Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / lib / index.js
1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
3 /******/        var __webpack_modules__ = ([
4 /* 0 */
5 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6
7 "use strict";
8
9 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10     if (k2 === undefined) k2 = k;
11     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12 }) : (function(o, m, k, k2) {
13     if (k2 === undefined) k2 = k;
14     o[k2] = m[k];
15 }));
16 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17     Object.defineProperty(o, "default", { enumerable: true, value: v });
18 }) : function(o, v) {
19     o["default"] = v;
20 });
21 var __importStar = (this && this.__importStar) || function (mod) {
22     if (mod && mod.__esModule) return mod;
23     var result = {};
24     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25     __setModuleDefault(result, mod);
26     return result;
27 };
28 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30     return new (P || (P = Promise))(function (resolve, reject) {
31         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34         step((generator = generator.apply(thisArg, _arguments || [])).next());
35     });
36 };
37 var __importDefault = (this && this.__importDefault) || function (mod) {
38     return (mod && mod.__esModule) ? mod : { "default": mod };
39 };
40 Object.defineProperty(exports, "__esModule", ({ value: true }));
41 exports.activate = void 0;
42 const coc_nvim_1 = __webpack_require__(1);
43 const vscode_languageserver_protocol_1 = __webpack_require__(2);
44 const configCacheHandler_1 = __importDefault(__webpack_require__(32));
45 const errorHandler_1 = __webpack_require__(34);
46 const ignoreFileHandler_1 = __importDefault(__webpack_require__(35));
47 const PrettierEditProvider_1 = __importStar(__webpack_require__(85));
48 const utils_1 = __webpack_require__(37);
49 let formatterHandler;
50 let rangeFormatterHandler;
51 /**
52  * Dispose formatters
53  */
54 function disposeHandlers() {
55     if (formatterHandler) {
56         formatterHandler.dispose();
57     }
58     if (rangeFormatterHandler) {
59         rangeFormatterHandler.dispose();
60     }
61     formatterHandler = undefined;
62     rangeFormatterHandler = undefined;
63 }
64 /**
65  * Build formatter selectors
66  */
67 function selectors(prettierInstance) {
68     let languageSelector = utils_1.enabledLanguages(prettierInstance).reduce((curr, language) => {
69         return curr.concat([
70             { language, scheme: 'file' },
71             { language, scheme: 'untitled' },
72         ]);
73     }, []);
74     let rangeLanguageSelector = utils_1.rangeLanguages().reduce((curr, language) => {
75         return curr.concat([
76             { language, scheme: 'file' },
77             { language, scheme: 'untitled' },
78         ]);
79     }, []);
80     return {
81         languageSelector,
82         rangeLanguageSelector,
83     };
84 }
85 function wait(ms) {
86     return new Promise(resolve => {
87         setTimeout(() => {
88             resolve();
89         }, ms);
90     });
91 }
92 function activate(context) {
93     return __awaiter(this, void 0, void 0, function* () {
94         context.subscriptions.push(errorHandler_1.setupErrorHandler());
95         const { fileIsIgnored } = ignoreFileHandler_1.default(context.subscriptions);
96         const editProvider = new PrettierEditProvider_1.default(fileIsIgnored);
97         const statusItem = coc_nvim_1.workspace.createStatusBarItem(0);
98         context.subscriptions.push(statusItem);
99         const config = coc_nvim_1.workspace.getConfiguration('prettier');
100         statusItem.text = config.get('statusItemText', 'Prettier');
101         let priority = config.get('formatterPriority', 1);
102         const prettierInstance = yield utils_1.getPrettierInstance();
103         if (!prettierInstance)
104             return;
105         function checkDocument() {
106             return __awaiter(this, void 0, void 0, function* () {
107                 yield wait(30);
108                 let doc = coc_nvim_1.workspace.getDocument(coc_nvim_1.workspace.bufnr);
109                 let languageIds = utils_1.enabledLanguages(prettierInstance);
110                 if (doc && languageIds.indexOf(doc.filetype) !== -1) {
111                     statusItem.show();
112                 }
113                 else {
114                     statusItem.hide();
115                 }
116             });
117         }
118         function registerFormatter() {
119             disposeHandlers();
120             const { languageSelector, rangeLanguageSelector } = selectors(prettierInstance);
121             rangeFormatterHandler = coc_nvim_1.languages.registerDocumentRangeFormatProvider(rangeLanguageSelector, editProvider, priority);
122             formatterHandler = coc_nvim_1.languages.registerDocumentFormatProvider(languageSelector, editProvider, priority);
123         }
124         registerFormatter();
125         checkDocument().catch(_e => {
126             // noop
127         });
128         coc_nvim_1.events.on('BufEnter', () => __awaiter(this, void 0, void 0, function* () {
129             yield checkDocument();
130         }), null, context.subscriptions);
131         context.subscriptions.push(configCacheHandler_1.default());
132         context.subscriptions.push(coc_nvim_1.commands.registerCommand('prettier.formatFile', () => __awaiter(this, void 0, void 0, function* () {
133             let document = yield coc_nvim_1.workspace.document;
134             let prettierConfig = coc_nvim_1.workspace.getConfiguration('prettier', document.uri);
135             let onlyUseLocalVersion = prettierConfig.get('onlyUseLocalVersion', false);
136             if (onlyUseLocalVersion &&
137                 (!utils_1.hasLocalPrettierInstalled(coc_nvim_1.Uri.parse(document.uri).fsPath) ||
138                     document.schema != 'file')) {
139                 coc_nvim_1.workspace.showMessage(`Flag prettier.onlyUseLocalVersion is set, but prettier is not installed locally. No operation will be made.`, 'warning');
140                 return;
141             }
142             let edits = yield PrettierEditProvider_1.format(document.content, document.textDocument, {}).then(code => {
143                 if (code == null)
144                     return null;
145                 return [vscode_languageserver_protocol_1.TextEdit.replace(PrettierEditProvider_1.fullDocumentRange(document.textDocument), code),];
146             });
147             if (edits && edits.length) {
148                 yield document.applyEdits(edits);
149             }
150         })));
151     });
152 }
153 exports.activate = activate;
154
155
156 /***/ }),
157 /* 1 */
158 /***/ ((module) => {
159
160 "use strict";
161 module.exports = require("coc.nvim");;
162
163 /***/ }),
164 /* 2 */
165 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
166
167 "use strict";
168 /* --------------------------------------------------------------------------------------------\r
169  * Copyright (c) Microsoft Corporation. All rights reserved.\r
170  * Licensed under the MIT License. See License.txt in the project root for license information.\r
171  * ------------------------------------------------------------------------------------------ */\r
172 \r
173 function __export(m) {\r
174     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
175 }\r
176 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
177 const vscode_jsonrpc_1 = __webpack_require__(3);\r
178 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
179 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
180 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
181 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
182 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
183 exports.Event = vscode_jsonrpc_1.Event;\r
184 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
185 exports.Trace = vscode_jsonrpc_1.Trace;\r
186 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
187 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
188 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
189 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
190 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
191 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
192 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
193 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
194 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
195 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
196 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
197 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
198 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
199 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
200 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
201 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
202 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
203 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
204 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
205 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
206 __export(__webpack_require__(17));\r
207 __export(__webpack_require__(18));\r
208 const callHierarchy = __webpack_require__(30);\r
209 const st = __webpack_require__(31);\r
210 var Proposed;\r
211 (function (Proposed) {\r
212     let CallHierarchyPrepareRequest;\r
213     (function (CallHierarchyPrepareRequest) {\r
214         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
215         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
216     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
217     let CallHierarchyIncomingCallsRequest;\r
218     (function (CallHierarchyIncomingCallsRequest) {\r
219         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
220         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
221     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
222     let CallHierarchyOutgoingCallsRequest;\r
223     (function (CallHierarchyOutgoingCallsRequest) {\r
224         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
225         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
226     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
227     Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
228     Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
229     Proposed.SemanticTokens = st.SemanticTokens;\r
230     let SemanticTokensRequest;\r
231     (function (SemanticTokensRequest) {\r
232         SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
233         SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
234     })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
235     let SemanticTokensEditsRequest;\r
236     (function (SemanticTokensEditsRequest) {\r
237         SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
238         SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
239     })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
240     let SemanticTokensRangeRequest;\r
241     (function (SemanticTokensRangeRequest) {\r
242         SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
243         SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
244     })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
245 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
246 function createProtocolConnection(reader, writer, logger, strategy) {\r
247     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
248 }\r
249 exports.createProtocolConnection = createProtocolConnection;\r
250
251
252 /***/ }),
253 /* 3 */
254 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
255
256 "use strict";
257 /* --------------------------------------------------------------------------------------------\r
258  * Copyright (c) Microsoft Corporation. All rights reserved.\r
259  * Licensed under the MIT License. See License.txt in the project root for license information.\r
260  * ------------------------------------------------------------------------------------------ */\r
261 /// <reference path="../typings/thenable.d.ts" />\r
262 \r
263 function __export(m) {\r
264     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
265 }\r
266 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
267 const Is = __webpack_require__(4);\r
268 const messages_1 = __webpack_require__(5);\r
269 exports.RequestType = messages_1.RequestType;\r
270 exports.RequestType0 = messages_1.RequestType0;\r
271 exports.RequestType1 = messages_1.RequestType1;\r
272 exports.RequestType2 = messages_1.RequestType2;\r
273 exports.RequestType3 = messages_1.RequestType3;\r
274 exports.RequestType4 = messages_1.RequestType4;\r
275 exports.RequestType5 = messages_1.RequestType5;\r
276 exports.RequestType6 = messages_1.RequestType6;\r
277 exports.RequestType7 = messages_1.RequestType7;\r
278 exports.RequestType8 = messages_1.RequestType8;\r
279 exports.RequestType9 = messages_1.RequestType9;\r
280 exports.ResponseError = messages_1.ResponseError;\r
281 exports.ErrorCodes = messages_1.ErrorCodes;\r
282 exports.NotificationType = messages_1.NotificationType;\r
283 exports.NotificationType0 = messages_1.NotificationType0;\r
284 exports.NotificationType1 = messages_1.NotificationType1;\r
285 exports.NotificationType2 = messages_1.NotificationType2;\r
286 exports.NotificationType3 = messages_1.NotificationType3;\r
287 exports.NotificationType4 = messages_1.NotificationType4;\r
288 exports.NotificationType5 = messages_1.NotificationType5;\r
289 exports.NotificationType6 = messages_1.NotificationType6;\r
290 exports.NotificationType7 = messages_1.NotificationType7;\r
291 exports.NotificationType8 = messages_1.NotificationType8;\r
292 exports.NotificationType9 = messages_1.NotificationType9;\r
293 const messageReader_1 = __webpack_require__(6);\r
294 exports.MessageReader = messageReader_1.MessageReader;\r
295 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
296 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
297 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
298 const messageWriter_1 = __webpack_require__(8);\r
299 exports.MessageWriter = messageWriter_1.MessageWriter;\r
300 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
301 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
302 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
303 const events_1 = __webpack_require__(7);\r
304 exports.Disposable = events_1.Disposable;\r
305 exports.Event = events_1.Event;\r
306 exports.Emitter = events_1.Emitter;\r
307 const cancellation_1 = __webpack_require__(9);\r
308 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
309 exports.CancellationToken = cancellation_1.CancellationToken;\r
310 const linkedMap_1 = __webpack_require__(10);\r
311 __export(__webpack_require__(11));\r
312 __export(__webpack_require__(16));\r
313 var CancelNotification;\r
314 (function (CancelNotification) {\r
315     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
316 })(CancelNotification || (CancelNotification = {}));\r
317 var ProgressNotification;\r
318 (function (ProgressNotification) {\r
319     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
320 })(ProgressNotification || (ProgressNotification = {}));\r
321 class ProgressType {\r
322     constructor() {\r
323     }\r
324 }\r
325 exports.ProgressType = ProgressType;\r
326 exports.NullLogger = Object.freeze({\r
327     error: () => { },\r
328     warn: () => { },\r
329     info: () => { },\r
330     log: () => { }\r
331 });\r
332 var Trace;\r
333 (function (Trace) {\r
334     Trace[Trace["Off"] = 0] = "Off";\r
335     Trace[Trace["Messages"] = 1] = "Messages";\r
336     Trace[Trace["Verbose"] = 2] = "Verbose";\r
337 })(Trace = exports.Trace || (exports.Trace = {}));\r
338 (function (Trace) {\r
339     function fromString(value) {\r
340         if (!Is.string(value)) {\r
341             return Trace.Off;\r
342         }\r
343         value = value.toLowerCase();\r
344         switch (value) {\r
345             case 'off':\r
346                 return Trace.Off;\r
347             case 'messages':\r
348                 return Trace.Messages;\r
349             case 'verbose':\r
350                 return Trace.Verbose;\r
351             default:\r
352                 return Trace.Off;\r
353         }\r
354     }\r
355     Trace.fromString = fromString;\r
356     function toString(value) {\r
357         switch (value) {\r
358             case Trace.Off:\r
359                 return 'off';\r
360             case Trace.Messages:\r
361                 return 'messages';\r
362             case Trace.Verbose:\r
363                 return 'verbose';\r
364             default:\r
365                 return 'off';\r
366         }\r
367     }\r
368     Trace.toString = toString;\r
369 })(Trace = exports.Trace || (exports.Trace = {}));\r
370 var TraceFormat;\r
371 (function (TraceFormat) {\r
372     TraceFormat["Text"] = "text";\r
373     TraceFormat["JSON"] = "json";\r
374 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
375 (function (TraceFormat) {\r
376     function fromString(value) {\r
377         value = value.toLowerCase();\r
378         if (value === 'json') {\r
379             return TraceFormat.JSON;\r
380         }\r
381         else {\r
382             return TraceFormat.Text;\r
383         }\r
384     }\r
385     TraceFormat.fromString = fromString;\r
386 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
387 var SetTraceNotification;\r
388 (function (SetTraceNotification) {\r
389     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
390 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
391 var LogTraceNotification;\r
392 (function (LogTraceNotification) {\r
393     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
394 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
395 var ConnectionErrors;\r
396 (function (ConnectionErrors) {\r
397     /**\r
398      * The connection is closed.\r
399      */\r
400     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
401     /**\r
402      * The connection got disposed.\r
403      */\r
404     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
405     /**\r
406      * The connection is already in listening mode.\r
407      */\r
408     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
409 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
410 class ConnectionError extends Error {\r
411     constructor(code, message) {\r
412         super(message);\r
413         this.code = code;\r
414         Object.setPrototypeOf(this, ConnectionError.prototype);\r
415     }\r
416 }\r
417 exports.ConnectionError = ConnectionError;\r
418 var ConnectionStrategy;\r
419 (function (ConnectionStrategy) {\r
420     function is(value) {\r
421         let candidate = value;\r
422         return candidate && Is.func(candidate.cancelUndispatched);\r
423     }\r
424     ConnectionStrategy.is = is;\r
425 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
426 var ConnectionState;\r
427 (function (ConnectionState) {\r
428     ConnectionState[ConnectionState["New"] = 1] = "New";\r
429     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
430     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
431     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
432 })(ConnectionState || (ConnectionState = {}));\r
433 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
434     let sequenceNumber = 0;\r
435     let notificationSquenceNumber = 0;\r
436     let unknownResponseSquenceNumber = 0;\r
437     const version = '2.0';\r
438     let starRequestHandler = undefined;\r
439     let requestHandlers = Object.create(null);\r
440     let starNotificationHandler = undefined;\r
441     let notificationHandlers = Object.create(null);\r
442     let progressHandlers = new Map();\r
443     let timer;\r
444     let messageQueue = new linkedMap_1.LinkedMap();\r
445     let responsePromises = Object.create(null);\r
446     let requestTokens = Object.create(null);\r
447     let trace = Trace.Off;\r
448     let traceFormat = TraceFormat.Text;\r
449     let tracer;\r
450     let state = ConnectionState.New;\r
451     let errorEmitter = new events_1.Emitter();\r
452     let closeEmitter = new events_1.Emitter();\r
453     let unhandledNotificationEmitter = new events_1.Emitter();\r
454     let unhandledProgressEmitter = new events_1.Emitter();\r
455     let disposeEmitter = new events_1.Emitter();\r
456     function createRequestQueueKey(id) {\r
457         return 'req-' + id.toString();\r
458     }\r
459     function createResponseQueueKey(id) {\r
460         if (id === null) {\r
461             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
462         }\r
463         else {\r
464             return 'res-' + id.toString();\r
465         }\r
466     }\r
467     function createNotificationQueueKey() {\r
468         return 'not-' + (++notificationSquenceNumber).toString();\r
469     }\r
470     function addMessageToQueue(queue, message) {\r
471         if (messages_1.isRequestMessage(message)) {\r
472             queue.set(createRequestQueueKey(message.id), message);\r
473         }\r
474         else if (messages_1.isResponseMessage(message)) {\r
475             queue.set(createResponseQueueKey(message.id), message);\r
476         }\r
477         else {\r
478             queue.set(createNotificationQueueKey(), message);\r
479         }\r
480     }\r
481     function cancelUndispatched(_message) {\r
482         return undefined;\r
483     }\r
484     function isListening() {\r
485         return state === ConnectionState.Listening;\r
486     }\r
487     function isClosed() {\r
488         return state === ConnectionState.Closed;\r
489     }\r
490     function isDisposed() {\r
491         return state === ConnectionState.Disposed;\r
492     }\r
493     function closeHandler() {\r
494         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
495             state = ConnectionState.Closed;\r
496             closeEmitter.fire(undefined);\r
497         }\r
498         // If the connection is disposed don't sent close events.\r
499     }\r
500     function readErrorHandler(error) {\r
501         errorEmitter.fire([error, undefined, undefined]);\r
502     }\r
503     function writeErrorHandler(data) {\r
504         errorEmitter.fire(data);\r
505     }\r
506     messageReader.onClose(closeHandler);\r
507     messageReader.onError(readErrorHandler);\r
508     messageWriter.onClose(closeHandler);\r
509     messageWriter.onError(writeErrorHandler);\r
510     function triggerMessageQueue() {\r
511         if (timer || messageQueue.size === 0) {\r
512             return;\r
513         }\r
514         timer = setImmediate(() => {\r
515             timer = undefined;\r
516             processMessageQueue();\r
517         });\r
518     }\r
519     function processMessageQueue() {\r
520         if (messageQueue.size === 0) {\r
521             return;\r
522         }\r
523         let message = messageQueue.shift();\r
524         try {\r
525             if (messages_1.isRequestMessage(message)) {\r
526                 handleRequest(message);\r
527             }\r
528             else if (messages_1.isNotificationMessage(message)) {\r
529                 handleNotification(message);\r
530             }\r
531             else if (messages_1.isResponseMessage(message)) {\r
532                 handleResponse(message);\r
533             }\r
534             else {\r
535                 handleInvalidMessage(message);\r
536             }\r
537         }\r
538         finally {\r
539             triggerMessageQueue();\r
540         }\r
541     }\r
542     let callback = (message) => {\r
543         try {\r
544             // We have received a cancellation message. Check if the message is still in the queue\r
545             // and cancel it if allowed to do so.\r
546             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
547                 let key = createRequestQueueKey(message.params.id);\r
548                 let toCancel = messageQueue.get(key);\r
549                 if (messages_1.isRequestMessage(toCancel)) {\r
550                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
551                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
552                         messageQueue.delete(key);\r
553                         response.id = toCancel.id;\r
554                         traceSendingResponse(response, message.method, Date.now());\r
555                         messageWriter.write(response);\r
556                         return;\r
557                     }\r
558                 }\r
559             }\r
560             addMessageToQueue(messageQueue, message);\r
561         }\r
562         finally {\r
563             triggerMessageQueue();\r
564         }\r
565     };\r
566     function handleRequest(requestMessage) {\r
567         if (isDisposed()) {\r
568             // we return here silently since we fired an event when the\r
569             // connection got disposed.\r
570             return;\r
571         }\r
572         function reply(resultOrError, method, startTime) {\r
573             let message = {\r
574                 jsonrpc: version,\r
575                 id: requestMessage.id\r
576             };\r
577             if (resultOrError instanceof messages_1.ResponseError) {\r
578                 message.error = resultOrError.toJson();\r
579             }\r
580             else {\r
581                 message.result = resultOrError === void 0 ? null : resultOrError;\r
582             }\r
583             traceSendingResponse(message, method, startTime);\r
584             messageWriter.write(message);\r
585         }\r
586         function replyError(error, method, startTime) {\r
587             let message = {\r
588                 jsonrpc: version,\r
589                 id: requestMessage.id,\r
590                 error: error.toJson()\r
591             };\r
592             traceSendingResponse(message, method, startTime);\r
593             messageWriter.write(message);\r
594         }\r
595         function replySuccess(result, method, startTime) {\r
596             // The JSON RPC defines that a response must either have a result or an error\r
597             // So we can't treat undefined as a valid response result.\r
598             if (result === void 0) {\r
599                 result = null;\r
600             }\r
601             let message = {\r
602                 jsonrpc: version,\r
603                 id: requestMessage.id,\r
604                 result: result\r
605             };\r
606             traceSendingResponse(message, method, startTime);\r
607             messageWriter.write(message);\r
608         }\r
609         traceReceivedRequest(requestMessage);\r
610         let element = requestHandlers[requestMessage.method];\r
611         let type;\r
612         let requestHandler;\r
613         if (element) {\r
614             type = element.type;\r
615             requestHandler = element.handler;\r
616         }\r
617         let startTime = Date.now();\r
618         if (requestHandler || starRequestHandler) {\r
619             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
620             let tokenKey = String(requestMessage.id);\r
621             requestTokens[tokenKey] = cancellationSource;\r
622             try {\r
623                 let handlerResult;\r
624                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
625                     handlerResult = requestHandler\r
626                         ? requestHandler(cancellationSource.token)\r
627                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
628                 }\r
629                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
630                     handlerResult = requestHandler\r
631                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
632                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
633                 }\r
634                 else {\r
635                     handlerResult = requestHandler\r
636                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
637                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
638                 }\r
639                 let promise = handlerResult;\r
640                 if (!handlerResult) {\r
641                     delete requestTokens[tokenKey];\r
642                     replySuccess(handlerResult, requestMessage.method, startTime);\r
643                 }\r
644                 else if (promise.then) {\r
645                     promise.then((resultOrError) => {\r
646                         delete requestTokens[tokenKey];\r
647                         reply(resultOrError, requestMessage.method, startTime);\r
648                     }, error => {\r
649                         delete requestTokens[tokenKey];\r
650                         if (error instanceof messages_1.ResponseError) {\r
651                             replyError(error, requestMessage.method, startTime);\r
652                         }\r
653                         else if (error && Is.string(error.message)) {\r
654                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
655                         }\r
656                         else {\r
657                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
658                         }\r
659                     });\r
660                 }\r
661                 else {\r
662                     delete requestTokens[tokenKey];\r
663                     reply(handlerResult, requestMessage.method, startTime);\r
664                 }\r
665             }\r
666             catch (error) {\r
667                 delete requestTokens[tokenKey];\r
668                 if (error instanceof messages_1.ResponseError) {\r
669                     reply(error, requestMessage.method, startTime);\r
670                 }\r
671                 else if (error && Is.string(error.message)) {\r
672                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
673                 }\r
674                 else {\r
675                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
676                 }\r
677             }\r
678         }\r
679         else {\r
680             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
681         }\r
682     }\r
683     function handleResponse(responseMessage) {\r
684         if (isDisposed()) {\r
685             // See handle request.\r
686             return;\r
687         }\r
688         if (responseMessage.id === null) {\r
689             if (responseMessage.error) {\r
690                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
691             }\r
692             else {\r
693                 logger.error(`Received response message without id. No further error information provided.`);\r
694             }\r
695         }\r
696         else {\r
697             let key = String(responseMessage.id);\r
698             let responsePromise = responsePromises[key];\r
699             traceReceivedResponse(responseMessage, responsePromise);\r
700             if (responsePromise) {\r
701                 delete responsePromises[key];\r
702                 try {\r
703                     if (responseMessage.error) {\r
704                         let error = responseMessage.error;\r
705                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
706                     }\r
707                     else if (responseMessage.result !== void 0) {\r
708                         responsePromise.resolve(responseMessage.result);\r
709                     }\r
710                     else {\r
711                         throw new Error('Should never happen.');\r
712                     }\r
713                 }\r
714                 catch (error) {\r
715                     if (error.message) {\r
716                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
717                     }\r
718                     else {\r
719                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
720                     }\r
721                 }\r
722             }\r
723         }\r
724     }\r
725     function handleNotification(message) {\r
726         if (isDisposed()) {\r
727             // See handle request.\r
728             return;\r
729         }\r
730         let type = undefined;\r
731         let notificationHandler;\r
732         if (message.method === CancelNotification.type.method) {\r
733             notificationHandler = (params) => {\r
734                 let id = params.id;\r
735                 let source = requestTokens[String(id)];\r
736                 if (source) {\r
737                     source.cancel();\r
738                 }\r
739             };\r
740         }\r
741         else {\r
742             let element = notificationHandlers[message.method];\r
743             if (element) {\r
744                 notificationHandler = element.handler;\r
745                 type = element.type;\r
746             }\r
747         }\r
748         if (notificationHandler || starNotificationHandler) {\r
749             try {\r
750                 traceReceivedNotification(message);\r
751                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
752                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
753                 }\r
754                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
755                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
756                 }\r
757                 else {\r
758                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
759                 }\r
760             }\r
761             catch (error) {\r
762                 if (error.message) {\r
763                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
764                 }\r
765                 else {\r
766                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
767                 }\r
768             }\r
769         }\r
770         else {\r
771             unhandledNotificationEmitter.fire(message);\r
772         }\r
773     }\r
774     function handleInvalidMessage(message) {\r
775         if (!message) {\r
776             logger.error('Received empty message.');\r
777             return;\r
778         }\r
779         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
780         // Test whether we find an id to reject the promise\r
781         let responseMessage = message;\r
782         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
783             let key = String(responseMessage.id);\r
784             let responseHandler = responsePromises[key];\r
785             if (responseHandler) {\r
786                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
787             }\r
788         }\r
789     }\r
790     function traceSendingRequest(message) {\r
791         if (trace === Trace.Off || !tracer) {\r
792             return;\r
793         }\r
794         if (traceFormat === TraceFormat.Text) {\r
795             let data = undefined;\r
796             if (trace === Trace.Verbose && message.params) {\r
797                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
798             }\r
799             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
800         }\r
801         else {\r
802             logLSPMessage('send-request', message);\r
803         }\r
804     }\r
805     function traceSendingNotification(message) {\r
806         if (trace === Trace.Off || !tracer) {\r
807             return;\r
808         }\r
809         if (traceFormat === TraceFormat.Text) {\r
810             let data = undefined;\r
811             if (trace === Trace.Verbose) {\r
812                 if (message.params) {\r
813                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
814                 }\r
815                 else {\r
816                     data = 'No parameters provided.\n\n';\r
817                 }\r
818             }\r
819             tracer.log(`Sending notification '${message.method}'.`, data);\r
820         }\r
821         else {\r
822             logLSPMessage('send-notification', message);\r
823         }\r
824     }\r
825     function traceSendingResponse(message, method, startTime) {\r
826         if (trace === Trace.Off || !tracer) {\r
827             return;\r
828         }\r
829         if (traceFormat === TraceFormat.Text) {\r
830             let data = undefined;\r
831             if (trace === Trace.Verbose) {\r
832                 if (message.error && message.error.data) {\r
833                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
834                 }\r
835                 else {\r
836                     if (message.result) {\r
837                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
838                     }\r
839                     else if (message.error === void 0) {\r
840                         data = 'No result returned.\n\n';\r
841                     }\r
842                 }\r
843             }\r
844             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
845         }\r
846         else {\r
847             logLSPMessage('send-response', message);\r
848         }\r
849     }\r
850     function traceReceivedRequest(message) {\r
851         if (trace === Trace.Off || !tracer) {\r
852             return;\r
853         }\r
854         if (traceFormat === TraceFormat.Text) {\r
855             let data = undefined;\r
856             if (trace === Trace.Verbose && message.params) {\r
857                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
858             }\r
859             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
860         }\r
861         else {\r
862             logLSPMessage('receive-request', message);\r
863         }\r
864     }\r
865     function traceReceivedNotification(message) {\r
866         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
867             return;\r
868         }\r
869         if (traceFormat === TraceFormat.Text) {\r
870             let data = undefined;\r
871             if (trace === Trace.Verbose) {\r
872                 if (message.params) {\r
873                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
874                 }\r
875                 else {\r
876                     data = 'No parameters provided.\n\n';\r
877                 }\r
878             }\r
879             tracer.log(`Received notification '${message.method}'.`, data);\r
880         }\r
881         else {\r
882             logLSPMessage('receive-notification', message);\r
883         }\r
884     }\r
885     function traceReceivedResponse(message, responsePromise) {\r
886         if (trace === Trace.Off || !tracer) {\r
887             return;\r
888         }\r
889         if (traceFormat === TraceFormat.Text) {\r
890             let data = undefined;\r
891             if (trace === Trace.Verbose) {\r
892                 if (message.error && message.error.data) {\r
893                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
894                 }\r
895                 else {\r
896                     if (message.result) {\r
897                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
898                     }\r
899                     else if (message.error === void 0) {\r
900                         data = 'No result returned.\n\n';\r
901                     }\r
902                 }\r
903             }\r
904             if (responsePromise) {\r
905                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
906                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
907             }\r
908             else {\r
909                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
910             }\r
911         }\r
912         else {\r
913             logLSPMessage('receive-response', message);\r
914         }\r
915     }\r
916     function logLSPMessage(type, message) {\r
917         if (!tracer || trace === Trace.Off) {\r
918             return;\r
919         }\r
920         const lspMessage = {\r
921             isLSPMessage: true,\r
922             type,\r
923             message,\r
924             timestamp: Date.now()\r
925         };\r
926         tracer.log(lspMessage);\r
927     }\r
928     function throwIfClosedOrDisposed() {\r
929         if (isClosed()) {\r
930             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
931         }\r
932         if (isDisposed()) {\r
933             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
934         }\r
935     }\r
936     function throwIfListening() {\r
937         if (isListening()) {\r
938             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
939         }\r
940     }\r
941     function throwIfNotListening() {\r
942         if (!isListening()) {\r
943             throw new Error('Call listen() first.');\r
944         }\r
945     }\r
946     function undefinedToNull(param) {\r
947         if (param === void 0) {\r
948             return null;\r
949         }\r
950         else {\r
951             return param;\r
952         }\r
953     }\r
954     function computeMessageParams(type, params) {\r
955         let result;\r
956         let numberOfParams = type.numberOfParams;\r
957         switch (numberOfParams) {\r
958             case 0:\r
959                 result = null;\r
960                 break;\r
961             case 1:\r
962                 result = undefinedToNull(params[0]);\r
963                 break;\r
964             default:\r
965                 result = [];\r
966                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
967                     result.push(undefinedToNull(params[i]));\r
968                 }\r
969                 if (params.length < numberOfParams) {\r
970                     for (let i = params.length; i < numberOfParams; i++) {\r
971                         result.push(null);\r
972                     }\r
973                 }\r
974                 break;\r
975         }\r
976         return result;\r
977     }\r
978     let connection = {\r
979         sendNotification: (type, ...params) => {\r
980             throwIfClosedOrDisposed();\r
981             let method;\r
982             let messageParams;\r
983             if (Is.string(type)) {\r
984                 method = type;\r
985                 switch (params.length) {\r
986                     case 0:\r
987                         messageParams = null;\r
988                         break;\r
989                     case 1:\r
990                         messageParams = params[0];\r
991                         break;\r
992                     default:\r
993                         messageParams = params;\r
994                         break;\r
995                 }\r
996             }\r
997             else {\r
998                 method = type.method;\r
999                 messageParams = computeMessageParams(type, params);\r
1000             }\r
1001             let notificationMessage = {\r
1002                 jsonrpc: version,\r
1003                 method: method,\r
1004                 params: messageParams\r
1005             };\r
1006             traceSendingNotification(notificationMessage);\r
1007             messageWriter.write(notificationMessage);\r
1008         },\r
1009         onNotification: (type, handler) => {\r
1010             throwIfClosedOrDisposed();\r
1011             if (Is.func(type)) {\r
1012                 starNotificationHandler = type;\r
1013             }\r
1014             else if (handler) {\r
1015                 if (Is.string(type)) {\r
1016                     notificationHandlers[type] = { type: undefined, handler };\r
1017                 }\r
1018                 else {\r
1019                     notificationHandlers[type.method] = { type, handler };\r
1020                 }\r
1021             }\r
1022         },\r
1023         onProgress: (_type, token, handler) => {\r
1024             if (progressHandlers.has(token)) {\r
1025                 throw new Error(`Progress handler for token ${token} already registered`);\r
1026             }\r
1027             progressHandlers.set(token, handler);\r
1028             return {\r
1029                 dispose: () => {\r
1030                     progressHandlers.delete(token);\r
1031                 }\r
1032             };\r
1033         },\r
1034         sendProgress: (_type, token, value) => {\r
1035             connection.sendNotification(ProgressNotification.type, { token, value });\r
1036         },\r
1037         onUnhandledProgress: unhandledProgressEmitter.event,\r
1038         sendRequest: (type, ...params) => {\r
1039             throwIfClosedOrDisposed();\r
1040             throwIfNotListening();\r
1041             let method;\r
1042             let messageParams;\r
1043             let token = undefined;\r
1044             if (Is.string(type)) {\r
1045                 method = type;\r
1046                 switch (params.length) {\r
1047                     case 0:\r
1048                         messageParams = null;\r
1049                         break;\r
1050                     case 1:\r
1051                         // The cancellation token is optional so it can also be undefined.\r
1052                         if (cancellation_1.CancellationToken.is(params[0])) {\r
1053                             messageParams = null;\r
1054                             token = params[0];\r
1055                         }\r
1056                         else {\r
1057                             messageParams = undefinedToNull(params[0]);\r
1058                         }\r
1059                         break;\r
1060                     default:\r
1061                         const last = params.length - 1;\r
1062                         if (cancellation_1.CancellationToken.is(params[last])) {\r
1063                             token = params[last];\r
1064                             if (params.length === 2) {\r
1065                                 messageParams = undefinedToNull(params[0]);\r
1066                             }\r
1067                             else {\r
1068                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
1069                             }\r
1070                         }\r
1071                         else {\r
1072                             messageParams = params.map(value => undefinedToNull(value));\r
1073                         }\r
1074                         break;\r
1075                 }\r
1076             }\r
1077             else {\r
1078                 method = type.method;\r
1079                 messageParams = computeMessageParams(type, params);\r
1080                 let numberOfParams = type.numberOfParams;\r
1081                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
1082             }\r
1083             let id = sequenceNumber++;\r
1084             let result = new Promise((resolve, reject) => {\r
1085                 let requestMessage = {\r
1086                     jsonrpc: version,\r
1087                     id: id,\r
1088                     method: method,\r
1089                     params: messageParams\r
1090                 };\r
1091                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
1092                 traceSendingRequest(requestMessage);\r
1093                 try {\r
1094                     messageWriter.write(requestMessage);\r
1095                 }\r
1096                 catch (e) {\r
1097                     // Writing the message failed. So we need to reject the promise.\r
1098                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
1099                     responsePromise = null;\r
1100                 }\r
1101                 if (responsePromise) {\r
1102                     responsePromises[String(id)] = responsePromise;\r
1103                 }\r
1104             });\r
1105             if (token) {\r
1106                 token.onCancellationRequested(() => {\r
1107                     connection.sendNotification(CancelNotification.type, { id });\r
1108                 });\r
1109             }\r
1110             return result;\r
1111         },\r
1112         onRequest: (type, handler) => {\r
1113             throwIfClosedOrDisposed();\r
1114             if (Is.func(type)) {\r
1115                 starRequestHandler = type;\r
1116             }\r
1117             else if (handler) {\r
1118                 if (Is.string(type)) {\r
1119                     requestHandlers[type] = { type: undefined, handler };\r
1120                 }\r
1121                 else {\r
1122                     requestHandlers[type.method] = { type, handler };\r
1123                 }\r
1124             }\r
1125         },\r
1126         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
1127             let _sendNotification = false;\r
1128             let _traceFormat = TraceFormat.Text;\r
1129             if (sendNotificationOrTraceOptions !== void 0) {\r
1130                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
1131                     _sendNotification = sendNotificationOrTraceOptions;\r
1132                 }\r
1133                 else {\r
1134                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
1135                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
1136                 }\r
1137             }\r
1138             trace = _value;\r
1139             traceFormat = _traceFormat;\r
1140             if (trace === Trace.Off) {\r
1141                 tracer = undefined;\r
1142             }\r
1143             else {\r
1144                 tracer = _tracer;\r
1145             }\r
1146             if (_sendNotification && !isClosed() && !isDisposed()) {\r
1147                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
1148             }\r
1149         },\r
1150         onError: errorEmitter.event,\r
1151         onClose: closeEmitter.event,\r
1152         onUnhandledNotification: unhandledNotificationEmitter.event,\r
1153         onDispose: disposeEmitter.event,\r
1154         dispose: () => {\r
1155             if (isDisposed()) {\r
1156                 return;\r
1157             }\r
1158             state = ConnectionState.Disposed;\r
1159             disposeEmitter.fire(undefined);\r
1160             let error = new Error('Connection got disposed.');\r
1161             Object.keys(responsePromises).forEach((key) => {\r
1162                 responsePromises[key].reject(error);\r
1163             });\r
1164             responsePromises = Object.create(null);\r
1165             requestTokens = Object.create(null);\r
1166             messageQueue = new linkedMap_1.LinkedMap();\r
1167             // Test for backwards compatibility\r
1168             if (Is.func(messageWriter.dispose)) {\r
1169                 messageWriter.dispose();\r
1170             }\r
1171             if (Is.func(messageReader.dispose)) {\r
1172                 messageReader.dispose();\r
1173             }\r
1174         },\r
1175         listen: () => {\r
1176             throwIfClosedOrDisposed();\r
1177             throwIfListening();\r
1178             state = ConnectionState.Listening;\r
1179             messageReader.listen(callback);\r
1180         },\r
1181         inspect: () => {\r
1182             // eslint-disable-next-line no-console\r
1183             console.log('inspect');\r
1184         }\r
1185     };\r
1186     connection.onNotification(LogTraceNotification.type, (params) => {\r
1187         if (trace === Trace.Off || !tracer) {\r
1188             return;\r
1189         }\r
1190         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
1191     });\r
1192     connection.onNotification(ProgressNotification.type, (params) => {\r
1193         const handler = progressHandlers.get(params.token);\r
1194         if (handler) {\r
1195             handler(params.value);\r
1196         }\r
1197         else {\r
1198             unhandledProgressEmitter.fire(params);\r
1199         }\r
1200     });\r
1201     return connection;\r
1202 }\r
1203 function isMessageReader(value) {\r
1204     return value.listen !== void 0 && value.read === void 0;\r
1205 }\r
1206 function isMessageWriter(value) {\r
1207     return value.write !== void 0 && value.end === void 0;\r
1208 }\r
1209 function createMessageConnection(input, output, logger, strategy) {\r
1210     if (!logger) {\r
1211         logger = exports.NullLogger;\r
1212     }\r
1213     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
1214     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
1215     return _createMessageConnection(reader, writer, logger, strategy);\r
1216 }\r
1217 exports.createMessageConnection = createMessageConnection;\r
1218
1219
1220 /***/ }),
1221 /* 4 */
1222 /***/ ((__unused_webpack_module, exports) => {
1223
1224 "use strict";
1225 /* --------------------------------------------------------------------------------------------\r
1226  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1227  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1228  * ------------------------------------------------------------------------------------------ */\r
1229 \r
1230 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1231 function boolean(value) {\r
1232     return value === true || value === false;\r
1233 }\r
1234 exports.boolean = boolean;\r
1235 function string(value) {\r
1236     return typeof value === 'string' || value instanceof String;\r
1237 }\r
1238 exports.string = string;\r
1239 function number(value) {\r
1240     return typeof value === 'number' || value instanceof Number;\r
1241 }\r
1242 exports.number = number;\r
1243 function error(value) {\r
1244     return value instanceof Error;\r
1245 }\r
1246 exports.error = error;\r
1247 function func(value) {\r
1248     return typeof value === 'function';\r
1249 }\r
1250 exports.func = func;\r
1251 function array(value) {\r
1252     return Array.isArray(value);\r
1253 }\r
1254 exports.array = array;\r
1255 function stringArray(value) {\r
1256     return array(value) && value.every(elem => string(elem));\r
1257 }\r
1258 exports.stringArray = stringArray;\r
1259
1260
1261 /***/ }),
1262 /* 5 */
1263 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1264
1265 "use strict";
1266 /* --------------------------------------------------------------------------------------------\r
1267  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1268  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1269  * ------------------------------------------------------------------------------------------ */\r
1270 \r
1271 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1272 const is = __webpack_require__(4);\r
1273 /**\r
1274  * Predefined error codes.\r
1275  */\r
1276 var ErrorCodes;\r
1277 (function (ErrorCodes) {\r
1278     // Defined by JSON RPC\r
1279     ErrorCodes.ParseError = -32700;\r
1280     ErrorCodes.InvalidRequest = -32600;\r
1281     ErrorCodes.MethodNotFound = -32601;\r
1282     ErrorCodes.InvalidParams = -32602;\r
1283     ErrorCodes.InternalError = -32603;\r
1284     ErrorCodes.serverErrorStart = -32099;\r
1285     ErrorCodes.serverErrorEnd = -32000;\r
1286     ErrorCodes.ServerNotInitialized = -32002;\r
1287     ErrorCodes.UnknownErrorCode = -32001;\r
1288     // Defined by the protocol.\r
1289     ErrorCodes.RequestCancelled = -32800;\r
1290     ErrorCodes.ContentModified = -32801;\r
1291     // Defined by VSCode library.\r
1292     ErrorCodes.MessageWriteError = 1;\r
1293     ErrorCodes.MessageReadError = 2;\r
1294 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
1295 /**\r
1296  * An error object return in a response in case a request\r
1297  * has failed.\r
1298  */\r
1299 class ResponseError extends Error {\r
1300     constructor(code, message, data) {\r
1301         super(message);\r
1302         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
1303         this.data = data;\r
1304         Object.setPrototypeOf(this, ResponseError.prototype);\r
1305     }\r
1306     toJson() {\r
1307         return {\r
1308             code: this.code,\r
1309             message: this.message,\r
1310             data: this.data,\r
1311         };\r
1312     }\r
1313 }\r
1314 exports.ResponseError = ResponseError;\r
1315 /**\r
1316  * An abstract implementation of a MessageType.\r
1317  */\r
1318 class AbstractMessageType {\r
1319     constructor(_method, _numberOfParams) {\r
1320         this._method = _method;\r
1321         this._numberOfParams = _numberOfParams;\r
1322     }\r
1323     get method() {\r
1324         return this._method;\r
1325     }\r
1326     get numberOfParams() {\r
1327         return this._numberOfParams;\r
1328     }\r
1329 }\r
1330 exports.AbstractMessageType = AbstractMessageType;\r
1331 /**\r
1332  * Classes to type request response pairs\r
1333  *\r
1334  * The type parameter RO will be removed in the next major version\r
1335  * of the JSON RPC library since it is a LSP concept and doesn't\r
1336  * belong here. For now it is tagged as default never.\r
1337  */\r
1338 class RequestType0 extends AbstractMessageType {\r
1339     constructor(method) {\r
1340         super(method, 0);\r
1341     }\r
1342 }\r
1343 exports.RequestType0 = RequestType0;\r
1344 class RequestType extends AbstractMessageType {\r
1345     constructor(method) {\r
1346         super(method, 1);\r
1347     }\r
1348 }\r
1349 exports.RequestType = RequestType;\r
1350 class RequestType1 extends AbstractMessageType {\r
1351     constructor(method) {\r
1352         super(method, 1);\r
1353     }\r
1354 }\r
1355 exports.RequestType1 = RequestType1;\r
1356 class RequestType2 extends AbstractMessageType {\r
1357     constructor(method) {\r
1358         super(method, 2);\r
1359     }\r
1360 }\r
1361 exports.RequestType2 = RequestType2;\r
1362 class RequestType3 extends AbstractMessageType {\r
1363     constructor(method) {\r
1364         super(method, 3);\r
1365     }\r
1366 }\r
1367 exports.RequestType3 = RequestType3;\r
1368 class RequestType4 extends AbstractMessageType {\r
1369     constructor(method) {\r
1370         super(method, 4);\r
1371     }\r
1372 }\r
1373 exports.RequestType4 = RequestType4;\r
1374 class RequestType5 extends AbstractMessageType {\r
1375     constructor(method) {\r
1376         super(method, 5);\r
1377     }\r
1378 }\r
1379 exports.RequestType5 = RequestType5;\r
1380 class RequestType6 extends AbstractMessageType {\r
1381     constructor(method) {\r
1382         super(method, 6);\r
1383     }\r
1384 }\r
1385 exports.RequestType6 = RequestType6;\r
1386 class RequestType7 extends AbstractMessageType {\r
1387     constructor(method) {\r
1388         super(method, 7);\r
1389     }\r
1390 }\r
1391 exports.RequestType7 = RequestType7;\r
1392 class RequestType8 extends AbstractMessageType {\r
1393     constructor(method) {\r
1394         super(method, 8);\r
1395     }\r
1396 }\r
1397 exports.RequestType8 = RequestType8;\r
1398 class RequestType9 extends AbstractMessageType {\r
1399     constructor(method) {\r
1400         super(method, 9);\r
1401     }\r
1402 }\r
1403 exports.RequestType9 = RequestType9;\r
1404 /**\r
1405  * The type parameter RO will be removed in the next major version\r
1406  * of the JSON RPC library since it is a LSP concept and doesn't\r
1407  * belong here. For now it is tagged as default never.\r
1408  */\r
1409 class NotificationType extends AbstractMessageType {\r
1410     constructor(method) {\r
1411         super(method, 1);\r
1412         this._ = undefined;\r
1413     }\r
1414 }\r
1415 exports.NotificationType = NotificationType;\r
1416 class NotificationType0 extends AbstractMessageType {\r
1417     constructor(method) {\r
1418         super(method, 0);\r
1419     }\r
1420 }\r
1421 exports.NotificationType0 = NotificationType0;\r
1422 class NotificationType1 extends AbstractMessageType {\r
1423     constructor(method) {\r
1424         super(method, 1);\r
1425     }\r
1426 }\r
1427 exports.NotificationType1 = NotificationType1;\r
1428 class NotificationType2 extends AbstractMessageType {\r
1429     constructor(method) {\r
1430         super(method, 2);\r
1431     }\r
1432 }\r
1433 exports.NotificationType2 = NotificationType2;\r
1434 class NotificationType3 extends AbstractMessageType {\r
1435     constructor(method) {\r
1436         super(method, 3);\r
1437     }\r
1438 }\r
1439 exports.NotificationType3 = NotificationType3;\r
1440 class NotificationType4 extends AbstractMessageType {\r
1441     constructor(method) {\r
1442         super(method, 4);\r
1443     }\r
1444 }\r
1445 exports.NotificationType4 = NotificationType4;\r
1446 class NotificationType5 extends AbstractMessageType {\r
1447     constructor(method) {\r
1448         super(method, 5);\r
1449     }\r
1450 }\r
1451 exports.NotificationType5 = NotificationType5;\r
1452 class NotificationType6 extends AbstractMessageType {\r
1453     constructor(method) {\r
1454         super(method, 6);\r
1455     }\r
1456 }\r
1457 exports.NotificationType6 = NotificationType6;\r
1458 class NotificationType7 extends AbstractMessageType {\r
1459     constructor(method) {\r
1460         super(method, 7);\r
1461     }\r
1462 }\r
1463 exports.NotificationType7 = NotificationType7;\r
1464 class NotificationType8 extends AbstractMessageType {\r
1465     constructor(method) {\r
1466         super(method, 8);\r
1467     }\r
1468 }\r
1469 exports.NotificationType8 = NotificationType8;\r
1470 class NotificationType9 extends AbstractMessageType {\r
1471     constructor(method) {\r
1472         super(method, 9);\r
1473     }\r
1474 }\r
1475 exports.NotificationType9 = NotificationType9;\r
1476 /**\r
1477  * Tests if the given message is a request message\r
1478  */\r
1479 function isRequestMessage(message) {\r
1480     let candidate = message;\r
1481     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
1482 }\r
1483 exports.isRequestMessage = isRequestMessage;\r
1484 /**\r
1485  * Tests if the given message is a notification message\r
1486  */\r
1487 function isNotificationMessage(message) {\r
1488     let candidate = message;\r
1489     return candidate && is.string(candidate.method) && message.id === void 0;\r
1490 }\r
1491 exports.isNotificationMessage = isNotificationMessage;\r
1492 /**\r
1493  * Tests if the given message is a response message\r
1494  */\r
1495 function isResponseMessage(message) {\r
1496     let candidate = message;\r
1497     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
1498 }\r
1499 exports.isResponseMessage = isResponseMessage;\r
1500
1501
1502 /***/ }),
1503 /* 6 */
1504 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1505
1506 "use strict";
1507 /* --------------------------------------------------------------------------------------------\r
1508  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1509  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1510  * ------------------------------------------------------------------------------------------ */\r
1511 \r
1512 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1513 const events_1 = __webpack_require__(7);\r
1514 const Is = __webpack_require__(4);\r
1515 let DefaultSize = 8192;\r
1516 let CR = Buffer.from('\r', 'ascii')[0];\r
1517 let LF = Buffer.from('\n', 'ascii')[0];\r
1518 let CRLF = '\r\n';\r
1519 class MessageBuffer {\r
1520     constructor(encoding = 'utf8') {\r
1521         this.encoding = encoding;\r
1522         this.index = 0;\r
1523         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
1524     }\r
1525     append(chunk) {\r
1526         var toAppend = chunk;\r
1527         if (typeof (chunk) === 'string') {\r
1528             var str = chunk;\r
1529             var bufferLen = Buffer.byteLength(str, this.encoding);\r
1530             toAppend = Buffer.allocUnsafe(bufferLen);\r
1531             toAppend.write(str, 0, bufferLen, this.encoding);\r
1532         }\r
1533         if (this.buffer.length - this.index >= toAppend.length) {\r
1534             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
1535         }\r
1536         else {\r
1537             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
1538             if (this.index === 0) {\r
1539                 this.buffer = Buffer.allocUnsafe(newSize);\r
1540                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
1541             }\r
1542             else {\r
1543                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
1544             }\r
1545         }\r
1546         this.index += toAppend.length;\r
1547     }\r
1548     tryReadHeaders() {\r
1549         let result = undefined;\r
1550         let current = 0;\r
1551         while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {\r
1552             current++;\r
1553         }\r
1554         // No header / body separator found (e.g CRLFCRLF)\r
1555         if (current + 3 >= this.index) {\r
1556             return result;\r
1557         }\r
1558         result = Object.create(null);\r
1559         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
1560         headers.forEach((header) => {\r
1561             let index = header.indexOf(':');\r
1562             if (index === -1) {\r
1563                 throw new Error('Message header must separate key and value using :');\r
1564             }\r
1565             let key = header.substr(0, index);\r
1566             let value = header.substr(index + 1).trim();\r
1567             result[key] = value;\r
1568         });\r
1569         let nextStart = current + 4;\r
1570         this.buffer = this.buffer.slice(nextStart);\r
1571         this.index = this.index - nextStart;\r
1572         return result;\r
1573     }\r
1574     tryReadContent(length) {\r
1575         if (this.index < length) {\r
1576             return null;\r
1577         }\r
1578         let result = this.buffer.toString(this.encoding, 0, length);\r
1579         let nextStart = length;\r
1580         this.buffer.copy(this.buffer, 0, nextStart);\r
1581         this.index = this.index - nextStart;\r
1582         return result;\r
1583     }\r
1584     get numberOfBytes() {\r
1585         return this.index;\r
1586     }\r
1587 }\r
1588 var MessageReader;\r
1589 (function (MessageReader) {\r
1590     function is(value) {\r
1591         let candidate = value;\r
1592         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
1593             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
1594     }\r
1595     MessageReader.is = is;\r
1596 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
1597 class AbstractMessageReader {\r
1598     constructor() {\r
1599         this.errorEmitter = new events_1.Emitter();\r
1600         this.closeEmitter = new events_1.Emitter();\r
1601         this.partialMessageEmitter = new events_1.Emitter();\r
1602     }\r
1603     dispose() {\r
1604         this.errorEmitter.dispose();\r
1605         this.closeEmitter.dispose();\r
1606     }\r
1607     get onError() {\r
1608         return this.errorEmitter.event;\r
1609     }\r
1610     fireError(error) {\r
1611         this.errorEmitter.fire(this.asError(error));\r
1612     }\r
1613     get onClose() {\r
1614         return this.closeEmitter.event;\r
1615     }\r
1616     fireClose() {\r
1617         this.closeEmitter.fire(undefined);\r
1618     }\r
1619     get onPartialMessage() {\r
1620         return this.partialMessageEmitter.event;\r
1621     }\r
1622     firePartialMessage(info) {\r
1623         this.partialMessageEmitter.fire(info);\r
1624     }\r
1625     asError(error) {\r
1626         if (error instanceof Error) {\r
1627             return error;\r
1628         }\r
1629         else {\r
1630             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1631         }\r
1632     }\r
1633 }\r
1634 exports.AbstractMessageReader = AbstractMessageReader;\r
1635 class StreamMessageReader extends AbstractMessageReader {\r
1636     constructor(readable, encoding = 'utf8') {\r
1637         super();\r
1638         this.readable = readable;\r
1639         this.buffer = new MessageBuffer(encoding);\r
1640         this._partialMessageTimeout = 10000;\r
1641     }\r
1642     set partialMessageTimeout(timeout) {\r
1643         this._partialMessageTimeout = timeout;\r
1644     }\r
1645     get partialMessageTimeout() {\r
1646         return this._partialMessageTimeout;\r
1647     }\r
1648     listen(callback) {\r
1649         this.nextMessageLength = -1;\r
1650         this.messageToken = 0;\r
1651         this.partialMessageTimer = undefined;\r
1652         this.callback = callback;\r
1653         this.readable.on('data', (data) => {\r
1654             this.onData(data);\r
1655         });\r
1656         this.readable.on('error', (error) => this.fireError(error));\r
1657         this.readable.on('close', () => this.fireClose());\r
1658     }\r
1659     onData(data) {\r
1660         this.buffer.append(data);\r
1661         while (true) {\r
1662             if (this.nextMessageLength === -1) {\r
1663                 let headers = this.buffer.tryReadHeaders();\r
1664                 if (!headers) {\r
1665                     return;\r
1666                 }\r
1667                 let contentLength = headers['Content-Length'];\r
1668                 if (!contentLength) {\r
1669                     throw new Error('Header must provide a Content-Length property.');\r
1670                 }\r
1671                 let length = parseInt(contentLength);\r
1672                 if (isNaN(length)) {\r
1673                     throw new Error('Content-Length value must be a number.');\r
1674                 }\r
1675                 this.nextMessageLength = length;\r
1676                 // Take the encoding form the header. For compatibility\r
1677                 // treat both utf-8 and utf8 as node utf8\r
1678             }\r
1679             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
1680             if (msg === null) {\r
1681                 /** We haven't received the full message yet. */\r
1682                 this.setPartialMessageTimer();\r
1683                 return;\r
1684             }\r
1685             this.clearPartialMessageTimer();\r
1686             this.nextMessageLength = -1;\r
1687             this.messageToken++;\r
1688             var json = JSON.parse(msg);\r
1689             this.callback(json);\r
1690         }\r
1691     }\r
1692     clearPartialMessageTimer() {\r
1693         if (this.partialMessageTimer) {\r
1694             clearTimeout(this.partialMessageTimer);\r
1695             this.partialMessageTimer = undefined;\r
1696         }\r
1697     }\r
1698     setPartialMessageTimer() {\r
1699         this.clearPartialMessageTimer();\r
1700         if (this._partialMessageTimeout <= 0) {\r
1701             return;\r
1702         }\r
1703         this.partialMessageTimer = setTimeout((token, timeout) => {\r
1704             this.partialMessageTimer = undefined;\r
1705             if (token === this.messageToken) {\r
1706                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
1707                 this.setPartialMessageTimer();\r
1708             }\r
1709         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
1710     }\r
1711 }\r
1712 exports.StreamMessageReader = StreamMessageReader;\r
1713 class IPCMessageReader extends AbstractMessageReader {\r
1714     constructor(process) {\r
1715         super();\r
1716         this.process = process;\r
1717         let eventEmitter = this.process;\r
1718         eventEmitter.on('error', (error) => this.fireError(error));\r
1719         eventEmitter.on('close', () => this.fireClose());\r
1720     }\r
1721     listen(callback) {\r
1722         this.process.on('message', callback);\r
1723     }\r
1724 }\r
1725 exports.IPCMessageReader = IPCMessageReader;\r
1726 class SocketMessageReader extends StreamMessageReader {\r
1727     constructor(socket, encoding = 'utf-8') {\r
1728         super(socket, encoding);\r
1729     }\r
1730 }\r
1731 exports.SocketMessageReader = SocketMessageReader;\r
1732
1733
1734 /***/ }),
1735 /* 7 */
1736 /***/ ((__unused_webpack_module, exports) => {
1737
1738 "use strict";
1739 /* --------------------------------------------------------------------------------------------\r
1740  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1741  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1742  * ------------------------------------------------------------------------------------------ */\r
1743 \r
1744 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1745 var Disposable;\r
1746 (function (Disposable) {\r
1747     function create(func) {\r
1748         return {\r
1749             dispose: func\r
1750         };\r
1751     }\r
1752     Disposable.create = create;\r
1753 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
1754 var Event;\r
1755 (function (Event) {\r
1756     const _disposable = { dispose() { } };\r
1757     Event.None = function () { return _disposable; };\r
1758 })(Event = exports.Event || (exports.Event = {}));\r
1759 class CallbackList {\r
1760     add(callback, context = null, bucket) {\r
1761         if (!this._callbacks) {\r
1762             this._callbacks = [];\r
1763             this._contexts = [];\r
1764         }\r
1765         this._callbacks.push(callback);\r
1766         this._contexts.push(context);\r
1767         if (Array.isArray(bucket)) {\r
1768             bucket.push({ dispose: () => this.remove(callback, context) });\r
1769         }\r
1770     }\r
1771     remove(callback, context = null) {\r
1772         if (!this._callbacks) {\r
1773             return;\r
1774         }\r
1775         var foundCallbackWithDifferentContext = false;\r
1776         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
1777             if (this._callbacks[i] === callback) {\r
1778                 if (this._contexts[i] === context) {\r
1779                     // callback & context match => remove it\r
1780                     this._callbacks.splice(i, 1);\r
1781                     this._contexts.splice(i, 1);\r
1782                     return;\r
1783                 }\r
1784                 else {\r
1785                     foundCallbackWithDifferentContext = true;\r
1786                 }\r
1787             }\r
1788         }\r
1789         if (foundCallbackWithDifferentContext) {\r
1790             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
1791         }\r
1792     }\r
1793     invoke(...args) {\r
1794         if (!this._callbacks) {\r
1795             return [];\r
1796         }\r
1797         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
1798         for (var i = 0, len = callbacks.length; i < len; i++) {\r
1799             try {\r
1800                 ret.push(callbacks[i].apply(contexts[i], args));\r
1801             }\r
1802             catch (e) {\r
1803                 // eslint-disable-next-line no-console\r
1804                 console.error(e);\r
1805             }\r
1806         }\r
1807         return ret;\r
1808     }\r
1809     isEmpty() {\r
1810         return !this._callbacks || this._callbacks.length === 0;\r
1811     }\r
1812     dispose() {\r
1813         this._callbacks = undefined;\r
1814         this._contexts = undefined;\r
1815     }\r
1816 }\r
1817 class Emitter {\r
1818     constructor(_options) {\r
1819         this._options = _options;\r
1820     }\r
1821     /**\r
1822      * For the public to allow to subscribe\r
1823      * to events from this Emitter\r
1824      */\r
1825     get event() {\r
1826         if (!this._event) {\r
1827             this._event = (listener, thisArgs, disposables) => {\r
1828                 if (!this._callbacks) {\r
1829                     this._callbacks = new CallbackList();\r
1830                 }\r
1831                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
1832                     this._options.onFirstListenerAdd(this);\r
1833                 }\r
1834                 this._callbacks.add(listener, thisArgs);\r
1835                 let result;\r
1836                 result = {\r
1837                     dispose: () => {\r
1838                         this._callbacks.remove(listener, thisArgs);\r
1839                         result.dispose = Emitter._noop;\r
1840                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
1841                             this._options.onLastListenerRemove(this);\r
1842                         }\r
1843                     }\r
1844                 };\r
1845                 if (Array.isArray(disposables)) {\r
1846                     disposables.push(result);\r
1847                 }\r
1848                 return result;\r
1849             };\r
1850         }\r
1851         return this._event;\r
1852     }\r
1853     /**\r
1854      * To be kept private to fire an event to\r
1855      * subscribers\r
1856      */\r
1857     fire(event) {\r
1858         if (this._callbacks) {\r
1859             this._callbacks.invoke.call(this._callbacks, event);\r
1860         }\r
1861     }\r
1862     dispose() {\r
1863         if (this._callbacks) {\r
1864             this._callbacks.dispose();\r
1865             this._callbacks = undefined;\r
1866         }\r
1867     }\r
1868 }\r
1869 exports.Emitter = Emitter;\r
1870 Emitter._noop = function () { };\r
1871
1872
1873 /***/ }),
1874 /* 8 */
1875 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1876
1877 "use strict";
1878 /* --------------------------------------------------------------------------------------------\r
1879  * Copyright (c) Microsoft Corporation. All rights reserved.\r
1880  * Licensed under the MIT License. See License.txt in the project root for license information.\r
1881  * ------------------------------------------------------------------------------------------ */\r
1882 \r
1883 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
1884 const events_1 = __webpack_require__(7);\r
1885 const Is = __webpack_require__(4);\r
1886 let ContentLength = 'Content-Length: ';\r
1887 let CRLF = '\r\n';\r
1888 var MessageWriter;\r
1889 (function (MessageWriter) {\r
1890     function is(value) {\r
1891         let candidate = value;\r
1892         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
1893             Is.func(candidate.onError) && Is.func(candidate.write);\r
1894     }\r
1895     MessageWriter.is = is;\r
1896 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
1897 class AbstractMessageWriter {\r
1898     constructor() {\r
1899         this.errorEmitter = new events_1.Emitter();\r
1900         this.closeEmitter = new events_1.Emitter();\r
1901     }\r
1902     dispose() {\r
1903         this.errorEmitter.dispose();\r
1904         this.closeEmitter.dispose();\r
1905     }\r
1906     get onError() {\r
1907         return this.errorEmitter.event;\r
1908     }\r
1909     fireError(error, message, count) {\r
1910         this.errorEmitter.fire([this.asError(error), message, count]);\r
1911     }\r
1912     get onClose() {\r
1913         return this.closeEmitter.event;\r
1914     }\r
1915     fireClose() {\r
1916         this.closeEmitter.fire(undefined);\r
1917     }\r
1918     asError(error) {\r
1919         if (error instanceof Error) {\r
1920             return error;\r
1921         }\r
1922         else {\r
1923             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
1924         }\r
1925     }\r
1926 }\r
1927 exports.AbstractMessageWriter = AbstractMessageWriter;\r
1928 class StreamMessageWriter extends AbstractMessageWriter {\r
1929     constructor(writable, encoding = 'utf8') {\r
1930         super();\r
1931         this.writable = writable;\r
1932         this.encoding = encoding;\r
1933         this.errorCount = 0;\r
1934         this.writable.on('error', (error) => this.fireError(error));\r
1935         this.writable.on('close', () => this.fireClose());\r
1936     }\r
1937     write(msg) {\r
1938         let json = JSON.stringify(msg);\r
1939         let contentLength = Buffer.byteLength(json, this.encoding);\r
1940         let headers = [\r
1941             ContentLength, contentLength.toString(), CRLF,\r
1942             CRLF\r
1943         ];\r
1944         try {\r
1945             // Header must be written in ASCII encoding\r
1946             this.writable.write(headers.join(''), 'ascii');\r
1947             // Now write the content. This can be written in any encoding\r
1948             this.writable.write(json, this.encoding);\r
1949             this.errorCount = 0;\r
1950         }\r
1951         catch (error) {\r
1952             this.errorCount++;\r
1953             this.fireError(error, msg, this.errorCount);\r
1954         }\r
1955     }\r
1956 }\r
1957 exports.StreamMessageWriter = StreamMessageWriter;\r
1958 class IPCMessageWriter extends AbstractMessageWriter {\r
1959     constructor(process) {\r
1960         super();\r
1961         this.process = process;\r
1962         this.errorCount = 0;\r
1963         this.queue = [];\r
1964         this.sending = false;\r
1965         let eventEmitter = this.process;\r
1966         eventEmitter.on('error', (error) => this.fireError(error));\r
1967         eventEmitter.on('close', () => this.fireClose);\r
1968     }\r
1969     write(msg) {\r
1970         if (!this.sending && this.queue.length === 0) {\r
1971             // See https://github.com/nodejs/node/issues/7657\r
1972             this.doWriteMessage(msg);\r
1973         }\r
1974         else {\r
1975             this.queue.push(msg);\r
1976         }\r
1977     }\r
1978     doWriteMessage(msg) {\r
1979         try {\r
1980             if (this.process.send) {\r
1981                 this.sending = true;\r
1982                 this.process.send(msg, undefined, undefined, (error) => {\r
1983                     this.sending = false;\r
1984                     if (error) {\r
1985                         this.errorCount++;\r
1986                         this.fireError(error, msg, this.errorCount);\r
1987                     }\r
1988                     else {\r
1989                         this.errorCount = 0;\r
1990                     }\r
1991                     if (this.queue.length > 0) {\r
1992                         this.doWriteMessage(this.queue.shift());\r
1993                     }\r
1994                 });\r
1995             }\r
1996         }\r
1997         catch (error) {\r
1998             this.errorCount++;\r
1999             this.fireError(error, msg, this.errorCount);\r
2000         }\r
2001     }\r
2002 }\r
2003 exports.IPCMessageWriter = IPCMessageWriter;\r
2004 class SocketMessageWriter extends AbstractMessageWriter {\r
2005     constructor(socket, encoding = 'utf8') {\r
2006         super();\r
2007         this.socket = socket;\r
2008         this.queue = [];\r
2009         this.sending = false;\r
2010         this.encoding = encoding;\r
2011         this.errorCount = 0;\r
2012         this.socket.on('error', (error) => this.fireError(error));\r
2013         this.socket.on('close', () => this.fireClose());\r
2014     }\r
2015     dispose() {\r
2016         super.dispose();\r
2017         this.socket.destroy();\r
2018     }\r
2019     write(msg) {\r
2020         if (!this.sending && this.queue.length === 0) {\r
2021             // See https://github.com/nodejs/node/issues/7657\r
2022             this.doWriteMessage(msg);\r
2023         }\r
2024         else {\r
2025             this.queue.push(msg);\r
2026         }\r
2027     }\r
2028     doWriteMessage(msg) {\r
2029         let json = JSON.stringify(msg);\r
2030         let contentLength = Buffer.byteLength(json, this.encoding);\r
2031         let headers = [\r
2032             ContentLength, contentLength.toString(), CRLF,\r
2033             CRLF\r
2034         ];\r
2035         try {\r
2036             // Header must be written in ASCII encoding\r
2037             this.sending = true;\r
2038             this.socket.write(headers.join(''), 'ascii', (error) => {\r
2039                 if (error) {\r
2040                     this.handleError(error, msg);\r
2041                 }\r
2042                 try {\r
2043                     // Now write the content. This can be written in any encoding\r
2044                     this.socket.write(json, this.encoding, (error) => {\r
2045                         this.sending = false;\r
2046                         if (error) {\r
2047                             this.handleError(error, msg);\r
2048                         }\r
2049                         else {\r
2050                             this.errorCount = 0;\r
2051                         }\r
2052                         if (this.queue.length > 0) {\r
2053                             this.doWriteMessage(this.queue.shift());\r
2054                         }\r
2055                     });\r
2056                 }\r
2057                 catch (error) {\r
2058                     this.handleError(error, msg);\r
2059                 }\r
2060             });\r
2061         }\r
2062         catch (error) {\r
2063             this.handleError(error, msg);\r
2064         }\r
2065     }\r
2066     handleError(error, msg) {\r
2067         this.errorCount++;\r
2068         this.fireError(error, msg, this.errorCount);\r
2069     }\r
2070 }\r
2071 exports.SocketMessageWriter = SocketMessageWriter;\r
2072
2073
2074 /***/ }),
2075 /* 9 */
2076 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2077
2078 "use strict";
2079 /*---------------------------------------------------------------------------------------------\r
2080  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2081  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2082  *--------------------------------------------------------------------------------------------*/\r
2083 \r
2084 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2085 const events_1 = __webpack_require__(7);\r
2086 const Is = __webpack_require__(4);\r
2087 var CancellationToken;\r
2088 (function (CancellationToken) {\r
2089     CancellationToken.None = Object.freeze({\r
2090         isCancellationRequested: false,\r
2091         onCancellationRequested: events_1.Event.None\r
2092     });\r
2093     CancellationToken.Cancelled = Object.freeze({\r
2094         isCancellationRequested: true,\r
2095         onCancellationRequested: events_1.Event.None\r
2096     });\r
2097     function is(value) {\r
2098         let candidate = value;\r
2099         return candidate && (candidate === CancellationToken.None\r
2100             || candidate === CancellationToken.Cancelled\r
2101             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
2102     }\r
2103     CancellationToken.is = is;\r
2104 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
2105 const shortcutEvent = Object.freeze(function (callback, context) {\r
2106     let handle = setTimeout(callback.bind(context), 0);\r
2107     return { dispose() { clearTimeout(handle); } };\r
2108 });\r
2109 class MutableToken {\r
2110     constructor() {\r
2111         this._isCancelled = false;\r
2112     }\r
2113     cancel() {\r
2114         if (!this._isCancelled) {\r
2115             this._isCancelled = true;\r
2116             if (this._emitter) {\r
2117                 this._emitter.fire(undefined);\r
2118                 this.dispose();\r
2119             }\r
2120         }\r
2121     }\r
2122     get isCancellationRequested() {\r
2123         return this._isCancelled;\r
2124     }\r
2125     get onCancellationRequested() {\r
2126         if (this._isCancelled) {\r
2127             return shortcutEvent;\r
2128         }\r
2129         if (!this._emitter) {\r
2130             this._emitter = new events_1.Emitter();\r
2131         }\r
2132         return this._emitter.event;\r
2133     }\r
2134     dispose() {\r
2135         if (this._emitter) {\r
2136             this._emitter.dispose();\r
2137             this._emitter = undefined;\r
2138         }\r
2139     }\r
2140 }\r
2141 class CancellationTokenSource {\r
2142     get token() {\r
2143         if (!this._token) {\r
2144             // be lazy and create the token only when\r
2145             // actually needed\r
2146             this._token = new MutableToken();\r
2147         }\r
2148         return this._token;\r
2149     }\r
2150     cancel() {\r
2151         if (!this._token) {\r
2152             // save an object by returning the default\r
2153             // cancelled token when cancellation happens\r
2154             // before someone asks for the token\r
2155             this._token = CancellationToken.Cancelled;\r
2156         }\r
2157         else {\r
2158             this._token.cancel();\r
2159         }\r
2160     }\r
2161     dispose() {\r
2162         if (!this._token) {\r
2163             // ensure to initialize with an empty token if we had none\r
2164             this._token = CancellationToken.None;\r
2165         }\r
2166         else if (this._token instanceof MutableToken) {\r
2167             // actually dispose\r
2168             this._token.dispose();\r
2169         }\r
2170     }\r
2171 }\r
2172 exports.CancellationTokenSource = CancellationTokenSource;\r
2173
2174
2175 /***/ }),
2176 /* 10 */
2177 /***/ ((__unused_webpack_module, exports) => {
2178
2179 "use strict";
2180 \r
2181 /*---------------------------------------------------------------------------------------------\r
2182  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
2183  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
2184  *--------------------------------------------------------------------------------------------*/\r
2185 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2186 var Touch;\r
2187 (function (Touch) {\r
2188     Touch.None = 0;\r
2189     Touch.First = 1;\r
2190     Touch.Last = 2;\r
2191 })(Touch = exports.Touch || (exports.Touch = {}));\r
2192 class LinkedMap {\r
2193     constructor() {\r
2194         this._map = new Map();\r
2195         this._head = undefined;\r
2196         this._tail = undefined;\r
2197         this._size = 0;\r
2198     }\r
2199     clear() {\r
2200         this._map.clear();\r
2201         this._head = undefined;\r
2202         this._tail = undefined;\r
2203         this._size = 0;\r
2204     }\r
2205     isEmpty() {\r
2206         return !this._head && !this._tail;\r
2207     }\r
2208     get size() {\r
2209         return this._size;\r
2210     }\r
2211     has(key) {\r
2212         return this._map.has(key);\r
2213     }\r
2214     get(key) {\r
2215         const item = this._map.get(key);\r
2216         if (!item) {\r
2217             return undefined;\r
2218         }\r
2219         return item.value;\r
2220     }\r
2221     set(key, value, touch = Touch.None) {\r
2222         let item = this._map.get(key);\r
2223         if (item) {\r
2224             item.value = value;\r
2225             if (touch !== Touch.None) {\r
2226                 this.touch(item, touch);\r
2227             }\r
2228         }\r
2229         else {\r
2230             item = { key, value, next: undefined, previous: undefined };\r
2231             switch (touch) {\r
2232                 case Touch.None:\r
2233                     this.addItemLast(item);\r
2234                     break;\r
2235                 case Touch.First:\r
2236                     this.addItemFirst(item);\r
2237                     break;\r
2238                 case Touch.Last:\r
2239                     this.addItemLast(item);\r
2240                     break;\r
2241                 default:\r
2242                     this.addItemLast(item);\r
2243                     break;\r
2244             }\r
2245             this._map.set(key, item);\r
2246             this._size++;\r
2247         }\r
2248     }\r
2249     delete(key) {\r
2250         const item = this._map.get(key);\r
2251         if (!item) {\r
2252             return false;\r
2253         }\r
2254         this._map.delete(key);\r
2255         this.removeItem(item);\r
2256         this._size--;\r
2257         return true;\r
2258     }\r
2259     shift() {\r
2260         if (!this._head && !this._tail) {\r
2261             return undefined;\r
2262         }\r
2263         if (!this._head || !this._tail) {\r
2264             throw new Error('Invalid list');\r
2265         }\r
2266         const item = this._head;\r
2267         this._map.delete(item.key);\r
2268         this.removeItem(item);\r
2269         this._size--;\r
2270         return item.value;\r
2271     }\r
2272     forEach(callbackfn, thisArg) {\r
2273         let current = this._head;\r
2274         while (current) {\r
2275             if (thisArg) {\r
2276                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2277             }\r
2278             else {\r
2279                 callbackfn(current.value, current.key, this);\r
2280             }\r
2281             current = current.next;\r
2282         }\r
2283     }\r
2284     forEachReverse(callbackfn, thisArg) {\r
2285         let current = this._tail;\r
2286         while (current) {\r
2287             if (thisArg) {\r
2288                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
2289             }\r
2290             else {\r
2291                 callbackfn(current.value, current.key, this);\r
2292             }\r
2293             current = current.previous;\r
2294         }\r
2295     }\r
2296     values() {\r
2297         let result = [];\r
2298         let current = this._head;\r
2299         while (current) {\r
2300             result.push(current.value);\r
2301             current = current.next;\r
2302         }\r
2303         return result;\r
2304     }\r
2305     keys() {\r
2306         let result = [];\r
2307         let current = this._head;\r
2308         while (current) {\r
2309             result.push(current.key);\r
2310             current = current.next;\r
2311         }\r
2312         return result;\r
2313     }\r
2314     /* JSON RPC run on es5 which has no Symbol.iterator\r
2315     public keys(): IterableIterator<K> {\r
2316         let current = this._head;\r
2317         let iterator: IterableIterator<K> = {\r
2318             [Symbol.iterator]() {\r
2319                 return iterator;\r
2320             },\r
2321             next():IteratorResult<K> {\r
2322                 if (current) {\r
2323                     let result = { value: current.key, done: false };\r
2324                     current = current.next;\r
2325                     return result;\r
2326                 } else {\r
2327                     return { value: undefined, done: true };\r
2328                 }\r
2329             }\r
2330         };\r
2331         return iterator;\r
2332     }\r
2333 \r
2334     public values(): IterableIterator<V> {\r
2335         let current = this._head;\r
2336         let iterator: IterableIterator<V> = {\r
2337             [Symbol.iterator]() {\r
2338                 return iterator;\r
2339             },\r
2340             next():IteratorResult<V> {\r
2341                 if (current) {\r
2342                     let result = { value: current.value, done: false };\r
2343                     current = current.next;\r
2344                     return result;\r
2345                 } else {\r
2346                     return { value: undefined, done: true };\r
2347                 }\r
2348             }\r
2349         };\r
2350         return iterator;\r
2351     }\r
2352     */\r
2353     addItemFirst(item) {\r
2354         // First time Insert\r
2355         if (!this._head && !this._tail) {\r
2356             this._tail = item;\r
2357         }\r
2358         else if (!this._head) {\r
2359             throw new Error('Invalid list');\r
2360         }\r
2361         else {\r
2362             item.next = this._head;\r
2363             this._head.previous = item;\r
2364         }\r
2365         this._head = item;\r
2366     }\r
2367     addItemLast(item) {\r
2368         // First time Insert\r
2369         if (!this._head && !this._tail) {\r
2370             this._head = item;\r
2371         }\r
2372         else if (!this._tail) {\r
2373             throw new Error('Invalid list');\r
2374         }\r
2375         else {\r
2376             item.previous = this._tail;\r
2377             this._tail.next = item;\r
2378         }\r
2379         this._tail = item;\r
2380     }\r
2381     removeItem(item) {\r
2382         if (item === this._head && item === this._tail) {\r
2383             this._head = undefined;\r
2384             this._tail = undefined;\r
2385         }\r
2386         else if (item === this._head) {\r
2387             this._head = item.next;\r
2388         }\r
2389         else if (item === this._tail) {\r
2390             this._tail = item.previous;\r
2391         }\r
2392         else {\r
2393             const next = item.next;\r
2394             const previous = item.previous;\r
2395             if (!next || !previous) {\r
2396                 throw new Error('Invalid list');\r
2397             }\r
2398             next.previous = previous;\r
2399             previous.next = next;\r
2400         }\r
2401     }\r
2402     touch(item, touch) {\r
2403         if (!this._head || !this._tail) {\r
2404             throw new Error('Invalid list');\r
2405         }\r
2406         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
2407             return;\r
2408         }\r
2409         if (touch === Touch.First) {\r
2410             if (item === this._head) {\r
2411                 return;\r
2412             }\r
2413             const next = item.next;\r
2414             const previous = item.previous;\r
2415             // Unlink the item\r
2416             if (item === this._tail) {\r
2417                 // previous must be defined since item was not head but is tail\r
2418                 // So there are more than on item in the map\r
2419                 previous.next = undefined;\r
2420                 this._tail = previous;\r
2421             }\r
2422             else {\r
2423                 // Both next and previous are not undefined since item was neither head nor tail.\r
2424                 next.previous = previous;\r
2425                 previous.next = next;\r
2426             }\r
2427             // Insert the node at head\r
2428             item.previous = undefined;\r
2429             item.next = this._head;\r
2430             this._head.previous = item;\r
2431             this._head = item;\r
2432         }\r
2433         else if (touch === Touch.Last) {\r
2434             if (item === this._tail) {\r
2435                 return;\r
2436             }\r
2437             const next = item.next;\r
2438             const previous = item.previous;\r
2439             // Unlink the item.\r
2440             if (item === this._head) {\r
2441                 // next must be defined since item was not tail but is head\r
2442                 // So there are more than on item in the map\r
2443                 next.previous = undefined;\r
2444                 this._head = next;\r
2445             }\r
2446             else {\r
2447                 // Both next and previous are not undefined since item was neither head nor tail.\r
2448                 next.previous = previous;\r
2449                 previous.next = next;\r
2450             }\r
2451             item.next = undefined;\r
2452             item.previous = this._tail;\r
2453             this._tail.next = item;\r
2454             this._tail = item;\r
2455         }\r
2456     }\r
2457 }\r
2458 exports.LinkedMap = LinkedMap;\r
2459
2460
2461 /***/ }),
2462 /* 11 */
2463 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2464
2465 "use strict";
2466 /* --------------------------------------------------------------------------------------------\r
2467  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2468  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2469  * ------------------------------------------------------------------------------------------ */\r
2470 \r
2471 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2472 const path_1 = __webpack_require__(12);\r
2473 const os_1 = __webpack_require__(13);\r
2474 const crypto_1 = __webpack_require__(14);\r
2475 const net_1 = __webpack_require__(15);\r
2476 const messageReader_1 = __webpack_require__(6);\r
2477 const messageWriter_1 = __webpack_require__(8);\r
2478 function generateRandomPipeName() {\r
2479     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
2480     if (process.platform === 'win32') {\r
2481         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
2482     }\r
2483     else {\r
2484         // Mac/Unix: use socket file\r
2485         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
2486     }\r
2487 }\r
2488 exports.generateRandomPipeName = generateRandomPipeName;\r
2489 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
2490     let connectResolve;\r
2491     let connected = new Promise((resolve, _reject) => {\r
2492         connectResolve = resolve;\r
2493     });\r
2494     return new Promise((resolve, reject) => {\r
2495         let server = net_1.createServer((socket) => {\r
2496             server.close();\r
2497             connectResolve([\r
2498                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2499                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2500             ]);\r
2501         });\r
2502         server.on('error', reject);\r
2503         server.listen(pipeName, () => {\r
2504             server.removeListener('error', reject);\r
2505             resolve({\r
2506                 onConnected: () => { return connected; }\r
2507             });\r
2508         });\r
2509     });\r
2510 }\r
2511 exports.createClientPipeTransport = createClientPipeTransport;\r
2512 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
2513     const socket = net_1.createConnection(pipeName);\r
2514     return [\r
2515         new messageReader_1.SocketMessageReader(socket, encoding),\r
2516         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2517     ];\r
2518 }\r
2519 exports.createServerPipeTransport = createServerPipeTransport;\r
2520
2521
2522 /***/ }),
2523 /* 12 */
2524 /***/ ((module) => {
2525
2526 "use strict";
2527 module.exports = require("path");;
2528
2529 /***/ }),
2530 /* 13 */
2531 /***/ ((module) => {
2532
2533 "use strict";
2534 module.exports = require("os");;
2535
2536 /***/ }),
2537 /* 14 */
2538 /***/ ((module) => {
2539
2540 "use strict";
2541 module.exports = require("crypto");;
2542
2543 /***/ }),
2544 /* 15 */
2545 /***/ ((module) => {
2546
2547 "use strict";
2548 module.exports = require("net");;
2549
2550 /***/ }),
2551 /* 16 */
2552 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2553
2554 "use strict";
2555 /* --------------------------------------------------------------------------------------------\r
2556  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2557  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2558  * ------------------------------------------------------------------------------------------ */\r
2559 \r
2560 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
2561 const net_1 = __webpack_require__(15);\r
2562 const messageReader_1 = __webpack_require__(6);\r
2563 const messageWriter_1 = __webpack_require__(8);\r
2564 function createClientSocketTransport(port, encoding = 'utf-8') {\r
2565     let connectResolve;\r
2566     let connected = new Promise((resolve, _reject) => {\r
2567         connectResolve = resolve;\r
2568     });\r
2569     return new Promise((resolve, reject) => {\r
2570         let server = net_1.createServer((socket) => {\r
2571             server.close();\r
2572             connectResolve([\r
2573                 new messageReader_1.SocketMessageReader(socket, encoding),\r
2574                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2575             ]);\r
2576         });\r
2577         server.on('error', reject);\r
2578         server.listen(port, '127.0.0.1', () => {\r
2579             server.removeListener('error', reject);\r
2580             resolve({\r
2581                 onConnected: () => { return connected; }\r
2582             });\r
2583         });\r
2584     });\r
2585 }\r
2586 exports.createClientSocketTransport = createClientSocketTransport;\r
2587 function createServerSocketTransport(port, encoding = 'utf-8') {\r
2588     const socket = net_1.createConnection(port, '127.0.0.1');\r
2589     return [\r
2590         new messageReader_1.SocketMessageReader(socket, encoding),\r
2591         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
2592     ];\r
2593 }\r
2594 exports.createServerSocketTransport = createServerSocketTransport;\r
2595
2596
2597 /***/ }),
2598 /* 17 */
2599 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2600
2601 "use strict";
2602 __webpack_require__.r(__webpack_exports__);
2603 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2604 /* harmony export */   "Position": () => /* binding */ Position,
2605 /* harmony export */   "Range": () => /* binding */ Range,
2606 /* harmony export */   "Location": () => /* binding */ Location,
2607 /* harmony export */   "LocationLink": () => /* binding */ LocationLink,
2608 /* harmony export */   "Color": () => /* binding */ Color,
2609 /* harmony export */   "ColorInformation": () => /* binding */ ColorInformation,
2610 /* harmony export */   "ColorPresentation": () => /* binding */ ColorPresentation,
2611 /* harmony export */   "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
2612 /* harmony export */   "FoldingRange": () => /* binding */ FoldingRange,
2613 /* harmony export */   "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
2614 /* harmony export */   "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
2615 /* harmony export */   "DiagnosticTag": () => /* binding */ DiagnosticTag,
2616 /* harmony export */   "Diagnostic": () => /* binding */ Diagnostic,
2617 /* harmony export */   "Command": () => /* binding */ Command,
2618 /* harmony export */   "TextEdit": () => /* binding */ TextEdit,
2619 /* harmony export */   "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
2620 /* harmony export */   "CreateFile": () => /* binding */ CreateFile,
2621 /* harmony export */   "RenameFile": () => /* binding */ RenameFile,
2622 /* harmony export */   "DeleteFile": () => /* binding */ DeleteFile,
2623 /* harmony export */   "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
2624 /* harmony export */   "WorkspaceChange": () => /* binding */ WorkspaceChange,
2625 /* harmony export */   "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
2626 /* harmony export */   "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
2627 /* harmony export */   "TextDocumentItem": () => /* binding */ TextDocumentItem,
2628 /* harmony export */   "MarkupKind": () => /* binding */ MarkupKind,
2629 /* harmony export */   "MarkupContent": () => /* binding */ MarkupContent,
2630 /* harmony export */   "CompletionItemKind": () => /* binding */ CompletionItemKind,
2631 /* harmony export */   "InsertTextFormat": () => /* binding */ InsertTextFormat,
2632 /* harmony export */   "CompletionItemTag": () => /* binding */ CompletionItemTag,
2633 /* harmony export */   "CompletionItem": () => /* binding */ CompletionItem,
2634 /* harmony export */   "CompletionList": () => /* binding */ CompletionList,
2635 /* harmony export */   "MarkedString": () => /* binding */ MarkedString,
2636 /* harmony export */   "Hover": () => /* binding */ Hover,
2637 /* harmony export */   "ParameterInformation": () => /* binding */ ParameterInformation,
2638 /* harmony export */   "SignatureInformation": () => /* binding */ SignatureInformation,
2639 /* harmony export */   "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
2640 /* harmony export */   "DocumentHighlight": () => /* binding */ DocumentHighlight,
2641 /* harmony export */   "SymbolKind": () => /* binding */ SymbolKind,
2642 /* harmony export */   "SymbolTag": () => /* binding */ SymbolTag,
2643 /* harmony export */   "SymbolInformation": () => /* binding */ SymbolInformation,
2644 /* harmony export */   "DocumentSymbol": () => /* binding */ DocumentSymbol,
2645 /* harmony export */   "CodeActionKind": () => /* binding */ CodeActionKind,
2646 /* harmony export */   "CodeActionContext": () => /* binding */ CodeActionContext,
2647 /* harmony export */   "CodeAction": () => /* binding */ CodeAction,
2648 /* harmony export */   "CodeLens": () => /* binding */ CodeLens,
2649 /* harmony export */   "FormattingOptions": () => /* binding */ FormattingOptions,
2650 /* harmony export */   "DocumentLink": () => /* binding */ DocumentLink,
2651 /* harmony export */   "SelectionRange": () => /* binding */ SelectionRange,
2652 /* harmony export */   "EOL": () => /* binding */ EOL,
2653 /* harmony export */   "TextDocument": () => /* binding */ TextDocument
2654 /* harmony export */ });
2655 /* --------------------------------------------------------------------------------------------\r
2656  * Copyright (c) Microsoft Corporation. All rights reserved.\r
2657  * Licensed under the MIT License. See License.txt in the project root for license information.\r
2658  * ------------------------------------------------------------------------------------------ */\r
2659 \r
2660 /**\r
2661  * The Position namespace provides helper functions to work with\r
2662  * [Position](#Position) literals.\r
2663  */\r
2664 var Position;\r
2665 (function (Position) {\r
2666     /**\r
2667      * Creates a new Position literal from the given line and character.\r
2668      * @param line The position's line.\r
2669      * @param character The position's character.\r
2670      */\r
2671     function create(line, character) {\r
2672         return { line: line, character: character };\r
2673     }\r
2674     Position.create = create;\r
2675     /**\r
2676      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
2677      */\r
2678     function is(value) {\r
2679         var candidate = value;\r
2680         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
2681     }\r
2682     Position.is = is;\r
2683 })(Position || (Position = {}));\r
2684 /**\r
2685  * The Range namespace provides helper functions to work with\r
2686  * [Range](#Range) literals.\r
2687  */\r
2688 var Range;\r
2689 (function (Range) {\r
2690     function create(one, two, three, four) {\r
2691         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
2692             return { start: Position.create(one, two), end: Position.create(three, four) };\r
2693         }\r
2694         else if (Position.is(one) && Position.is(two)) {\r
2695             return { start: one, end: two };\r
2696         }\r
2697         else {\r
2698             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
2699         }\r
2700     }\r
2701     Range.create = create;\r
2702     /**\r
2703      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
2704      */\r
2705     function is(value) {\r
2706         var candidate = value;\r
2707         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
2708     }\r
2709     Range.is = is;\r
2710 })(Range || (Range = {}));\r
2711 /**\r
2712  * The Location namespace provides helper functions to work with\r
2713  * [Location](#Location) literals.\r
2714  */\r
2715 var Location;\r
2716 (function (Location) {\r
2717     /**\r
2718      * Creates a Location literal.\r
2719      * @param uri The location's uri.\r
2720      * @param range The location's range.\r
2721      */\r
2722     function create(uri, range) {\r
2723         return { uri: uri, range: range };\r
2724     }\r
2725     Location.create = create;\r
2726     /**\r
2727      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
2728      */\r
2729     function is(value) {\r
2730         var candidate = value;\r
2731         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
2732     }\r
2733     Location.is = is;\r
2734 })(Location || (Location = {}));\r
2735 /**\r
2736  * The LocationLink namespace provides helper functions to work with\r
2737  * [LocationLink](#LocationLink) literals.\r
2738  */\r
2739 var LocationLink;\r
2740 (function (LocationLink) {\r
2741     /**\r
2742      * Creates a LocationLink literal.\r
2743      * @param targetUri The definition's uri.\r
2744      * @param targetRange The full range of the definition.\r
2745      * @param targetSelectionRange The span of the symbol definition at the target.\r
2746      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
2747      */\r
2748     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
2749         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
2750     }\r
2751     LocationLink.create = create;\r
2752     /**\r
2753      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
2754      */\r
2755     function is(value) {\r
2756         var candidate = value;\r
2757         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
2758             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
2759             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
2760     }\r
2761     LocationLink.is = is;\r
2762 })(LocationLink || (LocationLink = {}));\r
2763 /**\r
2764  * The Color namespace provides helper functions to work with\r
2765  * [Color](#Color) literals.\r
2766  */\r
2767 var Color;\r
2768 (function (Color) {\r
2769     /**\r
2770      * Creates a new Color literal.\r
2771      */\r
2772     function create(red, green, blue, alpha) {\r
2773         return {\r
2774             red: red,\r
2775             green: green,\r
2776             blue: blue,\r
2777             alpha: alpha,\r
2778         };\r
2779     }\r
2780     Color.create = create;\r
2781     /**\r
2782      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
2783      */\r
2784     function is(value) {\r
2785         var candidate = value;\r
2786         return Is.number(candidate.red)\r
2787             && Is.number(candidate.green)\r
2788             && Is.number(candidate.blue)\r
2789             && Is.number(candidate.alpha);\r
2790     }\r
2791     Color.is = is;\r
2792 })(Color || (Color = {}));\r
2793 /**\r
2794  * The ColorInformation namespace provides helper functions to work with\r
2795  * [ColorInformation](#ColorInformation) literals.\r
2796  */\r
2797 var ColorInformation;\r
2798 (function (ColorInformation) {\r
2799     /**\r
2800      * Creates a new ColorInformation literal.\r
2801      */\r
2802     function create(range, color) {\r
2803         return {\r
2804             range: range,\r
2805             color: color,\r
2806         };\r
2807     }\r
2808     ColorInformation.create = create;\r
2809     /**\r
2810      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2811      */\r
2812     function is(value) {\r
2813         var candidate = value;\r
2814         return Range.is(candidate.range) && Color.is(candidate.color);\r
2815     }\r
2816     ColorInformation.is = is;\r
2817 })(ColorInformation || (ColorInformation = {}));\r
2818 /**\r
2819  * The Color namespace provides helper functions to work with\r
2820  * [ColorPresentation](#ColorPresentation) literals.\r
2821  */\r
2822 var ColorPresentation;\r
2823 (function (ColorPresentation) {\r
2824     /**\r
2825      * Creates a new ColorInformation literal.\r
2826      */\r
2827     function create(label, textEdit, additionalTextEdits) {\r
2828         return {\r
2829             label: label,\r
2830             textEdit: textEdit,\r
2831             additionalTextEdits: additionalTextEdits,\r
2832         };\r
2833     }\r
2834     ColorPresentation.create = create;\r
2835     /**\r
2836      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
2837      */\r
2838     function is(value) {\r
2839         var candidate = value;\r
2840         return Is.string(candidate.label)\r
2841             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
2842             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
2843     }\r
2844     ColorPresentation.is = is;\r
2845 })(ColorPresentation || (ColorPresentation = {}));\r
2846 /**\r
2847  * Enum of known range kinds\r
2848  */\r
2849 var FoldingRangeKind;\r
2850 (function (FoldingRangeKind) {\r
2851     /**\r
2852      * Folding range for a comment\r
2853      */\r
2854     FoldingRangeKind["Comment"] = "comment";\r
2855     /**\r
2856      * Folding range for a imports or includes\r
2857      */\r
2858     FoldingRangeKind["Imports"] = "imports";\r
2859     /**\r
2860      * Folding range for a region (e.g. `#region`)\r
2861      */\r
2862     FoldingRangeKind["Region"] = "region";\r
2863 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
2864 /**\r
2865  * The folding range namespace provides helper functions to work with\r
2866  * [FoldingRange](#FoldingRange) literals.\r
2867  */\r
2868 var FoldingRange;\r
2869 (function (FoldingRange) {\r
2870     /**\r
2871      * Creates a new FoldingRange literal.\r
2872      */\r
2873     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
2874         var result = {\r
2875             startLine: startLine,\r
2876             endLine: endLine\r
2877         };\r
2878         if (Is.defined(startCharacter)) {\r
2879             result.startCharacter = startCharacter;\r
2880         }\r
2881         if (Is.defined(endCharacter)) {\r
2882             result.endCharacter = endCharacter;\r
2883         }\r
2884         if (Is.defined(kind)) {\r
2885             result.kind = kind;\r
2886         }\r
2887         return result;\r
2888     }\r
2889     FoldingRange.create = create;\r
2890     /**\r
2891      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
2892      */\r
2893     function is(value) {\r
2894         var candidate = value;\r
2895         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
2896             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
2897             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
2898             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
2899     }\r
2900     FoldingRange.is = is;\r
2901 })(FoldingRange || (FoldingRange = {}));\r
2902 /**\r
2903  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
2904  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
2905  */\r
2906 var DiagnosticRelatedInformation;\r
2907 (function (DiagnosticRelatedInformation) {\r
2908     /**\r
2909      * Creates a new DiagnosticRelatedInformation literal.\r
2910      */\r
2911     function create(location, message) {\r
2912         return {\r
2913             location: location,\r
2914             message: message\r
2915         };\r
2916     }\r
2917     DiagnosticRelatedInformation.create = create;\r
2918     /**\r
2919      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
2920      */\r
2921     function is(value) {\r
2922         var candidate = value;\r
2923         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
2924     }\r
2925     DiagnosticRelatedInformation.is = is;\r
2926 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
2927 /**\r
2928  * The diagnostic's severity.\r
2929  */\r
2930 var DiagnosticSeverity;\r
2931 (function (DiagnosticSeverity) {\r
2932     /**\r
2933      * Reports an error.\r
2934      */\r
2935     DiagnosticSeverity.Error = 1;\r
2936     /**\r
2937      * Reports a warning.\r
2938      */\r
2939     DiagnosticSeverity.Warning = 2;\r
2940     /**\r
2941      * Reports an information.\r
2942      */\r
2943     DiagnosticSeverity.Information = 3;\r
2944     /**\r
2945      * Reports a hint.\r
2946      */\r
2947     DiagnosticSeverity.Hint = 4;\r
2948 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
2949 /**\r
2950  * The diagnostic tags.\r
2951  *\r
2952  * @since 3.15.0\r
2953  */\r
2954 var DiagnosticTag;\r
2955 (function (DiagnosticTag) {\r
2956     /**\r
2957      * Unused or unnecessary code.\r
2958      *\r
2959      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
2960      * an error squiggle.\r
2961      */\r
2962     DiagnosticTag.Unnecessary = 1;\r
2963     /**\r
2964      * Deprecated or obsolete code.\r
2965      *\r
2966      * Clients are allowed to rendered diagnostics with this tag strike through.\r
2967      */\r
2968     DiagnosticTag.Deprecated = 2;\r
2969 })(DiagnosticTag || (DiagnosticTag = {}));\r
2970 /**\r
2971  * The Diagnostic namespace provides helper functions to work with\r
2972  * [Diagnostic](#Diagnostic) literals.\r
2973  */\r
2974 var Diagnostic;\r
2975 (function (Diagnostic) {\r
2976     /**\r
2977      * Creates a new Diagnostic literal.\r
2978      */\r
2979     function create(range, message, severity, code, source, relatedInformation) {\r
2980         var result = { range: range, message: message };\r
2981         if (Is.defined(severity)) {\r
2982             result.severity = severity;\r
2983         }\r
2984         if (Is.defined(code)) {\r
2985             result.code = code;\r
2986         }\r
2987         if (Is.defined(source)) {\r
2988             result.source = source;\r
2989         }\r
2990         if (Is.defined(relatedInformation)) {\r
2991             result.relatedInformation = relatedInformation;\r
2992         }\r
2993         return result;\r
2994     }\r
2995     Diagnostic.create = create;\r
2996     /**\r
2997      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
2998      */\r
2999     function is(value) {\r
3000         var candidate = value;\r
3001         return Is.defined(candidate)\r
3002             && Range.is(candidate.range)\r
3003             && Is.string(candidate.message)\r
3004             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
3005             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
3006             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
3007             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
3008     }\r
3009     Diagnostic.is = is;\r
3010 })(Diagnostic || (Diagnostic = {}));\r
3011 /**\r
3012  * The Command namespace provides helper functions to work with\r
3013  * [Command](#Command) literals.\r
3014  */\r
3015 var Command;\r
3016 (function (Command) {\r
3017     /**\r
3018      * Creates a new Command literal.\r
3019      */\r
3020     function create(title, command) {\r
3021         var args = [];\r
3022         for (var _i = 2; _i < arguments.length; _i++) {\r
3023             args[_i - 2] = arguments[_i];\r
3024         }\r
3025         var result = { title: title, command: command };\r
3026         if (Is.defined(args) && args.length > 0) {\r
3027             result.arguments = args;\r
3028         }\r
3029         return result;\r
3030     }\r
3031     Command.create = create;\r
3032     /**\r
3033      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
3034      */\r
3035     function is(value) {\r
3036         var candidate = value;\r
3037         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
3038     }\r
3039     Command.is = is;\r
3040 })(Command || (Command = {}));\r
3041 /**\r
3042  * The TextEdit namespace provides helper function to create replace,\r
3043  * insert and delete edits more easily.\r
3044  */\r
3045 var TextEdit;\r
3046 (function (TextEdit) {\r
3047     /**\r
3048      * Creates a replace text edit.\r
3049      * @param range The range of text to be replaced.\r
3050      * @param newText The new text.\r
3051      */\r
3052     function replace(range, newText) {\r
3053         return { range: range, newText: newText };\r
3054     }\r
3055     TextEdit.replace = replace;\r
3056     /**\r
3057      * Creates a insert text edit.\r
3058      * @param position The position to insert the text at.\r
3059      * @param newText The text to be inserted.\r
3060      */\r
3061     function insert(position, newText) {\r
3062         return { range: { start: position, end: position }, newText: newText };\r
3063     }\r
3064     TextEdit.insert = insert;\r
3065     /**\r
3066      * Creates a delete text edit.\r
3067      * @param range The range of text to be deleted.\r
3068      */\r
3069     function del(range) {\r
3070         return { range: range, newText: '' };\r
3071     }\r
3072     TextEdit.del = del;\r
3073     function is(value) {\r
3074         var candidate = value;\r
3075         return Is.objectLiteral(candidate)\r
3076             && Is.string(candidate.newText)\r
3077             && Range.is(candidate.range);\r
3078     }\r
3079     TextEdit.is = is;\r
3080 })(TextEdit || (TextEdit = {}));\r
3081 /**\r
3082  * The TextDocumentEdit namespace provides helper function to create\r
3083  * an edit that manipulates a text document.\r
3084  */\r
3085 var TextDocumentEdit;\r
3086 (function (TextDocumentEdit) {\r
3087     /**\r
3088      * Creates a new `TextDocumentEdit`\r
3089      */\r
3090     function create(textDocument, edits) {\r
3091         return { textDocument: textDocument, edits: edits };\r
3092     }\r
3093     TextDocumentEdit.create = create;\r
3094     function is(value) {\r
3095         var candidate = value;\r
3096         return Is.defined(candidate)\r
3097             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
3098             && Array.isArray(candidate.edits);\r
3099     }\r
3100     TextDocumentEdit.is = is;\r
3101 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
3102 var CreateFile;\r
3103 (function (CreateFile) {\r
3104     function create(uri, options) {\r
3105         var result = {\r
3106             kind: 'create',\r
3107             uri: uri\r
3108         };\r
3109         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3110             result.options = options;\r
3111         }\r
3112         return result;\r
3113     }\r
3114     CreateFile.create = create;\r
3115     function is(value) {\r
3116         var candidate = value;\r
3117         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
3118             (candidate.options === void 0 ||\r
3119                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3120     }\r
3121     CreateFile.is = is;\r
3122 })(CreateFile || (CreateFile = {}));\r
3123 var RenameFile;\r
3124 (function (RenameFile) {\r
3125     function create(oldUri, newUri, options) {\r
3126         var result = {\r
3127             kind: 'rename',\r
3128             oldUri: oldUri,\r
3129             newUri: newUri\r
3130         };\r
3131         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
3132             result.options = options;\r
3133         }\r
3134         return result;\r
3135     }\r
3136     RenameFile.create = create;\r
3137     function is(value) {\r
3138         var candidate = value;\r
3139         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
3140             (candidate.options === void 0 ||\r
3141                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
3142     }\r
3143     RenameFile.is = is;\r
3144 })(RenameFile || (RenameFile = {}));\r
3145 var DeleteFile;\r
3146 (function (DeleteFile) {\r
3147     function create(uri, options) {\r
3148         var result = {\r
3149             kind: 'delete',\r
3150             uri: uri\r
3151         };\r
3152         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
3153             result.options = options;\r
3154         }\r
3155         return result;\r
3156     }\r
3157     DeleteFile.create = create;\r
3158     function is(value) {\r
3159         var candidate = value;\r
3160         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
3161             (candidate.options === void 0 ||\r
3162                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
3163     }\r
3164     DeleteFile.is = is;\r
3165 })(DeleteFile || (DeleteFile = {}));\r
3166 var WorkspaceEdit;\r
3167 (function (WorkspaceEdit) {\r
3168     function is(value) {\r
3169         var candidate = value;\r
3170         return candidate &&\r
3171             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
3172             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
3173                 if (Is.string(change.kind)) {\r
3174                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
3175                 }\r
3176                 else {\r
3177                     return TextDocumentEdit.is(change);\r
3178                 }\r
3179             }));\r
3180     }\r
3181     WorkspaceEdit.is = is;\r
3182 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
3183 var TextEditChangeImpl = /** @class */ (function () {\r
3184     function TextEditChangeImpl(edits) {\r
3185         this.edits = edits;\r
3186     }\r
3187     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
3188         this.edits.push(TextEdit.insert(position, newText));\r
3189     };\r
3190     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
3191         this.edits.push(TextEdit.replace(range, newText));\r
3192     };\r
3193     TextEditChangeImpl.prototype.delete = function (range) {\r
3194         this.edits.push(TextEdit.del(range));\r
3195     };\r
3196     TextEditChangeImpl.prototype.add = function (edit) {\r
3197         this.edits.push(edit);\r
3198     };\r
3199     TextEditChangeImpl.prototype.all = function () {\r
3200         return this.edits;\r
3201     };\r
3202     TextEditChangeImpl.prototype.clear = function () {\r
3203         this.edits.splice(0, this.edits.length);\r
3204     };\r
3205     return TextEditChangeImpl;\r
3206 }());\r
3207 /**\r
3208  * A workspace change helps constructing changes to a workspace.\r
3209  */\r
3210 var WorkspaceChange = /** @class */ (function () {\r
3211     function WorkspaceChange(workspaceEdit) {\r
3212         var _this = this;\r
3213         this._textEditChanges = Object.create(null);\r
3214         if (workspaceEdit) {\r
3215             this._workspaceEdit = workspaceEdit;\r
3216             if (workspaceEdit.documentChanges) {\r
3217                 workspaceEdit.documentChanges.forEach(function (change) {\r
3218                     if (TextDocumentEdit.is(change)) {\r
3219                         var textEditChange = new TextEditChangeImpl(change.edits);\r
3220                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
3221                     }\r
3222                 });\r
3223             }\r
3224             else if (workspaceEdit.changes) {\r
3225                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
3226                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
3227                     _this._textEditChanges[key] = textEditChange;\r
3228                 });\r
3229             }\r
3230         }\r
3231     }\r
3232     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
3233         /**\r
3234          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
3235          * use to be returned from a workspace edit operation like rename.\r
3236          */\r
3237         get: function () {\r
3238             return this._workspaceEdit;\r
3239         },\r
3240         enumerable: true,\r
3241         configurable: true\r
3242     });\r
3243     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
3244         if (VersionedTextDocumentIdentifier.is(key)) {\r
3245             if (!this._workspaceEdit) {\r
3246                 this._workspaceEdit = {\r
3247                     documentChanges: []\r
3248                 };\r
3249             }\r
3250             if (!this._workspaceEdit.documentChanges) {\r
3251                 throw new Error('Workspace edit is not configured for document changes.');\r
3252             }\r
3253             var textDocument = key;\r
3254             var result = this._textEditChanges[textDocument.uri];\r
3255             if (!result) {\r
3256                 var edits = [];\r
3257                 var textDocumentEdit = {\r
3258                     textDocument: textDocument,\r
3259                     edits: edits\r
3260                 };\r
3261                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
3262                 result = new TextEditChangeImpl(edits);\r
3263                 this._textEditChanges[textDocument.uri] = result;\r
3264             }\r
3265             return result;\r
3266         }\r
3267         else {\r
3268             if (!this._workspaceEdit) {\r
3269                 this._workspaceEdit = {\r
3270                     changes: Object.create(null)\r
3271                 };\r
3272             }\r
3273             if (!this._workspaceEdit.changes) {\r
3274                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
3275             }\r
3276             var result = this._textEditChanges[key];\r
3277             if (!result) {\r
3278                 var edits = [];\r
3279                 this._workspaceEdit.changes[key] = edits;\r
3280                 result = new TextEditChangeImpl(edits);\r
3281                 this._textEditChanges[key] = result;\r
3282             }\r
3283             return result;\r
3284         }\r
3285     };\r
3286     WorkspaceChange.prototype.createFile = function (uri, options) {\r
3287         this.checkDocumentChanges();\r
3288         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
3289     };\r
3290     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
3291         this.checkDocumentChanges();\r
3292         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
3293     };\r
3294     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
3295         this.checkDocumentChanges();\r
3296         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
3297     };\r
3298     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
3299         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
3300             throw new Error('Workspace edit is not configured for document changes.');\r
3301         }\r
3302     };\r
3303     return WorkspaceChange;\r
3304 }());\r
3305 \r
3306 /**\r
3307  * The TextDocumentIdentifier namespace provides helper functions to work with\r
3308  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
3309  */\r
3310 var TextDocumentIdentifier;\r
3311 (function (TextDocumentIdentifier) {\r
3312     /**\r
3313      * Creates a new TextDocumentIdentifier literal.\r
3314      * @param uri The document's uri.\r
3315      */\r
3316     function create(uri) {\r
3317         return { uri: uri };\r
3318     }\r
3319     TextDocumentIdentifier.create = create;\r
3320     /**\r
3321      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
3322      */\r
3323     function is(value) {\r
3324         var candidate = value;\r
3325         return Is.defined(candidate) && Is.string(candidate.uri);\r
3326     }\r
3327     TextDocumentIdentifier.is = is;\r
3328 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
3329 /**\r
3330  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
3331  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
3332  */\r
3333 var VersionedTextDocumentIdentifier;\r
3334 (function (VersionedTextDocumentIdentifier) {\r
3335     /**\r
3336      * Creates a new VersionedTextDocumentIdentifier literal.\r
3337      * @param uri The document's uri.\r
3338      * @param uri The document's text.\r
3339      */\r
3340     function create(uri, version) {\r
3341         return { uri: uri, version: version };\r
3342     }\r
3343     VersionedTextDocumentIdentifier.create = create;\r
3344     /**\r
3345      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
3346      */\r
3347     function is(value) {\r
3348         var candidate = value;\r
3349         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
3350     }\r
3351     VersionedTextDocumentIdentifier.is = is;\r
3352 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
3353 /**\r
3354  * The TextDocumentItem namespace provides helper functions to work with\r
3355  * [TextDocumentItem](#TextDocumentItem) literals.\r
3356  */\r
3357 var TextDocumentItem;\r
3358 (function (TextDocumentItem) {\r
3359     /**\r
3360      * Creates a new TextDocumentItem literal.\r
3361      * @param uri The document's uri.\r
3362      * @param languageId The document's language identifier.\r
3363      * @param version The document's version number.\r
3364      * @param text The document's text.\r
3365      */\r
3366     function create(uri, languageId, version, text) {\r
3367         return { uri: uri, languageId: languageId, version: version, text: text };\r
3368     }\r
3369     TextDocumentItem.create = create;\r
3370     /**\r
3371      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
3372      */\r
3373     function is(value) {\r
3374         var candidate = value;\r
3375         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
3376     }\r
3377     TextDocumentItem.is = is;\r
3378 })(TextDocumentItem || (TextDocumentItem = {}));\r
3379 /**\r
3380  * Describes the content type that a client supports in various\r
3381  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
3382  *\r
3383  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
3384  * are reserved for internal usage.\r
3385  */\r
3386 var MarkupKind;\r
3387 (function (MarkupKind) {\r
3388     /**\r
3389      * Plain text is supported as a content format\r
3390      */\r
3391     MarkupKind.PlainText = 'plaintext';\r
3392     /**\r
3393      * Markdown is supported as a content format\r
3394      */\r
3395     MarkupKind.Markdown = 'markdown';\r
3396 })(MarkupKind || (MarkupKind = {}));\r
3397 (function (MarkupKind) {\r
3398     /**\r
3399      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
3400      */\r
3401     function is(value) {\r
3402         var candidate = value;\r
3403         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
3404     }\r
3405     MarkupKind.is = is;\r
3406 })(MarkupKind || (MarkupKind = {}));\r
3407 var MarkupContent;\r
3408 (function (MarkupContent) {\r
3409     /**\r
3410      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
3411      */\r
3412     function is(value) {\r
3413         var candidate = value;\r
3414         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
3415     }\r
3416     MarkupContent.is = is;\r
3417 })(MarkupContent || (MarkupContent = {}));\r
3418 /**\r
3419  * The kind of a completion entry.\r
3420  */\r
3421 var CompletionItemKind;\r
3422 (function (CompletionItemKind) {\r
3423     CompletionItemKind.Text = 1;\r
3424     CompletionItemKind.Method = 2;\r
3425     CompletionItemKind.Function = 3;\r
3426     CompletionItemKind.Constructor = 4;\r
3427     CompletionItemKind.Field = 5;\r
3428     CompletionItemKind.Variable = 6;\r
3429     CompletionItemKind.Class = 7;\r
3430     CompletionItemKind.Interface = 8;\r
3431     CompletionItemKind.Module = 9;\r
3432     CompletionItemKind.Property = 10;\r
3433     CompletionItemKind.Unit = 11;\r
3434     CompletionItemKind.Value = 12;\r
3435     CompletionItemKind.Enum = 13;\r
3436     CompletionItemKind.Keyword = 14;\r
3437     CompletionItemKind.Snippet = 15;\r
3438     CompletionItemKind.Color = 16;\r
3439     CompletionItemKind.File = 17;\r
3440     CompletionItemKind.Reference = 18;\r
3441     CompletionItemKind.Folder = 19;\r
3442     CompletionItemKind.EnumMember = 20;\r
3443     CompletionItemKind.Constant = 21;\r
3444     CompletionItemKind.Struct = 22;\r
3445     CompletionItemKind.Event = 23;\r
3446     CompletionItemKind.Operator = 24;\r
3447     CompletionItemKind.TypeParameter = 25;\r
3448 })(CompletionItemKind || (CompletionItemKind = {}));\r
3449 /**\r
3450  * Defines whether the insert text in a completion item should be interpreted as\r
3451  * plain text or a snippet.\r
3452  */\r
3453 var InsertTextFormat;\r
3454 (function (InsertTextFormat) {\r
3455     /**\r
3456      * The primary text to be inserted is treated as a plain string.\r
3457      */\r
3458     InsertTextFormat.PlainText = 1;\r
3459     /**\r
3460      * The primary text to be inserted is treated as a snippet.\r
3461      *\r
3462      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
3463      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
3464      * the end of the snippet. Placeholders with equal identifiers are linked,\r
3465      * that is typing in one will update others too.\r
3466      *\r
3467      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
3468      */\r
3469     InsertTextFormat.Snippet = 2;\r
3470 })(InsertTextFormat || (InsertTextFormat = {}));\r
3471 /**\r
3472  * Completion item tags are extra annotations that tweak the rendering of a completion\r
3473  * item.\r
3474  *\r
3475  * @since 3.15.0\r
3476  */\r
3477 var CompletionItemTag;\r
3478 (function (CompletionItemTag) {\r
3479     /**\r
3480      * Render a completion as obsolete, usually using a strike-out.\r
3481      */\r
3482     CompletionItemTag.Deprecated = 1;\r
3483 })(CompletionItemTag || (CompletionItemTag = {}));\r
3484 /**\r
3485  * The CompletionItem namespace provides functions to deal with\r
3486  * completion items.\r
3487  */\r
3488 var CompletionItem;\r
3489 (function (CompletionItem) {\r
3490     /**\r
3491      * Create a completion item and seed it with a label.\r
3492      * @param label The completion item's label\r
3493      */\r
3494     function create(label) {\r
3495         return { label: label };\r
3496     }\r
3497     CompletionItem.create = create;\r
3498 })(CompletionItem || (CompletionItem = {}));\r
3499 /**\r
3500  * The CompletionList namespace provides functions to deal with\r
3501  * completion lists.\r
3502  */\r
3503 var CompletionList;\r
3504 (function (CompletionList) {\r
3505     /**\r
3506      * Creates a new completion list.\r
3507      *\r
3508      * @param items The completion items.\r
3509      * @param isIncomplete The list is not complete.\r
3510      */\r
3511     function create(items, isIncomplete) {\r
3512         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
3513     }\r
3514     CompletionList.create = create;\r
3515 })(CompletionList || (CompletionList = {}));\r
3516 var MarkedString;\r
3517 (function (MarkedString) {\r
3518     /**\r
3519      * Creates a marked string from plain text.\r
3520      *\r
3521      * @param plainText The plain text.\r
3522      */\r
3523     function fromPlainText(plainText) {\r
3524         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
3525     }\r
3526     MarkedString.fromPlainText = fromPlainText;\r
3527     /**\r
3528      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
3529      */\r
3530     function is(value) {\r
3531         var candidate = value;\r
3532         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
3533     }\r
3534     MarkedString.is = is;\r
3535 })(MarkedString || (MarkedString = {}));\r
3536 var Hover;\r
3537 (function (Hover) {\r
3538     /**\r
3539      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
3540      */\r
3541     function is(value) {\r
3542         var candidate = value;\r
3543         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
3544             MarkedString.is(candidate.contents) ||\r
3545             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
3546     }\r
3547     Hover.is = is;\r
3548 })(Hover || (Hover = {}));\r
3549 /**\r
3550  * The ParameterInformation namespace provides helper functions to work with\r
3551  * [ParameterInformation](#ParameterInformation) literals.\r
3552  */\r
3553 var ParameterInformation;\r
3554 (function (ParameterInformation) {\r
3555     /**\r
3556      * Creates a new parameter information literal.\r
3557      *\r
3558      * @param label A label string.\r
3559      * @param documentation A doc string.\r
3560      */\r
3561     function create(label, documentation) {\r
3562         return documentation ? { label: label, documentation: documentation } : { label: label };\r
3563     }\r
3564     ParameterInformation.create = create;\r
3565 })(ParameterInformation || (ParameterInformation = {}));\r
3566 /**\r
3567  * The SignatureInformation namespace provides helper functions to work with\r
3568  * [SignatureInformation](#SignatureInformation) literals.\r
3569  */\r
3570 var SignatureInformation;\r
3571 (function (SignatureInformation) {\r
3572     function create(label, documentation) {\r
3573         var parameters = [];\r
3574         for (var _i = 2; _i < arguments.length; _i++) {\r
3575             parameters[_i - 2] = arguments[_i];\r
3576         }\r
3577         var result = { label: label };\r
3578         if (Is.defined(documentation)) {\r
3579             result.documentation = documentation;\r
3580         }\r
3581         if (Is.defined(parameters)) {\r
3582             result.parameters = parameters;\r
3583         }\r
3584         else {\r
3585             result.parameters = [];\r
3586         }\r
3587         return result;\r
3588     }\r
3589     SignatureInformation.create = create;\r
3590 })(SignatureInformation || (SignatureInformation = {}));\r
3591 /**\r
3592  * A document highlight kind.\r
3593  */\r
3594 var DocumentHighlightKind;\r
3595 (function (DocumentHighlightKind) {\r
3596     /**\r
3597      * A textual occurrence.\r
3598      */\r
3599     DocumentHighlightKind.Text = 1;\r
3600     /**\r
3601      * Read-access of a symbol, like reading a variable.\r
3602      */\r
3603     DocumentHighlightKind.Read = 2;\r
3604     /**\r
3605      * Write-access of a symbol, like writing to a variable.\r
3606      */\r
3607     DocumentHighlightKind.Write = 3;\r
3608 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
3609 /**\r
3610  * DocumentHighlight namespace to provide helper functions to work with\r
3611  * [DocumentHighlight](#DocumentHighlight) literals.\r
3612  */\r
3613 var DocumentHighlight;\r
3614 (function (DocumentHighlight) {\r
3615     /**\r
3616      * Create a DocumentHighlight object.\r
3617      * @param range The range the highlight applies to.\r
3618      */\r
3619     function create(range, kind) {\r
3620         var result = { range: range };\r
3621         if (Is.number(kind)) {\r
3622             result.kind = kind;\r
3623         }\r
3624         return result;\r
3625     }\r
3626     DocumentHighlight.create = create;\r
3627 })(DocumentHighlight || (DocumentHighlight = {}));\r
3628 /**\r
3629  * A symbol kind.\r
3630  */\r
3631 var SymbolKind;\r
3632 (function (SymbolKind) {\r
3633     SymbolKind.File = 1;\r
3634     SymbolKind.Module = 2;\r
3635     SymbolKind.Namespace = 3;\r
3636     SymbolKind.Package = 4;\r
3637     SymbolKind.Class = 5;\r
3638     SymbolKind.Method = 6;\r
3639     SymbolKind.Property = 7;\r
3640     SymbolKind.Field = 8;\r
3641     SymbolKind.Constructor = 9;\r
3642     SymbolKind.Enum = 10;\r
3643     SymbolKind.Interface = 11;\r
3644     SymbolKind.Function = 12;\r
3645     SymbolKind.Variable = 13;\r
3646     SymbolKind.Constant = 14;\r
3647     SymbolKind.String = 15;\r
3648     SymbolKind.Number = 16;\r
3649     SymbolKind.Boolean = 17;\r
3650     SymbolKind.Array = 18;\r
3651     SymbolKind.Object = 19;\r
3652     SymbolKind.Key = 20;\r
3653     SymbolKind.Null = 21;\r
3654     SymbolKind.EnumMember = 22;\r
3655     SymbolKind.Struct = 23;\r
3656     SymbolKind.Event = 24;\r
3657     SymbolKind.Operator = 25;\r
3658     SymbolKind.TypeParameter = 26;\r
3659 })(SymbolKind || (SymbolKind = {}));\r
3660 /**\r
3661  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
3662  * @since 3.15\r
3663  */\r
3664 var SymbolTag;\r
3665 (function (SymbolTag) {\r
3666     /**\r
3667      * Render a symbol as obsolete, usually using a strike-out.\r
3668      */\r
3669     SymbolTag.Deprecated = 1;\r
3670 })(SymbolTag || (SymbolTag = {}));\r
3671 var SymbolInformation;\r
3672 (function (SymbolInformation) {\r
3673     /**\r
3674      * Creates a new symbol information literal.\r
3675      *\r
3676      * @param name The name of the symbol.\r
3677      * @param kind The kind of the symbol.\r
3678      * @param range The range of the location of the symbol.\r
3679      * @param uri The resource of the location of symbol, defaults to the current document.\r
3680      * @param containerName The name of the symbol containing the symbol.\r
3681      */\r
3682     function create(name, kind, range, uri, containerName) {\r
3683         var result = {\r
3684             name: name,\r
3685             kind: kind,\r
3686             location: { uri: uri, range: range }\r
3687         };\r
3688         if (containerName) {\r
3689             result.containerName = containerName;\r
3690         }\r
3691         return result;\r
3692     }\r
3693     SymbolInformation.create = create;\r
3694 })(SymbolInformation || (SymbolInformation = {}));\r
3695 var DocumentSymbol;\r
3696 (function (DocumentSymbol) {\r
3697     /**\r
3698      * Creates a new symbol information literal.\r
3699      *\r
3700      * @param name The name of the symbol.\r
3701      * @param detail The detail of the symbol.\r
3702      * @param kind The kind of the symbol.\r
3703      * @param range The range of the symbol.\r
3704      * @param selectionRange The selectionRange of the symbol.\r
3705      * @param children Children of the symbol.\r
3706      */\r
3707     function create(name, detail, kind, range, selectionRange, children) {\r
3708         var result = {\r
3709             name: name,\r
3710             detail: detail,\r
3711             kind: kind,\r
3712             range: range,\r
3713             selectionRange: selectionRange\r
3714         };\r
3715         if (children !== void 0) {\r
3716             result.children = children;\r
3717         }\r
3718         return result;\r
3719     }\r
3720     DocumentSymbol.create = create;\r
3721     /**\r
3722      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
3723      */\r
3724     function is(value) {\r
3725         var candidate = value;\r
3726         return candidate &&\r
3727             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
3728             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
3729             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
3730             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
3731             (candidate.children === void 0 || Array.isArray(candidate.children));\r
3732     }\r
3733     DocumentSymbol.is = is;\r
3734 })(DocumentSymbol || (DocumentSymbol = {}));\r
3735 /**\r
3736  * A set of predefined code action kinds\r
3737  */\r
3738 var CodeActionKind;\r
3739 (function (CodeActionKind) {\r
3740     /**\r
3741      * Empty kind.\r
3742      */\r
3743     CodeActionKind.Empty = '';\r
3744     /**\r
3745      * Base kind for quickfix actions: 'quickfix'\r
3746      */\r
3747     CodeActionKind.QuickFix = 'quickfix';\r
3748     /**\r
3749      * Base kind for refactoring actions: 'refactor'\r
3750      */\r
3751     CodeActionKind.Refactor = 'refactor';\r
3752     /**\r
3753      * Base kind for refactoring extraction actions: 'refactor.extract'\r
3754      *\r
3755      * Example extract actions:\r
3756      *\r
3757      * - Extract method\r
3758      * - Extract function\r
3759      * - Extract variable\r
3760      * - Extract interface from class\r
3761      * - ...\r
3762      */\r
3763     CodeActionKind.RefactorExtract = 'refactor.extract';\r
3764     /**\r
3765      * Base kind for refactoring inline actions: 'refactor.inline'\r
3766      *\r
3767      * Example inline actions:\r
3768      *\r
3769      * - Inline function\r
3770      * - Inline variable\r
3771      * - Inline constant\r
3772      * - ...\r
3773      */\r
3774     CodeActionKind.RefactorInline = 'refactor.inline';\r
3775     /**\r
3776      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
3777      *\r
3778      * Example rewrite actions:\r
3779      *\r
3780      * - Convert JavaScript function to class\r
3781      * - Add or remove parameter\r
3782      * - Encapsulate field\r
3783      * - Make method static\r
3784      * - Move method to base class\r
3785      * - ...\r
3786      */\r
3787     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
3788     /**\r
3789      * Base kind for source actions: `source`\r
3790      *\r
3791      * Source code actions apply to the entire file.\r
3792      */\r
3793     CodeActionKind.Source = 'source';\r
3794     /**\r
3795      * Base kind for an organize imports source action: `source.organizeImports`\r
3796      */\r
3797     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
3798     /**\r
3799      * Base kind for auto-fix source actions: `source.fixAll`.\r
3800      *\r
3801      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
3802      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
3803      *\r
3804      * @since 3.15.0\r
3805      */\r
3806     CodeActionKind.SourceFixAll = 'source.fixAll';\r
3807 })(CodeActionKind || (CodeActionKind = {}));\r
3808 /**\r
3809  * The CodeActionContext namespace provides helper functions to work with\r
3810  * [CodeActionContext](#CodeActionContext) literals.\r
3811  */\r
3812 var CodeActionContext;\r
3813 (function (CodeActionContext) {\r
3814     /**\r
3815      * Creates a new CodeActionContext literal.\r
3816      */\r
3817     function create(diagnostics, only) {\r
3818         var result = { diagnostics: diagnostics };\r
3819         if (only !== void 0 && only !== null) {\r
3820             result.only = only;\r
3821         }\r
3822         return result;\r
3823     }\r
3824     CodeActionContext.create = create;\r
3825     /**\r
3826      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
3827      */\r
3828     function is(value) {\r
3829         var candidate = value;\r
3830         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
3831     }\r
3832     CodeActionContext.is = is;\r
3833 })(CodeActionContext || (CodeActionContext = {}));\r
3834 var CodeAction;\r
3835 (function (CodeAction) {\r
3836     function create(title, commandOrEdit, kind) {\r
3837         var result = { title: title };\r
3838         if (Command.is(commandOrEdit)) {\r
3839             result.command = commandOrEdit;\r
3840         }\r
3841         else {\r
3842             result.edit = commandOrEdit;\r
3843         }\r
3844         if (kind !== void 0) {\r
3845             result.kind = kind;\r
3846         }\r
3847         return result;\r
3848     }\r
3849     CodeAction.create = create;\r
3850     function is(value) {\r
3851         var candidate = value;\r
3852         return candidate && Is.string(candidate.title) &&\r
3853             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
3854             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
3855             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
3856             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
3857             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
3858             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
3859     }\r
3860     CodeAction.is = is;\r
3861 })(CodeAction || (CodeAction = {}));\r
3862 /**\r
3863  * The CodeLens namespace provides helper functions to work with\r
3864  * [CodeLens](#CodeLens) literals.\r
3865  */\r
3866 var CodeLens;\r
3867 (function (CodeLens) {\r
3868     /**\r
3869      * Creates a new CodeLens literal.\r
3870      */\r
3871     function create(range, data) {\r
3872         var result = { range: range };\r
3873         if (Is.defined(data)) {\r
3874             result.data = data;\r
3875         }\r
3876         return result;\r
3877     }\r
3878     CodeLens.create = create;\r
3879     /**\r
3880      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
3881      */\r
3882     function is(value) {\r
3883         var candidate = value;\r
3884         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
3885     }\r
3886     CodeLens.is = is;\r
3887 })(CodeLens || (CodeLens = {}));\r
3888 /**\r
3889  * The FormattingOptions namespace provides helper functions to work with\r
3890  * [FormattingOptions](#FormattingOptions) literals.\r
3891  */\r
3892 var FormattingOptions;\r
3893 (function (FormattingOptions) {\r
3894     /**\r
3895      * Creates a new FormattingOptions literal.\r
3896      */\r
3897     function create(tabSize, insertSpaces) {\r
3898         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
3899     }\r
3900     FormattingOptions.create = create;\r
3901     /**\r
3902      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
3903      */\r
3904     function is(value) {\r
3905         var candidate = value;\r
3906         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
3907     }\r
3908     FormattingOptions.is = is;\r
3909 })(FormattingOptions || (FormattingOptions = {}));\r
3910 /**\r
3911  * The DocumentLink namespace provides helper functions to work with\r
3912  * [DocumentLink](#DocumentLink) literals.\r
3913  */\r
3914 var DocumentLink;\r
3915 (function (DocumentLink) {\r
3916     /**\r
3917      * Creates a new DocumentLink literal.\r
3918      */\r
3919     function create(range, target, data) {\r
3920         return { range: range, target: target, data: data };\r
3921     }\r
3922     DocumentLink.create = create;\r
3923     /**\r
3924      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
3925      */\r
3926     function is(value) {\r
3927         var candidate = value;\r
3928         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
3929     }\r
3930     DocumentLink.is = is;\r
3931 })(DocumentLink || (DocumentLink = {}));\r
3932 /**\r
3933  * The SelectionRange namespace provides helper function to work with\r
3934  * SelectionRange literals.\r
3935  */\r
3936 var SelectionRange;\r
3937 (function (SelectionRange) {\r
3938     /**\r
3939      * Creates a new SelectionRange\r
3940      * @param range the range.\r
3941      * @param parent an optional parent.\r
3942      */\r
3943     function create(range, parent) {\r
3944         return { range: range, parent: parent };\r
3945     }\r
3946     SelectionRange.create = create;\r
3947     function is(value) {\r
3948         var candidate = value;\r
3949         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
3950     }\r
3951     SelectionRange.is = is;\r
3952 })(SelectionRange || (SelectionRange = {}));\r
3953 var EOL = ['\n', '\r\n', '\r'];\r
3954 /**\r
3955  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
3956  */\r
3957 var TextDocument;\r
3958 (function (TextDocument) {\r
3959     /**\r
3960      * Creates a new ITextDocument literal from the given uri and content.\r
3961      * @param uri The document's uri.\r
3962      * @param languageId  The document's language Id.\r
3963      * @param content The document's content.\r
3964      */\r
3965     function create(uri, languageId, version, content) {\r
3966         return new FullTextDocument(uri, languageId, version, content);\r
3967     }\r
3968     TextDocument.create = create;\r
3969     /**\r
3970      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
3971      */\r
3972     function is(value) {\r
3973         var candidate = value;\r
3974         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
3975             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
3976     }\r
3977     TextDocument.is = is;\r
3978     function applyEdits(document, edits) {\r
3979         var text = document.getText();\r
3980         var sortedEdits = mergeSort(edits, function (a, b) {\r
3981             var diff = a.range.start.line - b.range.start.line;\r
3982             if (diff === 0) {\r
3983                 return a.range.start.character - b.range.start.character;\r
3984             }\r
3985             return diff;\r
3986         });\r
3987         var lastModifiedOffset = text.length;\r
3988         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
3989             var e = sortedEdits[i];\r
3990             var startOffset = document.offsetAt(e.range.start);\r
3991             var endOffset = document.offsetAt(e.range.end);\r
3992             if (endOffset <= lastModifiedOffset) {\r
3993                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
3994             }\r
3995             else {\r
3996                 throw new Error('Overlapping edit');\r
3997             }\r
3998             lastModifiedOffset = startOffset;\r
3999         }\r
4000         return text;\r
4001     }\r
4002     TextDocument.applyEdits = applyEdits;\r
4003     function mergeSort(data, compare) {\r
4004         if (data.length <= 1) {\r
4005             // sorted\r
4006             return data;\r
4007         }\r
4008         var p = (data.length / 2) | 0;\r
4009         var left = data.slice(0, p);\r
4010         var right = data.slice(p);\r
4011         mergeSort(left, compare);\r
4012         mergeSort(right, compare);\r
4013         var leftIdx = 0;\r
4014         var rightIdx = 0;\r
4015         var i = 0;\r
4016         while (leftIdx < left.length && rightIdx < right.length) {\r
4017             var ret = compare(left[leftIdx], right[rightIdx]);\r
4018             if (ret <= 0) {\r
4019                 // smaller_equal -> take left to preserve order\r
4020                 data[i++] = left[leftIdx++];\r
4021             }\r
4022             else {\r
4023                 // greater -> take right\r
4024                 data[i++] = right[rightIdx++];\r
4025             }\r
4026         }\r
4027         while (leftIdx < left.length) {\r
4028             data[i++] = left[leftIdx++];\r
4029         }\r
4030         while (rightIdx < right.length) {\r
4031             data[i++] = right[rightIdx++];\r
4032         }\r
4033         return data;\r
4034     }\r
4035 })(TextDocument || (TextDocument = {}));\r
4036 var FullTextDocument = /** @class */ (function () {\r
4037     function FullTextDocument(uri, languageId, version, content) {\r
4038         this._uri = uri;\r
4039         this._languageId = languageId;\r
4040         this._version = version;\r
4041         this._content = content;\r
4042         this._lineOffsets = undefined;\r
4043     }\r
4044     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
4045         get: function () {\r
4046             return this._uri;\r
4047         },\r
4048         enumerable: true,\r
4049         configurable: true\r
4050     });\r
4051     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
4052         get: function () {\r
4053             return this._languageId;\r
4054         },\r
4055         enumerable: true,\r
4056         configurable: true\r
4057     });\r
4058     Object.defineProperty(FullTextDocument.prototype, "version", {\r
4059         get: function () {\r
4060             return this._version;\r
4061         },\r
4062         enumerable: true,\r
4063         configurable: true\r
4064     });\r
4065     FullTextDocument.prototype.getText = function (range) {\r
4066         if (range) {\r
4067             var start = this.offsetAt(range.start);\r
4068             var end = this.offsetAt(range.end);\r
4069             return this._content.substring(start, end);\r
4070         }\r
4071         return this._content;\r
4072     };\r
4073     FullTextDocument.prototype.update = function (event, version) {\r
4074         this._content = event.text;\r
4075         this._version = version;\r
4076         this._lineOffsets = undefined;\r
4077     };\r
4078     FullTextDocument.prototype.getLineOffsets = function () {\r
4079         if (this._lineOffsets === undefined) {\r
4080             var lineOffsets = [];\r
4081             var text = this._content;\r
4082             var isLineStart = true;\r
4083             for (var i = 0; i < text.length; i++) {\r
4084                 if (isLineStart) {\r
4085                     lineOffsets.push(i);\r
4086                     isLineStart = false;\r
4087                 }\r
4088                 var ch = text.charAt(i);\r
4089                 isLineStart = (ch === '\r' || ch === '\n');\r
4090                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
4091                     i++;\r
4092                 }\r
4093             }\r
4094             if (isLineStart && text.length > 0) {\r
4095                 lineOffsets.push(text.length);\r
4096             }\r
4097             this._lineOffsets = lineOffsets;\r
4098         }\r
4099         return this._lineOffsets;\r
4100     };\r
4101     FullTextDocument.prototype.positionAt = function (offset) {\r
4102         offset = Math.max(Math.min(offset, this._content.length), 0);\r
4103         var lineOffsets = this.getLineOffsets();\r
4104         var low = 0, high = lineOffsets.length;\r
4105         if (high === 0) {\r
4106             return Position.create(0, offset);\r
4107         }\r
4108         while (low < high) {\r
4109             var mid = Math.floor((low + high) / 2);\r
4110             if (lineOffsets[mid] > offset) {\r
4111                 high = mid;\r
4112             }\r
4113             else {\r
4114                 low = mid + 1;\r
4115             }\r
4116         }\r
4117         // low is the least x for which the line offset is larger than the current offset\r
4118         // or array.length if no line offset is larger than the current offset\r
4119         var line = low - 1;\r
4120         return Position.create(line, offset - lineOffsets[line]);\r
4121     };\r
4122     FullTextDocument.prototype.offsetAt = function (position) {\r
4123         var lineOffsets = this.getLineOffsets();\r
4124         if (position.line >= lineOffsets.length) {\r
4125             return this._content.length;\r
4126         }\r
4127         else if (position.line < 0) {\r
4128             return 0;\r
4129         }\r
4130         var lineOffset = lineOffsets[position.line];\r
4131         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
4132         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
4133     };\r
4134     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
4135         get: function () {\r
4136             return this.getLineOffsets().length;\r
4137         },\r
4138         enumerable: true,\r
4139         configurable: true\r
4140     });\r
4141     return FullTextDocument;\r
4142 }());\r
4143 var Is;\r
4144 (function (Is) {\r
4145     var toString = Object.prototype.toString;\r
4146     function defined(value) {\r
4147         return typeof value !== 'undefined';\r
4148     }\r
4149     Is.defined = defined;\r
4150     function undefined(value) {\r
4151         return typeof value === 'undefined';\r
4152     }\r
4153     Is.undefined = undefined;\r
4154     function boolean(value) {\r
4155         return value === true || value === false;\r
4156     }\r
4157     Is.boolean = boolean;\r
4158     function string(value) {\r
4159         return toString.call(value) === '[object String]';\r
4160     }\r
4161     Is.string = string;\r
4162     function number(value) {\r
4163         return toString.call(value) === '[object Number]';\r
4164     }\r
4165     Is.number = number;\r
4166     function func(value) {\r
4167         return toString.call(value) === '[object Function]';\r
4168     }\r
4169     Is.func = func;\r
4170     function objectLiteral(value) {\r
4171         // Strictly speaking class instances pass this check as well. Since the LSP\r
4172         // doesn't use classes we ignore this for now. If we do we need to add something\r
4173         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4174         return value !== null && typeof value === 'object';\r
4175     }\r
4176     Is.objectLiteral = objectLiteral;\r
4177     function typedArray(value, check) {\r
4178         return Array.isArray(value) && value.every(check);\r
4179     }\r
4180     Is.typedArray = typedArray;\r
4181 })(Is || (Is = {}));\r
4182
4183
4184 /***/ }),
4185 /* 18 */
4186 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4187
4188 "use strict";
4189 /* --------------------------------------------------------------------------------------------\r
4190  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4191  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4192  * ------------------------------------------------------------------------------------------ */\r
4193 \r
4194 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4195 const Is = __webpack_require__(19);\r
4196 const vscode_jsonrpc_1 = __webpack_require__(3);\r
4197 const messages_1 = __webpack_require__(20);\r
4198 const protocol_implementation_1 = __webpack_require__(21);\r
4199 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
4200 const protocol_typeDefinition_1 = __webpack_require__(22);\r
4201 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
4202 const protocol_workspaceFolders_1 = __webpack_require__(23);\r
4203 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
4204 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
4205 const protocol_configuration_1 = __webpack_require__(24);\r
4206 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
4207 const protocol_colorProvider_1 = __webpack_require__(25);\r
4208 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
4209 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
4210 const protocol_foldingRange_1 = __webpack_require__(26);\r
4211 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
4212 const protocol_declaration_1 = __webpack_require__(27);\r
4213 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
4214 const protocol_selectionRange_1 = __webpack_require__(28);\r
4215 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
4216 const protocol_progress_1 = __webpack_require__(29);\r
4217 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
4218 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
4219 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
4220 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4221 let __noDynamicImport;\r
4222 /**\r
4223  * The DocumentFilter namespace provides helper functions to work with\r
4224  * [DocumentFilter](#DocumentFilter) literals.\r
4225  */\r
4226 var DocumentFilter;\r
4227 (function (DocumentFilter) {\r
4228     function is(value) {\r
4229         const candidate = value;\r
4230         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
4231     }\r
4232     DocumentFilter.is = is;\r
4233 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
4234 /**\r
4235  * The DocumentSelector namespace provides helper functions to work with\r
4236  * [DocumentSelector](#DocumentSelector)s.\r
4237  */\r
4238 var DocumentSelector;\r
4239 (function (DocumentSelector) {\r
4240     function is(value) {\r
4241         if (!Array.isArray(value)) {\r
4242             return false;\r
4243         }\r
4244         for (let elem of value) {\r
4245             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
4246                 return false;\r
4247             }\r
4248         }\r
4249         return true;\r
4250     }\r
4251     DocumentSelector.is = is;\r
4252 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
4253 /**\r
4254  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
4255  * handler on the client side.\r
4256  */\r
4257 var RegistrationRequest;\r
4258 (function (RegistrationRequest) {\r
4259     RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
4260 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
4261 /**\r
4262  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
4263  * handler on the client side.\r
4264  */\r
4265 var UnregistrationRequest;\r
4266 (function (UnregistrationRequest) {\r
4267     UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
4268 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
4269 var ResourceOperationKind;\r
4270 (function (ResourceOperationKind) {\r
4271     /**\r
4272      * Supports creating new files and folders.\r
4273      */\r
4274     ResourceOperationKind.Create = 'create';\r
4275     /**\r
4276      * Supports renaming existing files and folders.\r
4277      */\r
4278     ResourceOperationKind.Rename = 'rename';\r
4279     /**\r
4280      * Supports deleting existing files and folders.\r
4281      */\r
4282     ResourceOperationKind.Delete = 'delete';\r
4283 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
4284 var FailureHandlingKind;\r
4285 (function (FailureHandlingKind) {\r
4286     /**\r
4287      * Applying the workspace change is simply aborted if one of the changes provided\r
4288      * fails. All operations executed before the failing operation stay executed.\r
4289      */\r
4290     FailureHandlingKind.Abort = 'abort';\r
4291     /**\r
4292      * All operations are executed transactional. That means they either all\r
4293      * succeed or no changes at all are applied to the workspace.\r
4294      */\r
4295     FailureHandlingKind.Transactional = 'transactional';\r
4296     /**\r
4297      * If the workspace edit contains only textual file changes they are executed transactional.\r
4298      * If resource changes (create, rename or delete file) are part of the change the failure\r
4299      * handling startegy is abort.\r
4300      */\r
4301     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
4302     /**\r
4303      * The client tries to undo the operations already executed. But there is no\r
4304      * guarantee that this is succeeding.\r
4305      */\r
4306     FailureHandlingKind.Undo = 'undo';\r
4307 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
4308 /**\r
4309  * The StaticRegistrationOptions namespace provides helper functions to work with\r
4310  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
4311  */\r
4312 var StaticRegistrationOptions;\r
4313 (function (StaticRegistrationOptions) {\r
4314     function hasId(value) {\r
4315         const candidate = value;\r
4316         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
4317     }\r
4318     StaticRegistrationOptions.hasId = hasId;\r
4319 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
4320 /**\r
4321  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
4322  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
4323  */\r
4324 var TextDocumentRegistrationOptions;\r
4325 (function (TextDocumentRegistrationOptions) {\r
4326     function is(value) {\r
4327         const candidate = value;\r
4328         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
4329     }\r
4330     TextDocumentRegistrationOptions.is = is;\r
4331 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
4332 /**\r
4333  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
4334  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
4335  */\r
4336 var WorkDoneProgressOptions;\r
4337 (function (WorkDoneProgressOptions) {\r
4338     function is(value) {\r
4339         const candidate = value;\r
4340         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
4341     }\r
4342     WorkDoneProgressOptions.is = is;\r
4343     function hasWorkDoneProgress(value) {\r
4344         const candidate = value;\r
4345         return candidate && Is.boolean(candidate.workDoneProgress);\r
4346     }\r
4347     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
4348 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
4349 /**\r
4350  * The initialize request is sent from the client to the server.\r
4351  * It is sent once as the request after starting up the server.\r
4352  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
4353  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
4354  * resolves to such.\r
4355  */\r
4356 var InitializeRequest;\r
4357 (function (InitializeRequest) {\r
4358     InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
4359 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
4360 /**\r
4361  * Known error codes for an `InitializeError`;\r
4362  */\r
4363 var InitializeError;\r
4364 (function (InitializeError) {\r
4365     /**\r
4366      * If the protocol version provided by the client can't be handled by the server.\r
4367      * @deprecated This initialize error got replaced by client capabilities. There is\r
4368      * no version handshake in version 3.0x\r
4369      */\r
4370     InitializeError.unknownProtocolVersion = 1;\r
4371 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
4372 /**\r
4373  * The intialized notification is sent from the client to the\r
4374  * server after the client is fully initialized and the server\r
4375  * is allowed to send requests from the server to the client.\r
4376  */\r
4377 var InitializedNotification;\r
4378 (function (InitializedNotification) {\r
4379     InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
4380 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
4381 //---- Shutdown Method ----\r
4382 /**\r
4383  * A shutdown request is sent from the client to the server.\r
4384  * It is sent once when the client decides to shutdown the\r
4385  * server. The only notification that is sent after a shutdown request\r
4386  * is the exit event.\r
4387  */\r
4388 var ShutdownRequest;\r
4389 (function (ShutdownRequest) {\r
4390     ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
4391 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
4392 //---- Exit Notification ----\r
4393 /**\r
4394  * The exit event is sent from the client to the server to\r
4395  * ask the server to exit its process.\r
4396  */\r
4397 var ExitNotification;\r
4398 (function (ExitNotification) {\r
4399     ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
4400 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
4401 /**\r
4402  * The configuration change notification is sent from the client to the server\r
4403  * when the client's configuration has changed. The notification contains\r
4404  * the changed configuration as defined by the language client.\r
4405  */\r
4406 var DidChangeConfigurationNotification;\r
4407 (function (DidChangeConfigurationNotification) {\r
4408     DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
4409 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
4410 //---- Message show and log notifications ----\r
4411 /**\r
4412  * The message type\r
4413  */\r
4414 var MessageType;\r
4415 (function (MessageType) {\r
4416     /**\r
4417      * An error message.\r
4418      */\r
4419     MessageType.Error = 1;\r
4420     /**\r
4421      * A warning message.\r
4422      */\r
4423     MessageType.Warning = 2;\r
4424     /**\r
4425      * An information message.\r
4426      */\r
4427     MessageType.Info = 3;\r
4428     /**\r
4429      * A log message.\r
4430      */\r
4431     MessageType.Log = 4;\r
4432 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
4433 /**\r
4434  * The show message notification is sent from a server to a client to ask\r
4435  * the client to display a particular message in the user interface.\r
4436  */\r
4437 var ShowMessageNotification;\r
4438 (function (ShowMessageNotification) {\r
4439     ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
4440 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
4441 /**\r
4442  * The show message request is sent from the server to the client to show a message\r
4443  * and a set of options actions to the user.\r
4444  */\r
4445 var ShowMessageRequest;\r
4446 (function (ShowMessageRequest) {\r
4447     ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
4448 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
4449 /**\r
4450  * The log message notification is sent from the server to the client to ask\r
4451  * the client to log a particular message.\r
4452  */\r
4453 var LogMessageNotification;\r
4454 (function (LogMessageNotification) {\r
4455     LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
4456 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
4457 //---- Telemetry notification\r
4458 /**\r
4459  * The telemetry event notification is sent from the server to the client to ask\r
4460  * the client to log telemetry data.\r
4461  */\r
4462 var TelemetryEventNotification;\r
4463 (function (TelemetryEventNotification) {\r
4464     TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
4465 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
4466 /**\r
4467  * Defines how the host (editor) should sync\r
4468  * document changes to the language server.\r
4469  */\r
4470 var TextDocumentSyncKind;\r
4471 (function (TextDocumentSyncKind) {\r
4472     /**\r
4473      * Documents should not be synced at all.\r
4474      */\r
4475     TextDocumentSyncKind.None = 0;\r
4476     /**\r
4477      * Documents are synced by always sending the full content\r
4478      * of the document.\r
4479      */\r
4480     TextDocumentSyncKind.Full = 1;\r
4481     /**\r
4482      * Documents are synced by sending the full content on open.\r
4483      * After that only incremental updates to the document are\r
4484      * send.\r
4485      */\r
4486     TextDocumentSyncKind.Incremental = 2;\r
4487 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
4488 /**\r
4489  * The document open notification is sent from the client to the server to signal\r
4490  * newly opened text documents. The document's truth is now managed by the client\r
4491  * and the server must not try to read the document's truth using the document's\r
4492  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
4493  * mean that its content is presented in an editor. An open notification must not\r
4494  * be sent more than once without a corresponding close notification send before.\r
4495  * This means open and close notification must be balanced and the max open count\r
4496  * is one.\r
4497  */\r
4498 var DidOpenTextDocumentNotification;\r
4499 (function (DidOpenTextDocumentNotification) {\r
4500     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
4501     DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
4502 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
4503 /**\r
4504  * The document change notification is sent from the client to the server to signal\r
4505  * changes to a text document.\r
4506  */\r
4507 var DidChangeTextDocumentNotification;\r
4508 (function (DidChangeTextDocumentNotification) {\r
4509     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
4510     DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
4511 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
4512 /**\r
4513  * The document close notification is sent from the client to the server when\r
4514  * the document got closed in the client. The document's truth now exists where\r
4515  * the document's uri points to (e.g. if the document's uri is a file uri the\r
4516  * truth now exists on disk). As with the open notification the close notification\r
4517  * is about managing the document's content. Receiving a close notification\r
4518  * doesn't mean that the document was open in an editor before. A close\r
4519  * notification requires a previous open notification to be sent.\r
4520  */\r
4521 var DidCloseTextDocumentNotification;\r
4522 (function (DidCloseTextDocumentNotification) {\r
4523     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
4524     DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
4525 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
4526 /**\r
4527  * The document save notification is sent from the client to the server when\r
4528  * the document got saved in the client.\r
4529  */\r
4530 var DidSaveTextDocumentNotification;\r
4531 (function (DidSaveTextDocumentNotification) {\r
4532     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
4533     DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
4534 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
4535 /**\r
4536  * Represents reasons why a text document is saved.\r
4537  */\r
4538 var TextDocumentSaveReason;\r
4539 (function (TextDocumentSaveReason) {\r
4540     /**\r
4541      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
4542      * or by an API call.\r
4543      */\r
4544     TextDocumentSaveReason.Manual = 1;\r
4545     /**\r
4546      * Automatic after a delay.\r
4547      */\r
4548     TextDocumentSaveReason.AfterDelay = 2;\r
4549     /**\r
4550      * When the editor lost focus.\r
4551      */\r
4552     TextDocumentSaveReason.FocusOut = 3;\r
4553 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
4554 /**\r
4555  * A document will save notification is sent from the client to the server before\r
4556  * the document is actually saved.\r
4557  */\r
4558 var WillSaveTextDocumentNotification;\r
4559 (function (WillSaveTextDocumentNotification) {\r
4560     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
4561     WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
4562 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
4563 /**\r
4564  * A document will save request is sent from the client to the server before\r
4565  * the document is actually saved. The request can return an array of TextEdits\r
4566  * which will be applied to the text document before it is saved. Please note that\r
4567  * clients might drop results if computing the text edits took too long or if a\r
4568  * server constantly fails on this request. This is done to keep the save fast and\r
4569  * reliable.\r
4570  */\r
4571 var WillSaveTextDocumentWaitUntilRequest;\r
4572 (function (WillSaveTextDocumentWaitUntilRequest) {\r
4573     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
4574     WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
4575 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
4576 /**\r
4577  * The watched files notification is sent from the client to the server when\r
4578  * the client detects changes to file watched by the language client.\r
4579  */\r
4580 var DidChangeWatchedFilesNotification;\r
4581 (function (DidChangeWatchedFilesNotification) {\r
4582     DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
4583 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
4584 /**\r
4585  * The file event type\r
4586  */\r
4587 var FileChangeType;\r
4588 (function (FileChangeType) {\r
4589     /**\r
4590      * The file got created.\r
4591      */\r
4592     FileChangeType.Created = 1;\r
4593     /**\r
4594      * The file got changed.\r
4595      */\r
4596     FileChangeType.Changed = 2;\r
4597     /**\r
4598      * The file got deleted.\r
4599      */\r
4600     FileChangeType.Deleted = 3;\r
4601 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
4602 var WatchKind;\r
4603 (function (WatchKind) {\r
4604     /**\r
4605      * Interested in create events.\r
4606      */\r
4607     WatchKind.Create = 1;\r
4608     /**\r
4609      * Interested in change events\r
4610      */\r
4611     WatchKind.Change = 2;\r
4612     /**\r
4613      * Interested in delete events\r
4614      */\r
4615     WatchKind.Delete = 4;\r
4616 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
4617 /**\r
4618  * Diagnostics notification are sent from the server to the client to signal\r
4619  * results of validation runs.\r
4620  */\r
4621 var PublishDiagnosticsNotification;\r
4622 (function (PublishDiagnosticsNotification) {\r
4623     PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
4624 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
4625 /**\r
4626  * How a completion was triggered\r
4627  */\r
4628 var CompletionTriggerKind;\r
4629 (function (CompletionTriggerKind) {\r
4630     /**\r
4631      * Completion was triggered by typing an identifier (24x7 code\r
4632      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
4633      */\r
4634     CompletionTriggerKind.Invoked = 1;\r
4635     /**\r
4636      * Completion was triggered by a trigger character specified by\r
4637      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
4638      */\r
4639     CompletionTriggerKind.TriggerCharacter = 2;\r
4640     /**\r
4641      * Completion was re-triggered as current completion list is incomplete\r
4642      */\r
4643     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
4644 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
4645 /**\r
4646  * Request to request completion at a given text document position. The request's\r
4647  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
4648  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
4649  * or a Thenable that resolves to such.\r
4650  *\r
4651  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
4652  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
4653  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
4654  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
4655  */\r
4656 var CompletionRequest;\r
4657 (function (CompletionRequest) {\r
4658     CompletionRequest.method = 'textDocument/completion';\r
4659     CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
4660     /** @deprecated Use CompletionRequest.type */\r
4661     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4662 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
4663 /**\r
4664  * Request to resolve additional information for a given completion item.The request's\r
4665  * parameter is of type [CompletionItem](#CompletionItem) the response\r
4666  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
4667  */\r
4668 var CompletionResolveRequest;\r
4669 (function (CompletionResolveRequest) {\r
4670     CompletionResolveRequest.method = 'completionItem/resolve';\r
4671     CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
4672 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
4673 /**\r
4674  * Request to request hover information at a given text document position. The request's\r
4675  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
4676  * type [Hover](#Hover) or a Thenable that resolves to such.\r
4677  */\r
4678 var HoverRequest;\r
4679 (function (HoverRequest) {\r
4680     HoverRequest.method = 'textDocument/hover';\r
4681     HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
4682 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
4683 /**\r
4684  * How a signature help was triggered.\r
4685  *\r
4686  * @since 3.15.0\r
4687  */\r
4688 var SignatureHelpTriggerKind;\r
4689 (function (SignatureHelpTriggerKind) {\r
4690     /**\r
4691      * Signature help was invoked manually by the user or by a command.\r
4692      */\r
4693     SignatureHelpTriggerKind.Invoked = 1;\r
4694     /**\r
4695      * Signature help was triggered by a trigger character.\r
4696      */\r
4697     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
4698     /**\r
4699      * Signature help was triggered by the cursor moving or by the document content changing.\r
4700      */\r
4701     SignatureHelpTriggerKind.ContentChange = 3;\r
4702 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
4703 var SignatureHelpRequest;\r
4704 (function (SignatureHelpRequest) {\r
4705     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
4706     SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
4707 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
4708 /**\r
4709  * A request to resolve the definition location of a symbol at a given text\r
4710  * document position. The request's parameter is of type [TextDocumentPosition]\r
4711  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
4712  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
4713  * to such.\r
4714  */\r
4715 var DefinitionRequest;\r
4716 (function (DefinitionRequest) {\r
4717     DefinitionRequest.method = 'textDocument/definition';\r
4718     DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
4719     /** @deprecated Use DefinitionRequest.type */\r
4720     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4721 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
4722 /**\r
4723  * A request to resolve project-wide references for the symbol denoted\r
4724  * by the given text document position. The request's parameter is of\r
4725  * type [ReferenceParams](#ReferenceParams) the response is of type\r
4726  * [Location[]](#Location) or a Thenable that resolves to such.\r
4727  */\r
4728 var ReferencesRequest;\r
4729 (function (ReferencesRequest) {\r
4730     ReferencesRequest.method = 'textDocument/references';\r
4731     ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
4732     /** @deprecated Use ReferencesRequest.type */\r
4733     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4734 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
4735 /**\r
4736  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
4737  * text document position. The request's parameter is of type [TextDocumentPosition]\r
4738  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
4739  * (#DocumentHighlight) or a Thenable that resolves to such.\r
4740  */\r
4741 var DocumentHighlightRequest;\r
4742 (function (DocumentHighlightRequest) {\r
4743     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
4744     DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
4745     /** @deprecated Use DocumentHighlightRequest.type */\r
4746     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4747 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
4748 /**\r
4749  * A request to list all symbols found in a given text document. The request's\r
4750  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
4751  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
4752  * that resolves to such.\r
4753  */\r
4754 var DocumentSymbolRequest;\r
4755 (function (DocumentSymbolRequest) {\r
4756     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
4757     DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
4758     /** @deprecated Use DocumentSymbolRequest.type */\r
4759     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4760 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
4761 /**\r
4762  * A request to provide commands for the given text document and range.\r
4763  */\r
4764 var CodeActionRequest;\r
4765 (function (CodeActionRequest) {\r
4766     CodeActionRequest.method = 'textDocument/codeAction';\r
4767     CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
4768     /** @deprecated Use CodeActionRequest.type */\r
4769     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4770 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
4771 /**\r
4772  * A request to list project-wide symbols matching the query string given\r
4773  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
4774  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
4775  * resolves to such.\r
4776  */\r
4777 var WorkspaceSymbolRequest;\r
4778 (function (WorkspaceSymbolRequest) {\r
4779     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
4780     WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
4781     /** @deprecated Use WorkspaceSymbolRequest.type */\r
4782     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4783 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
4784 /**\r
4785  * A request to provide code lens for the given text document.\r
4786  */\r
4787 var CodeLensRequest;\r
4788 (function (CodeLensRequest) {\r
4789     CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
4790     /** @deprecated Use CodeLensRequest.type */\r
4791     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4792 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
4793 /**\r
4794  * A request to resolve a command for a given code lens.\r
4795  */\r
4796 var CodeLensResolveRequest;\r
4797 (function (CodeLensResolveRequest) {\r
4798     CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
4799 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
4800 /**\r
4801  * A request to provide document links\r
4802  */\r
4803 var DocumentLinkRequest;\r
4804 (function (DocumentLinkRequest) {\r
4805     DocumentLinkRequest.method = 'textDocument/documentLink';\r
4806     DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
4807     /** @deprecated Use DocumentLinkRequest.type */\r
4808     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4809 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
4810 /**\r
4811  * Request to resolve additional information for a given document link. The request's\r
4812  * parameter is of type [DocumentLink](#DocumentLink) the response\r
4813  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
4814  */\r
4815 var DocumentLinkResolveRequest;\r
4816 (function (DocumentLinkResolveRequest) {\r
4817     DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
4818 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
4819 /**\r
4820  * A request to to format a whole document.\r
4821  */\r
4822 var DocumentFormattingRequest;\r
4823 (function (DocumentFormattingRequest) {\r
4824     DocumentFormattingRequest.method = 'textDocument/formatting';\r
4825     DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
4826 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
4827 /**\r
4828  * A request to to format a range in a document.\r
4829  */\r
4830 var DocumentRangeFormattingRequest;\r
4831 (function (DocumentRangeFormattingRequest) {\r
4832     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
4833     DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
4834 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
4835 /**\r
4836  * A request to format a document on type.\r
4837  */\r
4838 var DocumentOnTypeFormattingRequest;\r
4839 (function (DocumentOnTypeFormattingRequest) {\r
4840     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
4841     DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
4842 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
4843 /**\r
4844  * A request to rename a symbol.\r
4845  */\r
4846 var RenameRequest;\r
4847 (function (RenameRequest) {\r
4848     RenameRequest.method = 'textDocument/rename';\r
4849     RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
4850 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
4851 /**\r
4852  * A request to test and perform the setup necessary for a rename.\r
4853  */\r
4854 var PrepareRenameRequest;\r
4855 (function (PrepareRenameRequest) {\r
4856     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
4857     PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
4858 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
4859 /**\r
4860  * A request send from the client to the server to execute a command. The request might return\r
4861  * a workspace edit which the client will apply to the workspace.\r
4862  */\r
4863 var ExecuteCommandRequest;\r
4864 (function (ExecuteCommandRequest) {\r
4865     ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
4866 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
4867 /**\r
4868  * A request sent from the server to the client to modified certain resources.\r
4869  */\r
4870 var ApplyWorkspaceEditRequest;\r
4871 (function (ApplyWorkspaceEditRequest) {\r
4872     ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
4873 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
4874
4875
4876 /***/ }),
4877 /* 19 */
4878 /***/ ((__unused_webpack_module, exports) => {
4879
4880 "use strict";
4881 /* --------------------------------------------------------------------------------------------\r
4882  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4883  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4884  * ------------------------------------------------------------------------------------------ */\r
4885 \r
4886 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4887 function boolean(value) {\r
4888     return value === true || value === false;\r
4889 }\r
4890 exports.boolean = boolean;\r
4891 function string(value) {\r
4892     return typeof value === 'string' || value instanceof String;\r
4893 }\r
4894 exports.string = string;\r
4895 function number(value) {\r
4896     return typeof value === 'number' || value instanceof Number;\r
4897 }\r
4898 exports.number = number;\r
4899 function error(value) {\r
4900     return value instanceof Error;\r
4901 }\r
4902 exports.error = error;\r
4903 function func(value) {\r
4904     return typeof value === 'function';\r
4905 }\r
4906 exports.func = func;\r
4907 function array(value) {\r
4908     return Array.isArray(value);\r
4909 }\r
4910 exports.array = array;\r
4911 function stringArray(value) {\r
4912     return array(value) && value.every(elem => string(elem));\r
4913 }\r
4914 exports.stringArray = stringArray;\r
4915 function typedArray(value, check) {\r
4916     return Array.isArray(value) && value.every(check);\r
4917 }\r
4918 exports.typedArray = typedArray;\r
4919 function objectLiteral(value) {\r
4920     // Strictly speaking class instances pass this check as well. Since the LSP\r
4921     // doesn't use classes we ignore this for now. If we do we need to add something\r
4922     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
4923     return value !== null && typeof value === 'object';\r
4924 }\r
4925 exports.objectLiteral = objectLiteral;\r
4926
4927
4928 /***/ }),
4929 /* 20 */
4930 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4931
4932 "use strict";
4933 /* --------------------------------------------------------------------------------------------\r
4934  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4935  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4936  * ------------------------------------------------------------------------------------------ */\r
4937 \r
4938 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4939 const vscode_jsonrpc_1 = __webpack_require__(3);\r
4940 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
4941     constructor(method) {\r
4942         super(method);\r
4943     }\r
4944 }\r
4945 exports.ProtocolRequestType0 = ProtocolRequestType0;\r
4946 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
4947     constructor(method) {\r
4948         super(method);\r
4949     }\r
4950 }\r
4951 exports.ProtocolRequestType = ProtocolRequestType;\r
4952 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
4953     constructor(method) {\r
4954         super(method);\r
4955     }\r
4956 }\r
4957 exports.ProtocolNotificationType = ProtocolNotificationType;\r
4958 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
4959     constructor(method) {\r
4960         super(method);\r
4961     }\r
4962 }\r
4963 exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
4964
4965
4966 /***/ }),
4967 /* 21 */
4968 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4969
4970 "use strict";
4971 /* --------------------------------------------------------------------------------------------\r
4972  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4973  * Licensed under the MIT License. See License.txt in the project root for license information.\r
4974  * ------------------------------------------------------------------------------------------ */\r
4975 \r
4976 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
4977 const vscode_jsonrpc_1 = __webpack_require__(3);\r
4978 const messages_1 = __webpack_require__(20);\r
4979 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
4980 let __noDynamicImport;\r
4981 /**\r
4982  * A request to resolve the implementation locations of a symbol at a given text\r
4983  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
4984  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
4985  * Thenable that resolves to such.\r
4986  */\r
4987 var ImplementationRequest;\r
4988 (function (ImplementationRequest) {\r
4989     ImplementationRequest.method = 'textDocument/implementation';\r
4990     ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
4991     /** @deprecated Use ImplementationRequest.type */\r
4992     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
4993 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
4994
4995
4996 /***/ }),
4997 /* 22 */
4998 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4999
5000 "use strict";
5001 /* --------------------------------------------------------------------------------------------\r
5002  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5003  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5004  * ------------------------------------------------------------------------------------------ */\r
5005 \r
5006 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5007 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5008 const messages_1 = __webpack_require__(20);\r
5009 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5010 let __noDynamicImport;\r
5011 /**\r
5012  * A request to resolve the type definition locations of a symbol at a given text\r
5013  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5014  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
5015  * Thenable that resolves to such.\r
5016  */\r
5017 var TypeDefinitionRequest;\r
5018 (function (TypeDefinitionRequest) {\r
5019     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
5020     TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
5021     /** @deprecated Use TypeDefinitionRequest.type */\r
5022     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5023 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
5024
5025
5026 /***/ }),
5027 /* 23 */
5028 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5029
5030 "use strict";
5031 /* --------------------------------------------------------------------------------------------\r
5032  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5033  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5034  * ------------------------------------------------------------------------------------------ */\r
5035 \r
5036 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5037 const messages_1 = __webpack_require__(20);\r
5038 /**\r
5039  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
5040  */\r
5041 var WorkspaceFoldersRequest;\r
5042 (function (WorkspaceFoldersRequest) {\r
5043     WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
5044 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
5045 /**\r
5046  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
5047  * folder configuration changes.\r
5048  */\r
5049 var DidChangeWorkspaceFoldersNotification;\r
5050 (function (DidChangeWorkspaceFoldersNotification) {\r
5051     DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
5052 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
5053
5054
5055 /***/ }),
5056 /* 24 */
5057 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5058
5059 "use strict";
5060 /* --------------------------------------------------------------------------------------------\r
5061  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5062  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5063  * ------------------------------------------------------------------------------------------ */\r
5064 \r
5065 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5066 const messages_1 = __webpack_require__(20);\r
5067 /**\r
5068  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
5069  * configuration setting.\r
5070  *\r
5071  * This pull model replaces the old push model were the client signaled configuration change via an\r
5072  * event. If the server still needs to react to configuration changes (since the server caches the\r
5073  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
5074  * change event and empty the cache if such an event is received.\r
5075  */\r
5076 var ConfigurationRequest;\r
5077 (function (ConfigurationRequest) {\r
5078     ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
5079 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
5080
5081
5082 /***/ }),
5083 /* 25 */
5084 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5085
5086 "use strict";
5087 /* --------------------------------------------------------------------------------------------\r
5088  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5089  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5090  * ------------------------------------------------------------------------------------------ */\r
5091 \r
5092 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5093 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5094 const messages_1 = __webpack_require__(20);\r
5095 /**\r
5096  * A request to list all color symbols found in a given text document. The request's\r
5097  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
5098  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5099  * that resolves to such.\r
5100  */\r
5101 var DocumentColorRequest;\r
5102 (function (DocumentColorRequest) {\r
5103     DocumentColorRequest.method = 'textDocument/documentColor';\r
5104     DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
5105     /** @deprecated Use DocumentColorRequest.type */\r
5106     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5107 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
5108 /**\r
5109  * A request to list all presentation for a color. The request's\r
5110  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
5111  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
5112  * that resolves to such.\r
5113  */\r
5114 var ColorPresentationRequest;\r
5115 (function (ColorPresentationRequest) {\r
5116     ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
5117 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
5118
5119
5120 /***/ }),
5121 /* 26 */
5122 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5123
5124 "use strict";
5125 \r
5126 /*---------------------------------------------------------------------------------------------\r
5127  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5128  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5129  *--------------------------------------------------------------------------------------------*/\r
5130 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5131 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5132 const messages_1 = __webpack_require__(20);\r
5133 /**\r
5134  * Enum of known range kinds\r
5135  */\r
5136 var FoldingRangeKind;\r
5137 (function (FoldingRangeKind) {\r
5138     /**\r
5139      * Folding range for a comment\r
5140      */\r
5141     FoldingRangeKind["Comment"] = "comment";\r
5142     /**\r
5143      * Folding range for a imports or includes\r
5144      */\r
5145     FoldingRangeKind["Imports"] = "imports";\r
5146     /**\r
5147      * Folding range for a region (e.g. `#region`)\r
5148      */\r
5149     FoldingRangeKind["Region"] = "region";\r
5150 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
5151 /**\r
5152  * A request to provide folding ranges in a document. The request's\r
5153  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
5154  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
5155  * that resolves to such.\r
5156  */\r
5157 var FoldingRangeRequest;\r
5158 (function (FoldingRangeRequest) {\r
5159     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
5160     FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
5161     /** @deprecated Use FoldingRangeRequest.type */\r
5162     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5163 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
5164
5165
5166 /***/ }),
5167 /* 27 */
5168 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5169
5170 "use strict";
5171 /* --------------------------------------------------------------------------------------------\r
5172  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5173  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5174  * ------------------------------------------------------------------------------------------ */\r
5175 \r
5176 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5177 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5178 const messages_1 = __webpack_require__(20);\r
5179 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
5180 let __noDynamicImport;\r
5181 /**\r
5182  * A request to resolve the type definition locations of a symbol at a given text\r
5183  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
5184  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
5185  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
5186  * to such.\r
5187  */\r
5188 var DeclarationRequest;\r
5189 (function (DeclarationRequest) {\r
5190     DeclarationRequest.method = 'textDocument/declaration';\r
5191     DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
5192     /** @deprecated Use DeclarationRequest.type */\r
5193     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5194 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
5195
5196
5197 /***/ }),
5198 /* 28 */
5199 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5200
5201 "use strict";
5202 \r
5203 /*---------------------------------------------------------------------------------------------\r
5204  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
5205  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
5206  *--------------------------------------------------------------------------------------------*/\r
5207 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5208 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5209 const messages_1 = __webpack_require__(20);\r
5210 /**\r
5211  * A request to provide selection ranges in a document. The request's\r
5212  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
5213  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
5214  * that resolves to such.\r
5215  */\r
5216 var SelectionRangeRequest;\r
5217 (function (SelectionRangeRequest) {\r
5218     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
5219     SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
5220     /** @deprecated  Use SelectionRangeRequest.type */\r
5221     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
5222 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
5223
5224
5225 /***/ }),
5226 /* 29 */
5227 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5228
5229 "use strict";
5230 /* --------------------------------------------------------------------------------------------\r
5231  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5232  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5233  * ------------------------------------------------------------------------------------------ */\r
5234 \r
5235 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5236 const vscode_jsonrpc_1 = __webpack_require__(3);\r
5237 const messages_1 = __webpack_require__(20);\r
5238 var WorkDoneProgress;\r
5239 (function (WorkDoneProgress) {\r
5240     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
5241 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
5242 /**\r
5243  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
5244  * reporting from the server.\r
5245  */\r
5246 var WorkDoneProgressCreateRequest;\r
5247 (function (WorkDoneProgressCreateRequest) {\r
5248     WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
5249 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
5250 /**\r
5251  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
5252  * initiated on the server side.\r
5253  */\r
5254 var WorkDoneProgressCancelNotification;\r
5255 (function (WorkDoneProgressCancelNotification) {\r
5256     WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
5257 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
5258
5259
5260 /***/ }),
5261 /* 30 */
5262 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5263
5264 "use strict";
5265 /* --------------------------------------------------------------------------------------------\r
5266  * Copyright (c) TypeFox and others. All rights reserved.\r
5267  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5268  * ------------------------------------------------------------------------------------------ */\r
5269 \r
5270 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5271 const messages_1 = __webpack_require__(20);\r
5272 /**\r
5273  * A request to result a `CallHierarchyItem` in a document at a given position.\r
5274  * Can be used as an input to a incoming or outgoing call hierarchy.\r
5275  *\r
5276  * @since 3.16.0 - Proposed state\r
5277  */\r
5278 var CallHierarchyPrepareRequest;\r
5279 (function (CallHierarchyPrepareRequest) {\r
5280     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
5281     CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
5282 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
5283 /**\r
5284  * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
5285  *\r
5286  * @since 3.16.0 - Proposed state\r
5287  */\r
5288 var CallHierarchyIncomingCallsRequest;\r
5289 (function (CallHierarchyIncomingCallsRequest) {\r
5290     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
5291     CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
5292 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
5293 /**\r
5294  * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
5295  *\r
5296  * @since 3.16.0 - Proposed state\r
5297  */\r
5298 var CallHierarchyOutgoingCallsRequest;\r
5299 (function (CallHierarchyOutgoingCallsRequest) {\r
5300     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
5301     CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
5302 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
5303
5304
5305 /***/ }),
5306 /* 31 */
5307 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5308
5309 "use strict";
5310 /* --------------------------------------------------------------------------------------------\r
5311  * Copyright (c) Microsoft Corporation. All rights reserved.\r
5312  * Licensed under the MIT License. See License.txt in the project root for license information.\r
5313  * ------------------------------------------------------------------------------------------ */\r
5314 \r
5315 Object.defineProperty(exports, "__esModule", ({ value: true }));\r
5316 const messages_1 = __webpack_require__(20);\r
5317 /**\r
5318  * A set of predefined token types. This set is not fixed\r
5319  * an clients can specify additional token types via the\r
5320  * corresponding client capabilities.\r
5321  *\r
5322  * @since 3.16.0 - Proposed state\r
5323  */\r
5324 var SemanticTokenTypes;\r
5325 (function (SemanticTokenTypes) {\r
5326     SemanticTokenTypes["comment"] = "comment";\r
5327     SemanticTokenTypes["keyword"] = "keyword";\r
5328     SemanticTokenTypes["string"] = "string";\r
5329     SemanticTokenTypes["number"] = "number";\r
5330     SemanticTokenTypes["regexp"] = "regexp";\r
5331     SemanticTokenTypes["operator"] = "operator";\r
5332     SemanticTokenTypes["namespace"] = "namespace";\r
5333     SemanticTokenTypes["type"] = "type";\r
5334     SemanticTokenTypes["struct"] = "struct";\r
5335     SemanticTokenTypes["class"] = "class";\r
5336     SemanticTokenTypes["interface"] = "interface";\r
5337     SemanticTokenTypes["enum"] = "enum";\r
5338     SemanticTokenTypes["typeParameter"] = "typeParameter";\r
5339     SemanticTokenTypes["function"] = "function";\r
5340     SemanticTokenTypes["member"] = "member";\r
5341     SemanticTokenTypes["property"] = "property";\r
5342     SemanticTokenTypes["macro"] = "macro";\r
5343     SemanticTokenTypes["variable"] = "variable";\r
5344     SemanticTokenTypes["parameter"] = "parameter";\r
5345     SemanticTokenTypes["label"] = "label";\r
5346 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
5347 /**\r
5348  * A set of predefined token modifiers. This set is not fixed\r
5349  * an clients can specify additional token types via the\r
5350  * corresponding client capabilities.\r
5351  *\r
5352  * @since 3.16.0 - Proposed state\r
5353  */\r
5354 var SemanticTokenModifiers;\r
5355 (function (SemanticTokenModifiers) {\r
5356     SemanticTokenModifiers["documentation"] = "documentation";\r
5357     SemanticTokenModifiers["declaration"] = "declaration";\r
5358     SemanticTokenModifiers["definition"] = "definition";\r
5359     SemanticTokenModifiers["reference"] = "reference";\r
5360     SemanticTokenModifiers["static"] = "static";\r
5361     SemanticTokenModifiers["abstract"] = "abstract";\r
5362     SemanticTokenModifiers["deprecated"] = "deprecated";\r
5363     SemanticTokenModifiers["async"] = "async";\r
5364     SemanticTokenModifiers["volatile"] = "volatile";\r
5365     SemanticTokenModifiers["readonly"] = "readonly";\r
5366 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
5367 /**\r
5368  * @since 3.16.0 - Proposed state\r
5369  */\r
5370 var SemanticTokens;\r
5371 (function (SemanticTokens) {\r
5372     function is(value) {\r
5373         const candidate = value;\r
5374         return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
5375             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
5376     }\r
5377     SemanticTokens.is = is;\r
5378 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
5379 /**\r
5380  * @since 3.16.0 - Proposed state\r
5381  */\r
5382 var SemanticTokensRequest;\r
5383 (function (SemanticTokensRequest) {\r
5384     SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
5385     SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
5386 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
5387 /**\r
5388  * @since 3.16.0 - Proposed state\r
5389  */\r
5390 var SemanticTokensEditsRequest;\r
5391 (function (SemanticTokensEditsRequest) {\r
5392     SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
5393     SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
5394 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
5395 /**\r
5396  * @since 3.16.0 - Proposed state\r
5397  */\r
5398 var SemanticTokensRangeRequest;\r
5399 (function (SemanticTokensRangeRequest) {\r
5400     SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
5401     SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
5402 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
5403
5404
5405 /***/ }),
5406 /* 32 */
5407 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5408
5409 "use strict";
5410
5411 Object.defineProperty(exports, "__esModule", ({ value: true }));
5412 const coc_nvim_1 = __webpack_require__(1);
5413 const prettier = __webpack_require__(33);
5414 /**
5415  * Prettier reads configuration from files
5416  */
5417 const PRETTIER_CONFIG_FILES = [
5418     '.prettierrc',
5419     '.prettierrc.json',
5420     '.prettierrc.yaml',
5421     '.prettierrc.yml',
5422     '.prettierrc.js',
5423     'package.json',
5424     'prettier.config.js',
5425 ];
5426 /**
5427  * Create a file watcher. Clears prettier's configuration cache on
5428  * file change, create, delete.
5429  * @returns disposable file system watcher.
5430  */
5431 function fileListener() {
5432     const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(`**/{${PRETTIER_CONFIG_FILES.join(',')}}`);
5433     fileWatcher.onDidChange(prettier.clearConfigCache);
5434     fileWatcher.onDidCreate(prettier.clearConfigCache);
5435     fileWatcher.onDidDelete(prettier.clearConfigCache);
5436     return fileWatcher;
5437 }
5438 exports.default = fileListener;
5439
5440
5441 /***/ }),
5442 /* 33 */
5443 /***/ ((module) => {
5444
5445 "use strict";
5446 module.exports = require("prettier");;
5447
5448 /***/ }),
5449 /* 34 */
5450 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5451
5452 "use strict";
5453
5454 Object.defineProperty(exports, "__esModule", ({ value: true }));
5455 exports.setupErrorHandler = exports.safeExecution = exports.addToOutput = void 0;
5456 const coc_nvim_1 = __webpack_require__(1);
5457 let outputChannel;
5458 /**
5459  * Adds the filepath to the error message
5460  *
5461  * @param msg The original error message
5462  * @param fileName The path to the file
5463  * @returns {string} enhanced message with the filename
5464  */
5465 function addFilePath(msg, fileName) {
5466     const lines = msg.split('\n');
5467     if (lines.length > 0) {
5468         lines[0] = lines[0].replace(/(\d*):(\d*)/g, `${fileName}:$1:$2`);
5469         return lines.join('\n');
5470     }
5471     return msg;
5472 }
5473 /**
5474  * Append messages to the output channel and format it with a title
5475  *
5476  * @param message The message to append to the output channel
5477  */
5478 function addToOutput(message, type = 'Trace') {
5479     if (!outputChannel)
5480         return;
5481     const title = `${type} - ${new Date().toLocaleString()}:`;
5482     // Create a sort of title, to differentiate between messages
5483     outputChannel.appendLine('');
5484     // Append actual output
5485     outputChannel.appendLine(`[${title}] ${message}\n`);
5486 }
5487 exports.addToOutput = addToOutput;
5488 /**
5489  * Execute a callback safely, if it doesn't work, return default and log messages.
5490  *
5491  * @param cb The function to be executed,
5492  * @param defaultText The default value if execution of the cb failed
5493  * @param fileName The filename of the current document
5494  * @returns {string} formatted text or defaultText
5495  */
5496 function safeExecution(cb, defaultText, fileName) {
5497     if (cb instanceof Promise) {
5498         return cb
5499             .then(returnValue => {
5500             // updateStatusBar('Prettier: $(check)')
5501             return returnValue;
5502         })
5503             .catch((err) => {
5504             addToOutput(addFilePath(err.message, fileName), 'Error');
5505             // updateStatusBar('Prettier: $(x)')
5506             return defaultText;
5507         });
5508     }
5509     try {
5510         const returnValue = cb();
5511         // updateStatusBar('Prettier: $(check)')
5512         return returnValue;
5513     }
5514     catch (err) {
5515         addToOutput(addFilePath(err.message, fileName), 'Error');
5516         // updateStatusBar('Prettier: $(x)')
5517         return defaultText;
5518     }
5519 }
5520 exports.safeExecution = safeExecution;
5521 /**
5522  * Setup the output channel and the statusBarItem.
5523  * Create a command to show the output channel
5524  *
5525  * @returns {Disposable} The command to open the output channel
5526  */
5527 function setupErrorHandler() {
5528     // Setup the outputChannel
5529     outputChannel = coc_nvim_1.workspace.createOutputChannel('prettier');
5530     return coc_nvim_1.commands.registerCommand('prettier.open-output', () => {
5531         outputChannel.show();
5532     });
5533 }
5534 exports.setupErrorHandler = setupErrorHandler;
5535
5536
5537 /***/ }),
5538 /* 35 */
5539 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5540
5541 "use strict";
5542
5543 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5544     if (k2 === undefined) k2 = k;
5545     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5546 }) : (function(o, m, k, k2) {
5547     if (k2 === undefined) k2 = k;
5548     o[k2] = m[k];
5549 }));
5550 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5551     Object.defineProperty(o, "default", { enumerable: true, value: v });
5552 }) : function(o, v) {
5553     o["default"] = v;
5554 });
5555 var __importStar = (this && this.__importStar) || function (mod) {
5556     if (mod && mod.__esModule) return mod;
5557     var result = {};
5558     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5559     __setModuleDefault(result, mod);
5560     return result;
5561 };
5562 Object.defineProperty(exports, "__esModule", ({ value: true }));
5563 const coc_nvim_1 = __webpack_require__(1);
5564 const fs_1 = __webpack_require__(36);
5565 const path = __importStar(__webpack_require__(12));
5566 const errorHandler_1 = __webpack_require__(34);
5567 const utils_1 = __webpack_require__(37);
5568 const ignore = __webpack_require__(84);
5569 const nullIgnorer = { ignores: () => false };
5570 /**
5571  * Create an ignore file handler. Will lazily read ignore files on a per-resource
5572  * basis, and cache the contents until it changes.
5573  */
5574 function ignoreFileHandler(disposables) {
5575     const ignorers = new Map();
5576     disposables.push({ dispose: () => ignorers.clear() });
5577     return {
5578         fileIsIgnored(filePath) {
5579             const { ignorer, ignoreFilePath } = getIgnorerForFile(filePath);
5580             return ignorer.ignores(path.relative(path.dirname(ignoreFilePath), filePath));
5581         },
5582     };
5583     function getIgnorerForFile(fsPath) {
5584         const absolutePath = getIgnorePathForFile(fsPath, utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath);
5585         if (!absolutePath) {
5586             return { ignoreFilePath: '', ignorer: nullIgnorer };
5587         }
5588         if (!ignorers.has(absolutePath)) {
5589             loadIgnorer(coc_nvim_1.Uri.file(absolutePath));
5590         }
5591         if (!fs_1.existsSync(absolutePath)) {
5592             // Don't log default value.
5593             const ignorePath = utils_1.getConfig(coc_nvim_1.Uri.file(fsPath)).ignorePath;
5594             if (ignorePath !== '.prettierignore') {
5595                 errorHandler_1.addToOutput(`Wrong prettier.ignorePath provided in your settings. The path (${ignorePath}) does not exist.`, 'Warning');
5596             }
5597             return { ignoreFilePath: '', ignorer: nullIgnorer };
5598         }
5599         return {
5600             ignoreFilePath: absolutePath,
5601             ignorer: ignorers.get(absolutePath),
5602         };
5603     }
5604     function loadIgnorer(ignoreUri) {
5605         let ignorer = nullIgnorer;
5606         if (!ignorers.has(ignoreUri.fsPath)) {
5607             const fileWatcher = coc_nvim_1.workspace.createFileSystemWatcher(ignoreUri.fsPath);
5608             disposables.push(fileWatcher);
5609             fileWatcher.onDidCreate(loadIgnorer, null, disposables);
5610             fileWatcher.onDidChange(loadIgnorer, null, disposables);
5611             fileWatcher.onDidDelete(unloadIgnorer, null, disposables);
5612         }
5613         if (fs_1.existsSync(ignoreUri.fsPath)) {
5614             const ignoreFileContents = fs_1.readFileSync(ignoreUri.fsPath, 'utf8');
5615             ignorer = ignore().add(ignoreFileContents);
5616         }
5617         ignorers.set(ignoreUri.fsPath, ignorer);
5618     }
5619     function unloadIgnorer(ignoreUri) {
5620         ignorers.set(ignoreUri.fsPath, nullIgnorer);
5621     }
5622 }
5623 function getIgnorePathForFile(_filePath, ignorePath) {
5624     // Configuration `prettier.ignorePath` is set to `null`
5625     if (!ignorePath) {
5626         return null;
5627     }
5628     if (coc_nvim_1.workspace.workspaceFolder) {
5629         const folder = coc_nvim_1.workspace.workspaceFolder;
5630         return folder ? getPath(ignorePath, coc_nvim_1.Uri.parse(folder.uri).fsPath) : null;
5631     }
5632     return null;
5633 }
5634 function getPath(fsPath, relativeTo) {
5635     return path.isAbsolute(fsPath) ? fsPath : path.join(relativeTo, fsPath);
5636 }
5637 exports.default = ignoreFileHandler;
5638
5639
5640 /***/ }),
5641 /* 36 */
5642 /***/ ((module) => {
5643
5644 "use strict";
5645 module.exports = require("fs");;
5646
5647 /***/ }),
5648 /* 37 */
5649 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5650
5651 "use strict";
5652
5653 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5654     if (k2 === undefined) k2 = k;
5655     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5656 }) : (function(o, m, k, k2) {
5657     if (k2 === undefined) k2 = k;
5658     o[k2] = m[k];
5659 }));
5660 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
5661     Object.defineProperty(o, "default", { enumerable: true, value: v });
5662 }) : function(o, v) {
5663     o["default"] = v;
5664 });
5665 var __importStar = (this && this.__importStar) || function (mod) {
5666     if (mod && mod.__esModule) return mod;
5667     var result = {};
5668     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
5669     __setModuleDefault(result, mod);
5670     return result;
5671 };
5672 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5673     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5674     return new (P || (P = Promise))(function (resolve, reject) {
5675         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5676         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5677         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5678         step((generator = generator.apply(thisArg, _arguments || [])).next());
5679     });
5680 };
5681 var __importDefault = (this && this.__importDefault) || function (mod) {
5682     return (mod && mod.__esModule) ? mod : { "default": mod };
5683 };
5684 Object.defineProperty(exports, "__esModule", ({ value: true }));
5685 exports.hasLocalPrettierInstalled = exports.getGroup = exports.rangeLanguages = exports.enabledLanguages = exports.allLanguages = exports.getParsersFromLanguageId = exports.getPrettierInstance = exports.getConfig = void 0;
5686 const coc_nvim_1 = __webpack_require__(1);
5687 const path_1 = __importStar(__webpack_require__(12));
5688 const requirePkg_1 = __webpack_require__(38);
5689 const errorHandler_1 = __webpack_require__(34);
5690 const semver_1 = __importDefault(__webpack_require__(41));
5691 function getConfig(uri) {
5692     return coc_nvim_1.workspace.getConfiguration('prettier', uri ? uri.toString() : undefined);
5693 }
5694 exports.getConfig = getConfig;
5695 function getPrettierInstance() {
5696     return __awaiter(this, void 0, void 0, function* () {
5697         const document = yield coc_nvim_1.workspace.document;
5698         const uri = coc_nvim_1.Uri.parse(document.uri);
5699         const fileName = uri.fsPath;
5700         const vscodeConfig = getConfig(uri);
5701         const localOnly = vscodeConfig.onlyUseLocalVersion;
5702         const resolvedPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(fileName), 'prettier', { silent: true, ignoreBundled: localOnly }));
5703         if (!resolvedPrettier) {
5704             errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
5705         }
5706         return resolvedPrettier;
5707     });
5708 }
5709 exports.getPrettierInstance = getPrettierInstance;
5710 function getParsersFromLanguageId(languageId, prettierInstance, path) {
5711     const supportedLanguages = getSupportLanguages(prettierInstance);
5712     const language = supportedLanguages.find(lang => Array.isArray(lang.vscodeLanguageIds) &&
5713         lang.vscodeLanguageIds.includes(languageId) &&
5714         // Only for some specific filenames
5715         (lang.extensions.length > 0 ||
5716             (path != null &&
5717                 lang.filenames != null &&
5718                 lang.filenames.includes(path_1.basename(path)))));
5719     if (!language) {
5720         return [];
5721     }
5722     return language.parsers;
5723 }
5724 exports.getParsersFromLanguageId = getParsersFromLanguageId;
5725 function allLanguages(prettierInstance) {
5726     const supportedLanguages = getSupportLanguages(prettierInstance);
5727     return supportedLanguages.reduce((ids, language) => [...ids, ...(language.vscodeLanguageIds || [])], []);
5728 }
5729 exports.allLanguages = allLanguages;
5730 function enabledLanguages(prettierInstance) {
5731     const { disableLanguages } = getConfig();
5732     const languages = allLanguages(prettierInstance);
5733     return languages.filter(x => disableLanguages.indexOf(x) == -1);
5734 }
5735 exports.enabledLanguages = enabledLanguages;
5736 function rangeLanguages() {
5737     const { disableLanguages } = getConfig();
5738     return [
5739         'javascript',
5740         'javascriptreact',
5741         'typescript',
5742         'typescriptreact',
5743         'json',
5744         'graphql',
5745     ].filter(x => disableLanguages.indexOf(x) == -1);
5746 }
5747 exports.rangeLanguages = rangeLanguages;
5748 function getGroup(group, prettierInstance) {
5749     const supportedLanguages = getSupportLanguages(prettierInstance);
5750     return supportedLanguages.filter(language => language.group === group);
5751 }
5752 exports.getGroup = getGroup;
5753 function getSupportLanguages(prettierInstance) {
5754     if (semver_1.default.gte(prettierInstance.version, '2.0.0')) {
5755         return prettierInstance.getSupportInfo({
5756             showUnreleased: true
5757         }).languages;
5758     }
5759     return prettierInstance.getSupportInfo().languages;
5760 }
5761 function hasLocalPrettierInstalled(filePath) {
5762     const localPrettier = requirePkg_1.requireLocalPkg(filePath, 'prettier', {
5763         silent: true,
5764         ignoreBundled: true,
5765     });
5766     return localPrettier != null;
5767 }
5768 exports.hasLocalPrettierInstalled = hasLocalPrettierInstalled;
5769
5770
5771 /***/ }),
5772 /* 38 */
5773 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5774
5775 "use strict";
5776
5777 var __importDefault = (this && this.__importDefault) || function (mod) {
5778     return (mod && mod.__esModule) ? mod : { "default": mod };
5779 };
5780 Object.defineProperty(exports, "__esModule", ({ value: true }));
5781 exports.requireLocalPkg = void 0;
5782 const errorHandler_1 = __webpack_require__(34);
5783 const resolve_from_1 = __importDefault(__webpack_require__(39));
5784 const requireFunc =  true ? require : 0;
5785 /**
5786  * Require package explicitly installed relative to given path.
5787  * Fallback to bundled one if no package was found bottom up.
5788  * @param {string} fspath file system path starting point to resolve package
5789  * @param {string} pkgName package's name to require
5790  * @returns module
5791  */
5792 function requireLocalPkg(fspath, pkgName, options = { silent: true, ignoreBundled: false }) {
5793     let modulePath = resolve_from_1.default.silent(fspath, pkgName);
5794     if (modulePath !== void 0) {
5795         try {
5796             return requireFunc(modulePath);
5797         }
5798         catch (e) {
5799             if (!options.silent) {
5800                 errorHandler_1.addToOutput(`Failed to load require ${pkgName} from ${modulePath}.${options.ignoreBundled ? `` : ` Using bundled`}`, 'Error');
5801             }
5802         }
5803     }
5804     return options.ignoreBundled ? null : requireFunc(pkgName);
5805 }
5806 exports.requireLocalPkg = requireLocalPkg;
5807
5808
5809 /***/ }),
5810 /* 39 */
5811 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5812
5813 "use strict";
5814
5815 const path = __webpack_require__(12);
5816 const Module = __webpack_require__(40);
5817 const fs = __webpack_require__(36);
5818
5819 const resolveFrom = (fromDirectory, moduleId, silent) => {
5820         if (typeof fromDirectory !== 'string') {
5821                 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
5822         }
5823
5824         if (typeof moduleId !== 'string') {
5825                 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
5826         }
5827
5828         try {
5829                 fromDirectory = fs.realpathSync(fromDirectory);
5830         } catch (error) {
5831                 if (error.code === 'ENOENT') {
5832                         fromDirectory = path.resolve(fromDirectory);
5833                 } else if (silent) {
5834                         return;
5835                 } else {
5836                         throw error;
5837                 }
5838         }
5839
5840         const fromFile = path.join(fromDirectory, 'noop.js');
5841
5842         const resolveFileName = () => Module._resolveFilename(moduleId, {
5843                 id: fromFile,
5844                 filename: fromFile,
5845                 paths: Module._nodeModulePaths(fromDirectory)
5846         });
5847
5848         if (silent) {
5849                 try {
5850                         return resolveFileName();
5851                 } catch (error) {
5852                         return;
5853                 }
5854         }
5855
5856         return resolveFileName();
5857 };
5858
5859 module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
5860 module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);
5861
5862
5863 /***/ }),
5864 /* 40 */
5865 /***/ ((module) => {
5866
5867 "use strict";
5868 module.exports = require("module");;
5869
5870 /***/ }),
5871 /* 41 */
5872 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5873
5874 // just pre-load all the stuff that index.js lazily exports
5875 const internalRe = __webpack_require__(42)
5876 module.exports = {
5877   re: internalRe.re,
5878   src: internalRe.src,
5879   tokens: internalRe.t,
5880   SEMVER_SPEC_VERSION: __webpack_require__(43).SEMVER_SPEC_VERSION,
5881   SemVer: __webpack_require__(45),
5882   compareIdentifiers: __webpack_require__(46).compareIdentifiers,
5883   rcompareIdentifiers: __webpack_require__(46).rcompareIdentifiers,
5884   parse: __webpack_require__(47),
5885   valid: __webpack_require__(48),
5886   clean: __webpack_require__(49),
5887   inc: __webpack_require__(50),
5888   diff: __webpack_require__(51),
5889   major: __webpack_require__(54),
5890   minor: __webpack_require__(55),
5891   patch: __webpack_require__(56),
5892   prerelease: __webpack_require__(57),
5893   compare: __webpack_require__(53),
5894   rcompare: __webpack_require__(58),
5895   compareLoose: __webpack_require__(59),
5896   compareBuild: __webpack_require__(60),
5897   sort: __webpack_require__(61),
5898   rsort: __webpack_require__(62),
5899   gt: __webpack_require__(63),
5900   lt: __webpack_require__(64),
5901   eq: __webpack_require__(52),
5902   neq: __webpack_require__(65),
5903   gte: __webpack_require__(66),
5904   lte: __webpack_require__(67),
5905   cmp: __webpack_require__(68),
5906   coerce: __webpack_require__(69),
5907   Comparator: __webpack_require__(70),
5908   Range: __webpack_require__(71),
5909   satisfies: __webpack_require__(72),
5910   toComparators: __webpack_require__(73),
5911   maxSatisfying: __webpack_require__(74),
5912   minSatisfying: __webpack_require__(75),
5913   minVersion: __webpack_require__(76),
5914   validRange: __webpack_require__(77),
5915   outside: __webpack_require__(78),
5916   gtr: __webpack_require__(79),
5917   ltr: __webpack_require__(80),
5918   intersects: __webpack_require__(81),
5919   simplifyRange: __webpack_require__(82),
5920   subset: __webpack_require__(83),
5921 }
5922
5923
5924 /***/ }),
5925 /* 42 */
5926 /***/ ((module, exports, __webpack_require__) => {
5927
5928 const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(43)
5929 const debug = __webpack_require__(44)
5930 exports = module.exports = {}
5931
5932 // The actual regexps go on exports.re
5933 const re = exports.re = []
5934 const src = exports.src = []
5935 const t = exports.t = {}
5936 let R = 0
5937
5938 const createToken = (name, value, isGlobal) => {
5939   const index = R++
5940   debug(index, value)
5941   t[name] = index
5942   src[index] = value
5943   re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
5944 }
5945
5946 // The following Regular Expressions can be used for tokenizing,
5947 // validating, and parsing SemVer version strings.
5948
5949 // ## Numeric Identifier
5950 // A single `0`, or a non-zero digit followed by zero or more digits.
5951
5952 createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
5953 createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
5954
5955 // ## Non-numeric Identifier
5956 // Zero or more digits, followed by a letter or hyphen, and then zero or
5957 // more letters, digits, or hyphens.
5958
5959 createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
5960
5961 // ## Main Version
5962 // Three dot-separated numeric identifiers.
5963
5964 createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
5965                    `(${src[t.NUMERICIDENTIFIER]})\\.` +
5966                    `(${src[t.NUMERICIDENTIFIER]})`)
5967
5968 createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
5969                         `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
5970                         `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
5971
5972 // ## Pre-release Version Identifier
5973 // A numeric identifier, or a non-numeric identifier.
5974
5975 createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
5976 }|${src[t.NONNUMERICIDENTIFIER]})`)
5977
5978 createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
5979 }|${src[t.NONNUMERICIDENTIFIER]})`)
5980
5981 // ## Pre-release Version
5982 // Hyphen, followed by one or more dot-separated pre-release version
5983 // identifiers.
5984
5985 createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
5986 }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
5987
5988 createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
5989 }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
5990
5991 // ## Build Metadata Identifier
5992 // Any combination of digits, letters, or hyphens.
5993
5994 createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
5995
5996 // ## Build Metadata
5997 // Plus sign, followed by one or more period-separated build metadata
5998 // identifiers.
5999
6000 createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
6001 }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
6002
6003 // ## Full Version String
6004 // A main version, followed optionally by a pre-release version and
6005 // build metadata.
6006
6007 // Note that the only major, minor, patch, and pre-release sections of
6008 // the version string are capturing groups.  The build metadata is not a
6009 // capturing group, because it should not ever be used in version
6010 // comparison.
6011
6012 createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
6013 }${src[t.PRERELEASE]}?${
6014   src[t.BUILD]}?`)
6015
6016 createToken('FULL', `^${src[t.FULLPLAIN]}$`)
6017
6018 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
6019 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
6020 // common in the npm registry.
6021 createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
6022 }${src[t.PRERELEASELOOSE]}?${
6023   src[t.BUILD]}?`)
6024
6025 createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
6026
6027 createToken('GTLT', '((?:<|>)?=?)')
6028
6029 // Something like "2.*" or "1.2.x".
6030 // Note that "x.x" is a valid xRange identifer, meaning "any version"
6031 // Only the first item is strictly required.
6032 createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
6033 createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
6034
6035 createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
6036                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
6037                    `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
6038                    `(?:${src[t.PRERELEASE]})?${
6039                      src[t.BUILD]}?` +
6040                    `)?)?`)
6041
6042 createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6043                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6044                         `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
6045                         `(?:${src[t.PRERELEASELOOSE]})?${
6046                           src[t.BUILD]}?` +
6047                         `)?)?`)
6048
6049 createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
6050 createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
6051
6052 // Coercion.
6053 // Extract anything that could conceivably be a part of a valid semver
6054 createToken('COERCE', `${'(^|[^\\d])' +
6055               '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
6056               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
6057               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
6058               `(?:$|[^\\d])`)
6059 createToken('COERCERTL', src[t.COERCE], true)
6060
6061 // Tilde ranges.
6062 // Meaning is "reasonably at or greater than"
6063 createToken('LONETILDE', '(?:~>?)')
6064
6065 createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
6066 exports.tildeTrimReplace = '$1~'
6067
6068 createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
6069 createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
6070
6071 // Caret ranges.
6072 // Meaning is "at least and backwards compatible with"
6073 createToken('LONECARET', '(?:\\^)')
6074
6075 createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
6076 exports.caretTrimReplace = '$1^'
6077
6078 createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
6079 createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
6080
6081 // A simple gt/lt/eq thing, or just "" to indicate "any version"
6082 createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
6083 createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
6084
6085 // An expression to strip any whitespace between the gtlt and the thing
6086 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
6087 createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
6088 }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
6089 exports.comparatorTrimReplace = '$1$2$3'
6090
6091 // Something like `1.2.3 - 1.2.4`
6092 // Note that these all use the loose form, because they'll be
6093 // checked against either the strict or loose comparator form
6094 // later.
6095 createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
6096                    `\\s+-\\s+` +
6097                    `(${src[t.XRANGEPLAIN]})` +
6098                    `\\s*$`)
6099
6100 createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
6101                         `\\s+-\\s+` +
6102                         `(${src[t.XRANGEPLAINLOOSE]})` +
6103                         `\\s*$`)
6104
6105 // Star ranges basically just allow anything at all.
6106 createToken('STAR', '(<|>)?=?\\s*\\*')
6107 // >=0.0.0 is like a star
6108 createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
6109 createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
6110
6111
6112 /***/ }),
6113 /* 43 */
6114 /***/ ((module) => {
6115
6116 // Note: this is the semver.org version of the spec that it implements
6117 // Not necessarily the package version of this code.
6118 const SEMVER_SPEC_VERSION = '2.0.0'
6119
6120 const MAX_LENGTH = 256
6121 const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
6122   /* istanbul ignore next */ 9007199254740991
6123
6124 // Max safe segment length for coercion.
6125 const MAX_SAFE_COMPONENT_LENGTH = 16
6126
6127 module.exports = {
6128   SEMVER_SPEC_VERSION,
6129   MAX_LENGTH,
6130   MAX_SAFE_INTEGER,
6131   MAX_SAFE_COMPONENT_LENGTH
6132 }
6133
6134
6135 /***/ }),
6136 /* 44 */
6137 /***/ ((module) => {
6138
6139 const debug = (
6140   typeof process === 'object' &&
6141   process.env &&
6142   process.env.NODE_DEBUG &&
6143   /\bsemver\b/i.test(process.env.NODE_DEBUG)
6144 ) ? (...args) => console.error('SEMVER', ...args)
6145   : () => {}
6146
6147 module.exports = debug
6148
6149
6150 /***/ }),
6151 /* 45 */
6152 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6153
6154 const debug = __webpack_require__(44)
6155 const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(43)
6156 const { re, t } = __webpack_require__(42)
6157
6158 const { compareIdentifiers } = __webpack_require__(46)
6159 class SemVer {
6160   constructor (version, options) {
6161     if (!options || typeof options !== 'object') {
6162       options = {
6163         loose: !!options,
6164         includePrerelease: false
6165       }
6166     }
6167     if (version instanceof SemVer) {
6168       if (version.loose === !!options.loose &&
6169           version.includePrerelease === !!options.includePrerelease) {
6170         return version
6171       } else {
6172         version = version.version
6173       }
6174     } else if (typeof version !== 'string') {
6175       throw new TypeError(`Invalid Version: ${version}`)
6176     }
6177
6178     if (version.length > MAX_LENGTH) {
6179       throw new TypeError(
6180         `version is longer than ${MAX_LENGTH} characters`
6181       )
6182     }
6183
6184     debug('SemVer', version, options)
6185     this.options = options
6186     this.loose = !!options.loose
6187     // this isn't actually relevant for versions, but keep it so that we
6188     // don't run into trouble passing this.options around.
6189     this.includePrerelease = !!options.includePrerelease
6190
6191     const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
6192
6193     if (!m) {
6194       throw new TypeError(`Invalid Version: ${version}`)
6195     }
6196
6197     this.raw = version
6198
6199     // these are actually numbers
6200     this.major = +m[1]
6201     this.minor = +m[2]
6202     this.patch = +m[3]
6203
6204     if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
6205       throw new TypeError('Invalid major version')
6206     }
6207
6208     if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
6209       throw new TypeError('Invalid minor version')
6210     }
6211
6212     if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
6213       throw new TypeError('Invalid patch version')
6214     }
6215
6216     // numberify any prerelease numeric ids
6217     if (!m[4]) {
6218       this.prerelease = []
6219     } else {
6220       this.prerelease = m[4].split('.').map((id) => {
6221         if (/^[0-9]+$/.test(id)) {
6222           const num = +id
6223           if (num >= 0 && num < MAX_SAFE_INTEGER) {
6224             return num
6225           }
6226         }
6227         return id
6228       })
6229     }
6230
6231     this.build = m[5] ? m[5].split('.') : []
6232     this.format()
6233   }
6234
6235   format () {
6236     this.version = `${this.major}.${this.minor}.${this.patch}`
6237     if (this.prerelease.length) {
6238       this.version += `-${this.prerelease.join('.')}`
6239     }
6240     return this.version
6241   }
6242
6243   toString () {
6244     return this.version
6245   }
6246
6247   compare (other) {
6248     debug('SemVer.compare', this.version, this.options, other)
6249     if (!(other instanceof SemVer)) {
6250       if (typeof other === 'string' && other === this.version) {
6251         return 0
6252       }
6253       other = new SemVer(other, this.options)
6254     }
6255
6256     if (other.version === this.version) {
6257       return 0
6258     }
6259
6260     return this.compareMain(other) || this.comparePre(other)
6261   }
6262
6263   compareMain (other) {
6264     if (!(other instanceof SemVer)) {
6265       other = new SemVer(other, this.options)
6266     }
6267
6268     return (
6269       compareIdentifiers(this.major, other.major) ||
6270       compareIdentifiers(this.minor, other.minor) ||
6271       compareIdentifiers(this.patch, other.patch)
6272     )
6273   }
6274
6275   comparePre (other) {
6276     if (!(other instanceof SemVer)) {
6277       other = new SemVer(other, this.options)
6278     }
6279
6280     // NOT having a prerelease is > having one
6281     if (this.prerelease.length && !other.prerelease.length) {
6282       return -1
6283     } else if (!this.prerelease.length && other.prerelease.length) {
6284       return 1
6285     } else if (!this.prerelease.length && !other.prerelease.length) {
6286       return 0
6287     }
6288
6289     let i = 0
6290     do {
6291       const a = this.prerelease[i]
6292       const b = other.prerelease[i]
6293       debug('prerelease compare', i, a, b)
6294       if (a === undefined && b === undefined) {
6295         return 0
6296       } else if (b === undefined) {
6297         return 1
6298       } else if (a === undefined) {
6299         return -1
6300       } else if (a === b) {
6301         continue
6302       } else {
6303         return compareIdentifiers(a, b)
6304       }
6305     } while (++i)
6306   }
6307
6308   compareBuild (other) {
6309     if (!(other instanceof SemVer)) {
6310       other = new SemVer(other, this.options)
6311     }
6312
6313     let i = 0
6314     do {
6315       const a = this.build[i]
6316       const b = other.build[i]
6317       debug('prerelease compare', i, a, b)
6318       if (a === undefined && b === undefined) {
6319         return 0
6320       } else if (b === undefined) {
6321         return 1
6322       } else if (a === undefined) {
6323         return -1
6324       } else if (a === b) {
6325         continue
6326       } else {
6327         return compareIdentifiers(a, b)
6328       }
6329     } while (++i)
6330   }
6331
6332   // preminor will bump the version up to the next minor release, and immediately
6333   // down to pre-release. premajor and prepatch work the same way.
6334   inc (release, identifier) {
6335     switch (release) {
6336       case 'premajor':
6337         this.prerelease.length = 0
6338         this.patch = 0
6339         this.minor = 0
6340         this.major++
6341         this.inc('pre', identifier)
6342         break
6343       case 'preminor':
6344         this.prerelease.length = 0
6345         this.patch = 0
6346         this.minor++
6347         this.inc('pre', identifier)
6348         break
6349       case 'prepatch':
6350         // If this is already a prerelease, it will bump to the next version
6351         // drop any prereleases that might already exist, since they are not
6352         // relevant at this point.
6353         this.prerelease.length = 0
6354         this.inc('patch', identifier)
6355         this.inc('pre', identifier)
6356         break
6357       // If the input is a non-prerelease version, this acts the same as
6358       // prepatch.
6359       case 'prerelease':
6360         if (this.prerelease.length === 0) {
6361           this.inc('patch', identifier)
6362         }
6363         this.inc('pre', identifier)
6364         break
6365
6366       case 'major':
6367         // If this is a pre-major version, bump up to the same major version.
6368         // Otherwise increment major.
6369         // 1.0.0-5 bumps to 1.0.0
6370         // 1.1.0 bumps to 2.0.0
6371         if (
6372           this.minor !== 0 ||
6373           this.patch !== 0 ||
6374           this.prerelease.length === 0
6375         ) {
6376           this.major++
6377         }
6378         this.minor = 0
6379         this.patch = 0
6380         this.prerelease = []
6381         break
6382       case 'minor':
6383         // If this is a pre-minor version, bump up to the same minor version.
6384         // Otherwise increment minor.
6385         // 1.2.0-5 bumps to 1.2.0
6386         // 1.2.1 bumps to 1.3.0
6387         if (this.patch !== 0 || this.prerelease.length === 0) {
6388           this.minor++
6389         }
6390         this.patch = 0
6391         this.prerelease = []
6392         break
6393       case 'patch':
6394         // If this is not a pre-release version, it will increment the patch.
6395         // If it is a pre-release it will bump up to the same patch version.
6396         // 1.2.0-5 patches to 1.2.0
6397         // 1.2.0 patches to 1.2.1
6398         if (this.prerelease.length === 0) {
6399           this.patch++
6400         }
6401         this.prerelease = []
6402         break
6403       // This probably shouldn't be used publicly.
6404       // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
6405       case 'pre':
6406         if (this.prerelease.length === 0) {
6407           this.prerelease = [0]
6408         } else {
6409           let i = this.prerelease.length
6410           while (--i >= 0) {
6411             if (typeof this.prerelease[i] === 'number') {
6412               this.prerelease[i]++
6413               i = -2
6414             }
6415           }
6416           if (i === -1) {
6417             // didn't increment anything
6418             this.prerelease.push(0)
6419           }
6420         }
6421         if (identifier) {
6422           // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
6423           // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
6424           if (this.prerelease[0] === identifier) {
6425             if (isNaN(this.prerelease[1])) {
6426               this.prerelease = [identifier, 0]
6427             }
6428           } else {
6429             this.prerelease = [identifier, 0]
6430           }
6431         }
6432         break
6433
6434       default:
6435         throw new Error(`invalid increment argument: ${release}`)
6436     }
6437     this.format()
6438     this.raw = this.version
6439     return this
6440   }
6441 }
6442
6443 module.exports = SemVer
6444
6445
6446 /***/ }),
6447 /* 46 */
6448 /***/ ((module) => {
6449
6450 const numeric = /^[0-9]+$/
6451 const compareIdentifiers = (a, b) => {
6452   const anum = numeric.test(a)
6453   const bnum = numeric.test(b)
6454
6455   if (anum && bnum) {
6456     a = +a
6457     b = +b
6458   }
6459
6460   return a === b ? 0
6461     : (anum && !bnum) ? -1
6462     : (bnum && !anum) ? 1
6463     : a < b ? -1
6464     : 1
6465 }
6466
6467 const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
6468
6469 module.exports = {
6470   compareIdentifiers,
6471   rcompareIdentifiers
6472 }
6473
6474
6475 /***/ }),
6476 /* 47 */
6477 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6478
6479 const {MAX_LENGTH} = __webpack_require__(43)
6480 const { re, t } = __webpack_require__(42)
6481 const SemVer = __webpack_require__(45)
6482
6483 const parse = (version, options) => {
6484   if (!options || typeof options !== 'object') {
6485     options = {
6486       loose: !!options,
6487       includePrerelease: false
6488     }
6489   }
6490
6491   if (version instanceof SemVer) {
6492     return version
6493   }
6494
6495   if (typeof version !== 'string') {
6496     return null
6497   }
6498
6499   if (version.length > MAX_LENGTH) {
6500     return null
6501   }
6502
6503   const r = options.loose ? re[t.LOOSE] : re[t.FULL]
6504   if (!r.test(version)) {
6505     return null
6506   }
6507
6508   try {
6509     return new SemVer(version, options)
6510   } catch (er) {
6511     return null
6512   }
6513 }
6514
6515 module.exports = parse
6516
6517
6518 /***/ }),
6519 /* 48 */
6520 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6521
6522 const parse = __webpack_require__(47)
6523 const valid = (version, options) => {
6524   const v = parse(version, options)
6525   return v ? v.version : null
6526 }
6527 module.exports = valid
6528
6529
6530 /***/ }),
6531 /* 49 */
6532 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6533
6534 const parse = __webpack_require__(47)
6535 const clean = (version, options) => {
6536   const s = parse(version.trim().replace(/^[=v]+/, ''), options)
6537   return s ? s.version : null
6538 }
6539 module.exports = clean
6540
6541
6542 /***/ }),
6543 /* 50 */
6544 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6545
6546 const SemVer = __webpack_require__(45)
6547
6548 const inc = (version, release, options, identifier) => {
6549   if (typeof (options) === 'string') {
6550     identifier = options
6551     options = undefined
6552   }
6553
6554   try {
6555     return new SemVer(version, options).inc(release, identifier).version
6556   } catch (er) {
6557     return null
6558   }
6559 }
6560 module.exports = inc
6561
6562
6563 /***/ }),
6564 /* 51 */
6565 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6566
6567 const parse = __webpack_require__(47)
6568 const eq = __webpack_require__(52)
6569
6570 const diff = (version1, version2) => {
6571   if (eq(version1, version2)) {
6572     return null
6573   } else {
6574     const v1 = parse(version1)
6575     const v2 = parse(version2)
6576     const hasPre = v1.prerelease.length || v2.prerelease.length
6577     const prefix = hasPre ? 'pre' : ''
6578     const defaultResult = hasPre ? 'prerelease' : ''
6579     for (const key in v1) {
6580       if (key === 'major' || key === 'minor' || key === 'patch') {
6581         if (v1[key] !== v2[key]) {
6582           return prefix + key
6583         }
6584       }
6585     }
6586     return defaultResult // may be undefined
6587   }
6588 }
6589 module.exports = diff
6590
6591
6592 /***/ }),
6593 /* 52 */
6594 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6595
6596 const compare = __webpack_require__(53)
6597 const eq = (a, b, loose) => compare(a, b, loose) === 0
6598 module.exports = eq
6599
6600
6601 /***/ }),
6602 /* 53 */
6603 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6604
6605 const SemVer = __webpack_require__(45)
6606 const compare = (a, b, loose) =>
6607   new SemVer(a, loose).compare(new SemVer(b, loose))
6608
6609 module.exports = compare
6610
6611
6612 /***/ }),
6613 /* 54 */
6614 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6615
6616 const SemVer = __webpack_require__(45)
6617 const major = (a, loose) => new SemVer(a, loose).major
6618 module.exports = major
6619
6620
6621 /***/ }),
6622 /* 55 */
6623 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6624
6625 const SemVer = __webpack_require__(45)
6626 const minor = (a, loose) => new SemVer(a, loose).minor
6627 module.exports = minor
6628
6629
6630 /***/ }),
6631 /* 56 */
6632 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6633
6634 const SemVer = __webpack_require__(45)
6635 const patch = (a, loose) => new SemVer(a, loose).patch
6636 module.exports = patch
6637
6638
6639 /***/ }),
6640 /* 57 */
6641 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6642
6643 const parse = __webpack_require__(47)
6644 const prerelease = (version, options) => {
6645   const parsed = parse(version, options)
6646   return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
6647 }
6648 module.exports = prerelease
6649
6650
6651 /***/ }),
6652 /* 58 */
6653 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6654
6655 const compare = __webpack_require__(53)
6656 const rcompare = (a, b, loose) => compare(b, a, loose)
6657 module.exports = rcompare
6658
6659
6660 /***/ }),
6661 /* 59 */
6662 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6663
6664 const compare = __webpack_require__(53)
6665 const compareLoose = (a, b) => compare(a, b, true)
6666 module.exports = compareLoose
6667
6668
6669 /***/ }),
6670 /* 60 */
6671 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6672
6673 const SemVer = __webpack_require__(45)
6674 const compareBuild = (a, b, loose) => {
6675   const versionA = new SemVer(a, loose)
6676   const versionB = new SemVer(b, loose)
6677   return versionA.compare(versionB) || versionA.compareBuild(versionB)
6678 }
6679 module.exports = compareBuild
6680
6681
6682 /***/ }),
6683 /* 61 */
6684 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6685
6686 const compareBuild = __webpack_require__(60)
6687 const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
6688 module.exports = sort
6689
6690
6691 /***/ }),
6692 /* 62 */
6693 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6694
6695 const compareBuild = __webpack_require__(60)
6696 const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
6697 module.exports = rsort
6698
6699
6700 /***/ }),
6701 /* 63 */
6702 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6703
6704 const compare = __webpack_require__(53)
6705 const gt = (a, b, loose) => compare(a, b, loose) > 0
6706 module.exports = gt
6707
6708
6709 /***/ }),
6710 /* 64 */
6711 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6712
6713 const compare = __webpack_require__(53)
6714 const lt = (a, b, loose) => compare(a, b, loose) < 0
6715 module.exports = lt
6716
6717
6718 /***/ }),
6719 /* 65 */
6720 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6721
6722 const compare = __webpack_require__(53)
6723 const neq = (a, b, loose) => compare(a, b, loose) !== 0
6724 module.exports = neq
6725
6726
6727 /***/ }),
6728 /* 66 */
6729 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6730
6731 const compare = __webpack_require__(53)
6732 const gte = (a, b, loose) => compare(a, b, loose) >= 0
6733 module.exports = gte
6734
6735
6736 /***/ }),
6737 /* 67 */
6738 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6739
6740 const compare = __webpack_require__(53)
6741 const lte = (a, b, loose) => compare(a, b, loose) <= 0
6742 module.exports = lte
6743
6744
6745 /***/ }),
6746 /* 68 */
6747 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6748
6749 const eq = __webpack_require__(52)
6750 const neq = __webpack_require__(65)
6751 const gt = __webpack_require__(63)
6752 const gte = __webpack_require__(66)
6753 const lt = __webpack_require__(64)
6754 const lte = __webpack_require__(67)
6755
6756 const cmp = (a, op, b, loose) => {
6757   switch (op) {
6758     case '===':
6759       if (typeof a === 'object')
6760         a = a.version
6761       if (typeof b === 'object')
6762         b = b.version
6763       return a === b
6764
6765     case '!==':
6766       if (typeof a === 'object')
6767         a = a.version
6768       if (typeof b === 'object')
6769         b = b.version
6770       return a !== b
6771
6772     case '':
6773     case '=':
6774     case '==':
6775       return eq(a, b, loose)
6776
6777     case '!=':
6778       return neq(a, b, loose)
6779
6780     case '>':
6781       return gt(a, b, loose)
6782
6783     case '>=':
6784       return gte(a, b, loose)
6785
6786     case '<':
6787       return lt(a, b, loose)
6788
6789     case '<=':
6790       return lte(a, b, loose)
6791
6792     default:
6793       throw new TypeError(`Invalid operator: ${op}`)
6794   }
6795 }
6796 module.exports = cmp
6797
6798
6799 /***/ }),
6800 /* 69 */
6801 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6802
6803 const SemVer = __webpack_require__(45)
6804 const parse = __webpack_require__(47)
6805 const {re, t} = __webpack_require__(42)
6806
6807 const coerce = (version, options) => {
6808   if (version instanceof SemVer) {
6809     return version
6810   }
6811
6812   if (typeof version === 'number') {
6813     version = String(version)
6814   }
6815
6816   if (typeof version !== 'string') {
6817     return null
6818   }
6819
6820   options = options || {}
6821
6822   let match = null
6823   if (!options.rtl) {
6824     match = version.match(re[t.COERCE])
6825   } else {
6826     // Find the right-most coercible string that does not share
6827     // a terminus with a more left-ward coercible string.
6828     // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
6829     //
6830     // Walk through the string checking with a /g regexp
6831     // Manually set the index so as to pick up overlapping matches.
6832     // Stop when we get a match that ends at the string end, since no
6833     // coercible string can be more right-ward without the same terminus.
6834     let next
6835     while ((next = re[t.COERCERTL].exec(version)) &&
6836         (!match || match.index + match[0].length !== version.length)
6837     ) {
6838       if (!match ||
6839             next.index + next[0].length !== match.index + match[0].length) {
6840         match = next
6841       }
6842       re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
6843     }
6844     // leave it in a clean state
6845     re[t.COERCERTL].lastIndex = -1
6846   }
6847
6848   if (match === null)
6849     return null
6850
6851   return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
6852 }
6853 module.exports = coerce
6854
6855
6856 /***/ }),
6857 /* 70 */
6858 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6859
6860 const ANY = Symbol('SemVer ANY')
6861 // hoisted class for cyclic dependency
6862 class Comparator {
6863   static get ANY () {
6864     return ANY
6865   }
6866   constructor (comp, options) {
6867     if (!options || typeof options !== 'object') {
6868       options = {
6869         loose: !!options,
6870         includePrerelease: false
6871       }
6872     }
6873
6874     if (comp instanceof Comparator) {
6875       if (comp.loose === !!options.loose) {
6876         return comp
6877       } else {
6878         comp = comp.value
6879       }
6880     }
6881
6882     debug('comparator', comp, options)
6883     this.options = options
6884     this.loose = !!options.loose
6885     this.parse(comp)
6886
6887     if (this.semver === ANY) {
6888       this.value = ''
6889     } else {
6890       this.value = this.operator + this.semver.version
6891     }
6892
6893     debug('comp', this)
6894   }
6895
6896   parse (comp) {
6897     const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
6898     const m = comp.match(r)
6899
6900     if (!m) {
6901       throw new TypeError(`Invalid comparator: ${comp}`)
6902     }
6903
6904     this.operator = m[1] !== undefined ? m[1] : ''
6905     if (this.operator === '=') {
6906       this.operator = ''
6907     }
6908
6909     // if it literally is just '>' or '' then allow anything.
6910     if (!m[2]) {
6911       this.semver = ANY
6912     } else {
6913       this.semver = new SemVer(m[2], this.options.loose)
6914     }
6915   }
6916
6917   toString () {
6918     return this.value
6919   }
6920
6921   test (version) {
6922     debug('Comparator.test', version, this.options.loose)
6923
6924     if (this.semver === ANY || version === ANY) {
6925       return true
6926     }
6927
6928     if (typeof version === 'string') {
6929       try {
6930         version = new SemVer(version, this.options)
6931       } catch (er) {
6932         return false
6933       }
6934     }
6935
6936     return cmp(version, this.operator, this.semver, this.options)
6937   }
6938
6939   intersects (comp, options) {
6940     if (!(comp instanceof Comparator)) {
6941       throw new TypeError('a Comparator is required')
6942     }
6943
6944     if (!options || typeof options !== 'object') {
6945       options = {
6946         loose: !!options,
6947         includePrerelease: false
6948       }
6949     }
6950
6951     if (this.operator === '') {
6952       if (this.value === '') {
6953         return true
6954       }
6955       return new Range(comp.value, options).test(this.value)
6956     } else if (comp.operator === '') {
6957       if (comp.value === '') {
6958         return true
6959       }
6960       return new Range(this.value, options).test(comp.semver)
6961     }
6962
6963     const sameDirectionIncreasing =
6964       (this.operator === '>=' || this.operator === '>') &&
6965       (comp.operator === '>=' || comp.operator === '>')
6966     const sameDirectionDecreasing =
6967       (this.operator === '<=' || this.operator === '<') &&
6968       (comp.operator === '<=' || comp.operator === '<')
6969     const sameSemVer = this.semver.version === comp.semver.version
6970     const differentDirectionsInclusive =
6971       (this.operator === '>=' || this.operator === '<=') &&
6972       (comp.operator === '>=' || comp.operator === '<=')
6973     const oppositeDirectionsLessThan =
6974       cmp(this.semver, '<', comp.semver, options) &&
6975       (this.operator === '>=' || this.operator === '>') &&
6976         (comp.operator === '<=' || comp.operator === '<')
6977     const oppositeDirectionsGreaterThan =
6978       cmp(this.semver, '>', comp.semver, options) &&
6979       (this.operator === '<=' || this.operator === '<') &&
6980         (comp.operator === '>=' || comp.operator === '>')
6981
6982     return (
6983       sameDirectionIncreasing ||
6984       sameDirectionDecreasing ||
6985       (sameSemVer && differentDirectionsInclusive) ||
6986       oppositeDirectionsLessThan ||
6987       oppositeDirectionsGreaterThan
6988     )
6989   }
6990 }
6991
6992 module.exports = Comparator
6993
6994 const {re, t} = __webpack_require__(42)
6995 const cmp = __webpack_require__(68)
6996 const debug = __webpack_require__(44)
6997 const SemVer = __webpack_require__(45)
6998 const Range = __webpack_require__(71)
6999
7000
7001 /***/ }),
7002 /* 71 */
7003 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7004
7005 // hoisted class for cyclic dependency
7006 class Range {
7007   constructor (range, options) {
7008     if (!options || typeof options !== 'object') {
7009       options = {
7010         loose: !!options,
7011         includePrerelease: false
7012       }
7013     }
7014
7015     if (range instanceof Range) {
7016       if (
7017         range.loose === !!options.loose &&
7018         range.includePrerelease === !!options.includePrerelease
7019       ) {
7020         return range
7021       } else {
7022         return new Range(range.raw, options)
7023       }
7024     }
7025
7026     if (range instanceof Comparator) {
7027       // just put it in the set and return
7028       this.raw = range.value
7029       this.set = [[range]]
7030       this.format()
7031       return this
7032     }
7033
7034     this.options = options
7035     this.loose = !!options.loose
7036     this.includePrerelease = !!options.includePrerelease
7037
7038     // First, split based on boolean or ||
7039     this.raw = range
7040     this.set = range
7041       .split(/\s*\|\|\s*/)
7042       // map the range to a 2d array of comparators
7043       .map(range => this.parseRange(range.trim()))
7044       // throw out any comparator lists that are empty
7045       // this generally means that it was not a valid range, which is allowed
7046       // in loose mode, but will still throw if the WHOLE range is invalid.
7047       .filter(c => c.length)
7048
7049     if (!this.set.length) {
7050       throw new TypeError(`Invalid SemVer Range: ${range}`)
7051     }
7052
7053     this.format()
7054   }
7055
7056   format () {
7057     this.range = this.set
7058       .map((comps) => {
7059         return comps.join(' ').trim()
7060       })
7061       .join('||')
7062       .trim()
7063     return this.range
7064   }
7065
7066   toString () {
7067     return this.range
7068   }
7069
7070   parseRange (range) {
7071     const loose = this.options.loose
7072     range = range.trim()
7073     // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
7074     const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
7075     range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
7076     debug('hyphen replace', range)
7077     // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
7078     range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
7079     debug('comparator trim', range, re[t.COMPARATORTRIM])
7080
7081     // `~ 1.2.3` => `~1.2.3`
7082     range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
7083
7084     // `^ 1.2.3` => `^1.2.3`
7085     range = range.replace(re[t.CARETTRIM], caretTrimReplace)
7086
7087     // normalize spaces
7088     range = range.split(/\s+/).join(' ')
7089
7090     // At this point, the range is completely trimmed and
7091     // ready to be split into comparators.
7092
7093     const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
7094     return range
7095       .split(' ')
7096       .map(comp => parseComparator(comp, this.options))
7097       .join(' ')
7098       .split(/\s+/)
7099       .map(comp => replaceGTE0(comp, this.options))
7100       // in loose mode, throw out any that are not valid comparators
7101       .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
7102       .map(comp => new Comparator(comp, this.options))
7103   }
7104
7105   intersects (range, options) {
7106     if (!(range instanceof Range)) {
7107       throw new TypeError('a Range is required')
7108     }
7109
7110     return this.set.some((thisComparators) => {
7111       return (
7112         isSatisfiable(thisComparators, options) &&
7113         range.set.some((rangeComparators) => {
7114           return (
7115             isSatisfiable(rangeComparators, options) &&
7116             thisComparators.every((thisComparator) => {
7117               return rangeComparators.every((rangeComparator) => {
7118                 return thisComparator.intersects(rangeComparator, options)
7119               })
7120             })
7121           )
7122         })
7123       )
7124     })
7125   }
7126
7127   // if ANY of the sets match ALL of its comparators, then pass
7128   test (version) {
7129     if (!version) {
7130       return false
7131     }
7132
7133     if (typeof version === 'string') {
7134       try {
7135         version = new SemVer(version, this.options)
7136       } catch (er) {
7137         return false
7138       }
7139     }
7140
7141     for (let i = 0; i < this.set.length; i++) {
7142       if (testSet(this.set[i], version, this.options)) {
7143         return true
7144       }
7145     }
7146     return false
7147   }
7148 }
7149 module.exports = Range
7150
7151 const Comparator = __webpack_require__(70)
7152 const debug = __webpack_require__(44)
7153 const SemVer = __webpack_require__(45)
7154 const {
7155   re,
7156   t,
7157   comparatorTrimReplace,
7158   tildeTrimReplace,
7159   caretTrimReplace
7160 } = __webpack_require__(42)
7161
7162 // take a set of comparators and determine whether there
7163 // exists a version which can satisfy it
7164 const isSatisfiable = (comparators, options) => {
7165   let result = true
7166   const remainingComparators = comparators.slice()
7167   let testComparator = remainingComparators.pop()
7168
7169   while (result && remainingComparators.length) {
7170     result = remainingComparators.every((otherComparator) => {
7171       return testComparator.intersects(otherComparator, options)
7172     })
7173
7174     testComparator = remainingComparators.pop()
7175   }
7176
7177   return result
7178 }
7179
7180 // comprised of xranges, tildes, stars, and gtlt's at this point.
7181 // already replaced the hyphen ranges
7182 // turn into a set of JUST comparators.
7183 const parseComparator = (comp, options) => {
7184   debug('comp', comp, options)
7185   comp = replaceCarets(comp, options)
7186   debug('caret', comp)
7187   comp = replaceTildes(comp, options)
7188   debug('tildes', comp)
7189   comp = replaceXRanges(comp, options)
7190   debug('xrange', comp)
7191   comp = replaceStars(comp, options)
7192   debug('stars', comp)
7193   return comp
7194 }
7195
7196 const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
7197
7198 // ~, ~> --> * (any, kinda silly)
7199 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
7200 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
7201 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
7202 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
7203 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
7204 const replaceTildes = (comp, options) =>
7205   comp.trim().split(/\s+/).map((comp) => {
7206     return replaceTilde(comp, options)
7207   }).join(' ')
7208
7209 const replaceTilde = (comp, options) => {
7210   const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
7211   return comp.replace(r, (_, M, m, p, pr) => {
7212     debug('tilde', comp, _, M, m, p, pr)
7213     let ret
7214
7215     if (isX(M)) {
7216       ret = ''
7217     } else if (isX(m)) {
7218       ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
7219     } else if (isX(p)) {
7220       // ~1.2 == >=1.2.0 <1.3.0-0
7221       ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
7222     } else if (pr) {
7223       debug('replaceTilde pr', pr)
7224       ret = `>=${M}.${m}.${p}-${pr
7225       } <${M}.${+m + 1}.0-0`
7226     } else {
7227       // ~1.2.3 == >=1.2.3 <1.3.0-0
7228       ret = `>=${M}.${m}.${p
7229       } <${M}.${+m + 1}.0-0`
7230     }
7231
7232     debug('tilde return', ret)
7233     return ret
7234   })
7235 }
7236
7237 // ^ --> * (any, kinda silly)
7238 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
7239 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
7240 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
7241 // ^1.2.3 --> >=1.2.3 <2.0.0-0
7242 // ^1.2.0 --> >=1.2.0 <2.0.0-0
7243 const replaceCarets = (comp, options) =>
7244   comp.trim().split(/\s+/).map((comp) => {
7245     return replaceCaret(comp, options)
7246   }).join(' ')
7247
7248 const replaceCaret = (comp, options) => {
7249   debug('caret', comp, options)
7250   const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
7251   const z = options.includePrerelease ? '-0' : ''
7252   return comp.replace(r, (_, M, m, p, pr) => {
7253     debug('caret', comp, _, M, m, p, pr)
7254     let ret
7255
7256     if (isX(M)) {
7257       ret = ''
7258     } else if (isX(m)) {
7259       ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
7260     } else if (isX(p)) {
7261       if (M === '0') {
7262         ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
7263       } else {
7264         ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
7265       }
7266     } else if (pr) {
7267       debug('replaceCaret pr', pr)
7268       if (M === '0') {
7269         if (m === '0') {
7270           ret = `>=${M}.${m}.${p}-${pr
7271           } <${M}.${m}.${+p + 1}-0`
7272         } else {
7273           ret = `>=${M}.${m}.${p}-${pr
7274           } <${M}.${+m + 1}.0-0`
7275         }
7276       } else {
7277         ret = `>=${M}.${m}.${p}-${pr
7278         } <${+M + 1}.0.0-0`
7279       }
7280     } else {
7281       debug('no pr')
7282       if (M === '0') {
7283         if (m === '0') {
7284           ret = `>=${M}.${m}.${p
7285           }${z} <${M}.${m}.${+p + 1}-0`
7286         } else {
7287           ret = `>=${M}.${m}.${p
7288           }${z} <${M}.${+m + 1}.0-0`
7289         }
7290       } else {
7291         ret = `>=${M}.${m}.${p
7292         } <${+M + 1}.0.0-0`
7293       }
7294     }
7295
7296     debug('caret return', ret)
7297     return ret
7298   })
7299 }
7300
7301 const replaceXRanges = (comp, options) => {
7302   debug('replaceXRanges', comp, options)
7303   return comp.split(/\s+/).map((comp) => {
7304     return replaceXRange(comp, options)
7305   }).join(' ')
7306 }
7307
7308 const replaceXRange = (comp, options) => {
7309   comp = comp.trim()
7310   const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
7311   return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
7312     debug('xRange', comp, ret, gtlt, M, m, p, pr)
7313     const xM = isX(M)
7314     const xm = xM || isX(m)
7315     const xp = xm || isX(p)
7316     const anyX = xp
7317
7318     if (gtlt === '=' && anyX) {
7319       gtlt = ''
7320     }
7321
7322     // if we're including prereleases in the match, then we need
7323     // to fix this to -0, the lowest possible prerelease value
7324     pr = options.includePrerelease ? '-0' : ''
7325
7326     if (xM) {
7327       if (gtlt === '>' || gtlt === '<') {
7328         // nothing is allowed
7329         ret = '<0.0.0-0'
7330       } else {
7331         // nothing is forbidden
7332         ret = '*'
7333       }
7334     } else if (gtlt && anyX) {
7335       // we know patch is an x, because we have any x at all.
7336       // replace X with 0
7337       if (xm) {
7338         m = 0
7339       }
7340       p = 0
7341
7342       if (gtlt === '>') {
7343         // >1 => >=2.0.0
7344         // >1.2 => >=1.3.0
7345         gtlt = '>='
7346         if (xm) {
7347           M = +M + 1
7348           m = 0
7349           p = 0
7350         } else {
7351           m = +m + 1
7352           p = 0
7353         }
7354       } else if (gtlt === '<=') {
7355         // <=0.7.x is actually <0.8.0, since any 0.7.x should
7356         // pass.  Similarly, <=7.x is actually <8.0.0, etc.
7357         gtlt = '<'
7358         if (xm) {
7359           M = +M + 1
7360         } else {
7361           m = +m + 1
7362         }
7363       }
7364
7365       if (gtlt === '<')
7366         pr = '-0'
7367
7368       ret = `${gtlt + M}.${m}.${p}${pr}`
7369     } else if (xm) {
7370       ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
7371     } else if (xp) {
7372       ret = `>=${M}.${m}.0${pr
7373       } <${M}.${+m + 1}.0-0`
7374     }
7375
7376     debug('xRange return', ret)
7377
7378     return ret
7379   })
7380 }
7381
7382 // Because * is AND-ed with everything else in the comparator,
7383 // and '' means "any version", just remove the *s entirely.
7384 const replaceStars = (comp, options) => {
7385   debug('replaceStars', comp, options)
7386   // Looseness is ignored here.  star is always as loose as it gets!
7387   return comp.trim().replace(re[t.STAR], '')
7388 }
7389
7390 const replaceGTE0 = (comp, options) => {
7391   debug('replaceGTE0', comp, options)
7392   return comp.trim()
7393     .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
7394 }
7395
7396 // This function is passed to string.replace(re[t.HYPHENRANGE])
7397 // M, m, patch, prerelease, build
7398 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
7399 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
7400 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
7401 const hyphenReplace = incPr => ($0,
7402   from, fM, fm, fp, fpr, fb,
7403   to, tM, tm, tp, tpr, tb) => {
7404   if (isX(fM)) {
7405     from = ''
7406   } else if (isX(fm)) {
7407     from = `>=${fM}.0.0${incPr ? '-0' : ''}`
7408   } else if (isX(fp)) {
7409     from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
7410   } else if (fpr) {
7411     from = `>=${from}`
7412   } else {
7413     from = `>=${from}${incPr ? '-0' : ''}`
7414   }
7415
7416   if (isX(tM)) {
7417     to = ''
7418   } else if (isX(tm)) {
7419     to = `<${+tM + 1}.0.0-0`
7420   } else if (isX(tp)) {
7421     to = `<${tM}.${+tm + 1}.0-0`
7422   } else if (tpr) {
7423     to = `<=${tM}.${tm}.${tp}-${tpr}`
7424   } else if (incPr) {
7425     to = `<${tM}.${tm}.${+tp + 1}-0`
7426   } else {
7427     to = `<=${to}`
7428   }
7429
7430   return (`${from} ${to}`).trim()
7431 }
7432
7433 const testSet = (set, version, options) => {
7434   for (let i = 0; i < set.length; i++) {
7435     if (!set[i].test(version)) {
7436       return false
7437     }
7438   }
7439
7440   if (version.prerelease.length && !options.includePrerelease) {
7441     // Find the set of versions that are allowed to have prereleases
7442     // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
7443     // That should allow `1.2.3-pr.2` to pass.
7444     // However, `1.2.4-alpha.notready` should NOT be allowed,
7445     // even though it's within the range set by the comparators.
7446     for (let i = 0; i < set.length; i++) {
7447       debug(set[i].semver)
7448       if (set[i].semver === Comparator.ANY) {
7449         continue
7450       }
7451
7452       if (set[i].semver.prerelease.length > 0) {
7453         const allowed = set[i].semver
7454         if (allowed.major === version.major &&
7455             allowed.minor === version.minor &&
7456             allowed.patch === version.patch) {
7457           return true
7458         }
7459       }
7460     }
7461
7462     // Version has a -pre, but it's not one of the ones we like.
7463     return false
7464   }
7465
7466   return true
7467 }
7468
7469
7470 /***/ }),
7471 /* 72 */
7472 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7473
7474 const Range = __webpack_require__(71)
7475 const satisfies = (version, range, options) => {
7476   try {
7477     range = new Range(range, options)
7478   } catch (er) {
7479     return false
7480   }
7481   return range.test(version)
7482 }
7483 module.exports = satisfies
7484
7485
7486 /***/ }),
7487 /* 73 */
7488 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7489
7490 const Range = __webpack_require__(71)
7491
7492 // Mostly just for testing and legacy API reasons
7493 const toComparators = (range, options) =>
7494   new Range(range, options).set
7495     .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
7496
7497 module.exports = toComparators
7498
7499
7500 /***/ }),
7501 /* 74 */
7502 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7503
7504 const SemVer = __webpack_require__(45)
7505 const Range = __webpack_require__(71)
7506
7507 const maxSatisfying = (versions, range, options) => {
7508   let max = null
7509   let maxSV = null
7510   let rangeObj = null
7511   try {
7512     rangeObj = new Range(range, options)
7513   } catch (er) {
7514     return null
7515   }
7516   versions.forEach((v) => {
7517     if (rangeObj.test(v)) {
7518       // satisfies(v, range, options)
7519       if (!max || maxSV.compare(v) === -1) {
7520         // compare(max, v, true)
7521         max = v
7522         maxSV = new SemVer(max, options)
7523       }
7524     }
7525   })
7526   return max
7527 }
7528 module.exports = maxSatisfying
7529
7530
7531 /***/ }),
7532 /* 75 */
7533 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7534
7535 const SemVer = __webpack_require__(45)
7536 const Range = __webpack_require__(71)
7537 const minSatisfying = (versions, range, options) => {
7538   let min = null
7539   let minSV = null
7540   let rangeObj = null
7541   try {
7542     rangeObj = new Range(range, options)
7543   } catch (er) {
7544     return null
7545   }
7546   versions.forEach((v) => {
7547     if (rangeObj.test(v)) {
7548       // satisfies(v, range, options)
7549       if (!min || minSV.compare(v) === 1) {
7550         // compare(min, v, true)
7551         min = v
7552         minSV = new SemVer(min, options)
7553       }
7554     }
7555   })
7556   return min
7557 }
7558 module.exports = minSatisfying
7559
7560
7561 /***/ }),
7562 /* 76 */
7563 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7564
7565 const SemVer = __webpack_require__(45)
7566 const Range = __webpack_require__(71)
7567 const gt = __webpack_require__(63)
7568
7569 const minVersion = (range, loose) => {
7570   range = new Range(range, loose)
7571
7572   let minver = new SemVer('0.0.0')
7573   if (range.test(minver)) {
7574     return minver
7575   }
7576
7577   minver = new SemVer('0.0.0-0')
7578   if (range.test(minver)) {
7579     return minver
7580   }
7581
7582   minver = null
7583   for (let i = 0; i < range.set.length; ++i) {
7584     const comparators = range.set[i]
7585
7586     comparators.forEach((comparator) => {
7587       // Clone to avoid manipulating the comparator's semver object.
7588       const compver = new SemVer(comparator.semver.version)
7589       switch (comparator.operator) {
7590         case '>':
7591           if (compver.prerelease.length === 0) {
7592             compver.patch++
7593           } else {
7594             compver.prerelease.push(0)
7595           }
7596           compver.raw = compver.format()
7597           /* fallthrough */
7598         case '':
7599         case '>=':
7600           if (!minver || gt(minver, compver)) {
7601             minver = compver
7602           }
7603           break
7604         case '<':
7605         case '<=':
7606           /* Ignore maximum versions */
7607           break
7608         /* istanbul ignore next */
7609         default:
7610           throw new Error(`Unexpected operation: ${comparator.operator}`)
7611       }
7612     })
7613   }
7614
7615   if (minver && range.test(minver)) {
7616     return minver
7617   }
7618
7619   return null
7620 }
7621 module.exports = minVersion
7622
7623
7624 /***/ }),
7625 /* 77 */
7626 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7627
7628 const Range = __webpack_require__(71)
7629 const validRange = (range, options) => {
7630   try {
7631     // Return '*' instead of '' so that truthiness works.
7632     // This will throw if it's invalid anyway
7633     return new Range(range, options).range || '*'
7634   } catch (er) {
7635     return null
7636   }
7637 }
7638 module.exports = validRange
7639
7640
7641 /***/ }),
7642 /* 78 */
7643 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7644
7645 const SemVer = __webpack_require__(45)
7646 const Comparator = __webpack_require__(70)
7647 const {ANY} = Comparator
7648 const Range = __webpack_require__(71)
7649 const satisfies = __webpack_require__(72)
7650 const gt = __webpack_require__(63)
7651 const lt = __webpack_require__(64)
7652 const lte = __webpack_require__(67)
7653 const gte = __webpack_require__(66)
7654
7655 const outside = (version, range, hilo, options) => {
7656   version = new SemVer(version, options)
7657   range = new Range(range, options)
7658
7659   let gtfn, ltefn, ltfn, comp, ecomp
7660   switch (hilo) {
7661     case '>':
7662       gtfn = gt
7663       ltefn = lte
7664       ltfn = lt
7665       comp = '>'
7666       ecomp = '>='
7667       break
7668     case '<':
7669       gtfn = lt
7670       ltefn = gte
7671       ltfn = gt
7672       comp = '<'
7673       ecomp = '<='
7674       break
7675     default:
7676       throw new TypeError('Must provide a hilo val of "<" or ">"')
7677   }
7678
7679   // If it satisifes the range it is not outside
7680   if (satisfies(version, range, options)) {
7681     return false
7682   }
7683
7684   // From now on, variable terms are as if we're in "gtr" mode.
7685   // but note that everything is flipped for the "ltr" function.
7686
7687   for (let i = 0; i < range.set.length; ++i) {
7688     const comparators = range.set[i]
7689
7690     let high = null
7691     let low = null
7692
7693     comparators.forEach((comparator) => {
7694       if (comparator.semver === ANY) {
7695         comparator = new Comparator('>=0.0.0')
7696       }
7697       high = high || comparator
7698       low = low || comparator
7699       if (gtfn(comparator.semver, high.semver, options)) {
7700         high = comparator
7701       } else if (ltfn(comparator.semver, low.semver, options)) {
7702         low = comparator
7703       }
7704     })
7705
7706     // If the edge version comparator has a operator then our version
7707     // isn't outside it
7708     if (high.operator === comp || high.operator === ecomp) {
7709       return false
7710     }
7711
7712     // If the lowest version comparator has an operator and our version
7713     // is less than it then it isn't higher than the range
7714     if ((!low.operator || low.operator === comp) &&
7715         ltefn(version, low.semver)) {
7716       return false
7717     } else if (low.operator === ecomp && ltfn(version, low.semver)) {
7718       return false
7719     }
7720   }
7721   return true
7722 }
7723
7724 module.exports = outside
7725
7726
7727 /***/ }),
7728 /* 79 */
7729 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7730
7731 // Determine if version is greater than all the versions possible in the range.
7732 const outside = __webpack_require__(78)
7733 const gtr = (version, range, options) => outside(version, range, '>', options)
7734 module.exports = gtr
7735
7736
7737 /***/ }),
7738 /* 80 */
7739 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7740
7741 const outside = __webpack_require__(78)
7742 // Determine if version is less than all the versions possible in the range
7743 const ltr = (version, range, options) => outside(version, range, '<', options)
7744 module.exports = ltr
7745
7746
7747 /***/ }),
7748 /* 81 */
7749 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7750
7751 const Range = __webpack_require__(71)
7752 const intersects = (r1, r2, options) => {
7753   r1 = new Range(r1, options)
7754   r2 = new Range(r2, options)
7755   return r1.intersects(r2)
7756 }
7757 module.exports = intersects
7758
7759
7760 /***/ }),
7761 /* 82 */
7762 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7763
7764 // given a set of versions and a range, create a "simplified" range
7765 // that includes the same versions that the original range does
7766 // If the original range is shorter than the simplified one, return that.
7767 const satisfies = __webpack_require__(72)
7768 const compare = __webpack_require__(53)
7769 module.exports = (versions, range, options) => {
7770   const set = []
7771   let min = null
7772   let prev = null
7773   const v = versions.sort((a, b) => compare(a, b, options))
7774   for (const version of v) {
7775     const included = satisfies(version, range, options)
7776     if (included) {
7777       prev = version
7778       if (!min)
7779         min = version
7780     } else {
7781       if (prev) {
7782         set.push([min, prev])
7783       }
7784       prev = null
7785       min = null
7786     }
7787   }
7788   if (min)
7789     set.push([min, null])
7790
7791   const ranges = []
7792   for (const [min, max] of set) {
7793     if (min === max)
7794       ranges.push(min)
7795     else if (!max && min === v[0])
7796       ranges.push('*')
7797     else if (!max)
7798       ranges.push(`>=${min}`)
7799     else if (min === v[0])
7800       ranges.push(`<=${max}`)
7801     else
7802       ranges.push(`${min} - ${max}`)
7803   }
7804   const simplified = ranges.join(' || ')
7805   const original = typeof range.raw === 'string' ? range.raw : String(range)
7806   return simplified.length < original.length ? simplified : range
7807 }
7808
7809
7810 /***/ }),
7811 /* 83 */
7812 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7813
7814 const Range = __webpack_require__(71)
7815 const { ANY } = __webpack_require__(70)
7816 const satisfies = __webpack_require__(72)
7817 const compare = __webpack_require__(53)
7818
7819 // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
7820 // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
7821 //
7822 // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
7823 // - If c is only the ANY comparator
7824 //   - If C is only the ANY comparator, return true
7825 //   - Else return false
7826 // - Let EQ be the set of = comparators in c
7827 // - If EQ is more than one, return true (null set)
7828 // - Let GT be the highest > or >= comparator in c
7829 // - Let LT be the lowest < or <= comparator in c
7830 // - If GT and LT, and GT.semver > LT.semver, return true (null set)
7831 // - If EQ
7832 //   - If GT, and EQ does not satisfy GT, return true (null set)
7833 //   - If LT, and EQ does not satisfy LT, return true (null set)
7834 //   - If EQ satisfies every C, return true
7835 //   - Else return false
7836 // - If GT
7837 //   - If GT is lower than any > or >= comp in C, return false
7838 //   - If GT is >=, and GT.semver does not satisfy every C, return false
7839 // - If LT
7840 //   - If LT.semver is greater than that of any > comp in C, return false
7841 //   - If LT is <=, and LT.semver does not satisfy every C, return false
7842 // - If any C is a = range, and GT or LT are set, return false
7843 // - Else return true
7844
7845 const subset = (sub, dom, options) => {
7846   sub = new Range(sub, options)
7847   dom = new Range(dom, options)
7848   let sawNonNull = false
7849
7850   OUTER: for (const simpleSub of sub.set) {
7851     for (const simpleDom of dom.set) {
7852       const isSub = simpleSubset(simpleSub, simpleDom, options)
7853       sawNonNull = sawNonNull || isSub !== null
7854       if (isSub)
7855         continue OUTER
7856     }
7857     // the null set is a subset of everything, but null simple ranges in
7858     // a complex range should be ignored.  so if we saw a non-null range,
7859     // then we know this isn't a subset, but if EVERY simple range was null,
7860     // then it is a subset.
7861     if (sawNonNull)
7862       return false
7863   }
7864   return true
7865 }
7866
7867 const simpleSubset = (sub, dom, options) => {
7868   if (sub.length === 1 && sub[0].semver === ANY)
7869     return dom.length === 1 && dom[0].semver === ANY
7870
7871   const eqSet = new Set()
7872   let gt, lt
7873   for (const c of sub) {
7874     if (c.operator === '>' || c.operator === '>=')
7875       gt = higherGT(gt, c, options)
7876     else if (c.operator === '<' || c.operator === '<=')
7877       lt = lowerLT(lt, c, options)
7878     else
7879       eqSet.add(c.semver)
7880   }
7881
7882   if (eqSet.size > 1)
7883     return null
7884
7885   let gtltComp
7886   if (gt && lt) {
7887     gtltComp = compare(gt.semver, lt.semver, options)
7888     if (gtltComp > 0)
7889       return null
7890     else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
7891       return null
7892   }
7893
7894   // will iterate one or zero times
7895   for (const eq of eqSet) {
7896     if (gt && !satisfies(eq, String(gt), options))
7897       return null
7898
7899     if (lt && !satisfies(eq, String(lt), options))
7900       return null
7901
7902     for (const c of dom) {
7903       if (!satisfies(eq, String(c), options))
7904         return false
7905     }
7906     return true
7907   }
7908
7909   let higher, lower
7910   let hasDomLT, hasDomGT
7911   for (const c of dom) {
7912     hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
7913     hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
7914     if (gt) {
7915       if (c.operator === '>' || c.operator === '>=') {
7916         higher = higherGT(gt, c, options)
7917         if (higher === c)
7918           return false
7919       } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
7920         return false
7921     }
7922     if (lt) {
7923       if (c.operator === '<' || c.operator === '<=') {
7924         lower = lowerLT(lt, c, options)
7925         if (lower === c)
7926           return false
7927       } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
7928         return false
7929     }
7930     if (!c.operator && (lt || gt) && gtltComp !== 0)
7931       return false
7932   }
7933
7934   // if there was a < or >, and nothing in the dom, then must be false
7935   // UNLESS it was limited by another range in the other direction.
7936   // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
7937   if (gt && hasDomLT && !lt && gtltComp !== 0)
7938     return false
7939
7940   if (lt && hasDomGT && !gt && gtltComp !== 0)
7941     return false
7942
7943   return true
7944 }
7945
7946 // >=1.2.3 is lower than >1.2.3
7947 const higherGT = (a, b, options) => {
7948   if (!a)
7949     return b
7950   const comp = compare(a.semver, b.semver, options)
7951   return comp > 0 ? a
7952     : comp < 0 ? b
7953     : b.operator === '>' && a.operator === '>=' ? b
7954     : a
7955 }
7956
7957 // <=1.2.3 is higher than <1.2.3
7958 const lowerLT = (a, b, options) => {
7959   if (!a)
7960     return b
7961   const comp = compare(a.semver, b.semver, options)
7962   return comp < 0 ? a
7963     : comp > 0 ? b
7964     : b.operator === '<' && a.operator === '<=' ? b
7965     : a
7966 }
7967
7968 module.exports = subset
7969
7970
7971 /***/ }),
7972 /* 84 */
7973 /***/ ((module) => {
7974
7975 // A simple implementation of make-array
7976 function makeArray (subject) {
7977   return Array.isArray(subject)
7978     ? subject
7979     : [subject]
7980 }
7981
7982 const EMPTY = ''
7983 const SPACE = ' '
7984 const ESCAPE = '\\'
7985 const REGEX_TEST_BLANK_LINE = /^\s+$/
7986 const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
7987 const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
7988 const REGEX_SPLITALL_CRLF = /\r?\n/g
7989 // /foo,
7990 // ./foo,
7991 // ../foo,
7992 // .
7993 // ..
7994 const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
7995
7996 const SLASH = '/'
7997 const KEY_IGNORE = typeof Symbol !== 'undefined'
7998   ? Symbol.for('node-ignore')
7999   /* istanbul ignore next */
8000   : 'node-ignore'
8001
8002 const define = (object, key, value) =>
8003   Object.defineProperty(object, key, {value})
8004
8005 const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
8006
8007 // Sanitize the range of a regular expression
8008 // The cases are complicated, see test cases for details
8009 const sanitizeRange = range => range.replace(
8010   REGEX_REGEXP_RANGE,
8011   (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
8012     ? match
8013     // Invalid range (out of order) which is ok for gitignore rules but
8014     //   fatal for JavaScript regular expression, so eliminate it.
8015     : EMPTY
8016 )
8017
8018 // See fixtures #59
8019 const cleanRangeBackSlash = slashes => {
8020   const {length} = slashes
8021   return slashes.slice(0, length - length % 2)
8022 }
8023
8024 // > If the pattern ends with a slash,
8025 // > it is removed for the purpose of the following description,
8026 // > but it would only find a match with a directory.
8027 // > In other words, foo/ will match a directory foo and paths underneath it,
8028 // > but will not match a regular file or a symbolic link foo
8029 // >  (this is consistent with the way how pathspec works in general in Git).
8030 // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
8031 // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
8032 //      you could use option `mark: true` with `glob`
8033
8034 // '`foo/`' should not continue with the '`..`'
8035 const REPLACERS = [
8036
8037   // > Trailing spaces are ignored unless they are quoted with backslash ("\")
8038   [
8039     // (a\ ) -> (a )
8040     // (a  ) -> (a)
8041     // (a \ ) -> (a  )
8042     /\\?\s+$/,
8043     match => match.indexOf('\\') === 0
8044       ? SPACE
8045       : EMPTY
8046   ],
8047
8048   // replace (\ ) with ' '
8049   [
8050     /\\\s/g,
8051     () => SPACE
8052   ],
8053
8054   // Escape metacharacters
8055   // which is written down by users but means special for regular expressions.
8056
8057   // > There are 12 characters with special meanings:
8058   // > - the backslash \,
8059   // > - the caret ^,
8060   // > - the dollar sign $,
8061   // > - the period or dot .,
8062   // > - the vertical bar or pipe symbol |,
8063   // > - the question mark ?,
8064   // > - the asterisk or star *,
8065   // > - the plus sign +,
8066   // > - the opening parenthesis (,
8067   // > - the closing parenthesis ),
8068   // > - and the opening square bracket [,
8069   // > - the opening curly brace {,
8070   // > These special characters are often called "metacharacters".
8071   [
8072     /[\\$.|*+(){^]/g,
8073     match => `\\${match}`
8074   ],
8075
8076   [
8077     // > a question mark (?) matches a single character
8078     /(?!\\)\?/g,
8079     () => '[^/]'
8080   ],
8081
8082   // leading slash
8083   [
8084
8085     // > A leading slash matches the beginning of the pathname.
8086     // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
8087     // A leading slash matches the beginning of the pathname
8088     /^\//,
8089     () => '^'
8090   ],
8091
8092   // replace special metacharacter slash after the leading slash
8093   [
8094     /\//g,
8095     () => '\\/'
8096   ],
8097
8098   [
8099     // > A leading "**" followed by a slash means match in all directories.
8100     // > For example, "**/foo" matches file or directory "foo" anywhere,
8101     // > the same as pattern "foo".
8102     // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
8103     // >   under directory "foo".
8104     // Notice that the '*'s have been replaced as '\\*'
8105     /^\^*\\\*\\\*\\\//,
8106
8107     // '**/foo' <-> 'foo'
8108     () => '^(?:.*\\/)?'
8109   ],
8110
8111   // starting
8112   [
8113     // there will be no leading '/'
8114     //   (which has been replaced by section "leading slash")
8115     // If starts with '**', adding a '^' to the regular expression also works
8116     /^(?=[^^])/,
8117     function startingReplacer () {
8118       // If has a slash `/` at the beginning or middle
8119       return !/\/(?!$)/.test(this)
8120         // > Prior to 2.22.1
8121         // > If the pattern does not contain a slash /,
8122         // >   Git treats it as a shell glob pattern
8123         // Actually, if there is only a trailing slash,
8124         //   git also treats it as a shell glob pattern
8125
8126         // After 2.22.1 (compatible but clearer)
8127         // > If there is a separator at the beginning or middle (or both)
8128         // > of the pattern, then the pattern is relative to the directory
8129         // > level of the particular .gitignore file itself.
8130         // > Otherwise the pattern may also match at any level below
8131         // > the .gitignore level.
8132         ? '(?:^|\\/)'
8133
8134         // > Otherwise, Git treats the pattern as a shell glob suitable for
8135         // >   consumption by fnmatch(3)
8136         : '^'
8137     }
8138   ],
8139
8140   // two globstars
8141   [
8142     // Use lookahead assertions so that we could match more than one `'/**'`
8143     /\\\/\\\*\\\*(?=\\\/|$)/g,
8144
8145     // Zero, one or several directories
8146     // should not use '*', or it will be replaced by the next replacer
8147
8148     // Check if it is not the last `'/**'`
8149     (_, index, str) => index + 6 < str.length
8150
8151       // case: /**/
8152       // > A slash followed by two consecutive asterisks then a slash matches
8153       // >   zero or more directories.
8154       // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
8155       // '/**/'
8156       ? '(?:\\/[^\\/]+)*'
8157
8158       // case: /**
8159       // > A trailing `"/**"` matches everything inside.
8160
8161       // #21: everything inside but it should not include the current folder
8162       : '\\/.+'
8163   ],
8164
8165   // intermediate wildcards
8166   [
8167     // Never replace escaped '*'
8168     // ignore rule '\*' will match the path '*'
8169
8170     // 'abc.*/' -> go
8171     // 'abc.*'  -> skip this rule
8172     /(^|[^\\]+)\\\*(?=.+)/g,
8173
8174     // '*.js' matches '.js'
8175     // '*.js' doesn't match 'abc'
8176     (_, p1) => `${p1}[^\\/]*`
8177   ],
8178
8179   [
8180     // unescape, revert step 3 except for back slash
8181     // For example, if a user escape a '\\*',
8182     // after step 3, the result will be '\\\\\\*'
8183     /\\\\\\(?=[$.|*+(){^])/g,
8184     () => ESCAPE
8185   ],
8186
8187   [
8188     // '\\\\' -> '\\'
8189     /\\\\/g,
8190     () => ESCAPE
8191   ],
8192
8193   [
8194     // > The range notation, e.g. [a-zA-Z],
8195     // > can be used to match one of the characters in a range.
8196
8197     // `\` is escaped by step 3
8198     /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
8199     (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
8200       // '\\[bar]' -> '\\\\[bar\\]'
8201       ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
8202       : close === ']'
8203         ? endEscape.length % 2 === 0
8204           // A normal case, and it is a range notation
8205           // '[bar]'
8206           // '[bar\\\\]'
8207           ? `[${sanitizeRange(range)}${endEscape}]`
8208           // Invalid range notaton
8209           // '[bar\\]' -> '[bar\\\\]'
8210           : '[]'
8211         : '[]'
8212   ],
8213
8214   // ending
8215   [
8216     // 'js' will not match 'js.'
8217     // 'ab' will not match 'abc'
8218     /(?:[^*])$/,
8219
8220     // WTF!
8221     // https://git-scm.com/docs/gitignore
8222     // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
8223     // which re-fixes #24, #38
8224
8225     // > If there is a separator at the end of the pattern then the pattern
8226     // > will only match directories, otherwise the pattern can match both
8227     // > files and directories.
8228
8229     // 'js*' will not match 'a.js'
8230     // 'js/' will not match 'a.js'
8231     // 'js' will match 'a.js' and 'a.js/'
8232     match => /\/$/.test(match)
8233       // foo/ will not match 'foo'
8234       ? `${match}$`
8235       // foo matches 'foo' and 'foo/'
8236       : `${match}(?=$|\\/$)`
8237   ],
8238
8239   // trailing wildcard
8240   [
8241     /(\^|\\\/)?\\\*$/,
8242     (_, p1) => {
8243       const prefix = p1
8244         // '\^':
8245         // '/*' does not match EMPTY
8246         // '/*' does not match everything
8247
8248         // '\\\/':
8249         // 'abc/*' does not match 'abc/'
8250         ? `${p1}[^/]+`
8251
8252         // 'a*' matches 'a'
8253         // 'a*' matches 'aa'
8254         : '[^/]*'
8255
8256       return `${prefix}(?=$|\\/$)`
8257     }
8258   ],
8259 ]
8260
8261 // A simple cache, because an ignore rule only has only one certain meaning
8262 const regexCache = Object.create(null)
8263
8264 // @param {pattern}
8265 const makeRegex = (pattern, negative, ignorecase) => {
8266   const r = regexCache[pattern]
8267   if (r) {
8268     return r
8269   }
8270
8271   // const replacers = negative
8272   //   ? NEGATIVE_REPLACERS
8273   //   : POSITIVE_REPLACERS
8274
8275   const source = REPLACERS.reduce(
8276     (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
8277     pattern
8278   )
8279
8280   return regexCache[pattern] = ignorecase
8281     ? new RegExp(source, 'i')
8282     : new RegExp(source)
8283 }
8284
8285 const isString = subject => typeof subject === 'string'
8286
8287 // > A blank line matches no files, so it can serve as a separator for readability.
8288 const checkPattern = pattern => pattern
8289   && isString(pattern)
8290   && !REGEX_TEST_BLANK_LINE.test(pattern)
8291
8292   // > A line starting with # serves as a comment.
8293   && pattern.indexOf('#') !== 0
8294
8295 const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
8296
8297 class IgnoreRule {
8298   constructor (
8299     origin,
8300     pattern,
8301     negative,
8302     regex
8303   ) {
8304     this.origin = origin
8305     this.pattern = pattern
8306     this.negative = negative
8307     this.regex = regex
8308   }
8309 }
8310
8311 const createRule = (pattern, ignorecase) => {
8312   const origin = pattern
8313   let negative = false
8314
8315   // > An optional prefix "!" which negates the pattern;
8316   if (pattern.indexOf('!') === 0) {
8317     negative = true
8318     pattern = pattern.substr(1)
8319   }
8320
8321   pattern = pattern
8322   // > Put a backslash ("\") in front of the first "!" for patterns that
8323   // >   begin with a literal "!", for example, `"\!important!.txt"`.
8324   .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
8325   // > Put a backslash ("\") in front of the first hash for patterns that
8326   // >   begin with a hash.
8327   .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
8328
8329   const regex = makeRegex(pattern, negative, ignorecase)
8330
8331   return new IgnoreRule(
8332     origin,
8333     pattern,
8334     negative,
8335     regex
8336   )
8337 }
8338
8339 const throwError = (message, Ctor) => {
8340   throw new Ctor(message)
8341 }
8342
8343 const checkPath = (path, originalPath, doThrow) => {
8344   if (!isString(path)) {
8345     return doThrow(
8346       `path must be a string, but got \`${originalPath}\``,
8347       TypeError
8348     )
8349   }
8350
8351   // We don't know if we should ignore EMPTY, so throw
8352   if (!path) {
8353     return doThrow(`path must not be empty`, TypeError)
8354   }
8355
8356   // Check if it is a relative path
8357   if (checkPath.isNotRelative(path)) {
8358     const r = '`path.relative()`d'
8359     return doThrow(
8360       `path should be a ${r} string, but got "${originalPath}"`,
8361       RangeError
8362     )
8363   }
8364
8365   return true
8366 }
8367
8368 const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
8369
8370 checkPath.isNotRelative = isNotRelative
8371 checkPath.convert = p => p
8372
8373 class Ignore {
8374   constructor ({
8375     ignorecase = true
8376   } = {}) {
8377     this._rules = []
8378     this._ignorecase = ignorecase
8379     define(this, KEY_IGNORE, true)
8380     this._initCache()
8381   }
8382
8383   _initCache () {
8384     this._ignoreCache = Object.create(null)
8385     this._testCache = Object.create(null)
8386   }
8387
8388   _addPattern (pattern) {
8389     // #32
8390     if (pattern && pattern[KEY_IGNORE]) {
8391       this._rules = this._rules.concat(pattern._rules)
8392       this._added = true
8393       return
8394     }
8395
8396     if (checkPattern(pattern)) {
8397       const rule = createRule(pattern, this._ignorecase)
8398       this._added = true
8399       this._rules.push(rule)
8400     }
8401   }
8402
8403   // @param {Array<string> | string | Ignore} pattern
8404   add (pattern) {
8405     this._added = false
8406
8407     makeArray(
8408       isString(pattern)
8409         ? splitPattern(pattern)
8410         : pattern
8411     ).forEach(this._addPattern, this)
8412
8413     // Some rules have just added to the ignore,
8414     // making the behavior changed.
8415     if (this._added) {
8416       this._initCache()
8417     }
8418
8419     return this
8420   }
8421
8422   // legacy
8423   addPattern (pattern) {
8424     return this.add(pattern)
8425   }
8426
8427   //          |           ignored : unignored
8428   // negative |   0:0   |   0:1   |   1:0   |   1:1
8429   // -------- | ------- | ------- | ------- | --------
8430   //     0    |  TEST   |  TEST   |  SKIP   |    X
8431   //     1    |  TESTIF |  SKIP   |  TEST   |    X
8432
8433   // - SKIP: always skip
8434   // - TEST: always test
8435   // - TESTIF: only test if checkUnignored
8436   // - X: that never happen
8437
8438   // @param {boolean} whether should check if the path is unignored,
8439   //   setting `checkUnignored` to `false` could reduce additional
8440   //   path matching.
8441
8442   // @returns {TestResult} true if a file is ignored
8443   _testOne (path, checkUnignored) {
8444     let ignored = false
8445     let unignored = false
8446
8447     this._rules.forEach(rule => {
8448       const {negative} = rule
8449       if (
8450         unignored === negative && ignored !== unignored
8451         || negative && !ignored && !unignored && !checkUnignored
8452       ) {
8453         return
8454       }
8455
8456       const matched = rule.regex.test(path)
8457
8458       if (matched) {
8459         ignored = !negative
8460         unignored = negative
8461       }
8462     })
8463
8464     return {
8465       ignored,
8466       unignored
8467     }
8468   }
8469
8470   // @returns {TestResult}
8471   _test (originalPath, cache, checkUnignored, slices) {
8472     const path = originalPath
8473       // Supports nullable path
8474       && checkPath.convert(originalPath)
8475
8476     checkPath(path, originalPath, throwError)
8477
8478     return this._t(path, cache, checkUnignored, slices)
8479   }
8480
8481   _t (path, cache, checkUnignored, slices) {
8482     if (path in cache) {
8483       return cache[path]
8484     }
8485
8486     if (!slices) {
8487       // path/to/a.js
8488       // ['path', 'to', 'a.js']
8489       slices = path.split(SLASH)
8490     }
8491
8492     slices.pop()
8493
8494     // If the path has no parent directory, just test it
8495     if (!slices.length) {
8496       return cache[path] = this._testOne(path, checkUnignored)
8497     }
8498
8499     const parent = this._t(
8500       slices.join(SLASH) + SLASH,
8501       cache,
8502       checkUnignored,
8503       slices
8504     )
8505
8506     // If the path contains a parent directory, check the parent first
8507     return cache[path] = parent.ignored
8508       // > It is not possible to re-include a file if a parent directory of
8509       // >   that file is excluded.
8510       ? parent
8511       : this._testOne(path, checkUnignored)
8512   }
8513
8514   ignores (path) {
8515     return this._test(path, this._ignoreCache, false).ignored
8516   }
8517
8518   createFilter () {
8519     return path => !this.ignores(path)
8520   }
8521
8522   filter (paths) {
8523     return makeArray(paths).filter(this.createFilter())
8524   }
8525
8526   // @returns {TestResult}
8527   test (path) {
8528     return this._test(path, this._testCache, true)
8529   }
8530 }
8531
8532 const factory = options => new Ignore(options)
8533
8534 const returnFalse = () => false
8535
8536 const isPathValid = path =>
8537   checkPath(path && checkPath.convert(path), path, returnFalse)
8538
8539 factory.isPathValid = isPathValid
8540
8541 // Fixes typescript
8542 factory.default = factory
8543
8544 module.exports = factory
8545
8546 // Windows
8547 // --------------------------------------------------------------
8548 /* istanbul ignore if  */
8549 if (
8550   // Detect `process` so that it can run in browsers.
8551   typeof process !== 'undefined'
8552   && (
8553     process.env && process.env.IGNORE_TEST_WIN32
8554     || process.platform === 'win32'
8555   )
8556 ) {
8557   /* eslint no-control-regex: "off" */
8558   const makePosix = str => /^\\\\\?\\/.test(str)
8559   || /["<>|\u0000-\u001F]+/u.test(str)
8560     ? str
8561     : str.replace(/\\/g, '/')
8562
8563   checkPath.convert = makePosix
8564
8565   // 'C:\\foo'     <- 'C:\\foo' has been converted to 'C:/'
8566   // 'd:\\foo'
8567   const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
8568   checkPath.isNotRelative = path =>
8569     REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
8570     || isNotRelative(path)
8571 }
8572
8573
8574 /***/ }),
8575 /* 85 */
8576 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8577
8578 "use strict";
8579
8580 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8581     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8582     return new (P || (P = Promise))(function (resolve, reject) {
8583         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8584         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8585         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8586         step((generator = generator.apply(thisArg, _arguments || [])).next());
8587     });
8588 };
8589 var __importDefault = (this && this.__importDefault) || function (mod) {
8590     return (mod && mod.__esModule) ? mod : { "default": mod };
8591 };
8592 Object.defineProperty(exports, "__esModule", ({ value: true }));
8593 exports.fullDocumentRange = exports.format = void 0;
8594 const coc_nvim_1 = __webpack_require__(1);
8595 const path_1 = __importDefault(__webpack_require__(12));
8596 const vscode_languageserver_protocol_1 = __webpack_require__(2);
8597 const errorHandler_1 = __webpack_require__(34);
8598 const requirePkg_1 = __webpack_require__(38);
8599 const utils_1 = __webpack_require__(37);
8600 /**
8601  * HOLD style parsers (for stylelint integration)
8602  */
8603 const STYLE_PARSERS = ['postcss', 'css', 'less', 'scss'];
8604 /**
8605  * Resolves the prettierconfig for the given file.
8606  *
8607  * @param filePath file's path
8608  */
8609 function resolveConfig(filePath, options) {
8610     return __awaiter(this, void 0, void 0, function* () {
8611         try {
8612             const localPrettier = (yield requirePkg_1.requireLocalPkg(path_1.default.dirname(filePath), 'prettier', { silent: true, ignoreBundled: true }));
8613             let prettierInstance = localPrettier;
8614             if (!prettierInstance && !options.onlyUseLocalVersion) {
8615                 prettierInstance = __webpack_require__(33);
8616             }
8617             const config = yield prettierInstance.resolveConfig(filePath, options);
8618             return { config };
8619         }
8620         catch (error) {
8621             return { config: null, error };
8622         }
8623     });
8624 }
8625 /**
8626  * Define which config should be used.
8627  * If a prettierconfig exists, it returns itself.
8628  * It merges prettierconfig into vscode's config (editorconfig).
8629  * Priority:
8630  * - additionalConfig
8631  * - prettierConfig
8632  * - vscodeConfig
8633  * @param hasPrettierConfig a prettierconfig exists
8634  * @param additionalConfig config we really want to see in. (range)
8635  * @param prettierConfig prettier's file config
8636  * @param vscodeConfig our config
8637  */
8638 function mergeConfig(hasPrettierConfig, additionalConfig, prettierConfig, vscodeConfig) {
8639     return hasPrettierConfig
8640         ? Object.assign({ parser: vscodeConfig.parser }, // always merge our inferred parser in
8641         prettierConfig, additionalConfig)
8642         : Object.assign(vscodeConfig, prettierConfig, additionalConfig);
8643 }
8644 /**
8645  * Format the given text with user's configuration.
8646  * @param text Text to format
8647  * @param path formatting file's path
8648  * @returns {string} formatted text
8649  */
8650 function format(text, { languageId, uri }, customOptions) {
8651     return __awaiter(this, void 0, void 0, function* () {
8652         let u = coc_nvim_1.Uri.parse(uri);
8653         const isUntitled = u.scheme == 'untitled';
8654         const fileName = u.fsPath;
8655         const vscodeConfig = utils_1.getConfig(u);
8656         const localOnly = vscodeConfig.onlyUseLocalVersion;
8657         const resolvedPrettier = yield utils_1.getPrettierInstance();
8658         if (!resolvedPrettier) {
8659             errorHandler_1.addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, 'Error');
8660         }
8661         let supportedLanguages = utils_1.allLanguages(resolvedPrettier);
8662         if (supportedLanguages.indexOf(languageId) == -1) {
8663             coc_nvim_1.workspace.showMessage(`${languageId} not supported by prettier`, 'error');
8664             return;
8665         }
8666         const dynamicParsers = utils_1.getParsersFromLanguageId(languageId, resolvedPrettier, isUntitled ? undefined : fileName);
8667         let useBundled = false;
8668         let parser;
8669         if (!dynamicParsers.length) {
8670             const bundledParsers = utils_1.getParsersFromLanguageId(languageId, __webpack_require__(33), isUntitled ? undefined : fileName);
8671             parser = bundledParsers[0] || 'babylon';
8672             useBundled = true;
8673         }
8674         else if (dynamicParsers.includes(vscodeConfig.parser)) {
8675             // handle deprecated parser option (parser: "flow")
8676             parser = vscodeConfig.parser;
8677         }
8678         else {
8679             parser = dynamicParsers[0];
8680         }
8681         const doesParserSupportEslint = [
8682             'javascript',
8683             'javascriptreact',
8684             'typescript',
8685             'typescriptreact',
8686             'vue',
8687         ].includes(languageId);
8688         const { config: fileOptions, error } = yield resolveConfig(fileName, {
8689             editorconfig: true,
8690             onlyUseLocalVersion: localOnly,
8691             requireConfig: vscodeConfig.requireConfig,
8692         });
8693         const hasConfig = fileOptions != null;
8694         if (!hasConfig && vscodeConfig.requireConfig) {
8695             return text;
8696         }
8697         if (error) {
8698             errorHandler_1.addToOutput(`Failed to resolve config for ${fileName}. Falling back to the default config settings.`, 'Error');
8699         }
8700         const prettierOptions = mergeConfig(hasConfig, customOptions, fileOptions || {}, {
8701             printWidth: vscodeConfig.printWidth,
8702             tabWidth: vscodeConfig.tabWidth,
8703             singleQuote: vscodeConfig.singleQuote,
8704             jsxSingleQuote: vscodeConfig.jsxSingleQuote,
8705             trailingComma: vscodeConfig.trailingComma,
8706             bracketSpacing: vscodeConfig.bracketSpacing,
8707             jsxBracketSameLine: vscodeConfig.jsxBracketSameLine,
8708             parser,
8709             semi: vscodeConfig.semi,
8710             useTabs: vscodeConfig.useTabs,
8711             proseWrap: vscodeConfig.proseWrap,
8712             arrowParens: vscodeConfig.arrowParens,
8713         });
8714         if (vscodeConfig.tslintIntegration && parser === 'typescript') {
8715             return errorHandler_1.safeExecution(() => {
8716                 const prettierTslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-tslint')
8717                     .format;
8718                 // setUsedModule('prettier-tslint', 'Unknown', true)
8719                 return prettierTslint({
8720                     text,
8721                     filePath: fileName,
8722                     fallbackPrettierOptions: prettierOptions,
8723                 });
8724             }, text, fileName);
8725         }
8726         if (vscodeConfig.eslintIntegration && doesParserSupportEslint) {
8727             return errorHandler_1.safeExecution(() => {
8728                 const prettierEslint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-eslint');
8729                 // setUsedModule('prettier-eslint', 'Unknown', true)
8730                 return prettierEslint({
8731                     text,
8732                     filePath: fileName,
8733                     fallbackPrettierOptions: prettierOptions,
8734                 });
8735             }, text, fileName);
8736         }
8737         if (vscodeConfig.stylelintIntegration && STYLE_PARSERS.includes(parser)) {
8738             const prettierStylelint = requirePkg_1.requireLocalPkg(u.fsPath, 'prettier-stylelint');
8739             return errorHandler_1.safeExecution(prettierStylelint.format({
8740                 text,
8741                 filePath: fileName,
8742                 prettierOptions,
8743             }), text, fileName);
8744         }
8745         if (!doesParserSupportEslint && useBundled) {
8746             let bundledPrettier = __webpack_require__(33);
8747             return errorHandler_1.safeExecution(() => {
8748                 const warningMessage = `prettier@${bundledPrettier.version} doesn't support ${languageId}. ` +
8749                     `Falling back to bundled prettier@${bundledPrettier.version}.`;
8750                 errorHandler_1.addToOutput(warningMessage, 'Warning');
8751                 // setUsedModule('prettier', bundledPrettier.version, true)
8752                 return bundledPrettier.format(text, prettierOptions);
8753             }, text, fileName);
8754         }
8755         // setUsedModule('prettier', localPrettier.version, false)
8756         return errorHandler_1.safeExecution(() => resolvedPrettier.format(text, prettierOptions), text, fileName);
8757     });
8758 }
8759 exports.format = format;
8760 function fullDocumentRange(document) {
8761     const lastLineId = document.lineCount - 1;
8762     let doc = coc_nvim_1.workspace.getDocument(document.uri);
8763     return vscode_languageserver_protocol_1.Range.create({ character: 0, line: 0 }, { character: doc.getline(lastLineId).length, line: lastLineId });
8764 }
8765 exports.fullDocumentRange = fullDocumentRange;
8766 class PrettierEditProvider {
8767     constructor(_fileIsIgnored) {
8768         this._fileIsIgnored = _fileIsIgnored;
8769     }
8770     provideDocumentRangeFormattingEdits(document, range, _options, _token) {
8771         return this._provideEdits(document, {
8772             rangeStart: document.offsetAt(range.start),
8773             rangeEnd: document.offsetAt(range.end),
8774         });
8775     }
8776     provideDocumentFormattingEdits(document, _options, _token) {
8777         return this._provideEdits(document, {});
8778     }
8779     _provideEdits(document, options) {
8780         return __awaiter(this, void 0, void 0, function* () {
8781             let fileName = coc_nvim_1.Uri.parse(document.uri).fsPath;
8782             if (!document.uri.startsWith('untitled') && this._fileIsIgnored(fileName)) {
8783                 return Promise.resolve([]);
8784             }
8785             const code = yield format(document.getText(), document, options);
8786             const edits = [yield vscode_languageserver_protocol_1.TextEdit.replace(fullDocumentRange(document), code)];
8787             const { disableSuccessMessage } = utils_1.getConfig();
8788             if (edits && edits.length && !disableSuccessMessage) {
8789                 coc_nvim_1.workspace.showMessage('Formatted by prettier');
8790             }
8791             errorHandler_1.addToOutput(`Formatted file: ${document.uri}`);
8792             errorHandler_1.addToOutput(`Prettier format edits: ${JSON.stringify(edits, null, 2)}`);
8793             return edits;
8794         });
8795     }
8796 }
8797 exports.default = PrettierEditProvider;
8798
8799
8800 /***/ })
8801 /******/        ]);
8802 /************************************************************************/
8803 /******/        // The module cache
8804 /******/        var __webpack_module_cache__ = {};
8805 /******/        
8806 /******/        // The require function
8807 /******/        function __webpack_require__(moduleId) {
8808 /******/                // Check if module is in cache
8809 /******/                if(__webpack_module_cache__[moduleId]) {
8810 /******/                        return __webpack_module_cache__[moduleId].exports;
8811 /******/                }
8812 /******/                // Create a new module (and put it into the cache)
8813 /******/                var module = __webpack_module_cache__[moduleId] = {
8814 /******/                        // no module.id needed
8815 /******/                        // no module.loaded needed
8816 /******/                        exports: {}
8817 /******/                };
8818 /******/        
8819 /******/                // Execute the module function
8820 /******/                __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
8821 /******/        
8822 /******/                // Return the exports of the module
8823 /******/                return module.exports;
8824 /******/        }
8825 /******/        
8826 /************************************************************************/
8827 /******/        /* webpack/runtime/define property getters */
8828 /******/        (() => {
8829 /******/                // define getter functions for harmony exports
8830 /******/                __webpack_require__.d = (exports, definition) => {
8831 /******/                        for(var key in definition) {
8832 /******/                                if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
8833 /******/                                        Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
8834 /******/                                }
8835 /******/                        }
8836 /******/                };
8837 /******/        })();
8838 /******/        
8839 /******/        /* webpack/runtime/hasOwnProperty shorthand */
8840 /******/        (() => {
8841 /******/                __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
8842 /******/        })();
8843 /******/        
8844 /******/        /* webpack/runtime/make namespace object */
8845 /******/        (() => {
8846 /******/                // define __esModule on exports
8847 /******/                __webpack_require__.r = (exports) => {
8848 /******/                        if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
8849 /******/                                Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
8850 /******/                        }
8851 /******/                        Object.defineProperty(exports, '__esModule', { value: true });
8852 /******/                };
8853 /******/        })();
8854 /******/        
8855 /************************************************************************/
8856 /******/        // module exports must be returned from runtime so entry inlining is disabled
8857 /******/        // startup
8858 /******/        // Load entry module and return exports
8859 /******/        return __webpack_require__(0);
8860 /******/ })()
8861
8862 ));