From 5759cd1daa44d6500dd30d7b7d132a305fde7f8d Mon Sep 17 00:00:00 2001 From: Svetlozar Iliev Date: Wed, 1 May 2024 18:57:13 +0300 Subject: [PATCH 1/4] Make compile and build more robust, make error reporting more verbose, show quickfix list with the error entries --- src/standardLanguageClient.ts | 83 +++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/src/standardLanguageClient.ts b/src/standardLanguageClient.ts index 334ffe2..a1dce23 100644 --- a/src/standardLanguageClient.ts +++ b/src/standardLanguageClient.ts @@ -1,6 +1,6 @@ 'use strict' -import { CancellationToken, CodeActionKind, commands, ConfigurationTarget, DocumentSelector, Emitter, ExtensionContext, extensions, LanguageClient, LanguageClientOptions, languages, Location, Position, Range, services, StreamInfo, TextDocumentPositionParams, TextEditor, Uri, window, workspace } from "coc.nvim" +import { CancellationToken, CodeActionKind, commands, ConfigurationTarget, DocumentSelector, Emitter, ExtensionContext, extensions, LanguageClient, LanguageClientOptions, languages, Location, Position, Range, services, StreamInfo, TextDocumentPositionParams, TextEditor, Uri, window, nvim, workspace, diagnosticManager, DiagnosticSeverity } from "coc.nvim" import * as fse from 'fs-extra' import { findRuntimes } from "jdk-utils" import * as net from 'net' @@ -42,9 +42,9 @@ const AS_GRADLE_JVM = " as Gradle JVM" const UPGRADE_GRADLE = "Upgrade Gradle to " const GRADLE_IMPORT_JVM = "java.import.gradle.java.home" export const JAVA_SELECTOR: DocumentSelector = [ - { scheme: "file", language: "java", pattern: "**/*.java" }, - { scheme: "jdt", language: "java", pattern: "**/*.class" }, - { scheme: "untitled", language: "java", pattern: "**/*.java" } + { scheme: "file", language: "java", pattern: "**/*.java" }, + { scheme: "jdt", language: "java", pattern: "**/*.class" }, + { scheme: "untitled", language: "java", pattern: "**/*.java" } ] export class StandardLanguageClient { @@ -443,7 +443,6 @@ export class StandardLanguageClient { p.report({ message: 'Rebuilding projects...' }) return new Promise(async (resolve, reject) => { const start = new Date().getTime() - let res: CompileWorkspaceStatus try { res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) : @@ -457,6 +456,10 @@ export class StandardLanguageClient { const elapsed = new Date().getTime() - start const humanVisibleDelay = elapsed < 1000 ? 1000 : 0 + if (res == CompileWorkspaceStatus.withError) { + showCompileBuildDiagnostics() + window.showWarningMessage("Build finished with errors") + } setTimeout(() => { // set a timeout so user would still see the message when build time is short resolve() }, humanVisibleDelay) @@ -471,28 +474,29 @@ export class StandardLanguageClient { isFullCompile = selection !== 'Incremental' } p.report({ message: 'Compiling workspace...' }) - const start = new Date().getTime() - let res: CompileWorkspaceStatus - try { - res = token ? await this.languageClient.sendRequest(CompileWorkspaceRequest.type, isFullCompile, token) - : await this.languageClient.sendRequest(CompileWorkspaceRequest.type, isFullCompile) - } catch (error) { - if (error && error.code === -32800) { // Check if the request is cancelled. - res = CompileWorkspaceStatus.cancelled - } else { - throw error + return new Promise(async (resolve, reject) => { + const start = new Date().getTime() + let res: CompileWorkspaceStatus + try { + res = token ? await this.languageClient.sendRequest(CompileWorkspaceRequest.type, isFullCompile, token) + : await this.languageClient.sendRequest(CompileWorkspaceRequest.type, isFullCompile) + } catch (error) { + if (error && error.code === -32800) { // Check if the request is cancelled. + res = CompileWorkspaceStatus.cancelled + } else { + reject(error) + } } - } - const elapsed = new Date().getTime() - start - const humanVisibleDelay = elapsed < 1000 ? 1000 : 0 - return new Promise((resolve, reject) => { + const elapsed = new Date().getTime() - start + const humanVisibleDelay = elapsed < 1000 ? 1000 : 0 + + if (res == CompileWorkspaceStatus.withError) { + showCompileBuildDiagnostics() + window.showWarningMessage("Compilation finished with errors") + } setTimeout(() => { // set a timeout so user would still see the message when build time is short - if (res === CompileWorkspaceStatus.succeed) { - resolve(res) - } else { - reject(res) - } + resolve(res) }, humanVisibleDelay) }) }) @@ -656,6 +660,19 @@ async function showImportFinishNotification(context: ExtensionContext) { } } +async function showCompileBuildDiagnostics() { + const diagnostics = await diagnosticManager.getDiagnosticList() + const normalized = Uri.parse(workspace.getWorkspaceFolder(workspace.cwd).uri) + + const workingDirectoryList = diagnostics.filter(item => isParentFolder(normalized.fsPath, item.file)) + const errorDiagnostics = workingDirectoryList.filter(item => isErrorDiagnostic(item.level)) + const quickFixList = await workspace.getQuickfixList(errorDiagnostics.map(item => item.location)) + + await nvim.call('setqflist', [quickFixList]) + let openCommand = await nvim.getVar('coc_quickfix_open_command') as string + nvim.command(typeof openCommand === 'string' ? openCommand : 'copen', true) +} + function logNotification(message: string) { return new Promise(() => { createLogger().trace(message) @@ -700,6 +717,24 @@ function decodeBase64(text: string): string { return Buffer.from(text, 'base64').toString('ascii') } +function fileStartsWith(dir: string, pdir: string) { + return dir.toLowerCase().startsWith(pdir.toLowerCase()) +} + +function normalizeFilePath(filepath: string) { + return Uri.file(path.resolve(path.normalize(filepath))).fsPath +} + +function isErrorDiagnostic(level: number): boolean { + return level == DiagnosticSeverity.Error +} + +function isParentFolder(folder: string, filepath: string): boolean { + let pdir = normalizeFilePath(folder) + let dir = normalizeFilePath(filepath) + return fileStartsWith(dir, pdir) && dir[pdir.length] == path.sep +} + export function showNoLocationFound(message: string): void { window.showWarningMessage(message) } From 7741efb877bb9ddab5796878885b3b9fa55f8ea4 Mon Sep 17 00:00:00 2001 From: Svetlozar Iliev Date: Thu, 2 May 2024 07:52:50 +0300 Subject: [PATCH 2/4] Add manual clean up actions support. --- src/commands.ts | 4 ++++ src/protocol.ts | 4 ++++ src/sourceAction.ts | 13 +++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/commands.ts b/src/commands.ts index ce0db67..61b52f7 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -164,6 +164,10 @@ export namespace Commands { * Open settings.json */ export const OPEN_JSON_SETTINGS = 'workbench.action.openSettingsJson' + /** + * Manual action cleanup + */ + export const MANUAL_CLEANUP = "java.action.doCleanup"; /** * Organize imports. */ diff --git a/src/protocol.ts b/src/protocol.ts index c7720ad..d0ff7bf 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -223,6 +223,10 @@ export namespace GenerateHashCodeEqualsRequest { export const type = new RequestType('java/generateHashCodeEquals') } +export namespace CleanupRequest { + export const type = new RequestType('java/cleanup'); +} + export namespace OrganizeImportsRequest { export const type = new RequestType('java/organizeImports') } diff --git a/src/sourceAction.ts b/src/sourceAction.ts index bedc1a0..e75871d 100644 --- a/src/sourceAction.ts +++ b/src/sourceAction.ts @@ -1,14 +1,15 @@ 'use strict' -import { commands, Disposable, ExtensionContext, LanguageClient, Uri, window, workspace } from 'coc.nvim' +import { commands, Disposable, ExtensionContext, LanguageClient, TextDocumentIdentifier, Uri, window, workspace } from 'coc.nvim' import { CodeActionParams } from 'vscode-languageserver-protocol' import { Commands } from './commands' -import { AccessorCodeActionParams, AccessorCodeActionRequest, AccessorKind, AddOverridableMethodsRequest, CheckConstructorStatusRequest, CheckDelegateMethodsStatusRequest, CheckHashCodeEqualsStatusRequest, CheckToStringStatusRequest, GenerateAccessorsRequest, GenerateConstructorsRequest, GenerateDelegateMethodsRequest, GenerateHashCodeEqualsRequest, GenerateToStringRequest, ImportCandidate, ImportSelection, ListOverridableMethodsRequest, OrganizeImportsRequest, VariableBinding } from './protocol' +import { AccessorCodeActionParams, AccessorCodeActionRequest, AccessorKind, AddOverridableMethodsRequest, CheckConstructorStatusRequest, CheckDelegateMethodsStatusRequest, CheckHashCodeEqualsStatusRequest, CheckToStringStatusRequest, GenerateAccessorsRequest, GenerateConstructorsRequest, GenerateDelegateMethodsRequest, GenerateHashCodeEqualsRequest, GenerateToStringRequest, ImportCandidate, ImportSelection, ListOverridableMethodsRequest, CleanupRequest, OrganizeImportsRequest, VariableBinding } from './protocol' export function registerCommands(languageClient: LanguageClient, context: ExtensionContext) { registerOverrideMethodsCommand(languageClient, context) registerHashCodeEqualsCommand(languageClient, context) registerOrganizeImportsCommand(languageClient, context) + registerCleanupCommand(languageClient, context) registerChooseImportCommand(context) registerGenerateToStringCommand(languageClient, context) registerGenerateAccessorsCommand(languageClient, context) @@ -64,6 +65,14 @@ function registerOverrideMethodsCommand(languageClient: LanguageClient, context: }, null, true)) } +function registerCleanupCommand(languageClient: LanguageClient, context: ExtensionContext): void { + context.subscriptions.push(commands.registerCommand(Commands.MANUAL_CLEANUP, async () => { + const textDocument: TextDocumentIdentifier = TextDocumentIdentifier.create(window.activeTextEditor.document.uri) + const workspaceEdit = await languageClient.sendRequest(CleanupRequest.type, textDocument); + await workspace.applyEdit(workspaceEdit) + })); +} + function registerHashCodeEqualsCommand(languageClient: LanguageClient, context: ExtensionContext): void { context.subscriptions.push(commands.registerCommand(Commands.HASHCODE_EQUALS_PROMPT, async (params: CodeActionParams) => { const result = await languageClient.sendRequest(CheckHashCodeEqualsStatusRequest.type, params) From e50d1770ddb9c8d792c832df2e6e1ae8cb980826 Mon Sep 17 00:00:00 2001 From: Svetlozar Iliev Date: Thu, 2 May 2024 07:54:27 +0300 Subject: [PATCH 3/4] Add the details to the package json. --- package.json | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1119c1f..de2f3e3 100644 --- a/package.json +++ b/package.json @@ -939,9 +939,33 @@ "markdownDescription": "Specify how to enable the annotation-based null analysis.", "scope": "window" }, + "java.cleanup.actions": { + "type": "array", + "markdownDescription": "The list of clean ups to be run on the current document when it's saved or when the cleanup command is issued. Clean ups can automatically fix code style or programming mistakes.", + "items": { + "type": "string", + "enum": [ + "qualifyMembers", + "qualifyStaticMembers", + "addOverride", + "addDeprecated", + "stringConcatToTextBlock", + "invertEquals", + "addFinalModifier", + "instanceofPatternMatch", + "lambdaExpressionFromAnonymousClass", + "lambdaExpression", + "switchExpression", + "tryWithResource" + ] + }, + "default": [], + "scope": "window", + "order": 10 + }, "java.cleanup.actionsOnSave": { "type": "array", - "markdownDescription": "The list of clean ups to be run on the current document when it's saved. Clean ups can automatically fix code style or programming mistakes. Click [HERE](command:_java.learnMoreAboutCleanUps) to learn more about what each clean up does.", + "deprecationMessage": "Deprecated, please use 'java.cleanup.actions' instead.", "items": { "type": "string", "enum": [ @@ -953,6 +977,7 @@ "invertEquals", "addFinalModifier", "instanceofPatternMatch", + "lambdaExpressionFromAnonymousClass", "lambdaExpression", "switchExpression", "tryWithResource" @@ -961,6 +986,11 @@ "default": [], "scope": "window" }, + "java.saveActions.cleanup": { + "type": "boolean", + "default": true, + "description": "Enable/disable cleanup actions on save." + }, "java.sharedIndexes.enabled": { "type": "string", "enum": [ @@ -1079,6 +1109,11 @@ "title": "Show Type Hierarchy", "category": "Java" }, + { + "command": "java.action.doCleanup", + "title": "Manually apply cleanup actions", + "category": "Java" + }, { "command": "java.action.showClassHierarchy", "title": "Show Class Hierarchy", From e72617eb649ce44fdc23628459b379f312533ef7 Mon Sep 17 00:00:00 2001 From: Svetlozar Iliev Date: Thu, 2 May 2024 14:06:02 +0300 Subject: [PATCH 4/4] Build changes, migrate to using package lock --- .gitignore | 1 - .npmignore | 1 + lib/index.js | 30117 ++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 964 ++ yarn.lock | 495 - 5 files changed, 31082 insertions(+), 496 deletions(-) create mode 100644 lib/index.js create mode 100644 package-lock.json delete mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index 3063f07..3c3629e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -lib node_modules diff --git a/.npmignore b/.npmignore index 567a9cc..845916c 100644 --- a/.npmignore +++ b/.npmignore @@ -2,3 +2,4 @@ src tsconfig.json *.map yarn.lock +package-lock.json diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..23b0675 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,30117 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __esm = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; +}; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// node_modules/universalify/index.js +var require_universalify = __commonJS({ + "node_modules/universalify/index.js"(exports) { + "use strict"; + exports.fromCallback = function(fn) { + return Object.defineProperty(function() { + if (typeof arguments[arguments.length - 1] === "function") + fn.apply(this, arguments); + else { + return new Promise((resolve9, reject) => { + arguments[arguments.length] = (err, res) => { + if (err) + return reject(err); + resolve9(res); + }; + arguments.length++; + fn.apply(this, arguments); + }); + } + }, "name", { value: fn.name }); + }; + exports.fromPromise = function(fn) { + return Object.defineProperty(function() { + const cb = arguments[arguments.length - 1]; + if (typeof cb !== "function") + return fn.apply(this, arguments); + else + fn.apply(this, arguments).then((r) => cb(null, r), cb); + }, "name", { value: fn.name }); + }; + } +}); + +// node_modules/graceful-fs/polyfills.js +var require_polyfills = __commonJS({ + "node_modules/graceful-fs/polyfills.js"(exports, module2) { + var constants = require("constants"); + var origCwd = process.cwd; + var cwd = null; + var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform; + process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process); + return cwd; + }; + try { + process.cwd(); + } catch (er) { + } + if (typeof process.chdir === "function") { + chdir = process.chdir; + process.chdir = function(d) { + cwd = null; + chdir.call(process, d); + }; + if (Object.setPrototypeOf) + Object.setPrototypeOf(process.chdir, chdir); + } + var chdir; + module2.exports = patch; + function patch(fs6) { + if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs6); + } + if (!fs6.lutimes) { + patchLutimes(fs6); + } + fs6.chown = chownFix(fs6.chown); + fs6.fchown = chownFix(fs6.fchown); + fs6.lchown = chownFix(fs6.lchown); + fs6.chmod = chmodFix(fs6.chmod); + fs6.fchmod = chmodFix(fs6.fchmod); + fs6.lchmod = chmodFix(fs6.lchmod); + fs6.chownSync = chownFixSync(fs6.chownSync); + fs6.fchownSync = chownFixSync(fs6.fchownSync); + fs6.lchownSync = chownFixSync(fs6.lchownSync); + fs6.chmodSync = chmodFixSync(fs6.chmodSync); + fs6.fchmodSync = chmodFixSync(fs6.fchmodSync); + fs6.lchmodSync = chmodFixSync(fs6.lchmodSync); + fs6.stat = statFix(fs6.stat); + fs6.fstat = statFix(fs6.fstat); + fs6.lstat = statFix(fs6.lstat); + fs6.statSync = statFixSync(fs6.statSync); + fs6.fstatSync = statFixSync(fs6.fstatSync); + fs6.lstatSync = statFixSync(fs6.lstatSync); + if (fs6.chmod && !fs6.lchmod) { + fs6.lchmod = function(path18, mode, cb) { + if (cb) + process.nextTick(cb); + }; + fs6.lchmodSync = function() { + }; + } + if (fs6.chown && !fs6.lchown) { + fs6.lchown = function(path18, uid, gid, cb) { + if (cb) + process.nextTick(cb); + }; + fs6.lchownSync = function() { + }; + } + if (platform2 === "win32") { + fs6.rename = typeof fs6.rename !== "function" ? fs6.rename : function(fs$rename) { + function rename2(from, to, cb) { + var start = Date.now(); + var backoff = 0; + fs$rename(from, to, function CB(er) { + if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) { + setTimeout(function() { + fs6.stat(to, function(stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er); + }); + }, backoff); + if (backoff < 100) + backoff += 10; + return; + } + if (cb) + cb(er); + }); + } + if (Object.setPrototypeOf) + Object.setPrototypeOf(rename2, fs$rename); + return rename2; + }(fs6.rename); + } + fs6.read = typeof fs6.read !== "function" ? fs6.read : function(fs$read) { + function read(fd, buffer, offset, length, position, callback_) { + var callback; + if (callback_ && typeof callback_ === "function") { + var eagCounter = 0; + callback = function(er, _, __) { + if (er && er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + return fs$read.call(fs6, fd, buffer, offset, length, position, callback); + } + callback_.apply(this, arguments); + }; + } + return fs$read.call(fs6, fd, buffer, offset, length, position, callback); + } + if (Object.setPrototypeOf) + Object.setPrototypeOf(read, fs$read); + return read; + }(fs6.read); + fs6.readSync = typeof fs6.readSync !== "function" ? fs6.readSync : function(fs$readSync) { + return function(fd, buffer, offset, length, position) { + var eagCounter = 0; + while (true) { + try { + return fs$readSync.call(fs6, fd, buffer, offset, length, position); + } catch (er) { + if (er.code === "EAGAIN" && eagCounter < 10) { + eagCounter++; + continue; + } + throw er; + } + } + }; + }(fs6.readSync); + function patchLchmod(fs7) { + fs7.lchmod = function(path18, mode, callback) { + fs7.open( + path18, + constants.O_WRONLY | constants.O_SYMLINK, + mode, + function(err, fd) { + if (err) { + if (callback) + callback(err); + return; + } + fs7.fchmod(fd, mode, function(err2) { + fs7.close(fd, function(err22) { + if (callback) + callback(err2 || err22); + }); + }); + } + ); + }; + fs7.lchmodSync = function(path18, mode) { + var fd = fs7.openSync(path18, constants.O_WRONLY | constants.O_SYMLINK, mode); + var threw = true; + var ret; + try { + ret = fs7.fchmodSync(fd, mode); + threw = false; + } finally { + if (threw) { + try { + fs7.closeSync(fd); + } catch (er) { + } + } else { + fs7.closeSync(fd); + } + } + return ret; + }; + } + function patchLutimes(fs7) { + if (constants.hasOwnProperty("O_SYMLINK") && fs7.futimes) { + fs7.lutimes = function(path18, at, mt, cb) { + fs7.open(path18, constants.O_SYMLINK, function(er, fd) { + if (er) { + if (cb) + cb(er); + return; + } + fs7.futimes(fd, at, mt, function(er2) { + fs7.close(fd, function(er22) { + if (cb) + cb(er2 || er22); + }); + }); + }); + }; + fs7.lutimesSync = function(path18, at, mt) { + var fd = fs7.openSync(path18, constants.O_SYMLINK); + var ret; + var threw = true; + try { + ret = fs7.futimesSync(fd, at, mt); + threw = false; + } finally { + if (threw) { + try { + fs7.closeSync(fd); + } catch (er) { + } + } else { + fs7.closeSync(fd); + } + } + return ret; + }; + } else if (fs7.futimes) { + fs7.lutimes = function(_a, _b, _c, cb) { + if (cb) + process.nextTick(cb); + }; + fs7.lutimesSync = function() { + }; + } + } + function chmodFix(orig) { + if (!orig) + return orig; + return function(target, mode, cb) { + return orig.call(fs6, target, mode, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chmodFixSync(orig) { + if (!orig) + return orig; + return function(target, mode) { + try { + return orig.call(fs6, target, mode); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function chownFix(orig) { + if (!orig) + return orig; + return function(target, uid, gid, cb) { + return orig.call(fs6, target, uid, gid, function(er) { + if (chownErOk(er)) + er = null; + if (cb) + cb.apply(this, arguments); + }); + }; + } + function chownFixSync(orig) { + if (!orig) + return orig; + return function(target, uid, gid) { + try { + return orig.call(fs6, target, uid, gid); + } catch (er) { + if (!chownErOk(er)) + throw er; + } + }; + } + function statFix(orig) { + if (!orig) + return orig; + return function(target, options2, cb) { + if (typeof options2 === "function") { + cb = options2; + options2 = null; + } + function callback(er, stats) { + if (stats) { + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + } + if (cb) + cb.apply(this, arguments); + } + return options2 ? orig.call(fs6, target, options2, callback) : orig.call(fs6, target, callback); + }; + } + function statFixSync(orig) { + if (!orig) + return orig; + return function(target, options2) { + var stats = options2 ? orig.call(fs6, target, options2) : orig.call(fs6, target); + if (stats) { + if (stats.uid < 0) + stats.uid += 4294967296; + if (stats.gid < 0) + stats.gid += 4294967296; + } + return stats; + }; + } + function chownErOk(er) { + if (!er) + return true; + if (er.code === "ENOSYS") + return true; + var nonroot = !process.getuid || process.getuid() !== 0; + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true; + } + return false; + } + } + } +}); + +// node_modules/graceful-fs/legacy-streams.js +var require_legacy_streams = __commonJS({ + "node_modules/graceful-fs/legacy-streams.js"(exports, module2) { + var Stream = require("stream").Stream; + module2.exports = legacy; + function legacy(fs6) { + return { + ReadStream, + WriteStream + }; + function ReadStream(path18, options2) { + if (!(this instanceof ReadStream)) + return new ReadStream(path18, options2); + Stream.call(this); + var self2 = this; + this.path = path18; + this.fd = null; + this.readable = true; + this.paused = false; + this.flags = "r"; + this.mode = 438; + this.bufferSize = 64 * 1024; + options2 = options2 || {}; + var keys = Object.keys(options2); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options2[key]; + } + if (this.encoding) + this.setEncoding(this.encoding); + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); + } + if (this.end === void 0) { + this.end = Infinity; + } else if ("number" !== typeof this.end) { + throw TypeError("end must be a Number"); + } + if (this.start > this.end) { + throw new Error("start must be <= end"); + } + this.pos = this.start; + } + if (this.fd !== null) { + process.nextTick(function() { + self2._read(); + }); + return; + } + fs6.open(this.path, this.flags, this.mode, function(err, fd) { + if (err) { + self2.emit("error", err); + self2.readable = false; + return; + } + self2.fd = fd; + self2.emit("open", fd); + self2._read(); + }); + } + function WriteStream(path18, options2) { + if (!(this instanceof WriteStream)) + return new WriteStream(path18, options2); + Stream.call(this); + this.path = path18; + this.fd = null; + this.writable = true; + this.flags = "w"; + this.encoding = "binary"; + this.mode = 438; + this.bytesWritten = 0; + options2 = options2 || {}; + var keys = Object.keys(options2); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options2[key]; + } + if (this.start !== void 0) { + if ("number" !== typeof this.start) { + throw TypeError("start must be a Number"); + } + if (this.start < 0) { + throw new Error("start must be >= zero"); + } + this.pos = this.start; + } + this.busy = false; + this._queue = []; + if (this.fd === null) { + this._open = fs6.open; + this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); + this.flush(); + } + } + } + } +}); + +// node_modules/graceful-fs/clone.js +var require_clone = __commonJS({ + "node_modules/graceful-fs/clone.js"(exports, module2) { + "use strict"; + module2.exports = clone; + var getPrototypeOf = Object.getPrototypeOf || function(obj) { + return obj.__proto__; + }; + function clone(obj) { + if (obj === null || typeof obj !== "object") + return obj; + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) }; + else + var copy = /* @__PURE__ */ Object.create(null); + Object.getOwnPropertyNames(obj).forEach(function(key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); + }); + return copy; + } + } +}); + +// node_modules/graceful-fs/graceful-fs.js +var require_graceful_fs = __commonJS({ + "node_modules/graceful-fs/graceful-fs.js"(exports, module2) { + var fs6 = require("fs"); + var polyfills = require_polyfills(); + var legacy = require_legacy_streams(); + var clone = require_clone(); + var util = require("util"); + var gracefulQueue; + var previousSymbol; + if (typeof Symbol === "function" && typeof Symbol.for === "function") { + gracefulQueue = Symbol.for("graceful-fs.queue"); + previousSymbol = Symbol.for("graceful-fs.previous"); + } else { + gracefulQueue = "___graceful-fs.queue"; + previousSymbol = "___graceful-fs.previous"; + } + function noop() { + } + function publishQueue(context, queue2) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue2; + } + }); + } + var debug = noop; + if (util.debuglog) + debug = util.debuglog("gfs4"); + else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) + debug = function() { + var m = util.format.apply(util, arguments); + m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); + console.error(m); + }; + if (!fs6[gracefulQueue]) { + queue = global[gracefulQueue] || []; + publishQueue(fs6, queue); + fs6.close = function(fs$close) { + function close(fd, cb) { + return fs$close.call(fs6, fd, function(err) { + if (!err) { + resetQueue(); + } + if (typeof cb === "function") + cb.apply(this, arguments); + }); + } + Object.defineProperty(close, previousSymbol, { + value: fs$close + }); + return close; + }(fs6.close); + fs6.closeSync = function(fs$closeSync) { + function closeSync3(fd) { + fs$closeSync.apply(fs6, arguments); + resetQueue(); + } + Object.defineProperty(closeSync3, previousSymbol, { + value: fs$closeSync + }); + return closeSync3; + }(fs6.closeSync); + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { + process.on("exit", function() { + debug(fs6[gracefulQueue]); + require("assert").equal(fs6[gracefulQueue].length, 0); + }); + } + } + var queue; + if (!global[gracefulQueue]) { + publishQueue(global, fs6[gracefulQueue]); + } + module2.exports = patch(clone(fs6)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs6.__patched) { + module2.exports = patch(fs6); + fs6.__patched = true; + } + function patch(fs7) { + polyfills(fs7); + fs7.gracefulify = patch; + fs7.createReadStream = createReadStream2; + fs7.createWriteStream = createWriteStream2; + var fs$readFile = fs7.readFile; + fs7.readFile = readFile3; + function readFile3(path18, options2, cb) { + if (typeof options2 === "function") + cb = options2, options2 = null; + return go$readFile(path18, options2, cb); + function go$readFile(path19, options3, cb2, startTime) { + return fs$readFile(path19, options3, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$readFile, [path19, options3, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$writeFile = fs7.writeFile; + fs7.writeFile = writeFile2; + function writeFile2(path18, data, options2, cb) { + if (typeof options2 === "function") + cb = options2, options2 = null; + return go$writeFile(path18, data, options2, cb); + function go$writeFile(path19, data2, options3, cb2, startTime) { + return fs$writeFile(path19, data2, options3, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$writeFile, [path19, data2, options3, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$appendFile = fs7.appendFile; + if (fs$appendFile) + fs7.appendFile = appendFile2; + function appendFile2(path18, data, options2, cb) { + if (typeof options2 === "function") + cb = options2, options2 = null; + return go$appendFile(path18, data, options2, cb); + function go$appendFile(path19, data2, options3, cb2, startTime) { + return fs$appendFile(path19, data2, options3, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$appendFile, [path19, data2, options3, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$copyFile = fs7.copyFile; + if (fs$copyFile) + fs7.copyFile = copyFile; + function copyFile(src, dest, flags, cb) { + if (typeof flags === "function") { + cb = flags; + flags = 0; + } + return go$copyFile(src, dest, flags, cb); + function go$copyFile(src2, dest2, flags2, cb2, startTime) { + return fs$copyFile(src2, dest2, flags2, function(err) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + var fs$readdir = fs7.readdir; + fs7.readdir = readdir; + var noReaddirOptionVersions = /^v[0-5]\./; + function readdir(path18, options2, cb) { + if (typeof options2 === "function") + cb = options2, options2 = null; + var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path19, options3, cb2, startTime) { + return fs$readdir(path19, fs$readdirCallback( + path19, + options3, + cb2, + startTime + )); + } : function go$readdir2(path19, options3, cb2, startTime) { + return fs$readdir(path19, options3, fs$readdirCallback( + path19, + options3, + cb2, + startTime + )); + }; + return go$readdir(path18, options2, cb); + function fs$readdirCallback(path19, options3, cb2, startTime) { + return function(err, files) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([ + go$readdir, + [path19, options3, cb2], + err, + startTime || Date.now(), + Date.now() + ]); + else { + if (files && files.sort) + files.sort(); + if (typeof cb2 === "function") + cb2.call(this, err, files); + } + }; + } + } + if (process.version.substr(0, 4) === "v0.8") { + var legStreams = legacy(fs7); + ReadStream = legStreams.ReadStream; + WriteStream = legStreams.WriteStream; + } + var fs$ReadStream = fs7.ReadStream; + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype); + ReadStream.prototype.open = ReadStream$open; + } + var fs$WriteStream = fs7.WriteStream; + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype); + WriteStream.prototype.open = WriteStream$open; + } + Object.defineProperty(fs7, "ReadStream", { + get: function() { + return ReadStream; + }, + set: function(val) { + ReadStream = val; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(fs7, "WriteStream", { + get: function() { + return WriteStream; + }, + set: function(val) { + WriteStream = val; + }, + enumerable: true, + configurable: true + }); + var FileReadStream = ReadStream; + Object.defineProperty(fs7, "FileReadStream", { + get: function() { + return FileReadStream; + }, + set: function(val) { + FileReadStream = val; + }, + enumerable: true, + configurable: true + }); + var FileWriteStream = WriteStream; + Object.defineProperty(fs7, "FileWriteStream", { + get: function() { + return FileWriteStream; + }, + set: function(val) { + FileWriteStream = val; + }, + enumerable: true, + configurable: true + }); + function ReadStream(path18, options2) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this; + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments); + } + function ReadStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + if (that.autoClose) + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + that.read(); + } + }); + } + function WriteStream(path18, options2) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this; + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments); + } + function WriteStream$open() { + var that = this; + open(that.path, that.flags, that.mode, function(err, fd) { + if (err) { + that.destroy(); + that.emit("error", err); + } else { + that.fd = fd; + that.emit("open", fd); + } + }); + } + function createReadStream2(path18, options2) { + return new fs7.ReadStream(path18, options2); + } + function createWriteStream2(path18, options2) { + return new fs7.WriteStream(path18, options2); + } + var fs$open = fs7.open; + fs7.open = open; + function open(path18, flags, mode, cb) { + if (typeof mode === "function") + cb = mode, mode = null; + return go$open(path18, flags, mode, cb); + function go$open(path19, flags2, mode2, cb2, startTime) { + return fs$open(path19, flags2, mode2, function(err, fd) { + if (err && (err.code === "EMFILE" || err.code === "ENFILE")) + enqueue([go$open, [path19, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]); + else { + if (typeof cb2 === "function") + cb2.apply(this, arguments); + } + }); + } + } + return fs7; + } + function enqueue(elem) { + debug("ENQUEUE", elem[0].name, elem[1]); + fs6[gracefulQueue].push(elem); + retry(); + } + var retryTimer; + function resetQueue() { + var now = Date.now(); + for (var i = 0; i < fs6[gracefulQueue].length; ++i) { + if (fs6[gracefulQueue][i].length > 2) { + fs6[gracefulQueue][i][3] = now; + fs6[gracefulQueue][i][4] = now; + } + } + retry(); + } + function retry() { + clearTimeout(retryTimer); + retryTimer = void 0; + if (fs6[gracefulQueue].length === 0) + return; + var elem = fs6[gracefulQueue].shift(); + var fn = elem[0]; + var args = elem[1]; + var err = elem[2]; + var startTime = elem[3]; + var lastTime = elem[4]; + if (startTime === void 0) { + debug("RETRY", fn.name, args); + fn.apply(null, args); + } else if (Date.now() - startTime >= 6e4) { + debug("TIMEOUT", fn.name, args); + var cb = args.pop(); + if (typeof cb === "function") + cb.call(null, err); + } else { + var sinceAttempt = Date.now() - lastTime; + var sinceStart = Math.max(lastTime - startTime, 1); + var desiredDelay = Math.min(sinceStart * 1.2, 100); + if (sinceAttempt >= desiredDelay) { + debug("RETRY", fn.name, args); + fn.apply(null, args.concat([startTime])); + } else { + fs6[gracefulQueue].push(elem); + } + } + if (retryTimer === void 0) { + retryTimer = setTimeout(retry, 0); + } + } + } +}); + +// node_modules/fs-extra/lib/fs/index.js +var require_fs = __commonJS({ + "node_modules/fs-extra/lib/fs/index.js"(exports) { + "use strict"; + var u = require_universalify().fromCallback; + var fs6 = require_graceful_fs(); + var api = [ + "access", + "appendFile", + "chmod", + "chown", + "close", + "copyFile", + "fchmod", + "fchown", + "fdatasync", + "fstat", + "fsync", + "ftruncate", + "futimes", + "lchown", + "lchmod", + "link", + "lstat", + "mkdir", + "mkdtemp", + "open", + "readFile", + "readdir", + "readlink", + "realpath", + "rename", + "rmdir", + "stat", + "symlink", + "truncate", + "unlink", + "utimes", + "writeFile" + ].filter((key) => { + return typeof fs6[key] === "function"; + }); + Object.keys(fs6).forEach((key) => { + if (key === "promises") { + return; + } + exports[key] = fs6[key]; + }); + api.forEach((method) => { + exports[method] = u(fs6[method]); + }); + exports.exists = function(filename, callback) { + if (typeof callback === "function") { + return fs6.exists(filename, callback); + } + return new Promise((resolve9) => { + return fs6.exists(filename, resolve9); + }); + }; + exports.read = function(fd, buffer, offset, length, position, callback) { + if (typeof callback === "function") { + return fs6.read(fd, buffer, offset, length, position, callback); + } + return new Promise((resolve9, reject) => { + fs6.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => { + if (err) + return reject(err); + resolve9({ bytesRead, buffer: buffer2 }); + }); + }); + }; + exports.write = function(fd, buffer, ...args) { + if (typeof args[args.length - 1] === "function") { + return fs6.write(fd, buffer, ...args); + } + return new Promise((resolve9, reject) => { + fs6.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => { + if (err) + return reject(err); + resolve9({ bytesWritten, buffer: buffer2 }); + }); + }); + }; + if (typeof fs6.realpath.native === "function") { + exports.realpath.native = u(fs6.realpath.native); + } + } +}); + +// node_modules/fs-extra/lib/mkdirs/win32.js +var require_win32 = __commonJS({ + "node_modules/fs-extra/lib/mkdirs/win32.js"(exports, module2) { + "use strict"; + var path18 = require("path"); + function getRootPath(p) { + p = path18.normalize(path18.resolve(p)).split(path18.sep); + if (p.length > 0) + return p[0]; + return null; + } + var INVALID_PATH_CHARS = /[<>:"|?*]/; + function invalidWin32Path(p) { + const rp = getRootPath(p); + p = p.replace(rp, ""); + return INVALID_PATH_CHARS.test(p); + } + module2.exports = { + getRootPath, + invalidWin32Path + }; + } +}); + +// node_modules/fs-extra/lib/mkdirs/mkdirs.js +var require_mkdirs = __commonJS({ + "node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var invalidWin32Path = require_win32().invalidWin32Path; + var o777 = parseInt("0777", 8); + function mkdirs(p, opts, callback, made) { + if (typeof opts === "function") { + callback = opts; + opts = {}; + } else if (!opts || typeof opts !== "object") { + opts = { mode: opts }; + } + if (process.platform === "win32" && invalidWin32Path(p)) { + const errInval = new Error(p + " contains invalid WIN32 path characters."); + errInval.code = "EINVAL"; + return callback(errInval); + } + let mode = opts.mode; + const xfs = opts.fs || fs6; + if (mode === void 0) { + mode = o777 & ~process.umask(); + } + if (!made) + made = null; + callback = callback || function() { + }; + p = path18.resolve(p); + xfs.mkdir(p, mode, (er) => { + if (!er) { + made = made || p; + return callback(null, made); + } + switch (er.code) { + case "ENOENT": + if (path18.dirname(p) === p) + return callback(er); + mkdirs(path18.dirname(p), opts, (er2, made2) => { + if (er2) + callback(er2, made2); + else + mkdirs(p, opts, callback, made2); + }); + break; + default: + xfs.stat(p, (er2, stat2) => { + if (er2 || !stat2.isDirectory()) + callback(er, made); + else + callback(null, made); + }); + break; + } + }); + } + module2.exports = mkdirs; + } +}); + +// node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js +var require_mkdirs_sync = __commonJS({ + "node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var invalidWin32Path = require_win32().invalidWin32Path; + var o777 = parseInt("0777", 8); + function mkdirsSync(p, opts, made) { + if (!opts || typeof opts !== "object") { + opts = { mode: opts }; + } + let mode = opts.mode; + const xfs = opts.fs || fs6; + if (process.platform === "win32" && invalidWin32Path(p)) { + const errInval = new Error(p + " contains invalid WIN32 path characters."); + errInval.code = "EINVAL"; + throw errInval; + } + if (mode === void 0) { + mode = o777 & ~process.umask(); + } + if (!made) + made = null; + p = path18.resolve(p); + try { + xfs.mkdirSync(p, mode); + made = made || p; + } catch (err0) { + if (err0.code === "ENOENT") { + if (path18.dirname(p) === p) + throw err0; + made = mkdirsSync(path18.dirname(p), opts, made); + mkdirsSync(p, opts, made); + } else { + let stat2; + try { + stat2 = xfs.statSync(p); + } catch (err1) { + throw err0; + } + if (!stat2.isDirectory()) + throw err0; + } + } + return made; + } + module2.exports = mkdirsSync; + } +}); + +// node_modules/fs-extra/lib/mkdirs/index.js +var require_mkdirs2 = __commonJS({ + "node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var mkdirs = u(require_mkdirs()); + var mkdirsSync = require_mkdirs_sync(); + module2.exports = { + mkdirs, + mkdirsSync, + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync + }; + } +}); + +// node_modules/fs-extra/lib/util/utimes.js +var require_utimes = __commonJS({ + "node_modules/fs-extra/lib/util/utimes.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var os4 = require("os"); + var path18 = require("path"); + function hasMillisResSync() { + let tmpfile = path18.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2)); + tmpfile = path18.join(os4.tmpdir(), tmpfile); + const d = new Date(1435410243862); + fs6.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141"); + const fd = fs6.openSync(tmpfile, "r+"); + fs6.futimesSync(fd, d, d); + fs6.closeSync(fd); + return fs6.statSync(tmpfile).mtime > 1435410243e3; + } + function hasMillisRes(callback) { + let tmpfile = path18.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2)); + tmpfile = path18.join(os4.tmpdir(), tmpfile); + const d = new Date(1435410243862); + fs6.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => { + if (err) + return callback(err); + fs6.open(tmpfile, "r+", (err2, fd) => { + if (err2) + return callback(err2); + fs6.futimes(fd, d, d, (err3) => { + if (err3) + return callback(err3); + fs6.close(fd, (err4) => { + if (err4) + return callback(err4); + fs6.stat(tmpfile, (err5, stats) => { + if (err5) + return callback(err5); + callback(null, stats.mtime > 1435410243e3); + }); + }); + }); + }); + }); + } + function timeRemoveMillis(timestamp) { + if (typeof timestamp === "number") { + return Math.floor(timestamp / 1e3) * 1e3; + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1e3) * 1e3); + } else { + throw new Error("fs-extra: timeRemoveMillis() unknown parameter type"); + } + } + function utimesMillis(path19, atime, mtime, callback) { + fs6.open(path19, "r+", (err, fd) => { + if (err) + return callback(err); + fs6.futimes(fd, atime, mtime, (futimesErr) => { + fs6.close(fd, (closeErr) => { + if (callback) + callback(futimesErr || closeErr); + }); + }); + }); + } + function utimesMillisSync(path19, atime, mtime) { + const fd = fs6.openSync(path19, "r+"); + fs6.futimesSync(fd, atime, mtime); + return fs6.closeSync(fd); + } + module2.exports = { + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync + }; + } +}); + +// node_modules/fs-extra/lib/util/stat.js +var require_stat = __commonJS({ + "node_modules/fs-extra/lib/util/stat.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var NODE_VERSION_MAJOR_WITH_BIGINT = 10; + var NODE_VERSION_MINOR_WITH_BIGINT = 5; + var NODE_VERSION_PATCH_WITH_BIGINT = 0; + var nodeVersion = process.versions.node.split("."); + var nodeVersionMajor = Number.parseInt(nodeVersion[0], 10); + var nodeVersionMinor = Number.parseInt(nodeVersion[1], 10); + var nodeVersionPatch = Number.parseInt(nodeVersion[2], 10); + function nodeSupportsBigInt() { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true; + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true; + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true; + } + } + } + return false; + } + function getStats(src, dest, cb) { + if (nodeSupportsBigInt()) { + fs6.stat(src, { bigint: true }, (err, srcStat) => { + if (err) + return cb(err); + fs6.stat(dest, { bigint: true }, (err2, destStat) => { + if (err2) { + if (err2.code === "ENOENT") + return cb(null, { srcStat, destStat: null }); + return cb(err2); + } + return cb(null, { srcStat, destStat }); + }); + }); + } else { + fs6.stat(src, (err, srcStat) => { + if (err) + return cb(err); + fs6.stat(dest, (err2, destStat) => { + if (err2) { + if (err2.code === "ENOENT") + return cb(null, { srcStat, destStat: null }); + return cb(err2); + } + return cb(null, { srcStat, destStat }); + }); + }); + } + } + function getStatsSync(src, dest) { + let srcStat, destStat; + if (nodeSupportsBigInt()) { + srcStat = fs6.statSync(src, { bigint: true }); + } else { + srcStat = fs6.statSync(src); + } + try { + if (nodeSupportsBigInt()) { + destStat = fs6.statSync(dest, { bigint: true }); + } else { + destStat = fs6.statSync(dest); + } + } catch (err) { + if (err.code === "ENOENT") + return { srcStat, destStat: null }; + throw err; + } + return { srcStat, destStat }; + } + function checkPaths(src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { + if (err) + return cb(err); + const { srcStat, destStat } = stats; + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error("Source and destination must not be the same.")); + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); + } + return cb(null, { srcStat, destStat }); + }); + } + function checkPathsSync(src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest); + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error("Source and destination must not be the same."); + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; + } + function checkParentPaths(src, srcStat, dest, funcName, cb) { + const srcParent = path18.resolve(path18.dirname(src)); + const destParent = path18.resolve(path18.dirname(dest)); + if (destParent === srcParent || destParent === path18.parse(destParent).root) + return cb(); + if (nodeSupportsBigInt()) { + fs6.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === "ENOENT") + return cb(); + return cb(err); + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))); + } + return checkParentPaths(src, srcStat, destParent, funcName, cb); + }); + } else { + fs6.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === "ENOENT") + return cb(); + return cb(err); + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))); + } + return checkParentPaths(src, srcStat, destParent, funcName, cb); + }); + } + } + function checkParentPathsSync(src, srcStat, dest, funcName) { + const srcParent = path18.resolve(path18.dirname(src)); + const destParent = path18.resolve(path18.dirname(dest)); + if (destParent === srcParent || destParent === path18.parse(destParent).root) + return; + let destStat; + try { + if (nodeSupportsBigInt()) { + destStat = fs6.statSync(destParent, { bigint: true }); + } else { + destStat = fs6.statSync(destParent); + } + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPathsSync(src, srcStat, destParent, funcName); + } + function isSrcSubdir(src, dest) { + const srcArr = path18.resolve(src).split(path18.sep).filter((i) => i); + const destArr = path18.resolve(dest).split(path18.sep).filter((i) => i); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + } + function errMsg(src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; + } + module2.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir + }; + } +}); + +// node_modules/fs-extra/lib/util/buffer.js +var require_buffer = __commonJS({ + "node_modules/fs-extra/lib/util/buffer.js"(exports, module2) { + "use strict"; + module2.exports = function(size) { + if (typeof Buffer.allocUnsafe === "function") { + try { + return Buffer.allocUnsafe(size); + } catch (e) { + return new Buffer(size); + } + } + return new Buffer(size); + }; + } +}); + +// node_modules/fs-extra/lib/copy-sync/copy-sync.js +var require_copy_sync = __commonJS({ + "node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var mkdirpSync = require_mkdirs2().mkdirsSync; + var utimesSync = require_utimes().utimesMillisSync; + var stat2 = require_stat(); + function copySync(src, dest, opts) { + if (typeof opts === "function") { + opts = { filter: opts }; + } + opts = opts || {}; + opts.clobber = "clobber" in opts ? !!opts.clobber : true; + opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; + if (opts.preserveTimestamps && process.arch === "ia32") { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended; + + see https://github.com/jprichardson/node-fs-extra/issues/269`); + } + const { srcStat, destStat } = stat2.checkPathsSync(src, dest, "copy"); + stat2.checkParentPathsSync(src, srcStat, dest, "copy"); + return handleFilterAndCopy(destStat, src, dest, opts); + } + function handleFilterAndCopy(destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) + return; + const destParent = path18.dirname(dest); + if (!fs6.existsSync(destParent)) + mkdirpSync(destParent); + return startCopy(destStat, src, dest, opts); + } + function startCopy(destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) + return; + return getStats(destStat, src, dest, opts); + } + function getStats(destStat, src, dest, opts) { + const statSync3 = opts.dereference ? fs6.statSync : fs6.lstatSync; + const srcStat = statSync3(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + else if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + } + function onFile(srcStat, destStat, src, dest, opts) { + if (!destStat) + return copyFile(srcStat, src, dest, opts); + return mayCopyFile(srcStat, src, dest, opts); + } + function mayCopyFile(srcStat, src, dest, opts) { + if (opts.overwrite) { + fs6.unlinkSync(dest); + return copyFile(srcStat, src, dest, opts); + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } + } + function copyFile(srcStat, src, dest, opts) { + if (typeof fs6.copyFileSync === "function") { + fs6.copyFileSync(src, dest); + fs6.chmodSync(dest, srcStat.mode); + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime); + } + return; + } + return copyFileFallback(srcStat, src, dest, opts); + } + function copyFileFallback(srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024; + const _buff = require_buffer()(BUF_LENGTH); + const fdr = fs6.openSync(src, "r"); + const fdw = fs6.openSync(dest, "w", srcStat.mode); + let pos = 0; + while (pos < srcStat.size) { + const bytesRead = fs6.readSync(fdr, _buff, 0, BUF_LENGTH, pos); + fs6.writeSync(fdw, _buff, 0, bytesRead); + pos += bytesRead; + } + if (opts.preserveTimestamps) + fs6.futimesSync(fdw, srcStat.atime, srcStat.mtime); + fs6.closeSync(fdr); + fs6.closeSync(fdw); + } + function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) + return mkDirAndCopy(srcStat, src, dest, opts); + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); + } + return copyDir(src, dest, opts); + } + function mkDirAndCopy(srcStat, src, dest, opts) { + fs6.mkdirSync(dest); + copyDir(src, dest, opts); + return fs6.chmodSync(dest, srcStat.mode); + } + function copyDir(src, dest, opts) { + fs6.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts)); + } + function copyDirItem(item, src, dest, opts) { + const srcItem = path18.join(src, item); + const destItem = path18.join(dest, item); + const { destStat } = stat2.checkPathsSync(srcItem, destItem, "copy"); + return startCopy(destStat, srcItem, destItem, opts); + } + function onLink(destStat, src, dest, opts) { + let resolvedSrc = fs6.readlinkSync(src); + if (opts.dereference) { + resolvedSrc = path18.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs6.symlinkSync(resolvedSrc, dest); + } else { + let resolvedDest; + try { + resolvedDest = fs6.readlinkSync(dest); + } catch (err) { + if (err.code === "EINVAL" || err.code === "UNKNOWN") + return fs6.symlinkSync(resolvedSrc, dest); + throw err; + } + if (opts.dereference) { + resolvedDest = path18.resolve(process.cwd(), resolvedDest); + } + if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (fs6.statSync(dest).isDirectory() && stat2.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + return copyLink(resolvedSrc, dest); + } + } + function copyLink(resolvedSrc, dest) { + fs6.unlinkSync(dest); + return fs6.symlinkSync(resolvedSrc, dest); + } + module2.exports = copySync; + } +}); + +// node_modules/fs-extra/lib/copy-sync/index.js +var require_copy_sync2 = __commonJS({ + "node_modules/fs-extra/lib/copy-sync/index.js"(exports, module2) { + "use strict"; + module2.exports = { + copySync: require_copy_sync() + }; + } +}); + +// node_modules/fs-extra/lib/path-exists/index.js +var require_path_exists = __commonJS({ + "node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromPromise; + var fs6 = require_fs(); + function pathExists7(path18) { + return fs6.access(path18).then(() => true).catch(() => false); + } + module2.exports = { + pathExists: u(pathExists7), + pathExistsSync: fs6.existsSync + }; + } +}); + +// node_modules/fs-extra/lib/copy/copy.js +var require_copy = __commonJS({ + "node_modules/fs-extra/lib/copy/copy.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var mkdirp = require_mkdirs2().mkdirs; + var pathExists7 = require_path_exists().pathExists; + var utimes = require_utimes().utimesMillis; + var stat2 = require_stat(); + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else if (typeof opts === "function") { + opts = { filter: opts }; + } + cb = cb || function() { + }; + opts = opts || {}; + opts.clobber = "clobber" in opts ? !!opts.clobber : true; + opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; + if (opts.preserveTimestamps && process.arch === "ia32") { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended; + + see https://github.com/jprichardson/node-fs-extra/issues/269`); + } + stat2.checkPaths(src, dest, "copy", (err, stats) => { + if (err) + return cb(err); + const { srcStat, destStat } = stats; + stat2.checkParentPaths(src, srcStat, dest, "copy", (err2) => { + if (err2) + return cb(err2); + if (opts.filter) + return handleFilter(checkParentDir, destStat, src, dest, opts, cb); + return checkParentDir(destStat, src, dest, opts, cb); + }); + }); + } + function checkParentDir(destStat, src, dest, opts, cb) { + const destParent = path18.dirname(dest); + pathExists7(destParent, (err, dirExists) => { + if (err) + return cb(err); + if (dirExists) + return startCopy(destStat, src, dest, opts, cb); + mkdirp(destParent, (err2) => { + if (err2) + return cb(err2); + return startCopy(destStat, src, dest, opts, cb); + }); + }); + } + function handleFilter(onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then((include) => { + if (include) + return onInclude(destStat, src, dest, opts, cb); + return cb(); + }, (error) => cb(error)); + } + function startCopy(destStat, src, dest, opts, cb) { + if (opts.filter) + return handleFilter(getStats, destStat, src, dest, opts, cb); + return getStats(destStat, src, dest, opts, cb); + } + function getStats(destStat, src, dest, opts, cb) { + const stat3 = opts.dereference ? fs6.stat : fs6.lstat; + stat3(src, (err, srcStat) => { + if (err) + return cb(err); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts, cb); + else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts, cb); + else if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts, cb); + }); + } + function onFile(srcStat, destStat, src, dest, opts, cb) { + if (!destStat) + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs6.unlink(dest, (err) => { + if (err) + return cb(err); + return copyFile(srcStat, src, dest, opts, cb); + }); + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)); + } else + return cb(); + } + function copyFile(srcStat, src, dest, opts, cb) { + if (typeof fs6.copyFile === "function") { + return fs6.copyFile(src, dest, (err) => { + if (err) + return cb(err); + return setDestModeAndTimestamps(srcStat, dest, opts, cb); + }); + } + return copyFileFallback(srcStat, src, dest, opts, cb); + } + function copyFileFallback(srcStat, src, dest, opts, cb) { + const rs = fs6.createReadStream(src); + rs.on("error", (err) => cb(err)).once("open", () => { + const ws = fs6.createWriteStream(dest, { mode: srcStat.mode }); + ws.on("error", (err) => cb(err)).on("open", () => rs.pipe(ws)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb)); + }); + } + function setDestModeAndTimestamps(srcStat, dest, opts, cb) { + fs6.chmod(dest, srcStat.mode, (err) => { + if (err) + return cb(err); + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb); + } + return cb(); + }); + } + function onDir(srcStat, destStat, src, dest, opts, cb) { + if (!destStat) + return mkDirAndCopy(srcStat, src, dest, opts, cb); + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); + } + return copyDir(src, dest, opts, cb); + } + function mkDirAndCopy(srcStat, src, dest, opts, cb) { + fs6.mkdir(dest, (err) => { + if (err) + return cb(err); + copyDir(src, dest, opts, (err2) => { + if (err2) + return cb(err2); + return fs6.chmod(dest, srcStat.mode, cb); + }); + }); + } + function copyDir(src, dest, opts, cb) { + fs6.readdir(src, (err, items) => { + if (err) + return cb(err); + return copyDirItems(items, src, dest, opts, cb); + }); + } + function copyDirItems(items, src, dest, opts, cb) { + const item = items.pop(); + if (!item) + return cb(); + return copyDirItem(items, item, src, dest, opts, cb); + } + function copyDirItem(items, item, src, dest, opts, cb) { + const srcItem = path18.join(src, item); + const destItem = path18.join(dest, item); + stat2.checkPaths(srcItem, destItem, "copy", (err, stats) => { + if (err) + return cb(err); + const { destStat } = stats; + startCopy(destStat, srcItem, destItem, opts, (err2) => { + if (err2) + return cb(err2); + return copyDirItems(items, src, dest, opts, cb); + }); + }); + } + function onLink(destStat, src, dest, opts, cb) { + fs6.readlink(src, (err, resolvedSrc) => { + if (err) + return cb(err); + if (opts.dereference) { + resolvedSrc = path18.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs6.symlink(resolvedSrc, dest, cb); + } else { + fs6.readlink(dest, (err2, resolvedDest) => { + if (err2) { + if (err2.code === "EINVAL" || err2.code === "UNKNOWN") + return fs6.symlink(resolvedSrc, dest, cb); + return cb(err2); + } + if (opts.dereference) { + resolvedDest = path18.resolve(process.cwd(), resolvedDest); + } + if (stat2.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); + } + if (destStat.isDirectory() && stat2.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); + } + return copyLink(resolvedSrc, dest, cb); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs6.unlink(dest, (err) => { + if (err) + return cb(err); + return fs6.symlink(resolvedSrc, dest, cb); + }); + } + module2.exports = copy; + } +}); + +// node_modules/fs-extra/lib/copy/index.js +var require_copy2 = __commonJS({ + "node_modules/fs-extra/lib/copy/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + module2.exports = { + copy: u(require_copy()) + }; + } +}); + +// node_modules/fs-extra/lib/remove/rimraf.js +var require_rimraf = __commonJS({ + "node_modules/fs-extra/lib/remove/rimraf.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var assert = require("assert"); + var isWindows = process.platform === "win32"; + function defaults2(options2) { + const methods = [ + "unlink", + "chmod", + "stat", + "lstat", + "rmdir", + "readdir" + ]; + methods.forEach((m) => { + options2[m] = options2[m] || fs6[m]; + m = m + "Sync"; + options2[m] = options2[m] || fs6[m]; + }); + options2.maxBusyTries = options2.maxBusyTries || 3; + } + function rimraf(p, options2, cb) { + let busyTries = 0; + if (typeof options2 === "function") { + cb = options2; + options2 = {}; + } + assert(p, "rimraf: missing path"); + assert.strictEqual(typeof p, "string", "rimraf: path should be a string"); + assert.strictEqual(typeof cb, "function", "rimraf: callback function required"); + assert(options2, "rimraf: invalid options argument provided"); + assert.strictEqual(typeof options2, "object", "rimraf: options should be object"); + defaults2(options2); + rimraf_(p, options2, function CB(er) { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options2.maxBusyTries) { + busyTries++; + const time = busyTries * 100; + return setTimeout(() => rimraf_(p, options2, CB), time); + } + if (er.code === "ENOENT") + er = null; + } + cb(er); + }); + } + function rimraf_(p, options2, cb) { + assert(p); + assert(options2); + assert(typeof cb === "function"); + options2.lstat(p, (er, st) => { + if (er && er.code === "ENOENT") { + return cb(null); + } + if (er && er.code === "EPERM" && isWindows) { + return fixWinEPERM(p, options2, er, cb); + } + if (st && st.isDirectory()) { + return rmdir(p, options2, er, cb); + } + options2.unlink(p, (er2) => { + if (er2) { + if (er2.code === "ENOENT") { + return cb(null); + } + if (er2.code === "EPERM") { + return isWindows ? fixWinEPERM(p, options2, er2, cb) : rmdir(p, options2, er2, cb); + } + if (er2.code === "EISDIR") { + return rmdir(p, options2, er2, cb); + } + } + return cb(er2); + }); + }); + } + function fixWinEPERM(p, options2, er, cb) { + assert(p); + assert(options2); + assert(typeof cb === "function"); + if (er) { + assert(er instanceof Error); + } + options2.chmod(p, 438, (er2) => { + if (er2) { + cb(er2.code === "ENOENT" ? null : er); + } else { + options2.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === "ENOENT" ? null : er); + } else if (stats.isDirectory()) { + rmdir(p, options2, er, cb); + } else { + options2.unlink(p, cb); + } + }); + } + }); + } + function fixWinEPERMSync(p, options2, er) { + let stats; + assert(p); + assert(options2); + if (er) { + assert(er instanceof Error); + } + try { + options2.chmodSync(p, 438); + } catch (er2) { + if (er2.code === "ENOENT") { + return; + } else { + throw er; + } + } + try { + stats = options2.statSync(p); + } catch (er3) { + if (er3.code === "ENOENT") { + return; + } else { + throw er; + } + } + if (stats.isDirectory()) { + rmdirSync2(p, options2, er); + } else { + options2.unlinkSync(p); + } + } + function rmdir(p, options2, originalEr, cb) { + assert(p); + assert(options2); + if (originalEr) { + assert(originalEr instanceof Error); + } + assert(typeof cb === "function"); + options2.rmdir(p, (er) => { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) { + rmkids(p, options2, cb); + } else if (er && er.code === "ENOTDIR") { + cb(originalEr); + } else { + cb(er); + } + }); + } + function rmkids(p, options2, cb) { + assert(p); + assert(options2); + assert(typeof cb === "function"); + options2.readdir(p, (er, files) => { + if (er) + return cb(er); + let n = files.length; + let errState; + if (n === 0) + return options2.rmdir(p, cb); + files.forEach((f) => { + rimraf(path18.join(p, f), options2, (er2) => { + if (errState) { + return; + } + if (er2) + return cb(errState = er2); + if (--n === 0) { + options2.rmdir(p, cb); + } + }); + }); + }); + } + function rimrafSync(p, options2) { + let st; + options2 = options2 || {}; + defaults2(options2); + assert(p, "rimraf: missing path"); + assert.strictEqual(typeof p, "string", "rimraf: path should be a string"); + assert(options2, "rimraf: missing options"); + assert.strictEqual(typeof options2, "object", "rimraf: options should be object"); + try { + st = options2.lstatSync(p); + } catch (er) { + if (er.code === "ENOENT") { + return; + } + if (er.code === "EPERM" && isWindows) { + fixWinEPERMSync(p, options2, er); + } + } + try { + if (st && st.isDirectory()) { + rmdirSync2(p, options2, null); + } else { + options2.unlinkSync(p); + } + } catch (er) { + if (er.code === "ENOENT") { + return; + } else if (er.code === "EPERM") { + return isWindows ? fixWinEPERMSync(p, options2, er) : rmdirSync2(p, options2, er); + } else if (er.code !== "EISDIR") { + throw er; + } + rmdirSync2(p, options2, er); + } + } + function rmdirSync2(p, options2, originalEr) { + assert(p); + assert(options2); + if (originalEr) { + assert(originalEr instanceof Error); + } + try { + options2.rmdirSync(p); + } catch (er) { + if (er.code === "ENOTDIR") { + throw originalEr; + } else if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") { + rmkidsSync(p, options2); + } else if (er.code !== "ENOENT") { + throw er; + } + } + } + function rmkidsSync(p, options2) { + assert(p); + assert(options2); + options2.readdirSync(p).forEach((f) => rimrafSync(path18.join(p, f), options2)); + if (isWindows) { + const startTime = Date.now(); + do { + try { + const ret = options2.rmdirSync(p, options2); + return ret; + } catch (er) { + } + } while (Date.now() - startTime < 500); + } else { + const ret = options2.rmdirSync(p, options2); + return ret; + } + } + module2.exports = rimraf; + rimraf.sync = rimrafSync; + } +}); + +// node_modules/fs-extra/lib/remove/index.js +var require_remove = __commonJS({ + "node_modules/fs-extra/lib/remove/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var rimraf = require_rimraf(); + module2.exports = { + remove: u(rimraf), + removeSync: rimraf.sync + }; + } +}); + +// node_modules/fs-extra/lib/empty/index.js +var require_empty = __commonJS({ + "node_modules/fs-extra/lib/empty/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var mkdir = require_mkdirs2(); + var remove3 = require_remove(); + var emptyDir = u(function emptyDir2(dir, callback) { + callback = callback || function() { + }; + fs6.readdir(dir, (err, items) => { + if (err) + return mkdir.mkdirs(dir, callback); + items = items.map((item) => path18.join(dir, item)); + deleteItem(); + function deleteItem() { + const item = items.pop(); + if (!item) + return callback(); + remove3.remove(item, (err2) => { + if (err2) + return callback(err2); + deleteItem(); + }); + } + }); + }); + function emptyDirSync(dir) { + let items; + try { + items = fs6.readdirSync(dir); + } catch (err) { + return mkdir.mkdirsSync(dir); + } + items.forEach((item) => { + item = path18.join(dir, item); + remove3.removeSync(item); + }); + } + module2.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir + }; + } +}); + +// node_modules/fs-extra/lib/ensure/file.js +var require_file = __commonJS({ + "node_modules/fs-extra/lib/ensure/file.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var path18 = require("path"); + var fs6 = require_graceful_fs(); + var mkdir = require_mkdirs2(); + var pathExists7 = require_path_exists().pathExists; + function createFile(file, callback) { + function makeFile() { + fs6.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); + } + fs6.stat(file, (err, stats) => { + if (!err && stats.isFile()) + return callback(); + const dir = path18.dirname(file); + pathExists7(dir, (err2, dirExists) => { + if (err2) + return callback(err2); + if (dirExists) + return makeFile(); + mkdir.mkdirs(dir, (err3) => { + if (err3) + return callback(err3); + makeFile(); + }); + }); + }); + } + function createFileSync(file) { + let stats; + try { + stats = fs6.statSync(file); + } catch (e) { + } + if (stats && stats.isFile()) + return; + const dir = path18.dirname(file); + if (!fs6.existsSync(dir)) { + mkdir.mkdirsSync(dir); + } + fs6.writeFileSync(file, ""); + } + module2.exports = { + createFile: u(createFile), + createFileSync + }; + } +}); + +// node_modules/fs-extra/lib/ensure/link.js +var require_link = __commonJS({ + "node_modules/fs-extra/lib/ensure/link.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var path18 = require("path"); + var fs6 = require_graceful_fs(); + var mkdir = require_mkdirs2(); + var pathExists7 = require_path_exists().pathExists; + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs6.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); + } + pathExists7(dstpath, (err, destinationExists) => { + if (err) + return callback(err); + if (destinationExists) + return callback(null); + fs6.lstat(srcpath, (err2) => { + if (err2) { + err2.message = err2.message.replace("lstat", "ensureLink"); + return callback(err2); + } + const dir = path18.dirname(dstpath); + pathExists7(dir, (err3, dirExists) => { + if (err3) + return callback(err3); + if (dirExists) + return makeLink(srcpath, dstpath); + mkdir.mkdirs(dir, (err4) => { + if (err4) + return callback(err4); + makeLink(srcpath, dstpath); + }); + }); + }); + }); + } + function createLinkSync(srcpath, dstpath) { + const destinationExists = fs6.existsSync(dstpath); + if (destinationExists) + return void 0; + try { + fs6.lstatSync(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + const dir = path18.dirname(dstpath); + const dirExists = fs6.existsSync(dir); + if (dirExists) + return fs6.linkSync(srcpath, dstpath); + mkdir.mkdirsSync(dir); + return fs6.linkSync(srcpath, dstpath); + } + module2.exports = { + createLink: u(createLink), + createLinkSync + }; + } +}); + +// node_modules/fs-extra/lib/ensure/symlink-paths.js +var require_symlink_paths = __commonJS({ + "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) { + "use strict"; + var path18 = require("path"); + var fs6 = require_graceful_fs(); + var pathExists7 = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { + if (path18.isAbsolute(srcpath)) { + return fs6.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + return callback(err); + } + return callback(null, { + "toCwd": srcpath, + "toDst": srcpath + }); + }); + } else { + const dstdir = path18.dirname(dstpath); + const relativeToDst = path18.join(dstdir, srcpath); + return pathExists7(relativeToDst, (err, exists) => { + if (err) + return callback(err); + if (exists) { + return callback(null, { + "toCwd": relativeToDst, + "toDst": srcpath + }); + } else { + return fs6.lstat(srcpath, (err2) => { + if (err2) { + err2.message = err2.message.replace("lstat", "ensureSymlink"); + return callback(err2); + } + return callback(null, { + "toCwd": srcpath, + "toDst": path18.relative(dstdir, srcpath) + }); + }); + } + }); + } + } + function symlinkPathsSync(srcpath, dstpath) { + let exists; + if (path18.isAbsolute(srcpath)) { + exists = fs6.existsSync(srcpath); + if (!exists) + throw new Error("absolute srcpath does not exist"); + return { + "toCwd": srcpath, + "toDst": srcpath + }; + } else { + const dstdir = path18.dirname(dstpath); + const relativeToDst = path18.join(dstdir, srcpath); + exists = fs6.existsSync(relativeToDst); + if (exists) { + return { + "toCwd": relativeToDst, + "toDst": srcpath + }; + } else { + exists = fs6.existsSync(srcpath); + if (!exists) + throw new Error("relative srcpath does not exist"); + return { + "toCwd": srcpath, + "toDst": path18.relative(dstdir, srcpath) + }; + } + } + } + module2.exports = { + symlinkPaths, + symlinkPathsSync + }; + } +}); + +// node_modules/fs-extra/lib/ensure/symlink-type.js +var require_symlink_type = __commonJS({ + "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; + if (type) + return callback(null, type); + fs6.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); + } + function symlinkTypeSync(srcpath, type) { + let stats; + if (type) + return type; + try { + stats = fs6.lstatSync(srcpath); + } catch (e) { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; + } + module2.exports = { + symlinkType, + symlinkTypeSync + }; + } +}); + +// node_modules/fs-extra/lib/ensure/symlink.js +var require_symlink = __commonJS({ + "node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var path18 = require("path"); + var fs6 = require_graceful_fs(); + var _mkdirs = require_mkdirs2(); + var mkdirs = _mkdirs.mkdirs; + var mkdirsSync = _mkdirs.mkdirsSync; + var _symlinkPaths = require_symlink_paths(); + var symlinkPaths = _symlinkPaths.symlinkPaths; + var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; + var _symlinkType = require_symlink_type(); + var symlinkType = _symlinkType.symlinkType; + var symlinkTypeSync = _symlinkType.symlinkTypeSync; + var pathExists7 = require_path_exists().pathExists; + function createSymlink(srcpath, dstpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; + pathExists7(dstpath, (err, destinationExists) => { + if (err) + return callback(err); + if (destinationExists) + return callback(null); + symlinkPaths(srcpath, dstpath, (err2, relative5) => { + if (err2) + return callback(err2); + srcpath = relative5.toDst; + symlinkType(relative5.toCwd, type, (err3, type2) => { + if (err3) + return callback(err3); + const dir = path18.dirname(dstpath); + pathExists7(dir, (err4, dirExists) => { + if (err4) + return callback(err4); + if (dirExists) + return fs6.symlink(srcpath, dstpath, type2, callback); + mkdirs(dir, (err5) => { + if (err5) + return callback(err5); + fs6.symlink(srcpath, dstpath, type2, callback); + }); + }); + }); + }); + }); + } + function createSymlinkSync(srcpath, dstpath, type) { + const destinationExists = fs6.existsSync(dstpath); + if (destinationExists) + return void 0; + const relative5 = symlinkPathsSync(srcpath, dstpath); + srcpath = relative5.toDst; + type = symlinkTypeSync(relative5.toCwd, type); + const dir = path18.dirname(dstpath); + const exists = fs6.existsSync(dir); + if (exists) + return fs6.symlinkSync(srcpath, dstpath, type); + mkdirsSync(dir); + return fs6.symlinkSync(srcpath, dstpath, type); + } + module2.exports = { + createSymlink: u(createSymlink), + createSymlinkSync + }; + } +}); + +// node_modules/fs-extra/lib/ensure/index.js +var require_ensure = __commonJS({ + "node_modules/fs-extra/lib/ensure/index.js"(exports, module2) { + "use strict"; + var file = require_file(); + var link = require_link(); + var symlink = require_symlink(); + module2.exports = { + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync + }; + } +}); + +// node_modules/jsonfile/index.js +var require_jsonfile = __commonJS({ + "node_modules/jsonfile/index.js"(exports, module2) { + var _fs; + try { + _fs = require_graceful_fs(); + } catch (_) { + _fs = require("fs"); + } + function readFile3(file, options2, callback) { + if (callback == null) { + callback = options2; + options2 = {}; + } + if (typeof options2 === "string") { + options2 = { encoding: options2 }; + } + options2 = options2 || {}; + var fs6 = options2.fs || _fs; + var shouldThrow = true; + if ("throws" in options2) { + shouldThrow = options2.throws; + } + fs6.readFile(file, options2, function(err, data) { + if (err) + return callback(err); + data = stripBom(data); + var obj; + try { + obj = JSON.parse(data, options2 ? options2.reviver : null); + } catch (err2) { + if (shouldThrow) { + err2.message = file + ": " + err2.message; + return callback(err2); + } else { + return callback(null, null); + } + } + callback(null, obj); + }); + } + function readFileSync3(file, options2) { + options2 = options2 || {}; + if (typeof options2 === "string") { + options2 = { encoding: options2 }; + } + var fs6 = options2.fs || _fs; + var shouldThrow = true; + if ("throws" in options2) { + shouldThrow = options2.throws; + } + try { + var content = fs6.readFileSync(file, options2); + content = stripBom(content); + return JSON.parse(content, options2.reviver); + } catch (err) { + if (shouldThrow) { + err.message = file + ": " + err.message; + throw err; + } else { + return null; + } + } + } + function stringify(obj, options2) { + var spaces; + var EOL2 = "\n"; + if (typeof options2 === "object" && options2 !== null) { + if (options2.spaces) { + spaces = options2.spaces; + } + if (options2.EOL) { + EOL2 = options2.EOL; + } + } + var str = JSON.stringify(obj, options2 ? options2.replacer : null, spaces); + return str.replace(/\n/g, EOL2) + EOL2; + } + function writeFile2(file, obj, options2, callback) { + if (callback == null) { + callback = options2; + options2 = {}; + } + options2 = options2 || {}; + var fs6 = options2.fs || _fs; + var str = ""; + try { + str = stringify(obj, options2); + } catch (err) { + if (callback) + callback(err, null); + return; + } + fs6.writeFile(file, str, options2, callback); + } + function writeFileSync(file, obj, options2) { + options2 = options2 || {}; + var fs6 = options2.fs || _fs; + var str = stringify(obj, options2); + return fs6.writeFileSync(file, str, options2); + } + function stripBom(content) { + if (Buffer.isBuffer(content)) + content = content.toString("utf8"); + content = content.replace(/^\uFEFF/, ""); + return content; + } + var jsonfile = { + readFile: readFile3, + readFileSync: readFileSync3, + writeFile: writeFile2, + writeFileSync + }; + module2.exports = jsonfile; + } +}); + +// node_modules/fs-extra/lib/json/jsonfile.js +var require_jsonfile2 = __commonJS({ + "node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var jsonFile = require_jsonfile(); + module2.exports = { + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync + }; + } +}); + +// node_modules/fs-extra/lib/json/output-json.js +var require_output_json = __commonJS({ + "node_modules/fs-extra/lib/json/output-json.js"(exports, module2) { + "use strict"; + var path18 = require("path"); + var mkdir = require_mkdirs2(); + var pathExists7 = require_path_exists().pathExists; + var jsonFile = require_jsonfile2(); + function outputJson(file, data, options2, callback) { + if (typeof options2 === "function") { + callback = options2; + options2 = {}; + } + const dir = path18.dirname(file); + pathExists7(dir, (err, itDoes) => { + if (err) + return callback(err); + if (itDoes) + return jsonFile.writeJson(file, data, options2, callback); + mkdir.mkdirs(dir, (err2) => { + if (err2) + return callback(err2); + jsonFile.writeJson(file, data, options2, callback); + }); + }); + } + module2.exports = outputJson; + } +}); + +// node_modules/fs-extra/lib/json/output-json-sync.js +var require_output_json_sync = __commonJS({ + "node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var mkdir = require_mkdirs2(); + var jsonFile = require_jsonfile2(); + function outputJsonSync(file, data, options2) { + const dir = path18.dirname(file); + if (!fs6.existsSync(dir)) { + mkdir.mkdirsSync(dir); + } + jsonFile.writeJsonSync(file, data, options2); + } + module2.exports = outputJsonSync; + } +}); + +// node_modules/fs-extra/lib/json/index.js +var require_json = __commonJS({ + "node_modules/fs-extra/lib/json/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var jsonFile = require_jsonfile2(); + jsonFile.outputJson = u(require_output_json()); + jsonFile.outputJsonSync = require_output_json_sync(); + jsonFile.outputJSON = jsonFile.outputJson; + jsonFile.outputJSONSync = jsonFile.outputJsonSync; + jsonFile.writeJSON = jsonFile.writeJson; + jsonFile.writeJSONSync = jsonFile.writeJsonSync; + jsonFile.readJSON = jsonFile.readJson; + jsonFile.readJSONSync = jsonFile.readJsonSync; + module2.exports = jsonFile; + } +}); + +// node_modules/fs-extra/lib/move-sync/move-sync.js +var require_move_sync = __commonJS({ + "node_modules/fs-extra/lib/move-sync/move-sync.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var copySync = require_copy_sync2().copySync; + var removeSync = require_remove().removeSync; + var mkdirpSync = require_mkdirs2().mkdirpSync; + var stat2 = require_stat(); + function moveSync2(src, dest, opts) { + opts = opts || {}; + const overwrite = opts.overwrite || opts.clobber || false; + const { srcStat } = stat2.checkPathsSync(src, dest, "move"); + stat2.checkParentPathsSync(src, srcStat, dest, "move"); + mkdirpSync(path18.dirname(dest)); + return doRename(src, dest, overwrite); + } + function doRename(src, dest, overwrite) { + if (overwrite) { + removeSync(dest); + return rename2(src, dest, overwrite); + } + if (fs6.existsSync(dest)) + throw new Error("dest already exists."); + return rename2(src, dest, overwrite); + } + function rename2(src, dest, overwrite) { + try { + fs6.renameSync(src, dest); + } catch (err) { + if (err.code !== "EXDEV") + throw err; + return moveAcrossDevice(src, dest, overwrite); + } + } + function moveAcrossDevice(src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + }; + copySync(src, dest, opts); + return removeSync(src); + } + module2.exports = moveSync2; + } +}); + +// node_modules/fs-extra/lib/move-sync/index.js +var require_move_sync2 = __commonJS({ + "node_modules/fs-extra/lib/move-sync/index.js"(exports, module2) { + "use strict"; + module2.exports = { + moveSync: require_move_sync() + }; + } +}); + +// node_modules/fs-extra/lib/move/move.js +var require_move = __commonJS({ + "node_modules/fs-extra/lib/move/move.js"(exports, module2) { + "use strict"; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var copy = require_copy2().copy; + var remove3 = require_remove().remove; + var mkdirp = require_mkdirs2().mkdirp; + var pathExists7 = require_path_exists().pathExists; + var stat2 = require_stat(); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; + } + const overwrite = opts.overwrite || opts.clobber || false; + stat2.checkPaths(src, dest, "move", (err, stats) => { + if (err) + return cb(err); + const { srcStat } = stats; + stat2.checkParentPaths(src, srcStat, dest, "move", (err2) => { + if (err2) + return cb(err2); + mkdirp(path18.dirname(dest), (err3) => { + if (err3) + return cb(err3); + return doRename(src, dest, overwrite, cb); + }); + }); + }); + } + function doRename(src, dest, overwrite, cb) { + if (overwrite) { + return remove3(dest, (err) => { + if (err) + return cb(err); + return rename2(src, dest, overwrite, cb); + }); + } + pathExists7(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename2(src, dest, overwrite, cb); + }); + } + function rename2(src, dest, overwrite, cb) { + fs6.rename(src, dest, (err) => { + if (!err) + return cb(); + if (err.code !== "EXDEV") + return cb(err); + return moveAcrossDevice(src, dest, overwrite, cb); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + }; + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove3(src, cb); + }); + } + module2.exports = move; + } +}); + +// node_modules/fs-extra/lib/move/index.js +var require_move2 = __commonJS({ + "node_modules/fs-extra/lib/move/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + module2.exports = { + move: u(require_move()) + }; + } +}); + +// node_modules/fs-extra/lib/output/index.js +var require_output = __commonJS({ + "node_modules/fs-extra/lib/output/index.js"(exports, module2) { + "use strict"; + var u = require_universalify().fromCallback; + var fs6 = require_graceful_fs(); + var path18 = require("path"); + var mkdir = require_mkdirs2(); + var pathExists7 = require_path_exists().pathExists; + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; + } + const dir = path18.dirname(file); + pathExists7(dir, (err, itDoes) => { + if (err) + return callback(err); + if (itDoes) + return fs6.writeFile(file, data, encoding, callback); + mkdir.mkdirs(dir, (err2) => { + if (err2) + return callback(err2); + fs6.writeFile(file, data, encoding, callback); + }); + }); + } + function outputFileSync(file, ...args) { + const dir = path18.dirname(file); + if (fs6.existsSync(dir)) { + return fs6.writeFileSync(file, ...args); + } + mkdir.mkdirsSync(dir); + fs6.writeFileSync(file, ...args); + } + module2.exports = { + outputFile: u(outputFile), + outputFileSync + }; + } +}); + +// node_modules/fs-extra/lib/index.js +var require_lib = __commonJS({ + "node_modules/fs-extra/lib/index.js"(exports, module2) { + "use strict"; + module2.exports = Object.assign( + {}, + require_fs(), + require_copy_sync2(), + require_copy2(), + require_empty(), + require_ensure(), + require_json(), + require_mkdirs2(), + require_move_sync2(), + require_move2(), + require_output(), + require_path_exists(), + require_remove() + ); + var fs6 = require("fs"); + if (Object.getOwnPropertyDescriptor(fs6, "promises")) { + Object.defineProperty(module2.exports, "promises", { + get() { + return fs6.promises; + } + }); + } + } +}); + +// node_modules/vscode-jsonrpc/lib/common/ral.js +var require_ral = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var _ral; + function RAL() { + if (_ral === void 0) { + throw new Error(`No runtime abstraction layer installed`); + } + return _ral; + } + (function(RAL2) { + function install(ral) { + if (ral === void 0) { + throw new Error(`No runtime abstraction layer provided`); + } + _ral = ral; + } + RAL2.install = install; + })(RAL || (RAL = {})); + exports.default = RAL; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/disposable.js +var require_disposable = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Disposable = void 0; + var Disposable7; + (function(Disposable8) { + function create(func) { + return { + dispose: func + }; + } + Disposable8.create = create; + })(Disposable7 = exports.Disposable || (exports.Disposable = {})); + } +}); + +// node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +var require_messageBuffer = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AbstractMessageBuffer = void 0; + var CR = 13; + var LF = 10; + var CRLF = "\r\n"; + var AbstractMessageBuffer = class { + constructor(encoding = "utf-8") { + this._encoding = encoding; + this._chunks = []; + this._totalLength = 0; + } + get encoding() { + return this._encoding; + } + append(chunk) { + const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; + this._chunks.push(toAppend); + this._totalLength += toAppend.byteLength; + } + tryReadHeaders() { + if (this._chunks.length === 0) { + return void 0; + } + let state = 0; + let chunkIndex = 0; + let offset = 0; + let chunkBytesRead = 0; + row: + while (chunkIndex < this._chunks.length) { + const chunk = this._chunks[chunkIndex]; + offset = 0; + column: + while (offset < chunk.length) { + const value = chunk[offset]; + switch (value) { + case CR: + switch (state) { + case 0: + state = 1; + break; + case 2: + state = 3; + break; + default: + state = 0; + } + break; + case LF: + switch (state) { + case 1: + state = 2; + break; + case 3: + state = 4; + offset++; + break row; + default: + state = 0; + } + break; + default: + state = 0; + } + offset++; + } + chunkBytesRead += chunk.byteLength; + chunkIndex++; + } + if (state !== 4) { + return void 0; + } + const buffer = this._read(chunkBytesRead + offset); + const result = /* @__PURE__ */ new Map(); + const headers = this.toString(buffer, "ascii").split(CRLF); + if (headers.length < 2) { + return result; + } + for (let i = 0; i < headers.length - 2; i++) { + const header = headers[i]; + const index = header.indexOf(":"); + if (index === -1) { + throw new Error("Message header must separate key and value using :"); + } + const key = header.substr(0, index); + const value = header.substr(index + 1).trim(); + result.set(key, value); + } + return result; + } + tryReadBody(length) { + if (this._totalLength < length) { + return void 0; + } + return this._read(length); + } + get numberOfBytes() { + return this._totalLength; + } + _read(byteCount) { + if (byteCount === 0) { + return this.emptyBuffer(); + } + if (byteCount > this._totalLength) { + throw new Error(`Cannot read so many bytes!`); + } + if (this._chunks[0].byteLength === byteCount) { + const chunk = this._chunks[0]; + this._chunks.shift(); + this._totalLength -= byteCount; + return this.asNative(chunk); + } + if (this._chunks[0].byteLength > byteCount) { + const chunk = this._chunks[0]; + const result2 = this.asNative(chunk, byteCount); + this._chunks[0] = chunk.slice(byteCount); + this._totalLength -= byteCount; + return result2; + } + const result = this.allocNative(byteCount); + let resultOffset = 0; + let chunkIndex = 0; + while (byteCount > 0) { + const chunk = this._chunks[chunkIndex]; + if (chunk.byteLength > byteCount) { + const chunkPart = chunk.slice(0, byteCount); + result.set(chunkPart, resultOffset); + resultOffset += byteCount; + this._chunks[chunkIndex] = chunk.slice(byteCount); + this._totalLength -= byteCount; + byteCount -= byteCount; + } else { + result.set(chunk, resultOffset); + resultOffset += chunk.byteLength; + this._chunks.shift(); + this._totalLength -= chunk.byteLength; + byteCount -= chunk.byteLength; + } + } + return result; + } + }; + exports.AbstractMessageBuffer = AbstractMessageBuffer; + } +}); + +// node_modules/vscode-jsonrpc/lib/node/ril.js +var require_ril = __commonJS({ + "node_modules/vscode-jsonrpc/lib/node/ril.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var ral_1 = require_ral(); + var util_1 = require("util"); + var disposable_1 = require_disposable(); + var messageBuffer_1 = require_messageBuffer(); + var MessageBuffer = class extends messageBuffer_1.AbstractMessageBuffer { + constructor(encoding = "utf-8") { + super(encoding); + } + emptyBuffer() { + return MessageBuffer.emptyBuffer; + } + fromString(value, encoding) { + return Buffer.from(value, encoding); + } + toString(value, encoding) { + if (value instanceof Buffer) { + return value.toString(encoding); + } else { + return new util_1.TextDecoder(encoding).decode(value); + } + } + asNative(buffer, length) { + if (length === void 0) { + return buffer instanceof Buffer ? buffer : Buffer.from(buffer); + } else { + return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); + } + } + allocNative(length) { + return Buffer.allocUnsafe(length); + } + }; + MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); + var ReadableStreamWrapper = class { + constructor(stream) { + this.stream = stream; + } + onClose(listener) { + this.stream.on("close", listener); + return disposable_1.Disposable.create(() => this.stream.off("close", listener)); + } + onError(listener) { + this.stream.on("error", listener); + return disposable_1.Disposable.create(() => this.stream.off("error", listener)); + } + onEnd(listener) { + this.stream.on("end", listener); + return disposable_1.Disposable.create(() => this.stream.off("end", listener)); + } + onData(listener) { + this.stream.on("data", listener); + return disposable_1.Disposable.create(() => this.stream.off("data", listener)); + } + }; + var WritableStreamWrapper = class { + constructor(stream) { + this.stream = stream; + } + onClose(listener) { + this.stream.on("close", listener); + return disposable_1.Disposable.create(() => this.stream.off("close", listener)); + } + onError(listener) { + this.stream.on("error", listener); + return disposable_1.Disposable.create(() => this.stream.off("error", listener)); + } + onEnd(listener) { + this.stream.on("end", listener); + return disposable_1.Disposable.create(() => this.stream.off("end", listener)); + } + write(data, encoding) { + return new Promise((resolve9, reject) => { + const callback = (error) => { + if (error === void 0 || error === null) { + resolve9(); + } else { + reject(error); + } + }; + if (typeof data === "string") { + this.stream.write(data, encoding, callback); + } else { + this.stream.write(data, callback); + } + }); + } + end() { + this.stream.end(); + } + }; + var _ril = Object.freeze({ + messageBuffer: Object.freeze({ + create: (encoding) => new MessageBuffer(encoding) + }), + applicationJson: Object.freeze({ + encoder: Object.freeze({ + name: "application/json", + encode: (msg, options2) => { + try { + return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options2.charset)); + } catch (err) { + return Promise.reject(err); + } + } + }), + decoder: Object.freeze({ + name: "application/json", + decode: (buffer, options2) => { + try { + if (buffer instanceof Buffer) { + return Promise.resolve(JSON.parse(buffer.toString(options2.charset))); + } else { + return Promise.resolve(JSON.parse(new util_1.TextDecoder(options2.charset).decode(buffer))); + } + } catch (err) { + return Promise.reject(err); + } + } + }) + }), + stream: Object.freeze({ + asReadableStream: (stream) => new ReadableStreamWrapper(stream), + asWritableStream: (stream) => new WritableStreamWrapper(stream) + }), + console, + timer: Object.freeze({ + setTimeout(callback, ms, ...args) { + const handle = setTimeout(callback, ms, ...args); + return { dispose: () => clearTimeout(handle) }; + }, + setImmediate(callback, ...args) { + const handle = setImmediate(callback, ...args); + return { dispose: () => clearImmediate(handle) }; + }, + setInterval(callback, ms, ...args) { + const handle = setInterval(callback, ms, ...args); + return { dispose: () => clearInterval(handle) }; + } + }) + }); + function RIL() { + return _ril; + } + (function(RIL2) { + function install() { + ral_1.default.install(_ril); + } + RIL2.install = install; + })(RIL || (RIL = {})); + exports.default = RIL; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/is.js +var require_is = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/is.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; + function boolean(value) { + return value === true || value === false; + } + exports.boolean = boolean; + function string(value) { + return typeof value === "string" || value instanceof String; + } + exports.string = string; + function number(value) { + return typeof value === "number" || value instanceof Number; + } + exports.number = number; + function error(value) { + return value instanceof Error; + } + exports.error = error; + function func(value) { + return typeof value === "function"; + } + exports.func = func; + function array(value) { + return Array.isArray(value); + } + exports.array = array; + function stringArray(value) { + return array(value) && value.every((elem) => string(elem)); + } + exports.stringArray = stringArray; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/messages.js +var require_messages = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; + var is = require_is(); + var ErrorCodes; + (function(ErrorCodes2) { + ErrorCodes2.ParseError = -32700; + ErrorCodes2.InvalidRequest = -32600; + ErrorCodes2.MethodNotFound = -32601; + ErrorCodes2.InvalidParams = -32602; + ErrorCodes2.InternalError = -32603; + ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; + ErrorCodes2.serverErrorStart = -32099; + ErrorCodes2.MessageWriteError = -32099; + ErrorCodes2.MessageReadError = -32098; + ErrorCodes2.PendingResponseRejected = -32097; + ErrorCodes2.ConnectionInactive = -32096; + ErrorCodes2.ServerNotInitialized = -32002; + ErrorCodes2.UnknownErrorCode = -32001; + ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; + ErrorCodes2.serverErrorEnd = -32e3; + })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {})); + var ResponseError = class extends Error { + constructor(code, message, data) { + super(message); + this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; + this.data = data; + Object.setPrototypeOf(this, ResponseError.prototype); + } + toJson() { + const result = { + code: this.code, + message: this.message + }; + if (this.data !== void 0) { + result.data = this.data; + } + return result; + } + }; + exports.ResponseError = ResponseError; + var ParameterStructures = class { + constructor(kind) { + this.kind = kind; + } + static is(value) { + return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition; + } + toString() { + return this.kind; + } + }; + exports.ParameterStructures = ParameterStructures; + ParameterStructures.auto = new ParameterStructures("auto"); + ParameterStructures.byPosition = new ParameterStructures("byPosition"); + ParameterStructures.byName = new ParameterStructures("byName"); + var AbstractMessageSignature = class { + constructor(method, numberOfParams) { + this.method = method; + this.numberOfParams = numberOfParams; + } + get parameterStructures() { + return ParameterStructures.auto; + } + }; + exports.AbstractMessageSignature = AbstractMessageSignature; + var RequestType0 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } + }; + exports.RequestType0 = RequestType0; + var RequestType3 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports.RequestType = RequestType3; + var RequestType1 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports.RequestType1 = RequestType1; + var RequestType22 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 2); + } + }; + exports.RequestType2 = RequestType22; + var RequestType32 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 3); + } + }; + exports.RequestType3 = RequestType32; + var RequestType4 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 4); + } + }; + exports.RequestType4 = RequestType4; + var RequestType5 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 5); + } + }; + exports.RequestType5 = RequestType5; + var RequestType6 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 6); + } + }; + exports.RequestType6 = RequestType6; + var RequestType7 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 7); + } + }; + exports.RequestType7 = RequestType7; + var RequestType8 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 8); + } + }; + exports.RequestType8 = RequestType8; + var RequestType9 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 9); + } + }; + exports.RequestType9 = RequestType9; + var NotificationType2 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports.NotificationType = NotificationType2; + var NotificationType0 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } + }; + exports.NotificationType0 = NotificationType0; + var NotificationType1 = class extends AbstractMessageSignature { + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports.NotificationType1 = NotificationType1; + var NotificationType22 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 2); + } + }; + exports.NotificationType2 = NotificationType22; + var NotificationType3 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 3); + } + }; + exports.NotificationType3 = NotificationType3; + var NotificationType4 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 4); + } + }; + exports.NotificationType4 = NotificationType4; + var NotificationType5 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 5); + } + }; + exports.NotificationType5 = NotificationType5; + var NotificationType6 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 6); + } + }; + exports.NotificationType6 = NotificationType6; + var NotificationType7 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 7); + } + }; + exports.NotificationType7 = NotificationType7; + var NotificationType8 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 8); + } + }; + exports.NotificationType8 = NotificationType8; + var NotificationType9 = class extends AbstractMessageSignature { + constructor(method) { + super(method, 9); + } + }; + exports.NotificationType9 = NotificationType9; + var Message2; + (function(Message3) { + function isRequest(message) { + const candidate = message; + return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); + } + Message3.isRequest = isRequest; + function isNotification(message) { + const candidate = message; + return candidate && is.string(candidate.method) && message.id === void 0; + } + Message3.isNotification = isNotification; + function isResponse(message) { + const candidate = message; + return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); + } + Message3.isResponse = isResponse; + })(Message2 = exports.Message || (exports.Message = {})); + } +}); + +// node_modules/vscode-jsonrpc/lib/common/linkedMap.js +var require_linkedMap = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports) { + "use strict"; + var _a; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; + var Touch; + (function(Touch2) { + Touch2.None = 0; + Touch2.First = 1; + Touch2.AsOld = Touch2.First; + Touch2.Last = 2; + Touch2.AsNew = Touch2.Last; + })(Touch = exports.Touch || (exports.Touch = {})); + var LinkedMap = class { + constructor() { + this[_a] = "LinkedMap"; + this._map = /* @__PURE__ */ new Map(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state = 0; + } + clear() { + this._map.clear(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state++; + } + isEmpty() { + return !this._head && !this._tail; + } + get size() { + return this._size; + } + get first() { + var _a2; + return (_a2 = this._head) == null ? void 0 : _a2.value; + } + get last() { + var _a2; + return (_a2 = this._tail) == null ? void 0 : _a2.value; + } + has(key) { + return this._map.has(key); + } + get(key, touch = Touch.None) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + if (touch !== Touch.None) { + this.touch(item, touch); + } + return item.value; + } + set(key, value, touch = Touch.None) { + let item = this._map.get(key); + if (item) { + item.value = value; + if (touch !== Touch.None) { + this.touch(item, touch); + } + } else { + item = { key, value, next: void 0, previous: void 0 }; + switch (touch) { + case Touch.None: + this.addItemLast(item); + break; + case Touch.First: + this.addItemFirst(item); + break; + case Touch.Last: + this.addItemLast(item); + break; + default: + this.addItemLast(item); + break; + } + this._map.set(key, item); + this._size++; + } + return this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return void 0; + } + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + const item = this._head; + this._map.delete(item.key); + this.removeItem(item); + this._size--; + return item.value; + } + forEach(callbackfn, thisArg) { + const state = this._state; + let current = this._head; + while (current) { + if (thisArg) { + callbackfn.bind(thisArg)(current.value, current.key, this); + } else { + callbackfn(current.value, current.key, this); + } + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + current = current.next; + } + } + keys() { + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: () => { + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.key, done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + } + }; + return iterator; + } + values() { + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: () => { + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.value, done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + } + }; + return iterator; + } + entries() { + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: () => { + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: [current.key, current.value], done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + } + }; + return iterator; + } + [(_a = Symbol.toStringTag, Symbol.iterator)]() { + return this.entries(); + } + trimOld(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; + } + this._head = current; + this._size = currentSize; + if (current) { + current.previous = void 0; + } + this._state++; + } + addItemFirst(item) { + if (!this._head && !this._tail) { + this._tail = item; + } else if (!this._head) { + throw new Error("Invalid list"); + } else { + item.next = this._head; + this._head.previous = item; + } + this._head = item; + this._state++; + } + addItemLast(item) { + if (!this._head && !this._tail) { + this._head = item; + } else if (!this._tail) { + throw new Error("Invalid list"); + } else { + item.previous = this._tail; + this._tail.next = item; + } + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = void 0; + this._tail = void 0; + } else if (item === this._head) { + if (!item.next) { + throw new Error("Invalid list"); + } + item.next.previous = void 0; + this._head = item.next; + } else if (item === this._tail) { + if (!item.previous) { + throw new Error("Invalid list"); + } + item.previous.next = void 0; + this._tail = item.previous; + } else { + const next = item.next; + const previous = item.previous; + if (!next || !previous) { + throw new Error("Invalid list"); + } + next.previous = previous; + previous.next = next; + } + item.next = void 0; + item.previous = void 0; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + if (touch !== Touch.First && touch !== Touch.Last) { + return; + } + if (touch === Touch.First) { + if (item === this._head) { + return; + } + const next = item.next; + const previous = item.previous; + if (item === this._tail) { + previous.next = void 0; + this._tail = previous; + } else { + next.previous = previous; + previous.next = next; + } + item.previous = void 0; + item.next = this._head; + this._head.previous = item; + this._head = item; + this._state++; + } else if (touch === Touch.Last) { + if (item === this._tail) { + return; + } + const next = item.next; + const previous = item.previous; + if (item === this._head) { + next.previous = void 0; + this._head = next; + } else { + next.previous = previous; + previous.next = next; + } + item.next = void 0; + item.previous = this._tail; + this._tail.next = item; + this._tail = item; + this._state++; + } + } + toJSON() { + const data = []; + this.forEach((value, key) => { + data.push([key, value]); + }); + return data; + } + fromJSON(data) { + this.clear(); + for (const [key, value] of data) { + this.set(key, value); + } + } + }; + exports.LinkedMap = LinkedMap; + var LRUCache = class extends LinkedMap { + constructor(limit, ratio = 1) { + super(); + this._limit = limit; + this._ratio = Math.min(Math.max(0, ratio), 1); + } + get limit() { + return this._limit; + } + set limit(limit) { + this._limit = limit; + this.checkTrim(); + } + get ratio() { + return this._ratio; + } + set ratio(ratio) { + this._ratio = Math.min(Math.max(0, ratio), 1); + this.checkTrim(); + } + get(key, touch = Touch.AsNew) { + return super.get(key, touch); + } + peek(key) { + return super.get(key, Touch.None); + } + set(key, value) { + super.set(key, value, Touch.Last); + this.checkTrim(); + return this; + } + checkTrim() { + if (this.size > this._limit) { + this.trimOld(Math.round(this._limit * this._ratio)); + } + } + }; + exports.LRUCache = LRUCache; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/events.js +var require_events = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/events.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Emitter = exports.Event = void 0; + var ral_1 = require_ral(); + var Event3; + (function(Event4) { + const _disposable = { dispose() { + } }; + Event4.None = function() { + return _disposable; + }; + })(Event3 = exports.Event || (exports.Event = {})); + var CallbackList = class { + add(callback, context = null, bucket) { + if (!this._callbacks) { + this._callbacks = []; + this._contexts = []; + } + this._callbacks.push(callback); + this._contexts.push(context); + if (Array.isArray(bucket)) { + bucket.push({ dispose: () => this.remove(callback, context) }); + } + } + remove(callback, context = null) { + if (!this._callbacks) { + return; + } + let foundCallbackWithDifferentContext = false; + for (let i = 0, len = this._callbacks.length; i < len; i++) { + if (this._callbacks[i] === callback) { + if (this._contexts[i] === context) { + this._callbacks.splice(i, 1); + this._contexts.splice(i, 1); + return; + } else { + foundCallbackWithDifferentContext = true; + } + } + } + if (foundCallbackWithDifferentContext) { + throw new Error("When adding a listener with a context, you should remove it with the same context"); + } + } + invoke(...args) { + if (!this._callbacks) { + return []; + } + const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); + for (let i = 0, len = callbacks.length; i < len; i++) { + try { + ret.push(callbacks[i].apply(contexts[i], args)); + } catch (e) { + (0, ral_1.default)().console.error(e); + } + } + return ret; + } + isEmpty() { + return !this._callbacks || this._callbacks.length === 0; + } + dispose() { + this._callbacks = void 0; + this._contexts = void 0; + } + }; + var Emitter9 = class { + constructor(_options) { + this._options = _options; + } + get event() { + if (!this._event) { + this._event = (listener, thisArgs, disposables) => { + if (!this._callbacks) { + this._callbacks = new CallbackList(); + } + if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { + this._options.onFirstListenerAdd(this); + } + this._callbacks.add(listener, thisArgs); + const result = { + dispose: () => { + if (!this._callbacks) { + return; + } + this._callbacks.remove(listener, thisArgs); + result.dispose = Emitter9._noop; + if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { + this._options.onLastListenerRemove(this); + } + } + }; + if (Array.isArray(disposables)) { + disposables.push(result); + } + return result; + }; + } + return this._event; + } + fire(event) { + if (this._callbacks) { + this._callbacks.invoke.call(this._callbacks, event); + } + } + dispose() { + if (this._callbacks) { + this._callbacks.dispose(); + this._callbacks = void 0; + } + } + }; + exports.Emitter = Emitter9; + Emitter9._noop = function() { + }; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/cancellation.js +var require_cancellation = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CancellationTokenSource = exports.CancellationToken = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var events_1 = require_events(); + var CancellationToken9; + (function(CancellationToken10) { + CancellationToken10.None = Object.freeze({ + isCancellationRequested: false, + onCancellationRequested: events_1.Event.None + }); + CancellationToken10.Cancelled = Object.freeze({ + isCancellationRequested: true, + onCancellationRequested: events_1.Event.None + }); + function is(value) { + const candidate = value; + return candidate && (candidate === CancellationToken10.None || candidate === CancellationToken10.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); + } + CancellationToken10.is = is; + })(CancellationToken9 = exports.CancellationToken || (exports.CancellationToken = {})); + var shortcutEvent = Object.freeze(function(callback, context) { + const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0); + return { dispose() { + handle.dispose(); + } }; + }); + var MutableToken = class { + constructor() { + this._isCancelled = false; + } + cancel() { + if (!this._isCancelled) { + this._isCancelled = true; + if (this._emitter) { + this._emitter.fire(void 0); + this.dispose(); + } + } + } + get isCancellationRequested() { + return this._isCancelled; + } + get onCancellationRequested() { + if (this._isCancelled) { + return shortcutEvent; + } + if (!this._emitter) { + this._emitter = new events_1.Emitter(); + } + return this._emitter.event; + } + dispose() { + if (this._emitter) { + this._emitter.dispose(); + this._emitter = void 0; + } + } + }; + var CancellationTokenSource2 = class { + get token() { + if (!this._token) { + this._token = new MutableToken(); + } + return this._token; + } + cancel() { + if (!this._token) { + this._token = CancellationToken9.Cancelled; + } else { + this._token.cancel(); + } + } + dispose() { + if (!this._token) { + this._token = CancellationToken9.None; + } else if (this._token instanceof MutableToken) { + this._token.dispose(); + } + } + }; + exports.CancellationTokenSource = CancellationTokenSource2; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/messageReader.js +var require_messageReader = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var events_1 = require_events(); + var MessageReader; + (function(MessageReader2) { + function is(value) { + let candidate = value; + return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage); + } + MessageReader2.is = is; + })(MessageReader = exports.MessageReader || (exports.MessageReader = {})); + var AbstractMessageReader = class { + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + this.partialMessageEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error) { + this.errorEmitter.fire(this.asError(error)); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + get onPartialMessage() { + return this.partialMessageEmitter.event; + } + firePartialMessage(info) { + this.partialMessageEmitter.fire(info); + } + asError(error) { + if (error instanceof Error) { + return error; + } else { + return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); + } + } + }; + exports.AbstractMessageReader = AbstractMessageReader; + var ResolvedMessageReaderOptions; + (function(ResolvedMessageReaderOptions2) { + function fromOptions(options2) { + let charset; + let result; + let contentDecoder; + const contentDecoders = /* @__PURE__ */ new Map(); + let contentTypeDecoder; + const contentTypeDecoders = /* @__PURE__ */ new Map(); + if (options2 === void 0 || typeof options2 === "string") { + charset = options2 ?? "utf-8"; + } else { + charset = options2.charset ?? "utf-8"; + if (options2.contentDecoder !== void 0) { + contentDecoder = options2.contentDecoder; + contentDecoders.set(contentDecoder.name, contentDecoder); + } + if (options2.contentDecoders !== void 0) { + for (const decoder of options2.contentDecoders) { + contentDecoders.set(decoder.name, decoder); + } + } + if (options2.contentTypeDecoder !== void 0) { + contentTypeDecoder = options2.contentTypeDecoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + if (options2.contentTypeDecoders !== void 0) { + for (const decoder of options2.contentTypeDecoders) { + contentTypeDecoders.set(decoder.name, decoder); + } + } + } + if (contentTypeDecoder === void 0) { + contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; + } + ResolvedMessageReaderOptions2.fromOptions = fromOptions; + })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); + var ReadableStreamMessageReader = class extends AbstractMessageReader { + constructor(readable, options2) { + super(); + this.readable = readable; + this.options = ResolvedMessageReaderOptions.fromOptions(options2); + this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset); + this._partialMessageTimeout = 1e4; + this.nextMessageLength = -1; + this.messageToken = 0; + } + set partialMessageTimeout(timeout) { + this._partialMessageTimeout = timeout; + } + get partialMessageTimeout() { + return this._partialMessageTimeout; + } + listen(callback) { + this.nextMessageLength = -1; + this.messageToken = 0; + this.partialMessageTimer = void 0; + this.callback = callback; + const result = this.readable.onData((data) => { + this.onData(data); + }); + this.readable.onError((error) => this.fireError(error)); + this.readable.onClose(() => this.fireClose()); + return result; + } + onData(data) { + this.buffer.append(data); + while (true) { + if (this.nextMessageLength === -1) { + const headers = this.buffer.tryReadHeaders(); + if (!headers) { + return; + } + const contentLength = headers.get("Content-Length"); + if (!contentLength) { + throw new Error("Header must provide a Content-Length property."); + } + const length = parseInt(contentLength); + if (isNaN(length)) { + throw new Error("Content-Length value must be a number."); + } + this.nextMessageLength = length; + } + const body = this.buffer.tryReadBody(this.nextMessageLength); + if (body === void 0) { + this.setPartialMessageTimer(); + return; + } + this.clearPartialMessageTimer(); + this.nextMessageLength = -1; + let p; + if (this.options.contentDecoder !== void 0) { + p = this.options.contentDecoder.decode(body); + } else { + p = Promise.resolve(body); + } + p.then((value) => { + this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { + this.callback(msg); + }, (error) => { + this.fireError(error); + }); + }, (error) => { + this.fireError(error); + }); + } + } + clearPartialMessageTimer() { + if (this.partialMessageTimer) { + this.partialMessageTimer.dispose(); + this.partialMessageTimer = void 0; + } + } + setPartialMessageTimer() { + this.clearPartialMessageTimer(); + if (this._partialMessageTimeout <= 0) { + return; + } + this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => { + this.partialMessageTimer = void 0; + if (token === this.messageToken) { + this.firePartialMessage({ messageToken: token, waitingTime: timeout }); + this.setPartialMessageTimer(); + } + }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); + } + }; + exports.ReadableStreamMessageReader = ReadableStreamMessageReader; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/semaphore.js +var require_semaphore = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Semaphore = void 0; + var ral_1 = require_ral(); + var Semaphore = class { + constructor(capacity = 1) { + if (capacity <= 0) { + throw new Error("Capacity must be greater than 0"); + } + this._capacity = capacity; + this._active = 0; + this._waiting = []; + } + lock(thunk) { + return new Promise((resolve9, reject) => { + this._waiting.push({ thunk, resolve: resolve9, reject }); + this.runNext(); + }); + } + get active() { + return this._active; + } + runNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + (0, ral_1.default)().timer.setImmediate(() => this.doRunNext()); + } + doRunNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + const next = this._waiting.shift(); + this._active++; + if (this._active > this._capacity) { + throw new Error(`To many thunks active`); + } + try { + const result = next.thunk(); + if (result instanceof Promise) { + result.then((value) => { + this._active--; + next.resolve(value); + this.runNext(); + }, (err) => { + this._active--; + next.reject(err); + this.runNext(); + }); + } else { + this._active--; + next.resolve(result); + this.runNext(); + } + } catch (err) { + this._active--; + next.reject(err); + this.runNext(); + } + } + }; + exports.Semaphore = Semaphore; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/messageWriter.js +var require_messageWriter = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var semaphore_1 = require_semaphore(); + var events_1 = require_events(); + var ContentLength = "Content-Length: "; + var CRLF = "\r\n"; + var MessageWriter; + (function(MessageWriter2) { + function is(value) { + let candidate = value; + return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write); + } + MessageWriter2.is = is; + })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {})); + var AbstractMessageWriter = class { + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error, message, count) { + this.errorEmitter.fire([this.asError(error), message, count]); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + asError(error) { + if (error instanceof Error) { + return error; + } else { + return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`); + } + } + }; + exports.AbstractMessageWriter = AbstractMessageWriter; + var ResolvedMessageWriterOptions; + (function(ResolvedMessageWriterOptions2) { + function fromOptions(options2) { + if (options2 === void 0 || typeof options2 === "string") { + return { charset: options2 ?? "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder }; + } else { + return { charset: options2.charset ?? "utf-8", contentEncoder: options2.contentEncoder, contentTypeEncoder: options2.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder }; + } + } + ResolvedMessageWriterOptions2.fromOptions = fromOptions; + })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); + var WriteableStreamMessageWriter = class extends AbstractMessageWriter { + constructor(writable, options2) { + super(); + this.writable = writable; + this.options = ResolvedMessageWriterOptions.fromOptions(options2); + this.errorCount = 0; + this.writeSemaphore = new semaphore_1.Semaphore(1); + this.writable.onError((error) => this.fireError(error)); + this.writable.onClose(() => this.fireClose()); + } + async write(msg) { + return this.writeSemaphore.lock(async () => { + const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { + if (this.options.contentEncoder !== void 0) { + return this.options.contentEncoder.encode(buffer); + } else { + return buffer; + } + }); + return payload.then((buffer) => { + const headers = []; + headers.push(ContentLength, buffer.byteLength.toString(), CRLF); + headers.push(CRLF); + return this.doWrite(msg, headers, buffer); + }, (error) => { + this.fireError(error); + throw error; + }); + }); + } + async doWrite(msg, headers, data) { + try { + await this.writable.write(headers.join(""), "ascii"); + return this.writable.write(data); + } catch (error) { + this.handleError(error, msg); + return Promise.reject(error); + } + } + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); + } + end() { + this.writable.end(); + } + }; + exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/connection.js +var require_connection = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = exports.NullLogger = exports.ProgressType = exports.ProgressToken = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var messages_1 = require_messages(); + var linkedMap_1 = require_linkedMap(); + var events_1 = require_events(); + var cancellation_1 = require_cancellation(); + var CancelNotification; + (function(CancelNotification2) { + CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); + })(CancelNotification || (CancelNotification = {})); + var ProgressToken; + (function(ProgressToken2) { + function is(value) { + return typeof value === "string" || typeof value === "number"; + } + ProgressToken2.is = is; + })(ProgressToken = exports.ProgressToken || (exports.ProgressToken = {})); + var ProgressNotification; + (function(ProgressNotification2) { + ProgressNotification2.type = new messages_1.NotificationType("$/progress"); + })(ProgressNotification || (ProgressNotification = {})); + var ProgressType = class { + constructor() { + } + }; + exports.ProgressType = ProgressType; + var StarRequestHandler; + (function(StarRequestHandler2) { + function is(value) { + return Is2.func(value); + } + StarRequestHandler2.is = is; + })(StarRequestHandler || (StarRequestHandler = {})); + exports.NullLogger = Object.freeze({ + error: () => { + }, + warn: () => { + }, + info: () => { + }, + log: () => { + } + }); + var Trace; + (function(Trace2) { + Trace2[Trace2["Off"] = 0] = "Off"; + Trace2[Trace2["Messages"] = 1] = "Messages"; + Trace2[Trace2["Compact"] = 2] = "Compact"; + Trace2[Trace2["Verbose"] = 3] = "Verbose"; + })(Trace = exports.Trace || (exports.Trace = {})); + var TraceValues; + (function(TraceValues2) { + TraceValues2.Off = "off"; + TraceValues2.Messages = "messages"; + TraceValues2.Compact = "compact"; + TraceValues2.Verbose = "verbose"; + })(TraceValues = exports.TraceValues || (exports.TraceValues = {})); + (function(Trace2) { + function fromString(value) { + if (!Is2.string(value)) { + return Trace2.Off; + } + value = value.toLowerCase(); + switch (value) { + case "off": + return Trace2.Off; + case "messages": + return Trace2.Messages; + case "compact": + return Trace2.Compact; + case "verbose": + return Trace2.Verbose; + default: + return Trace2.Off; + } + } + Trace2.fromString = fromString; + function toString(value) { + switch (value) { + case Trace2.Off: + return "off"; + case Trace2.Messages: + return "messages"; + case Trace2.Compact: + return "compact"; + case Trace2.Verbose: + return "verbose"; + default: + return "off"; + } + } + Trace2.toString = toString; + })(Trace = exports.Trace || (exports.Trace = {})); + var TraceFormat; + (function(TraceFormat2) { + TraceFormat2["Text"] = "text"; + TraceFormat2["JSON"] = "json"; + })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); + (function(TraceFormat2) { + function fromString(value) { + if (!Is2.string(value)) { + return TraceFormat2.Text; + } + value = value.toLowerCase(); + if (value === "json") { + return TraceFormat2.JSON; + } else { + return TraceFormat2.Text; + } + } + TraceFormat2.fromString = fromString; + })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); + var SetTraceNotification; + (function(SetTraceNotification2) { + SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); + })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); + var LogTraceNotification; + (function(LogTraceNotification2) { + LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); + })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); + var ConnectionErrors; + (function(ConnectionErrors2) { + ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; + ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; + ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; + })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {})); + var ConnectionError = class extends Error { + constructor(code, message) { + super(message); + this.code = code; + Object.setPrototypeOf(this, ConnectionError.prototype); + } + }; + exports.ConnectionError = ConnectionError; + var ConnectionStrategy; + (function(ConnectionStrategy2) { + function is(value) { + const candidate = value; + return candidate && Is2.func(candidate.cancelUndispatched); + } + ConnectionStrategy2.is = is; + })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); + var CancellationReceiverStrategy; + (function(CancellationReceiverStrategy2) { + CancellationReceiverStrategy2.Message = Object.freeze({ + createCancellationTokenSource(_) { + return new cancellation_1.CancellationTokenSource(); + } + }); + function is(value) { + const candidate = value; + return candidate && Is2.func(candidate.createCancellationTokenSource); + } + CancellationReceiverStrategy2.is = is; + })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {})); + var CancellationSenderStrategy; + (function(CancellationSenderStrategy2) { + CancellationSenderStrategy2.Message = Object.freeze({ + sendCancellation(conn, id) { + return conn.sendNotification(CancelNotification.type, { id }); + }, + cleanup(_) { + } + }); + function is(value) { + const candidate = value; + return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup); + } + CancellationSenderStrategy2.is = is; + })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {})); + var CancellationStrategy; + (function(CancellationStrategy2) { + CancellationStrategy2.Message = Object.freeze({ + receiver: CancellationReceiverStrategy.Message, + sender: CancellationSenderStrategy.Message + }); + function is(value) { + const candidate = value; + return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); + } + CancellationStrategy2.is = is; + })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {})); + var ConnectionOptions; + (function(ConnectionOptions2) { + function is(value) { + const candidate = value; + return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); + } + ConnectionOptions2.is = is; + })(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {})); + var ConnectionState; + (function(ConnectionState2) { + ConnectionState2[ConnectionState2["New"] = 1] = "New"; + ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; + ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; + ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; + })(ConnectionState || (ConnectionState = {})); + function createMessageConnection(messageReader, messageWriter, _logger, options2) { + const logger2 = _logger !== void 0 ? _logger : exports.NullLogger; + let sequenceNumber = 0; + let notificationSequenceNumber = 0; + let unknownResponseSequenceNumber = 0; + const version = "2.0"; + let starRequestHandler = void 0; + const requestHandlers = /* @__PURE__ */ new Map(); + let starNotificationHandler = void 0; + const notificationHandlers = /* @__PURE__ */ new Map(); + const progressHandlers = /* @__PURE__ */ new Map(); + let timer; + let messageQueue = new linkedMap_1.LinkedMap(); + let responsePromises = /* @__PURE__ */ new Map(); + let knownCanceledRequests = /* @__PURE__ */ new Set(); + let requestTokens = /* @__PURE__ */ new Map(); + let trace = Trace.Off; + let traceFormat = TraceFormat.Text; + let tracer; + let state = ConnectionState.New; + const errorEmitter = new events_1.Emitter(); + const closeEmitter = new events_1.Emitter(); + const unhandledNotificationEmitter = new events_1.Emitter(); + const unhandledProgressEmitter = new events_1.Emitter(); + const disposeEmitter = new events_1.Emitter(); + const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message; + function createRequestQueueKey(id) { + if (id === null) { + throw new Error(`Can't send requests with id null since the response can't be correlated.`); + } + return "req-" + id.toString(); + } + function createResponseQueueKey(id) { + if (id === null) { + return "res-unknown-" + (++unknownResponseSequenceNumber).toString(); + } else { + return "res-" + id.toString(); + } + } + function createNotificationQueueKey() { + return "not-" + (++notificationSequenceNumber).toString(); + } + function addMessageToQueue(queue, message) { + if (messages_1.Message.isRequest(message)) { + queue.set(createRequestQueueKey(message.id), message); + } else if (messages_1.Message.isResponse(message)) { + queue.set(createResponseQueueKey(message.id), message); + } else { + queue.set(createNotificationQueueKey(), message); + } + } + function cancelUndispatched(_message) { + return void 0; + } + function isListening() { + return state === ConnectionState.Listening; + } + function isClosed() { + return state === ConnectionState.Closed; + } + function isDisposed() { + return state === ConnectionState.Disposed; + } + function closeHandler() { + if (state === ConnectionState.New || state === ConnectionState.Listening) { + state = ConnectionState.Closed; + closeEmitter.fire(void 0); + } + } + function readErrorHandler(error) { + errorEmitter.fire([error, void 0, void 0]); + } + function writeErrorHandler(data) { + errorEmitter.fire(data); + } + messageReader.onClose(closeHandler); + messageReader.onError(readErrorHandler); + messageWriter.onClose(closeHandler); + messageWriter.onError(writeErrorHandler); + function triggerMessageQueue() { + if (timer || messageQueue.size === 0) { + return; + } + timer = (0, ral_1.default)().timer.setImmediate(() => { + timer = void 0; + processMessageQueue(); + }); + } + function processMessageQueue() { + if (messageQueue.size === 0) { + return; + } + const message = messageQueue.shift(); + try { + if (messages_1.Message.isRequest(message)) { + handleRequest(message); + } else if (messages_1.Message.isNotification(message)) { + handleNotification(message); + } else if (messages_1.Message.isResponse(message)) { + handleResponse(message); + } else { + handleInvalidMessage(message); + } + } finally { + triggerMessageQueue(); + } + } + const callback = (message) => { + try { + if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) { + const cancelId = message.params.id; + const key = createRequestQueueKey(cancelId); + const toCancel = messageQueue.get(key); + if (messages_1.Message.isRequest(toCancel)) { + const strategy = options2 == null ? void 0 : options2.connectionStrategy; + const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); + if (response && (response.error !== void 0 || response.result !== void 0)) { + messageQueue.delete(key); + requestTokens.delete(cancelId); + response.id = toCancel.id; + traceSendingResponse(response, message.method, Date.now()); + messageWriter.write(response).catch(() => logger2.error(`Sending response for canceled message failed.`)); + return; + } + } + const cancellationToken = requestTokens.get(cancelId); + if (cancellationToken !== void 0) { + cancellationToken.cancel(); + traceReceivedNotification(message); + return; + } else { + knownCanceledRequests.add(cancelId); + } + } + addMessageToQueue(messageQueue, message); + } finally { + triggerMessageQueue(); + } + }; + function handleRequest(requestMessage) { + if (isDisposed()) { + return; + } + function reply(resultOrError, method, startTime2) { + const message = { + jsonrpc: version, + id: requestMessage.id + }; + if (resultOrError instanceof messages_1.ResponseError) { + message.error = resultOrError.toJson(); + } else { + message.result = resultOrError === void 0 ? null : resultOrError; + } + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger2.error(`Sending response failed.`)); + } + function replyError(error, method, startTime2) { + const message = { + jsonrpc: version, + id: requestMessage.id, + error: error.toJson() + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger2.error(`Sending response failed.`)); + } + function replySuccess(result, method, startTime2) { + if (result === void 0) { + result = null; + } + const message = { + jsonrpc: version, + id: requestMessage.id, + result + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger2.error(`Sending response failed.`)); + } + traceReceivedRequest(requestMessage); + const element = requestHandlers.get(requestMessage.method); + let type; + let requestHandler; + if (element) { + type = element.type; + requestHandler = element.handler; + } + const startTime = Date.now(); + if (requestHandler || starRequestHandler) { + const tokenKey = requestMessage.id ?? String(Date.now()); + const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); + if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { + cancellationSource.cancel(); + } + if (requestMessage.id !== null) { + requestTokens.set(tokenKey, cancellationSource); + } + try { + let handlerResult; + if (requestHandler) { + if (requestMessage.params === void 0) { + if (type !== void 0 && type.numberOfParams !== 0) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but received none.`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(cancellationSource.token); + } else if (Array.isArray(requestMessage.params)) { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); + } else { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(requestMessage.params, cancellationSource.token); + } + } else if (starRequestHandler) { + handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); + } + const promise = handlerResult; + if (!handlerResult) { + requestTokens.delete(tokenKey); + replySuccess(handlerResult, requestMessage.method, startTime); + } else if (promise.then) { + promise.then((resultOrError) => { + requestTokens.delete(tokenKey); + reply(resultOrError, requestMessage.method, startTime); + }, (error) => { + requestTokens.delete(tokenKey); + if (error instanceof messages_1.ResponseError) { + replyError(error, requestMessage.method, startTime); + } else if (error && Is2.string(error.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + }); + } else { + requestTokens.delete(tokenKey); + reply(handlerResult, requestMessage.method, startTime); + } + } catch (error) { + requestTokens.delete(tokenKey); + if (error instanceof messages_1.ResponseError) { + reply(error, requestMessage.method, startTime); + } else if (error && Is2.string(error.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + } + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); + } + } + function handleResponse(responseMessage) { + if (isDisposed()) { + return; + } + if (responseMessage.id === null) { + if (responseMessage.error) { + logger2.error(`Received response message without id: Error is: +${JSON.stringify(responseMessage.error, void 0, 4)}`); + } else { + logger2.error(`Received response message without id. No further error information provided.`); + } + } else { + const key = responseMessage.id; + const responsePromise = responsePromises.get(key); + traceReceivedResponse(responseMessage, responsePromise); + if (responsePromise !== void 0) { + responsePromises.delete(key); + try { + if (responseMessage.error) { + const error = responseMessage.error; + responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); + } else if (responseMessage.result !== void 0) { + responsePromise.resolve(responseMessage.result); + } else { + throw new Error("Should never happen."); + } + } catch (error) { + if (error.message) { + logger2.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); + } else { + logger2.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); + } + } + } + } + } + function handleNotification(message) { + if (isDisposed()) { + return; + } + let type = void 0; + let notificationHandler; + if (message.method === CancelNotification.type.method) { + const cancelId = message.params.id; + knownCanceledRequests.delete(cancelId); + traceReceivedNotification(message); + return; + } else { + const element = notificationHandlers.get(message.method); + if (element) { + notificationHandler = element.handler; + type = element.type; + } + } + if (notificationHandler || starNotificationHandler) { + try { + traceReceivedNotification(message); + if (notificationHandler) { + if (message.params === void 0) { + if (type !== void 0) { + if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { + logger2.error(`Notification ${message.method} defines ${type.numberOfParams} params but received none.`); + } + } + notificationHandler(); + } else if (Array.isArray(message.params)) { + const params = message.params; + if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) { + notificationHandler({ token: params[0], value: params[1] }); + } else { + if (type !== void 0) { + if (type.parameterStructures === messages_1.ParameterStructures.byName) { + logger2.error(`Notification ${message.method} defines parameters by name but received parameters by position`); + } + if (type.numberOfParams !== message.params.length) { + logger2.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${params.length} arguments`); + } + } + notificationHandler(...params); + } + } else { + if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) { + logger2.error(`Notification ${message.method} defines parameters by position but received parameters by name`); + } + notificationHandler(message.params); + } + } else if (starNotificationHandler) { + starNotificationHandler(message.method, message.params); + } + } catch (error) { + if (error.message) { + logger2.error(`Notification handler '${message.method}' failed with message: ${error.message}`); + } else { + logger2.error(`Notification handler '${message.method}' failed unexpectedly.`); + } + } + } else { + unhandledNotificationEmitter.fire(message); + } + } + function handleInvalidMessage(message) { + if (!message) { + logger2.error("Received empty message."); + return; + } + logger2.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(message, null, 4)}`); + const responseMessage = message; + if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) { + const key = responseMessage.id; + const responseHandler = responsePromises.get(key); + if (responseHandler) { + responseHandler.reject(new Error("The received response has neither a result nor an error property.")); + } + } + } + function stringifyTrace(params) { + if (params === void 0 || params === null) { + return void 0; + } + switch (trace) { + case Trace.Verbose: + return JSON.stringify(params, null, 4); + case Trace.Compact: + return JSON.stringify(params); + default: + return void 0; + } + } + function traceSendingRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { + data = `Params: ${stringifyTrace(message.params)} + +`; + } + tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); + } else { + logLSPMessage("send-request", message); + } + } + function traceSendingNotification(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.params) { + data = `Params: ${stringifyTrace(message.params)} + +`; + } else { + data = "No parameters provided.\n\n"; + } + } + tracer.log(`Sending notification '${message.method}'.`, data); + } else { + logLSPMessage("send-notification", message); + } + } + function traceSendingResponse(message, method, startTime) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.error && message.error.data) { + data = `Error data: ${stringifyTrace(message.error.data)} + +`; + } else { + if (message.result) { + data = `Result: ${stringifyTrace(message.result)} + +`; + } else if (message.error === void 0) { + data = "No result returned.\n\n"; + } + } + } + tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); + } else { + logLSPMessage("send-response", message); + } + } + function traceReceivedRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { + data = `Params: ${stringifyTrace(message.params)} + +`; + } + tracer.log(`Received request '${message.method} - (${message.id})'.`, data); + } else { + logLSPMessage("receive-request", message); + } + } + function traceReceivedNotification(message) { + if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.params) { + data = `Params: ${stringifyTrace(message.params)} + +`; + } else { + data = "No parameters provided.\n\n"; + } + } + tracer.log(`Received notification '${message.method}'.`, data); + } else { + logLSPMessage("receive-notification", message); + } + } + function traceReceivedResponse(message, responsePromise) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.error && message.error.data) { + data = `Error data: ${stringifyTrace(message.error.data)} + +`; + } else { + if (message.result) { + data = `Result: ${stringifyTrace(message.result)} + +`; + } else if (message.error === void 0) { + data = "No result returned.\n\n"; + } + } + } + if (responsePromise) { + const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; + tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); + } else { + tracer.log(`Received response ${message.id} without active response promise.`, data); + } + } else { + logLSPMessage("receive-response", message); + } + } + function logLSPMessage(type, message) { + if (!tracer || trace === Trace.Off) { + return; + } + const lspMessage = { + isLSPMessage: true, + type, + message, + timestamp: Date.now() + }; + tracer.log(lspMessage); + } + function throwIfClosedOrDisposed() { + if (isClosed()) { + throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); + } + if (isDisposed()) { + throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); + } + } + function throwIfListening() { + if (isListening()) { + throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); + } + } + function throwIfNotListening() { + if (!isListening()) { + throw new Error("Call listen() first."); + } + } + function undefinedToNull(param) { + if (param === void 0) { + return null; + } else { + return param; + } + } + function nullToUndefined(param) { + if (param === null) { + return void 0; + } else { + return param; + } + } + function isNamedParam(param) { + return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; + } + function computeSingleParam(parameterStructures, param) { + switch (parameterStructures) { + case messages_1.ParameterStructures.auto: + if (isNamedParam(param)) { + return nullToUndefined(param); + } else { + return [undefinedToNull(param)]; + } + case messages_1.ParameterStructures.byName: + if (!isNamedParam(param)) { + throw new Error(`Received parameters by name but param is not an object literal.`); + } + return nullToUndefined(param); + case messages_1.ParameterStructures.byPosition: + return [undefinedToNull(param)]; + default: + throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); + } + } + function computeMessageParams(type, params) { + let result; + const numberOfParams = type.numberOfParams; + switch (numberOfParams) { + case 0: + result = void 0; + break; + case 1: + result = computeSingleParam(type.parameterStructures, params[0]); + break; + default: + result = []; + for (let i = 0; i < params.length && i < numberOfParams; i++) { + result.push(undefinedToNull(params[i])); + } + if (params.length < numberOfParams) { + for (let i = params.length; i < numberOfParams; i++) { + result.push(null); + } + } + break; + } + return result; + } + const connection = { + sendNotification: (type, ...args) => { + throwIfClosedOrDisposed(); + let method; + let messageParams; + if (Is2.string(type)) { + method = type; + const first = args[0]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first)) { + paramStart = 1; + parameterStructures = first; + } + let paramEnd = args.length; + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); + break; + } + } else { + const params = args; + method = type.method; + messageParams = computeMessageParams(type, params); + } + const notificationMessage = { + jsonrpc: version, + method, + params: messageParams + }; + traceSendingNotification(notificationMessage); + return messageWriter.write(notificationMessage).catch(() => logger2.error(`Sending notification failed.`)); + }, + onNotification: (type, handler) => { + throwIfClosedOrDisposed(); + let method; + if (Is2.func(type)) { + starNotificationHandler = type; + } else if (handler) { + if (Is2.string(type)) { + method = type; + notificationHandlers.set(type, { type: void 0, handler }); + } else { + method = type.method; + notificationHandlers.set(type.method, { type, handler }); + } + } + return { + dispose: () => { + if (method !== void 0) { + notificationHandlers.delete(method); + } else { + starNotificationHandler = void 0; + } + } + }; + }, + onProgress: (_type, token, handler) => { + if (progressHandlers.has(token)) { + throw new Error(`Progress handler for token ${token} already registered`); + } + progressHandlers.set(token, handler); + return { + dispose: () => { + progressHandlers.delete(token); + } + }; + }, + sendProgress: (_type, token, value) => { + return connection.sendNotification(ProgressNotification.type, { token, value }); + }, + onUnhandledProgress: unhandledProgressEmitter.event, + sendRequest: (type, ...args) => { + throwIfClosedOrDisposed(); + throwIfNotListening(); + let method; + let messageParams; + let token = void 0; + if (Is2.string(type)) { + method = type; + const first = args[0]; + const last = args[args.length - 1]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first)) { + paramStart = 1; + parameterStructures = first; + } + let paramEnd = args.length; + if (cancellation_1.CancellationToken.is(last)) { + paramEnd = paramEnd - 1; + token = last; + } + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value)); + break; + } + } else { + const params = args; + method = type.method; + messageParams = computeMessageParams(type, params); + const numberOfParams = type.numberOfParams; + token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; + } + const id = sequenceNumber++; + let disposable; + if (token) { + disposable = token.onCancellationRequested(() => { + const p = cancellationStrategy.sender.sendCancellation(connection, id); + if (p === void 0) { + logger2.log(`Received no promise from cancellation strategy when cancelling id ${id}`); + return Promise.resolve(); + } else { + return p.catch(() => { + logger2.log(`Sending cancellation messages for id ${id} failed`); + }); + } + }); + } + const result = new Promise((resolve9, reject) => { + const requestMessage = { + jsonrpc: version, + id, + method, + params: messageParams + }; + const resolveWithCleanup = (r) => { + resolve9(r); + cancellationStrategy.sender.cleanup(id); + disposable == null ? void 0 : disposable.dispose(); + }; + const rejectWithCleanup = (r) => { + reject(r); + cancellationStrategy.sender.cleanup(id); + disposable == null ? void 0 : disposable.dispose(); + }; + let responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; + traceSendingRequest(requestMessage); + try { + messageWriter.write(requestMessage).catch(() => logger2.error(`Sending request failed.`)); + } catch (e) { + responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason")); + responsePromise = null; + } + if (responsePromise) { + responsePromises.set(id, responsePromise); + } + }); + return result; + }, + onRequest: (type, handler) => { + throwIfClosedOrDisposed(); + let method = null; + if (StarRequestHandler.is(type)) { + method = void 0; + starRequestHandler = type; + } else if (Is2.string(type)) { + method = null; + if (handler !== void 0) { + method = type; + requestHandlers.set(type, { handler, type: void 0 }); + } + } else { + if (handler !== void 0) { + method = type.method; + requestHandlers.set(type.method, { type, handler }); + } + } + return { + dispose: () => { + if (method === null) { + return; + } + if (method !== void 0) { + requestHandlers.delete(method); + } else { + starRequestHandler = void 0; + } + } + }; + }, + hasPendingResponse: () => { + return responsePromises.size > 0; + }, + trace: async (_value, _tracer, sendNotificationOrTraceOptions) => { + let _sendNotification = false; + let _traceFormat = TraceFormat.Text; + if (sendNotificationOrTraceOptions !== void 0) { + if (Is2.boolean(sendNotificationOrTraceOptions)) { + _sendNotification = sendNotificationOrTraceOptions; + } else { + _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; + _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; + } + } + trace = _value; + traceFormat = _traceFormat; + if (trace === Trace.Off) { + tracer = void 0; + } else { + tracer = _tracer; + } + if (_sendNotification && !isClosed() && !isDisposed()) { + await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); + } + }, + onError: errorEmitter.event, + onClose: closeEmitter.event, + onUnhandledNotification: unhandledNotificationEmitter.event, + onDispose: disposeEmitter.event, + end: () => { + messageWriter.end(); + }, + dispose: () => { + if (isDisposed()) { + return; + } + state = ConnectionState.Disposed; + disposeEmitter.fire(void 0); + const error = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed"); + for (const promise of responsePromises.values()) { + promise.reject(error); + } + responsePromises = /* @__PURE__ */ new Map(); + requestTokens = /* @__PURE__ */ new Map(); + knownCanceledRequests = /* @__PURE__ */ new Set(); + messageQueue = new linkedMap_1.LinkedMap(); + if (Is2.func(messageWriter.dispose)) { + messageWriter.dispose(); + } + if (Is2.func(messageReader.dispose)) { + messageReader.dispose(); + } + }, + listen: () => { + throwIfClosedOrDisposed(); + throwIfListening(); + state = ConnectionState.Listening; + messageReader.listen(callback); + }, + inspect: () => { + (0, ral_1.default)().console.log("inspect"); + } + }; + connection.onNotification(LogTraceNotification.type, (params) => { + if (trace === Trace.Off || !tracer) { + return; + } + const verbose = trace === Trace.Verbose || trace === Trace.Compact; + tracer.log(params.message, verbose ? params.verbose : void 0); + }); + connection.onNotification(ProgressNotification.type, (params) => { + const handler = progressHandlers.get(params.token); + if (handler) { + handler(params.value); + } else { + unhandledProgressEmitter.fire(params); + } + }); + return connection; + } + exports.createMessageConnection = createMessageConnection; + } +}); + +// node_modules/vscode-jsonrpc/lib/common/api.js +var require_api = __commonJS({ + "node_modules/vscode-jsonrpc/lib/common/api.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TraceFormat = exports.TraceValues = exports.Trace = exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0; + exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = void 0; + var messages_1 = require_messages(); + Object.defineProperty(exports, "Message", { enumerable: true, get: function() { + return messages_1.Message; + } }); + Object.defineProperty(exports, "RequestType", { enumerable: true, get: function() { + return messages_1.RequestType; + } }); + Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function() { + return messages_1.RequestType0; + } }); + Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function() { + return messages_1.RequestType1; + } }); + Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function() { + return messages_1.RequestType2; + } }); + Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function() { + return messages_1.RequestType3; + } }); + Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function() { + return messages_1.RequestType4; + } }); + Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function() { + return messages_1.RequestType5; + } }); + Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function() { + return messages_1.RequestType6; + } }); + Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function() { + return messages_1.RequestType7; + } }); + Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function() { + return messages_1.RequestType8; + } }); + Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function() { + return messages_1.RequestType9; + } }); + Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function() { + return messages_1.ResponseError; + } }); + Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function() { + return messages_1.ErrorCodes; + } }); + Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function() { + return messages_1.NotificationType; + } }); + Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function() { + return messages_1.NotificationType0; + } }); + Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function() { + return messages_1.NotificationType1; + } }); + Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function() { + return messages_1.NotificationType2; + } }); + Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function() { + return messages_1.NotificationType3; + } }); + Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function() { + return messages_1.NotificationType4; + } }); + Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function() { + return messages_1.NotificationType5; + } }); + Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function() { + return messages_1.NotificationType6; + } }); + Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function() { + return messages_1.NotificationType7; + } }); + Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function() { + return messages_1.NotificationType8; + } }); + Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function() { + return messages_1.NotificationType9; + } }); + Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function() { + return messages_1.ParameterStructures; + } }); + var linkedMap_1 = require_linkedMap(); + Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function() { + return linkedMap_1.LinkedMap; + } }); + Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function() { + return linkedMap_1.LRUCache; + } }); + Object.defineProperty(exports, "Touch", { enumerable: true, get: function() { + return linkedMap_1.Touch; + } }); + var disposable_1 = require_disposable(); + Object.defineProperty(exports, "Disposable", { enumerable: true, get: function() { + return disposable_1.Disposable; + } }); + var events_1 = require_events(); + Object.defineProperty(exports, "Event", { enumerable: true, get: function() { + return events_1.Event; + } }); + Object.defineProperty(exports, "Emitter", { enumerable: true, get: function() { + return events_1.Emitter; + } }); + var cancellation_1 = require_cancellation(); + Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function() { + return cancellation_1.CancellationTokenSource; + } }); + Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function() { + return cancellation_1.CancellationToken; + } }); + var messageReader_1 = require_messageReader(); + Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function() { + return messageReader_1.MessageReader; + } }); + Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function() { + return messageReader_1.AbstractMessageReader; + } }); + Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function() { + return messageReader_1.ReadableStreamMessageReader; + } }); + var messageWriter_1 = require_messageWriter(); + Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function() { + return messageWriter_1.MessageWriter; + } }); + Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function() { + return messageWriter_1.AbstractMessageWriter; + } }); + Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function() { + return messageWriter_1.WriteableStreamMessageWriter; + } }); + var connection_1 = require_connection(); + Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function() { + return connection_1.ConnectionStrategy; + } }); + Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function() { + return connection_1.ConnectionOptions; + } }); + Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function() { + return connection_1.NullLogger; + } }); + Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function() { + return connection_1.createMessageConnection; + } }); + Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function() { + return connection_1.ProgressToken; + } }); + Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function() { + return connection_1.ProgressType; + } }); + Object.defineProperty(exports, "Trace", { enumerable: true, get: function() { + return connection_1.Trace; + } }); + Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function() { + return connection_1.TraceValues; + } }); + Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function() { + return connection_1.TraceFormat; + } }); + Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function() { + return connection_1.SetTraceNotification; + } }); + Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function() { + return connection_1.LogTraceNotification; + } }); + Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function() { + return connection_1.ConnectionErrors; + } }); + Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function() { + return connection_1.ConnectionError; + } }); + Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function() { + return connection_1.CancellationReceiverStrategy; + } }); + Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function() { + return connection_1.CancellationSenderStrategy; + } }); + Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function() { + return connection_1.CancellationStrategy; + } }); + var ral_1 = require_ral(); + exports.RAL = ral_1.default; + } +}); + +// node_modules/vscode-jsonrpc/lib/node/main.js +var require_main = __commonJS({ + "node_modules/vscode-jsonrpc/lib/node/main.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0; + var ril_1 = require_ril(); + ril_1.default.install(); + var api_1 = require_api(); + var path18 = require("path"); + var os4 = require("os"); + var crypto_1 = require("crypto"); + var net_1 = require("net"); + __exportStar(require_api(), exports); + var IPCMessageReader = class extends api_1.AbstractMessageReader { + constructor(process2) { + super(); + this.process = process2; + let eventEmitter = this.process; + eventEmitter.on("error", (error) => this.fireError(error)); + eventEmitter.on("close", () => this.fireClose()); + } + listen(callback) { + this.process.on("message", callback); + return api_1.Disposable.create(() => this.process.off("message", callback)); + } + }; + exports.IPCMessageReader = IPCMessageReader; + var IPCMessageWriter = class extends api_1.AbstractMessageWriter { + constructor(process2) { + super(); + this.process = process2; + this.errorCount = 0; + let eventEmitter = this.process; + eventEmitter.on("error", (error) => this.fireError(error)); + eventEmitter.on("close", () => this.fireClose); + } + write(msg) { + try { + if (typeof this.process.send === "function") { + this.process.send(msg, void 0, void 0, (error) => { + if (error) { + this.errorCount++; + this.handleError(error, msg); + } else { + this.errorCount = 0; + } + }); + } + return Promise.resolve(); + } catch (error) { + this.handleError(error, msg); + return Promise.reject(error); + } + } + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); + } + end() { + } + }; + exports.IPCMessageWriter = IPCMessageWriter; + var SocketMessageReader = class extends api_1.ReadableStreamMessageReader { + constructor(socket, encoding = "utf-8") { + super((0, ril_1.default)().stream.asReadableStream(socket), encoding); + } + }; + exports.SocketMessageReader = SocketMessageReader; + var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter { + constructor(socket, options2) { + super((0, ril_1.default)().stream.asWritableStream(socket), options2); + this.socket = socket; + } + dispose() { + super.dispose(); + this.socket.destroy(); + } + }; + exports.SocketMessageWriter = SocketMessageWriter; + var StreamMessageReader = class extends api_1.ReadableStreamMessageReader { + constructor(readble, encoding) { + super((0, ril_1.default)().stream.asReadableStream(readble), encoding); + } + }; + exports.StreamMessageReader = StreamMessageReader; + var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter { + constructor(writable, options2) { + super((0, ril_1.default)().stream.asWritableStream(writable), options2); + } + }; + exports.StreamMessageWriter = StreamMessageWriter; + var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"]; + var safeIpcPathLengths = /* @__PURE__ */ new Map([ + ["linux", 107], + ["darwin", 103] + ]); + function generateRandomPipeName() { + const randomSuffix = (0, crypto_1.randomBytes)(21).toString("hex"); + if (process.platform === "win32") { + return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; + } + let result; + if (XDG_RUNTIME_DIR) { + result = path18.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); + } else { + result = path18.join(os4.tmpdir(), `vscode-${randomSuffix}.sock`); + } + const limit = safeIpcPathLengths.get(process.platform); + if (limit !== void 0 && result.length >= limit) { + (0, ril_1.default)().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); + } + return result; + } + exports.generateRandomPipeName = generateRandomPipeName; + function createClientPipeTransport(pipeName, encoding = "utf-8") { + let connectResolve; + const connected = new Promise((resolve9, _reject) => { + connectResolve = resolve9; + }); + return new Promise((resolve9, reject) => { + let server = (0, net_1.createServer)((socket) => { + server.close(); + connectResolve([ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]); + }); + server.on("error", reject); + server.listen(pipeName, () => { + server.removeListener("error", reject); + resolve9({ + onConnected: () => { + return connected; + } + }); + }); + }); + } + exports.createClientPipeTransport = createClientPipeTransport; + function createServerPipeTransport(pipeName, encoding = "utf-8") { + const socket = (0, net_1.createConnection)(pipeName); + return [ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]; + } + exports.createServerPipeTransport = createServerPipeTransport; + function createClientSocketTransport(port, encoding = "utf-8") { + let connectResolve; + const connected = new Promise((resolve9, _reject) => { + connectResolve = resolve9; + }); + return new Promise((resolve9, reject) => { + const server = (0, net_1.createServer)((socket) => { + server.close(); + connectResolve([ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]); + }); + server.on("error", reject); + server.listen(port, "127.0.0.1", () => { + server.removeListener("error", reject); + resolve9({ + onConnected: () => { + return connected; + } + }); + }); + }); + } + exports.createClientSocketTransport = createClientSocketTransport; + function createServerSocketTransport(port, encoding = "utf-8") { + const socket = (0, net_1.createConnection)(port, "127.0.0.1"); + return [ + new SocketMessageReader(socket, encoding), + new SocketMessageWriter(socket, encoding) + ]; + } + exports.createServerSocketTransport = createServerSocketTransport; + function isReadableStream(value) { + const candidate = value; + return candidate.read !== void 0 && candidate.addListener !== void 0; + } + function isWritableStream(value) { + const candidate = value; + return candidate.write !== void 0 && candidate.addListener !== void 0; + } + function createMessageConnection(input, output, logger2, options2) { + if (!logger2) { + logger2 = api_1.NullLogger; + } + const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; + const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; + if (api_1.ConnectionStrategy.is(options2)) { + options2 = { connectionStrategy: options2 }; + } + return (0, api_1.createMessageConnection)(reader, writer, logger2, options2); + } + exports.createMessageConnection = createMessageConnection; + } +}); + +// node_modules/vscode-jsonrpc/node.js +var require_node = __commonJS({ + "node_modules/vscode-jsonrpc/node.js"(exports, module2) { + "use strict"; + module2.exports = require_main(); + } +}); + +// node_modules/vscode-languageserver-types/lib/esm/main.js +var main_exports = {}; +__export(main_exports, { + AnnotatedTextEdit: () => AnnotatedTextEdit, + ChangeAnnotation: () => ChangeAnnotation, + ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier, + CodeAction: () => CodeAction, + CodeActionContext: () => CodeActionContext, + CodeActionKind: () => CodeActionKind, + CodeActionTriggerKind: () => CodeActionTriggerKind, + CodeDescription: () => CodeDescription, + CodeLens: () => CodeLens, + Color: () => Color, + ColorInformation: () => ColorInformation, + ColorPresentation: () => ColorPresentation, + Command: () => Command, + CompletionItem: () => CompletionItem, + CompletionItemKind: () => CompletionItemKind, + CompletionItemLabelDetails: () => CompletionItemLabelDetails, + CompletionItemTag: () => CompletionItemTag, + CompletionList: () => CompletionList, + CreateFile: () => CreateFile, + DeleteFile: () => DeleteFile, + Diagnostic: () => Diagnostic, + DiagnosticRelatedInformation: () => DiagnosticRelatedInformation, + DiagnosticSeverity: () => DiagnosticSeverity, + DiagnosticTag: () => DiagnosticTag, + DocumentHighlight: () => DocumentHighlight, + DocumentHighlightKind: () => DocumentHighlightKind, + DocumentLink: () => DocumentLink, + DocumentSymbol: () => DocumentSymbol, + DocumentUri: () => DocumentUri, + EOL: () => EOL, + FoldingRange: () => FoldingRange, + FoldingRangeKind: () => FoldingRangeKind, + FormattingOptions: () => FormattingOptions, + Hover: () => Hover, + InlayHint: () => InlayHint, + InlayHintKind: () => InlayHintKind, + InlayHintLabelPart: () => InlayHintLabelPart, + InlineValueContext: () => InlineValueContext, + InlineValueEvaluatableExpression: () => InlineValueEvaluatableExpression, + InlineValueText: () => InlineValueText, + InlineValueVariableLookup: () => InlineValueVariableLookup, + InsertReplaceEdit: () => InsertReplaceEdit, + InsertTextFormat: () => InsertTextFormat, + InsertTextMode: () => InsertTextMode, + Location: () => Location, + LocationLink: () => LocationLink, + MarkedString: () => MarkedString, + MarkupContent: () => MarkupContent, + MarkupKind: () => MarkupKind, + OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier, + ParameterInformation: () => ParameterInformation, + Position: () => Position, + Range: () => Range, + RenameFile: () => RenameFile, + SelectionRange: () => SelectionRange, + SemanticTokenModifiers: () => SemanticTokenModifiers, + SemanticTokenTypes: () => SemanticTokenTypes, + SemanticTokens: () => SemanticTokens, + SignatureInformation: () => SignatureInformation, + SymbolInformation: () => SymbolInformation, + SymbolKind: () => SymbolKind, + SymbolTag: () => SymbolTag, + TextDocument: () => TextDocument, + TextDocumentEdit: () => TextDocumentEdit, + TextDocumentIdentifier: () => TextDocumentIdentifier, + TextDocumentItem: () => TextDocumentItem, + TextEdit: () => TextEdit, + URI: () => URI, + VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier, + WorkspaceChange: () => WorkspaceChange, + WorkspaceEdit: () => WorkspaceEdit, + WorkspaceFolder: () => WorkspaceFolder, + WorkspaceSymbol: () => WorkspaceSymbol, + integer: () => integer, + uinteger: () => uinteger +}); +var DocumentUri, URI, integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is; +var init_main = __esm({ + "node_modules/vscode-languageserver-types/lib/esm/main.js"() { + "use strict"; + (function(DocumentUri2) { + function is(value) { + return typeof value === "string"; + } + DocumentUri2.is = is; + })(DocumentUri || (DocumentUri = {})); + (function(URI2) { + function is(value) { + return typeof value === "string"; + } + URI2.is = is; + })(URI || (URI = {})); + (function(integer2) { + integer2.MIN_VALUE = -2147483648; + integer2.MAX_VALUE = 2147483647; + function is(value) { + return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE; + } + integer2.is = is; + })(integer || (integer = {})); + (function(uinteger2) { + uinteger2.MIN_VALUE = 0; + uinteger2.MAX_VALUE = 2147483647; + function is(value) { + return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE; + } + uinteger2.is = is; + })(uinteger || (uinteger = {})); + (function(Position9) { + function create(line, character) { + if (line === Number.MAX_VALUE) { + line = uinteger.MAX_VALUE; + } + if (character === Number.MAX_VALUE) { + character = uinteger.MAX_VALUE; + } + return { line, character }; + } + Position9.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); + } + Position9.is = is; + })(Position || (Position = {})); + (function(Range11) { + function create(one, two, three, four) { + if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { + return { start: Position.create(one, two), end: Position.create(three, four) }; + } else if (Position.is(one) && Position.is(two)) { + return { start: one, end: two }; + } else { + throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]")); + } + } + Range11.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); + } + Range11.is = is; + })(Range || (Range = {})); + (function(Location6) { + function create(uri, range) { + return { uri, range }; + } + Location6.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); + } + Location6.is = is; + })(Location || (Location = {})); + (function(LocationLink2) { + function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { + return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; + } + LocationLink2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); + } + LocationLink2.is = is; + })(LocationLink || (LocationLink = {})); + (function(Color2) { + function create(red, green, blue, alpha) { + return { + red, + green, + blue, + alpha + }; + } + Color2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); + } + Color2.is = is; + })(Color || (Color = {})); + (function(ColorInformation2) { + function create(range, color) { + return { + range, + color + }; + } + ColorInformation2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color); + } + ColorInformation2.is = is; + })(ColorInformation || (ColorInformation = {})); + (function(ColorPresentation2) { + function create(label, textEdit, additionalTextEdits) { + return { + label, + textEdit, + additionalTextEdits + }; + } + ColorPresentation2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); + } + ColorPresentation2.is = is; + })(ColorPresentation || (ColorPresentation = {})); + (function(FoldingRangeKind2) { + FoldingRangeKind2.Comment = "comment"; + FoldingRangeKind2.Imports = "imports"; + FoldingRangeKind2.Region = "region"; + })(FoldingRangeKind || (FoldingRangeKind = {})); + (function(FoldingRange2) { + function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { + var result = { + startLine, + endLine + }; + if (Is.defined(startCharacter)) { + result.startCharacter = startCharacter; + } + if (Is.defined(endCharacter)) { + result.endCharacter = endCharacter; + } + if (Is.defined(kind)) { + result.kind = kind; + } + if (Is.defined(collapsedText)) { + result.collapsedText = collapsedText; + } + return result; + } + FoldingRange2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); + } + FoldingRange2.is = is; + })(FoldingRange || (FoldingRange = {})); + (function(DiagnosticRelatedInformation2) { + function create(location, message) { + return { + location, + message + }; + } + DiagnosticRelatedInformation2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); + } + DiagnosticRelatedInformation2.is = is; + })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); + (function(DiagnosticSeverity3) { + DiagnosticSeverity3.Error = 1; + DiagnosticSeverity3.Warning = 2; + DiagnosticSeverity3.Information = 3; + DiagnosticSeverity3.Hint = 4; + })(DiagnosticSeverity || (DiagnosticSeverity = {})); + (function(DiagnosticTag2) { + DiagnosticTag2.Unnecessary = 1; + DiagnosticTag2.Deprecated = 2; + })(DiagnosticTag || (DiagnosticTag = {})); + (function(CodeDescription2) { + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.string(candidate.href); + } + CodeDescription2.is = is; + })(CodeDescription || (CodeDescription = {})); + (function(Diagnostic5) { + function create(range, message, severity, code, source, relatedInformation) { + var result = { range, message }; + if (Is.defined(severity)) { + result.severity = severity; + } + if (Is.defined(code)) { + result.code = code; + } + if (Is.defined(source)) { + result.source = source; + } + if (Is.defined(relatedInformation)) { + result.relatedInformation = relatedInformation; + } + return result; + } + Diagnostic5.create = create; + function is(value) { + var _a; + var candidate = value; + return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); + } + Diagnostic5.is = is; + })(Diagnostic || (Diagnostic = {})); + (function(Command7) { + function create(title, command) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var result = { title, command }; + if (Is.defined(args) && args.length > 0) { + result.arguments = args; + } + return result; + } + Command7.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); + } + Command7.is = is; + })(Command || (Command = {})); + (function(TextEdit3) { + function replace(range, newText) { + return { range, newText }; + } + TextEdit3.replace = replace; + function insert(position, newText) { + return { range: { start: position, end: position }, newText }; + } + TextEdit3.insert = insert; + function del(range) { + return { range, newText: "" }; + } + TextEdit3.del = del; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); + } + TextEdit3.is = is; + })(TextEdit || (TextEdit = {})); + (function(ChangeAnnotation2) { + function create(label, needsConfirmation, description) { + var result = { label }; + if (needsConfirmation !== void 0) { + result.needsConfirmation = needsConfirmation; + } + if (description !== void 0) { + result.description = description; + } + return result; + } + ChangeAnnotation2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); + } + ChangeAnnotation2.is = is; + })(ChangeAnnotation || (ChangeAnnotation = {})); + (function(ChangeAnnotationIdentifier2) { + function is(value) { + var candidate = value; + return Is.string(candidate); + } + ChangeAnnotationIdentifier2.is = is; + })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); + (function(AnnotatedTextEdit2) { + function replace(range, newText, annotation) { + return { range, newText, annotationId: annotation }; + } + AnnotatedTextEdit2.replace = replace; + function insert(position, newText, annotation) { + return { range: { start: position, end: position }, newText, annotationId: annotation }; + } + AnnotatedTextEdit2.insert = insert; + function del(range, annotation) { + return { range, newText: "", annotationId: annotation }; + } + AnnotatedTextEdit2.del = del; + function is(value) { + var candidate = value; + return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + AnnotatedTextEdit2.is = is; + })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); + (function(TextDocumentEdit4) { + function create(textDocument, edits) { + return { textDocument, edits }; + } + TextDocumentEdit4.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); + } + TextDocumentEdit4.is = is; + })(TextDocumentEdit || (TextDocumentEdit = {})); + (function(CreateFile2) { + function create(uri, options2, annotation) { + var result = { + kind: "create", + uri + }; + if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + CreateFile2.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + CreateFile2.is = is; + })(CreateFile || (CreateFile = {})); + (function(RenameFile3) { + function create(oldUri, newUri, options2, annotation) { + var result = { + kind: "rename", + oldUri, + newUri + }; + if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + RenameFile3.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + RenameFile3.is = is; + })(RenameFile || (RenameFile = {})); + (function(DeleteFile3) { + function create(uri, options2, annotation) { + var result = { + kind: "delete", + uri + }; + if (options2 !== void 0 && (options2.recursive !== void 0 || options2.ignoreIfNotExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + DeleteFile3.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + DeleteFile3.is = is; + })(DeleteFile || (DeleteFile = {})); + (function(WorkspaceEdit5) { + function is(value) { + var candidate = value; + return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) { + if (Is.string(change.kind)) { + return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); + } else { + return TextDocumentEdit.is(change); + } + })); + } + WorkspaceEdit5.is = is; + })(WorkspaceEdit || (WorkspaceEdit = {})); + TextEditChangeImpl = function() { + function TextEditChangeImpl2(edits, changeAnnotations) { + this.edits = edits; + this.changeAnnotations = changeAnnotations; + } + TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) { + var edit2; + var id; + if (annotation === void 0) { + edit2 = TextEdit.insert(position, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit2 = AnnotatedTextEdit.insert(position, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit2 = AnnotatedTextEdit.insert(position, newText, id); + } + this.edits.push(edit2); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) { + var edit2; + var id; + if (annotation === void 0) { + edit2 = TextEdit.replace(range, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit2 = AnnotatedTextEdit.replace(range, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit2 = AnnotatedTextEdit.replace(range, newText, id); + } + this.edits.push(edit2); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.delete = function(range, annotation) { + var edit2; + var id; + if (annotation === void 0) { + edit2 = TextEdit.del(range); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id = annotation; + edit2 = AnnotatedTextEdit.del(range, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id = this.changeAnnotations.manage(annotation); + edit2 = AnnotatedTextEdit.del(range, id); + } + this.edits.push(edit2); + if (id !== void 0) { + return id; + } + }; + TextEditChangeImpl2.prototype.add = function(edit2) { + this.edits.push(edit2); + }; + TextEditChangeImpl2.prototype.all = function() { + return this.edits; + }; + TextEditChangeImpl2.prototype.clear = function() { + this.edits.splice(0, this.edits.length); + }; + TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) { + if (value === void 0) { + throw new Error("Text edit change is not configured to manage change annotations."); + } + }; + return TextEditChangeImpl2; + }(); + ChangeAnnotations = function() { + function ChangeAnnotations2(annotations) { + this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; + this._counter = 0; + this._size = 0; + } + ChangeAnnotations2.prototype.all = function() { + return this._annotations; + }; + Object.defineProperty(ChangeAnnotations2.prototype, "size", { + get: function() { + return this._size; + }, + enumerable: false, + configurable: true + }); + ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) { + var id; + if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { + id = idOrAnnotation; + } else { + id = this.nextId(); + annotation = idOrAnnotation; + } + if (this._annotations[id] !== void 0) { + throw new Error("Id ".concat(id, " is already in use.")); + } + if (annotation === void 0) { + throw new Error("No annotation provided for id ".concat(id)); + } + this._annotations[id] = annotation; + this._size++; + return id; + }; + ChangeAnnotations2.prototype.nextId = function() { + this._counter++; + return this._counter.toString(); + }; + return ChangeAnnotations2; + }(); + WorkspaceChange = function() { + function WorkspaceChange2(workspaceEdit) { + var _this = this; + this._textEditChanges = /* @__PURE__ */ Object.create(null); + if (workspaceEdit !== void 0) { + this._workspaceEdit = workspaceEdit; + if (workspaceEdit.documentChanges) { + this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); + workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + workspaceEdit.documentChanges.forEach(function(change) { + if (TextDocumentEdit.is(change)) { + var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); + _this._textEditChanges[change.textDocument.uri] = textEditChange; + } + }); + } else if (workspaceEdit.changes) { + Object.keys(workspaceEdit.changes).forEach(function(key) { + var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); + _this._textEditChanges[key] = textEditChange; + }); + } + } else { + this._workspaceEdit = {}; + } + } + Object.defineProperty(WorkspaceChange2.prototype, "edit", { + get: function() { + this.initDocumentChanges(); + if (this._changeAnnotations !== void 0) { + if (this._changeAnnotations.size === 0) { + this._workspaceEdit.changeAnnotations = void 0; + } else { + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + } + return this._workspaceEdit; + }, + enumerable: false, + configurable: true + }); + WorkspaceChange2.prototype.getTextEditChange = function(key) { + if (OptionalVersionedTextDocumentIdentifier.is(key)) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var textDocument = { uri: key.uri, version: key.version }; + var result = this._textEditChanges[textDocument.uri]; + if (!result) { + var edits = []; + var textDocumentEdit = { + textDocument, + edits + }; + this._workspaceEdit.documentChanges.push(textDocumentEdit); + result = new TextEditChangeImpl(edits, this._changeAnnotations); + this._textEditChanges[textDocument.uri] = result; + } + return result; + } else { + this.initChanges(); + if (this._workspaceEdit.changes === void 0) { + throw new Error("Workspace edit is not configured for normal text edit changes."); + } + var result = this._textEditChanges[key]; + if (!result) { + var edits = []; + this._workspaceEdit.changes[key] = edits; + result = new TextEditChangeImpl(edits); + this._textEditChanges[key] = result; + } + return result; + } + }; + WorkspaceChange2.prototype.initDocumentChanges = function() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._changeAnnotations = new ChangeAnnotations(); + this._workspaceEdit.documentChanges = []; + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + }; + WorkspaceChange2.prototype.initChanges = function() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); + } + }; + WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = CreateFile.create(uri, options2); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = CreateFile.create(uri, options2, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = RenameFile.create(oldUri, newUri, options2); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = RenameFile.create(oldUri, newUri, options2, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + var annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + var operation; + var id; + if (annotation === void 0) { + operation = DeleteFile.create(uri, options2); + } else { + id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = DeleteFile.create(uri, options2, id); + } + this._workspaceEdit.documentChanges.push(operation); + if (id !== void 0) { + return id; + } + }; + return WorkspaceChange2; + }(); + (function(TextDocumentIdentifier5) { + function create(uri) { + return { uri }; + } + TextDocumentIdentifier5.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri); + } + TextDocumentIdentifier5.is = is; + })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); + (function(VersionedTextDocumentIdentifier2) { + function create(uri, version) { + return { uri, version }; + } + VersionedTextDocumentIdentifier2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); + } + VersionedTextDocumentIdentifier2.is = is; + })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); + (function(OptionalVersionedTextDocumentIdentifier2) { + function create(uri, version) { + return { uri, version }; + } + OptionalVersionedTextDocumentIdentifier2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); + } + OptionalVersionedTextDocumentIdentifier2.is = is; + })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); + (function(TextDocumentItem2) { + function create(uri, languageId, version, text) { + return { uri, languageId, version, text }; + } + TextDocumentItem2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); + } + TextDocumentItem2.is = is; + })(TextDocumentItem || (TextDocumentItem = {})); + (function(MarkupKind2) { + MarkupKind2.PlainText = "plaintext"; + MarkupKind2.Markdown = "markdown"; + function is(value) { + var candidate = value; + return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; + } + MarkupKind2.is = is; + })(MarkupKind || (MarkupKind = {})); + (function(MarkupContent2) { + function is(value) { + var candidate = value; + return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); + } + MarkupContent2.is = is; + })(MarkupContent || (MarkupContent = {})); + (function(CompletionItemKind2) { + CompletionItemKind2.Text = 1; + CompletionItemKind2.Method = 2; + CompletionItemKind2.Function = 3; + CompletionItemKind2.Constructor = 4; + CompletionItemKind2.Field = 5; + CompletionItemKind2.Variable = 6; + CompletionItemKind2.Class = 7; + CompletionItemKind2.Interface = 8; + CompletionItemKind2.Module = 9; + CompletionItemKind2.Property = 10; + CompletionItemKind2.Unit = 11; + CompletionItemKind2.Value = 12; + CompletionItemKind2.Enum = 13; + CompletionItemKind2.Keyword = 14; + CompletionItemKind2.Snippet = 15; + CompletionItemKind2.Color = 16; + CompletionItemKind2.File = 17; + CompletionItemKind2.Reference = 18; + CompletionItemKind2.Folder = 19; + CompletionItemKind2.EnumMember = 20; + CompletionItemKind2.Constant = 21; + CompletionItemKind2.Struct = 22; + CompletionItemKind2.Event = 23; + CompletionItemKind2.Operator = 24; + CompletionItemKind2.TypeParameter = 25; + })(CompletionItemKind || (CompletionItemKind = {})); + (function(InsertTextFormat2) { + InsertTextFormat2.PlainText = 1; + InsertTextFormat2.Snippet = 2; + })(InsertTextFormat || (InsertTextFormat = {})); + (function(CompletionItemTag2) { + CompletionItemTag2.Deprecated = 1; + })(CompletionItemTag || (CompletionItemTag = {})); + (function(InsertReplaceEdit2) { + function create(newText, insert, replace) { + return { newText, insert, replace }; + } + InsertReplaceEdit2.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); + } + InsertReplaceEdit2.is = is; + })(InsertReplaceEdit || (InsertReplaceEdit = {})); + (function(InsertTextMode2) { + InsertTextMode2.asIs = 1; + InsertTextMode2.adjustIndentation = 2; + })(InsertTextMode || (InsertTextMode = {})); + (function(CompletionItemLabelDetails2) { + function is(value) { + var candidate = value; + return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); + } + CompletionItemLabelDetails2.is = is; + })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); + (function(CompletionItem2) { + function create(label) { + return { label }; + } + CompletionItem2.create = create; + })(CompletionItem || (CompletionItem = {})); + (function(CompletionList2) { + function create(items, isIncomplete) { + return { items: items ? items : [], isIncomplete: !!isIncomplete }; + } + CompletionList2.create = create; + })(CompletionList || (CompletionList = {})); + (function(MarkedString4) { + function fromPlainText(plainText) { + return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); + } + MarkedString4.fromPlainText = fromPlainText; + function is(value) { + var candidate = value; + return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); + } + MarkedString4.is = is; + })(MarkedString || (MarkedString = {})); + (function(Hover3) { + function is(value) { + var candidate = value; + return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range)); + } + Hover3.is = is; + })(Hover || (Hover = {})); + (function(ParameterInformation2) { + function create(label, documentation) { + return documentation ? { label, documentation } : { label }; + } + ParameterInformation2.create = create; + })(ParameterInformation || (ParameterInformation = {})); + (function(SignatureInformation2) { + function create(label, documentation) { + var parameters = []; + for (var _i = 2; _i < arguments.length; _i++) { + parameters[_i - 2] = arguments[_i]; + } + var result = { label }; + if (Is.defined(documentation)) { + result.documentation = documentation; + } + if (Is.defined(parameters)) { + result.parameters = parameters; + } else { + result.parameters = []; + } + return result; + } + SignatureInformation2.create = create; + })(SignatureInformation || (SignatureInformation = {})); + (function(DocumentHighlightKind2) { + DocumentHighlightKind2.Text = 1; + DocumentHighlightKind2.Read = 2; + DocumentHighlightKind2.Write = 3; + })(DocumentHighlightKind || (DocumentHighlightKind = {})); + (function(DocumentHighlight2) { + function create(range, kind) { + var result = { range }; + if (Is.number(kind)) { + result.kind = kind; + } + return result; + } + DocumentHighlight2.create = create; + })(DocumentHighlight || (DocumentHighlight = {})); + (function(SymbolKind6) { + SymbolKind6.File = 1; + SymbolKind6.Module = 2; + SymbolKind6.Namespace = 3; + SymbolKind6.Package = 4; + SymbolKind6.Class = 5; + SymbolKind6.Method = 6; + SymbolKind6.Property = 7; + SymbolKind6.Field = 8; + SymbolKind6.Constructor = 9; + SymbolKind6.Enum = 10; + SymbolKind6.Interface = 11; + SymbolKind6.Function = 12; + SymbolKind6.Variable = 13; + SymbolKind6.Constant = 14; + SymbolKind6.String = 15; + SymbolKind6.Number = 16; + SymbolKind6.Boolean = 17; + SymbolKind6.Array = 18; + SymbolKind6.Object = 19; + SymbolKind6.Key = 20; + SymbolKind6.Null = 21; + SymbolKind6.EnumMember = 22; + SymbolKind6.Struct = 23; + SymbolKind6.Event = 24; + SymbolKind6.Operator = 25; + SymbolKind6.TypeParameter = 26; + })(SymbolKind || (SymbolKind = {})); + (function(SymbolTag2) { + SymbolTag2.Deprecated = 1; + })(SymbolTag || (SymbolTag = {})); + (function(SymbolInformation5) { + function create(name, kind, range, uri, containerName) { + var result = { + name, + kind, + location: { uri, range } + }; + if (containerName) { + result.containerName = containerName; + } + return result; + } + SymbolInformation5.create = create; + })(SymbolInformation || (SymbolInformation = {})); + (function(WorkspaceSymbol2) { + function create(name, kind, uri, range) { + return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } }; + } + WorkspaceSymbol2.create = create; + })(WorkspaceSymbol || (WorkspaceSymbol = {})); + (function(DocumentSymbol3) { + function create(name, detail, kind, range, selectionRange, children) { + var result = { + name, + detail, + kind, + range, + selectionRange + }; + if (children !== void 0) { + result.children = children; + } + return result; + } + DocumentSymbol3.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); + } + DocumentSymbol3.is = is; + })(DocumentSymbol || (DocumentSymbol = {})); + (function(CodeActionKind6) { + CodeActionKind6.Empty = ""; + CodeActionKind6.QuickFix = "quickfix"; + CodeActionKind6.Refactor = "refactor"; + CodeActionKind6.RefactorExtract = "refactor.extract"; + CodeActionKind6.RefactorInline = "refactor.inline"; + CodeActionKind6.RefactorRewrite = "refactor.rewrite"; + CodeActionKind6.Source = "source"; + CodeActionKind6.SourceOrganizeImports = "source.organizeImports"; + CodeActionKind6.SourceFixAll = "source.fixAll"; + })(CodeActionKind || (CodeActionKind = {})); + (function(CodeActionTriggerKind3) { + CodeActionTriggerKind3.Invoked = 1; + CodeActionTriggerKind3.Automatic = 2; + })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); + (function(CodeActionContext5) { + function create(diagnostics, only, triggerKind) { + var result = { diagnostics }; + if (only !== void 0 && only !== null) { + result.only = only; + } + if (triggerKind !== void 0 && triggerKind !== null) { + result.triggerKind = triggerKind; + } + return result; + } + CodeActionContext5.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); + } + CodeActionContext5.is = is; + })(CodeActionContext || (CodeActionContext = {})); + (function(CodeAction4) { + function create(title, kindOrCommandOrEdit, kind) { + var result = { title }; + var checkKind = true; + if (typeof kindOrCommandOrEdit === "string") { + checkKind = false; + result.kind = kindOrCommandOrEdit; + } else if (Command.is(kindOrCommandOrEdit)) { + result.command = kindOrCommandOrEdit; + } else { + result.edit = kindOrCommandOrEdit; + } + if (checkKind && kind !== void 0) { + result.kind = kind; + } + return result; + } + CodeAction4.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); + } + CodeAction4.is = is; + })(CodeAction || (CodeAction = {})); + (function(CodeLens2) { + function create(range, data) { + var result = { range }; + if (Is.defined(data)) { + result.data = data; + } + return result; + } + CodeLens2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); + } + CodeLens2.is = is; + })(CodeLens || (CodeLens = {})); + (function(FormattingOptions4) { + function create(tabSize, insertSpaces) { + return { tabSize, insertSpaces }; + } + FormattingOptions4.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); + } + FormattingOptions4.is = is; + })(FormattingOptions || (FormattingOptions = {})); + (function(DocumentLink2) { + function create(range, target, data) { + return { range, target, data }; + } + DocumentLink2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); + } + DocumentLink2.is = is; + })(DocumentLink || (DocumentLink = {})); + (function(SelectionRange2) { + function create(range, parent) { + return { range, parent }; + } + SelectionRange2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); + } + SelectionRange2.is = is; + })(SelectionRange || (SelectionRange = {})); + (function(SemanticTokenTypes2) { + SemanticTokenTypes2["namespace"] = "namespace"; + SemanticTokenTypes2["type"] = "type"; + SemanticTokenTypes2["class"] = "class"; + SemanticTokenTypes2["enum"] = "enum"; + SemanticTokenTypes2["interface"] = "interface"; + SemanticTokenTypes2["struct"] = "struct"; + SemanticTokenTypes2["typeParameter"] = "typeParameter"; + SemanticTokenTypes2["parameter"] = "parameter"; + SemanticTokenTypes2["variable"] = "variable"; + SemanticTokenTypes2["property"] = "property"; + SemanticTokenTypes2["enumMember"] = "enumMember"; + SemanticTokenTypes2["event"] = "event"; + SemanticTokenTypes2["function"] = "function"; + SemanticTokenTypes2["method"] = "method"; + SemanticTokenTypes2["macro"] = "macro"; + SemanticTokenTypes2["keyword"] = "keyword"; + SemanticTokenTypes2["modifier"] = "modifier"; + SemanticTokenTypes2["comment"] = "comment"; + SemanticTokenTypes2["string"] = "string"; + SemanticTokenTypes2["number"] = "number"; + SemanticTokenTypes2["regexp"] = "regexp"; + SemanticTokenTypes2["operator"] = "operator"; + SemanticTokenTypes2["decorator"] = "decorator"; + })(SemanticTokenTypes || (SemanticTokenTypes = {})); + (function(SemanticTokenModifiers2) { + SemanticTokenModifiers2["declaration"] = "declaration"; + SemanticTokenModifiers2["definition"] = "definition"; + SemanticTokenModifiers2["readonly"] = "readonly"; + SemanticTokenModifiers2["static"] = "static"; + SemanticTokenModifiers2["deprecated"] = "deprecated"; + SemanticTokenModifiers2["abstract"] = "abstract"; + SemanticTokenModifiers2["async"] = "async"; + SemanticTokenModifiers2["modification"] = "modification"; + SemanticTokenModifiers2["documentation"] = "documentation"; + SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; + })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); + (function(SemanticTokens2) { + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); + } + SemanticTokens2.is = is; + })(SemanticTokens || (SemanticTokens = {})); + (function(InlineValueText2) { + function create(range, text) { + return { range, text }; + } + InlineValueText2.create = create; + function is(value) { + var candidate = value; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text); + } + InlineValueText2.is = is; + })(InlineValueText || (InlineValueText = {})); + (function(InlineValueVariableLookup2) { + function create(range, variableName, caseSensitiveLookup) { + return { range, variableName, caseSensitiveLookup }; + } + InlineValueVariableLookup2.create = create; + function is(value) { + var candidate = value; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); + } + InlineValueVariableLookup2.is = is; + })(InlineValueVariableLookup || (InlineValueVariableLookup = {})); + (function(InlineValueEvaluatableExpression2) { + function create(range, expression) { + return { range, expression }; + } + InlineValueEvaluatableExpression2.create = create; + function is(value) { + var candidate = value; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); + } + InlineValueEvaluatableExpression2.is = is; + })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); + (function(InlineValueContext2) { + function create(frameId, stoppedLocation) { + return { frameId, stoppedLocation }; + } + InlineValueContext2.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Range.is(value.stoppedLocation); + } + InlineValueContext2.is = is; + })(InlineValueContext || (InlineValueContext = {})); + (function(InlayHintKind3) { + InlayHintKind3.Type = 1; + InlayHintKind3.Parameter = 2; + function is(value) { + return value === 1 || value === 2; + } + InlayHintKind3.is = is; + })(InlayHintKind || (InlayHintKind = {})); + (function(InlayHintLabelPart2) { + function create(value) { + return { value }; + } + InlayHintLabelPart2.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); + } + InlayHintLabelPart2.is = is; + })(InlayHintLabelPart || (InlayHintLabelPart = {})); + (function(InlayHint3) { + function create(position, label, kind) { + var result = { position, label }; + if (kind !== void 0) { + result.kind = kind; + } + return result; + } + InlayHint3.create = create; + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); + } + InlayHint3.is = is; + })(InlayHint || (InlayHint = {})); + (function(WorkspaceFolder3) { + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name); + } + WorkspaceFolder3.is = is; + })(WorkspaceFolder || (WorkspaceFolder = {})); + EOL = ["\n", "\r\n", "\r"]; + (function(TextDocument6) { + function create(uri, languageId, version, content) { + return new FullTextDocument(uri, languageId, version, content); + } + TextDocument6.create = create; + function is(value) { + var candidate = value; + return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; + } + TextDocument6.is = is; + function applyEdits(document, edits) { + var text = document.getText(); + var sortedEdits = mergeSort(edits, function(a, b) { + var diff = a.range.start.line - b.range.start.line; + if (diff === 0) { + return a.range.start.character - b.range.start.character; + } + return diff; + }); + var lastModifiedOffset = text.length; + for (var i = sortedEdits.length - 1; i >= 0; i--) { + var e = sortedEdits[i]; + var startOffset = document.offsetAt(e.range.start); + var endOffset = document.offsetAt(e.range.end); + if (endOffset <= lastModifiedOffset) { + text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); + } else { + throw new Error("Overlapping edit"); + } + lastModifiedOffset = startOffset; + } + return text; + } + TextDocument6.applyEdits = applyEdits; + function mergeSort(data, compare) { + if (data.length <= 1) { + return data; + } + var p = data.length / 2 | 0; + var left = data.slice(0, p); + var right = data.slice(p); + mergeSort(left, compare); + mergeSort(right, compare); + var leftIdx = 0; + var rightIdx = 0; + var i = 0; + while (leftIdx < left.length && rightIdx < right.length) { + var ret = compare(left[leftIdx], right[rightIdx]); + if (ret <= 0) { + data[i++] = left[leftIdx++]; + } else { + data[i++] = right[rightIdx++]; + } + } + while (leftIdx < left.length) { + data[i++] = left[leftIdx++]; + } + while (rightIdx < right.length) { + data[i++] = right[rightIdx++]; + } + return data; + } + })(TextDocument || (TextDocument = {})); + FullTextDocument = function() { + function FullTextDocument2(uri, languageId, version, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version; + this._content = content; + this._lineOffsets = void 0; + } + Object.defineProperty(FullTextDocument2.prototype, "uri", { + get: function() { + return this._uri; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FullTextDocument2.prototype, "languageId", { + get: function() { + return this._languageId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FullTextDocument2.prototype, "version", { + get: function() { + return this._version; + }, + enumerable: false, + configurable: true + }); + FullTextDocument2.prototype.getText = function(range) { + if (range) { + var start = this.offsetAt(range.start); + var end = this.offsetAt(range.end); + return this._content.substring(start, end); + } + return this._content; + }; + FullTextDocument2.prototype.update = function(event, version) { + this._content = event.text; + this._version = version; + this._lineOffsets = void 0; + }; + FullTextDocument2.prototype.getLineOffsets = function() { + if (this._lineOffsets === void 0) { + var lineOffsets = []; + var text = this._content; + var isLineStart = true; + for (var i = 0; i < text.length; i++) { + if (isLineStart) { + lineOffsets.push(i); + isLineStart = false; + } + var ch = text.charAt(i); + isLineStart = ch === "\r" || ch === "\n"; + if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") { + i++; + } + } + if (isLineStart && text.length > 0) { + lineOffsets.push(text.length); + } + this._lineOffsets = lineOffsets; + } + return this._lineOffsets; + }; + FullTextDocument2.prototype.positionAt = function(offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + var lineOffsets = this.getLineOffsets(); + var low = 0, high = lineOffsets.length; + if (high === 0) { + return Position.create(0, offset); + } + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } else { + low = mid + 1; + } + } + var line = low - 1; + return Position.create(line, offset - lineOffsets[line]); + }; + FullTextDocument2.prototype.offsetAt = function(position) { + var lineOffsets = this.getLineOffsets(); + if (position.line >= lineOffsets.length) { + return this._content.length; + } else if (position.line < 0) { + return 0; + } + var lineOffset = lineOffsets[position.line]; + var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length; + return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); + }; + Object.defineProperty(FullTextDocument2.prototype, "lineCount", { + get: function() { + return this.getLineOffsets().length; + }, + enumerable: false, + configurable: true + }); + return FullTextDocument2; + }(); + (function(Is2) { + var toString = Object.prototype.toString; + function defined(value) { + return typeof value !== "undefined"; + } + Is2.defined = defined; + function undefined2(value) { + return typeof value === "undefined"; + } + Is2.undefined = undefined2; + function boolean(value) { + return value === true || value === false; + } + Is2.boolean = boolean; + function string(value) { + return toString.call(value) === "[object String]"; + } + Is2.string = string; + function number(value) { + return toString.call(value) === "[object Number]"; + } + Is2.number = number; + function numberRange(value, min, max) { + return toString.call(value) === "[object Number]" && min <= value && value <= max; + } + Is2.numberRange = numberRange; + function integer2(value) { + return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647; + } + Is2.integer = integer2; + function uinteger2(value) { + return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647; + } + Is2.uinteger = uinteger2; + function func(value) { + return toString.call(value) === "[object Function]"; + } + Is2.func = func; + function objectLiteral(value) { + return value !== null && typeof value === "object"; + } + Is2.objectLiteral = objectLiteral; + function typedArray(value, check) { + return Array.isArray(value) && value.every(check); + } + Is2.typedArray = typedArray; + })(Is || (Is = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/messages.js +var require_messages2 = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = exports.MessageDirection = void 0; + var vscode_jsonrpc_1 = require_main(); + var MessageDirection; + (function(MessageDirection2) { + MessageDirection2["clientToServer"] = "clientToServer"; + MessageDirection2["serverToClient"] = "serverToClient"; + MessageDirection2["both"] = "both"; + })(MessageDirection = exports.MessageDirection || (exports.MessageDirection = {})); + var RegistrationType = class { + constructor(method) { + this.method = method; + } + }; + exports.RegistrationType = RegistrationType; + var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { + constructor(method) { + super(method); + } + }; + exports.ProtocolRequestType0 = ProtocolRequestType0; + var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports.ProtocolRequestType = ProtocolRequestType; + var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { + constructor(method) { + super(method); + } + }; + exports.ProtocolNotificationType0 = ProtocolNotificationType0; + var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports.ProtocolNotificationType = ProtocolNotificationType; + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +var require_is2 = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; + function boolean(value) { + return value === true || value === false; + } + exports.boolean = boolean; + function string(value) { + return typeof value === "string" || value instanceof String; + } + exports.string = string; + function number(value) { + return typeof value === "number" || value instanceof Number; + } + exports.number = number; + function error(value) { + return value instanceof Error; + } + exports.error = error; + function func(value) { + return typeof value === "function"; + } + exports.func = func; + function array(value) { + return Array.isArray(value); + } + exports.array = array; + function stringArray(value) { + return array(value) && value.every((elem) => string(elem)); + } + exports.stringArray = stringArray; + function typedArray(value, check) { + return Array.isArray(value) && value.every(check); + } + exports.typedArray = typedArray; + function objectLiteral(value) { + return value !== null && typeof value === "object"; + } + exports.objectLiteral = objectLiteral; + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +var require_protocol_implementation = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ImplementationRequest = void 0; + var messages_1 = require_messages2(); + var ImplementationRequest; + (function(ImplementationRequest2) { + ImplementationRequest2.method = "textDocument/implementation"; + ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); + })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +var require_protocol_typeDefinition = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TypeDefinitionRequest = void 0; + var messages_1 = require_messages2(); + var TypeDefinitionRequest; + (function(TypeDefinitionRequest2) { + TypeDefinitionRequest2.method = "textDocument/typeDefinition"; + TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); + })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +var require_protocol_workspaceFolder = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; + var messages_1 = require_messages2(); + var WorkspaceFoldersRequest; + (function(WorkspaceFoldersRequest2) { + WorkspaceFoldersRequest2.method = "workspace/workspaceFolders"; + WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method); + })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {})); + var DidChangeWorkspaceFoldersNotification; + (function(DidChangeWorkspaceFoldersNotification2) { + DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders"; + DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method); + })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +var require_protocol_configuration = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ConfigurationRequest = void 0; + var messages_1 = require_messages2(); + var ConfigurationRequest2; + (function(ConfigurationRequest3) { + ConfigurationRequest3.method = "workspace/configuration"; + ConfigurationRequest3.messageDirection = messages_1.MessageDirection.serverToClient; + ConfigurationRequest3.type = new messages_1.ProtocolRequestType(ConfigurationRequest3.method); + })(ConfigurationRequest2 = exports.ConfigurationRequest || (exports.ConfigurationRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +var require_protocol_colorProvider = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; + var messages_1 = require_messages2(); + var DocumentColorRequest; + (function(DocumentColorRequest2) { + DocumentColorRequest2.method = "textDocument/documentColor"; + DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); + })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {})); + var ColorPresentationRequest; + (function(ColorPresentationRequest2) { + ColorPresentationRequest2.method = "textDocument/colorPresentation"; + ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method); + })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +var require_protocol_foldingRange = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.FoldingRangeRequest = void 0; + var messages_1 = require_messages2(); + var FoldingRangeRequest; + (function(FoldingRangeRequest2) { + FoldingRangeRequest2.method = "textDocument/foldingRange"; + FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); + })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +var require_protocol_declaration = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DeclarationRequest = void 0; + var messages_1 = require_messages2(); + var DeclarationRequest; + (function(DeclarationRequest2) { + DeclarationRequest2.method = "textDocument/declaration"; + DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); + })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +var require_protocol_selectionRange = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SelectionRangeRequest = void 0; + var messages_1 = require_messages2(); + var SelectionRangeRequest; + (function(SelectionRangeRequest2) { + SelectionRangeRequest2.method = "textDocument/selectionRange"; + SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); + })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +var require_protocol_progress = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; + var vscode_jsonrpc_1 = require_main(); + var messages_1 = require_messages2(); + var WorkDoneProgress; + (function(WorkDoneProgress2) { + WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); + function is(value) { + return value === WorkDoneProgress2.type; + } + WorkDoneProgress2.is = is; + })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {})); + var WorkDoneProgressCreateRequest; + (function(WorkDoneProgressCreateRequest2) { + WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create"; + WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method); + })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {})); + var WorkDoneProgressCancelNotification; + (function(WorkDoneProgressCancelNotification2) { + WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel"; + WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method); + })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +var require_protocol_callHierarchy = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var CallHierarchyPrepareRequest; + (function(CallHierarchyPrepareRequest2) { + CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; + CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); + })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {})); + var CallHierarchyIncomingCallsRequest; + (function(CallHierarchyIncomingCallsRequest2) { + CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; + CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); + })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {})); + var CallHierarchyOutgoingCallsRequest; + (function(CallHierarchyOutgoingCallsRequest2) { + CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; + CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); + })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +var require_protocol_semanticTokens = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = void 0; + var messages_1 = require_messages2(); + var TokenFormat; + (function(TokenFormat2) { + TokenFormat2.Relative = "relative"; + })(TokenFormat = exports.TokenFormat || (exports.TokenFormat = {})); + var SemanticTokensRegistrationType; + (function(SemanticTokensRegistrationType2) { + SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; + SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); + })(SemanticTokensRegistrationType = exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {})); + var SemanticTokensRequest; + (function(SemanticTokensRequest2) { + SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; + SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); + SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); + var SemanticTokensDeltaRequest; + (function(SemanticTokensDeltaRequest2) { + SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; + SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); + SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensDeltaRequest = exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {})); + var SemanticTokensRangeRequest; + (function(SemanticTokensRangeRequest2) { + SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; + SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); + SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); + var SemanticTokensRefreshRequest; + (function(SemanticTokensRefreshRequest2) { + SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; + SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); + })(SemanticTokensRefreshRequest = exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +var require_protocol_showDocument = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ShowDocumentRequest = void 0; + var messages_1 = require_messages2(); + var ShowDocumentRequest; + (function(ShowDocumentRequest2) { + ShowDocumentRequest2.method = "window/showDocument"; + ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); + })(ShowDocumentRequest = exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +var require_protocol_linkedEditingRange = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.LinkedEditingRangeRequest = void 0; + var messages_1 = require_messages2(); + var LinkedEditingRangeRequest; + (function(LinkedEditingRangeRequest2) { + LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; + LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); + })(LinkedEditingRangeRequest = exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +var require_protocol_fileOperations = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; + var messages_1 = require_messages2(); + var FileOperationPatternKind; + (function(FileOperationPatternKind2) { + FileOperationPatternKind2.file = "file"; + FileOperationPatternKind2.folder = "folder"; + })(FileOperationPatternKind = exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {})); + var WillCreateFilesRequest; + (function(WillCreateFilesRequest2) { + WillCreateFilesRequest2.method = "workspace/willCreateFiles"; + WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); + })(WillCreateFilesRequest = exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {})); + var DidCreateFilesNotification; + (function(DidCreateFilesNotification2) { + DidCreateFilesNotification2.method = "workspace/didCreateFiles"; + DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); + })(DidCreateFilesNotification = exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {})); + var WillRenameFilesRequest; + (function(WillRenameFilesRequest2) { + WillRenameFilesRequest2.method = "workspace/willRenameFiles"; + WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); + })(WillRenameFilesRequest = exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {})); + var DidRenameFilesNotification; + (function(DidRenameFilesNotification2) { + DidRenameFilesNotification2.method = "workspace/didRenameFiles"; + DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); + })(DidRenameFilesNotification = exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {})); + var DidDeleteFilesNotification; + (function(DidDeleteFilesNotification2) { + DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; + DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); + })(DidDeleteFilesNotification = exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {})); + var WillDeleteFilesRequest; + (function(WillDeleteFilesRequest2) { + WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; + WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); + })(WillDeleteFilesRequest = exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +var require_protocol_moniker = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; + var messages_1 = require_messages2(); + var UniquenessLevel; + (function(UniquenessLevel2) { + UniquenessLevel2.document = "document"; + UniquenessLevel2.project = "project"; + UniquenessLevel2.group = "group"; + UniquenessLevel2.scheme = "scheme"; + UniquenessLevel2.global = "global"; + })(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {})); + var MonikerKind; + (function(MonikerKind2) { + MonikerKind2.$import = "import"; + MonikerKind2.$export = "export"; + MonikerKind2.local = "local"; + })(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {})); + var MonikerRequest; + (function(MonikerRequest2) { + MonikerRequest2.method = "textDocument/moniker"; + MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); + })(MonikerRequest = exports.MonikerRequest || (exports.MonikerRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +var require_protocol_typeHierarchy = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TypeHierarchySubtypesRequest = exports.TypeHierarchySupertypesRequest = exports.TypeHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var TypeHierarchyPrepareRequest; + (function(TypeHierarchyPrepareRequest2) { + TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy"; + TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method); + })(TypeHierarchyPrepareRequest = exports.TypeHierarchyPrepareRequest || (exports.TypeHierarchyPrepareRequest = {})); + var TypeHierarchySupertypesRequest; + (function(TypeHierarchySupertypesRequest2) { + TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes"; + TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method); + })(TypeHierarchySupertypesRequest = exports.TypeHierarchySupertypesRequest || (exports.TypeHierarchySupertypesRequest = {})); + var TypeHierarchySubtypesRequest; + (function(TypeHierarchySubtypesRequest2) { + TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes"; + TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method); + })(TypeHierarchySubtypesRequest = exports.TypeHierarchySubtypesRequest || (exports.TypeHierarchySubtypesRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +var require_protocol_inlineValue = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.InlineValueRefreshRequest = exports.InlineValueRequest = void 0; + var messages_1 = require_messages2(); + var InlineValueRequest; + (function(InlineValueRequest2) { + InlineValueRequest2.method = "textDocument/inlineValue"; + InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method); + })(InlineValueRequest = exports.InlineValueRequest || (exports.InlineValueRequest = {})); + var InlineValueRefreshRequest; + (function(InlineValueRefreshRequest2) { + InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`; + InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method); + })(InlineValueRefreshRequest = exports.InlineValueRefreshRequest || (exports.InlineValueRefreshRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +var require_protocol_inlayHint = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = void 0; + var messages_1 = require_messages2(); + var InlayHintRequest2; + (function(InlayHintRequest3) { + InlayHintRequest3.method = "textDocument/inlayHint"; + InlayHintRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + InlayHintRequest3.type = new messages_1.ProtocolRequestType(InlayHintRequest3.method); + })(InlayHintRequest2 = exports.InlayHintRequest || (exports.InlayHintRequest = {})); + var InlayHintResolveRequest; + (function(InlayHintResolveRequest2) { + InlayHintResolveRequest2.method = "inlayHint/resolve"; + InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method); + })(InlayHintResolveRequest = exports.InlayHintResolveRequest || (exports.InlayHintResolveRequest = {})); + var InlayHintRefreshRequest2; + (function(InlayHintRefreshRequest3) { + InlayHintRefreshRequest3.method = `workspace/inlayHint/refresh`; + InlayHintRefreshRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + InlayHintRefreshRequest3.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest3.method); + })(InlayHintRefreshRequest2 = exports.InlayHintRefreshRequest || (exports.InlayHintRefreshRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +var require_protocol_diagnostic = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = void 0; + var vscode_jsonrpc_1 = require_main(); + var Is2 = require_is2(); + var messages_1 = require_messages2(); + var DiagnosticServerCancellationData; + (function(DiagnosticServerCancellationData2) { + function is(value) { + const candidate = value; + return candidate && Is2.boolean(candidate.retriggerRequest); + } + DiagnosticServerCancellationData2.is = is; + })(DiagnosticServerCancellationData = exports.DiagnosticServerCancellationData || (exports.DiagnosticServerCancellationData = {})); + var DocumentDiagnosticReportKind; + (function(DocumentDiagnosticReportKind2) { + DocumentDiagnosticReportKind2.Full = "full"; + DocumentDiagnosticReportKind2.Unchanged = "unchanged"; + })(DocumentDiagnosticReportKind = exports.DocumentDiagnosticReportKind || (exports.DocumentDiagnosticReportKind = {})); + var DocumentDiagnosticRequest; + (function(DocumentDiagnosticRequest2) { + DocumentDiagnosticRequest2.method = "textDocument/diagnostic"; + DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method); + DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); + })(DocumentDiagnosticRequest = exports.DocumentDiagnosticRequest || (exports.DocumentDiagnosticRequest = {})); + var WorkspaceDiagnosticRequest; + (function(WorkspaceDiagnosticRequest2) { + WorkspaceDiagnosticRequest2.method = "workspace/diagnostic"; + WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method); + WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); + })(WorkspaceDiagnosticRequest = exports.WorkspaceDiagnosticRequest || (exports.WorkspaceDiagnosticRequest = {})); + var DiagnosticRefreshRequest; + (function(DiagnosticRefreshRequest2) { + DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`; + DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method); + })(DiagnosticRefreshRequest = exports.DiagnosticRefreshRequest || (exports.DiagnosticRefreshRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +var require_protocol_notebook = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = void 0; + var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); + var Is2 = require_is2(); + var messages_1 = require_messages2(); + var NotebookCellKind; + (function(NotebookCellKind2) { + NotebookCellKind2.Markup = 1; + NotebookCellKind2.Code = 2; + function is(value) { + return value === 1 || value === 2; + } + NotebookCellKind2.is = is; + })(NotebookCellKind = exports.NotebookCellKind || (exports.NotebookCellKind = {})); + var ExecutionSummary; + (function(ExecutionSummary2) { + function create(executionOrder, success) { + const result = { executionOrder }; + if (success === true || success === false) { + result.success = success; + } + return result; + } + ExecutionSummary2.create = create; + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success)); + } + ExecutionSummary2.is = is; + function equals2(one, other) { + if (one === other) { + return true; + } + if (one === null || one === void 0 || other === null || other === void 0) { + return false; + } + return one.executionOrder === other.executionOrder && one.success === other.success; + } + ExecutionSummary2.equals = equals2; + })(ExecutionSummary = exports.ExecutionSummary || (exports.ExecutionSummary = {})); + var NotebookCell; + (function(NotebookCell2) { + function create(kind, document) { + return { kind, document }; + } + NotebookCell2.create = create; + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata)); + } + NotebookCell2.is = is; + function diff(one, two) { + const result = /* @__PURE__ */ new Set(); + if (one.document !== two.document) { + result.add("document"); + } + if (one.kind !== two.kind) { + result.add("kind"); + } + if (one.executionSummary !== two.executionSummary) { + result.add("executionSummary"); + } + if ((one.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one.metadata, two.metadata)) { + result.add("metadata"); + } + if ((one.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one.executionSummary, two.executionSummary)) { + result.add("executionSummary"); + } + return result; + } + NotebookCell2.diff = diff; + function equalsMetadata(one, other) { + if (one === other) { + return true; + } + if (one === null || one === void 0 || other === null || other === void 0) { + return false; + } + if (typeof one !== typeof other) { + return false; + } + if (typeof one !== "object") { + return false; + } + const oneArray = Array.isArray(one); + const otherArray = Array.isArray(other); + if (oneArray !== otherArray) { + return false; + } + if (oneArray && otherArray) { + if (one.length !== other.length) { + return false; + } + for (let i = 0; i < one.length; i++) { + if (!equalsMetadata(one[i], other[i])) { + return false; + } + } + } + if (Is2.objectLiteral(one) && Is2.objectLiteral(other)) { + const oneKeys = Object.keys(one); + const otherKeys = Object.keys(other); + if (oneKeys.length !== otherKeys.length) { + return false; + } + oneKeys.sort(); + otherKeys.sort(); + if (!equalsMetadata(oneKeys, otherKeys)) { + return false; + } + for (let i = 0; i < oneKeys.length; i++) { + const prop = oneKeys[i]; + if (!equalsMetadata(one[prop], other[prop])) { + return false; + } + } + } + return true; + } + })(NotebookCell = exports.NotebookCell || (exports.NotebookCell = {})); + var NotebookDocument; + (function(NotebookDocument2) { + function create(uri, notebookType, version, cells) { + return { uri, notebookType, version, cells }; + } + NotebookDocument2.create = create; + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is); + } + NotebookDocument2.is = is; + })(NotebookDocument = exports.NotebookDocument || (exports.NotebookDocument = {})); + var NotebookDocumentSyncRegistrationType; + (function(NotebookDocumentSyncRegistrationType2) { + NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync"; + NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer; + NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method); + })(NotebookDocumentSyncRegistrationType = exports.NotebookDocumentSyncRegistrationType || (exports.NotebookDocumentSyncRegistrationType = {})); + var DidOpenNotebookDocumentNotification; + (function(DidOpenNotebookDocumentNotification2) { + DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen"; + DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method); + DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidOpenNotebookDocumentNotification = exports.DidOpenNotebookDocumentNotification || (exports.DidOpenNotebookDocumentNotification = {})); + var NotebookCellArrayChange; + (function(NotebookCellArrayChange2) { + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is)); + } + NotebookCellArrayChange2.is = is; + function create(start, deleteCount, cells) { + const result = { start, deleteCount }; + if (cells !== void 0) { + result.cells = cells; + } + return result; + } + NotebookCellArrayChange2.create = create; + })(NotebookCellArrayChange = exports.NotebookCellArrayChange || (exports.NotebookCellArrayChange = {})); + var DidChangeNotebookDocumentNotification; + (function(DidChangeNotebookDocumentNotification2) { + DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange"; + DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method); + DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidChangeNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification || (exports.DidChangeNotebookDocumentNotification = {})); + var DidSaveNotebookDocumentNotification; + (function(DidSaveNotebookDocumentNotification2) { + DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave"; + DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method); + DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidSaveNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification || (exports.DidSaveNotebookDocumentNotification = {})); + var DidCloseNotebookDocumentNotification; + (function(DidCloseNotebookDocumentNotification2) { + DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose"; + DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method); + DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidCloseNotebookDocumentNotification = exports.DidCloseNotebookDocumentNotification || (exports.DidCloseNotebookDocumentNotification = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/protocol.js +var require_protocol = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.RelativePattern = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeErrorCodes = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.PositionEncodingKind = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.NotebookCellTextDocumentFilter = exports.NotebookDocumentFilter = exports.TextDocumentFilter = void 0; + exports.TypeHierarchySubtypesRequest = exports.TypeHierarchyPrepareRequest = exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolResolveRequest = void 0; + exports.DidCloseNotebookDocumentNotification = exports.DidSaveNotebookDocumentNotification = exports.DidChangeNotebookDocumentNotification = exports.NotebookCellArrayChange = exports.DidOpenNotebookDocumentNotification = exports.NotebookDocumentSyncRegistrationType = exports.NotebookDocument = exports.NotebookCell = exports.ExecutionSummary = exports.NotebookCellKind = exports.DiagnosticRefreshRequest = exports.WorkspaceDiagnosticRequest = exports.DocumentDiagnosticRequest = exports.DocumentDiagnosticReportKind = exports.DiagnosticServerCancellationData = exports.InlayHintRefreshRequest = exports.InlayHintResolveRequest = exports.InlayHintRequest = exports.InlineValueRefreshRequest = exports.InlineValueRequest = exports.TypeHierarchySupertypesRequest = void 0; + var messages_1 = require_messages2(); + var vscode_languageserver_types_1 = (init_main(), __toCommonJS(main_exports)); + var Is2 = require_is2(); + var protocol_implementation_1 = require_protocol_implementation(); + Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function() { + return protocol_implementation_1.ImplementationRequest; + } }); + var protocol_typeDefinition_1 = require_protocol_typeDefinition(); + Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function() { + return protocol_typeDefinition_1.TypeDefinitionRequest; + } }); + var protocol_workspaceFolder_1 = require_protocol_workspaceFolder(); + Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function() { + return protocol_workspaceFolder_1.WorkspaceFoldersRequest; + } }); + Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() { + return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; + } }); + var protocol_configuration_1 = require_protocol_configuration(); + Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function() { + return protocol_configuration_1.ConfigurationRequest; + } }); + var protocol_colorProvider_1 = require_protocol_colorProvider(); + Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function() { + return protocol_colorProvider_1.DocumentColorRequest; + } }); + Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function() { + return protocol_colorProvider_1.ColorPresentationRequest; + } }); + var protocol_foldingRange_1 = require_protocol_foldingRange(); + Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function() { + return protocol_foldingRange_1.FoldingRangeRequest; + } }); + var protocol_declaration_1 = require_protocol_declaration(); + Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function() { + return protocol_declaration_1.DeclarationRequest; + } }); + var protocol_selectionRange_1 = require_protocol_selectionRange(); + Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function() { + return protocol_selectionRange_1.SelectionRangeRequest; + } }); + var protocol_progress_1 = require_protocol_progress(); + Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgress; + } }); + Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgressCreateRequest; + } }); + Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() { + return protocol_progress_1.WorkDoneProgressCancelNotification; + } }); + var protocol_callHierarchy_1 = require_protocol_callHierarchy(); + Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; + } }); + Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; + } }); + Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function() { + return protocol_callHierarchy_1.CallHierarchyPrepareRequest; + } }); + var protocol_semanticTokens_1 = require_protocol_semanticTokens(); + Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function() { + return protocol_semanticTokens_1.TokenFormat; + } }); + Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRequest; + } }); + Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensDeltaRequest; + } }); + Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRangeRequest; + } }); + Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRefreshRequest; + } }); + Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function() { + return protocol_semanticTokens_1.SemanticTokensRegistrationType; + } }); + var protocol_showDocument_1 = require_protocol_showDocument(); + Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function() { + return protocol_showDocument_1.ShowDocumentRequest; + } }); + var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); + Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function() { + return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; + } }); + var protocol_fileOperations_1 = require_protocol_fileOperations(); + Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function() { + return protocol_fileOperations_1.FileOperationPatternKind; + } }); + Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function() { + return protocol_fileOperations_1.DidCreateFilesNotification; + } }); + Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function() { + return protocol_fileOperations_1.WillCreateFilesRequest; + } }); + Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function() { + return protocol_fileOperations_1.DidRenameFilesNotification; + } }); + Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function() { + return protocol_fileOperations_1.WillRenameFilesRequest; + } }); + Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function() { + return protocol_fileOperations_1.DidDeleteFilesNotification; + } }); + Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function() { + return protocol_fileOperations_1.WillDeleteFilesRequest; + } }); + var protocol_moniker_1 = require_protocol_moniker(); + Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function() { + return protocol_moniker_1.UniquenessLevel; + } }); + Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function() { + return protocol_moniker_1.MonikerKind; + } }); + Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function() { + return protocol_moniker_1.MonikerRequest; + } }); + var protocol_typeHierarchy_1 = require_protocol_typeHierarchy(); + Object.defineProperty(exports, "TypeHierarchyPrepareRequest", { enumerable: true, get: function() { + return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; + } }); + Object.defineProperty(exports, "TypeHierarchySubtypesRequest", { enumerable: true, get: function() { + return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; + } }); + Object.defineProperty(exports, "TypeHierarchySupertypesRequest", { enumerable: true, get: function() { + return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; + } }); + var protocol_inlineValue_1 = require_protocol_inlineValue(); + Object.defineProperty(exports, "InlineValueRequest", { enumerable: true, get: function() { + return protocol_inlineValue_1.InlineValueRequest; + } }); + Object.defineProperty(exports, "InlineValueRefreshRequest", { enumerable: true, get: function() { + return protocol_inlineValue_1.InlineValueRefreshRequest; + } }); + var protocol_inlayHint_1 = require_protocol_inlayHint(); + Object.defineProperty(exports, "InlayHintRequest", { enumerable: true, get: function() { + return protocol_inlayHint_1.InlayHintRequest; + } }); + Object.defineProperty(exports, "InlayHintResolveRequest", { enumerable: true, get: function() { + return protocol_inlayHint_1.InlayHintResolveRequest; + } }); + Object.defineProperty(exports, "InlayHintRefreshRequest", { enumerable: true, get: function() { + return protocol_inlayHint_1.InlayHintRefreshRequest; + } }); + var protocol_diagnostic_1 = require_protocol_diagnostic(); + Object.defineProperty(exports, "DiagnosticServerCancellationData", { enumerable: true, get: function() { + return protocol_diagnostic_1.DiagnosticServerCancellationData; + } }); + Object.defineProperty(exports, "DocumentDiagnosticReportKind", { enumerable: true, get: function() { + return protocol_diagnostic_1.DocumentDiagnosticReportKind; + } }); + Object.defineProperty(exports, "DocumentDiagnosticRequest", { enumerable: true, get: function() { + return protocol_diagnostic_1.DocumentDiagnosticRequest; + } }); + Object.defineProperty(exports, "WorkspaceDiagnosticRequest", { enumerable: true, get: function() { + return protocol_diagnostic_1.WorkspaceDiagnosticRequest; + } }); + Object.defineProperty(exports, "DiagnosticRefreshRequest", { enumerable: true, get: function() { + return protocol_diagnostic_1.DiagnosticRefreshRequest; + } }); + var protocol_notebook_1 = require_protocol_notebook(); + Object.defineProperty(exports, "NotebookCellKind", { enumerable: true, get: function() { + return protocol_notebook_1.NotebookCellKind; + } }); + Object.defineProperty(exports, "ExecutionSummary", { enumerable: true, get: function() { + return protocol_notebook_1.ExecutionSummary; + } }); + Object.defineProperty(exports, "NotebookCell", { enumerable: true, get: function() { + return protocol_notebook_1.NotebookCell; + } }); + Object.defineProperty(exports, "NotebookDocument", { enumerable: true, get: function() { + return protocol_notebook_1.NotebookDocument; + } }); + Object.defineProperty(exports, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: function() { + return protocol_notebook_1.NotebookDocumentSyncRegistrationType; + } }); + Object.defineProperty(exports, "DidOpenNotebookDocumentNotification", { enumerable: true, get: function() { + return protocol_notebook_1.DidOpenNotebookDocumentNotification; + } }); + Object.defineProperty(exports, "NotebookCellArrayChange", { enumerable: true, get: function() { + return protocol_notebook_1.NotebookCellArrayChange; + } }); + Object.defineProperty(exports, "DidChangeNotebookDocumentNotification", { enumerable: true, get: function() { + return protocol_notebook_1.DidChangeNotebookDocumentNotification; + } }); + Object.defineProperty(exports, "DidSaveNotebookDocumentNotification", { enumerable: true, get: function() { + return protocol_notebook_1.DidSaveNotebookDocumentNotification; + } }); + Object.defineProperty(exports, "DidCloseNotebookDocumentNotification", { enumerable: true, get: function() { + return protocol_notebook_1.DidCloseNotebookDocumentNotification; + } }); + var TextDocumentFilter; + (function(TextDocumentFilter2) { + function is(value) { + const candidate = value; + return Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern); + } + TextDocumentFilter2.is = is; + })(TextDocumentFilter = exports.TextDocumentFilter || (exports.TextDocumentFilter = {})); + var NotebookDocumentFilter; + (function(NotebookDocumentFilter2) { + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); + } + NotebookDocumentFilter2.is = is; + })(NotebookDocumentFilter = exports.NotebookDocumentFilter || (exports.NotebookDocumentFilter = {})); + var NotebookCellTextDocumentFilter; + (function(NotebookCellTextDocumentFilter2) { + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language)); + } + NotebookCellTextDocumentFilter2.is = is; + })(NotebookCellTextDocumentFilter = exports.NotebookCellTextDocumentFilter || (exports.NotebookCellTextDocumentFilter = {})); + var DocumentSelector2; + (function(DocumentSelector3) { + function is(value) { + if (!Array.isArray(value)) { + return false; + } + for (let elem of value) { + if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) { + return false; + } + } + return true; + } + DocumentSelector3.is = is; + })(DocumentSelector2 = exports.DocumentSelector || (exports.DocumentSelector = {})); + var RegistrationRequest; + (function(RegistrationRequest2) { + RegistrationRequest2.method = "client/registerCapability"; + RegistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + RegistrationRequest2.type = new messages_1.ProtocolRequestType(RegistrationRequest2.method); + })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {})); + var UnregistrationRequest; + (function(UnregistrationRequest2) { + UnregistrationRequest2.method = "client/unregisterCapability"; + UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method); + })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {})); + var ResourceOperationKind; + (function(ResourceOperationKind2) { + ResourceOperationKind2.Create = "create"; + ResourceOperationKind2.Rename = "rename"; + ResourceOperationKind2.Delete = "delete"; + })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {})); + var FailureHandlingKind; + (function(FailureHandlingKind2) { + FailureHandlingKind2.Abort = "abort"; + FailureHandlingKind2.Transactional = "transactional"; + FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; + FailureHandlingKind2.Undo = "undo"; + })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {})); + var PositionEncodingKind; + (function(PositionEncodingKind2) { + PositionEncodingKind2.UTF8 = "utf-8"; + PositionEncodingKind2.UTF16 = "utf-16"; + PositionEncodingKind2.UTF32 = "utf-32"; + })(PositionEncodingKind = exports.PositionEncodingKind || (exports.PositionEncodingKind = {})); + var StaticRegistrationOptions; + (function(StaticRegistrationOptions2) { + function hasId(value) { + const candidate = value; + return candidate && Is2.string(candidate.id) && candidate.id.length > 0; + } + StaticRegistrationOptions2.hasId = hasId; + })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {})); + var TextDocumentRegistrationOptions; + (function(TextDocumentRegistrationOptions2) { + function is(value) { + const candidate = value; + return candidate && (candidate.documentSelector === null || DocumentSelector2.is(candidate.documentSelector)); + } + TextDocumentRegistrationOptions2.is = is; + })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {})); + var WorkDoneProgressOptions; + (function(WorkDoneProgressOptions2) { + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress)); + } + WorkDoneProgressOptions2.is = is; + function hasWorkDoneProgress(value) { + const candidate = value; + return candidate && Is2.boolean(candidate.workDoneProgress); + } + WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; + })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {})); + var InitializeRequest; + (function(InitializeRequest2) { + InitializeRequest2.method = "initialize"; + InitializeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InitializeRequest2.type = new messages_1.ProtocolRequestType(InitializeRequest2.method); + })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {})); + var InitializeErrorCodes; + (function(InitializeErrorCodes2) { + InitializeErrorCodes2.unknownProtocolVersion = 1; + })(InitializeErrorCodes = exports.InitializeErrorCodes || (exports.InitializeErrorCodes = {})); + var InitializedNotification; + (function(InitializedNotification2) { + InitializedNotification2.method = "initialized"; + InitializedNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + InitializedNotification2.type = new messages_1.ProtocolNotificationType(InitializedNotification2.method); + })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {})); + var ShutdownRequest; + (function(ShutdownRequest2) { + ShutdownRequest2.method = "shutdown"; + ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method); + })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {})); + var ExitNotification; + (function(ExitNotification2) { + ExitNotification2.method = "exit"; + ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method); + })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {})); + var DidChangeConfigurationNotification3; + (function(DidChangeConfigurationNotification4) { + DidChangeConfigurationNotification4.method = "workspace/didChangeConfiguration"; + DidChangeConfigurationNotification4.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeConfigurationNotification4.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification4.method); + })(DidChangeConfigurationNotification3 = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {})); + var MessageType2; + (function(MessageType3) { + MessageType3.Error = 1; + MessageType3.Warning = 2; + MessageType3.Info = 3; + MessageType3.Log = 4; + })(MessageType2 = exports.MessageType || (exports.MessageType = {})); + var ShowMessageNotification; + (function(ShowMessageNotification2) { + ShowMessageNotification2.method = "window/showMessage"; + ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method); + })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {})); + var ShowMessageRequest; + (function(ShowMessageRequest2) { + ShowMessageRequest2.method = "window/showMessageRequest"; + ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method); + })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {})); + var LogMessageNotification; + (function(LogMessageNotification2) { + LogMessageNotification2.method = "window/logMessage"; + LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method); + })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {})); + var TelemetryEventNotification; + (function(TelemetryEventNotification2) { + TelemetryEventNotification2.method = "telemetry/event"; + TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method); + })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {})); + var TextDocumentSyncKind; + (function(TextDocumentSyncKind2) { + TextDocumentSyncKind2.None = 0; + TextDocumentSyncKind2.Full = 1; + TextDocumentSyncKind2.Incremental = 2; + })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {})); + var DidOpenTextDocumentNotification; + (function(DidOpenTextDocumentNotification2) { + DidOpenTextDocumentNotification2.method = "textDocument/didOpen"; + DidOpenTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method); + })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {})); + var TextDocumentContentChangeEvent; + (function(TextDocumentContentChangeEvent2) { + function isIncremental(event) { + let candidate = event; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); + } + TextDocumentContentChangeEvent2.isIncremental = isIncremental; + function isFull(event) { + let candidate = event; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; + } + TextDocumentContentChangeEvent2.isFull = isFull; + })(TextDocumentContentChangeEvent = exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {})); + var DidChangeTextDocumentNotification; + (function(DidChangeTextDocumentNotification2) { + DidChangeTextDocumentNotification2.method = "textDocument/didChange"; + DidChangeTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method); + })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {})); + var DidCloseTextDocumentNotification; + (function(DidCloseTextDocumentNotification2) { + DidCloseTextDocumentNotification2.method = "textDocument/didClose"; + DidCloseTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method); + })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {})); + var DidSaveTextDocumentNotification; + (function(DidSaveTextDocumentNotification2) { + DidSaveTextDocumentNotification2.method = "textDocument/didSave"; + DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); + })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {})); + var TextDocumentSaveReason; + (function(TextDocumentSaveReason2) { + TextDocumentSaveReason2.Manual = 1; + TextDocumentSaveReason2.AfterDelay = 2; + TextDocumentSaveReason2.FocusOut = 3; + })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {})); + var WillSaveTextDocumentNotification; + (function(WillSaveTextDocumentNotification2) { + WillSaveTextDocumentNotification2.method = "textDocument/willSave"; + WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); + })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {})); + var WillSaveTextDocumentWaitUntilRequest; + (function(WillSaveTextDocumentWaitUntilRequest2) { + WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; + WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); + })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {})); + var DidChangeWatchedFilesNotification; + (function(DidChangeWatchedFilesNotification2) { + DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles"; + DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method); + })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {})); + var FileChangeType; + (function(FileChangeType2) { + FileChangeType2.Created = 1; + FileChangeType2.Changed = 2; + FileChangeType2.Deleted = 3; + })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {})); + var RelativePattern2; + (function(RelativePattern3) { + function is(value) { + const candidate = value; + return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern); + } + RelativePattern3.is = is; + })(RelativePattern2 = exports.RelativePattern || (exports.RelativePattern = {})); + var WatchKind; + (function(WatchKind2) { + WatchKind2.Create = 1; + WatchKind2.Change = 2; + WatchKind2.Delete = 4; + })(WatchKind = exports.WatchKind || (exports.WatchKind = {})); + var PublishDiagnosticsNotification; + (function(PublishDiagnosticsNotification2) { + PublishDiagnosticsNotification2.method = "textDocument/publishDiagnostics"; + PublishDiagnosticsNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method); + })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {})); + var CompletionTriggerKind; + (function(CompletionTriggerKind2) { + CompletionTriggerKind2.Invoked = 1; + CompletionTriggerKind2.TriggerCharacter = 2; + CompletionTriggerKind2.TriggerForIncompleteCompletions = 3; + })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {})); + var CompletionRequest; + (function(CompletionRequest2) { + CompletionRequest2.method = "textDocument/completion"; + CompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method); + })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {})); + var CompletionResolveRequest; + (function(CompletionResolveRequest2) { + CompletionResolveRequest2.method = "completionItem/resolve"; + CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); + })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {})); + var HoverRequest3; + (function(HoverRequest4) { + HoverRequest4.method = "textDocument/hover"; + HoverRequest4.messageDirection = messages_1.MessageDirection.clientToServer; + HoverRequest4.type = new messages_1.ProtocolRequestType(HoverRequest4.method); + })(HoverRequest3 = exports.HoverRequest || (exports.HoverRequest = {})); + var SignatureHelpTriggerKind; + (function(SignatureHelpTriggerKind2) { + SignatureHelpTriggerKind2.Invoked = 1; + SignatureHelpTriggerKind2.TriggerCharacter = 2; + SignatureHelpTriggerKind2.ContentChange = 3; + })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {})); + var SignatureHelpRequest; + (function(SignatureHelpRequest2) { + SignatureHelpRequest2.method = "textDocument/signatureHelp"; + SignatureHelpRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method); + })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {})); + var DefinitionRequest2; + (function(DefinitionRequest3) { + DefinitionRequest3.method = "textDocument/definition"; + DefinitionRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + DefinitionRequest3.type = new messages_1.ProtocolRequestType(DefinitionRequest3.method); + })(DefinitionRequest2 = exports.DefinitionRequest || (exports.DefinitionRequest = {})); + var ReferencesRequest; + (function(ReferencesRequest2) { + ReferencesRequest2.method = "textDocument/references"; + ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); + })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {})); + var DocumentHighlightRequest; + (function(DocumentHighlightRequest2) { + DocumentHighlightRequest2.method = "textDocument/documentHighlight"; + DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); + })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {})); + var DocumentSymbolRequest3; + (function(DocumentSymbolRequest4) { + DocumentSymbolRequest4.method = "textDocument/documentSymbol"; + DocumentSymbolRequest4.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentSymbolRequest4.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest4.method); + })(DocumentSymbolRequest3 = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {})); + var CodeActionRequest2; + (function(CodeActionRequest3) { + CodeActionRequest3.method = "textDocument/codeAction"; + CodeActionRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + CodeActionRequest3.type = new messages_1.ProtocolRequestType(CodeActionRequest3.method); + })(CodeActionRequest2 = exports.CodeActionRequest || (exports.CodeActionRequest = {})); + var CodeActionResolveRequest; + (function(CodeActionResolveRequest2) { + CodeActionResolveRequest2.method = "codeAction/resolve"; + CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); + })(CodeActionResolveRequest = exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {})); + var WorkspaceSymbolRequest2; + (function(WorkspaceSymbolRequest3) { + WorkspaceSymbolRequest3.method = "workspace/symbol"; + WorkspaceSymbolRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceSymbolRequest3.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest3.method); + })(WorkspaceSymbolRequest2 = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); + var WorkspaceSymbolResolveRequest; + (function(WorkspaceSymbolResolveRequest2) { + WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve"; + WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method); + })(WorkspaceSymbolResolveRequest = exports.WorkspaceSymbolResolveRequest || (exports.WorkspaceSymbolResolveRequest = {})); + var CodeLensRequest; + (function(CodeLensRequest2) { + CodeLensRequest2.method = "textDocument/codeLens"; + CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); + })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {})); + var CodeLensResolveRequest; + (function(CodeLensResolveRequest2) { + CodeLensResolveRequest2.method = "codeLens/resolve"; + CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); + })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); + var CodeLensRefreshRequest; + (function(CodeLensRefreshRequest2) { + CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; + CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); + })(CodeLensRefreshRequest = exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {})); + var DocumentLinkRequest; + (function(DocumentLinkRequest2) { + DocumentLinkRequest2.method = "textDocument/documentLink"; + DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); + })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {})); + var DocumentLinkResolveRequest; + (function(DocumentLinkResolveRequest2) { + DocumentLinkResolveRequest2.method = "documentLink/resolve"; + DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); + })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {})); + var DocumentFormattingRequest; + (function(DocumentFormattingRequest2) { + DocumentFormattingRequest2.method = "textDocument/formatting"; + DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); + })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {})); + var DocumentRangeFormattingRequest; + (function(DocumentRangeFormattingRequest2) { + DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; + DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); + })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {})); + var DocumentOnTypeFormattingRequest; + (function(DocumentOnTypeFormattingRequest2) { + DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; + DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); + })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {})); + var PrepareSupportDefaultBehavior; + (function(PrepareSupportDefaultBehavior2) { + PrepareSupportDefaultBehavior2.Identifier = 1; + })(PrepareSupportDefaultBehavior = exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {})); + var RenameRequest; + (function(RenameRequest2) { + RenameRequest2.method = "textDocument/rename"; + RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); + })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {})); + var PrepareRenameRequest; + (function(PrepareRenameRequest2) { + PrepareRenameRequest2.method = "textDocument/prepareRename"; + PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); + })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {})); + var ExecuteCommandRequest2; + (function(ExecuteCommandRequest3) { + ExecuteCommandRequest3.method = "workspace/executeCommand"; + ExecuteCommandRequest3.messageDirection = messages_1.MessageDirection.clientToServer; + ExecuteCommandRequest3.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest3.method); + })(ExecuteCommandRequest2 = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {})); + var ApplyWorkspaceEditRequest; + (function(ApplyWorkspaceEditRequest2) { + ApplyWorkspaceEditRequest2.method = "workspace/applyEdit"; + ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); + })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/connection.js +var require_connection2 = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createProtocolConnection = void 0; + var vscode_jsonrpc_1 = require_main(); + function createProtocolConnection(input, output, logger2, options2) { + if (vscode_jsonrpc_1.ConnectionStrategy.is(options2)) { + options2 = { connectionStrategy: options2 }; + } + return (0, vscode_jsonrpc_1.createMessageConnection)(input, output, logger2, options2); + } + exports.createProtocolConnection = createProtocolConnection; + } +}); + +// node_modules/vscode-languageserver-protocol/lib/common/api.js +var require_api2 = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.LSPErrorCodes = exports.createProtocolConnection = void 0; + __exportStar(require_main(), exports); + __exportStar((init_main(), __toCommonJS(main_exports)), exports); + __exportStar(require_messages2(), exports); + __exportStar(require_protocol(), exports); + var connection_1 = require_connection2(); + Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function() { + return connection_1.createProtocolConnection; + } }); + var LSPErrorCodes; + (function(LSPErrorCodes2) { + LSPErrorCodes2.lspReservedErrorRangeStart = -32899; + LSPErrorCodes2.RequestFailed = -32803; + LSPErrorCodes2.ServerCancelled = -32802; + LSPErrorCodes2.ContentModified = -32801; + LSPErrorCodes2.RequestCancelled = -32800; + LSPErrorCodes2.lspReservedErrorRangeEnd = -32800; + })(LSPErrorCodes = exports.LSPErrorCodes || (exports.LSPErrorCodes = {})); + } +}); + +// node_modules/vscode-languageserver-protocol/lib/node/main.js +var require_main2 = __commonJS({ + "node_modules/vscode-languageserver-protocol/lib/node/main.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createProtocolConnection = void 0; + var node_1 = require_node(); + __exportStar(require_node(), exports); + __exportStar(require_api2(), exports); + function createProtocolConnection(input, output, logger2, options2) { + return (0, node_1.createMessageConnection)(input, output, logger2, options2); + } + exports.createProtocolConnection = createProtocolConnection; + } +}); + +// node_modules/lodash/lodash.js +var require_lodash = __commonJS({ + "node_modules/lodash/lodash.js"(exports, module2) { + (function() { + var undefined2; + var VERSION = "4.17.21"; + var LARGE_ARRAY_SIZE = 200; + var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var MAX_MEMOIZE_SIZE = 500; + var PLACEHOLDER = "__lodash_placeholder__"; + var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; + var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; + var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; + var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; + var HOT_COUNT = 800, HOT_SPAN = 16; + var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; + var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; + var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + var wrapFlags = [ + ["ary", WRAP_ARY_FLAG], + ["bind", WRAP_BIND_FLAG], + ["bindKey", WRAP_BIND_KEY_FLAG], + ["curry", WRAP_CURRY_FLAG], + ["curryRight", WRAP_CURRY_RIGHT_FLAG], + ["flip", WRAP_FLIP_FLAG], + ["partial", WRAP_PARTIAL_FLAG], + ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], + ["rearg", WRAP_REARG_FLAG] + ]; + var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; + var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; + var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); + var reTrimStart = /^\s+/; + var reWhitespace = /\s/; + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; + var reEscapeChar = /\\(\\)?/g; + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + var reFlags = /\w*$/; + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + var reIsBinary = /^0b[01]+$/i; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var reIsOctal = /^0o[0-7]+$/i; + var reIsUint = /^(?:0|[1-9]\d*)$/; + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + var reNoMatch = /($^)/; + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d"; + var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; + var reApos = RegExp(rsApos, "g"); + var reComboMark = RegExp(rsCombo, "g"); + var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); + var reUnicodeWord = RegExp([ + rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", + rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", + rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, + rsUpper + "+" + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join("|"), "g"); + var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + var contextProps = [ + "Array", + "Buffer", + "DataView", + "Date", + "Error", + "Float32Array", + "Float64Array", + "Function", + "Int8Array", + "Int16Array", + "Int32Array", + "Map", + "Math", + "Object", + "Promise", + "RegExp", + "Set", + "String", + "Symbol", + "TypeError", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "WeakMap", + "_", + "clearTimeout", + "isFinite", + "parseInt", + "setTimeout" + ]; + var templateCounter = -1; + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; + var deburredLetters = { + "\xC0": "A", + "\xC1": "A", + "\xC2": "A", + "\xC3": "A", + "\xC4": "A", + "\xC5": "A", + "\xE0": "a", + "\xE1": "a", + "\xE2": "a", + "\xE3": "a", + "\xE4": "a", + "\xE5": "a", + "\xC7": "C", + "\xE7": "c", + "\xD0": "D", + "\xF0": "d", + "\xC8": "E", + "\xC9": "E", + "\xCA": "E", + "\xCB": "E", + "\xE8": "e", + "\xE9": "e", + "\xEA": "e", + "\xEB": "e", + "\xCC": "I", + "\xCD": "I", + "\xCE": "I", + "\xCF": "I", + "\xEC": "i", + "\xED": "i", + "\xEE": "i", + "\xEF": "i", + "\xD1": "N", + "\xF1": "n", + "\xD2": "O", + "\xD3": "O", + "\xD4": "O", + "\xD5": "O", + "\xD6": "O", + "\xD8": "O", + "\xF2": "o", + "\xF3": "o", + "\xF4": "o", + "\xF5": "o", + "\xF6": "o", + "\xF8": "o", + "\xD9": "U", + "\xDA": "U", + "\xDB": "U", + "\xDC": "U", + "\xF9": "u", + "\xFA": "u", + "\xFB": "u", + "\xFC": "u", + "\xDD": "Y", + "\xFD": "y", + "\xFF": "y", + "\xC6": "Ae", + "\xE6": "ae", + "\xDE": "Th", + "\xFE": "th", + "\xDF": "ss", + "\u0100": "A", + "\u0102": "A", + "\u0104": "A", + "\u0101": "a", + "\u0103": "a", + "\u0105": "a", + "\u0106": "C", + "\u0108": "C", + "\u010A": "C", + "\u010C": "C", + "\u0107": "c", + "\u0109": "c", + "\u010B": "c", + "\u010D": "c", + "\u010E": "D", + "\u0110": "D", + "\u010F": "d", + "\u0111": "d", + "\u0112": "E", + "\u0114": "E", + "\u0116": "E", + "\u0118": "E", + "\u011A": "E", + "\u0113": "e", + "\u0115": "e", + "\u0117": "e", + "\u0119": "e", + "\u011B": "e", + "\u011C": "G", + "\u011E": "G", + "\u0120": "G", + "\u0122": "G", + "\u011D": "g", + "\u011F": "g", + "\u0121": "g", + "\u0123": "g", + "\u0124": "H", + "\u0126": "H", + "\u0125": "h", + "\u0127": "h", + "\u0128": "I", + "\u012A": "I", + "\u012C": "I", + "\u012E": "I", + "\u0130": "I", + "\u0129": "i", + "\u012B": "i", + "\u012D": "i", + "\u012F": "i", + "\u0131": "i", + "\u0134": "J", + "\u0135": "j", + "\u0136": "K", + "\u0137": "k", + "\u0138": "k", + "\u0139": "L", + "\u013B": "L", + "\u013D": "L", + "\u013F": "L", + "\u0141": "L", + "\u013A": "l", + "\u013C": "l", + "\u013E": "l", + "\u0140": "l", + "\u0142": "l", + "\u0143": "N", + "\u0145": "N", + "\u0147": "N", + "\u014A": "N", + "\u0144": "n", + "\u0146": "n", + "\u0148": "n", + "\u014B": "n", + "\u014C": "O", + "\u014E": "O", + "\u0150": "O", + "\u014D": "o", + "\u014F": "o", + "\u0151": "o", + "\u0154": "R", + "\u0156": "R", + "\u0158": "R", + "\u0155": "r", + "\u0157": "r", + "\u0159": "r", + "\u015A": "S", + "\u015C": "S", + "\u015E": "S", + "\u0160": "S", + "\u015B": "s", + "\u015D": "s", + "\u015F": "s", + "\u0161": "s", + "\u0162": "T", + "\u0164": "T", + "\u0166": "T", + "\u0163": "t", + "\u0165": "t", + "\u0167": "t", + "\u0168": "U", + "\u016A": "U", + "\u016C": "U", + "\u016E": "U", + "\u0170": "U", + "\u0172": "U", + "\u0169": "u", + "\u016B": "u", + "\u016D": "u", + "\u016F": "u", + "\u0171": "u", + "\u0173": "u", + "\u0174": "W", + "\u0175": "w", + "\u0176": "Y", + "\u0177": "y", + "\u0178": "Y", + "\u0179": "Z", + "\u017B": "Z", + "\u017D": "Z", + "\u017A": "z", + "\u017C": "z", + "\u017E": "z", + "\u0132": "IJ", + "\u0133": "ij", + "\u0152": "Oe", + "\u0153": "oe", + "\u0149": "'n", + "\u017F": "s" + }; + var htmlEscapes = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" + }; + var htmlUnescapes = { + "&": "&", + "<": "<", + ">": ">", + """: '"', + "'": "'" + }; + var stringEscapes = { + "\\": "\\", + "'": "'", + "\n": "n", + "\r": "r", + "\u2028": "u2028", + "\u2029": "u2029" + }; + var freeParseFloat = parseFloat, freeParseInt = parseInt; + var freeGlobal = typeof global == "object" && global && global.Object === Object && global; + var freeSelf = typeof self == "object" && self && self.Object === Object && self; + var root = freeGlobal || freeSelf || Function("return this")(); + var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; + var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; + var moduleExports = freeModule && freeModule.exports === freeExports; + var freeProcess = moduleExports && freeGlobal.process; + var nodeUtil = function() { + try { + var types = freeModule && freeModule.require && freeModule.require("util").types; + if (types) { + return types; + } + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e) { + } + }(); + var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + function apply(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, length = array == null ? 0 : array.length; + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + function arrayEach(array, iteratee) { + var index = -1, length = array == null ? 0 : array.length; + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; + } + function arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + function arrayEvery(array, predicate) { + var index = -1, length = array == null ? 0 : array.length; + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + function arrayFilter(array, predicate) { + var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; + } + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + function arrayIncludesWith(array, value, comparator) { + var index = -1, length = array == null ? 0 : array.length; + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + function arrayMap(array, iteratee) { + var index = -1, length = array == null ? 0 : array.length, result = Array(length); + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + function arrayPush(array, values) { + var index = -1, length = values.length, offset = array.length; + while (++index < length) { + array[offset + index] = values[index]; + } + return array; + } + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + function arraySome(array, predicate) { + var index = -1, length = array == null ? 0 : array.length; + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + var asciiSize = baseProperty("length"); + function asciiToArray(string) { + return string.split(""); + } + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection2) { + if (predicate(value, key, collection2)) { + result = key; + return false; + } + }); + return result; + } + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, index = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index-- : ++index < length) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + function baseIndexOf(array, value, fromIndex) { + return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); + } + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, length = array.length; + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + function baseIsNaN(value) { + return value !== value; + } + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? baseSum(array, iteratee) / length : NAN; + } + function baseProperty(key) { + return function(object) { + return object == null ? undefined2 : object[key]; + }; + } + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined2 : object[key]; + }; + } + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection2) { + accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); + }); + return accumulator; + } + function baseSortBy(array, comparer) { + var length = array.length; + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + function baseSum(array, iteratee) { + var result, index = -1, length = array.length; + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined2) { + result = result === undefined2 ? current : result + current; + } + } + return result; + } + function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + function baseTrim(string) { + return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; + } + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + function cacheHas(cache, key) { + return cache.has(key); + } + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, length = strSymbols.length; + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { + } + return index; + } + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { + } + return index; + } + function countHolders(array, placeholder) { + var length = array.length, result = 0; + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + var deburrLetter = basePropertyOf(deburredLetters); + var escapeHtmlChar = basePropertyOf(htmlEscapes); + function escapeStringChar(chr) { + return "\\" + stringEscapes[chr]; + } + function getValue(object, key) { + return object == null ? undefined2 : object[key]; + } + function hasUnicode(string) { + return reHasUnicode.test(string); + } + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + function iteratorToArray(iterator) { + var data, result = []; + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } + function mapToArray(map) { + var index = -1, result = Array(map.size); + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + function replaceHolders(array, placeholder) { + var index = -1, length = array.length, resIndex = 0, result = []; + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } + function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + function setToPairs(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, length = array.length; + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + function stringSize(string) { + return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); + } + function stringToArray(string) { + return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); + } + function trimmedEndIndex(string) { + var index = string.length; + while (index-- && reWhitespace.test(string.charAt(index))) { + } + return index; + } + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + var runInContext = function runInContext2(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; + var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; + var coreJsData = context["__core-js_shared__"]; + var funcToString = funcProto.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var idCounter = 0; + var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + }(); + var nativeObjectToString = objectProto.toString; + var objectCtorString = funcToString.call(Object2); + var oldDash = root._; + var reIsNative = RegExp2( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; + var defineProperty = function() { + try { + var func = getNative(Object2, "defineProperty"); + func({}, "", {}); + return func; + } catch (e) { + } + }(); + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; + var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); + var metaMap = WeakMap && new WeakMap(); + var realNames = {}; + var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap); + var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2; + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, "__wrapped__")) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + var baseCreate = function() { + function object() { + } + return function(proto) { + if (!isObject(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object.prototype = proto; + var result2 = new object(); + object.prototype = undefined2; + return result2; + }; + }(); + function baseLodash() { + } + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined2; + } + lodash.templateSettings = { + "escape": reEscape, + "evaluate": reEvaluate, + "interpolate": reInterpolate, + "variable": "", + "imports": { + "_": lodash + } + }; + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + function lazyClone() { + var result2 = new LazyWrapper(this.__wrapped__); + result2.__actions__ = copyArray(this.__actions__); + result2.__dir__ = this.__dir__; + result2.__filtered__ = this.__filtered__; + result2.__iteratees__ = copyArray(this.__iteratees__); + result2.__takeCount__ = this.__takeCount__; + result2.__views__ = copyArray(this.__views__); + return result2; + } + function lazyReverse() { + if (this.__filtered__) { + var result2 = new LazyWrapper(this); + result2.__dir__ = -1; + result2.__filtered__ = true; + } else { + result2 = this.clone(); + result2.__dir__ *= -1; + } + return result2; + } + function lazyValue() { + var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); + if (!isArr || !isRight && arrLength == length && takeCount == length) { + return baseWrapperValue(array, this.__actions__); + } + var result2 = []; + outer: + while (length-- && resIndex < takeCount) { + index += dir; + var iterIndex = -1, value = array[index]; + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value); + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result2[resIndex++] = value; + } + return result2; + } + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + function Hash(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + function hashDelete(key) { + var result2 = this.has(key) && delete this.__data__[key]; + this.size -= result2 ? 1 : 0; + return result2; + } + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result2 = data[key]; + return result2 === HASH_UNDEFINED ? undefined2 : result2; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined2; + } + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key); + } + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; + return this; + } + Hash.prototype.clear = hashClear; + Hash.prototype["delete"] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + function ListCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? undefined2 : data[index][1]; + } + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + ListCache.prototype.clear = listCacheClear; + ListCache.prototype["delete"] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + function MapCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear() { + this.size = 0; + this.__data__ = { + "hash": new Hash(), + "map": new (Map2 || ListCache)(), + "string": new Hash() + }; + } + function mapCacheDelete(key) { + var result2 = getMapData(this, key)["delete"](key); + this.size -= result2 ? 1 : 0; + return result2; + } + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + function mapCacheSet(key, value) { + var data = getMapData(this, key), size2 = data.size; + data.set(key, value); + this.size += data.size == size2 ? 0 : 1; + return this; + } + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype["delete"] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + function SetCache(values2) { + var index = -1, length = values2 == null ? 0 : values2.length; + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values2[index]); + } + } + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + function setCacheHas(value) { + return this.__data__.has(value); + } + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; + } + function stackClear() { + this.__data__ = new ListCache(); + this.size = 0; + } + function stackDelete(key) { + var data = this.__data__, result2 = data["delete"](key); + this.size = data.size; + return result2; + } + function stackGet(key) { + return this.__data__.get(key); + } + function stackHas(key) { + return this.__data__.has(key); + } + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; + } + Stack.prototype.clear = stackClear; + Stack.prototype["delete"] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) { + result2.push(key); + } + } + return result2; + } + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined2; + } + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + function assignMergeValue(object, key, value) { + if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) { + baseAssignValue(object, key, value); + } + } + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) { + baseAssignValue(object, key, value); + } + } + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + function baseAggregator(collection, setter, iteratee2, accumulator) { + baseEach(collection, function(value, key, collection2) { + setter(accumulator, value, iteratee2(value), collection2); + }); + return accumulator; + } + function baseAssign(object, source) { + return object && copyObject(source, keys(source), object); + } + function baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); + } + function baseAssignValue(object, key, value) { + if (key == "__proto__" && defineProperty) { + defineProperty(object, key, { + "configurable": true, + "enumerable": true, + "value": value, + "writable": true + }); + } else { + object[key] = value; + } + } + function baseAt(object, paths) { + var index = -1, length = paths.length, result2 = Array2(length), skip = object == null; + while (++index < length) { + result2[index] = skip ? undefined2 : get(object, paths[index]); + } + return result2; + } + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined2) { + number = number <= upper ? number : upper; + } + if (lower !== undefined2) { + number = number >= lower ? number : lower; + } + } + return number; + } + function baseClone(value, bitmask, customizer, key, object, stack) { + var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; + if (customizer) { + result2 = object ? customizer(value, key, object, stack) : customizer(value); + } + if (result2 !== undefined2) { + return result2; + } + if (!isObject(value)) { + return value; + } + var isArr = isArray(value); + if (isArr) { + result2 = initCloneArray(value); + if (!isDeep) { + return copyArray(value, result2); + } + } else { + var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } + if (tag == objectTag || tag == argsTag || isFunc && !object) { + result2 = isFlat || isFunc ? {} : initCloneObject(value); + if (!isDeep) { + return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); + } + } else { + if (!cloneableTags[tag]) { + return object ? value : {}; + } + result2 = initCloneByTag(value, tag, isDeep); + } + } + stack || (stack = new Stack()); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result2); + if (isSet(value)) { + value.forEach(function(subValue) { + result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); + }); + } else if (isMap(value)) { + value.forEach(function(subValue, key2) { + result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); + }); + } + var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; + var props = isArr ? undefined2 : keysFunc(value); + arrayEach(props || value, function(subValue, key2) { + if (props) { + key2 = subValue; + subValue = value[key2]; + } + assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); + }); + return result2; + } + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object2(object); + while (length--) { + var key = props[length], predicate = source[key], value = object[key]; + if (value === undefined2 && !(key in object) || !predicate(value)) { + return false; + } + } + return true; + } + function baseDelay(func, wait, args) { + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + return setTimeout2(function() { + func.apply(undefined2, args); + }, wait); + } + function baseDifference(array, values2, iteratee2, comparator) { + var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length; + if (!length) { + return result2; + } + if (iteratee2) { + values2 = arrayMap(values2, baseUnary(iteratee2)); + } + if (comparator) { + includes2 = arrayIncludesWith; + isCommon = false; + } else if (values2.length >= LARGE_ARRAY_SIZE) { + includes2 = cacheHas; + isCommon = false; + values2 = new SetCache(values2); + } + outer: + while (++index < length) { + var value = array[index], computed = iteratee2 == null ? value : iteratee2(value); + value = comparator || value !== 0 ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values2[valuesIndex] === computed) { + continue outer; + } + } + result2.push(value); + } else if (!includes2(values2, computed, comparator)) { + result2.push(value); + } + } + return result2; + } + var baseEach = createBaseEach(baseForOwn); + var baseEachRight = createBaseEach(baseForOwnRight, true); + function baseEvery(collection, predicate) { + var result2 = true; + baseEach(collection, function(value, index, collection2) { + result2 = !!predicate(value, index, collection2); + return result2; + }); + return result2; + } + function baseExtremum(array, iteratee2, comparator) { + var index = -1, length = array.length; + while (++index < length) { + var value = array[index], current = iteratee2(value); + if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) { + var computed = current, result2 = value; + } + } + return result2; + } + function baseFill(array, value, start, end) { + var length = array.length; + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : length + start; + } + end = end === undefined2 || end > length ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + function baseFilter(collection, predicate) { + var result2 = []; + baseEach(collection, function(value, index, collection2) { + if (predicate(value, index, collection2)) { + result2.push(value); + } + }); + return result2; + } + function baseFlatten(array, depth, predicate, isStrict, result2) { + var index = -1, length = array.length; + predicate || (predicate = isFlattenable); + result2 || (result2 = []); + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + baseFlatten(value, depth - 1, predicate, isStrict, result2); + } else { + arrayPush(result2, value); + } + } else if (!isStrict) { + result2[result2.length] = value; + } + } + return result2; + } + var baseFor = createBaseFor(); + var baseForRight = createBaseFor(true); + function baseForOwn(object, iteratee2) { + return object && baseFor(object, iteratee2, keys); + } + function baseForOwnRight(object, iteratee2) { + return object && baseForRight(object, iteratee2, keys); + } + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + function baseGet(object, path18) { + path18 = castPath(path18, object); + var index = 0, length = path18.length; + while (object != null && index < length) { + object = object[toKey(path18[index++])]; + } + return index && index == length ? object : undefined2; + } + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result2 = keysFunc(object); + return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object)); + } + function baseGetTag(value) { + if (value == null) { + return value === undefined2 ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value); + } + function baseGt(value, other) { + return value > other; + } + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + function baseHasIn(object, key) { + return object != null && key in Object2(object); + } + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + function baseIntersection(arrays, iteratee2, comparator) { + var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee2) { + array = arrayMap(array, baseUnary(iteratee2)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; + } + array = arrays[0]; + var index = -1, seen = caches[0]; + outer: + while (++index < length && result2.length < maxLength) { + var value = array[index], computed = iteratee2 ? iteratee2(value) : value; + value = comparator || value !== 0 ? value : 0; + if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result2.push(value); + } + } + return result2; + } + function baseInverter(object, setter, iteratee2, accumulator) { + baseForOwn(object, function(value, key, object2) { + setter(accumulator, iteratee2(value), key, object2); + }); + return accumulator; + } + function baseInvoke(object, path18, args) { + path18 = castPath(path18, object); + object = parent(object, path18); + var func = object == null ? object : object[toKey(last(path18))]; + return func == null ? undefined2 : apply(func, object, args); + } + function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; + } + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); + } + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; + } + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, length = index, noCustomizer = !customizer; + if (object == null) { + return !length; + } + object = Object2(object); + while (index--) { + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], objValue = object[key], srcValue = data[1]; + if (noCustomizer && data[2]) { + if (objValue === undefined2 && !(key in object)) { + return false; + } + } else { + var stack = new Stack(); + if (customizer) { + var result2 = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { + return false; + } + } + } + return true; + } + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; + } + function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } + function baseIteratee(value) { + if (typeof value == "function") { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == "object") { + return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); + } + return property(value); + } + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result2 = []; + for (var key in Object2(object)) { + if (hasOwnProperty.call(object, key) && key != "constructor") { + result2.push(key); + } + } + return result2; + } + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), result2 = []; + for (var key in object) { + if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) { + result2.push(key); + } + } + return result2; + } + function baseLt(value, other) { + return value < other; + } + function baseMap(collection, iteratee2) { + var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; + baseEach(collection, function(value, key, collection2) { + result2[++index] = iteratee2(value, key, collection2); + }); + return result2; + } + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + function baseMatchesProperty(path18, srcValue) { + if (isKey(path18) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path18), srcValue); + } + return function(object) { + var objValue = get(object, path18); + return objValue === undefined2 && objValue === srcValue ? hasIn(object, path18) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack()); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } else { + var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2; + if (newValue === undefined2) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2; + var isCommon = newValue === undefined2; + if (isCommon) { + var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } else { + newValue = []; + } + } else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } else { + isCommon = false; + } + } + if (isCommon) { + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack["delete"](srcValue); + } + assignMergeValue(object, key, newValue); + } + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined2; + } + function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee2) { + if (isArray(iteratee2)) { + return function(value) { + return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); + }; + } + return iteratee2; + }); + } else { + iteratees = [identity]; + } + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + var result2 = baseMap(collection, function(value, key, collection2) { + var criteria = arrayMap(iteratees, function(iteratee2) { + return iteratee2(value); + }); + return { "criteria": criteria, "index": ++index, "value": value }; + }); + return baseSortBy(result2, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path18) { + return hasIn(object, path18); + }); + } + function basePickBy(object, paths, predicate) { + var index = -1, length = paths.length, result2 = {}; + while (++index < length) { + var path18 = paths[index], value = baseGet(object, path18); + if (predicate(value, path18)) { + baseSet(result2, castPath(path18, object), value); + } + } + return result2; + } + function basePropertyDeep(path18) { + return function(object) { + return baseGet(object, path18); + }; + } + function basePullAll(array, values2, iteratee2, comparator) { + var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; + if (array === values2) { + values2 = copyArray(values2); + } + if (iteratee2) { + seen = arrayMap(array, baseUnary(iteratee2)); + } + while (++index < length) { + var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; + while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, lastIndex = length - 1; + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + function baseRange(start, end, step, fromRight) { + var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); + while (length--) { + result2[fromRight ? length : ++index] = start; + start += step; + } + return result2; + } + function baseRepeat(string, n) { + var result2 = ""; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result2; + } + do { + if (n % 2) { + result2 += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + return result2; + } + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ""); + } + function baseSample(collection) { + return arraySample(values(collection)); + } + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + function baseSet(object, path18, value, customizer) { + if (!isObject(object)) { + return object; + } + path18 = castPath(path18, object); + var index = -1, length = path18.length, lastIndex = length - 1, nested = object; + while (nested != null && ++index < length) { + var key = toKey(path18[index]), newValue = value; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + return object; + } + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined2; + if (newValue === undefined2) { + newValue = isObject(objValue) ? objValue : isIndex(path18[index + 1]) ? [] : {}; + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, "toString", { + "configurable": true, + "enumerable": false, + "value": constant(string), + "writable": true + }); + }; + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + function baseSlice(array, start, end) { + var index = -1, length = array.length; + if (start < 0) { + start = -start > length ? 0 : length + start; + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : end - start >>> 0; + start >>>= 0; + var result2 = Array2(length); + while (++index < length) { + result2[index] = array[index + start]; + } + return result2; + } + function baseSome(collection, predicate) { + var result2; + baseEach(collection, function(value, index, collection2) { + result2 = predicate(value, index, collection2); + return !result2; + }); + return !!result2; + } + function baseSortedIndex(array, value, retHighest) { + var low = 0, high = array == null ? low : array.length; + if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = low + high >>> 1, computed = array[mid]; + if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + function baseSortedIndexBy(array, value, iteratee2, retHighest) { + var low = 0, high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + value = iteratee2(value); + var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2; + while (low < high) { + var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? computed <= value : computed < value; + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + function baseSortedUniq(array, iteratee2) { + var index = -1, length = array.length, resIndex = 0, result2 = []; + while (++index < length) { + var value = array[index], computed = iteratee2 ? iteratee2(value) : value; + if (!index || !eq(computed, seen)) { + var seen = computed; + result2[resIndex++] = value === 0 ? 0 : value; + } + } + return result2; + } + function baseToNumber(value) { + if (typeof value == "number") { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + function baseToString(value) { + if (typeof value == "string") { + return value; + } + if (isArray(value)) { + return arrayMap(value, baseToString) + ""; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ""; + } + var result2 = value + ""; + return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; + } + function baseUniq(array, iteratee2, comparator) { + var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; + if (comparator) { + isCommon = false; + includes2 = arrayIncludesWith; + } else if (length >= LARGE_ARRAY_SIZE) { + var set2 = iteratee2 ? null : createSet(array); + if (set2) { + return setToArray(set2); + } + isCommon = false; + includes2 = cacheHas; + seen = new SetCache(); + } else { + seen = iteratee2 ? [] : result2; + } + outer: + while (++index < length) { + var value = array[index], computed = iteratee2 ? iteratee2(value) : value; + value = comparator || value !== 0 ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee2) { + seen.push(computed); + } + result2.push(value); + } else if (!includes2(seen, computed, comparator)) { + if (seen !== result2) { + seen.push(computed); + } + result2.push(value); + } + } + return result2; + } + function baseUnset(object, path18) { + path18 = castPath(path18, object); + object = parent(object, path18); + return object == null || delete object[toKey(last(path18))]; + } + function baseUpdate(object, path18, updater, customizer) { + return baseSet(object, path18, updater(baseGet(object, path18)), customizer); + } + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, index = fromRight ? length : -1; + while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { + } + return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); + } + function baseWrapperValue(value, actions) { + var result2 = value; + if (result2 instanceof LazyWrapper) { + result2 = result2.value(); + } + return arrayReduce(actions, function(result3, action) { + return action.func.apply(action.thisArg, arrayPush([result3], action.args)); + }, result2); + } + function baseXor(arrays, iteratee2, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, result2 = Array2(length); + while (++index < length) { + var array = arrays[index], othIndex = -1; + while (++othIndex < length) { + if (othIndex != index) { + result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator); + } + } + } + return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); + } + function baseZipObject(props, values2, assignFunc) { + var index = -1, length = props.length, valsLength = values2.length, result2 = {}; + while (++index < length) { + var value = index < valsLength ? values2[index] : undefined2; + assignFunc(result2, props[index], value); + } + return result2; + } + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + function castFunction(value) { + return typeof value == "function" ? value : identity; + } + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + var castRest = baseRest; + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined2 ? length : end; + return !start && end >= length ? array : baseSlice(array, start, end); + } + var clearTimeout2 = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + buffer.copy(result2); + return result2; + } + function cloneArrayBuffer(arrayBuffer) { + var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); + return result2; + } + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + function cloneRegExp(regexp) { + var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result2.lastIndex = regexp.lastIndex; + return result2; + } + function cloneSymbol(symbol) { + return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; + } + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); + var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); + if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { + return 1; + } + if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { + return -1; + } + } + return 0; + } + function compareMultiple(object, other, orders) { + var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; + while (++index < length) { + var result2 = compareAscending(objCriteria[index], othCriteria[index]); + if (result2) { + if (index >= ordersLength) { + return result2; + } + var order = orders[index]; + return result2 * (order == "desc" ? -1 : 1); + } + } + return object.index - other.index; + } + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; + while (++leftIndex < leftLength) { + result2[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result2[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result2[leftIndex++] = args[argsIndex++]; + } + return result2; + } + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; + while (++argsIndex < rangeLength) { + result2[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result2[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result2[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result2; + } + function copyArray(source, array) { + var index = -1, length = source.length; + array || (array = Array2(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; + } + function copyObject(source, props, object, customizer) { + var isNew = !object; + object || (object = {}); + var index = -1, length = props.length; + while (++index < length) { + var key = props[index]; + var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2; + if (newValue === undefined2) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } + } + return object; + } + function copySymbols(source, object) { + return copyObject(source, getSymbols(source), object); + } + function copySymbolsIn(source, object) { + return copyObject(source, getSymbolsIn(source), object); + } + function createAggregator(setter, initializer) { + return function(collection, iteratee2) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; + return func(collection, setter, getIteratee(iteratee2, 2), accumulator); + }; + } + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; + customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined2 : customizer; + length = 1; + } + object = Object2(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee2) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee2); + } + var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); + while (fromRight ? index-- : ++index < length) { + if (iteratee2(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + function createBaseFor(fromRight) { + return function(object, iteratee2, keysFunc) { + var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee2(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); + function wrapper() { + var fn = this && this !== root && this instanceof wrapper ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2; + var chr = strSymbols ? strSymbols[0] : string.charAt(0); + var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); + return chr[methodName]() + trailing; + }; + } + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); + }; + } + function createCtor(Ctor) { + return function() { + var args = arguments; + switch (args.length) { + case 0: + return new Ctor(); + case 1: + return new Ctor(args[0]); + case 2: + return new Ctor(args[0], args[1]); + case 3: + return new Ctor(args[0], args[1], args[2]); + case 4: + return new Ctor(args[0], args[1], args[2], args[3]); + case 5: + return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: + return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: + return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); + return isObject(result2) ? result2 : thisBinding; + }; + } + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + function wrapper() { + var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper); + while (index--) { + args[index] = arguments[index]; + } + var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); + length -= holders.length; + if (length < arity) { + return createRecurry( + func, + bitmask, + createHybrid, + wrapper.placeholder, + undefined2, + args, + holders, + undefined2, + undefined2, + arity - length + ); + } + var fn = this && this !== root && this instanceof wrapper ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object2(collection); + if (!isArrayLike(collection)) { + var iteratee2 = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { + return iteratee2(iterable[key], key, iterable); + }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2; + }; + } + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == "wrapper") { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2; + if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); + } + } + return function() { + var args = arguments, value = args[0]; + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; + while (++index2 < length) { + result2 = funcs[index2].call(this, result2); + } + return result2; + }; + }); + } + function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); + function wrapper() { + var length = arguments.length, args = Array2(length), index = length; + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, + bitmask, + createHybrid, + wrapper.placeholder, + thisArg, + args, + newHolders, + argPos, + ary2, + arity - length + ); + } + var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary2 < length) { + args.length = ary2; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + function createInverter(setter, toIteratee) { + return function(object, iteratee2) { + return baseInverter(object, setter, toIteratee(iteratee2), {}); + }; + } + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result2; + if (value === undefined2 && other === undefined2) { + return defaultValue; + } + if (value !== undefined2) { + result2 = value; + } + if (other !== undefined2) { + if (result2 === undefined2) { + return other; + } + if (typeof value == "string" || typeof other == "string") { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result2 = operator(value, other); + } + return result2; + }; + } + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee2) { + return apply(iteratee2, thisArg, args); + }); + }); + }); + } + function createPadding(length, chars) { + chars = chars === undefined2 ? " " : baseToString(chars); + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); + } + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); + function wrapper() { + var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != "number" && isIterateeCall(start, end, step)) { + end = step = undefined2; + } + start = toFinite(start); + if (end === undefined2) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == "string" && typeof other == "string")) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials; + bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG; + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, + bitmask, + thisArg, + newPartials, + newHolders, + newPartialsRight, + newHoldersRight, + argPos, + ary2, + arity + ]; + var result2 = wrapFunc.apply(undefined2, newData); + if (isLaziable(func)) { + setData(result2, newData); + } + result2.placeholder = placeholder; + return setWrapToString(result2, func, bitmask); + } + function createRound(methodName) { + var func = Math2[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); + pair = (toString(value) + "e").split("e"); + return +(pair[0] + "e" + (+pair[1] - precision)); + } + return func(number); + }; + } + var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) { + return new Set2(values2); + }; + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined2; + } + ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0); + arity = arity === undefined2 ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, holdersRight = holders; + partials = holders = undefined2; + } + var data = isBindKey ? undefined2 : getData(func); + var newData = [ + func, + bitmask, + thisArg, + partials, + holders, + partialsRight, + holdersRight, + argPos, + ary2, + arity + ]; + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0); + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result2 = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result2 = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result2 = createPartial(func, bitmask, thisArg, partials); + } else { + result2 = createHybrid.apply(undefined2, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result2, newData), func, bitmask); + } + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) { + return srcValue; + } + return objValue; + } + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); + stack["delete"](srcValue); + } + return objValue; + } + function customOmitClone(value) { + return isPlainObject(value) ? undefined2 : value; + } + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var arrStacked = stack.get(array); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array; + } + var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; + stack.set(array, other); + stack.set(other, array); + while (++index < arrLength) { + var arrValue = array[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined2) { + if (compared) { + continue; + } + result2 = false; + break; + } + if (seen) { + if (!arraySome(other, function(othValue2, othIndex) { + if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result2 = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result2 = false; + break; + } + } + stack["delete"](array); + stack["delete"](other); + return result2; + } + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + object = object.buffer; + other = other.buffer; + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { + return false; + } + return true; + case boolTag: + case dateTag: + case numberTag: + return eq(+object, +other); + case errorTag: + return object.name == other.name && object.message == other.message; + case regexpTag: + case stringTag: + return object == other + ""; + case mapTag: + var convert = mapToArray; + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + if (object.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + stack.set(object, other); + var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object); + return result2; + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var objStacked = stack.get(object); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object; + } + var result2 = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } + if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result2 = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result2 && !skipCtor) { + var objCtor = object.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result2 = false; + } + } + stack["delete"](object); + stack["delete"](other); + return result2; + } + function flatRest(func) { + return setToString(overRest(func, undefined2, flatten), func + ""); + } + function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); + } + function getAllKeysIn(object) { + return baseGetAllKeys(object, keysIn, getSymbolsIn); + } + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + function getFuncName(func) { + var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0; + while (length--) { + var data = array[length], otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result2; + } + function getHolder(func) { + var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func; + return object.placeholder; + } + function getIteratee() { + var result2 = lodash.iteratee || iteratee; + result2 = result2 === iteratee ? baseIteratee : result2; + return arguments.length ? result2(arguments[0], arguments[1]) : result2; + } + function getMapData(map2, key) { + var data = map2.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + function getMatchData(object) { + var result2 = keys(object), length = result2.length; + while (length--) { + var key = result2[length], value = object[key]; + result2[length] = [key, value, isStrictComparable(value)]; + } + return result2; + } + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined2; + } + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; + try { + value[symToStringTag] = undefined2; + var unmasked = true; + } catch (e) { + } + var result2 = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result2; + } + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object2(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); + }; + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { + var result2 = []; + while (object) { + arrayPush(result2, getSymbols(object)); + object = getPrototype(object); + } + return result2; + }; + var getTag = baseGetTag; + if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { + getTag = function(value) { + var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result2; + }; + } + function getView(start, end, transforms) { + var index = -1, length = transforms.length; + while (++index < length) { + var data = transforms[index], size2 = data.size; + switch (data.type) { + case "drop": + start += size2; + break; + case "dropRight": + end -= size2; + break; + case "take": + end = nativeMin(end, start + size2); + break; + case "takeRight": + start = nativeMax(start, end - size2); + break; + } + } + return { "start": start, "end": end }; + } + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + function hasPath(object, path18, hasFunc) { + path18 = castPath(path18, object); + var index = -1, length = path18.length, result2 = false; + while (++index < length) { + var key = toKey(path18[index]); + if (!(result2 = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result2 || ++index != length) { + return result2; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); + } + function initCloneArray(array) { + var length = array.length, result2 = new array.constructor(length); + if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { + result2.index = array.index; + result2.input = array.input; + } + return result2; + } + function initCloneObject(object) { + return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; + } + function initCloneByTag(object, tag, isDeep) { + var Ctor = object.constructor; + switch (tag) { + case arrayBufferTag: + return cloneArrayBuffer(object); + case boolTag: + case dateTag: + return new Ctor(+object); + case dataViewTag: + return cloneDataView(object, isDeep); + case float32Tag: + case float64Tag: + case int8Tag: + case int16Tag: + case int32Tag: + case uint8Tag: + case uint8ClampedTag: + case uint16Tag: + case uint32Tag: + return cloneTypedArray(object, isDeep); + case mapTag: + return new Ctor(); + case numberTag: + case stringTag: + return new Ctor(object); + case regexpTag: + return cloneRegExp(object); + case setTag: + return new Ctor(); + case symbolTag: + return cloneSymbol(object); + } + } + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; + details = details.join(length > 2 ? ", " : " "); + return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); + } + function isFlattenable(value) { + return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); + } + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); + } + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) { + return eq(object[index], value); + } + return false; + } + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); + } + function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; + } + function isLaziable(func) { + var funcName = getFuncName(func), other = lodash[funcName]; + if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; + } + var isMaskable = coreJsData ? isFunction : stubFalse; + function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + return value === proto; + } + function isStrictComparable(value) { + return value === value && !isObject(value); + } + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); + }; + } + function memoizeCapped(func) { + var result2 = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + var cache = result2.cache; + return result2; + } + function mergeData(data, source) { + var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; + if (!(isCommon || isCombo)) { + return data; + } + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + value = source[7]; + if (value) { + data[7] = value; + } + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + if (data[9] == null) { + data[9] = source[9]; + } + data[0] = source[0]; + data[1] = newBitmask; + return data; + } + function nativeKeysIn(object) { + var result2 = []; + if (object != null) { + for (var key in Object2(object)) { + result2.push(key); + } + } + return result2; + } + function objectToString(value) { + return nativeObjectToString.call(value); + } + function overRest(func, start, transform2) { + start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); + return function() { + var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array2(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform2(array); + return apply(func, this, otherArgs); + }; + } + function parent(object, path18) { + return path18.length < 2 ? object : baseGet(object, baseSlice(path18, 0, -1)); + } + function reorder(array, indexes) { + var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2; + } + return array; + } + function safeGet(object, key) { + if (key === "constructor" && typeof object[key] === "function") { + return; + } + if (key == "__proto__") { + return; + } + return object[key]; + } + var setData = shortOut(baseSetData); + var setTimeout2 = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + var setToString = shortOut(baseSetToString); + function setWrapToString(wrapper, reference, bitmask) { + var source = reference + ""; + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + function shortOut(func) { + var count = 0, lastCalled = 0; + return function() { + var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined2, arguments); + }; + } + function shuffleSelf(array, size2) { + var index = -1, length = array.length, lastIndex = length - 1; + size2 = size2 === undefined2 ? length : size2; + while (++index < size2) { + var rand = baseRandom(index, lastIndex), value = array[rand]; + array[rand] = array[index]; + array[index] = value; + } + array.length = size2; + return array; + } + var stringToPath = memoizeCapped(function(string) { + var result2 = []; + if (string.charCodeAt(0) === 46) { + result2.push(""); + } + string.replace(rePropName, function(match, number, quote, subString) { + result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); + }); + return result2; + }); + function toKey(value) { + if (typeof value == "string" || isSymbol(value)) { + return value; + } + var result2 = value + ""; + return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; + } + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = "_." + pair[0]; + if (bitmask & pair[1] && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result2.__actions__ = copyArray(wrapper.__actions__); + result2.__index__ = wrapper.__index__; + result2.__values__ = wrapper.__values__; + return result2; + } + function chunk(array, size2, guard) { + if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) { + size2 = 1; + } else { + size2 = nativeMax(toInteger(size2), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size2 < 1) { + return []; + } + var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2)); + while (index < length) { + result2[resIndex++] = baseSlice(array, index, index += size2); + } + return result2; + } + function compact(array) { + var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; + while (++index < length) { + var value = array[index]; + if (value) { + result2[resIndex++] = value; + } + } + return result2; + } + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array2(length - 1), array = arguments[0], index = length; + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + var difference = baseRest(function(array, values2) { + return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; + }); + var differenceBy = baseRest(function(array, values2) { + var iteratee2 = last(values2); + if (isArrayLikeObject(iteratee2)) { + iteratee2 = undefined2; + } + return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; + }); + var differenceWith = baseRest(function(array, values2) { + var comparator = last(values2); + if (isArrayLikeObject(comparator)) { + comparator = undefined2; + } + return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : []; + }); + function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = guard || n === undefined2 ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = guard || n === undefined2 ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); + } + function dropRightWhile(array, predicate) { + return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; + } + function dropWhile(array, predicate) { + return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; + } + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != "number" && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + function findIndex2(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined2) { + index = toInteger(fromIndex); + index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined2 ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + function fromPairs(pairs) { + var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; + while (++index < length) { + var pair = pairs[index]; + result2[pair[0]] = pair[1]; + } + return result2; + } + function head(array) { + return array && array.length ? array[0] : undefined2; + } + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; + }); + var intersectionBy = baseRest(function(arrays) { + var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); + if (iteratee2 === last(mapped)) { + iteratee2 = undefined2; + } else { + mapped.pop(); + } + return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; + }); + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); + comparator = typeof comparator == "function" ? comparator : undefined2; + if (comparator) { + mapped.pop(); + } + return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; + }); + function join12(array, separator) { + return array == null ? "" : nativeJoin.call(array, separator); + } + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined2; + } + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined2) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); + } + function nth(array, n) { + return array && array.length ? baseNth(array, toInteger(n)) : undefined2; + } + var pull = baseRest(pullAll); + function pullAll(array, values2) { + return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array; + } + function pullAllBy(array, values2, iteratee2) { + return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array; + } + function pullAllWith(array, values2, comparator) { + return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array; + } + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + return result2; + }); + function remove3(array, predicate) { + var result2 = []; + if (!(array && array.length)) { + return result2; + } + var index = -1, indexes = [], length = array.length; + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result2.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result2; + } + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != "number" && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } else { + start = start == null ? 0 : toInteger(start); + end = end === undefined2 ? length : toInteger(end); + } + return baseSlice(array, start, end); + } + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + function sortedIndexBy(array, value, iteratee2) { + return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); + } + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -1; + } + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + function sortedLastIndexBy(array, value, iteratee2) { + return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); + } + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + function sortedUniq(array) { + return array && array.length ? baseSortedUniq(array) : []; + } + function sortedUniqBy(array, iteratee2) { + return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; + } + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + function take(array, n, guard) { + if (!(array && array.length)) { + return []; + } + n = guard || n === undefined2 ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + function takeRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = guard || n === undefined2 ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + function takeRightWhile(array, predicate) { + return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; + } + function takeWhile(array, predicate) { + return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; + } + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + var unionBy = baseRest(function(arrays) { + var iteratee2 = last(arrays); + if (isArrayLikeObject(iteratee2)) { + iteratee2 = undefined2; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); + }); + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == "function" ? comparator : undefined2; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator); + }); + function uniq(array) { + return array && array.length ? baseUniq(array) : []; + } + function uniqBy(array, iteratee2) { + return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; + } + function uniqWith(array, comparator) { + comparator = typeof comparator == "function" ? comparator : undefined2; + return array && array.length ? baseUniq(array, undefined2, comparator) : []; + } + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + function unzipWith(array, iteratee2) { + if (!(array && array.length)) { + return []; + } + var result2 = unzip(array); + if (iteratee2 == null) { + return result2; + } + return arrayMap(result2, function(group) { + return apply(iteratee2, undefined2, group); + }); + } + var without = baseRest(function(array, values2) { + return isArrayLikeObject(array) ? baseDifference(array, values2) : []; + }); + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + var xorBy = baseRest(function(arrays) { + var iteratee2 = last(arrays); + if (isArrayLikeObject(iteratee2)) { + iteratee2 = undefined2; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); + }); + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == "function" ? comparator : undefined2; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); + }); + var zip = baseRest(unzip); + function zipObject(props, values2) { + return baseZipObject(props || [], values2 || [], assignValue); + } + function zipObjectDeep(props, values2) { + return baseZipObject(props || [], values2 || [], baseSet); + } + var zipWith = baseRest(function(arrays) { + var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2; + iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2; + return unzipWith(arrays, iteratee2); + }); + function chain(value) { + var result2 = lodash(value); + result2.__chain__ = true; + return result2; + } + function tap(value, interceptor) { + interceptor(value); + return value; + } + function thru(value, interceptor) { + return interceptor(value); + } + var wrapperAt = flatRest(function(paths) { + var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { + return baseAt(object, paths); + }; + if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + "func": thru, + "args": [interceptor], + "thisArg": undefined2 + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined2); + } + return array; + }); + }); + function wrapperChain() { + return chain(this); + } + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + function wrapperNext() { + if (this.__values__ === undefined2) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; + return { "done": done, "value": value }; + } + function wrapperToIterator() { + return this; + } + function wrapperPlant(value) { + var result2, parent2 = this; + while (parent2 instanceof baseLodash) { + var clone2 = wrapperClone(parent2); + clone2.__index__ = 0; + clone2.__values__ = undefined2; + if (result2) { + previous.__wrapped__ = clone2; + } else { + result2 = clone2; + } + var previous = clone2; + parent2 = parent2.__wrapped__; + } + previous.__wrapped__ = value; + return result2; + } + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + "func": thru, + "args": [reverse], + "thisArg": undefined2 + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + var countBy = createAggregator(function(result2, value, key) { + if (hasOwnProperty.call(result2, key)) { + ++result2[key]; + } else { + baseAssignValue(result2, key, 1); + } + }); + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined2; + } + return func(collection, getIteratee(predicate, 3)); + } + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + var find = createFind(findIndex2); + var findLast = createFind(findLastIndex); + function flatMap(collection, iteratee2) { + return baseFlatten(map(collection, iteratee2), 1); + } + function flatMapDeep(collection, iteratee2) { + return baseFlatten(map(collection, iteratee2), INFINITY); + } + function flatMapDepth(collection, iteratee2, depth) { + depth = depth === undefined2 ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee2), depth); + } + function forEach(collection, iteratee2) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee2, 3)); + } + function forEachRight(collection, iteratee2) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee2, 3)); + } + var groupBy = createAggregator(function(result2, value, key) { + if (hasOwnProperty.call(result2, key)) { + result2[key].push(value); + } else { + baseAssignValue(result2, key, [value]); + } + }); + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; + } + var invokeMap = baseRest(function(collection, path18, args) { + var index = -1, isFunc = typeof path18 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; + baseEach(collection, function(value) { + result2[++index] = isFunc ? apply(path18, value, args) : baseInvoke(value, path18, args); + }); + return result2; + }); + var keyBy = createAggregator(function(result2, value, key) { + baseAssignValue(result2, key, value); + }); + function map(collection, iteratee2) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee2, 3)); + } + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined2 : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + var partition = createAggregator(function(result2, value, key) { + result2[key ? 0 : 1].push(value); + }, function() { + return [[], []]; + }); + function reduce(collection, iteratee2, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; + return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); + } + function reduceRight(collection, iteratee2, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; + return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); + } + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + function sampleSize(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + function shuffle(collection) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined2; + } + return func(collection, getIteratee(predicate, 3)); + } + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + var now = ctxNow || function() { + return root.Date.now(); + }; + function after(n, func) { + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + function ary(func, n, guard) { + n = guard ? undefined2 : n; + n = func && n == null ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n); + } + function before(n, func) { + var result2; + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result2 = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined2; + } + return result2; + }; + } + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + function curry(func, arity, guard) { + arity = guard ? undefined2 : arity; + var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); + result2.placeholder = curry.placeholder; + return result2; + } + function curryRight(func, arity, guard) { + arity = guard ? undefined2 : arity; + var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); + result2.placeholder = curryRight.placeholder; + return result2; + } + function debounce(func, wait, options2) { + var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options2)) { + leading = !!options2.leading; + maxing = "maxWait" in options2; + maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait; + trailing = "trailing" in options2 ? !!options2.trailing : trailing; + } + function invokeFunc(time) { + var args = lastArgs, thisArg = lastThis; + lastArgs = lastThis = undefined2; + lastInvokeTime = time; + result2 = func.apply(thisArg, args); + return result2; + } + function leadingEdge(time) { + lastInvokeTime = time; + timerId = setTimeout2(timerExpired, wait); + return leading ? invokeFunc(time) : result2; + } + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; + return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; + } + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; + return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; + } + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + timerId = setTimeout2(timerExpired, remainingWait(time)); + } + function trailingEdge(time) { + timerId = undefined2; + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined2; + return result2; + } + function cancel() { + if (timerId !== undefined2) { + clearTimeout2(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined2; + } + function flush() { + return timerId === undefined2 ? result2 : trailingEdge(now()); + } + function debounced() { + var time = now(), isInvoking = shouldInvoke(time); + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + if (isInvoking) { + if (timerId === undefined2) { + return leadingEdge(lastCallTime); + } + if (maxing) { + clearTimeout2(timerId); + timerId = setTimeout2(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined2) { + timerId = setTimeout2(timerExpired, wait); + } + return result2; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + function memoize(func, resolver) { + if (typeof func != "function" || resolver != null && typeof resolver != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) { + return cache.get(key); + } + var result2 = func.apply(this, args); + memoized.cache = cache.set(key, result2) || cache; + return result2; + }; + memoized.cache = new (memoize.Cache || MapCache)(); + return memoized; + } + memoize.Cache = MapCache; + function negate(predicate) { + if (typeof predicate != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: + return !predicate.call(this); + case 1: + return !predicate.call(this, args[0]); + case 2: + return !predicate.call(this, args[0], args[1]); + case 3: + return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + function once(func) { + return before(2, func); + } + var overArgs = castRest(function(func, transforms) { + transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, length = nativeMin(args.length, funcsLength); + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders); + }); + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); + }); + var rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); + }); + function rest(func, start) { + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + start = start === undefined2 ? start : toInteger(start); + return baseRest(func, start); + } + function spread(func, start) { + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], otherArgs = castSlice(args, 0, start); + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + function throttle(func, wait, options2) { + var leading = true, trailing = true; + if (typeof func != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + if (isObject(options2)) { + leading = "leading" in options2 ? !!options2.leading : leading; + trailing = "trailing" in options2 ? !!options2.trailing : trailing; + } + return debounce(func, wait, { + "leading": leading, + "maxWait": wait, + "trailing": trailing + }); + } + function unary(func) { + return ary(func, 1); + } + function wrap(value, wrapper) { + return partial(castFunction(wrapper), value); + } + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + function cloneWith(value, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + function cloneDeep(value) { + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + } + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + function eq(value, other) { + return value === other || value !== value && other !== other; + } + var gt = createRelationalOperation(baseGt); + var gte2 = createRelationalOperation(function(value, other) { + return value >= other; + }); + var isArguments = baseIsArguments(function() { + return arguments; + }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); + }; + var isArray = Array2.isArray; + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + function isBoolean(value) { + return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; + } + var isBuffer = nativeIsBuffer || stubFalse; + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + function isEqual(value, other) { + return baseIsEqual(value, other); + } + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + var result2 = customizer ? customizer(value, other) : undefined2; + return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; + } + function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); + } + function isFinite(value) { + return typeof value == "number" && nativeIsFinite(value); + } + function isFunction(value) { + if (!isObject(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + function isInteger(value) { + return typeof value == "number" && value == toInteger(value); + } + function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + function isObject(value) { + var type = typeof value; + return value != null && (type == "object" || type == "function"); + } + function isObjectLike(value) { + return value != null && typeof value == "object"; + } + var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + function isNaN2(value) { + return isNumber(value) && value != +value; + } + function isNative(value) { + if (isMaskable(value)) { + throw new Error2(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + function isNull(value) { + return value === null; + } + function isNil(value) { + return value == null; + } + function isNumber(value) { + return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; + } + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; + } + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; + function isString(value) { + return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; + } + function isSymbol(value) { + return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; + } + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + function isUndefined(value) { + return value === undefined2; + } + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + var lt = createRelationalOperation(baseLt); + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; + return func(value); + } + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = value < 0 ? -1 : 1; + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + function toInteger(value) { + var result2 = toFinite(value), remainder = result2 % 1; + return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; + } + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + function toNumber(value) { + if (typeof value == "number") { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == "function" ? value.valueOf() : value; + value = isObject(other) ? other + "" : other; + } + if (typeof value != "string") { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; + } + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + function toSafeInteger(value) { + return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; + } + function toString(value) { + return value == null ? "" : baseToString(value); + } + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + var at = flatRest(baseAt); + function create(prototype, properties) { + var result2 = baseCreate(prototype); + return properties == null ? result2 : baseAssign(result2, properties); + } + var defaults2 = baseRest(function(object, sources) { + object = Object2(object); + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined2; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) { + object[key] = source[key]; + } + } + } + return object; + }); + var defaultsDeep = baseRest(function(args) { + args.push(undefined2, customDefaultsMerge); + return apply(mergeWith, undefined2, args); + }); + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + function forIn(object, iteratee2) { + return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); + } + function forInRight(object, iteratee2) { + return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); + } + function forOwn(object, iteratee2) { + return object && baseForOwn(object, getIteratee(iteratee2, 3)); + } + function forOwnRight(object, iteratee2) { + return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); + } + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + function get(object, path18, defaultValue) { + var result2 = object == null ? undefined2 : baseGet(object, path18); + return result2 === undefined2 ? defaultValue : result2; + } + function has(object, path18) { + return object != null && hasPath(object, path18, baseHas); + } + function hasIn(object, path18) { + return object != null && hasPath(object, path18, baseHasIn); + } + var invert = createInverter(function(result2, value, key) { + if (value != null && typeof value.toString != "function") { + value = nativeObjectToString.call(value); + } + result2[value] = key; + }, constant(identity)); + var invertBy = createInverter(function(result2, value, key) { + if (value != null && typeof value.toString != "function") { + value = nativeObjectToString.call(value); + } + if (hasOwnProperty.call(result2, value)) { + result2[value].push(key); + } else { + result2[value] = [key]; + } + }, getIteratee); + var invoke = baseRest(baseInvoke); + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + function keysIn(object) { + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); + } + function mapKeys(object, iteratee2) { + var result2 = {}; + iteratee2 = getIteratee(iteratee2, 3); + baseForOwn(object, function(value, key, object2) { + baseAssignValue(result2, iteratee2(value, key, object2), value); + }); + return result2; + } + function mapValues(object, iteratee2) { + var result2 = {}; + iteratee2 = getIteratee(iteratee2, 3); + baseForOwn(object, function(value, key, object2) { + baseAssignValue(result2, key, iteratee2(value, key, object2)); + }); + return result2; + } + var merge2 = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + var omit = flatRest(function(object, paths) { + var result2 = {}; + if (object == null) { + return result2; + } + var isDeep = false; + paths = arrayMap(paths, function(path18) { + path18 = castPath(path18, object); + isDeep || (isDeep = path18.length > 1); + return path18; + }); + copyObject(object, getAllKeysIn(object), result2); + if (isDeep) { + result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result2, paths[length]); + } + return result2; + }); + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path18) { + return predicate(value, path18[0]); + }); + } + function result(object, path18, defaultValue) { + path18 = castPath(path18, object); + var index = -1, length = path18.length; + if (!length) { + length = 1; + object = undefined2; + } + while (++index < length) { + var value = object == null ? undefined2 : object[toKey(path18[index])]; + if (value === undefined2) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + function set(object, path18, value) { + return object == null ? object : baseSet(object, path18, value); + } + function setWith(object, path18, value, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + return object == null ? object : baseSet(object, path18, value, customizer); + } + var toPairs = createToPairs(keys); + var toPairsIn = createToPairs(keysIn); + function transform(object, iteratee2, accumulator) { + var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); + iteratee2 = getIteratee(iteratee2, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor() : []; + } else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { + return iteratee2(accumulator, value, index, object2); + }); + return accumulator; + } + function unset(object, path18) { + return object == null ? true : baseUnset(object, path18); + } + function update(object, path18, updater) { + return object == null ? object : baseUpdate(object, path18, castFunction(updater)); + } + function updateWith(object, path18, updater, customizer) { + customizer = typeof customizer == "function" ? customizer : undefined2; + return object == null ? object : baseUpdate(object, path18, castFunction(updater), customizer); + } + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + function valuesIn(object) { + return object == null ? [] : baseValues(object, keysIn(object)); + } + function clamp(number, lower, upper) { + if (upper === undefined2) { + upper = lower; + lower = undefined2; + } + if (upper !== undefined2) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined2) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined2) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + function random(lower, upper, floating) { + if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined2; + } + if (floating === undefined2) { + if (typeof upper == "boolean") { + floating = upper; + upper = undefined2; + } else if (typeof lower == "boolean") { + floating = lower; + lower = undefined2; + } + } + if (lower === undefined2 && upper === undefined2) { + lower = 0; + upper = 1; + } else { + lower = toFinite(lower); + if (upper === undefined2) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); + } + return baseRandom(lower, upper); + } + var camelCase = createCompounder(function(result2, word, index) { + word = word.toLowerCase(); + return result2 + (index ? capitalize(word) : word); + }); + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); + } + function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + var length = string.length; + position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length); + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + function escape2(string) { + string = toString(string); + return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; + } + function escapeRegExp(string) { + string = toString(string); + return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; + } + var kebabCase = createCompounder(function(result2, word, index) { + return result2 + (index ? "-" : "") + word.toLowerCase(); + }); + var lowerCase = createCompounder(function(result2, word, index) { + return result2 + (index ? " " : "") + word.toLowerCase(); + }); + var lowerFirst = createCaseFirst("toLowerCase"); + function pad(string, length, chars) { + string = toString(string); + length = toInteger(length); + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); + } + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + var strLength = length ? stringSize(string) : 0; + return length && strLength < length ? string + createPadding(length - strLength, chars) : string; + } + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + var strLength = length ? stringSize(string) : 0; + return length && strLength < length ? createPadding(length - strLength, chars) + string : string; + } + function parseInt2(string, radix, guard) { + if (guard || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0); + } + function repeat(string, n, guard) { + if (guard ? isIterateeCall(string, n, guard) : n === undefined2) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + function replace() { + var args = arguments, string = toString(args[0]); + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + var snakeCase = createCompounder(function(result2, word, index) { + return result2 + (index ? "_" : "") + word.toLowerCase(); + }); + function split(string, separator, limit) { + if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) { + separator = limit = undefined2; + } + limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + var startCase = createCompounder(function(result2, word, index) { + return result2 + (index ? " " : "") + upperFirst(word); + }); + function startsWith(string, target, position) { + string = toString(string); + position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + function template(string, options2, guard) { + var settings = lodash.templateSettings; + if (guard && isIterateeCall(string, options2, guard)) { + options2 = undefined2; + } + string = toString(string); + options2 = assignInWith({}, options2, settings, customDefaultsAssignIn); + var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); + var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '"; + var reDelimiters = RegExp2( + (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$", + "g" + ); + var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; + string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { + interpolateValue || (interpolateValue = esTemplateValue); + source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); + if (escapeValue) { + isEscaping = true; + source += "' +\n__e(" + escapeValue + ") +\n'"; + } + if (evaluateValue) { + isEvaluating = true; + source += "';\n" + evaluateValue + ";\n__p += '"; + } + if (interpolateValue) { + source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; + } + index = offset + match.length; + return match; + }); + source += "';\n"; + var variable = hasOwnProperty.call(options2, "variable") && options2.variable; + if (!variable) { + source = "with (obj) {\n" + source + "\n}\n"; + } else if (reForbiddenIdentifierChars.test(variable)) { + throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); + } + source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); + source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; + var result2 = attempt(function() { + return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues); + }); + result2.source = source; + if (isError(result2)) { + throw result2; + } + return result2; + } + function toLower(value) { + return toString(value).toLowerCase(); + } + function toUpper(value) { + return toString(value).toUpperCase(); + } + function trim(string, chars, guard) { + string = toString(string); + if (string && (guard || chars === undefined2)) { + return baseTrim(string); + } + if (!string || !(chars = baseToString(chars))) { + return string; + } + var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; + return castSlice(strSymbols, start, end).join(""); + } + function trimEnd(string, chars, guard) { + string = toString(string); + if (string && (guard || chars === undefined2)) { + return string.slice(0, trimmedEndIndex(string) + 1); + } + if (!string || !(chars = baseToString(chars))) { + return string; + } + var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; + return castSlice(strSymbols, 0, end).join(""); + } + function trimStart(string, chars, guard) { + string = toString(string); + if (string && (guard || chars === undefined2)) { + return string.replace(reTrimStart, ""); + } + if (!string || !(chars = baseToString(chars))) { + return string; + } + var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); + return castSlice(strSymbols, start).join(""); + } + function truncate(string, options2) { + var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; + if (isObject(options2)) { + var separator = "separator" in options2 ? options2.separator : separator; + length = "length" in options2 ? toInteger(options2.length) : length; + omission = "omission" in options2 ? baseToString(options2.omission) : omission; + } + string = toString(string); + var strLength = string.length; + if (hasUnicode(string)) { + var strSymbols = stringToArray(string); + strLength = strSymbols.length; + } + if (length >= strLength) { + return string; + } + var end = length - stringSize(omission); + if (end < 1) { + return omission; + } + var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); + if (separator === undefined2) { + return result2 + omission; + } + if (strSymbols) { + end += result2.length - end; + } + if (isRegExp(separator)) { + if (string.slice(end).search(separator)) { + var match, substring = result2; + if (!separator.global) { + separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g"); + } + separator.lastIndex = 0; + while (match = separator.exec(substring)) { + var newEnd = match.index; + } + result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); + } + } else if (string.indexOf(baseToString(separator), end) != end) { + var index = result2.lastIndexOf(separator); + if (index > -1) { + result2 = result2.slice(0, index); + } + } + return result2 + omission; + } + function unescape2(string) { + string = toString(string); + return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; + } + var upperCase = createCompounder(function(result2, word, index) { + return result2 + (index ? " " : "") + word.toUpperCase(); + }); + var upperFirst = createCaseFirst("toUpperCase"); + function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined2 : pattern; + if (pattern === undefined2) { + return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); + } + return string.match(pattern) || []; + } + var attempt = baseRest(function(func, args) { + try { + return apply(func, undefined2, args); + } catch (e) { + return isError(e) ? e : new Error2(e); + } + }); + var bindAll = flatRest(function(object, methodNames) { + arrayEach(methodNames, function(key) { + key = toKey(key); + baseAssignValue(object, key, bind(object[key], object)); + }); + return object; + }); + function cond(pairs) { + var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); + pairs = !length ? [] : arrayMap(pairs, function(pair) { + if (typeof pair[1] != "function") { + throw new TypeError2(FUNC_ERROR_TEXT); + } + return [toIteratee(pair[0]), pair[1]]; + }); + return baseRest(function(args) { + var index = -1; + while (++index < length) { + var pair = pairs[index]; + if (apply(pair[0], this, args)) { + return apply(pair[1], this, args); + } + } + }); + } + function conforms(source) { + return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); + } + function constant(value) { + return function() { + return value; + }; + } + function defaultTo(value, defaultValue) { + return value == null || value !== value ? defaultValue : value; + } + var flow = createFlow(); + var flowRight = createFlow(true); + function identity(value) { + return value; + } + function iteratee(func) { + return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); + } + function matches(source) { + return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); + } + function matchesProperty(path18, srcValue) { + return baseMatchesProperty(path18, baseClone(srcValue, CLONE_DEEP_FLAG)); + } + var method = baseRest(function(path18, args) { + return function(object) { + return baseInvoke(object, path18, args); + }; + }); + var methodOf = baseRest(function(object, args) { + return function(path18) { + return baseInvoke(object, path18, args); + }; + }); + function mixin(object, source, options2) { + var props = keys(source), methodNames = baseFunctions(source, props); + if (options2 == null && !(isObject(source) && (methodNames.length || !props.length))) { + options2 = source; + source = object; + object = this; + methodNames = baseFunctions(source, keys(source)); + } + var chain2 = !(isObject(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction(object); + arrayEach(methodNames, function(methodName) { + var func = source[methodName]; + object[methodName] = func; + if (isFunc) { + object.prototype[methodName] = function() { + var chainAll = this.__chain__; + if (chain2 || chainAll) { + var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); + actions.push({ "func": func, "args": arguments, "thisArg": object }); + result2.__chain__ = chainAll; + return result2; + } + return func.apply(object, arrayPush([this.value()], arguments)); + }; + } + }); + return object; + } + function noConflict() { + if (root._ === this) { + root._ = oldDash; + } + return this; + } + function noop() { + } + function nthArg(n) { + n = toInteger(n); + return baseRest(function(args) { + return baseNth(args, n); + }); + } + var over = createOver(arrayMap); + var overEvery = createOver(arrayEvery); + var overSome = createOver(arraySome); + function property(path18) { + return isKey(path18) ? baseProperty(toKey(path18)) : basePropertyDeep(path18); + } + function propertyOf(object) { + return function(path18) { + return object == null ? undefined2 : baseGet(object, path18); + }; + } + var range = createRange(); + var rangeRight = createRange(true); + function stubArray() { + return []; + } + function stubFalse() { + return false; + } + function stubObject() { + return {}; + } + function stubString() { + return ""; + } + function stubTrue() { + return true; + } + function times(n, iteratee2) { + n = toInteger(n); + if (n < 1 || n > MAX_SAFE_INTEGER) { + return []; + } + var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); + iteratee2 = getIteratee(iteratee2); + n -= MAX_ARRAY_LENGTH; + var result2 = baseTimes(length, iteratee2); + while (++index < n) { + iteratee2(index); + } + return result2; + } + function toPath(value) { + if (isArray(value)) { + return arrayMap(value, toKey); + } + return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); + } + function uniqueId(prefix) { + var id = ++idCounter; + return toString(prefix) + id; + } + var add = createMathOperation(function(augend, addend) { + return augend + addend; + }, 0); + var ceil = createRound("ceil"); + var divide = createMathOperation(function(dividend, divisor) { + return dividend / divisor; + }, 1); + var floor = createRound("floor"); + function max(array) { + return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2; + } + function maxBy(array, iteratee2) { + return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2; + } + function mean(array) { + return baseMean(array, identity); + } + function meanBy(array, iteratee2) { + return baseMean(array, getIteratee(iteratee2, 2)); + } + function min(array) { + return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2; + } + function minBy(array, iteratee2) { + return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2; + } + var multiply = createMathOperation(function(multiplier, multiplicand) { + return multiplier * multiplicand; + }, 1); + var round = createRound("round"); + var subtract = createMathOperation(function(minuend, subtrahend) { + return minuend - subtrahend; + }, 0); + function sum(array) { + return array && array.length ? baseSum(array, identity) : 0; + } + function sumBy(array, iteratee2) { + return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; + } + lodash.after = after; + lodash.ary = ary; + lodash.assign = assign; + lodash.assignIn = assignIn; + lodash.assignInWith = assignInWith; + lodash.assignWith = assignWith; + lodash.at = at; + lodash.before = before; + lodash.bind = bind; + lodash.bindAll = bindAll; + lodash.bindKey = bindKey; + lodash.castArray = castArray; + lodash.chain = chain; + lodash.chunk = chunk; + lodash.compact = compact; + lodash.concat = concat; + lodash.cond = cond; + lodash.conforms = conforms; + lodash.constant = constant; + lodash.countBy = countBy; + lodash.create = create; + lodash.curry = curry; + lodash.curryRight = curryRight; + lodash.debounce = debounce; + lodash.defaults = defaults2; + lodash.defaultsDeep = defaultsDeep; + lodash.defer = defer; + lodash.delay = delay; + lodash.difference = difference; + lodash.differenceBy = differenceBy; + lodash.differenceWith = differenceWith; + lodash.drop = drop; + lodash.dropRight = dropRight; + lodash.dropRightWhile = dropRightWhile; + lodash.dropWhile = dropWhile; + lodash.fill = fill; + lodash.filter = filter; + lodash.flatMap = flatMap; + lodash.flatMapDeep = flatMapDeep; + lodash.flatMapDepth = flatMapDepth; + lodash.flatten = flatten; + lodash.flattenDeep = flattenDeep; + lodash.flattenDepth = flattenDepth; + lodash.flip = flip; + lodash.flow = flow; + lodash.flowRight = flowRight; + lodash.fromPairs = fromPairs; + lodash.functions = functions; + lodash.functionsIn = functionsIn; + lodash.groupBy = groupBy; + lodash.initial = initial; + lodash.intersection = intersection; + lodash.intersectionBy = intersectionBy; + lodash.intersectionWith = intersectionWith; + lodash.invert = invert; + lodash.invertBy = invertBy; + lodash.invokeMap = invokeMap; + lodash.iteratee = iteratee; + lodash.keyBy = keyBy; + lodash.keys = keys; + lodash.keysIn = keysIn; + lodash.map = map; + lodash.mapKeys = mapKeys; + lodash.mapValues = mapValues; + lodash.matches = matches; + lodash.matchesProperty = matchesProperty; + lodash.memoize = memoize; + lodash.merge = merge2; + lodash.mergeWith = mergeWith; + lodash.method = method; + lodash.methodOf = methodOf; + lodash.mixin = mixin; + lodash.negate = negate; + lodash.nthArg = nthArg; + lodash.omit = omit; + lodash.omitBy = omitBy; + lodash.once = once; + lodash.orderBy = orderBy; + lodash.over = over; + lodash.overArgs = overArgs; + lodash.overEvery = overEvery; + lodash.overSome = overSome; + lodash.partial = partial; + lodash.partialRight = partialRight; + lodash.partition = partition; + lodash.pick = pick; + lodash.pickBy = pickBy; + lodash.property = property; + lodash.propertyOf = propertyOf; + lodash.pull = pull; + lodash.pullAll = pullAll; + lodash.pullAllBy = pullAllBy; + lodash.pullAllWith = pullAllWith; + lodash.pullAt = pullAt; + lodash.range = range; + lodash.rangeRight = rangeRight; + lodash.rearg = rearg; + lodash.reject = reject; + lodash.remove = remove3; + lodash.rest = rest; + lodash.reverse = reverse; + lodash.sampleSize = sampleSize; + lodash.set = set; + lodash.setWith = setWith; + lodash.shuffle = shuffle; + lodash.slice = slice; + lodash.sortBy = sortBy; + lodash.sortedUniq = sortedUniq; + lodash.sortedUniqBy = sortedUniqBy; + lodash.split = split; + lodash.spread = spread; + lodash.tail = tail; + lodash.take = take; + lodash.takeRight = takeRight; + lodash.takeRightWhile = takeRightWhile; + lodash.takeWhile = takeWhile; + lodash.tap = tap; + lodash.throttle = throttle; + lodash.thru = thru; + lodash.toArray = toArray; + lodash.toPairs = toPairs; + lodash.toPairsIn = toPairsIn; + lodash.toPath = toPath; + lodash.toPlainObject = toPlainObject; + lodash.transform = transform; + lodash.unary = unary; + lodash.union = union; + lodash.unionBy = unionBy; + lodash.unionWith = unionWith; + lodash.uniq = uniq; + lodash.uniqBy = uniqBy; + lodash.uniqWith = uniqWith; + lodash.unset = unset; + lodash.unzip = unzip; + lodash.unzipWith = unzipWith; + lodash.update = update; + lodash.updateWith = updateWith; + lodash.values = values; + lodash.valuesIn = valuesIn; + lodash.without = without; + lodash.words = words; + lodash.wrap = wrap; + lodash.xor = xor; + lodash.xorBy = xorBy; + lodash.xorWith = xorWith; + lodash.zip = zip; + lodash.zipObject = zipObject; + lodash.zipObjectDeep = zipObjectDeep; + lodash.zipWith = zipWith; + lodash.entries = toPairs; + lodash.entriesIn = toPairsIn; + lodash.extend = assignIn; + lodash.extendWith = assignInWith; + mixin(lodash, lodash); + lodash.add = add; + lodash.attempt = attempt; + lodash.camelCase = camelCase; + lodash.capitalize = capitalize; + lodash.ceil = ceil; + lodash.clamp = clamp; + lodash.clone = clone; + lodash.cloneDeep = cloneDeep; + lodash.cloneDeepWith = cloneDeepWith; + lodash.cloneWith = cloneWith; + lodash.conformsTo = conformsTo; + lodash.deburr = deburr; + lodash.defaultTo = defaultTo; + lodash.divide = divide; + lodash.endsWith = endsWith; + lodash.eq = eq; + lodash.escape = escape2; + lodash.escapeRegExp = escapeRegExp; + lodash.every = every; + lodash.find = find; + lodash.findIndex = findIndex2; + lodash.findKey = findKey; + lodash.findLast = findLast; + lodash.findLastIndex = findLastIndex; + lodash.findLastKey = findLastKey; + lodash.floor = floor; + lodash.forEach = forEach; + lodash.forEachRight = forEachRight; + lodash.forIn = forIn; + lodash.forInRight = forInRight; + lodash.forOwn = forOwn; + lodash.forOwnRight = forOwnRight; + lodash.get = get; + lodash.gt = gt; + lodash.gte = gte2; + lodash.has = has; + lodash.hasIn = hasIn; + lodash.head = head; + lodash.identity = identity; + lodash.includes = includes; + lodash.indexOf = indexOf; + lodash.inRange = inRange; + lodash.invoke = invoke; + lodash.isArguments = isArguments; + lodash.isArray = isArray; + lodash.isArrayBuffer = isArrayBuffer; + lodash.isArrayLike = isArrayLike; + lodash.isArrayLikeObject = isArrayLikeObject; + lodash.isBoolean = isBoolean; + lodash.isBuffer = isBuffer; + lodash.isDate = isDate; + lodash.isElement = isElement; + lodash.isEmpty = isEmpty; + lodash.isEqual = isEqual; + lodash.isEqualWith = isEqualWith; + lodash.isError = isError; + lodash.isFinite = isFinite; + lodash.isFunction = isFunction; + lodash.isInteger = isInteger; + lodash.isLength = isLength; + lodash.isMap = isMap; + lodash.isMatch = isMatch; + lodash.isMatchWith = isMatchWith; + lodash.isNaN = isNaN2; + lodash.isNative = isNative; + lodash.isNil = isNil; + lodash.isNull = isNull; + lodash.isNumber = isNumber; + lodash.isObject = isObject; + lodash.isObjectLike = isObjectLike; + lodash.isPlainObject = isPlainObject; + lodash.isRegExp = isRegExp; + lodash.isSafeInteger = isSafeInteger; + lodash.isSet = isSet; + lodash.isString = isString; + lodash.isSymbol = isSymbol; + lodash.isTypedArray = isTypedArray; + lodash.isUndefined = isUndefined; + lodash.isWeakMap = isWeakMap; + lodash.isWeakSet = isWeakSet; + lodash.join = join12; + lodash.kebabCase = kebabCase; + lodash.last = last; + lodash.lastIndexOf = lastIndexOf; + lodash.lowerCase = lowerCase; + lodash.lowerFirst = lowerFirst; + lodash.lt = lt; + lodash.lte = lte; + lodash.max = max; + lodash.maxBy = maxBy; + lodash.mean = mean; + lodash.meanBy = meanBy; + lodash.min = min; + lodash.minBy = minBy; + lodash.stubArray = stubArray; + lodash.stubFalse = stubFalse; + lodash.stubObject = stubObject; + lodash.stubString = stubString; + lodash.stubTrue = stubTrue; + lodash.multiply = multiply; + lodash.nth = nth; + lodash.noConflict = noConflict; + lodash.noop = noop; + lodash.now = now; + lodash.pad = pad; + lodash.padEnd = padEnd; + lodash.padStart = padStart; + lodash.parseInt = parseInt2; + lodash.random = random; + lodash.reduce = reduce; + lodash.reduceRight = reduceRight; + lodash.repeat = repeat; + lodash.replace = replace; + lodash.result = result; + lodash.round = round; + lodash.runInContext = runInContext2; + lodash.sample = sample; + lodash.size = size; + lodash.snakeCase = snakeCase; + lodash.some = some; + lodash.sortedIndex = sortedIndex; + lodash.sortedIndexBy = sortedIndexBy; + lodash.sortedIndexOf = sortedIndexOf; + lodash.sortedLastIndex = sortedLastIndex; + lodash.sortedLastIndexBy = sortedLastIndexBy; + lodash.sortedLastIndexOf = sortedLastIndexOf; + lodash.startCase = startCase; + lodash.startsWith = startsWith; + lodash.subtract = subtract; + lodash.sum = sum; + lodash.sumBy = sumBy; + lodash.template = template; + lodash.times = times; + lodash.toFinite = toFinite; + lodash.toInteger = toInteger; + lodash.toLength = toLength; + lodash.toLower = toLower; + lodash.toNumber = toNumber; + lodash.toSafeInteger = toSafeInteger; + lodash.toString = toString; + lodash.toUpper = toUpper; + lodash.trim = trim; + lodash.trimEnd = trimEnd; + lodash.trimStart = trimStart; + lodash.truncate = truncate; + lodash.unescape = unescape2; + lodash.uniqueId = uniqueId; + lodash.upperCase = upperCase; + lodash.upperFirst = upperFirst; + lodash.each = forEach; + lodash.eachRight = forEachRight; + lodash.first = head; + mixin(lodash, function() { + var source = {}; + baseForOwn(lodash, function(func, methodName) { + if (!hasOwnProperty.call(lodash.prototype, methodName)) { + source[methodName] = func; + } + }); + return source; + }(), { "chain": false }); + lodash.VERSION = VERSION; + arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { + lodash[methodName].placeholder = lodash; + }); + arrayEach(["drop", "take"], function(methodName, index) { + LazyWrapper.prototype[methodName] = function(n) { + n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0); + var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); + if (result2.__filtered__) { + result2.__takeCount__ = nativeMin(n, result2.__takeCount__); + } else { + result2.__views__.push({ + "size": nativeMin(n, MAX_ARRAY_LENGTH), + "type": methodName + (result2.__dir__ < 0 ? "Right" : "") + }); + } + return result2; + }; + LazyWrapper.prototype[methodName + "Right"] = function(n) { + return this.reverse()[methodName](n).reverse(); + }; + }); + arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { + var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; + LazyWrapper.prototype[methodName] = function(iteratee2) { + var result2 = this.clone(); + result2.__iteratees__.push({ + "iteratee": getIteratee(iteratee2, 3), + "type": type + }); + result2.__filtered__ = result2.__filtered__ || isFilter; + return result2; + }; + }); + arrayEach(["head", "last"], function(methodName, index) { + var takeName = "take" + (index ? "Right" : ""); + LazyWrapper.prototype[methodName] = function() { + return this[takeName](1).value()[0]; + }; + }); + arrayEach(["initial", "tail"], function(methodName, index) { + var dropName = "drop" + (index ? "" : "Right"); + LazyWrapper.prototype[methodName] = function() { + return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); + }; + }); + LazyWrapper.prototype.compact = function() { + return this.filter(identity); + }; + LazyWrapper.prototype.find = function(predicate) { + return this.filter(predicate).head(); + }; + LazyWrapper.prototype.findLast = function(predicate) { + return this.reverse().find(predicate); + }; + LazyWrapper.prototype.invokeMap = baseRest(function(path18, args) { + if (typeof path18 == "function") { + return new LazyWrapper(this); + } + return this.map(function(value) { + return baseInvoke(value, path18, args); + }); + }); + LazyWrapper.prototype.reject = function(predicate) { + return this.filter(negate(getIteratee(predicate))); + }; + LazyWrapper.prototype.slice = function(start, end) { + start = toInteger(start); + var result2 = this; + if (result2.__filtered__ && (start > 0 || end < 0)) { + return new LazyWrapper(result2); + } + if (start < 0) { + result2 = result2.takeRight(-start); + } else if (start) { + result2 = result2.drop(start); + } + if (end !== undefined2) { + end = toInteger(end); + result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); + } + return result2; + }; + LazyWrapper.prototype.takeRightWhile = function(predicate) { + return this.reverse().takeWhile(predicate).reverse(); + }; + LazyWrapper.prototype.toArray = function() { + return this.take(MAX_ARRAY_LENGTH); + }; + baseForOwn(LazyWrapper.prototype, function(func, methodName) { + var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); + if (!lodashFunc) { + return; + } + lodash.prototype[methodName] = function() { + var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value); + var interceptor = function(value2) { + var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); + return isTaker && chainAll ? result3[0] : result3; + }; + if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { + isLazy = useLazy = false; + } + var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; + if (!retUnwrapped && useLazy) { + value = onlyLazy ? value : new LazyWrapper(this); + var result2 = func.apply(value, args); + result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); + return new LodashWrapper(result2, chainAll); + } + if (isUnwrapped && onlyLazy) { + return func.apply(this, args); + } + result2 = this.thru(interceptor); + return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; + }; + }); + arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { + var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); + lodash.prototype[methodName] = function() { + var args = arguments; + if (retUnwrapped && !this.__chain__) { + var value = this.value(); + return func.apply(isArray(value) ? value : [], args); + } + return this[chainName](function(value2) { + return func.apply(isArray(value2) ? value2 : [], args); + }); + }; + }); + baseForOwn(LazyWrapper.prototype, function(func, methodName) { + var lodashFunc = lodash[methodName]; + if (lodashFunc) { + var key = lodashFunc.name + ""; + if (!hasOwnProperty.call(realNames, key)) { + realNames[key] = []; + } + realNames[key].push({ "name": methodName, "func": lodashFunc }); + } + }); + realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ + "name": "wrapper", + "func": undefined2 + }]; + LazyWrapper.prototype.clone = lazyClone; + LazyWrapper.prototype.reverse = lazyReverse; + LazyWrapper.prototype.value = lazyValue; + lodash.prototype.at = wrapperAt; + lodash.prototype.chain = wrapperChain; + lodash.prototype.commit = wrapperCommit; + lodash.prototype.next = wrapperNext; + lodash.prototype.plant = wrapperPlant; + lodash.prototype.reverse = wrapperReverse; + lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; + lodash.prototype.first = lodash.prototype.head; + if (symIterator) { + lodash.prototype[symIterator] = wrapperToIterator; + } + return lodash; + }; + var _ = runInContext(); + if (typeof define == "function" && typeof define.amd == "object" && define.amd) { + root._ = _; + define(function() { + return _; + }); + } else if (freeModule) { + (freeModule.exports = _)._ = _; + freeExports._ = _; + } else { + root._ = _; + } + }).call(exports); + } +}); + +// node_modules/fmtr/index.js +var require_fmtr = __commonJS({ + "node_modules/fmtr/index.js"(exports, module2) { + "use strict"; + var _ = require_lodash(); + module2.exports = function fmtr(str, obj) { + if (typeof str !== "string") { + return ""; + } + return str.replace(/\\?\$\{([^\}]+)\}/gm, function(match, p1) { + if (/^\\/.test(match)) { + return match.substring(1); + } + return _.get(obj, p1) || ""; + }); + }; + } +}); + +// node_modules/fs.realpath/old.js +var require_old = __commonJS({ + "node_modules/fs.realpath/old.js"(exports) { + var pathModule = require("path"); + var isWindows = process.platform === "win32"; + var fs6 = require("fs"); + var DEBUG2 = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + function rethrow() { + var callback; + if (DEBUG2) { + var backtrace = new Error(); + callback = debugCallback; + } else + callback = missingCallback; + return callback; + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; + else if (!process.noDeprecation) { + var msg = "fs: missing callback " + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } + } + function maybeCallback(cb) { + return typeof cb === "function" ? cb : rethrow(); + } + var normalize3 = pathModule.normalize; + if (isWindows) { + nextPartRe = /(.*?)(?:[\/\\]+|$)/g; + } else { + nextPartRe = /(.*?)(?:[\/]+|$)/g; + } + var nextPartRe; + if (isWindows) { + splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; + } else { + splitRootRe = /^[\/]*/; + } + var splitRootRe; + exports.realpathSync = function realpathSync(p, cache) { + p = pathModule.resolve(p); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + var original = p, seenLinks = {}, knownHard = {}; + var pos; + var current; + var base; + var previous; + start(); + function start() { + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ""; + if (isWindows && !knownHard[base]) { + fs6.lstatSync(base); + knownHard[base] = true; + } + } + while (pos < p.length) { + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + if (knownHard[base] || cache && cache[base] === base) { + continue; + } + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + resolvedLink = cache[base]; + } else { + var stat2 = fs6.lstatSync(base); + if (!stat2.isSymbolicLink()) { + knownHard[base] = true; + if (cache) + cache[base] = base; + continue; + } + var linkTarget = null; + if (!isWindows) { + var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs6.statSync(base); + linkTarget = fs6.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + if (cache) + cache[base] = resolvedLink; + if (!isWindows) + seenLinks[id] = linkTarget; + } + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + if (cache) + cache[original] = p; + return p; + }; + exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== "function") { + cb = maybeCallback(cache); + cache = null; + } + p = pathModule.resolve(p); + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + var original = p, seenLinks = {}, knownHard = {}; + var pos; + var current; + var base; + var previous; + start(); + function start() { + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ""; + if (isWindows && !knownHard[base]) { + fs6.lstat(base, function(err) { + if (err) + return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + function LOOP() { + if (pos >= p.length) { + if (cache) + cache[original] = p; + return cb(null, p); + } + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + if (knownHard[base] || cache && cache[base] === base) { + return process.nextTick(LOOP); + } + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + return gotResolvedLink(cache[base]); + } + return fs6.lstat(base, gotStat); + } + function gotStat(err, stat2) { + if (err) + return cb(err); + if (!stat2.isSymbolicLink()) { + knownHard[base] = true; + if (cache) + cache[base] = base; + return process.nextTick(LOOP); + } + if (!isWindows) { + var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs6.stat(base, function(err2) { + if (err2) + return cb(err2); + fs6.readlink(base, function(err3, target) { + if (!isWindows) + seenLinks[id] = target; + gotTarget(err3, target); + }); + }); + } + function gotTarget(err, target, base2) { + if (err) + return cb(err); + var resolvedLink = pathModule.resolve(previous, target); + if (cache) + cache[base2] = resolvedLink; + gotResolvedLink(resolvedLink); + } + function gotResolvedLink(resolvedLink) { + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + }; + } +}); + +// node_modules/fs.realpath/index.js +var require_fs2 = __commonJS({ + "node_modules/fs.realpath/index.js"(exports, module2) { + module2.exports = realpath; + realpath.realpath = realpath; + realpath.sync = realpathSync; + realpath.realpathSync = realpathSync; + realpath.monkeypatch = monkeypatch; + realpath.unmonkeypatch = unmonkeypatch; + var fs6 = require("fs"); + var origRealpath = fs6.realpath; + var origRealpathSync = fs6.realpathSync; + var version = process.version; + var ok = /^v[0-5]\./.test(version); + var old = require_old(); + function newError(er) { + return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG"); + } + function realpath(p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb); + } + if (typeof cache === "function") { + cb = cache; + cache = null; + } + origRealpath(p, cache, function(er, result) { + if (newError(er)) { + old.realpath(p, cache, cb); + } else { + cb(er, result); + } + }); + } + function realpathSync(p, cache) { + if (ok) { + return origRealpathSync(p, cache); + } + try { + return origRealpathSync(p, cache); + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache); + } else { + throw er; + } + } + } + function monkeypatch() { + fs6.realpath = realpath; + fs6.realpathSync = realpathSync; + } + function unmonkeypatch() { + fs6.realpath = origRealpath; + fs6.realpathSync = origRealpathSync; + } + } +}); + +// node_modules/concat-map/index.js +var require_concat_map = __commonJS({ + "node_modules/concat-map/index.js"(exports, module2) { + module2.exports = function(xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) + res.push.apply(res, x); + else + res.push(x); + } + return res; + }; + var isArray = Array.isArray || function(xs) { + return Object.prototype.toString.call(xs) === "[object Array]"; + }; + } +}); + +// node_modules/balanced-match/index.js +var require_balanced_match = __commonJS({ + "node_modules/balanced-match/index.js"(exports, module2) { + "use strict"; + module2.exports = balanced; + function balanced(a, b, str) { + if (a instanceof RegExp) + a = maybeMatch(a, str); + if (b instanceof RegExp) + b = maybeMatch(b, str); + var r = range(a, b, str); + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; + } + function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; + } + balanced.range = range; + function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + if (ai >= 0 && bi > 0) { + if (a === b) { + return [ai, bi]; + } + begs = []; + left = str.length; + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [begs.pop(), bi]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + bi = str.indexOf(b, i + 1); + } + i = ai < bi && ai >= 0 ? ai : bi; + } + if (begs.length) { + result = [left, right]; + } + } + return result; + } + } +}); + +// node_modules/brace-expansion/index.js +var require_brace_expansion = __commonJS({ + "node_modules/brace-expansion/index.js"(exports, module2) { + var concatMap = require_concat_map(); + var balanced = require_balanced_match(); + module2.exports = expandTop; + var escSlash = "\0SLASH" + Math.random() + "\0"; + var escOpen = "\0OPEN" + Math.random() + "\0"; + var escClose = "\0CLOSE" + Math.random() + "\0"; + var escComma = "\0COMMA" + Math.random() + "\0"; + var escPeriod = "\0PERIOD" + Math.random() + "\0"; + function numeric(str) { + return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0); + } + function escapeBraces(str) { + return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod); + } + function unescapeBraces(str) { + return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join("."); + } + function parseCommaParts(str) { + if (!str) + return [""]; + var parts = []; + var m = balanced("{", "}", str); + if (!m) + return str.split(","); + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(","); + p[p.length - 1] += "{" + body + "}"; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length - 1] += postParts.shift(); + p.push.apply(p, postParts); + } + parts.push.apply(parts, p); + return parts; + } + function expandTop(str) { + if (!str) + return []; + if (str.substr(0, 2) === "{}") { + str = "\\{\\}" + str.substr(2); + } + return expand(escapeBraces(str), true).map(unescapeBraces); + } + function embrace(str) { + return "{" + str + "}"; + } + function isPadded(el) { + return /^-?0\d/.test(el); + } + function lte(i, y) { + return i <= y; + } + function gte2(i, y) { + return i >= y; + } + function expand(str, isTop) { + var expansions = []; + var m = balanced("{", "}", str); + if (!m || /\$$/.test(m.pre)) + return [str]; + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(",") >= 0; + if (!isSequence && !isOptions) { + if (m.post.match(/,.*\}/)) { + str = m.pre + "{" + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length ? expand(m.post, false) : [""]; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + var pre = m.pre; + var post = m.post.length ? expand(m.post, false) : [""]; + var N; + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length); + var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte2; + } + var pad = n.some(isPadded); + N = []; + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === "\\") + c = ""; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join("0"); + if (i < 0) + c = "-" + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { + return expand(el, false); + }); + } + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + return expansions; + } + } +}); + +// node_modules/minimatch/minimatch.js +var require_minimatch = __commonJS({ + "node_modules/minimatch/minimatch.js"(exports, module2) { + module2.exports = minimatch; + minimatch.Minimatch = Minimatch; + var path18 = function() { + try { + return require("path"); + } catch (e) { + } + }() || { + sep: "/" + }; + minimatch.sep = path18.sep; + var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; + var expand = require_brace_expansion(); + var plTypes = { + "!": { open: "(?:(?!(?:", close: "))[^/]*?)" }, + "?": { open: "(?:", close: ")?" }, + "+": { open: "(?:", close: ")+" }, + "*": { open: "(?:", close: ")*" }, + "@": { open: "(?:", close: ")" } + }; + var qmark = "[^/]"; + var star = qmark + "*?"; + var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?"; + var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?"; + var reSpecials = charSet("().*{}+?[]^$\\!"); + function charSet(s) { + return s.split("").reduce(function(set, c) { + set[c] = true; + return set; + }, {}); + } + var slashSplit = /\/+/; + minimatch.filter = filter; + function filter(pattern, options2) { + options2 = options2 || {}; + return function(p, i, list) { + return minimatch(p, pattern, options2); + }; + } + function ext(a, b) { + b = b || {}; + var t = {}; + Object.keys(a).forEach(function(k) { + t[k] = a[k]; + }); + Object.keys(b).forEach(function(k) { + t[k] = b[k]; + }); + return t; + } + minimatch.defaults = function(def) { + if (!def || typeof def !== "object" || !Object.keys(def).length) { + return minimatch; + } + var orig = minimatch; + var m = function minimatch2(p, pattern, options2) { + return orig(p, pattern, ext(def, options2)); + }; + m.Minimatch = function Minimatch2(pattern, options2) { + return new orig.Minimatch(pattern, ext(def, options2)); + }; + m.Minimatch.defaults = function defaults2(options2) { + return orig.defaults(ext(def, options2)).Minimatch; + }; + m.filter = function filter2(pattern, options2) { + return orig.filter(pattern, ext(def, options2)); + }; + m.defaults = function defaults2(options2) { + return orig.defaults(ext(def, options2)); + }; + m.makeRe = function makeRe2(pattern, options2) { + return orig.makeRe(pattern, ext(def, options2)); + }; + m.braceExpand = function braceExpand2(pattern, options2) { + return orig.braceExpand(pattern, ext(def, options2)); + }; + m.match = function(list, pattern, options2) { + return orig.match(list, pattern, ext(def, options2)); + }; + return m; + }; + Minimatch.defaults = function(def) { + return minimatch.defaults(def).Minimatch; + }; + function minimatch(p, pattern, options2) { + assertValidPattern(pattern); + if (!options2) + options2 = {}; + if (!options2.nocomment && pattern.charAt(0) === "#") { + return false; + } + return new Minimatch(pattern, options2).match(p); + } + function Minimatch(pattern, options2) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options2); + } + assertValidPattern(pattern); + if (!options2) + options2 = {}; + pattern = pattern.trim(); + if (!options2.allowWindowsEscape && path18.sep !== "/") { + pattern = pattern.split(path18.sep).join("/"); + } + this.options = options2; + this.set = []; + this.pattern = pattern; + this.regexp = null; + this.negate = false; + this.comment = false; + this.empty = false; + this.partial = !!options2.partial; + this.make(); + } + Minimatch.prototype.debug = function() { + }; + Minimatch.prototype.make = make; + function make() { + var pattern = this.pattern; + var options2 = this.options; + if (!options2.nocomment && pattern.charAt(0) === "#") { + this.comment = true; + return; + } + if (!pattern) { + this.empty = true; + return; + } + this.parseNegate(); + var set = this.globSet = this.braceExpand(); + if (options2.debug) + this.debug = function debug() { + console.error.apply(console, arguments); + }; + this.debug(this.pattern, set); + set = this.globParts = set.map(function(s) { + return s.split(slashSplit); + }); + this.debug(this.pattern, set); + set = set.map(function(s, si, set2) { + return s.map(this.parse, this); + }, this); + this.debug(this.pattern, set); + set = set.filter(function(s) { + return s.indexOf(false) === -1; + }); + this.debug(this.pattern, set); + this.set = set; + } + Minimatch.prototype.parseNegate = parseNegate; + function parseNegate() { + var pattern = this.pattern; + var negate = false; + var options2 = this.options; + var negateOffset = 0; + if (options2.nonegate) + return; + for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) { + negate = !negate; + negateOffset++; + } + if (negateOffset) + this.pattern = pattern.substr(negateOffset); + this.negate = negate; + } + minimatch.braceExpand = function(pattern, options2) { + return braceExpand(pattern, options2); + }; + Minimatch.prototype.braceExpand = braceExpand; + function braceExpand(pattern, options2) { + if (!options2) { + if (this instanceof Minimatch) { + options2 = this.options; + } else { + options2 = {}; + } + } + pattern = typeof pattern === "undefined" ? this.pattern : pattern; + assertValidPattern(pattern); + if (options2.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + return [pattern]; + } + return expand(pattern); + } + var MAX_PATTERN_LENGTH = 1024 * 64; + var assertValidPattern = function(pattern) { + if (typeof pattern !== "string") { + throw new TypeError("invalid pattern"); + } + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError("pattern is too long"); + } + }; + Minimatch.prototype.parse = parse; + var SUBPARSE = {}; + function parse(pattern, isSub) { + assertValidPattern(pattern); + var options2 = this.options; + if (pattern === "**") { + if (!options2.noglobstar) + return GLOBSTAR; + else + pattern = "*"; + } + if (pattern === "") + return ""; + var re = ""; + var hasMagic = !!options2.nocase; + var escaping = false; + var patternListStack = []; + var negativeLists = []; + var stateChar; + var inClass = false; + var reClassStart = -1; + var classStart = -1; + var patternStart = pattern.charAt(0) === "." ? "" : options2.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)"; + var self2 = this; + function clearStateChar() { + if (stateChar) { + switch (stateChar) { + case "*": + re += star; + hasMagic = true; + break; + case "?": + re += qmark; + hasMagic = true; + break; + default: + re += "\\" + stateChar; + break; + } + self2.debug("clearStateChar %j %j", stateChar, re); + stateChar = false; + } + } + for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { + this.debug("%s %s %s %j", pattern, i, re, c); + if (escaping && reSpecials[c]) { + re += "\\" + c; + escaping = false; + continue; + } + switch (c) { + case "/": { + return false; + } + case "\\": + clearStateChar(); + escaping = true; + continue; + case "?": + case "*": + case "+": + case "@": + case "!": + this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c); + if (inClass) { + this.debug(" in class"); + if (c === "!" && i === classStart + 1) + c = "^"; + re += c; + continue; + } + self2.debug("call clearStateChar %j", stateChar); + clearStateChar(); + stateChar = c; + if (options2.noext) + clearStateChar(); + continue; + case "(": + if (inClass) { + re += "("; + continue; + } + if (!stateChar) { + re += "\\("; + continue; + } + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }); + re += stateChar === "!" ? "(?:(?!(?:" : "(?:"; + this.debug("plType %j %j", stateChar, re); + stateChar = false; + continue; + case ")": + if (inClass || !patternListStack.length) { + re += "\\)"; + continue; + } + clearStateChar(); + hasMagic = true; + var pl = patternListStack.pop(); + re += pl.close; + if (pl.type === "!") { + negativeLists.push(pl); + } + pl.reEnd = re.length; + continue; + case "|": + if (inClass || !patternListStack.length || escaping) { + re += "\\|"; + escaping = false; + continue; + } + clearStateChar(); + re += "|"; + continue; + case "[": + clearStateChar(); + if (inClass) { + re += "\\" + c; + continue; + } + inClass = true; + classStart = i; + reClassStart = re.length; + re += c; + continue; + case "]": + if (i === classStart + 1 || !inClass) { + re += "\\" + c; + escaping = false; + continue; + } + var cs = pattern.substring(classStart + 1, i); + try { + RegExp("[" + cs + "]"); + } catch (er) { + var sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]"; + hasMagic = hasMagic || sp[1]; + inClass = false; + continue; + } + hasMagic = true; + inClass = false; + re += c; + continue; + default: + clearStateChar(); + if (escaping) { + escaping = false; + } else if (reSpecials[c] && !(c === "^" && inClass)) { + re += "\\"; + } + re += c; + } + } + if (inClass) { + cs = pattern.substr(classStart + 1); + sp = this.parse(cs, SUBPARSE); + re = re.substr(0, reClassStart) + "\\[" + sp[0]; + hasMagic = hasMagic || sp[1]; + } + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length); + this.debug("setting tail", re, pl); + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) { + if (!$2) { + $2 = "\\"; + } + return $1 + $1 + $2 + "|"; + }); + this.debug("tail=%j\n %s", tail, tail, pl, re); + var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type; + hasMagic = true; + re = re.slice(0, pl.reStart) + t + "\\(" + tail; + } + clearStateChar(); + if (escaping) { + re += "\\\\"; + } + var addPatternStart = false; + switch (re.charAt(0)) { + case "[": + case ".": + case "(": + addPatternStart = true; + } + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n]; + var nlBefore = re.slice(0, nl.reStart); + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re.slice(nl.reEnd); + nlLast += nlAfter; + var openParensBefore = nlBefore.split("(").length - 1; + var cleanAfter = nlAfter; + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, ""); + } + nlAfter = cleanAfter; + var dollar = ""; + if (nlAfter === "" && isSub !== SUBPARSE) { + dollar = "$"; + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; + re = newRe; + } + if (re !== "" && hasMagic) { + re = "(?=.)" + re; + } + if (addPatternStart) { + re = patternStart + re; + } + if (isSub === SUBPARSE) { + return [re, hasMagic]; + } + if (!hasMagic) { + return globUnescape(pattern); + } + var flags = options2.nocase ? "i" : ""; + try { + var regExp = new RegExp("^" + re + "$", flags); + } catch (er) { + return new RegExp("$."); + } + regExp._glob = pattern; + regExp._src = re; + return regExp; + } + minimatch.makeRe = function(pattern, options2) { + return new Minimatch(pattern, options2 || {}).makeRe(); + }; + Minimatch.prototype.makeRe = makeRe; + function makeRe() { + if (this.regexp || this.regexp === false) + return this.regexp; + var set = this.set; + if (!set.length) { + this.regexp = false; + return this.regexp; + } + var options2 = this.options; + var twoStar = options2.noglobstar ? star : options2.dot ? twoStarDot : twoStarNoDot; + var flags = options2.nocase ? "i" : ""; + var re = set.map(function(pattern) { + return pattern.map(function(p) { + return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src; + }).join("\\/"); + }).join("|"); + re = "^(?:" + re + ")$"; + if (this.negate) + re = "^(?!" + re + ").*$"; + try { + this.regexp = new RegExp(re, flags); + } catch (ex) { + this.regexp = false; + } + return this.regexp; + } + minimatch.match = function(list, pattern, options2) { + options2 = options2 || {}; + var mm = new Minimatch(pattern, options2); + list = list.filter(function(f) { + return mm.match(f); + }); + if (mm.options.nonull && !list.length) { + list.push(pattern); + } + return list; + }; + Minimatch.prototype.match = function match(f, partial) { + if (typeof partial === "undefined") + partial = this.partial; + this.debug("match", f, this.pattern); + if (this.comment) + return false; + if (this.empty) + return f === ""; + if (f === "/" && partial) + return true; + var options2 = this.options; + if (path18.sep !== "/") { + f = f.split(path18.sep).join("/"); + } + f = f.split(slashSplit); + this.debug(this.pattern, "split", f); + var set = this.set; + this.debug(this.pattern, "set", set); + var filename; + var i; + for (i = f.length - 1; i >= 0; i--) { + filename = f[i]; + if (filename) + break; + } + for (i = 0; i < set.length; i++) { + var pattern = set[i]; + var file = f; + if (options2.matchBase && pattern.length === 1) { + file = [filename]; + } + var hit = this.matchOne(file, pattern, partial); + if (hit) { + if (options2.flipNegate) + return true; + return !this.negate; + } + } + if (options2.flipNegate) + return false; + return this.negate; + }; + Minimatch.prototype.matchOne = function(file, pattern, partial) { + var options2 = this.options; + this.debug( + "matchOne", + { "this": this, file, pattern } + ); + this.debug("matchOne", file.length, pattern.length); + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug("matchOne loop"); + var p = pattern[pi]; + var f = file[fi]; + this.debug(pattern, p, f); + if (p === false) + return false; + if (p === GLOBSTAR) { + this.debug("GLOBSTAR", [pattern, p, f]); + var fr = fi; + var pr = pi + 1; + if (pr === pl) { + this.debug("** at the end"); + for (; fi < fl; fi++) { + if (file[fi] === "." || file[fi] === ".." || !options2.dot && file[fi].charAt(0) === ".") + return false; + } + return true; + } + while (fr < fl) { + var swallowee = file[fr]; + this.debug("\nglobstar while", file, fr, pattern, pr, swallowee); + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug("globstar found match!", fr, fl, swallowee); + return true; + } else { + if (swallowee === "." || swallowee === ".." || !options2.dot && swallowee.charAt(0) === ".") { + this.debug("dot detected!", file, fr, pattern, pr); + break; + } + this.debug("globstar swallow a segment, and continue"); + fr++; + } + } + if (partial) { + this.debug("\n>>> no match, partial?", file, fr, pattern, pr); + if (fr === fl) + return true; + } + return false; + } + var hit; + if (typeof p === "string") { + hit = f === p; + this.debug("string match", p, f, hit); + } else { + hit = f.match(p); + this.debug("pattern match", p, f, hit); + } + if (!hit) + return false; + } + if (fi === fl && pi === pl) { + return true; + } else if (fi === fl) { + return partial; + } else if (pi === pl) { + return fi === fl - 1 && file[fi] === ""; + } + throw new Error("wtf?"); + }; + function globUnescape(s) { + return s.replace(/\\(.)/g, "$1"); + } + function regExpEscape(s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + } + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS({ + "node_modules/inherits/inherits_browser.js"(exports, module2) { + if (typeof Object.create === "function") { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; + } else { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS({ + "node_modules/inherits/inherits.js"(exports, module2) { + try { + util = require("util"); + if (typeof util.inherits !== "function") + throw ""; + module2.exports = util.inherits; + } catch (e) { + module2.exports = require_inherits_browser(); + } + var util; + } +}); + +// node_modules/path-is-absolute/index.js +var require_path_is_absolute = __commonJS({ + "node_modules/path-is-absolute/index.js"(exports, module2) { + "use strict"; + function posix(path18) { + return path18.charAt(0) === "/"; + } + function win32(path18) { + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path18); + var device = result[1] || ""; + var isUnc = Boolean(device && device.charAt(1) !== ":"); + return Boolean(result[2] || isUnc); + } + module2.exports = process.platform === "win32" ? win32 : posix; + module2.exports.posix = posix; + module2.exports.win32 = win32; + } +}); + +// node_modules/glob/common.js +var require_common = __commonJS({ + "node_modules/glob/common.js"(exports) { + exports.setopts = setopts; + exports.ownProp = ownProp; + exports.makeAbs = makeAbs; + exports.finish = finish; + exports.mark = mark; + exports.isIgnored = isIgnored; + exports.childrenIgnored = childrenIgnored; + function ownProp(obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field); + } + var fs6 = require("fs"); + var path18 = require("path"); + var minimatch = require_minimatch(); + var isAbsolute4 = require_path_is_absolute(); + var Minimatch = minimatch.Minimatch; + function alphasort(a, b) { + return a.localeCompare(b, "en"); + } + function setupIgnores(self2, options2) { + self2.ignore = options2.ignore || []; + if (!Array.isArray(self2.ignore)) + self2.ignore = [self2.ignore]; + if (self2.ignore.length) { + self2.ignore = self2.ignore.map(ignoreMap); + } + } + function ignoreMap(pattern) { + var gmatcher = null; + if (pattern.slice(-3) === "/**") { + var gpattern = pattern.replace(/(\/\*\*)+$/, ""); + gmatcher = new Minimatch(gpattern, { dot: true }); + } + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher + }; + } + function setopts(self2, pattern, options2) { + if (!options2) + options2 = {}; + if (options2.matchBase && -1 === pattern.indexOf("/")) { + if (options2.noglobstar) { + throw new Error("base matching requires globstar"); + } + pattern = "**/" + pattern; + } + self2.silent = !!options2.silent; + self2.pattern = pattern; + self2.strict = options2.strict !== false; + self2.realpath = !!options2.realpath; + self2.realpathCache = options2.realpathCache || /* @__PURE__ */ Object.create(null); + self2.follow = !!options2.follow; + self2.dot = !!options2.dot; + self2.mark = !!options2.mark; + self2.nodir = !!options2.nodir; + if (self2.nodir) + self2.mark = true; + self2.sync = !!options2.sync; + self2.nounique = !!options2.nounique; + self2.nonull = !!options2.nonull; + self2.nosort = !!options2.nosort; + self2.nocase = !!options2.nocase; + self2.stat = !!options2.stat; + self2.noprocess = !!options2.noprocess; + self2.absolute = !!options2.absolute; + self2.fs = options2.fs || fs6; + self2.maxLength = options2.maxLength || Infinity; + self2.cache = options2.cache || /* @__PURE__ */ Object.create(null); + self2.statCache = options2.statCache || /* @__PURE__ */ Object.create(null); + self2.symlinks = options2.symlinks || /* @__PURE__ */ Object.create(null); + setupIgnores(self2, options2); + self2.changedCwd = false; + var cwd = process.cwd(); + if (!ownProp(options2, "cwd")) + self2.cwd = cwd; + else { + self2.cwd = path18.resolve(options2.cwd); + self2.changedCwd = self2.cwd !== cwd; + } + self2.root = options2.root || path18.resolve(self2.cwd, "/"); + self2.root = path18.resolve(self2.root); + if (process.platform === "win32") + self2.root = self2.root.replace(/\\/g, "/"); + self2.cwdAbs = isAbsolute4(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd); + if (process.platform === "win32") + self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/"); + self2.nomount = !!options2.nomount; + options2.nonegate = true; + options2.nocomment = true; + options2.allowWindowsEscape = false; + self2.minimatch = new Minimatch(pattern, options2); + self2.options = self2.minimatch.options; + } + function finish(self2) { + var nou = self2.nounique; + var all = nou ? [] : /* @__PURE__ */ Object.create(null); + for (var i = 0, l = self2.matches.length; i < l; i++) { + var matches = self2.matches[i]; + if (!matches || Object.keys(matches).length === 0) { + if (self2.nonull) { + var literal = self2.minimatch.globSet[i]; + if (nou) + all.push(literal); + else + all[literal] = true; + } + } else { + var m = Object.keys(matches); + if (nou) + all.push.apply(all, m); + else + m.forEach(function(m2) { + all[m2] = true; + }); + } + } + if (!nou) + all = Object.keys(all); + if (!self2.nosort) + all = all.sort(alphasort); + if (self2.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self2._mark(all[i]); + } + if (self2.nodir) { + all = all.filter(function(e) { + var notDir = !/\/$/.test(e); + var c = self2.cache[e] || self2.cache[makeAbs(self2, e)]; + if (notDir && c) + notDir = c !== "DIR" && !Array.isArray(c); + return notDir; + }); + } + } + if (self2.ignore.length) + all = all.filter(function(m2) { + return !isIgnored(self2, m2); + }); + self2.found = all; + } + function mark(self2, p) { + var abs = makeAbs(self2, p); + var c = self2.cache[abs]; + var m = p; + if (c) { + var isDir = c === "DIR" || Array.isArray(c); + var slash = p.slice(-1) === "/"; + if (isDir && !slash) + m += "/"; + else if (!isDir && slash) + m = m.slice(0, -1); + if (m !== p) { + var mabs = makeAbs(self2, m); + self2.statCache[mabs] = self2.statCache[abs]; + self2.cache[mabs] = self2.cache[abs]; + } + } + return m; + } + function makeAbs(self2, f) { + var abs = f; + if (f.charAt(0) === "/") { + abs = path18.join(self2.root, f); + } else if (isAbsolute4(f) || f === "") { + abs = f; + } else if (self2.changedCwd) { + abs = path18.resolve(self2.cwd, f); + } else { + abs = path18.resolve(f); + } + if (process.platform === "win32") + abs = abs.replace(/\\/g, "/"); + return abs; + } + function isIgnored(self2, path19) { + if (!self2.ignore.length) + return false; + return self2.ignore.some(function(item) { + return item.matcher.match(path19) || !!(item.gmatcher && item.gmatcher.match(path19)); + }); + } + function childrenIgnored(self2, path19) { + if (!self2.ignore.length) + return false; + return self2.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path19)); + }); + } + } +}); + +// node_modules/glob/sync.js +var require_sync = __commonJS({ + "node_modules/glob/sync.js"(exports, module2) { + module2.exports = globSync; + globSync.GlobSync = GlobSync; + var rp = require_fs2(); + var minimatch = require_minimatch(); + var Minimatch = minimatch.Minimatch; + var Glob = require_glob().Glob; + var util = require("util"); + var path18 = require("path"); + var assert = require("assert"); + var isAbsolute4 = require_path_is_absolute(); + var common = require_common(); + var setopts = common.setopts; + var ownProp = common.ownProp; + var childrenIgnored = common.childrenIgnored; + var isIgnored = common.isIgnored; + function globSync(pattern, options2) { + if (typeof options2 === "function" || arguments.length === 3) + throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167"); + return new GlobSync(pattern, options2).found; + } + function GlobSync(pattern, options2) { + if (!pattern) + throw new Error("must provide pattern"); + if (typeof options2 === "function" || arguments.length === 3) + throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167"); + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options2); + setopts(this, pattern, options2); + if (this.noprocess) + return this; + var n = this.minimatch.set.length; + this.matches = new Array(n); + for (var i = 0; i < n; i++) { + this._process(this.minimatch.set[i], i, false); + } + this._finish(); + } + GlobSync.prototype._finish = function() { + assert.ok(this instanceof GlobSync); + if (this.realpath) { + var self2 = this; + this.matches.forEach(function(matchset, index) { + var set = self2.matches[index] = /* @__PURE__ */ Object.create(null); + for (var p in matchset) { + try { + p = self2._makeAbs(p); + var real = rp.realpathSync(p, self2.realpathCache); + set[real] = true; + } catch (er) { + if (er.syscall === "stat") + set[self2._makeAbs(p)] = true; + else + throw er; + } + } + }); + } + common.finish(this); + }; + GlobSync.prototype._process = function(pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync); + var n = 0; + while (typeof pattern[n] === "string") { + n++; + } + var prefix; + switch (n) { + case pattern.length: + this._processSimple(pattern.join("/"), index); + return; + case 0: + prefix = null; + break; + default: + prefix = pattern.slice(0, n).join("/"); + break; + } + var remain = pattern.slice(n); + var read; + if (prefix === null) + read = "."; + else if (isAbsolute4(prefix) || isAbsolute4(pattern.map(function(p) { + return typeof p === "string" ? p : "[*]"; + }).join("/"))) { + if (!prefix || !isAbsolute4(prefix)) + prefix = "/" + prefix; + read = prefix; + } else + read = prefix; + var abs = this._makeAbs(read); + if (childrenIgnored(this, read)) + return; + var isGlobStar = remain[0] === minimatch.GLOBSTAR; + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar); + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar); + }; + GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar); + if (!entries) + return; + var pn = remain[0]; + var negate = !!this.minimatch.negate; + var rawGlob = pn._glob; + var dotOk = this.dot || rawGlob.charAt(0) === "."; + var matchedEntries = []; + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (e.charAt(0) !== "." || dotOk) { + var m; + if (negate && !prefix) { + m = !e.match(pn); + } else { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + var len = matchedEntries.length; + if (len === 0) + return; + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = /* @__PURE__ */ Object.create(null); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + if (prefix) { + if (prefix.slice(-1) !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + if (e.charAt(0) === "/" && !this.nomount) { + e = path18.join(this.root, e); + } + this._emitMatch(index, e); + } + return; + } + remain.shift(); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + var newPattern; + if (prefix) + newPattern = [prefix, e]; + else + newPattern = [e]; + this._process(newPattern.concat(remain), index, inGlobStar); + } + }; + GlobSync.prototype._emitMatch = function(index, e) { + if (isIgnored(this, e)) + return; + var abs = this._makeAbs(e); + if (this.mark) + e = this._mark(e); + if (this.absolute) { + e = abs; + } + if (this.matches[index][e]) + return; + if (this.nodir) { + var c = this.cache[abs]; + if (c === "DIR" || Array.isArray(c)) + return; + } + this.matches[index][e] = true; + if (this.stat) + this._stat(e); + }; + GlobSync.prototype._readdirInGlobStar = function(abs) { + if (this.follow) + return this._readdir(abs, false); + var entries; + var lstat; + var stat2; + try { + lstat = this.fs.lstatSync(abs); + } catch (er) { + if (er.code === "ENOENT") { + return null; + } + } + var isSym = lstat && lstat.isSymbolicLink(); + this.symlinks[abs] = isSym; + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = "FILE"; + else + entries = this._readdir(abs, false); + return entries; + }; + GlobSync.prototype._readdir = function(abs, inGlobStar) { + var entries; + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === "FILE") + return null; + if (Array.isArray(c)) + return c; + } + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)); + } catch (er) { + this._readdirError(abs, er); + return null; + } + }; + GlobSync.prototype._readdirEntries = function(abs, entries) { + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (abs === "/") + e = abs + e; + else + e = abs + "/" + e; + this.cache[e] = true; + } + } + this.cache[abs] = entries; + return entries; + }; + GlobSync.prototype._readdirError = function(f, er) { + switch (er.code) { + case "ENOTSUP": + case "ENOTDIR": + var abs = this._makeAbs(f); + this.cache[abs] = "FILE"; + if (abs === this.cwdAbs) { + var error = new Error(er.code + " invalid cwd " + this.cwd); + error.path = this.cwd; + error.code = er.code; + throw error; + } + break; + case "ENOENT": + case "ELOOP": + case "ENAMETOOLONG": + case "UNKNOWN": + this.cache[this._makeAbs(f)] = false; + break; + default: + this.cache[this._makeAbs(f)] = false; + if (this.strict) + throw er; + if (!this.silent) + console.error("glob error", er); + break; + } + }; + GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar); + if (!entries) + return; + var remainWithoutGlobStar = remain.slice(1); + var gspref = prefix ? [prefix] : []; + var noGlobStar = gspref.concat(remainWithoutGlobStar); + this._process(noGlobStar, index, false); + var len = entries.length; + var isSym = this.symlinks[abs]; + if (isSym && inGlobStar) + return; + for (var i = 0; i < len; i++) { + var e = entries[i]; + if (e.charAt(0) === "." && !this.dot) + continue; + var instead = gspref.concat(entries[i], remainWithoutGlobStar); + this._process(instead, index, true); + var below = gspref.concat(entries[i], remain); + this._process(below, index, true); + } + }; + GlobSync.prototype._processSimple = function(prefix, index) { + var exists = this._stat(prefix); + if (!this.matches[index]) + this.matches[index] = /* @__PURE__ */ Object.create(null); + if (!exists) + return; + if (prefix && isAbsolute4(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix); + if (prefix.charAt(0) === "/") { + prefix = path18.join(this.root, prefix); + } else { + prefix = path18.resolve(this.root, prefix); + if (trail) + prefix += "/"; + } + } + if (process.platform === "win32") + prefix = prefix.replace(/\\/g, "/"); + this._emitMatch(index, prefix); + }; + GlobSync.prototype._stat = function(f) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === "/"; + if (f.length > this.maxLength) + return false; + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (Array.isArray(c)) + c = "DIR"; + if (!needDir || c === "DIR") + return c; + if (needDir && c === "FILE") + return false; + } + var exists; + var stat2 = this.statCache[abs]; + if (!stat2) { + var lstat; + try { + lstat = this.fs.lstatSync(abs); + } catch (er) { + if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + this.statCache[abs] = false; + return false; + } + } + if (lstat && lstat.isSymbolicLink()) { + try { + stat2 = this.fs.statSync(abs); + } catch (er) { + stat2 = lstat; + } + } else { + stat2 = lstat; + } + } + this.statCache[abs] = stat2; + var c = true; + if (stat2) + c = stat2.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c; + if (needDir && c === "FILE") + return false; + return c; + }; + GlobSync.prototype._mark = function(p) { + return common.mark(this, p); + }; + GlobSync.prototype._makeAbs = function(f) { + return common.makeAbs(this, f); + }; + } +}); + +// node_modules/wrappy/wrappy.js +var require_wrappy = __commonJS({ + "node_modules/wrappy/wrappy.js"(exports, module2) { + module2.exports = wrappy; + function wrappy(fn, cb) { + if (fn && cb) + return wrappy(fn)(cb); + if (typeof fn !== "function") + throw new TypeError("need wrapper function"); + Object.keys(fn).forEach(function(k) { + wrapper[k] = fn[k]; + }); + return wrapper; + function wrapper() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + var ret = fn.apply(this, args); + var cb2 = args[args.length - 1]; + if (typeof ret === "function" && ret !== cb2) { + Object.keys(cb2).forEach(function(k) { + ret[k] = cb2[k]; + }); + } + return ret; + } + } + } +}); + +// node_modules/once/once.js +var require_once = __commonJS({ + "node_modules/once/once.js"(exports, module2) { + var wrappy = require_wrappy(); + module2.exports = wrappy(once); + module2.exports.strict = wrappy(onceStrict); + once.proto = once(function() { + Object.defineProperty(Function.prototype, "once", { + value: function() { + return once(this); + }, + configurable: true + }); + Object.defineProperty(Function.prototype, "onceStrict", { + value: function() { + return onceStrict(this); + }, + configurable: true + }); + }); + function once(fn) { + var f = function() { + if (f.called) + return f.value; + f.called = true; + return f.value = fn.apply(this, arguments); + }; + f.called = false; + return f; + } + function onceStrict(fn) { + var f = function() { + if (f.called) + throw new Error(f.onceError); + f.called = true; + return f.value = fn.apply(this, arguments); + }; + var name = fn.name || "Function wrapped with `once`"; + f.onceError = name + " shouldn't be called more than once"; + f.called = false; + return f; + } + } +}); + +// node_modules/inflight/inflight.js +var require_inflight = __commonJS({ + "node_modules/inflight/inflight.js"(exports, module2) { + var wrappy = require_wrappy(); + var reqs = /* @__PURE__ */ Object.create(null); + var once = require_once(); + module2.exports = wrappy(inflight); + function inflight(key, cb) { + if (reqs[key]) { + reqs[key].push(cb); + return null; + } else { + reqs[key] = [cb]; + return makeres(key); + } + } + function makeres(key) { + return once(function RES() { + var cbs = reqs[key]; + var len = cbs.length; + var args = slice(arguments); + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args); + } + } finally { + if (cbs.length > len) { + cbs.splice(0, len); + process.nextTick(function() { + RES.apply(null, args); + }); + } else { + delete reqs[key]; + } + } + }); + } + function slice(args) { + var length = args.length; + var array = []; + for (var i = 0; i < length; i++) + array[i] = args[i]; + return array; + } + } +}); + +// node_modules/glob/glob.js +var require_glob = __commonJS({ + "node_modules/glob/glob.js"(exports, module2) { + module2.exports = glob3; + var rp = require_fs2(); + var minimatch = require_minimatch(); + var Minimatch = minimatch.Minimatch; + var inherits = require_inherits(); + var EE = require("events").EventEmitter; + var path18 = require("path"); + var assert = require("assert"); + var isAbsolute4 = require_path_is_absolute(); + var globSync = require_sync(); + var common = require_common(); + var setopts = common.setopts; + var ownProp = common.ownProp; + var inflight = require_inflight(); + var util = require("util"); + var childrenIgnored = common.childrenIgnored; + var isIgnored = common.isIgnored; + var once = require_once(); + function glob3(pattern, options2, cb) { + if (typeof options2 === "function") + cb = options2, options2 = {}; + if (!options2) + options2 = {}; + if (options2.sync) { + if (cb) + throw new TypeError("callback provided to sync glob"); + return globSync(pattern, options2); + } + return new Glob(pattern, options2, cb); + } + glob3.sync = globSync; + var GlobSync = glob3.GlobSync = globSync.GlobSync; + glob3.glob = glob3; + function extend(origin, add) { + if (add === null || typeof add !== "object") { + return origin; + } + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; + } + glob3.hasMagic = function(pattern, options_) { + var options2 = extend({}, options_); + options2.noprocess = true; + var g = new Glob(pattern, options2); + var set = g.minimatch.set; + if (!pattern) + return false; + if (set.length > 1) + return true; + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== "string") + return true; + } + return false; + }; + glob3.Glob = Glob; + inherits(Glob, EE); + function Glob(pattern, options2, cb) { + if (typeof options2 === "function") { + cb = options2; + options2 = null; + } + if (options2 && options2.sync) { + if (cb) + throw new TypeError("callback provided to sync glob"); + return new GlobSync(pattern, options2); + } + if (!(this instanceof Glob)) + return new Glob(pattern, options2, cb); + setopts(this, pattern, options2); + this._didRealPath = false; + var n = this.minimatch.set.length; + this.matches = new Array(n); + if (typeof cb === "function") { + cb = once(cb); + this.on("error", cb); + this.on("end", function(matches) { + cb(null, matches); + }); + } + var self2 = this; + this._processing = 0; + this._emitQueue = []; + this._processQueue = []; + this.paused = false; + if (this.noprocess) + return this; + if (n === 0) + return done(); + var sync2 = true; + for (var i = 0; i < n; i++) { + this._process(this.minimatch.set[i], i, false, done); + } + sync2 = false; + function done() { + --self2._processing; + if (self2._processing <= 0) { + if (sync2) { + process.nextTick(function() { + self2._finish(); + }); + } else { + self2._finish(); + } + } + } + } + Glob.prototype._finish = function() { + assert(this instanceof Glob); + if (this.aborted) + return; + if (this.realpath && !this._didRealpath) + return this._realpath(); + common.finish(this); + this.emit("end", this.found); + }; + Glob.prototype._realpath = function() { + if (this._didRealpath) + return; + this._didRealpath = true; + var n = this.matches.length; + if (n === 0) + return this._finish(); + var self2 = this; + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next); + function next() { + if (--n === 0) + self2._finish(); + } + }; + Glob.prototype._realpathSet = function(index, cb) { + var matchset = this.matches[index]; + if (!matchset) + return cb(); + var found = Object.keys(matchset); + var self2 = this; + var n = found.length; + if (n === 0) + return cb(); + var set = this.matches[index] = /* @__PURE__ */ Object.create(null); + found.forEach(function(p, i) { + p = self2._makeAbs(p); + rp.realpath(p, self2.realpathCache, function(er, real) { + if (!er) + set[real] = true; + else if (er.syscall === "stat") + set[p] = true; + else + self2.emit("error", er); + if (--n === 0) { + self2.matches[index] = set; + cb(); + } + }); + }); + }; + Glob.prototype._mark = function(p) { + return common.mark(this, p); + }; + Glob.prototype._makeAbs = function(f) { + return common.makeAbs(this, f); + }; + Glob.prototype.abort = function() { + this.aborted = true; + this.emit("abort"); + }; + Glob.prototype.pause = function() { + if (!this.paused) { + this.paused = true; + this.emit("pause"); + } + }; + Glob.prototype.resume = function() { + if (this.paused) { + this.emit("resume"); + this.paused = false; + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0); + this._emitQueue.length = 0; + for (var i = 0; i < eq.length; i++) { + var e = eq[i]; + this._emitMatch(e[0], e[1]); + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0); + this._processQueue.length = 0; + for (var i = 0; i < pq.length; i++) { + var p = pq[i]; + this._processing--; + this._process(p[0], p[1], p[2], p[3]); + } + } + } + }; + Glob.prototype._process = function(pattern, index, inGlobStar, cb) { + assert(this instanceof Glob); + assert(typeof cb === "function"); + if (this.aborted) + return; + this._processing++; + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]); + return; + } + var n = 0; + while (typeof pattern[n] === "string") { + n++; + } + var prefix; + switch (n) { + case pattern.length: + this._processSimple(pattern.join("/"), index, cb); + return; + case 0: + prefix = null; + break; + default: + prefix = pattern.slice(0, n).join("/"); + break; + } + var remain = pattern.slice(n); + var read; + if (prefix === null) + read = "."; + else if (isAbsolute4(prefix) || isAbsolute4(pattern.map(function(p) { + return typeof p === "string" ? p : "[*]"; + }).join("/"))) { + if (!prefix || !isAbsolute4(prefix)) + prefix = "/" + prefix; + read = prefix; + } else + read = prefix; + var abs = this._makeAbs(read); + if (childrenIgnored(this, read)) + return cb(); + var isGlobStar = remain[0] === minimatch.GLOBSTAR; + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb); + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb); + }; + Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) { + var self2 = this; + this._readdir(abs, inGlobStar, function(er, entries) { + return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb); + }); + }; + Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) { + if (!entries) + return cb(); + var pn = remain[0]; + var negate = !!this.minimatch.negate; + var rawGlob = pn._glob; + var dotOk = this.dot || rawGlob.charAt(0) === "."; + var matchedEntries = []; + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (e.charAt(0) !== "." || dotOk) { + var m; + if (negate && !prefix) { + m = !e.match(pn); + } else { + m = e.match(pn); + } + if (m) + matchedEntries.push(e); + } + } + var len = matchedEntries.length; + if (len === 0) + return cb(); + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = /* @__PURE__ */ Object.create(null); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + if (prefix) { + if (prefix !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + if (e.charAt(0) === "/" && !this.nomount) { + e = path18.join(this.root, e); + } + this._emitMatch(index, e); + } + return cb(); + } + remain.shift(); + for (var i = 0; i < len; i++) { + var e = matchedEntries[i]; + var newPattern; + if (prefix) { + if (prefix !== "/") + e = prefix + "/" + e; + else + e = prefix + e; + } + this._process([e].concat(remain), index, inGlobStar, cb); + } + cb(); + }; + Glob.prototype._emitMatch = function(index, e) { + if (this.aborted) + return; + if (isIgnored(this, e)) + return; + if (this.paused) { + this._emitQueue.push([index, e]); + return; + } + var abs = isAbsolute4(e) ? e : this._makeAbs(e); + if (this.mark) + e = this._mark(e); + if (this.absolute) + e = abs; + if (this.matches[index][e]) + return; + if (this.nodir) { + var c = this.cache[abs]; + if (c === "DIR" || Array.isArray(c)) + return; + } + this.matches[index][e] = true; + var st = this.statCache[abs]; + if (st) + this.emit("stat", e, st); + this.emit("match", e); + }; + Glob.prototype._readdirInGlobStar = function(abs, cb) { + if (this.aborted) + return; + if (this.follow) + return this._readdir(abs, false, cb); + var lstatkey = "lstat\0" + abs; + var self2 = this; + var lstatcb = inflight(lstatkey, lstatcb_); + if (lstatcb) + self2.fs.lstat(abs, lstatcb); + function lstatcb_(er, lstat) { + if (er && er.code === "ENOENT") + return cb(); + var isSym = lstat && lstat.isSymbolicLink(); + self2.symlinks[abs] = isSym; + if (!isSym && lstat && !lstat.isDirectory()) { + self2.cache[abs] = "FILE"; + cb(); + } else + self2._readdir(abs, false, cb); + } + }; + Glob.prototype._readdir = function(abs, inGlobStar, cb) { + if (this.aborted) + return; + cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb); + if (!cb) + return; + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (!c || c === "FILE") + return cb(); + if (Array.isArray(c)) + return cb(null, c); + } + var self2 = this; + self2.fs.readdir(abs, readdirCb(this, abs, cb)); + }; + function readdirCb(self2, abs, cb) { + return function(er, entries) { + if (er) + self2._readdirError(abs, er, cb); + else + self2._readdirEntries(abs, entries, cb); + }; + } + Glob.prototype._readdirEntries = function(abs, entries, cb) { + if (this.aborted) + return; + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i++) { + var e = entries[i]; + if (abs === "/") + e = abs + e; + else + e = abs + "/" + e; + this.cache[e] = true; + } + } + this.cache[abs] = entries; + return cb(null, entries); + }; + Glob.prototype._readdirError = function(f, er, cb) { + if (this.aborted) + return; + switch (er.code) { + case "ENOTSUP": + case "ENOTDIR": + var abs = this._makeAbs(f); + this.cache[abs] = "FILE"; + if (abs === this.cwdAbs) { + var error = new Error(er.code + " invalid cwd " + this.cwd); + error.path = this.cwd; + error.code = er.code; + this.emit("error", error); + this.abort(); + } + break; + case "ENOENT": + case "ELOOP": + case "ENAMETOOLONG": + case "UNKNOWN": + this.cache[this._makeAbs(f)] = false; + break; + default: + this.cache[this._makeAbs(f)] = false; + if (this.strict) { + this.emit("error", er); + this.abort(); + } + if (!this.silent) + console.error("glob error", er); + break; + } + return cb(); + }; + Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) { + var self2 = this; + this._readdir(abs, inGlobStar, function(er, entries) { + self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb); + }); + }; + Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) { + if (!entries) + return cb(); + var remainWithoutGlobStar = remain.slice(1); + var gspref = prefix ? [prefix] : []; + var noGlobStar = gspref.concat(remainWithoutGlobStar); + this._process(noGlobStar, index, false, cb); + var isSym = this.symlinks[abs]; + var len = entries.length; + if (isSym && inGlobStar) + return cb(); + for (var i = 0; i < len; i++) { + var e = entries[i]; + if (e.charAt(0) === "." && !this.dot) + continue; + var instead = gspref.concat(entries[i], remainWithoutGlobStar); + this._process(instead, index, true, cb); + var below = gspref.concat(entries[i], remain); + this._process(below, index, true, cb); + } + cb(); + }; + Glob.prototype._processSimple = function(prefix, index, cb) { + var self2 = this; + this._stat(prefix, function(er, exists) { + self2._processSimple2(prefix, index, er, exists, cb); + }); + }; + Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) { + if (!this.matches[index]) + this.matches[index] = /* @__PURE__ */ Object.create(null); + if (!exists) + return cb(); + if (prefix && isAbsolute4(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix); + if (prefix.charAt(0) === "/") { + prefix = path18.join(this.root, prefix); + } else { + prefix = path18.resolve(this.root, prefix); + if (trail) + prefix += "/"; + } + } + if (process.platform === "win32") + prefix = prefix.replace(/\\/g, "/"); + this._emitMatch(index, prefix); + cb(); + }; + Glob.prototype._stat = function(f, cb) { + var abs = this._makeAbs(f); + var needDir = f.slice(-1) === "/"; + if (f.length > this.maxLength) + return cb(); + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs]; + if (Array.isArray(c)) + c = "DIR"; + if (!needDir || c === "DIR") + return cb(null, c); + if (needDir && c === "FILE") + return cb(); + } + var exists; + var stat2 = this.statCache[abs]; + if (stat2 !== void 0) { + if (stat2 === false) + return cb(null, stat2); + else { + var type = stat2.isDirectory() ? "DIR" : "FILE"; + if (needDir && type === "FILE") + return cb(); + else + return cb(null, type, stat2); + } + } + var self2 = this; + var statcb = inflight("stat\0" + abs, lstatcb_); + if (statcb) + self2.fs.lstat(abs, statcb); + function lstatcb_(er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + return self2.fs.stat(abs, function(er2, stat3) { + if (er2) + self2._stat2(f, abs, null, lstat, cb); + else + self2._stat2(f, abs, er2, stat3, cb); + }); + } else { + self2._stat2(f, abs, er, lstat, cb); + } + } + }; + Glob.prototype._stat2 = function(f, abs, er, stat2, cb) { + if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + this.statCache[abs] = false; + return cb(); + } + var needDir = f.slice(-1) === "/"; + this.statCache[abs] = stat2; + if (abs.slice(-1) === "/" && stat2 && !stat2.isDirectory()) + return cb(null, false, stat2); + var c = true; + if (stat2) + c = stat2.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c; + if (needDir && c === "FILE") + return cb(); + return cb(null, c, stat2); + }; + } +}); + +// node_modules/semver/internal/constants.js +var require_constants = __commonJS({ + "node_modules/semver/internal/constants.js"(exports, module2) { + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + module2.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH + }; + } +}); + +// node_modules/semver/internal/debug.js +var require_debug = __commonJS({ + "node_modules/semver/internal/debug.js"(exports, module2) { + var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => { + }; + module2.exports = debug; + } +}); + +// node_modules/semver/internal/re.js +var require_re = __commonJS({ + "node_modules/semver/internal/re.js"(exports, module2) { + var { MAX_SAFE_COMPONENT_LENGTH } = require_constants(); + var debug = require_debug(); + exports = module2.exports = {}; + var re = exports.re = []; + var src = exports.src = []; + var t = exports.t = {}; + var R = 0; + var createToken = (name, value, isGlobal) => { + const index = R++; + debug(name, index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? "g" : void 0); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+"); + createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*"); + createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+"); + createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken("FULL", `^${src[t.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`); + createToken("COERCERTL", src[t.COERCE], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); + } +}); + +// node_modules/semver/internal/parse-options.js +var require_parse_options = __commonJS({ + "node_modules/semver/internal/parse-options.js"(exports, module2) { + var opts = ["includePrerelease", "loose", "rtl"]; + var parseOptions = (options2) => !options2 ? {} : typeof options2 !== "object" ? { loose: true } : opts.filter((k) => options2[k]).reduce((o, k) => { + o[k] = true; + return o; + }, {}); + module2.exports = parseOptions; + } +}); + +// node_modules/semver/internal/identifiers.js +var require_identifiers = __commonJS({ + "node_modules/semver/internal/identifiers.js"(exports, module2) { + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a, b) => { + const anum = numeric.test(a); + const bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + module2.exports = { + compareIdentifiers, + rcompareIdentifiers + }; + } +}); + +// node_modules/semver/classes/semver.js +var require_semver = __commonJS({ + "node_modules/semver/classes/semver.js"(exports, module2) { + var debug = require_debug(); + var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(); + var { re, t } = require_re(); + var parseOptions = require_parse_options(); + var { compareIdentifiers } = require_identifiers(); + var SemVer = class { + constructor(version, options2) { + options2 = parseOptions(options2); + if (version instanceof SemVer) { + if (version.loose === !!options2.loose && version.includePrerelease === !!options2.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== "string") { + throw new TypeError(`Invalid Version: ${version}`); + } + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ); + } + debug("SemVer", version, options2); + this.options = options2; + this.loose = !!options2.loose; + this.includePrerelease = !!options2.includePrerelease; + const m = version.trim().match(options2.loose ? re[t.LOOSE] : re[t.FULL]); + if (!m) { + throw new TypeError(`Invalid Version: ${version}`); + } + this.raw = version; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug("SemVer.compare", this.version, this.options, other); + if (!(other instanceof SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); + } + comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + inc(release, identifier) { + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier); + this.inc("pre", identifier); + break; + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier); + } + this.inc("pre", identifier); + break; + case "major": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case "pre": + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === "number") { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + this.prerelease.push(0); + } + } + if (identifier) { + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; + } + } + break; + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.format(); + this.raw = this.version; + return this; + } + }; + module2.exports = SemVer; + } +}); + +// node_modules/semver/functions/parse.js +var require_parse = __commonJS({ + "node_modules/semver/functions/parse.js"(exports, module2) { + var { MAX_LENGTH } = require_constants(); + var { re, t } = require_re(); + var SemVer = require_semver(); + var parseOptions = require_parse_options(); + var parse = (version, options2) => { + options2 = parseOptions(options2); + if (version instanceof SemVer) { + return version; + } + if (typeof version !== "string") { + return null; + } + if (version.length > MAX_LENGTH) { + return null; + } + const r = options2.loose ? re[t.LOOSE] : re[t.FULL]; + if (!r.test(version)) { + return null; + } + try { + return new SemVer(version, options2); + } catch (er) { + return null; + } + }; + module2.exports = parse; + } +}); + +// node_modules/semver/functions/valid.js +var require_valid = __commonJS({ + "node_modules/semver/functions/valid.js"(exports, module2) { + var parse = require_parse(); + var valid = (version, options2) => { + const v = parse(version, options2); + return v ? v.version : null; + }; + module2.exports = valid; + } +}); + +// node_modules/semver/functions/clean.js +var require_clean = __commonJS({ + "node_modules/semver/functions/clean.js"(exports, module2) { + var parse = require_parse(); + var clean = (version, options2) => { + const s = parse(version.trim().replace(/^[=v]+/, ""), options2); + return s ? s.version : null; + }; + module2.exports = clean; + } +}); + +// node_modules/semver/functions/inc.js +var require_inc = __commonJS({ + "node_modules/semver/functions/inc.js"(exports, module2) { + var SemVer = require_semver(); + var inc = (version, release, options2, identifier) => { + if (typeof options2 === "string") { + identifier = options2; + options2 = void 0; + } + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options2 + ).inc(release, identifier).version; + } catch (er) { + return null; + } + }; + module2.exports = inc; + } +}); + +// node_modules/semver/functions/compare.js +var require_compare = __commonJS({ + "node_modules/semver/functions/compare.js"(exports, module2) { + var SemVer = require_semver(); + var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); + module2.exports = compare; + } +}); + +// node_modules/semver/functions/eq.js +var require_eq = __commonJS({ + "node_modules/semver/functions/eq.js"(exports, module2) { + var compare = require_compare(); + var eq = (a, b, loose) => compare(a, b, loose) === 0; + module2.exports = eq; + } +}); + +// node_modules/semver/functions/diff.js +var require_diff = __commonJS({ + "node_modules/semver/functions/diff.js"(exports, module2) { + var parse = require_parse(); + var eq = require_eq(); + var diff = (version1, version2) => { + if (eq(version1, version2)) { + return null; + } else { + const v1 = parse(version1); + const v2 = parse(version2); + const hasPre = v1.prerelease.length || v2.prerelease.length; + const prefix = hasPre ? "pre" : ""; + const defaultResult = hasPre ? "prerelease" : ""; + for (const key in v1) { + if (key === "major" || key === "minor" || key === "patch") { + if (v1[key] !== v2[key]) { + return prefix + key; + } + } + } + return defaultResult; + } + }; + module2.exports = diff; + } +}); + +// node_modules/semver/functions/major.js +var require_major = __commonJS({ + "node_modules/semver/functions/major.js"(exports, module2) { + var SemVer = require_semver(); + var major = (a, loose) => new SemVer(a, loose).major; + module2.exports = major; + } +}); + +// node_modules/semver/functions/minor.js +var require_minor = __commonJS({ + "node_modules/semver/functions/minor.js"(exports, module2) { + var SemVer = require_semver(); + var minor = (a, loose) => new SemVer(a, loose).minor; + module2.exports = minor; + } +}); + +// node_modules/semver/functions/patch.js +var require_patch = __commonJS({ + "node_modules/semver/functions/patch.js"(exports, module2) { + var SemVer = require_semver(); + var patch = (a, loose) => new SemVer(a, loose).patch; + module2.exports = patch; + } +}); + +// node_modules/semver/functions/prerelease.js +var require_prerelease = __commonJS({ + "node_modules/semver/functions/prerelease.js"(exports, module2) { + var parse = require_parse(); + var prerelease = (version, options2) => { + const parsed = parse(version, options2); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + }; + module2.exports = prerelease; + } +}); + +// node_modules/semver/functions/rcompare.js +var require_rcompare = __commonJS({ + "node_modules/semver/functions/rcompare.js"(exports, module2) { + var compare = require_compare(); + var rcompare = (a, b, loose) => compare(b, a, loose); + module2.exports = rcompare; + } +}); + +// node_modules/semver/functions/compare-loose.js +var require_compare_loose = __commonJS({ + "node_modules/semver/functions/compare-loose.js"(exports, module2) { + var compare = require_compare(); + var compareLoose = (a, b) => compare(a, b, true); + module2.exports = compareLoose; + } +}); + +// node_modules/semver/functions/compare-build.js +var require_compare_build = __commonJS({ + "node_modules/semver/functions/compare-build.js"(exports, module2) { + var SemVer = require_semver(); + var compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose); + const versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module2.exports = compareBuild; + } +}); + +// node_modules/semver/functions/sort.js +var require_sort = __commonJS({ + "node_modules/semver/functions/sort.js"(exports, module2) { + var compareBuild = require_compare_build(); + var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); + module2.exports = sort; + } +}); + +// node_modules/semver/functions/rsort.js +var require_rsort = __commonJS({ + "node_modules/semver/functions/rsort.js"(exports, module2) { + var compareBuild = require_compare_build(); + var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); + module2.exports = rsort; + } +}); + +// node_modules/semver/functions/gt.js +var require_gt = __commonJS({ + "node_modules/semver/functions/gt.js"(exports, module2) { + var compare = require_compare(); + var gt = (a, b, loose) => compare(a, b, loose) > 0; + module2.exports = gt; + } +}); + +// node_modules/semver/functions/lt.js +var require_lt = __commonJS({ + "node_modules/semver/functions/lt.js"(exports, module2) { + var compare = require_compare(); + var lt = (a, b, loose) => compare(a, b, loose) < 0; + module2.exports = lt; + } +}); + +// node_modules/semver/functions/neq.js +var require_neq = __commonJS({ + "node_modules/semver/functions/neq.js"(exports, module2) { + var compare = require_compare(); + var neq = (a, b, loose) => compare(a, b, loose) !== 0; + module2.exports = neq; + } +}); + +// node_modules/semver/functions/gte.js +var require_gte = __commonJS({ + "node_modules/semver/functions/gte.js"(exports, module2) { + var compare = require_compare(); + var gte2 = (a, b, loose) => compare(a, b, loose) >= 0; + module2.exports = gte2; + } +}); + +// node_modules/semver/functions/lte.js +var require_lte = __commonJS({ + "node_modules/semver/functions/lte.js"(exports, module2) { + var compare = require_compare(); + var lte = (a, b, loose) => compare(a, b, loose) <= 0; + module2.exports = lte; + } +}); + +// node_modules/semver/functions/cmp.js +var require_cmp = __commonJS({ + "node_modules/semver/functions/cmp.js"(exports, module2) { + var eq = require_eq(); + var neq = require_neq(); + var gt = require_gt(); + var gte2 = require_gte(); + var lt = require_lt(); + var lte = require_lte(); + var cmp = (a, op, b, loose) => { + switch (op) { + case "===": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a === b; + case "!==": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a !== b; + case "": + case "=": + case "==": + return eq(a, b, loose); + case "!=": + return neq(a, b, loose); + case ">": + return gt(a, b, loose); + case ">=": + return gte2(a, b, loose); + case "<": + return lt(a, b, loose); + case "<=": + return lte(a, b, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module2.exports = cmp; + } +}); + +// node_modules/semver/functions/coerce.js +var require_coerce = __commonJS({ + "node_modules/semver/functions/coerce.js"(exports, module2) { + var SemVer = require_semver(); + var parse = require_parse(); + var { re, t } = require_re(); + var coerce = (version, options2) => { + if (version instanceof SemVer) { + return version; + } + if (typeof version === "number") { + version = String(version); + } + if (typeof version !== "string") { + return null; + } + options2 = options2 || {}; + let match = null; + if (!options2.rtl) { + match = version.match(re[t.COERCE]); + } else { + let next; + while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } + re[t.COERCERTL].lastIndex = -1; + } + if (match === null) { + return null; + } + return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options2); + }; + module2.exports = coerce; + } +}); + +// node_modules/yallist/iterator.js +var require_iterator = __commonJS({ + "node_modules/yallist/iterator.js"(exports, module2) { + "use strict"; + module2.exports = function(Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + }; + }; + } +}); + +// node_modules/yallist/yallist.js +var require_yallist = __commonJS({ + "node_modules/yallist/yallist.js"(exports, module2) { + "use strict"; + module2.exports = Yallist; + Yallist.Node = Node; + Yallist.create = Yallist; + function Yallist(list) { + var self2 = this; + if (!(self2 instanceof Yallist)) { + self2 = new Yallist(); + } + self2.tail = null; + self2.head = null; + self2.length = 0; + if (list && typeof list.forEach === "function") { + list.forEach(function(item) { + self2.push(item); + }); + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self2.push(arguments[i]); + } + } + return self2; + } + Yallist.prototype.removeNode = function(node) { + if (node.list !== this) { + throw new Error("removing node which does not belong to this list"); + } + var next = node.next; + var prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + node.list.length--; + node.next = null; + node.prev = null; + node.list = null; + return next; + }; + Yallist.prototype.unshiftNode = function(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + }; + Yallist.prototype.pushNode = function(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + }; + Yallist.prototype.push = function() { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]); + } + return this.length; + }; + Yallist.prototype.unshift = function() { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]); + } + return this.length; + }; + Yallist.prototype.pop = function() { + if (!this.tail) { + return void 0; + } + var res = this.tail.value; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = null; + } else { + this.head = null; + } + this.length--; + return res; + }; + Yallist.prototype.shift = function() { + if (!this.head) { + return void 0; + } + var res = this.head.value; + this.head = this.head.next; + if (this.head) { + this.head.prev = null; + } else { + this.tail = null; + } + this.length--; + return res; + }; + Yallist.prototype.forEach = function(fn, thisp) { + thisp = thisp || this; + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + }; + Yallist.prototype.forEachReverse = function(fn, thisp) { + thisp = thisp || this; + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + }; + Yallist.prototype.get = function(n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + walker = walker.next; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist.prototype.getReverse = function(n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + walker = walker.prev; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist.prototype.map = function(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (var walker = this.head; walker !== null; ) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + }; + Yallist.prototype.mapReverse = function(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (var walker = this.tail; walker !== null; ) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + }; + Yallist.prototype.reduce = function(fn, initial) { + var acc; + var walker = this.head; + if (arguments.length > 1) { + acc = initial; + } else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } else { + throw new TypeError("Reduce of empty list with no initial value"); + } + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + }; + Yallist.prototype.reduceReverse = function(fn, initial) { + var acc; + var walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } else { + throw new TypeError("Reduce of empty list with no initial value"); + } + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + }; + Yallist.prototype.toArray = function() { + var arr = new Array(this.length); + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + }; + Yallist.prototype.toArrayReverse = function() { + var arr = new Array(this.length); + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + }; + Yallist.prototype.slice = function(from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next; + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + }; + Yallist.prototype.sliceReverse = function(from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev; + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + }; + Yallist.prototype.splice = function(start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next; + } + var ret = []; + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (walker === null) { + walker = this.tail; + } + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev; + } + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]); + } + return ret; + }; + Yallist.prototype.reverse = function() { + var head = this.head; + var tail = this.tail; + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + }; + function insert(self2, node, value) { + var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2); + if (inserted.next === null) { + self2.tail = inserted; + } + if (inserted.prev === null) { + self2.head = inserted; + } + self2.length++; + return inserted; + } + function push(self2, item) { + self2.tail = new Node(item, self2.tail, null, self2); + if (!self2.head) { + self2.head = self2.tail; + } + self2.length++; + } + function unshift(self2, item) { + self2.head = new Node(item, null, self2.head, self2); + if (!self2.tail) { + self2.tail = self2.head; + } + self2.length++; + } + function Node(value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list); + } + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } else { + this.prev = null; + } + if (next) { + next.prev = this; + this.next = next; + } else { + this.next = null; + } + } + try { + require_iterator()(Yallist); + } catch (er) { + } + } +}); + +// node_modules/lru-cache/index.js +var require_lru_cache = __commonJS({ + "node_modules/lru-cache/index.js"(exports, module2) { + "use strict"; + var Yallist = require_yallist(); + var MAX = Symbol("max"); + var LENGTH = Symbol("length"); + var LENGTH_CALCULATOR = Symbol("lengthCalculator"); + var ALLOW_STALE = Symbol("allowStale"); + var MAX_AGE = Symbol("maxAge"); + var DISPOSE = Symbol("dispose"); + var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet"); + var LRU_LIST = Symbol("lruList"); + var CACHE = Symbol("cache"); + var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet"); + var naiveLength = () => 1; + var LRUCache = class { + constructor(options2) { + if (typeof options2 === "number") + options2 = { max: options2 }; + if (!options2) + options2 = {}; + if (options2.max && (typeof options2.max !== "number" || options2.max < 0)) + throw new TypeError("max must be a non-negative number"); + const max = this[MAX] = options2.max || Infinity; + const lc = options2.length || naiveLength; + this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc; + this[ALLOW_STALE] = options2.stale || false; + if (options2.maxAge && typeof options2.maxAge !== "number") + throw new TypeError("maxAge must be a number"); + this[MAX_AGE] = options2.maxAge || 0; + this[DISPOSE] = options2.dispose; + this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false; + this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false; + this.reset(); + } + set max(mL) { + if (typeof mL !== "number" || mL < 0) + throw new TypeError("max must be a non-negative number"); + this[MAX] = mL || Infinity; + trim(this); + } + get max() { + return this[MAX]; + } + set allowStale(allowStale) { + this[ALLOW_STALE] = !!allowStale; + } + get allowStale() { + return this[ALLOW_STALE]; + } + set maxAge(mA) { + if (typeof mA !== "number") + throw new TypeError("maxAge must be a non-negative number"); + this[MAX_AGE] = mA; + trim(this); + } + get maxAge() { + return this[MAX_AGE]; + } + set lengthCalculator(lC) { + if (typeof lC !== "function") + lC = naiveLength; + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach((hit) => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); + this[LENGTH] += hit.length; + }); + } + trim(this); + } + get lengthCalculator() { + return this[LENGTH_CALCULATOR]; + } + get length() { + return this[LENGTH]; + } + get itemCount() { + return this[LRU_LIST].length; + } + rforEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].tail; walker !== null; ) { + const prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; + } + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this[LRU_LIST].head; walker !== null; ) { + const next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } + } + keys() { + return this[LRU_LIST].toArray().map((k) => k.key); + } + values() { + return this[LRU_LIST].toArray().map((k) => k.value); + } + reset() { + if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { + this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value)); + } + this[CACHE] = /* @__PURE__ */ new Map(); + this[LRU_LIST] = new Yallist(); + this[LENGTH] = 0; + } + dump() { + return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter((h) => h); + } + dumpLru() { + return this[LRU_LIST]; + } + set(key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + if (maxAge && typeof maxAge !== "number") + throw new TypeError("maxAge must be a number"); + const now = maxAge ? Date.now() : 0; + const len = this[LENGTH_CALCULATOR](value, key); + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)); + return false; + } + const node = this[CACHE].get(key); + const item = node.value; + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) + this[DISPOSE](key, item.value); + } + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim(this); + return true; + } + const hit = new Entry(key, value, len, now, maxAge); + if (hit.length > this[MAX]) { + if (this[DISPOSE]) + this[DISPOSE](key, value); + return false; + } + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim(this); + return true; + } + has(key) { + if (!this[CACHE].has(key)) + return false; + const hit = this[CACHE].get(key).value; + return !isStale(this, hit); + } + get(key) { + return get(this, key, true); + } + peek(key) { + return get(this, key, false); + } + pop() { + const node = this[LRU_LIST].tail; + if (!node) + return null; + del(this, node); + return node.value; + } + del(key) { + del(this, this[CACHE].get(key)); + } + load(arr) { + this.reset(); + const now = Date.now(); + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l]; + const expiresAt = hit.e || 0; + if (expiresAt === 0) + this.set(hit.k, hit.v); + else { + const maxAge = expiresAt - now; + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); + } + } + } + } + prune() { + this[CACHE].forEach((value, key) => get(this, key, false)); + } + }; + var get = (self2, key, doUse) => { + const node = self2[CACHE].get(key); + if (node) { + const hit = node.value; + if (isStale(self2, hit)) { + del(self2, node); + if (!self2[ALLOW_STALE]) + return void 0; + } else { + if (doUse) { + if (self2[UPDATE_AGE_ON_GET]) + node.value.now = Date.now(); + self2[LRU_LIST].unshiftNode(node); + } + } + return hit.value; + } + }; + var isStale = (self2, hit) => { + if (!hit || !hit.maxAge && !self2[MAX_AGE]) + return false; + const diff = Date.now() - hit.now; + return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE]; + }; + var trim = (self2) => { + if (self2[LENGTH] > self2[MAX]) { + for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) { + const prev = walker.prev; + del(self2, walker); + walker = prev; + } + } + }; + var del = (self2, node) => { + if (node) { + const hit = node.value; + if (self2[DISPOSE]) + self2[DISPOSE](hit.key, hit.value); + self2[LENGTH] -= hit.length; + self2[CACHE].delete(hit.key); + self2[LRU_LIST].removeNode(node); + } + }; + var Entry = class { + constructor(key, value, length, now, maxAge) { + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; + } + }; + var forEachStep = (self2, fn, node, thisp) => { + let hit = node.value; + if (isStale(self2, hit)) { + del(self2, node); + if (!self2[ALLOW_STALE]) + hit = void 0; + } + if (hit) + fn.call(thisp, hit.value, hit.key, self2); + }; + module2.exports = LRUCache; + } +}); + +// node_modules/semver/classes/range.js +var require_range = __commonJS({ + "node_modules/semver/classes/range.js"(exports, module2) { + var Range11 = class { + constructor(range, options2) { + options2 = parseOptions(options2); + if (range instanceof Range11) { + if (range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease) { + return range; + } else { + return new Range11(range.raw, options2); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.format(); + return this; + } + this.options = options2; + this.loose = !!options2.loose; + this.includePrerelease = !!options2.includePrerelease; + this.raw = range; + this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c) => !isNullSet(c[0])); + if (this.set.length === 0) { + this.set = [first]; + } else if (this.set.length > 1) { + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } + } + this.format(); + } + format() { + this.range = this.set.map((comps) => { + return comps.join(" ").trim(); + }).join("||").trim(); + return this.range; + } + toString() { + return this.range; + } + parseRange(range) { + range = range.trim(); + const memoOpts = Object.keys(this.options).join(","); + const memoKey = `parseRange:${memoOpts}:${range}`; + const cached = cache.get(memoKey); + if (cached) { + return cached; + } + const loose = this.options.loose; + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug("hyphen replace", range); + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + range = range.split(/\s+/).join(" "); + let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); + if (loose) { + rangeList = rangeList.filter((comp) => { + debug("loose invalid filter", comp, this.options); + return !!comp.match(re[t.COMPARATORLOOSE]); + }); + } + debug("range list", rangeList); + const rangeMap = /* @__PURE__ */ new Map(); + const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp]; + } + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) { + rangeMap.delete(""); + } + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range, options2) { + if (!(range instanceof Range11)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options2) && range.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options2); + }); + }); + }); + }); + } + test(version) { + if (!version) { + return false; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + return false; + } + }; + module2.exports = Range11; + var LRU = require_lru_cache(); + var cache = new LRU({ max: 1e3 }); + var parseOptions = require_parse_options(); + var Comparator = require_comparator(); + var debug = require_debug(); + var SemVer = require_semver(); + var { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re(); + var isNullSet = (c) => c.value === "<0.0.0-0"; + var isAny = (c) => c.value === ""; + var isSatisfiable = (comparators, options2) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options2); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options2) => { + debug("comp", comp, options2); + comp = replaceCarets(comp, options2); + debug("caret", comp); + comp = replaceTildes(comp, options2); + debug("tildes", comp); + comp = replaceXRanges(comp, options2); + debug("xrange", comp); + comp = replaceStars(comp, options2); + debug("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options2) => comp.trim().split(/\s+/).map((c) => { + return replaceTilde(c, options2); + }).join(" "); + var replaceTilde = (comp, options2) => { + const r = options2.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug("tilde", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug("replaceTilde pr", pr); + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + } + debug("tilde return", ret); + return ret; + }); + }; + var replaceCarets = (comp, options2) => comp.trim().split(/\s+/).map((c) => { + return replaceCaret(c, options2); + }).join(" "); + var replaceCaret = (comp, options2) => { + debug("caret", comp, options2); + const r = options2.loose ? re[t.CARETLOOSE] : re[t.CARET]; + const z = options2.includePrerelease ? "-0" : ""; + return comp.replace(r, (_, M, m, p, pr) => { + debug("caret", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === "0") { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug("replaceCaret pr", pr); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + } + } else { + debug("no pr"); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; + } + } + debug("caret return", ret); + return ret; + }); + }; + var replaceXRanges = (comp, options2) => { + debug("replaceXRanges", comp, options2); + return comp.split(/\s+/).map((c) => { + return replaceXRange(c, options2); + }).join(" "); + }; + var replaceXRange = (comp, options2) => { + comp = comp.trim(); + const r = options2.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug("xRange", comp, ret, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options2.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret = "<0.0.0-0"; + } else { + ret = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === "<") { + pr = "-0"; + } + ret = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + } + debug("xRange return", ret); + return ret; + }); + }; + var replaceStars = (comp, options2) => { + debug("replaceStars", comp, options2); + return comp.trim().replace(re[t.STAR], ""); + }; + var replaceGTE0 = (comp, options2) => { + debug("replaceGTE0", comp, options2); + return comp.trim().replace(re[options2.includePrerelease ? t.GTE0PRE : t.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set, version, options2) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + if (version.prerelease.length && !options2.includePrerelease) { + for (let i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === Comparator.ANY) { + continue; + } + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; + } +}); + +// node_modules/semver/classes/comparator.js +var require_comparator = __commonJS({ + "node_modules/semver/classes/comparator.js"(exports, module2) { + var ANY = Symbol("SemVer ANY"); + var Comparator = class { + static get ANY() { + return ANY; + } + constructor(comp, options2) { + options2 = parseOptions(options2); + if (comp instanceof Comparator) { + if (comp.loose === !!options2.loose) { + return comp; + } else { + comp = comp.value; + } + } + debug("comparator", comp, options2); + this.options = options2; + this.loose = !!options2.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug("comp", this); + } + parse(comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const m = comp.match(r); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m[1] !== void 0 ? m[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version) { + debug("Comparator.test", version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + intersects(comp, options2) { + if (!(comp instanceof Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (!options2 || typeof options2 !== "object") { + options2 = { + loose: !!options2, + includePrerelease: false + }; + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range11(comp.value, options2).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range11(this.value, options2).test(comp.semver); + } + const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">"); + const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<"); + const sameSemVer = this.semver.version === comp.semver.version; + const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<="); + const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options2) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<"); + const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options2) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">"); + return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; + } + }; + module2.exports = Comparator; + var parseOptions = require_parse_options(); + var { re, t } = require_re(); + var cmp = require_cmp(); + var debug = require_debug(); + var SemVer = require_semver(); + var Range11 = require_range(); + } +}); + +// node_modules/semver/functions/satisfies.js +var require_satisfies = __commonJS({ + "node_modules/semver/functions/satisfies.js"(exports, module2) { + var Range11 = require_range(); + var satisfies = (version, range, options2) => { + try { + range = new Range11(range, options2); + } catch (er) { + return false; + } + return range.test(version); + }; + module2.exports = satisfies; + } +}); + +// node_modules/semver/ranges/to-comparators.js +var require_to_comparators = __commonJS({ + "node_modules/semver/ranges/to-comparators.js"(exports, module2) { + var Range11 = require_range(); + var toComparators = (range, options2) => new Range11(range, options2).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); + module2.exports = toComparators; + } +}); + +// node_modules/semver/ranges/max-satisfying.js +var require_max_satisfying = __commonJS({ + "node_modules/semver/ranges/max-satisfying.js"(exports, module2) { + var SemVer = require_semver(); + var Range11 = require_range(); + var maxSatisfying = (versions, range, options2) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range11(range, options2); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!max || maxSV.compare(v) === -1) { + max = v; + maxSV = new SemVer(max, options2); + } + } + }); + return max; + }; + module2.exports = maxSatisfying; + } +}); + +// node_modules/semver/ranges/min-satisfying.js +var require_min_satisfying = __commonJS({ + "node_modules/semver/ranges/min-satisfying.js"(exports, module2) { + var SemVer = require_semver(); + var Range11 = require_range(); + var minSatisfying = (versions, range, options2) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range11(range, options2); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!min || minSV.compare(v) === 1) { + min = v; + minSV = new SemVer(min, options2); + } + } + }); + return min; + }; + module2.exports = minSatisfying; + } +}); + +// node_modules/semver/ranges/min-version.js +var require_min_version = __commonJS({ + "node_modules/semver/ranges/min-version.js"(exports, module2) { + var SemVer = require_semver(); + var Range11 = require_range(); + var gt = require_gt(); + var minVersion = (range, loose) => { + range = new Range11(range, loose); + let minver = new SemVer("0.0.0"); + if (range.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range.test(minver)) { + return minver; + } + minver = null; + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + case "": + case ">=": + if (!setMin || gt(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin; + } + } + if (minver && range.test(minver)) { + return minver; + } + return null; + }; + module2.exports = minVersion; + } +}); + +// node_modules/semver/ranges/valid.js +var require_valid2 = __commonJS({ + "node_modules/semver/ranges/valid.js"(exports, module2) { + var Range11 = require_range(); + var validRange = (range, options2) => { + try { + return new Range11(range, options2).range || "*"; + } catch (er) { + return null; + } + }; + module2.exports = validRange; + } +}); + +// node_modules/semver/ranges/outside.js +var require_outside = __commonJS({ + "node_modules/semver/ranges/outside.js"(exports, module2) { + var SemVer = require_semver(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var Range11 = require_range(); + var satisfies = require_satisfies(); + var gt = require_gt(); + var lt = require_lt(); + var lte = require_lte(); + var gte2 = require_gte(); + var outside = (version, range, hilo, options2) => { + version = new SemVer(version, options2); + range = new Range11(range, options2); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt; + ltefn = gte2; + ltfn = gt; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version, range, options2)) { + return false; + } + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options2)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options2)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; + }; + module2.exports = outside; + } +}); + +// node_modules/semver/ranges/gtr.js +var require_gtr = __commonJS({ + "node_modules/semver/ranges/gtr.js"(exports, module2) { + var outside = require_outside(); + var gtr = (version, range, options2) => outside(version, range, ">", options2); + module2.exports = gtr; + } +}); + +// node_modules/semver/ranges/ltr.js +var require_ltr = __commonJS({ + "node_modules/semver/ranges/ltr.js"(exports, module2) { + var outside = require_outside(); + var ltr = (version, range, options2) => outside(version, range, "<", options2); + module2.exports = ltr; + } +}); + +// node_modules/semver/ranges/intersects.js +var require_intersects = __commonJS({ + "node_modules/semver/ranges/intersects.js"(exports, module2) { + var Range11 = require_range(); + var intersects = (r1, r2, options2) => { + r1 = new Range11(r1, options2); + r2 = new Range11(r2, options2); + return r1.intersects(r2); + }; + module2.exports = intersects; + } +}); + +// node_modules/semver/ranges/simplify.js +var require_simplify = __commonJS({ + "node_modules/semver/ranges/simplify.js"(exports, module2) { + var satisfies = require_satisfies(); + var compare = require_compare(); + module2.exports = (versions, range, options2) => { + const set = []; + let first = null; + let prev = null; + const v = versions.sort((a, b) => compare(a, b, options2)); + for (const version of v) { + const included = satisfies(version, range, options2); + if (included) { + prev = version; + if (!first) { + first = version; + } + } else { + if (prev) { + set.push([first, prev]); + } + prev = null; + first = null; + } + } + if (first) { + set.push([first, null]); + } + const ranges = []; + for (const [min, max] of set) { + if (min === max) { + ranges.push(min); + } else if (!max && min === v[0]) { + ranges.push("*"); + } else if (!max) { + ranges.push(`>=${min}`); + } else if (min === v[0]) { + ranges.push(`<=${max}`); + } else { + ranges.push(`${min} - ${max}`); + } + } + const simplified = ranges.join(" || "); + const original = typeof range.raw === "string" ? range.raw : String(range); + return simplified.length < original.length ? simplified : range; + }; + } +}); + +// node_modules/semver/ranges/subset.js +var require_subset = __commonJS({ + "node_modules/semver/ranges/subset.js"(exports, module2) { + var Range11 = require_range(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var satisfies = require_satisfies(); + var compare = require_compare(); + var subset = (sub, dom, options2 = {}) => { + if (sub === dom) { + return true; + } + sub = new Range11(sub, options2); + dom = new Range11(dom, options2); + let sawNonNull = false; + OUTER: + for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options2); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) { + continue OUTER; + } + } + if (sawNonNull) { + return false; + } + } + return true; + }; + var simpleSubset = (sub, dom, options2) => { + if (sub === dom) { + return true; + } + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true; + } else if (options2.includePrerelease) { + sub = [new Comparator(">=0.0.0-0")]; + } else { + sub = [new Comparator(">=0.0.0")]; + } + } + if (dom.length === 1 && dom[0].semver === ANY) { + if (options2.includePrerelease) { + return true; + } else { + dom = [new Comparator(">=0.0.0")]; + } + } + const eqSet = /* @__PURE__ */ new Set(); + let gt, lt; + for (const c of sub) { + if (c.operator === ">" || c.operator === ">=") { + gt = higherGT(gt, c, options2); + } else if (c.operator === "<" || c.operator === "<=") { + lt = lowerLT(lt, c, options2); + } else { + eqSet.add(c.semver); + } + } + if (eqSet.size > 1) { + return null; + } + let gtltComp; + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options2); + if (gtltComp > 0) { + return null; + } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) { + return null; + } + } + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options2)) { + return null; + } + if (lt && !satisfies(eq, String(lt), options2)) { + return null; + } + for (const c of dom) { + if (!satisfies(eq, String(c), options2)) { + return false; + } + } + return true; + } + let higher, lower; + let hasDomLT, hasDomGT; + let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; + let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false; + } + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; + hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false; + } + } + if (c.operator === ">" || c.operator === ">=") { + higher = higherGT(gt, c, options2); + if (higher === c && higher !== gt) { + return false; + } + } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options2)) { + return false; + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false; + } + } + if (c.operator === "<" || c.operator === "<=") { + lower = lowerLT(lt, c, options2); + if (lower === c && lower !== lt) { + return false; + } + } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options2)) { + return false; + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false; + } + } + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false; + } + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false; + } + if (needDomGTPre || needDomLTPre) { + return false; + } + return true; + }; + var higherGT = (a, b, options2) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options2); + return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; + }; + var lowerLT = (a, b, options2) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options2); + return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; + }; + module2.exports = subset; + } +}); + +// node_modules/semver/index.js +var require_semver2 = __commonJS({ + "node_modules/semver/index.js"(exports, module2) { + var internalRe = require_re(); + var constants = require_constants(); + var SemVer = require_semver(); + var identifiers = require_identifiers(); + var parse = require_parse(); + var valid = require_valid(); + var clean = require_clean(); + var inc = require_inc(); + var diff = require_diff(); + var major = require_major(); + var minor = require_minor(); + var patch = require_patch(); + var prerelease = require_prerelease(); + var compare = require_compare(); + var rcompare = require_rcompare(); + var compareLoose = require_compare_loose(); + var compareBuild = require_compare_build(); + var sort = require_sort(); + var rsort = require_rsort(); + var gt = require_gt(); + var lt = require_lt(); + var eq = require_eq(); + var neq = require_neq(); + var gte2 = require_gte(); + var lte = require_lte(); + var cmp = require_cmp(); + var coerce = require_coerce(); + var Comparator = require_comparator(); + var Range11 = require_range(); + var satisfies = require_satisfies(); + var toComparators = require_to_comparators(); + var maxSatisfying = require_max_satisfying(); + var minSatisfying = require_min_satisfying(); + var minVersion = require_min_version(); + var validRange = require_valid2(); + var outside = require_outside(); + var gtr = require_gtr(); + var ltr = require_ltr(); + var intersects = require_intersects(); + var simplifyRange = require_simplify(); + var subset = require_subset(); + module2.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte: gte2, + lte, + cmp, + coerce, + Comparator, + Range: Range11, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers + }; + } +}); + +// node_modules/expand-home-dir/index.js +var require_expand_home_dir = __commonJS({ + "node_modules/expand-home-dir/index.js"(exports, module2) { + var join12 = require("path").join; + var homedir3 = process.env[process.platform == "win32" ? "USERPROFILE" : "HOME"]; + module2.exports = expandHomeDir2; + function expandHomeDir2(path18) { + if (!path18) + return path18; + if (path18 == "~") + return homedir3; + if (path18.slice(0, 2) != "~/") + return path18; + return join12(homedir3, path18.slice(2)); + } + } +}); + +// node_modules/jdk-utils/dist/logger.js +var require_logger = __commonJS({ + "node_modules/jdk-utils/dist/logger.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.log = void 0; + function log(...args) { + } + exports.log = log; + } +}); + +// node_modules/jdk-utils/dist/from/asdf.js +var require_asdf = __commonJS({ + "node_modules/jdk-utils/dist/from/asdf.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var _a; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var ASDF_DATA_DIR = (_a = process.env.ASDF_DATA_DIR) !== null && _a !== void 0 ? _a : path18.join(os4.homedir(), ".asdf"); + var JDK_BASE_DIR = path18.join(ASDF_DATA_DIR, "installs", "java"); + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + const files = yield fs6.promises.readdir(JDK_BASE_DIR, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(JDK_BASE_DIR, file.name)); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/utils.js +var require_utils = __commonJS({ + "node_modules/jdk-utils/dist/utils.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getRealHome = exports.expandTilde = exports.deDup = exports.looksLikeJavaHome = exports.JAVAC_FILENAME = exports.JAVA_FILENAME = exports.isArm = exports.isLinux = exports.isMac = exports.isWindows = void 0; + var fs6 = __importStar(require("fs")); + var os_1 = require("os"); + var path_1 = require("path"); + var logger2 = __importStar(require_logger()); + exports.isWindows = process.platform.indexOf("win") === 0; + exports.isMac = process.platform.indexOf("darwin") === 0; + exports.isLinux = process.platform.indexOf("linux") === 0; + exports.isArm = process.arch.indexOf("arm") === 0; + exports.JAVA_FILENAME = exports.isWindows ? "java.exe" : "java"; + exports.JAVAC_FILENAME = exports.isWindows ? "javac.exe" : "javac"; + function looksLikeJavaHome(dir) { + const lower = dir.toLocaleLowerCase(); + return lower.includes("jdk") || lower.includes("java"); + } + exports.looksLikeJavaHome = looksLikeJavaHome; + function deDup(arr) { + return Array.from(new Set(arr)); + } + exports.deDup = deDup; + function expandTilde(filepath) { + if (filepath.charCodeAt(0) === 126) { + return (0, path_1.join)((0, os_1.homedir)(), filepath.slice(1)); + } else { + return filepath; + } + } + exports.expandTilde = expandTilde; + function getRealHome(javaHomePathLike) { + return __awaiter(this, void 0, void 0, function* () { + const javaBinaryPath = expandTilde((0, path_1.join)(javaHomePathLike, "bin", exports.JAVA_FILENAME)); + try { + const rp = yield fs6.promises.realpath(javaBinaryPath); + return (0, path_1.dirname)((0, path_1.dirname)(rp)); + } catch (error) { + logger2.log(error); + } + return void 0; + }); + } + exports.getRealHome = getRealHome; + } +}); + +// node_modules/jdk-utils/dist/from/envs.js +var require_envs = __commonJS({ + "node_modules/jdk-utils/dist/from/envs.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidatesFromSpecificEnv = exports.candidatesFromPath = void 0; + var fs6 = __importStar(require("fs")); + var path18 = __importStar(require("path")); + var utils_1 = require_utils(); + var EXCLUSIONS_ON_MAC = /* @__PURE__ */ new Set([ + "/usr", + "/usr/" + ]); + function candidatesFromPath() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + if (process.env.PATH) { + const jdkBinFolderFromPath = process.env.PATH.split(path18.delimiter).filter((p) => (0, utils_1.looksLikeJavaHome)(p) || fs6.existsSync(path18.join(p, utils_1.JAVA_FILENAME))).map(utils_1.expandTilde); + const homeDirs = (yield Promise.all(jdkBinFolderFromPath.map((p) => (0, utils_1.getRealHome)(path18.dirname(p))))).filter((homeDir) => { + return homeDir && !(utils_1.isMac && EXCLUSIONS_ON_MAC.has(homeDir)); + }); + ret.push(...homeDirs); + } + return ret.filter(Boolean); + }); + } + exports.candidatesFromPath = candidatesFromPath; + function candidatesFromSpecificEnv(envkey) { + return __awaiter(this, void 0, void 0, function* () { + if (process.env[envkey]) { + const rmSlash = process.env[envkey].replace(/[\\\/]$/, ""); + return (0, utils_1.getRealHome)(rmSlash); + } + return void 0; + }); + } + exports.candidatesFromSpecificEnv = candidatesFromSpecificEnv; + } +}); + +// node_modules/jdk-utils/dist/from/gradle.js +var require_gradle = __commonJS({ + "node_modules/jdk-utils/dist/from/gradle.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var _a; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var utils_1 = require_utils(); + var GRADLE_USER_HOME = (_a = process.env.GRADLE_USER_HOME) !== null && _a !== void 0 ? _a : path18.join(os4.homedir(), ".gradle"); + var JDK_BASE_DIR = path18.join(GRADLE_USER_HOME, "jdks"); + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + for (const distro of yield fs6.promises.readdir(JDK_BASE_DIR, { withFileTypes: true })) { + if (distro.isDirectory()) { + const distroDir = path18.join(JDK_BASE_DIR, distro.name); + const files = yield fs6.promises.readdir(distroDir, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => { + if (utils_1.isMac) { + return path18.join(distroDir, file.name, "Contents", "Home"); + } else { + return path18.join(distroDir, file.name); + } + }); + ret.push(...homedirs); + } + } + } catch (error) { + (0, logger_1.log)(error); + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/homebrew.js +var require_homebrew = __commonJS({ + "node_modules/jdk-utils/dist/from/homebrew.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = exports.HOMEBREW_DIR_LINUX = exports.HOMEBREW_DIR_APPLE_SILLICON = exports.HOMEBREW_DIR_INTEL = void 0; + var fs6 = __importStar(require("fs")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var utils_1 = require_utils(); + exports.HOMEBREW_DIR_INTEL = "/usr/local/opt"; + exports.HOMEBREW_DIR_APPLE_SILLICON = "/opt/homebrew/opt"; + exports.HOMEBREW_DIR_LINUX = "/home/linuxbrew/.linuxbrew/opt"; + function candidates(homebrewOptPath) { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + const files = yield fs6.promises.readdir(homebrewOptPath, { withFileTypes: true }); + const homeDirLinks = files.filter((file) => file.isSymbolicLink() && (0, utils_1.looksLikeJavaHome)(file.name)).map((file) => path18.join(homebrewOptPath, file.name)); + const actualHomeDirs = yield Promise.all((0, utils_1.deDup)(homeDirLinks).map((file) => (0, utils_1.getRealHome)(file))); + ret.push(...actualHomeDirs); + } catch (error) { + (0, logger_1.log)(error); + } + return ret.filter(Boolean); + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/jabba.js +var require_jabba = __commonJS({ + "node_modules/jdk-utils/dist/from/jabba.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var JABBA_DIR = path18.join(os4.homedir(), ".jabba"); + var JDK_BASE_DIR = path18.join(JABBA_DIR, "jdk"); + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + const files = yield fs6.promises.readdir(JDK_BASE_DIR, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(JDK_BASE_DIR, file.name)); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/jenv.js +var require_jenv = __commonJS({ + "node_modules/jdk-utils/dist/from/jenv.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var utils_1 = require_utils(); + var JENV_DIR = path18.join(os4.homedir(), ".jenv"); + var JDK_LINK_BASE_DIR = path18.join(JENV_DIR, "versions"); + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + const files = yield fs6.promises.readdir(JDK_LINK_BASE_DIR, { withFileTypes: true }); + const homeDirLinks = files.filter((file) => file.isSymbolicLink()).map((file) => path18.join(JDK_LINK_BASE_DIR, file.name)); + const actualHomeDirs = yield Promise.all(homeDirLinks.map((file) => fs6.promises.realpath(file))); + const uniqHomes = (0, utils_1.deDup)(actualHomeDirs); + ret.push(...uniqHomes); + } catch (error) { + (0, logger_1.log)(error); + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/linux.js +var require_linux = __commonJS({ + "node_modules/jdk-utils/dist/from/linux.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var JDK_BASE_DIRS = [ + "/usr/lib/jvm", + "/usr/java" + ]; + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + for (const baseDir of JDK_BASE_DIRS) { + try { + const files = yield fs6.promises.readdir(baseDir, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(baseDir, file.name)); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/macOS.js +var require_macOS = __commonJS({ + "node_modules/jdk-utils/dist/from/macOS.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var cp = __importStar(require("child_process")); + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var utils_1 = require_utils(); + var JDK_BASE_DIRS = [ + "/Library/Java/JavaVirtualMachines", + path18.join(os4.homedir(), "Library/Java/JavaVirtualMachines") + ]; + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + ret.push(...yield fromJavaHomeUtil()); + ret.push(...yield fromDefaultIntallationLocation()); + return (0, utils_1.deDup)(ret); + }); + } + exports.candidates = candidates; + function fromDefaultIntallationLocation() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + for (const baseDir of JDK_BASE_DIRS) { + try { + const files = yield fs6.promises.readdir(baseDir, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(baseDir, file.name, "Contents", "Home")); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + } + return ret; + }); + } + function fromJavaHomeUtil() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + const javaHomeUtility = "/usr/libexec/java_home"; + try { + yield fs6.promises.access(javaHomeUtility, fs6.constants.F_OK); + yield new Promise((resolve9, _reject) => { + cp.execFile(javaHomeUtility, ["-V"], {}, (_error, _stdout, stderr) => { + const regexp = /".*" - ".*" (.*)/g; + let match; + do { + match = regexp.exec(stderr); + if (match) { + ret.push(match[1]); + } + } while (match !== null); + resolve9(); + }); + }); + } catch (e) { + (0, logger_1.log)(e); + } + return ret; + }); + } + } +}); + +// node_modules/jdk-utils/dist/from/sdkman.js +var require_sdkman = __commonJS({ + "node_modules/jdk-utils/dist/from/sdkman.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var _a; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var SDKMAN_DIR = (_a = process.env.SDKMAN_DIR) !== null && _a !== void 0 ? _a : path18.join(os4.homedir(), ".sdkman"); + var JDK_BASE_DIR = path18.join(SDKMAN_DIR, "candidates", "java"); + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + try { + const files = yield fs6.promises.readdir(JDK_BASE_DIR, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(JDK_BASE_DIR, file.name)); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + return ret; + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/from/windows.js +var require_windows = __commonJS({ + "node_modules/jdk-utils/dist/from/windows.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.candidates = void 0; + var fs6 = __importStar(require("fs")); + var os4 = __importStar(require("os")); + var path18 = __importStar(require("path")); + var logger_1 = require_logger(); + var utils_1 = require_utils(); + var PROGRAM_DIRS = Array.from(/* @__PURE__ */ new Set([ + process.env.ProgramW6432, + process.env.ProgramFiles, + process.env.LOCALAPPDATA, + path18.join(os4.homedir(), "AppData", "Local") + ])).filter(Boolean); + var POPULAR_DISTRIBUTIONS = [ + "Eclipse Foundation", + "Eclipse Adoptium", + "Java", + "Amazon Corretto", + "Microsoft", + path18.join("SapMachine", "JDK"), + "Zulu" + ]; + function candidates() { + return __awaiter(this, void 0, void 0, function* () { + const ret = []; + for (const programDir of PROGRAM_DIRS) { + for (const distro of POPULAR_DISTRIBUTIONS) { + const baseDir = path18.join(programDir, distro); + try { + const files = yield fs6.promises.readdir(baseDir, { withFileTypes: true }); + const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(baseDir, file.name)); + ret.push(...homedirs); + } catch (error) { + (0, logger_1.log)(error); + } + } + } + return ret.filter(utils_1.looksLikeJavaHome); + }); + } + exports.candidates = candidates; + } +}); + +// node_modules/jdk-utils/dist/index.js +var require_dist = __commonJS({ + "node_modules/jdk-utils/dist/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve9) { + resolve9(value); + }); + } + return new (P || (P = Promise))(function(resolve9, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getSources = exports.getRuntime = exports.findRuntimes = exports.JAVA_FILENAME = exports.JAVAC_FILENAME = void 0; + var cp = __importStar(require("child_process")); + var fs6 = __importStar(require("fs")); + var path18 = __importStar(require("path")); + var asdf = __importStar(require_asdf()); + var envs = __importStar(require_envs()); + var gradle = __importStar(require_gradle()); + var homebrew = __importStar(require_homebrew()); + var jabba = __importStar(require_jabba()); + var jenv = __importStar(require_jenv()); + var linux = __importStar(require_linux()); + var macOS = __importStar(require_macOS()); + var sdkman = __importStar(require_sdkman()); + var windows = __importStar(require_windows()); + var logger2 = __importStar(require_logger()); + var utils_1 = require_utils(); + var utils_2 = require_utils(); + Object.defineProperty(exports, "JAVAC_FILENAME", { enumerable: true, get: function() { + return utils_2.JAVAC_FILENAME; + } }); + Object.defineProperty(exports, "JAVA_FILENAME", { enumerable: true, get: function() { + return utils_2.JAVA_FILENAME; + } }); + function findRuntimes3(options2) { + var _a, _b, _c, _d, _e, _f, _g, _h; + return __awaiter(this, void 0, void 0, function* () { + const store = new RuntimeStore(); + const candidates = []; + const updateCandidates = (homedirs, updater) => { + if (options2 === null || options2 === void 0 ? void 0 : options2.withTags) { + store.updateRuntimes(homedirs, updater); + } else { + candidates.push(...homedirs); + } + }; + if (!((_a = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _a === void 0 ? void 0 : _a.sdkman)) { + const fromSdkman = yield sdkman.candidates(); + updateCandidates(fromSdkman, (r) => Object.assign(Object.assign({}, r), { isFromSDKMAN: true })); + } + if (utils_1.isLinux) { + updateCandidates(yield linux.candidates()); + updateCandidates(yield homebrew.candidates(homebrew.HOMEBREW_DIR_LINUX)); + } + if (utils_1.isMac) { + updateCandidates(yield macOS.candidates()); + const hbOptPath = utils_1.isArm ? homebrew.HOMEBREW_DIR_APPLE_SILLICON : homebrew.HOMEBREW_DIR_INTEL; + updateCandidates(yield homebrew.candidates(hbOptPath)); + } + if (utils_1.isWindows) { + updateCandidates(yield windows.candidates()); + } + if (!((_b = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _b === void 0 ? void 0 : _b.jdkHomeEnv)) { + const fromJdkHome = yield envs.candidatesFromSpecificEnv("JDK_HOME"); + if (fromJdkHome) { + updateCandidates([fromJdkHome], (r) => Object.assign(Object.assign({}, r), { isJdkHomeEnv: true })); + } + } + if (!((_c = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _c === void 0 ? void 0 : _c.javaHomeEnv)) { + const fromJavaHome = yield envs.candidatesFromSpecificEnv("JAVA_HOME"); + if (fromJavaHome) { + updateCandidates([fromJavaHome], (r) => Object.assign(Object.assign({}, r), { isJavaHomeEnv: true })); + } + } + if (!((_d = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _d === void 0 ? void 0 : _d.inPathEnv)) { + const fromPath = yield envs.candidatesFromPath(); + updateCandidates(fromPath, (r) => Object.assign(Object.assign({}, r), { isInPathEnv: true })); + } + if (!((_e = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _e === void 0 ? void 0 : _e.jenv)) { + const fromJENV = yield jenv.candidates(); + updateCandidates(fromJENV, (r) => Object.assign(Object.assign({}, r), { isFromJENV: true })); + } + if (!((_f = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _f === void 0 ? void 0 : _f.jabba)) { + const fromJabba = yield jabba.candidates(); + updateCandidates(fromJabba, (r) => Object.assign(Object.assign({}, r), { isFromJabba: true })); + } + if (!((_g = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _g === void 0 ? void 0 : _g.asdf)) { + const fromASDF = yield asdf.candidates(); + updateCandidates(fromASDF, (r) => Object.assign(Object.assign({}, r), { isFromASDF: true })); + } + if (!((_h = options2 === null || options2 === void 0 ? void 0 : options2.skipFrom) === null || _h === void 0 ? void 0 : _h.gradle)) { + const fromGradle = yield gradle.candidates(); + updateCandidates(fromGradle, (r) => Object.assign(Object.assign({}, r), { isFromGradle: true })); + } + let runtimes = (options2 === null || options2 === void 0 ? void 0 : options2.withTags) ? store.allRuntimes() : (0, utils_1.deDup)(candidates).map((homedir3) => ({ homedir: homedir3 })); + if (true) { + runtimes = yield Promise.all(runtimes.map(checkJavaFile)); + if (true) { + runtimes = runtimes.filter((r) => r.isValid); + } + } + if (options2 === null || options2 === void 0 ? void 0 : options2.checkJavac) { + runtimes = yield Promise.all(runtimes.map(checkJavacFile)); + } + if (options2 === null || options2 === void 0 ? void 0 : options2.withVersion) { + runtimes = yield Promise.all(runtimes.map(parseVersion)); + } + for (const r of runtimes) { + delete r.isValid; + } + return runtimes; + }); + } + exports.findRuntimes = findRuntimes3; + function getRuntime3(homedir3, options2) { + return __awaiter(this, void 0, void 0, function* () { + let runtime = { homedir: homedir3 }; + runtime = yield checkJavaFile(runtime); + if (!runtime.isValid) { + return void 0; + } + if (options2 === null || options2 === void 0 ? void 0 : options2.checkJavac) { + runtime = yield checkJavacFile(runtime); + } + if (options2 === null || options2 === void 0 ? void 0 : options2.withVersion) { + runtime = yield parseVersion(runtime); + } + if (options2 === null || options2 === void 0 ? void 0 : options2.withTags) { + const gList = yield gradle.candidates(); + if (gList.includes(homedir3)) { + runtime.isFromGradle = true; + } + const aList = yield asdf.candidates(); + if (aList.includes(homedir3)) { + runtime.isFromASDF = true; + } + const jList = yield jenv.candidates(); + if (jList.includes(homedir3)) { + runtime.isFromJENV = true; + } + const sList = yield sdkman.candidates(); + if (sList.includes(homedir3)) { + runtime.isFromSDKMAN = true; + } + const jbList = yield jabba.candidates(); + if (jbList.includes(homedir3)) { + runtime.isFromJabba = true; + } + const pList = yield envs.candidatesFromPath(); + if (pList.includes(homedir3)) { + runtime.isInPathEnv = true; + } + if ((yield envs.candidatesFromSpecificEnv("JAVA_HOME")) === homedir3) { + runtime.isJavaHomeEnv = true; + } + if ((yield envs.candidatesFromSpecificEnv("JDK_HOME")) === homedir3) { + runtime.isJdkHomeEnv = true; + } + } + return runtime; + }); + } + exports.getRuntime = getRuntime3; + function getSources2(r) { + const sources = []; + if (r.isJdkHomeEnv) { + sources.push("JDK_HOME"); + } + if (r.isJavaHomeEnv) { + sources.push("JAVA_HOME"); + } + if (r.isInPathEnv) { + sources.push("PATH"); + } + if (r.isFromSDKMAN) { + sources.push("SDKMAN"); + } + if (r.isFromJENV) { + sources.push("jEnv"); + } + if (r.isFromJabba) { + sources.push("jabba"); + } + if (r.isFromASDF) { + sources.push("asdf"); + } + if (r.isFromGradle) { + sources.push("Gradle"); + } + return sources; + } + exports.getSources = getSources2; + function checkJavaFile(runtime) { + return __awaiter(this, void 0, void 0, function* () { + const { homedir: homedir3 } = runtime; + const binary = path18.join(homedir3, "bin", utils_1.JAVA_FILENAME); + try { + yield fs6.promises.access(binary, fs6.constants.F_OK); + runtime.isValid = true; + } catch (error) { + runtime.isValid = false; + } + return runtime; + }); + } + function checkJavacFile(runtime) { + return __awaiter(this, void 0, void 0, function* () { + const { homedir: homedir3 } = runtime; + const binary = path18.join(homedir3, "bin", utils_1.JAVAC_FILENAME); + try { + yield fs6.promises.access(binary, fs6.constants.F_OK); + runtime.hasJavac = true; + } catch (error) { + runtime.hasJavac = false; + } + return runtime; + }); + } + function parseVersion(runtime) { + return __awaiter(this, void 0, void 0, function* () { + const { homedir: homedir3 } = runtime; + const releaseFile = path18.join(homedir3, "release"); + try { + const content = yield fs6.promises.readFile(releaseFile, { encoding: "utf-8" }); + const regexp = /^JAVA_VERSION="(.*)"/gm; + const match = regexp.exec(content.toString()); + if (!match) { + return runtime; + } + const java_version = match[1]; + const major = parseMajorVersion(java_version); + runtime.version = { + java_version, + major + }; + } catch (error) { + logger2.log(error); + } + if (runtime.version === void 0) { + try { + runtime.version = yield checkJavaVersionByCLI(homedir3); + } catch (error) { + logger2.log(error); + } + } + return runtime; + }); + } + function checkJavaVersionByCLI(javaHome) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve9, _reject) => { + const javaBin = path18.join(javaHome, "bin", utils_1.JAVA_FILENAME); + cp.execFile(javaBin, ["-version"], {}, (_error, _stdout, stderr) => { + const regexp = /version "(.*)"/g; + const match = regexp.exec(stderr); + if (!match) { + return resolve9(void 0); + } + const java_version = match[1]; + const major = parseMajorVersion(java_version); + resolve9({ + java_version, + major + }); + }); + }); + }); + } + function parseMajorVersion(version) { + if (!version) { + return 0; + } + if (version.startsWith("1.")) { + version = version.substring(2); + } + const regexp = /\d+/g; + const match = regexp.exec(version); + let javaVersion = 0; + if (match) { + javaVersion = parseInt(match[0]); + } + return javaVersion; + } + var RuntimeStore = class { + constructor() { + this.map = /* @__PURE__ */ new Map(); + } + updateRuntimes(homedirs, updater) { + for (const h of homedirs) { + this.updateRuntime(h, updater); + } + } + updateRuntime(homedir3, updater) { + var _a; + const runtime = this.map.get(homedir3) || { homedir: homedir3 }; + this.map.set(homedir3, (_a = updater === null || updater === void 0 ? void 0 : updater(runtime)) !== null && _a !== void 0 ? _a : runtime); + } + allRuntimes() { + return Array.from(this.map.values()); + } + }; + } +}); + +// node_modules/lodash.findindex/index.js +var require_lodash2 = __commonJS({ + "node_modules/lodash.findindex/index.js"(exports, module2) { + var LARGE_ARRAY_SIZE = 200; + var FUNC_ERROR_TEXT = "Expected a function"; + var HASH_UNDEFINED = "__lodash_hash_undefined__"; + var UNORDERED_COMPARE_FLAG = 1; + var PARTIAL_COMPARE_FLAG = 2; + var INFINITY = 1 / 0; + var MAX_SAFE_INTEGER = 9007199254740991; + var MAX_INTEGER = 17976931348623157e292; + var NAN = 0 / 0; + var argsTag = "[object Arguments]"; + var arrayTag = "[object Array]"; + var boolTag = "[object Boolean]"; + var dateTag = "[object Date]"; + var errorTag = "[object Error]"; + var funcTag = "[object Function]"; + var genTag = "[object GeneratorFunction]"; + var mapTag = "[object Map]"; + var numberTag = "[object Number]"; + var objectTag = "[object Object]"; + var promiseTag = "[object Promise]"; + var regexpTag = "[object RegExp]"; + var setTag = "[object Set]"; + var stringTag = "[object String]"; + var symbolTag = "[object Symbol]"; + var weakMapTag = "[object WeakMap]"; + var arrayBufferTag = "[object ArrayBuffer]"; + var dataViewTag = "[object DataView]"; + var float32Tag = "[object Float32Array]"; + var float64Tag = "[object Float64Array]"; + var int8Tag = "[object Int8Array]"; + var int16Tag = "[object Int16Array]"; + var int32Tag = "[object Int32Array]"; + var uint8Tag = "[object Uint8Array]"; + var uint8ClampedTag = "[object Uint8ClampedArray]"; + var uint16Tag = "[object Uint16Array]"; + var uint32Tag = "[object Uint32Array]"; + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + var reIsPlainProp = /^\w*$/; + var reLeadingDot = /^\./; + var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + var reTrim = /^\s+|\s+$/g; + var reEscapeChar = /\\(\\)?/g; + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + var reIsBinary = /^0b[01]+$/i; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + var reIsOctal = /^0o[0-7]+$/i; + var reIsUint = /^(?:0|[1-9]\d*)$/; + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + var freeParseInt = parseInt; + var freeGlobal = typeof global == "object" && global && global.Object === Object && global; + var freeSelf = typeof self == "object" && self && self.Object === Object && self; + var root = freeGlobal || freeSelf || Function("return this")(); + var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; + var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2; + var moduleExports = freeModule && freeModule.exports === freeExports; + var freeProcess = moduleExports && freeGlobal.process; + var nodeUtil = function() { + try { + return freeProcess && freeProcess.binding("util"); + } catch (e) { + } + }(); + var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + function arraySome(array, predicate) { + var index = -1, length = array ? array.length : 0; + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; + } + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, index = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index-- : ++index < length) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + function baseProperty(key) { + return function(object) { + return object == null ? void 0 : object[key]; + }; + } + function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; + } + function baseUnary(func) { + return function(value) { + return func(value); + }; + } + function getValue(object, key) { + return object == null ? void 0 : object[key]; + } + function isHostObject(value) { + var result = false; + if (value != null && typeof value.toString != "function") { + try { + result = !!(value + ""); + } catch (e) { + } + } + return result; + } + function mapToArray(map) { + var index = -1, result = Array(map.size); + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } + function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } + var arrayProto = Array.prototype; + var funcProto = Function.prototype; + var objectProto = Object.prototype; + var coreJsData = root["__core-js_shared__"]; + var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + }(); + var funcToString = funcProto.toString; + var hasOwnProperty = objectProto.hasOwnProperty; + var objectToString = objectProto.toString; + var reIsNative = RegExp( + "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + var Symbol2 = root.Symbol; + var Uint8Array2 = root.Uint8Array; + var propertyIsEnumerable = objectProto.propertyIsEnumerable; + var splice = arrayProto.splice; + var nativeKeys = overArg(Object.keys, Object); + var nativeMax = Math.max; + var DataView = getNative(root, "DataView"); + var Map2 = getNative(root, "Map"); + var Promise2 = getNative(root, "Promise"); + var Set2 = getNative(root, "Set"); + var WeakMap = getNative(root, "WeakMap"); + var nativeCreate = getNative(Object, "create"); + var dataViewCtorString = toSource(DataView); + var mapCtorString = toSource(Map2); + var promiseCtorString = toSource(Promise2); + var setCtorString = toSource(Set2); + var weakMapCtorString = toSource(WeakMap); + var symbolProto = Symbol2 ? Symbol2.prototype : void 0; + var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; + var symbolToString = symbolProto ? symbolProto.toString : void 0; + function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + } + function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; + } + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty.call(data, key) ? data[key] : void 0; + } + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key); + } + function hashSet(key, value) { + var data = this.__data__; + data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value; + return this; + } + Hash.prototype.clear = hashClear; + Hash.prototype["delete"] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear() { + this.__data__ = []; + } + function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; + } + function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? void 0 : data[index][1]; + } + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + ListCache.prototype.clear = listCacheClear; + ListCache.prototype["delete"] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear() { + this.__data__ = { + "hash": new Hash(), + "map": new (Map2 || ListCache)(), + "string": new Hash() + }; + } + function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); + } + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; + } + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype["delete"] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + function SetCache(values) { + var index = -1, length = values ? values.length : 0; + this.__data__ = new MapCache(); + while (++index < length) { + this.add(values[index]); + } + } + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; + } + function setCacheHas(value) { + return this.__data__.has(value); + } + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + function Stack(entries) { + this.__data__ = new ListCache(entries); + } + function stackClear() { + this.__data__ = new ListCache(); + } + function stackDelete(key) { + return this.__data__["delete"](key); + } + function stackGet(key) { + return this.__data__.get(key); + } + function stackHas(key) { + return this.__data__.has(key); + } + function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache) { + var pairs = cache.__data__; + if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([key, value]); + return this; + } + cache = this.__data__ = new MapCache(pairs); + } + cache.set(key, value); + return this; + } + Stack.prototype.clear = stackClear; + Stack.prototype["delete"] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + function arrayLikeKeys(value, inherited) { + var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []; + var length = result.length, skipIndexes = !!length; + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) { + result.push(key); + } + } + return result; + } + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + function baseGet(object, path18) { + path18 = isKey(path18, object) ? [path18] : castPath(path18); + var index = 0, length = path18.length; + while (object != null && index < length) { + object = object[toKey(path18[index++])]; + } + return index && index == length ? object : void 0; + } + function baseGetTag(value) { + return objectToString.call(value); + } + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || !isObject(value) && !isObjectLike(other)) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); + } + function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; + if (!objIsArr) { + objTag = getTag(object); + objTag = objTag == argsTag ? objectTag : objTag; + } + if (!othIsArr) { + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; + } + var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; + if (isSameTag && !objIsObj) { + stack || (stack = new Stack()); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack()); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack()); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); + } + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, length = index, noCustomizer = !customizer; + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], objValue = object[key], srcValue = data[1]; + if (noCustomizer && data[2]) { + if (objValue === void 0 && !(key in object)) { + return false; + } + } else { + var stack = new Stack(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === void 0 ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { + return false; + } + } + } + return true; + } + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + } + function baseIteratee(value) { + if (typeof value == "function") { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == "object") { + return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); + } + return property(value); + } + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != "constructor") { + result.push(key); + } + } + return result; + } + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + function baseMatchesProperty(path18, srcValue) { + if (isKey(path18) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path18), srcValue); + } + return function(object) { + var objValue = get(object, path18); + return objValue === void 0 && objValue === srcValue ? hasIn(object, path18) : baseIsEqual(srcValue, objValue, void 0, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); + }; + } + function basePropertyDeep(path18) { + return function(object) { + return baseGet(object, path18); + }; + } + function baseToString(value) { + if (typeof value == "string") { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ""; + } + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; + } + function castPath(value) { + return isArray(value) ? value : stringToPath(value); + } + function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : void 0; + stack.set(array, other); + stack.set(other, array); + while (++index < arrLength) { + var arrValue = array[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome(other, function(othValue2, othIndex) { + if (!seen.has(othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, customizer, bitmask, stack))) { + return seen.add(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack["delete"](array); + stack["delete"](other); + return result; + } + function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { + switch (tag) { + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { + return false; + } + object = object.buffer; + other = other.buffer; + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { + return false; + } + return true; + case boolTag: + case dateTag: + case numberTag: + return eq(+object, +other); + case errorTag: + return object.name == other.name && object.message == other.message; + case regexpTag: + case stringTag: + return object == other + ""; + case mapTag: + var convert = mapToArray; + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + if (object.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); + stack["delete"](object); + return result; + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; + } + function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object); + stack["delete"](other); + return result; + } + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; + } + function getMatchData(object) { + var result = keys(object), length = result.length; + while (length--) { + var key = result[length], value = object[key]; + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : void 0; + } + var getTag = baseGetTag; + if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) { + getTag = function(value) { + var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + } + return result; + }; + } + function hasPath(object, path18, hasFunc) { + path18 = isKey(path18, object) ? [path18] : castPath(path18); + var result, index = -1, length = path18.length; + while (++index < length) { + var key = toKey(path18[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result) { + return result; + } + var length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); + } + function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); + } + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); + } + function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; + } + function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; + } + function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + return value === proto; + } + function isStrictComparable(value) { + return value === value && !isObject(value); + } + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && (srcValue !== void 0 || key in Object(object)); + }; + } + var stringToPath = memoize(function(string) { + string = toString(string); + var result = []; + if (reLeadingDot.test(string)) { + result.push(""); + } + string.replace(rePropName, function(match, number, quote, string2) { + result.push(quote ? string2.replace(reEscapeChar, "$1") : number || match); + }); + return result; + }); + function toKey(value) { + if (typeof value == "string" || isSymbol(value)) { + return value; + } + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; + } + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) { + } + try { + return func + ""; + } catch (e) { + } + } + return ""; + } + function findIndex2(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index); + } + function memoize(func, resolver) { + if (typeof func != "function" || resolver && typeof resolver != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache)(); + return memoized; + } + memoize.Cache = MapCache; + function eq(value, other) { + return value === other || value !== value && other !== other; + } + function isArguments(value) { + return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag); + } + var isArray = Array.isArray; + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + function isFunction(value) { + var tag = isObject(value) ? objectToString.call(value) : ""; + return tag == funcTag || tag == genTag; + } + function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + function isObject(value) { + var type = typeof value; + return !!value && (type == "object" || type == "function"); + } + function isObjectLike(value) { + return !!value && typeof value == "object"; + } + function isSymbol(value) { + return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; + } + var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = value < 0 ? -1 : 1; + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + function toInteger(value) { + var result = toFinite(value), remainder = result % 1; + return result === result ? remainder ? result - remainder : result : 0; + } + function toNumber(value) { + if (typeof value == "number") { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == "function" ? value.valueOf() : value; + value = isObject(other) ? other + "" : other; + } + if (typeof value != "string") { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ""); + var isBinary = reIsBinary.test(value); + return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; + } + function toString(value) { + return value == null ? "" : baseToString(value); + } + function get(object, path18, defaultValue) { + var result = object == null ? void 0 : baseGet(object, path18); + return result === void 0 ? defaultValue : result; + } + function hasIn(object, path18) { + return object != null && hasPath(object, path18, baseHasIn); + } + function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); + } + function identity(value) { + return value; + } + function property(path18) { + return isKey(path18) ? baseProperty(toKey(path18)) : basePropertyDeep(path18); + } + module2.exports = findIndex2; + } +}); + +// src/extension.ts +var extension_exports = {}; +__export(extension_exports, { + activate: () => activate, + deactivate: () => deactivate, + getActiveLanguageClient: () => getActiveLanguageClient +}); +module.exports = __toCommonJS(extension_exports); +var chokidar = __toESM(require("chokidar")); +var import_coc37 = require("coc.nvim"); +var import_crypto2 = require("crypto"); +var fs5 = __toESM(require("fs")); +var fse9 = __toESM(require_lib()); +var path17 = __toESM(require("path")); +var import_vscode_languageserver_protocol8 = __toESM(require_main2()); + +// src/apiManager.ts +var import_coc2 = require("coc.nvim"); + +// src/commands.ts +var Commands; +((Commands2) => { + Commands2.OPEN_BROWSER = "vscode.open"; + Commands2.OPEN_OUTPUT = "java.open.output"; + Commands2.SHOW_JAVA_REFERENCES = "java.show.references"; + Commands2.SHOW_JAVA_IMPLEMENTATIONS = "java.show.implementations"; + Commands2.SHOW_REFERENCES = "editor.action.showReferences"; + Commands2.CONFIGURATION_UPDATE = "java.projectConfiguration.update"; + Commands2.IGNORE_INCOMPLETE_CLASSPATH = "java.ignoreIncompleteClasspath"; + Commands2.IGNORE_INCOMPLETE_CLASSPATH_HELP = "java.ignoreIncompleteClasspath.help"; + Commands2.RELOAD_WINDOW = "workbench.action.reloadWindow"; + Commands2.PROJECT_CONFIGURATION_STATUS = "java.projectConfiguration.status"; + Commands2.NULL_ANALYSIS_SET_MODE = "java.compile.nullAnalysis.setMode"; + Commands2.APPLY_WORKSPACE_EDIT = "java.apply.workspaceEdit"; + Commands2.EXECUTE_WORKSPACE_COMMAND = "java.execute.workspaceCommand"; + Commands2.COMPILE_WORKSPACE = "java.workspace.compile"; + Commands2.BUILD_PROJECT = "java.project.build"; + Commands2.OPEN_SERVER_LOG = "java.open.serverLog"; + Commands2.OPEN_SERVER_STDOUT_LOG = "java.open.serverStdoutLog"; + Commands2.OPEN_SERVER_STDERR_LOG = "java.open.serverStderrLog"; + Commands2.OPEN_CLIENT_LOG = "java.open.clientLog"; + Commands2.OPEN_LOGS = "java.open.logs"; + Commands2.OPEN_FORMATTER = "java.open.formatter.settings"; + Commands2.OPEN_FILE = "java.open.file"; + Commands2.CLEAN_WORKSPACE = "java.clean.workspace"; + Commands2.UPDATE_SOURCE_ATTACHMENT_CMD = "java.project.updateSourceAttachment.command"; + Commands2.UPDATE_SOURCE_ATTACHMENT = "java.project.updateSourceAttachment"; + Commands2.RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; + Commands2.ADD_TO_SOURCEPATH_CMD = "java.project.addToSourcePath.command"; + Commands2.ADD_TO_SOURCEPATH = "java.project.addToSourcePath"; + Commands2.REMOVE_FROM_SOURCEPATH_CMD = "java.project.removeFromSourcePath.command"; + Commands2.REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; + Commands2.LIST_SOURCEPATHS_CMD = "java.project.listSourcePaths.command"; + Commands2.LIST_SOURCEPATHS = "java.project.listSourcePaths"; + Commands2.IMPORT_PROJECTS_CMD = "java.project.import.command"; + Commands2.IMPORT_PROJECTS = "java.project.import"; + Commands2.OVERRIDE_METHODS_PROMPT = "java.action.overrideMethodsPrompt"; + Commands2.HASHCODE_EQUALS_PROMPT = "java.action.hashCodeEqualsPrompt"; + Commands2.OPEN_JSON_SETTINGS = "workbench.action.openSettingsJson"; + Commands2.MANUAL_CLEANUP = "java.action.doCleanup"; + Commands2.ORGANIZE_IMPORTS = "java.action.organizeImports"; + Commands2.ORGANIZE_IMPORTS_SILENTLY = "java.edit.organizeImports"; + Commands2.HANDLE_PASTE_EVENT = "java.edit.handlePasteEvent"; + Commands2.CLIPBOARD_ONPASTE = "java.action.clipboardPasteAction"; + Commands2.CHOOSE_IMPORTS = "java.action.organizeImports.chooseImports"; + Commands2.GENERATE_TOSTRING_PROMPT = "java.action.generateToStringPrompt"; + Commands2.GENERATE_ACCESSORS_PROMPT = "java.action.generateAccessorsPrompt"; + Commands2.GENERATE_CONSTRUCTORS_PROMPT = "java.action.generateConstructorsPrompt"; + Commands2.GENERATE_DELEGATE_METHODS_PROMPT = "java.action.generateDelegateMethodsPrompt"; + Commands2.APPLY_REFACTORING_COMMAND = "java.action.applyRefactoringCommand"; + Commands2.RENAME_COMMAND = "java.action.rename"; + Commands2.NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND = "java.action.navigateToSuperImplementation"; + Commands2.SHOW_TYPE_HIERARCHY = "java.action.showTypeHierarchy"; + Commands2.SHOW_SUPERTYPE_HIERARCHY = "java.action.showSupertypeHierarchy"; + Commands2.OPEN_TYPE_HIERARCHY_LOCATION = "java.action.typeHierarchy.open"; + Commands2.SHOW_SUBTYPE_HIERARCHY = "java.action.showSubtypeHierarchy"; + Commands2.SHOW_CLASS_HIERARCHY = "java.action.showClassHierarchy"; + Commands2.CHANGE_BASE_TYPE = "java.action.changeBaseType"; + Commands2.OPEN_TYPE_HIERARCHY = "java.navigate.openTypeHierarchy"; + Commands2.RESOLVE_TYPE_HIERARCHY = "java.navigate.resolveTypeHierarchy"; + Commands2.SHOW_SERVER_TASK_STATUS = "java.show.server.task.status"; + Commands2.GET_PROJECT_SETTINGS = "java.project.getSettings"; + Commands2.GET_CLASSPATHS = "java.project.getClasspaths"; + Commands2.IS_TEST_FILE = "java.project.isTestFile"; + Commands2.GET_ALL_JAVA_PROJECTS = "java.project.getAll"; + Commands2.SWITCH_SERVER_MODE = "java.server.mode.switch"; + Commands2.LEARN_MORE_ABOUT_REFACTORING = "_java.learnMoreAboutRefactorings"; + Commands2.LEARN_MORE_ABOUT_CLEAN_UPS = "_java.learnMoreAboutCleanUps"; + Commands2.TEMPLATE_VARIABLES = "_java.templateVariables"; + Commands2.NOT_COVERED_EXECUTION = "_java.notCoveredExecution"; + Commands2.MEATDATA_FILES_GENERATION = "_java.metadataFilesGeneration"; + Commands2.RUNTIME_VALIDATION_OPEN = "java.runtimeValidation.open"; + Commands2.RESOLVE_WORKSPACE_SYMBOL = "java.project.resolveWorkspaceSymbol"; + Commands2.GET_WORKSPACE_PATH = "_java.workspace.path"; + Commands2.UPGRADE_GRADLE_WRAPPER_CMD = "java.project.upgradeGradle.command"; + Commands2.UPGRADE_GRADLE_WRAPPER = "java.project.upgradeGradle"; + Commands2.LOMBOK_CONFIGURE = "java.lombokConfigure"; + Commands2.CREATE_MODULE_INFO = "java.project.createModuleInfo"; + Commands2.CREATE_MODULE_INFO_COMMAND = "java.project.createModuleInfo.command"; + Commands2.REFRESH_BUNDLES = "java.reloadBundles"; + Commands2.REFRESH_BUNDLES_COMMAND = "_java.reloadBundles.command"; + Commands2.CLEAN_SHARED_INDEXES = "java.clean.sharedIndexes"; +})(Commands || (Commands = {})); + +// src/documentSymbols.ts +var import_vscode_languageserver_protocol = __toESM(require_main2()); +function getDocumentSymbolsProvider() { + return async (params, token) => { + const languageClient = await getActiveLanguageClient(); + if (!languageClient) { + return []; + } + if (token !== void 0) { + return languageClient.sendRequest(import_vscode_languageserver_protocol.DocumentSymbolRequest.type, params, token); + } + return languageClient.sendRequest(import_vscode_languageserver_protocol.DocumentSymbolRequest.type, params); + }; +} + +// src/extension.api.ts +var extensionApiVersion = "0.7"; + +// src/goToDefinition.ts +var import_vscode_languageserver_protocol2 = __toESM(require_main2()); +function goToDefinitionProvider() { + return async (params, token) => { + const languageClient = await getActiveLanguageClient(); + if (!languageClient) { + return null; + } + if (token !== void 0) { + return languageClient.sendRequest(import_vscode_languageserver_protocol2.DefinitionRequest.type, params, token); + } + return languageClient.sendRequest(import_vscode_languageserver_protocol2.DefinitionRequest.type, params); + }; +} + +// src/hoverAction.ts +var import_vscode_languageserver_protocol3 = __toESM(require_main2()); + +// src/log.ts +var fs = __toESM(require("fs")); +var path = __toESM(require("path")); +var import_util = require("util"); +var MAX_FILE_SIZE = 1 * 1024 * 1024; +var DEFAULT_LOG_LEVEL = 2 /* Info */; +var toTwoDigits = (v) => v < 10 ? `0${v}` : v.toString(); +var toThreeDigits = (v) => v < 10 ? `00${v}` : v < 100 ? `0${v}` : v.toString(); +function format(args, depth = 2, color = false, hidden = false) { + let result = ""; + for (let i = 0; i < args.length; i++) { + let a = args[i]; + if (typeof a === "object") { + try { + a = (0, import_util.inspect)(a, hidden, depth, color); + } catch (e) { + } + } + result += (i > 0 ? " " : "") + a; + } + return result; +} +var AbstractLogger = class { + constructor() { + this.level = DEFAULT_LOG_LEVEL; + } + setLevel(level) { + if (this.level !== level) { + this.level = level; + } + } + getLevel() { + return this.level; + } +}; +var FileLogger = class extends AbstractLogger { + constructor(fsPath, level, config) { + super(); + this.fsPath = fsPath; + this.backupIndex = 1; + this.useConsole = false; + this.loggers = /* @__PURE__ */ new Map(); + this.config = Object.assign({ + userFormatters: true, + color: false, + depth: 2, + showHidden: false + }, config); + this.setLevel(level); + this.promise = this.initialize(); + } + switchConsole() { + this.useConsole = !this.useConsole; + } + format(args) { + let { color, showHidden, depth } = this.config; + return format(args, depth, color, showHidden); + } + createLogger(scope) { + let logger2 = this.loggers.has(scope) ? this.loggers.get(scope) : { + category: scope, + mark: () => { + }, + getLevel: () => { + return this.getLevel(); + }, + trace: (...args) => { + if (this.level <= 0 /* Trace */) { + this._log(0 /* Trace */, scope, args, this.getCurrentTimestamp()); + } + }, + debug: (...args) => { + if (this.level <= 1 /* Debug */) { + this._log(1 /* Debug */, scope, args, this.getCurrentTimestamp()); + } + }, + log: (...args) => { + if (this.level <= 2 /* Info */) { + this._log(2 /* Info */, scope, args, this.getCurrentTimestamp()); + } + }, + info: (...args) => { + if (this.level <= 2 /* Info */) { + this._log(2 /* Info */, scope, args, this.getCurrentTimestamp()); + } + }, + warn: (...args) => { + if (this.level <= 3 /* Warning */) { + this._log(3 /* Warning */, scope, args, this.getCurrentTimestamp()); + } + }, + error: (...args) => { + if (this.level <= 4 /* Error */) { + this._log(4 /* Error */, scope, args, this.getCurrentTimestamp()); + } + }, + fatal: (...args) => { + if (this.level <= 4 /* Error */) { + this._log(4 /* Error */, scope, args, this.getCurrentTimestamp()); + } + }, + flush: () => { + return this.promise; + } + }; + this.loggers.set(scope, logger2); + return logger2; + } + async initialize() { + return Promise.resolve(); + } + shouldBackup(size) { + return size > MAX_FILE_SIZE; + } + _log(level, scope, args, time) { + if (this.useConsole) { + let method = level === 4 /* Error */ ? "error" : "log"; + console[method](`${stringifyLogLevel(level)}`, format(args, null, true)); + } else { + let message = this.format(args); + this.promise = this.promise.then(() => { + let fn = async () => { + let text; + if (this.config.userFormatters !== false) { + let parts = [time, stringifyLogLevel(level), `(pid:${process.pid})`]; + text = `${parts.join(" ")} - ${message} +`; + } else { + text = message; + } + await (0, import_util.promisify)(fs.appendFile)(this.fsPath, text, { encoding: "utf8", flag: "a+" }); + let stat2 = await (0, import_util.promisify)(fs.stat)(this.fsPath); + if (this.shouldBackup(stat2.size)) { + let newFile = this.getBackupResource(); + await (0, import_util.promisify)(fs.rename)(this.fsPath, newFile); + } + }; + return fn(); + }).catch((err) => { + }); + } + } + getCurrentTimestamp() { + const currentTime = new Date(); + return `${currentTime.getFullYear()}-${toTwoDigits(currentTime.getMonth() + 1)}-${toTwoDigits(currentTime.getDate())}T${getTimestamp(currentTime)}`; + } + getBackupResource() { + this.backupIndex = this.backupIndex > 5 ? 1 : this.backupIndex; + return path.join(path.dirname(this.fsPath), `${path.basename(this.fsPath)}_${this.backupIndex++}`); + } +}; +function stringifyLogLevel(level) { + switch (level) { + case 1 /* Debug */: + return "DEBUG"; + case 4 /* Error */: + return "ERROR"; + case 2 /* Info */: + return "INFO"; + case 0 /* Trace */: + return "TRACE"; + case 3 /* Warning */: + return "WARN"; + } + return ""; +} +function getTimestamp(date) { + return `${toTwoDigits(date.getHours())}:${toTwoDigits(date.getMinutes())}:${toTwoDigits(date.getSeconds())}.${toThreeDigits(date.getMilliseconds())}`; +} +var logger; +function initializeLogFile(filename) { + logger = new FileLogger(filename, 0 /* Trace */, { + color: false, + userFormatters: true + }); +} +function createLogger() { + return logger.createLogger(""); +} + +// src/protocol.ts +var import_coc = require("coc.nvim"); +var FeatureStatus = /* @__PURE__ */ ((FeatureStatus2) => { + FeatureStatus2[FeatureStatus2["disabled"] = 0] = "disabled"; + FeatureStatus2[FeatureStatus2["interactive"] = 1] = "interactive"; + FeatureStatus2[FeatureStatus2["automatic"] = 2] = "automatic"; + return FeatureStatus2; +})(FeatureStatus || {}); +var StatusNotification; +((StatusNotification2) => { + StatusNotification2.type = new import_coc.NotificationType("language/status"); +})(StatusNotification || (StatusNotification = {})); +var ProgressReportNotification; +((ProgressReportNotification2) => { + ProgressReportNotification2.type = new import_coc.NotificationType("language/progressReport"); +})(ProgressReportNotification || (ProgressReportNotification = {})); +var ClassFileContentsRequest; +((ClassFileContentsRequest2) => { + ClassFileContentsRequest2.type = new import_coc.RequestType("java/classFileContents"); +})(ClassFileContentsRequest || (ClassFileContentsRequest = {})); +var ProjectConfigurationUpdateRequest; +((ProjectConfigurationUpdateRequest2) => { + ProjectConfigurationUpdateRequest2.type = new import_coc.NotificationType("java/projectConfigurationUpdate"); + ProjectConfigurationUpdateRequest2.typeV2 = new import_coc.NotificationType("java/projectConfigurationsUpdate"); +})(ProjectConfigurationUpdateRequest || (ProjectConfigurationUpdateRequest = {})); +var ActionableNotification; +((ActionableNotification2) => { + ActionableNotification2.type = new import_coc.NotificationType("language/actionableNotification"); +})(ActionableNotification || (ActionableNotification = {})); +var EventNotification; +((EventNotification2) => { + EventNotification2.type = new import_coc.NotificationType("language/eventNotification"); +})(EventNotification || (EventNotification = {})); +var CompileWorkspaceRequest; +((CompileWorkspaceRequest2) => { + CompileWorkspaceRequest2.type = new import_coc.RequestType("java/buildWorkspace"); +})(CompileWorkspaceRequest || (CompileWorkspaceRequest = {})); +var BuildProjectRequest; +((BuildProjectRequest2) => { + BuildProjectRequest2.type = new import_coc.RequestType("java/buildProjects"); +})(BuildProjectRequest || (BuildProjectRequest = {})); +var ExecuteClientCommandRequest; +((ExecuteClientCommandRequest2) => { + ExecuteClientCommandRequest2.type = new import_coc.RequestType("workspace/executeClientCommand"); +})(ExecuteClientCommandRequest || (ExecuteClientCommandRequest = {})); +var ServerNotification; +((ServerNotification2) => { + ServerNotification2.type = new import_coc.NotificationType("workspace/notify"); +})(ServerNotification || (ServerNotification = {})); +var ListOverridableMethodsRequest; +((ListOverridableMethodsRequest2) => { + ListOverridableMethodsRequest2.type = new import_coc.RequestType("java/listOverridableMethods"); +})(ListOverridableMethodsRequest || (ListOverridableMethodsRequest = {})); +var AddOverridableMethodsRequest; +((AddOverridableMethodsRequest2) => { + AddOverridableMethodsRequest2.type = new import_coc.RequestType("java/addOverridableMethods"); +})(AddOverridableMethodsRequest || (AddOverridableMethodsRequest = {})); +var CheckHashCodeEqualsStatusRequest; +((CheckHashCodeEqualsStatusRequest2) => { + CheckHashCodeEqualsStatusRequest2.type = new import_coc.RequestType("java/checkHashCodeEqualsStatus"); +})(CheckHashCodeEqualsStatusRequest || (CheckHashCodeEqualsStatusRequest = {})); +var GenerateHashCodeEqualsRequest; +((GenerateHashCodeEqualsRequest2) => { + GenerateHashCodeEqualsRequest2.type = new import_coc.RequestType("java/generateHashCodeEquals"); +})(GenerateHashCodeEqualsRequest || (GenerateHashCodeEqualsRequest = {})); +var CleanupRequest; +((CleanupRequest2) => { + CleanupRequest2.type = new import_coc.RequestType("java/cleanup"); +})(CleanupRequest || (CleanupRequest = {})); +var OrganizeImportsRequest; +((OrganizeImportsRequest2) => { + OrganizeImportsRequest2.type = new import_coc.RequestType("java/organizeImports"); +})(OrganizeImportsRequest || (OrganizeImportsRequest = {})); +var CheckToStringStatusRequest; +((CheckToStringStatusRequest2) => { + CheckToStringStatusRequest2.type = new import_coc.RequestType("java/checkToStringStatus"); +})(CheckToStringStatusRequest || (CheckToStringStatusRequest = {})); +var GenerateToStringRequest; +((GenerateToStringRequest2) => { + GenerateToStringRequest2.type = new import_coc.RequestType("java/generateToString"); +})(GenerateToStringRequest || (GenerateToStringRequest = {})); +var AccessorCodeActionRequest; +((AccessorCodeActionRequest2) => { + AccessorCodeActionRequest2.type = new import_coc.RequestType("java/resolveUnimplementedAccessors"); +})(AccessorCodeActionRequest || (AccessorCodeActionRequest = {})); +var GenerateAccessorsRequest; +((GenerateAccessorsRequest2) => { + GenerateAccessorsRequest2.type = new import_coc.RequestType("java/generateAccessors"); +})(GenerateAccessorsRequest || (GenerateAccessorsRequest = {})); +var CheckConstructorStatusRequest; +((CheckConstructorStatusRequest2) => { + CheckConstructorStatusRequest2.type = new import_coc.RequestType("java/checkConstructorsStatus"); +})(CheckConstructorStatusRequest || (CheckConstructorStatusRequest = {})); +var GenerateConstructorsRequest; +((GenerateConstructorsRequest2) => { + GenerateConstructorsRequest2.type = new import_coc.RequestType("java/generateConstructors"); +})(GenerateConstructorsRequest || (GenerateConstructorsRequest = {})); +var CheckDelegateMethodsStatusRequest; +((CheckDelegateMethodsStatusRequest2) => { + CheckDelegateMethodsStatusRequest2.type = new import_coc.RequestType("java/checkDelegateMethodsStatus"); +})(CheckDelegateMethodsStatusRequest || (CheckDelegateMethodsStatusRequest = {})); +var GenerateDelegateMethodsRequest; +((GenerateDelegateMethodsRequest2) => { + GenerateDelegateMethodsRequest2.type = new import_coc.RequestType("java/generateDelegateMethods"); +})(GenerateDelegateMethodsRequest || (GenerateDelegateMethodsRequest = {})); +var GetRefactorEditRequest; +((GetRefactorEditRequest2) => { + GetRefactorEditRequest2.type = new import_coc.RequestType("java/getRefactorEdit"); +})(GetRefactorEditRequest || (GetRefactorEditRequest = {})); +var InferSelectionRequest; +((InferSelectionRequest2) => { + InferSelectionRequest2.type = new import_coc.RequestType("java/inferSelection"); +})(InferSelectionRequest || (InferSelectionRequest = {})); +var GetMoveDestinationsRequest; +((GetMoveDestinationsRequest2) => { + GetMoveDestinationsRequest2.type = new import_coc.RequestType("java/getMoveDestinations"); +})(GetMoveDestinationsRequest || (GetMoveDestinationsRequest = {})); +var MoveRequest; +((MoveRequest2) => { + MoveRequest2.type = new import_coc.RequestType("java/move"); +})(MoveRequest || (MoveRequest = {})); +var SearchSymbols; +((SearchSymbols2) => { + SearchSymbols2.type = new import_coc.RequestType("java/searchSymbols"); +})(SearchSymbols || (SearchSymbols = {})); +var FindLinks; +((FindLinks2) => { + FindLinks2.type = new import_coc.RequestType("java/findLinks"); +})(FindLinks || (FindLinks = {})); +var WillRenameFiles; +((WillRenameFiles2) => { + WillRenameFiles2.type = new import_coc.RequestType("workspace/willRenameFiles"); +})(WillRenameFiles || (WillRenameFiles = {})); +var CheckExtractInterfaceStatusRequest; +((CheckExtractInterfaceStatusRequest2) => { + CheckExtractInterfaceStatusRequest2.type = new import_coc.RequestType("java/checkExtractInterfaceStatus"); +})(CheckExtractInterfaceStatusRequest || (CheckExtractInterfaceStatusRequest = {})); + +// src/hoverAction.ts +function createClientHoverProvider(languageClient) { + const hoverProvider = new JavaHoverProvider(languageClient); + registerHoverCommand(async (params, token) => { + return await provideHoverCommand(languageClient, params, token); + }); + return hoverProvider; +} +async function provideHoverCommand(languageClient, params, token) { + const response = await languageClient.sendRequest(FindLinks.type, { + type: "superImplementation", + position: params + }, token); + if (response && response.length) { + const location = response[0]; + let tooltip; + if (location.kind === "method") { + tooltip = `Go to super method '${location.displayName}'`; + } else { + tooltip = `Go to super implementation '${location.displayName}'`; + } + return [{ + title: "Go to Super Implementation", + command: Commands.NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND, + arguments: [{ + uri: encodeBase64(location.uri), + range: location.range + }] + }]; + } +} +function encodeBase64(text) { + return Buffer.from(text).toString("base64"); +} +var hoverCommandRegistry = []; +function registerHoverCommand(callback) { + hoverCommandRegistry.push(callback); +} +var JavaHoverProvider = class { + constructor(languageClient) { + this.languageClient = languageClient; + } + async provideHover(document, position, token) { + const params = { + textDocument: document, + position + }; + const hoverResponse = await this.languageClient.sendRequest(import_vscode_languageserver_protocol3.HoverRequest.type, params, token); + const serverHover = hoverResponse; + const contributedCommands = await this.getContributedHoverCommands(params, token); + if (!contributedCommands.length) { + return serverHover; + } + const contributed = { language: "markdown", value: contributedCommands.map((command) => this.convertCommandToMarkdown(command)).join(" | ") }; + let contents = [contributed]; + let range; + if (serverHover && serverHover.contents) { + contents = contents.concat(serverHover.contents); + range = serverHover.range; + } + return { contents, range }; + } + async getContributedHoverCommands(params, token) { + const contributedCommands = []; + for (const provideFn of hoverCommandRegistry) { + try { + if (token.isCancellationRequested) { + break; + } + const commands22 = await provideFn(params, token) || []; + commands22.forEach((command) => { + contributedCommands.push(command); + }); + } catch (error) { + createLogger().error(`Failed to provide hover command ${String(error)}`); + } + } + return contributedCommands; + } + convertCommandToMarkdown(command) { + return `[${command.title}](command:${command.command}?${encodeURIComponent(JSON.stringify(command.arguments || []))} "${command.command}")`; + } +}; + +// src/apiManager.ts +var ApiManager = class { + constructor() { + this.onDidClasspathUpdateEmitter = new import_coc2.Emitter(); + this.onDidServerModeChangeEmitter = new import_coc2.Emitter(); + this.onDidProjectsImportEmitter = new import_coc2.Emitter(); + } + initialize(requirements, serverMode) { + const getDocumentSymbols = getDocumentSymbolsProvider(); + const goToDefinition = goToDefinitionProvider(); + const getProjectSettings = async (uri, settingKeys) => { + return await import_coc2.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_PROJECT_SETTINGS, uri, settingKeys); + }; + const getClasspaths = async (uri, options2) => { + return await import_coc2.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_CLASSPATHS, uri, JSON.stringify(options2)); + }; + const isTestFile = async (uri) => { + return await import_coc2.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.IS_TEST_FILE, uri); + }; + const onDidClasspathUpdate = this.onDidClasspathUpdateEmitter.event; + const onDidServerModeChange = this.onDidServerModeChangeEmitter.event; + const onDidProjectsImport = this.onDidProjectsImportEmitter.event; + const serverReadyPromise = new Promise((resolve9) => { + this.serverReadyPromiseResolve = resolve9; + }); + const serverReady2 = async () => { + return serverReadyPromise; + }; + this.api = { + apiVersion: extensionApiVersion, + javaRequirement: requirements, + status: "Starting" /* starting */, + registerHoverCommand, + getDocumentSymbols, + goToDefinition, + getProjectSettings, + getClasspaths, + isTestFile, + onDidClasspathUpdate, + serverMode, + onDidServerModeChange, + onDidProjectsImport, + serverReady: serverReady2 + }; + } + getApiInstance() { + if (!this.api) { + throw new Error("API instance is not initialized"); + } + return this.api; + } + fireDidClasspathUpdate(event) { + this.onDidClasspathUpdateEmitter.fire(event); + } + fireDidServerModeChange(event) { + this.onDidServerModeChangeEmitter.fire(event); + } + fireDidProjectsImport(event) { + this.onDidProjectsImportEmitter.fire(event); + } + updateServerMode(mode) { + this.api.serverMode = mode; + } + updateStatus(status2) { + this.api.status = status2; + } + resolveServerReadyPromise() { + this.serverReadyPromiseResolve(true); + } +}; +var apiManager = new ApiManager(); + +// src/clientErrorHandler.ts +var import_coc3 = require("coc.nvim"); +var ClientErrorHandler = class { + constructor(name) { + this.name = name; + this.restarts = []; + this.logger = createLogger(); + } + error(_error, _message, count) { + if (count && count <= 3) { + this.logger.error(`${this.name} server encountered error: ${_message}, ${_error && _error.toString()}`); + return import_coc3.ErrorAction.Continue; + } + this.logger.error(`${this.name} server encountered error and will shut down: ${_message}, ${_error && _error.toString()}`); + return import_coc3.ErrorAction.Shutdown; + } + closed() { + this.restarts.push(Date.now()); + if (this.restarts.length < 5) { + this.logger.error(`The ${this.name} server crashed and will restart.`); + return import_coc3.CloseAction.Restart; + } else { + const diff = this.restarts[this.restarts.length - 1] - this.restarts[0]; + if (diff <= 3 * 60 * 1e3) { + const message = `The ${this.name} server crashed 5 times in the last 3 minutes. The server will not be restarted.`; + this.logger.error(message); + const action = "Show logs"; + import_coc3.window.showErrorMessage(message, action).then((selection) => { + if (selection === action) { + import_coc3.commands.executeCommand(Commands.OPEN_LOGS); + } + }); + return import_coc3.CloseAction.DoNotRestart; + } + this.logger.error(`The ${this.name} server crashed and will restart.`); + this.restarts.shift(); + return import_coc3.CloseAction.Restart; + } + } +}; + +// src/fileEventHandler.ts +var import_coc5 = require("coc.nvim"); +var import_fmtr = __toESM(require_fmtr()); +var import_fs_extra = __toESM(require_lib()); +var import_os = require("os"); +var path3 = __toESM(require("path")); + +// src/utils.ts +var import_coc4 = require("coc.nvim"); +var fs2 = __toESM(require("fs")); +var path2 = __toESM(require("path")); +function getJavaConfiguration() { + return import_coc4.workspace.getConfiguration("java"); +} +function deleteDirectory(dir) { + if (fs2.existsSync(dir)) { + fs2.readdirSync(dir).forEach((child) => { + const entry = path2.join(dir, child); + if (fs2.lstatSync(entry).isDirectory()) { + deleteDirectory(entry); + } else { + fs2.unlinkSync(entry); + } + }); + fs2.rmdirSync(dir); + } +} +function getTimestamp2(file) { + if (!fs2.existsSync(file)) { + return -1; + } + const stat2 = fs2.statSync(file); + return stat2.mtimeMs; +} +function ensureExists(folder) { + if (fs2.existsSync(folder)) { + return; + } + ensureExists(path2.dirname(folder)); + fs2.mkdirSync(folder); +} +function getBuildFilePatterns() { + const config = getJavaConfiguration(); + const isMavenImporterEnabled = config.get("import.maven.enabled"); + const isGradleImporterEnabled = config.get("import.gradle.enabled"); + const patterns = []; + if (isMavenImporterEnabled) { + patterns.push("**/pom.xml"); + } + if (isGradleImporterEnabled) { + patterns.push("**/*.gradle"); + patterns.push("**/*.gradle.kts"); + } + return patterns; +} +function getInclusionPatternsFromNegatedExclusion() { + const config = getJavaConfiguration(); + const exclusions = config.get("import.exclusions", []); + const patterns = []; + for (const exclusion of exclusions) { + if (exclusion.startsWith("!")) { + patterns.push(exclusion.substr(1)); + } + } + return patterns; +} +function convertToGlob(filePatterns, basePatterns) { + if (!filePatterns || filePatterns.length === 0) { + return ""; + } + if (!basePatterns || basePatterns.length === 0) { + return parseToStringGlob(filePatterns); + } + const patterns = []; + for (const basePattern of basePatterns) { + for (const filePattern of filePatterns) { + patterns.push(path2.join(basePattern, `/${filePattern}`).replace(/\\/g, "/")); + } + } + return parseToStringGlob(patterns); +} +function getExclusionBlob() { + const config = getJavaConfiguration(); + const exclusions = config.get("import.exclusions", []); + const patterns = []; + for (const exclusion of exclusions) { + if (exclusion.startsWith("!")) { + continue; + } + patterns.push(exclusion); + } + return parseToStringGlob(patterns); +} +function parseToStringGlob(patterns) { + if (!patterns || patterns.length === 0) { + return ""; + } + return `{${patterns.join(",")}}`; +} +async function getAllJavaProjects(excludeDefaultProject = true) { + let projectUris = await import_coc4.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_ALL_JAVA_PROJECTS); + if (excludeDefaultProject) { + projectUris = projectUris.filter((uriString) => { + const projectPath = import_coc4.Uri.parse(uriString).fsPath; + return path2.basename(projectPath) !== "jdt.ls-java-project"; + }); + } + return projectUris; +} +async function hasBuildToolConflicts() { + const projectConfigurationUris = await getBuildFilesInWorkspace(); + const projectConfigurationFsPaths = projectConfigurationUris.map((uri) => uri.fsPath); + const eclipseDirectories = getDirectoriesByBuildFile(projectConfigurationFsPaths, [], ".project"); + const gradleDirectories = getDirectoriesByBuildFile(projectConfigurationFsPaths, eclipseDirectories, ".gradle"); + const gradleDirectoriesKts = getDirectoriesByBuildFile(projectConfigurationFsPaths, eclipseDirectories, ".gradle.kts"); + gradleDirectories.concat(gradleDirectoriesKts); + const mavenDirectories = getDirectoriesByBuildFile(projectConfigurationFsPaths, eclipseDirectories, "pom.xml"); + return gradleDirectories.some((gradleDir) => { + return mavenDirectories.includes(gradleDir); + }); +} +async function getBuildFilesInWorkspace() { + const buildFiles = []; + const inclusionFilePatterns = getBuildFilePatterns(); + inclusionFilePatterns.push("**/.project"); + const inclusionFolderPatterns = getInclusionPatternsFromNegatedExclusion(); + if (inclusionFilePatterns.length > 0 && inclusionFolderPatterns.length > 0) { + buildFiles.push(...await import_coc4.workspace.findFiles(convertToGlob(inclusionFilePatterns, inclusionFolderPatterns), null)); + } + const inclusionBlob = convertToGlob(inclusionFilePatterns); + const exclusionBlob = getExclusionBlob(); + if (inclusionBlob) { + buildFiles.push(...await import_coc4.workspace.findFiles(inclusionBlob, exclusionBlob)); + } + return buildFiles; +} +function getDirectoriesByBuildFile(inclusions, exclusions, fileName) { + return inclusions.filter((fsPath) => fsPath.endsWith(fileName)).map((fsPath) => { + return path2.dirname(fsPath); + }).filter((inclusion) => { + return !exclusions.includes(inclusion); + }); +} +function getJavaConfig(javaHome) { + const origConfig = getJavaConfiguration(); + const javaConfig = JSON.parse(JSON.stringify(origConfig)); + javaConfig.home = javaHome; + javaConfig.project.outputPath = origConfig.inspect("project.outputPath").workspaceValue; + javaConfig.project.sourcePaths = origConfig.inspect("project.sourcePaths").workspaceValue; + const editorConfig = import_coc4.workspace.getConfiguration("editor"); + javaConfig.format.insertSpaces = editorConfig.get("insertSpaces"); + javaConfig.format.tabSize = editorConfig.get("tabSize"); + const isInsider = false; + const androidSupport = javaConfig.jdt.ls.androidSupport.enabled; + switch (androidSupport) { + case "auto": + javaConfig.jdt.ls.androidSupport.enabled = isInsider; + break; + case "on": + javaConfig.jdt.ls.androidSupport.enabled = true; + break; + case "off": + javaConfig.jdt.ls.androidSupport.enabled = false; + break; + default: + javaConfig.jdt.ls.androidSupport.enabled = false; + break; + } + const completionCaseMatching = javaConfig.completion.matchCase; + if (completionCaseMatching === "auto") { + javaConfig.completion.matchCase = isInsider ? "firstLetter" : "off"; + } + return javaConfig; +} +function equals(one, other) { + if (one === other) { + return true; + } + if (one === null || one === void 0 || other === null || other === void 0) { + return false; + } + if (typeof one !== typeof other) { + return false; + } + if (typeof one !== "object") { + return false; + } + if (Array.isArray(one) !== Array.isArray(other)) { + return false; + } + let i; + let key; + if (Array.isArray(one)) { + if (one.length !== other.length) { + return false; + } + for (i = 0; i < one.length; i++) { + if (!equals(one[i], other[i])) { + return false; + } + } + } else { + const oneKeys = []; + for (key in one) { + oneKeys.push(key); + } + oneKeys.sort(); + const otherKeys = []; + for (key in other) { + otherKeys.push(key); + } + otherKeys.sort(); + if (!equals(oneKeys, otherKeys)) { + return false; + } + for (i = 0; i < oneKeys.length; i++) { + if (!equals(one[oneKeys[i]], other[oneKeys[i]])) { + return false; + } + } + } + return true; +} +function rangeIntersect(r, range) { + if (positionInRange(r.start, range) == 0) { + return true; + } + if (positionInRange(r.end, range) == 0) { + return true; + } + if (rangeInRange(range, r)) { + return true; + } + return false; +} +function rangeInRange(r, range) { + return positionInRange(r.start, range) === 0 && positionInRange(r.end, range) === 0; +} +function positionInRange(position, range) { + let { start, end } = range; + if (comparePosition(position, start) < 0) + return -1; + if (comparePosition(position, end) > 0) + return 1; + return 0; +} +function comparePosition(position, other) { + if (position.line > other.line) + return 1; + if (other.line == position.line && position.character > other.character) + return 1; + if (other.line == position.line && position.character == other.character) + return 0; + return -1; +} + +// src/fileEventHandler.ts +var serverReady = false; +function setServerStatus(ready) { + serverReady = ready; +} +function registerFileEventHandlers(client, context) { + if (import_coc5.workspace.onDidCreateFiles) { + context.subscriptions.push(import_coc5.workspace.onDidCreateFiles(handleNewJavaFiles)); + } + if (import_coc5.workspace.onWillRenameFiles) { + context.subscriptions.push(import_coc5.workspace.onWillRenameFiles(getWillRenameHandler(client))); + } +} +async function handleNewJavaFiles(e) { + const emptyFiles = []; + const textDocuments = []; + for (const uri of e.files) { + if (!isJavaFile(uri)) { + continue; + } + const textDocument = (await import_coc5.workspace.openTextDocument(uri)).textDocument; + if (textDocument.getText()) { + continue; + } + emptyFiles.push(uri); + textDocuments.push(textDocument); + } + if (!emptyFiles.length) { + return; + } + let sourcePaths = []; + if (serverReady) { + const result = await import_coc5.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.LIST_SOURCEPATHS); + if (result && result.data && result.data.length) { + sourcePaths = result.data.map((sourcePath) => sourcePath.path).sort((a, b) => b.length - a.length); + } + } + const timeout = setTimeout(async () => { + const formatNumber = (num) => num > 9 ? String(num) : `0${num}`; + for (let i = 0; i < emptyFiles.length; i++) { + if (textDocuments[i].getText()) { + continue; + } + const fileName = import_coc5.Uri.parse(textDocuments[i].uri).fsPath; + const typeName = resolveTypeName(fileName); + const isPackageInfo = typeName === "package-info"; + const isModuleInfo = typeName === "module-info"; + const date = new Date(); + const context = { + fileName: path3.basename(fileName), + packageName: "", + typeName, + user: (0, import_os.userInfo)().username, + date: date.toLocaleDateString(void 0, { month: "short", day: "2-digit", year: "numeric" }), + time: date.toLocaleTimeString(), + year: date.getFullYear(), + month: formatNumber(date.getMonth() + 1), + shortmonth: date.toLocaleDateString(void 0, { month: "short" }), + day: formatNumber(date.getDate()), + hour: formatNumber(date.getHours()), + minute: formatNumber(date.getMinutes()) + }; + if (!isModuleInfo) { + context.packageName = resolvePackageName(sourcePaths, emptyFiles[i].fsPath); + } + const snippets = []; + const fileHeader = getJavaConfiguration().get("templates.fileHeader"); + if (fileHeader && fileHeader.length) { + for (const template of fileHeader) { + snippets.push((0, import_fmtr.default)(template, context)); + } + } + if (!isModuleInfo) { + if (context.packageName) { + snippets.push(`package ${context.packageName};`); + snippets.push(""); + } + } + if (!isPackageInfo) { + const typeComment = getJavaConfiguration().get("templates.typeComment"); + if (typeComment && typeComment.length) { + for (const template of typeComment) { + snippets.push((0, import_fmtr.default)(template, context)); + } + } + if (isModuleInfo) { + snippets.push(`module \${1:name} {`); + } else if (!serverReady || await isVersionLessThan(emptyFiles[i].toString(), 14)) { + snippets.push(`public \${1|class,interface,enum,abstract class,@interface|} ${typeName} {`); + } else { + snippets.push(`public \${1|class ${typeName},interface ${typeName},enum ${typeName},record ${typeName}(),abstract class ${typeName},@interface ${typeName}|} {`); + } + snippets.push(" ${0}"); + snippets.push("}"); + snippets.push(""); + } + await import_coc5.workspace.jumpTo(textDocuments[i].uri); + if (textDocuments[i].getText()) { + continue; + } + import_coc5.snippetManager.insertSnippet(new import_coc5.SnippetString(snippets.join("\n"))); + } + clearTimeout(timeout); + }, 100); +} +function getWillRenameHandler(client) { + return function handleWillRenameFiles(e) { + if (!serverReady) { + return; + } + e.waitUntil(new Promise(async (resolve9, reject) => { + try { + const javaRenameEvents = []; + for (const file of e.files) { + if (await isJavaFileWillRename(file.oldUri, file.newUri) || await isFolderWillRename(file.oldUri, file.newUri) || await isJavaWillMove(file.oldUri, file.newUri)) { + javaRenameEvents.push({ + oldUri: file.oldUri.toString(), + newUri: file.newUri.toString() + }); + } + } + if (!javaRenameEvents.length) { + resolve9(void 0); + return; + } + const edit2 = await client.sendRequest(WillRenameFiles.type, { + files: javaRenameEvents + }); + resolve9(edit2); + } catch (ex) { + reject(ex); + } + })); + }; +} +function isJavaFile(uri) { + return uri.fsPath && uri.fsPath.endsWith(".java"); +} +async function isFile(uri) { + return (0, import_fs_extra.lstatSync)(uri.fsPath).isFile(); +} +async function isDirectory(uri) { + return (0, import_fs_extra.lstatSync)(uri.fsPath).isDirectory(); +} +async function isJavaFileWillRename(oldUri, newUri) { + if (isInSameDirectory(oldUri, newUri)) { + return await isFile(oldUri) && isJavaFile(oldUri) && isJavaFile(newUri); + } + return false; +} +async function isFolderWillRename(oldUri, newUri) { + return await isDirectory(oldUri); +} +async function isJavaWillMove(oldUri, newUri) { + return await isFile(oldUri) && isJavaFile(oldUri) && isJavaFile(newUri) && !isInSameDirectory(oldUri, newUri); +} +function isInSameDirectory(oldUri, newUri) { + const oldDir = path3.dirname(oldUri.fsPath); + const newDir = path3.dirname(newUri.fsPath); + return !path3.relative(oldDir, newDir); +} +function resolveTypeName(filePath) { + const fileName = path3.basename(filePath); + const extName = path3.extname(fileName); + return fileName.substring(0, fileName.length - extName.length); +} +function resolvePackageName(sourcePaths, filePath) { + if (!sourcePaths || !sourcePaths.length) { + return ""; + } + for (const sourcePath of sourcePaths) { + if (isPrefix(sourcePath, filePath)) { + const relative5 = path3.relative(sourcePath, path3.dirname(filePath)); + return relative5.replace(/[\/\\]/g, "."); + } + } + return ""; +} +function isPrefix(parentPath, filePath) { + const relative5 = path3.relative(parentPath, filePath); + return !relative5 || !relative5.startsWith("..") && !path3.isAbsolute(relative5); +} +var COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance"; +async function isVersionLessThan(fileUri, targetVersion) { + let projectSettings = {}; + try { + projectSettings = await import_coc5.commands.executeCommand( + Commands.EXECUTE_WORKSPACE_COMMAND, + Commands.GET_PROJECT_SETTINGS, + fileUri, + [COMPLIANCE] + ); + } catch (err) { + } + let javaVersion = 0; + let complianceVersion = projectSettings[COMPLIANCE]; + if (complianceVersion) { + if (complianceVersion.startsWith("1.")) { + complianceVersion = complianceVersion.substring(2); + } + const regexp = /\d+/g; + const match = regexp.exec(complianceVersion); + if (match) { + javaVersion = parseInt(match[0]); + } + } + return javaVersion < targetVersion; +} + +// src/javaServerStarter.ts +var import_coc11 = require("coc.nvim"); +var fs4 = __toESM(require("fs")); +var glob = __toESM(require_glob()); +var net = __toESM(require("net")); +var os = __toESM(require("os")); +var path8 = __toESM(require("path")); + +// src/lombokSupport.ts +var import_coc10 = require("coc.nvim"); +var fse2 = __toESM(require_lib()); +var path7 = __toESM(require("path")); +var semver = __toESM(require_semver2()); + +// src/runtimeStatusBarProvider.ts +var import_coc9 = require("coc.nvim"); +var fse = __toESM(require_lib()); +var path6 = __toESM(require("path")); + +// src/languageStatusItemFactory.ts +var import_coc7 = require("coc.nvim"); +var path4 = __toESM(require("path")); + +// src/serverStatusBarProvider.ts +var import_coc6 = require("coc.nvim"); +var ServerStatusBarProvider = class { + constructor() { + const icons = getJavaConfiguration().get("jdt.ls.statusIcons", {}); + this.statusIcons = icons ?? {}; + this.isAdvancedStatusBarItem = false; + } + getIcon(key) { + let text = this.statusIcons[key]; + if (text) + return text; + return StatusIcon[key] ?? ""; + } + initialize(context) { + if (supportsLanguageStatus()) { + this.languageStatusItem = ServerStatusItemFactory.create(); + } else { + this.statusBarItem = import_coc6.window.createStatusBarItem(Number.MAX_VALUE); + import_coc6.window.onDidChangeActiveTextEditor((editor) => { + var _a, _b; + let doc = editor == null ? void 0 : editor.document; + if (doc && import_coc6.workspace.match(languageServerDocumentSelector, doc) > 0) { + (_a = this.statusBarItem) == null ? void 0 : _a.show(); + } else { + (_b = this.statusBarItem) == null ? void 0 : _b.hide(); + } + }, null, context.subscriptions); + } + } + shouldShow() { + var _a; + let doc = (_a = import_coc6.window.activeTextEditor) == null ? void 0 : _a.document; + return doc && import_coc6.workspace.match(languageServerDocumentSelector, doc) > 0; + } + showLightWeightStatus() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.showLightWeightStatus(this.languageStatusItem); + } else { + if (this.isAdvancedStatusBarItem) { + this.statusBarItem.name = "Java Server Mode"; + } + this.statusBarItem.text = StatusIcon.lightWeight; + this.statusBarItem.command = StatusCommands.switchToStandardCommand; + this.statusBarItem.tooltip = "Java language server is running in LightWeight mode, click to switch to Standard mode"; + if (this.shouldShow()) { + this.statusBarItem.show(); + } + } + } + showStandardStatus() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.showStandardStatus(this.languageStatusItem); + ServerStatusItemFactory.setBusy(this.languageStatusItem); + } else { + if (this.isAdvancedStatusBarItem) { + this.statusBarItem.name = "Java Server Status"; + } + this.statusBarItem.isProgress = true; + this.statusBarItem.text = ""; + this.statusBarItem.command = Commands.SHOW_SERVER_TASK_STATUS; + this.statusBarItem.tooltip = ""; + if (this.shouldShow()) { + this.statusBarItem.show(); + } + } + } + setBusy() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.setBusy(this.languageStatusItem); + } else { + this.statusBarItem.isProgress = true; + } + } + setError() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.setError(this.languageStatusItem); + } else { + this.statusBarItem.isProgress = false; + this.statusBarItem.text = this.getIcon("error"); + this.statusBarItem.command = Commands.OPEN_LOGS; + } + } + setWarning() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.setWarning(this.languageStatusItem); + } else { + this.statusBarItem.isProgress = false; + this.statusBarItem.text = this.getIcon("warning"); + this.statusBarItem.command = "workbench.panel.markers.view.focus"; + this.statusBarItem.tooltip = "Errors occurred in project configurations, click to show the PROBLEMS panel"; + } + } + setReady() { + if (supportsLanguageStatus()) { + ServerStatusItemFactory.setReady(this.languageStatusItem); + } else { + this.statusBarItem.text = this.getIcon("ready"); + this.statusBarItem.isProgress = false; + this.statusBarItem.command = Commands.SHOW_SERVER_TASK_STATUS; + this.statusBarItem.tooltip = "ServiceReady"; + } + } + updateTooltip(tooltip) { + if (!supportsLanguageStatus()) { + this.statusBarItem.tooltip = tooltip; + } + } + dispose() { + var _a, _b; + (_a = this.statusBarItem) == null ? void 0 : _a.dispose(); + (_b = this.languageStatusItem) == null ? void 0 : _b.dispose(); + } +}; +var StatusIcon = /* @__PURE__ */ ((StatusIcon2) => { + StatusIcon2["lightWeight"] = ""; + StatusIcon2["busy"] = "Busy"; + StatusIcon2["ready"] = "OK"; + StatusIcon2["warning"] = "Warning"; + StatusIcon2["error"] = "Error"; + return StatusIcon2; +})(StatusIcon || {}); +var serverStatusBarProvider = new ServerStatusBarProvider(); + +// src/languageStatusItemFactory.ts +var languageServerDocumentSelector = [ + { scheme: "file", language: "java" }, + { scheme: "jdt", language: "java" }, + { scheme: "untitled", language: "java" }, + { pattern: "**/pom.xml" }, + { pattern: "**/{build,settings}.gradle" }, + { pattern: "**/{build,settings}.gradle.kts" } +]; +function supportsLanguageStatus() { + return typeof import_coc7.languages["createLanguageStatusItem"] === "function"; +} +var StatusCommands; +((StatusCommands2) => { + StatusCommands2.switchToStandardCommand = { + title: "Load Projects", + command: Commands.SWITCH_SERVER_MODE, + arguments: ["Standard", true], + tooltip: "LightWeight mode only provides limited features, please load projects to get full feature set" + }; + StatusCommands2.showServerStatusCommand = { + title: "Show Build Status", + command: Commands.SHOW_SERVER_TASK_STATUS, + tooltip: "Show Build Status" + }; + StatusCommands2.configureJavaRuntimeCommand = { + title: "Configure Java Runtime", + command: "workbench.action.openSettings", + arguments: ["java.configuration.runtimes"], + tooltip: "Configure Java Runtime" + }; +})(StatusCommands || (StatusCommands = {})); +var ServerStatusItemFactory; +((ServerStatusItemFactory2) => { + function create() { + if (supportsLanguageStatus()) { + const item = import_coc7.languages["createLanguageStatusItem"]("JavaServerStatusItem", languageServerDocumentSelector); + item.name = "Java Language Server Status"; + return item; + } + return void 0; + } + ServerStatusItemFactory2.create = create; + function showLightWeightStatus(item) { + item.text = "" /* lightWeight */; + item.detail = "Lightweight Mode"; + item.command = StatusCommands.switchToStandardCommand; + } + ServerStatusItemFactory2.showLightWeightStatus = showLightWeightStatus; + function showStandardStatus(item) { + item.command = StatusCommands.showServerStatusCommand; + } + ServerStatusItemFactory2.showStandardStatus = showStandardStatus; + function setBusy(item) { + if (item.busy === true) { + return; + } + item.text = "Building"; + item.busy = true; + } + ServerStatusItemFactory2.setBusy = setBusy; + function setError(item) { + item.busy = false; + item.command = { + title: "Open logs", + command: Commands.OPEN_LOGS + }; + item.text = "Error" /* error */; + item.detail = "Errors occurred in initializing language server"; + } + ServerStatusItemFactory2.setError = setError; + function setWarning(item) { + item.busy = false; + item.command = { + title: "Show PROBLEMS Panel", + command: "workbench.panel.markers.view.focus", + tooltip: "Errors occurred in project configurations, click to show the PROBLEMS panel" + }; + item.text = "Warning" /* warning */; + item.detail = "Project Configuration Error"; + } + ServerStatusItemFactory2.setWarning = setWarning; + function setReady(item) { + if (item.text === "OK" /* ready */) { + return; + } + item.busy = false; + item.command = StatusCommands.showServerStatusCommand; + item.text = "OK" /* ready */; + item.detail = ""; + } + ServerStatusItemFactory2.setReady = setReady; +})(ServerStatusItemFactory || (ServerStatusItemFactory = {})); +var RuntimeStatusItemFactory; +((RuntimeStatusItemFactory2) => { + function create(text, vmInstallPath) { + if (supportsLanguageStatus()) { + const item = import_coc7.languages["createLanguageStatusItem"]("javaRuntimeStatusItem", languageServerDocumentSelector); + item.name = "Java Runtime"; + item.text = text; + item.command = StatusCommands.configureJavaRuntimeCommand; + if (vmInstallPath) { + item.command.tooltip = `Language Level: ${text} <${vmInstallPath}>`; + } + return item; + } + return void 0; + } + RuntimeStatusItemFactory2.create = create; + function update(item, text, vmInstallPath) { + item.text = text; + item.command.tooltip = vmInstallPath ? `Language Level: ${text} <${vmInstallPath}>` : "Configure Java Runtime"; + } + RuntimeStatusItemFactory2.update = update; +})(RuntimeStatusItemFactory || (RuntimeStatusItemFactory = {})); +var BuildFileStatusItemFactory; +((BuildFileStatusItemFactory2) => { + function create(buildFilePath) { + if (supportsLanguageStatus()) { + const fileName = path4.basename(buildFilePath); + const item = import_coc7.languages["createLanguageStatusItem"]("javaBuildFileStatusItem", languageServerDocumentSelector); + item.name = "Java Build File"; + item.text = fileName; + item.command = getOpenBuildFileCommand(buildFilePath); + return item; + } + return void 0; + } + BuildFileStatusItemFactory2.create = create; + function update(item, buildFilePath) { + const fileName = path4.basename(buildFilePath); + item.text = fileName; + item.command = getOpenBuildFileCommand(buildFilePath); + } + BuildFileStatusItemFactory2.update = update; + function getOpenBuildFileCommand(buildFilePath) { + const relativePath = import_coc7.workspace.asRelativePath(buildFilePath); + return { + title: `Open Config File ${relativePath}`, + command: Commands.OPEN_BROWSER, + arguments: [import_coc7.Uri.file(buildFilePath)] + }; + } +})(BuildFileStatusItemFactory || (BuildFileStatusItemFactory = {})); + +// src/settings.ts +var import_coc8 = require("coc.nvim"); +var fs3 = __toESM(require("fs")); +var path5 = __toESM(require("path")); +var DEFAULT_HIDDEN_FILES = ["**/.classpath", "**/.project", "**/.settings", "**/.factorypath"]; +var IS_WORKSPACE_JDK_ALLOWED = "java.ls.isJdkAllowed"; +var IS_WORKSPACE_JLS_JDK_ALLOWED = "java.jdt.ls.java.home.isAllowed"; +var IS_WORKSPACE_VMARGS_ALLOWED = "java.ls.isVmargsAllowed"; +var ACTIVE_BUILD_TOOL_STATE = "java.activeBuildTool"; +var cleanWorkspaceFileName = ".cleanWorkspace"; +var env = { appName: "coc.nvim" }; +var EXCLUDE_FILE_CONFIG = "configuration.checkProjectSettingsExclusions"; +var oldConfig = getJavaConfiguration(); +var gradleWrapperPromptDialogs = []; +function onConfigurationChange(workspacePath, context) { + return import_coc8.workspace.onDidChangeConfiguration((params) => { + if (!params.affectsConfiguration("java")) { + return; + } + const newConfig = getJavaConfiguration(); + if (newConfig.get(EXCLUDE_FILE_CONFIG)) { + excludeProjectSettingsFiles(); + } + const isFsModeChanged = hasConfigKeyChanged("import.generatesMetadataFilesAtProjectRoot", oldConfig, newConfig); + if (isFsModeChanged) { + ensureExists(workspacePath); + const file = path5.join(workspacePath, cleanWorkspaceFileName); + fs3.closeSync(fs3.openSync(file, "w")); + } + if (isFsModeChanged || hasJavaConfigChanged(oldConfig, newConfig)) { + const msg = `Java Language Server configuration changed, please reload coc.nvim.`; + const action = "Reload"; + const restartId = Commands.RELOAD_WINDOW; + import_coc8.window.showWarningMessage(msg, action).then((selection) => { + if (action === selection) { + import_coc8.commands.executeCommand(restartId); + } + }); + } + if (hasConfigKeyChanged("jdt.ls.lombokSupport.enabled", oldConfig, newConfig)) { + if (newConfig.get("jdt.ls.lombokSupport.enabled")) { + const msg = `Lombok support is enabled, please reload coc.nvim.`; + const action = "Reload"; + const restartId = Commands.RELOAD_WINDOW; + import_coc8.window.showWarningMessage(msg, action).then((selection) => { + if (action === selection) { + import_coc8.commands.executeCommand(restartId); + } + }); + } else { + cleanupLombokCache(context); + const msg = `Lombok support is disabled, please reload ${env.appName}.`; + const action = "Reload"; + const restartId = Commands.RELOAD_WINDOW; + import_coc8.window.showWarningMessage(msg, action).then((selection) => { + if (action === selection) { + import_coc8.commands.executeCommand(restartId); + } + }); + } + } + oldConfig = newConfig; + }); +} +function excludeProjectSettingsFiles() { + if (import_coc8.workspace.workspaceFolders && import_coc8.workspace.workspaceFolders.length) { + import_coc8.workspace.workspaceFolders.forEach((folder) => { + excludeProjectSettingsFilesForWorkspace(import_coc8.Uri.parse(folder.uri)); + }); + } +} +function excludeProjectSettingsFilesForWorkspace(workspaceUri) { + const javaConfig = getJavaConfiguration(); + const checkExclusionConfig = javaConfig.get(EXCLUDE_FILE_CONFIG); + if (checkExclusionConfig) { + const config = import_coc8.workspace.getConfiguration("files", workspaceUri); + const excludedValue = config.get("exclude"); + const needExcludeFiles = []; + let needUpdate = false; + for (const hiddenFile of DEFAULT_HIDDEN_FILES) { + if (!excludedValue.hasOwnProperty(hiddenFile)) { + needExcludeFiles.push(hiddenFile); + needUpdate = true; + } + } + if (needUpdate) { + const excludedInspectedValue = config.inspect("exclude"); + const checkExclusionInWorkspace = javaConfig.inspect(EXCLUDE_FILE_CONFIG).workspaceValue; + if (checkExclusionInWorkspace) { + const workspaceValue = excludedInspectedValue.workspaceValue || {}; + for (const hiddenFile of needExcludeFiles) { + workspaceValue[hiddenFile] = true; + } + config.update("exclude", workspaceValue, import_coc8.ConfigurationTarget.Workspace); + } else { + const globalValue = excludedInspectedValue.globalValue = excludedInspectedValue.globalValue || {}; + for (const hiddenFile of needExcludeFiles) { + globalValue[hiddenFile] = true; + } + config.update("exclude", globalValue, import_coc8.ConfigurationTarget.Global); + } + } + } +} +function hasJavaConfigChanged(oldConfig2, newConfig) { + return hasConfigKeyChanged("jdt.ls.java.home", oldConfig2, newConfig) || hasConfigKeyChanged("home", oldConfig2, newConfig) || hasConfigKeyChanged("jdt.ls.vmargs", oldConfig2, newConfig) || hasConfigKeyChanged("progressReports.enabled", oldConfig2, newConfig) || hasConfigKeyChanged("server.launchMode", oldConfig2, newConfig) || hasConfigKeyChanged("sharedIndexes.location", oldConfig2, newConfig); + ; +} +function hasConfigKeyChanged(key, oldConfig2, newConfig) { + return oldConfig2.get(key) !== newConfig.get(key); +} +function getJavaEncoding() { + const config = import_coc8.workspace.getConfiguration(); + const languageConfig = config.get("[java]"); + let javaEncoding = null; + if (languageConfig) { + javaEncoding = languageConfig["files.encoding"]; + } + if (!javaEncoding) { + javaEncoding = config.get("files.encoding", "UTF-8"); + } + return javaEncoding; +} +async function checkJavaPreferences(context) { + const allow = "Allow"; + const disallow = "Disallow"; + let preference = "java.jdt.ls.java.home"; + let javaHome = import_coc8.workspace.getConfiguration().inspect("java.jdt.ls.java.home").workspaceValue; + let isVerified = javaHome === void 0 || javaHome === null; + if (isVerified) { + javaHome = getJavaConfiguration().get("jdt.ls.java.home"); + } + const key = getKey(IS_WORKSPACE_JLS_JDK_ALLOWED, context.storagePath, javaHome); + const globalState = context.globalState; + if (!isVerified) { + isVerified = globalState.get(key); + if (isVerified === void 0) { + await import_coc8.window.showErrorMessage(`Security Warning! Do you allow this workspace to set the java.jdt.ls.java.home variable? + java.jdt.ls.java.home: ${javaHome}`, disallow, allow).then(async (selection) => { + if (selection === allow) { + globalState.update(key, true); + } else if (selection === disallow) { + globalState.update(key, false); + await import_coc8.workspace.getConfiguration().update("java.jdt.ls.java.home", void 0, import_coc8.ConfigurationTarget.Workspace); + } + }); + isVerified = globalState.get(key); + } + if (!isVerified) { + javaHome = import_coc8.workspace.getConfiguration().inspect("java.jdt.ls.java.home").globalValue; + } + } + if (!javaHome) { + preference = "java.home"; + javaHome = import_coc8.workspace.getConfiguration().inspect("java.home").workspaceValue; + isVerified = javaHome === void 0 || javaHome === null; + if (isVerified) { + javaHome = getJavaConfiguration().get("home"); + } + const key2 = getKey(IS_WORKSPACE_JDK_ALLOWED, context.storagePath, javaHome); + const globalState2 = context.globalState; + if (!isVerified) { + isVerified = globalState2.get(key2); + if (isVerified === void 0) { + await import_coc8.window.showErrorMessage(`Security Warning! Do you allow this workspace to set the java.home variable? + java.home: ${javaHome}`, disallow, allow).then(async (selection) => { + if (selection === allow) { + globalState2.update(key2, true); + } else if (selection === disallow) { + globalState2.update(key2, false); + await import_coc8.workspace.getConfiguration().update("java.home", void 0, import_coc8.ConfigurationTarget.Workspace); + } + }); + isVerified = globalState2.get(key2); + } + if (!isVerified) { + javaHome = import_coc8.workspace.getConfiguration().inspect("java.home").globalValue; + } + } + } + const vmargs = import_coc8.workspace.getConfiguration().inspect("java.jdt.ls.vmargs").workspaceValue; + if (vmargs !== void 0) { + const isWorkspaceTrusted = import_coc8.workspace.isTrusted; + const agentFlag = getJavaagentFlag(vmargs); + if (agentFlag !== null && (isWorkspaceTrusted === void 0 || !isWorkspaceTrusted)) { + const keyVmargs = getKey(IS_WORKSPACE_VMARGS_ALLOWED, context.storagePath, vmargs); + const vmargsVerified = globalState.get(keyVmargs); + if ((vmargsVerified === void 0 || vmargsVerified === null) && (import_coc8.workspace.workspaceFolders && isInWorkspaceFolder(agentFlag, import_coc8.workspace.workspaceFolders))) { + await import_coc8.window.showErrorMessage(`Security Warning! The java.jdt.ls.vmargs variable defined in ${env.appName} settings includes the (${agentFlag}) javagent preference. Do you allow it to be used?`, disallow, allow).then(async (selection) => { + if (selection === allow) { + globalState.update(keyVmargs, true); + } else if (selection === disallow) { + globalState.update(keyVmargs, false); + await import_coc8.workspace.getConfiguration().update("java.jdt.ls.vmargs", void 0, import_coc8.ConfigurationTarget.Workspace); + } + }); + } + } + } + return { + javaHome, + preference + }; +} +function getKey(prefix, storagePath2, value) { + const workspacePath = path5.resolve(`${storagePath2}/jdt_ws`); + return `${prefix}::${value}`; +} +function getJavaagentFlag(vmargs) { + const javaagent = "-javaagent:"; + const args = vmargs.split(" "); + let agentFlag = null; + for (const arg of args) { + if (arg.startsWith(javaagent)) { + agentFlag = arg.substring(javaagent.length); + break; + } + } + return agentFlag; +} +function isInWorkspaceFolder(loc, workspaceFolders) { + return !path5.isAbsolute(loc) || workspaceFolders.some((dir) => loc.startsWith(import_coc8.Uri.parse(dir.uri).fsPath)); +} +function getJavaServerMode() { + return import_coc8.workspace.getConfiguration().get("java.server.launchMode") || "Hybrid" /* hybrid */; +} +function setGradleWrapperChecksum(wrapper, sha256) { + const opened = gradleWrapperPromptDialogs.filter((v) => v === sha256); + if (opened !== null && opened.length > 0) { + return; + } + gradleWrapperPromptDialogs.push(sha256); + const allow = "Trust"; + const disallow = "Do not trust"; + import_coc8.window.showErrorMessage(`"Security Warning! The gradle wrapper '${wrapper}'" [sha256 '${sha256}'] [could be malicious](https://github.com/redhat-developer/vscode-java/wiki/Gradle-Support#suspicious.wrapper). Should it be trusted?";`, disallow, allow).then(async (selection) => { + let allowed; + if (selection === allow) { + allowed = true; + } else if (selection === disallow) { + allowed = false; + } else { + unregisterGradleWrapperPromptDialog(sha256); + return false; + } + const key = "java.imports.gradle.wrapper.checksums"; + let property = import_coc8.workspace.getConfiguration().inspect(key).globalValue; + if (!Array.isArray(property)) { + property = []; + } + const entry = property.filter((p) => p.sha256 === sha256); + if (entry === null || entry.length === 0) { + property.push({ sha256, allowed }); + import_coc8.workspace.getConfiguration().update(key, property, import_coc8.ConfigurationTarget.Global); + } + unregisterGradleWrapperPromptDialog(sha256); + }); +} +function unregisterGradleWrapperPromptDialog(sha256) { + const index = gradleWrapperPromptDialogs.indexOf(sha256); + if (index > -1) { + gradleWrapperPromptDialogs.splice(index, 1); + } +} + +// src/runtimeStatusBarProvider.ts +var RuntimeStatusBarProvider = class { + constructor() { + this.javaProjects = /* @__PURE__ */ new Map(); + this.fileProjectMapping = /* @__PURE__ */ new Map(); + this.disposables = []; + this.isAdvancedStatusBarItem = false; + } + async initialize(context) { + const storagePath2 = context.storagePath; + if (storagePath2) { + this.storagePath = import_coc9.Uri.file(path6.join(storagePath2, "..", "..")).fsPath; + } + if (!supportsLanguageStatus()) { + if (this.isAdvancedStatusBarItem) { + } else { + this.statusBarItem = import_coc9.window.createStatusBarItem(0); + } + } + let projectUriStrings; + try { + projectUriStrings = await getAllJavaProjects(false); + } catch (e) { + return; + } + for (const uri of projectUriStrings) { + this.javaProjects.set(import_coc9.Uri.parse(uri).fsPath, void 0); + } + if (!supportsLanguageStatus()) { + this.statusBarItem.command = StatusCommands.configureJavaRuntimeCommand; + } + this.disposables.push(import_coc9.window.onDidChangeActiveTextEditor((textEditor) => { + this.updateItem(context, textEditor); + })); + this.disposables.push(apiManager.getApiInstance().onDidProjectsImport(async (uris) => { + for (const uri of uris) { + this.javaProjects.set(uri.fsPath, this.javaProjects.get(uri.fsPath)); + } + await this.updateItem(context, import_coc9.window.activeTextEditor); + })); + this.disposables.push(apiManager.getApiInstance().onDidClasspathUpdate(async (e) => { + for (const projectPath of this.javaProjects.keys()) { + if (path6.relative(projectPath, e.fsPath) === "") { + this.javaProjects.set(projectPath, void 0); + await this.updateItem(context, import_coc9.window.activeTextEditor); + return; + } + } + })); + await this.updateItem(context, import_coc9.window.activeTextEditor); + } + initializeLombokStatusBar() { + this.lombokVersionItem = LombokVersionItemFactory.create(getLombokVersion()); + } + destroyLombokStatusBar() { + this.hideLombokVersionItem(); + } + hideRuntimeStatusItem() { + var _a; + (_a = this.runtimeStatusItem) == null ? void 0 : _a.dispose(); + this.runtimeStatusItem = void 0; + } + hideBuildFileStatusItem() { + var _a; + (_a = this.buildFileStatusItem) == null ? void 0 : _a.dispose(); + this.buildFileStatusItem = void 0; + } + hideLombokVersionItem() { + var _a; + (_a = this.lombokVersionItem) == null ? void 0 : _a.dispose(); + this.lombokVersionItem = void 0; + } + dispose() { + var _a, _b, _c, _d; + (_a = this.statusBarItem) == null ? void 0 : _a.dispose(); + (_b = this.runtimeStatusItem) == null ? void 0 : _b.dispose(); + (_c = this.buildFileStatusItem) == null ? void 0 : _c.dispose(); + (_d = this.lombokVersionItem) == null ? void 0 : _d.dispose(); + for (const disposable of this.disposables) { + disposable.dispose(); + } + } + findOwnerProject(uri) { + let ownerProjectPath = this.fileProjectMapping.get(uri.fsPath); + if (ownerProjectPath) { + return ownerProjectPath; + } + const isInWorkspaceFolder2 = !!import_coc9.workspace.getWorkspaceFolder(uri.toString()); + for (const projectPath of this.javaProjects.keys()) { + if (!isInWorkspaceFolder2 && this.isDefaultProjectPath(projectPath)) { + ownerProjectPath = projectPath; + break; + } + if (uri.fsPath.startsWith(projectPath)) { + if (!ownerProjectPath) { + ownerProjectPath = projectPath; + continue; + } + if (projectPath.length > ownerProjectPath.length) { + ownerProjectPath = projectPath; + } + } + } + if (ownerProjectPath) { + this.fileProjectMapping.set(uri.fsPath, ownerProjectPath); + } + return ownerProjectPath; + } + async getProjectInfo(projectPath) { + let projectInfo = this.javaProjects.get(projectPath); + if (projectInfo) { + return projectInfo; + } + try { + const settings = await import_coc9.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_PROJECT_SETTINGS, import_coc9.Uri.file(projectPath).toString(), [SOURCE_LEVEL_KEY, VM_INSTALL_PATH]); + projectInfo = { + sourceLevel: settings[SOURCE_LEVEL_KEY], + vmInstallPath: settings[VM_INSTALL_PATH] + }; + this.javaProjects.set(projectPath, projectInfo); + return projectInfo; + } catch (e) { + } + return void 0; + } + async updateItem(context, textEditor) { + var _a, _b, _c; + let doc = textEditor == null ? void 0 : textEditor.document; + let fileName = doc ? import_coc9.Uri.parse(doc.uri).fsPath : void 0; + if (!textEditor || !fileName || path6.extname(fileName) !== ".java" && !supportsLanguageStatus()) { + (_a = this.statusBarItem) == null ? void 0 : _a.hide(); + return; + } + const uri = import_coc9.Uri.parse(textEditor.document.uri); + const projectPath = this.findOwnerProject(uri); + if (!projectPath) { + if (supportsLanguageStatus()) { + this.hideRuntimeStatusItem(); + this.hideBuildFileStatusItem(); + this.hideLombokVersionItem(); + } else { + (_b = this.statusBarItem) == null ? void 0 : _b.hide(); + } + return; + } + const projectInfo = await this.getProjectInfo(projectPath); + if (!projectInfo) { + if (supportsLanguageStatus()) { + this.hideRuntimeStatusItem(); + this.hideBuildFileStatusItem(); + this.hideLombokVersionItem(); + } else { + (_c = this.statusBarItem) == null ? void 0 : _c.hide(); + } + return; + } + const text = this.getJavaRuntimeFromVersion(projectInfo.sourceLevel); + if (supportsLanguageStatus()) { + const buildFilePath = await this.getBuildFilePath(context, projectPath); + if (!this.runtimeStatusItem) { + this.runtimeStatusItem = RuntimeStatusItemFactory.create(text, projectInfo.vmInstallPath); + if (buildFilePath) { + this.buildFileStatusItem = BuildFileStatusItemFactory.create(buildFilePath); + } + } else { + RuntimeStatusItemFactory.update(this.runtimeStatusItem, text, projectInfo.vmInstallPath); + if (buildFilePath) { + BuildFileStatusItemFactory.update(this.buildFileStatusItem, buildFilePath); + } + } + if (!this.lombokVersionItem) { + if (isLombokImported()) { + this.lombokVersionItem = LombokVersionItemFactory.create(getLombokVersion()); + } + } else { + if (isLombokImported()) { + LombokVersionItemFactory.update(this.lombokVersionItem, getLombokVersion()); + } + } + } else { + this.statusBarItem.text = text; + this.statusBarItem.show(); + } + } + isDefaultProjectPath(fsPath) { + return !this.storagePath || fsPath.startsWith(this.storagePath) && fsPath.indexOf("jdt.ls-java-project") > -1; + } + getJavaRuntimeFromVersion(ver) { + if (!ver) { + return ""; + } + if (ver === "1.5") { + return "J2SE-1.5"; + } + return `JavaSE-${ver}`; + } + async getBuildFilePath(context, projectPath) { + const isMavenEnabled = getJavaConfiguration().get("import.maven.enabled"); + const isGradleEnabled = getJavaConfiguration().get("import.gradle.enabled"); + if (isMavenEnabled && isGradleEnabled) { + let buildFilePath; + const activeBuildTool = context.workspaceState.get(ACTIVE_BUILD_TOOL_STATE); + if (!activeBuildTool) { + if (!await hasBuildToolConflicts()) { + buildFilePath = await this.getBuildFilePathFromNames(projectPath, ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"]); + } else { + return void 0; + } + } else if (activeBuildTool.toLocaleLowerCase().includes("maven")) { + buildFilePath = await this.getBuildFilePathFromNames(projectPath, ["pom.xml"]); + } else if (activeBuildTool.toLocaleLowerCase().includes("gradle")) { + buildFilePath = await this.getBuildFilePathFromNames(projectPath, ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"]); + } + return buildFilePath; + } else if (isMavenEnabled) { + return this.getBuildFilePathFromNames(projectPath, ["pom.xml"]); + } else if (isGradleEnabled) { + return this.getBuildFilePathFromNames(projectPath, ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"]); + } else { + return void 0; + } + } + async getBuildFilePathFromNames(projectPath, buildFileNames) { + for (const buildFileName of buildFileNames) { + const buildFilePath = path6.join(projectPath, buildFileName); + if (await fse.pathExists(buildFilePath)) { + return buildFilePath; + } + } + return void 0; + } +}; +var SOURCE_LEVEL_KEY = "org.eclipse.jdt.core.compiler.source"; +var VM_INSTALL_PATH = "org.eclipse.jdt.ls.core.vm.location"; +var runtimeStatusBarProvider = new RuntimeStatusBarProvider(); + +// src/lombokSupport.ts +var JAVA_LOMBOK_PATH = "java.lombokPath"; +var lombokJarRegex = /lombok-\d+.*\.jar$/; +var compatibleVersion = "1.18.4"; +var activeLombokPath = void 0; +var isLombokStatusBarInitialized = false; +var isLombokCommandInitialized = false; +var isExtensionLombok = false; +var projectLombokPath = void 0; +function isLombokSupportEnabled() { + return import_coc10.workspace.getConfiguration().get("java.jdt.ls.lombokSupport.enabled"); +} +function isLombokImported() { + return projectLombokPath !== void 0; +} +function updateActiveLombokPath(path18) { + activeLombokPath = path18; +} +function cleanupLombokCache(context) { + context.workspaceState.update(JAVA_LOMBOK_PATH, void 0); +} +function getExtensionLombokPath(context) { + if (!fse2.pathExistsSync(context.asAbsolutePath("lombok"))) { + return void 0; + } + const files = fse2.readdirSync(context.asAbsolutePath("lombok")); + if (!files.length) { + return void 0; + } + return path7.join(context.asAbsolutePath("lombok"), files[0]); +} +function lombokPath2Version(lombokPath) { + if (!lombokPath) + return ""; + const lombokVersion = lombokJarRegex.exec(lombokPath)[0].split(".jar")[0]; + return lombokVersion; +} +function lombokPath2VersionNumber(lombokPath) { + const lombokVersioNumber = lombokPath2Version(lombokPath).split("-")[1]; + return lombokVersioNumber; +} +function getLombokVersion() { + return lombokPath2Version(activeLombokPath); +} +function isCompatibleLombokVersion(currentVersion) { + return semver.gte(currentVersion, compatibleVersion); +} +function addLombokParam(context, params) { + const reg = /-javaagent:.*[\\|/]lombok.*\.jar/; + const deleteIndex = []; + for (let i = 0; i < params.length; i++) { + if (reg.test(params[i])) { + deleteIndex.push(i); + } + } + const lastMatchedParam = params[deleteIndex[deleteIndex.length - 1]]; + for (let i = deleteIndex.length - 1; i >= 0; i--) { + params.splice(deleteIndex[i], 1); + } + isExtensionLombok = true; + let lombokJarPath = context.workspaceState.get(JAVA_LOMBOK_PATH); + if (!lombokJarPath && !!lastMatchedParam) { + lombokJarPath = lastMatchedParam.replace("-javaagent:", ""); + } + if (lombokJarPath && fse2.existsSync(lombokJarPath)) { + if (isCompatibleLombokVersion(lombokPath2VersionNumber(lombokJarPath))) { + isExtensionLombok = false; + } else { + cleanupLombokCache(context); + createLogger().warn(`The project's Lombok version ${lombokPath2VersionNumber(lombokJarPath)} is not supported, Falling back to the built-in Lombok version ${lombokPath2VersionNumber(getExtensionLombokPath(context))}`); + } + } + if (isExtensionLombok) { + lombokJarPath = getExtensionLombokPath(context); + } + if (!lombokJarPath) { + createLogger().warn("Could not find lombok.jar path."); + return; + } + const lombokAgentParam = `-javaagent:${lombokJarPath}`; + params.push(lombokAgentParam); + updateActiveLombokPath(lombokJarPath); +} +async function checkLombokDependency(context) { + if (!isLombokSupportEnabled()) { + return; + } + let versionChange = false; + let lombokFound = false; + let currentLombokVersion = void 0; + let previousLombokVersion = void 0; + let currentLombokClasspath = void 0; + const projectUris = await getAllJavaProjects(); + for (const projectUri of projectUris) { + const classpathResult = await apiManager.getApiInstance().getClasspaths(projectUri, { scope: "test" }); + for (const classpath of classpathResult.classpaths) { + if (lombokJarRegex.test(classpath)) { + currentLombokClasspath = classpath; + if (activeLombokPath && !isExtensionLombok) { + currentLombokVersion = lombokJarRegex.exec(classpath)[0]; + previousLombokVersion = lombokJarRegex.exec(activeLombokPath)[0]; + if (currentLombokVersion !== previousLombokVersion) { + versionChange = true; + } + } + lombokFound = true; + break; + } + } + if (lombokFound) { + break; + } + } + projectLombokPath = currentLombokClasspath; + if (!isLombokStatusBarInitialized && projectLombokPath) { + if (!isLombokCommandInitialized) { + registerLombokConfigureCommand(context); + isLombokCommandInitialized = true; + } + runtimeStatusBarProvider.initializeLombokStatusBar(); + isLombokStatusBarInitialized = true; + } + if (isLombokStatusBarInitialized && !projectLombokPath) { + runtimeStatusBarProvider.destroyLombokStatusBar(); + isLombokStatusBarInitialized = false; + cleanupLombokCache(context); + } + if (versionChange && !isExtensionLombok) { + context.workspaceState.update(JAVA_LOMBOK_PATH, currentLombokClasspath); + const msg = `Lombok version changed from ${previousLombokVersion.split(".jar")[0].split("-")[1]} to ${currentLombokVersion.split(".jar")[0].split("-")[1]} . Do you want to reload the window to load the new Lombok version?`; + const action = "Reload"; + const restartId = Commands.RELOAD_WINDOW; + import_coc10.window.showInformationMessage(msg, action).then((selection) => { + if (action === selection) { + import_coc10.commands.executeCommand(restartId); + } + }); + } +} +function registerLombokConfigureCommand(context) { + context.subscriptions.push(import_coc10.commands.registerCommand(Commands.LOMBOK_CONFIGURE, async (buildFilePath) => { + const extensionLombokPath = getExtensionLombokPath(context); + if (!extensionLombokPath || !projectLombokPath) { + return; + } + const extensionItemLabel = "Use Extension's Version"; + const extensionItemLabelCheck = `\u2022 ${extensionItemLabel}`; + const projectItemLabel = "Use Project's Version"; + const projectItemLabelCheck = `\u2022 ${projectItemLabel}`; + const lombokPathItems = [ + { + label: isExtensionLombok ? extensionItemLabelCheck : extensionItemLabel, + description: lombokPath2Version(extensionLombokPath) + }, + { + label: isExtensionLombok ? projectItemLabel : projectItemLabelCheck, + description: lombokPath2Version(projectLombokPath), + detail: projectLombokPath + } + ]; + const selectLombokPathItem = await import_coc10.window.showQuickPick(lombokPathItems, { + placeholder: "Select the Lombok version used in the Java extension" + }); + let shouldReload = false; + if (!selectLombokPathItem) { + return; + } + if (selectLombokPathItem.label === extensionItemLabel || selectLombokPathItem.label === extensionItemLabelCheck) { + if (!isExtensionLombok) { + shouldReload = true; + cleanupLombokCache(context); + } + } else { + if (isExtensionLombok) { + const projectLombokVersion = lombokPath2VersionNumber(projectLombokPath); + if (!isCompatibleLombokVersion(projectLombokVersion)) { + const msg = `The project's Lombok version ${projectLombokVersion} is not supported. Falling back to the built-in Lombok version in the extension.`; + import_coc10.window.showWarningMessage(msg); + return; + } else { + shouldReload = true; + context.workspaceState.update(JAVA_LOMBOK_PATH, projectLombokPath); + } + } + } + if (shouldReload) { + const msg = `The Lombok version used in Java extension has changed, please reload the window.`; + const action = "Reload"; + const restartId = Commands.RELOAD_WINDOW; + import_coc10.window.showInformationMessage(msg, action).then((selection) => { + if (action === selection) { + import_coc10.commands.executeCommand(restartId); + } + }); + } else { + const msg = `Current Lombok version is ${isExtensionLombok ? "extension's" : "project's"} version. Nothing to do.`; + import_coc10.window.showInformationMessage(msg); + } + }, null, true)); +} +var LombokVersionItemFactory; +((LombokVersionItemFactory2) => { + function create(text) { + return void 0; + } + LombokVersionItemFactory2.create = create; + function update(item, text) { + item.text = text; + } + LombokVersionItemFactory2.update = update; + function getLombokChangeCommand() { + return { + title: `Configure Lombok Version`, + command: Commands.LOMBOK_CONFIGURE + }; + } +})(LombokVersionItemFactory || (LombokVersionItemFactory = {})); + +// src/javaServerStarter.ts +var DEBUG = typeof v8debug === "object" || startedInDebugMode(); +var HEAP_DUMP_LOCATION = "-XX:HeapDumpPath="; +var HEAP_DUMP = "-XX:+HeapDumpOnOutOfMemoryError"; +function prepareExecutable(requirements, workspacePath, javaConfig, context, isSyntaxServer) { + const executable = /* @__PURE__ */ Object.create(null); + const options2 = /* @__PURE__ */ Object.create(null); + options2.env = Object.assign({ syntaxserver: isSyntaxServer }, process.env); + if (os.platform() === "win32") { + const vmargs = getJavaConfiguration().get("jdt.ls.vmargs", ""); + const watchParentProcess = "-DwatchParentProcess=false"; + if (vmargs.indexOf(watchParentProcess) < 0) { + options2.detached = true; + } + } + executable.options = options2; + executable.command = path8.resolve(`${requirements.tooling_jre}/bin/java`); + executable.args = prepareParams(requirements, javaConfig, workspacePath, context, isSyntaxServer); + createLogger().info(`Starting Java server with: ${executable.command} ${executable.args.join(" ")}`); + return executable; +} +function awaitServerConnection(port) { + const addr = parseInt(port); + return new Promise((res, rej) => { + const server = net.createServer((stream) => { + server.close(); + createLogger().info(`JDT LS connection established on port ${addr}`); + res({ reader: stream, writer: stream }); + }); + server.on("error", rej); + server.listen(addr, () => { + server.removeListener("error", rej); + createLogger().info(`Awaiting JDT LS connection on port ${addr}`); + }); + return server; + }); +} +function prepareParams(requirements, javaConfiguration, workspacePath, context, isSyntaxServer) { + const params = []; + if (DEBUG) { + const port = isSyntaxServer ? 1045 : 1044; + params.push(`-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${port},quiet=y`); + } + params.push( + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "--add-opens", + "java.base/sun.nio.fs=ALL-UNNAMED" + ); + params.push( + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product" + ); + if (DEBUG) { + params.push("-Dlog.level=ALL"); + } + const metadataLocation = import_coc11.workspace.getConfiguration().get("java.import.generatesMetadataFilesAtProjectRoot"); + if (metadataLocation !== void 0) { + params.push(`-Djava.import.generatesMetadataFilesAtProjectRoot=${metadataLocation}`); + } + let vmargsCheck = import_coc11.workspace.getConfiguration().inspect("java.jdt.ls.vmargs").workspaceValue; + if (vmargsCheck !== void 0) { + const isWorkspaceTrusted = true; + const agentFlag = getJavaagentFlag(vmargsCheck); + if (agentFlag !== null && (isWorkspaceTrusted === void 0 || !isWorkspaceTrusted)) { + const keyVmargs = getKey(IS_WORKSPACE_VMARGS_ALLOWED, context.storagePath, vmargsCheck); + const key = context.globalState.get(keyVmargs); + if (key !== true && (import_coc11.workspace.workspaceFolders && isInWorkspaceFolder(agentFlag, import_coc11.workspace.workspaceFolders))) { + vmargsCheck = import_coc11.workspace.getConfiguration().inspect("java.jdt.ls.vmargs").globalValue; + } + } + } else { + vmargsCheck = getJavaConfiguration().get("jdt.ls.vmargs"); + } + let vmargs; + if (vmargsCheck !== void 0) { + vmargs = String(vmargsCheck); + } else { + vmargs = ""; + } + const encodingKey = "-Dfile.encoding="; + if (vmargs.indexOf(encodingKey) < 0) { + params.push(encodingKey + getJavaEncoding()); + } + if (vmargs.indexOf("-Xlog:") < 0) { + params.push("-Xlog:disable"); + } + parseVMargs(params, vmargs); + if (isLombokSupportEnabled()) { + addLombokParam(context, params); + } + if (!isSyntaxServer) { + if (vmargs.indexOf(HEAP_DUMP) < 0) { + params.push(HEAP_DUMP); + } + if (vmargs.indexOf(HEAP_DUMP_LOCATION) < 0) { + params.push(`${HEAP_DUMP_LOCATION}${path8.dirname(workspacePath)}`); + } + const sharedIndexLocation = resolveIndexCache(context); + if (sharedIndexLocation) { + params.push(`-Djdt.core.sharedIndexLocation=${sharedIndexLocation}`); + } + } + if (params.indexOf("-noverify") < 0 && params.indexOf("-Xverify:none") < 0 && requirements.tooling_jre_version < 13) { + params.push("-noverify"); + } + let directory = getJavaConfiguration().get("jdt.ls.directory"); + if (directory) { + directory = import_coc11.workspace.expand(directory); + if (!fs4.existsSync(directory)) { + directory = void 0; + } + } + const serverHome = directory ? directory : path8.resolve(__dirname, "../server"); + const launchersFound = glob.sync("**/plugins/org.eclipse.equinox.launcher_*.jar", { cwd: serverHome }); + if (launchersFound.length) { + params.push("-jar"); + params.push(path8.resolve(serverHome, launchersFound[0])); + } else { + return null; + } + let configDir = isSyntaxServer ? "config_ss_win" : "config_win"; + if (process.platform === "darwin") { + configDir = isSyntaxServer ? "config_ss_mac" : "config_mac"; + } else if (process.platform === "linux") { + configDir = isSyntaxServer ? "config_ss_linux" : "config_linux"; + } + params.push("-configuration"); + if (startedFromSources()) { + console.log(`Starting jdt.ls ${isSyntaxServer ? "(syntax)" : "(standard)"} from vscode-java sources`); + params.push(path8.resolve(__dirname, "../server", configDir)); + } else if (directory) { + console.log(`Starting jdt.ls ${isSyntaxServer ? "(syntax)" : "(standard)"} from custom directory ${directory}`); + params.push(path8.resolve(directory, configDir)); + } else { + params.push(resolveConfiguration(context, configDir)); + } + params.push("-data"); + params.push(workspacePath); + return params; +} +function resolveIndexCache(context) { + let enabled = getJavaConfiguration().get("sharedIndexes.enabled"); + if (enabled === "auto") { + enabled = "off"; + } + if (enabled !== "on") { + return; + } + const location = getSharedIndexCache(context); + if (location) { + ensureExists(location); + if (!fs4.existsSync(location)) { + createLogger().error(`Failed to create the shared index directory '${location}', fall back to local index.`); + return; + } + } + return location; +} +function getSharedIndexCache(context) { + let location = getJavaConfiguration().get("sharedIndexes.location"); + if (!location) { + switch (process.platform) { + case "win32": + location = process.env.APPDATA ? path8.join(process.env.APPDATA, ".jdt", "index") : path8.join(os.homedir(), ".jdt", "index"); + break; + case "darwin": + location = path8.join(os.homedir(), "Library", "Caches", ".jdt", "index"); + break; + case "linux": + location = process.env.XDG_CACHE_HOME ? path8.join(process.env.XDG_CACHE_HOME, ".jdt", "index") : path8.join(os.homedir(), ".cache", ".jdt", "index"); + break; + default: + const globalStoragePath = context.storagePath; + location = globalStoragePath ? path8.join(globalStoragePath, "index") : void 0; + } + } else { + location = location.startsWith(`~${path8.sep}`) ? path8.join(os.homedir(), location.slice(2)) : location; + } + return location; +} +function resolveConfiguration(context, configDir) { + ensureExists(context.storagePath); + const extensionPath = path8.resolve(context.extensionPath, "package.json"); + const packageFile = JSON.parse(fs4.readFileSync(extensionPath, "utf8")); + let version; + if (packageFile) { + version = packageFile.version; + } else { + version = "0.0.0"; + } + let configuration = path8.resolve(context.storagePath, version); + ensureExists(configuration); + configuration = path8.resolve(configuration, configDir); + ensureExists(configuration); + const configIniName = "config.ini"; + const configIni = path8.resolve(configuration, configIniName); + const ini = path8.resolve(__dirname, "../server", configDir, configIniName); + if (!fs4.existsSync(configIni)) { + fs4.copyFileSync(ini, configIni); + } else { + const configIniTime = getTimestamp2(configIni); + const iniTime = getTimestamp2(ini); + if (iniTime > configIniTime) { + deleteDirectory(configuration); + resolveConfiguration(context, configDir); + } + } + return configuration; +} +function startedInDebugMode() { + const args = process.execArgv; + return hasDebugFlag(args); +} +function startedFromSources() { + return process.env["DEBUG_VSCODE_JAVA"] === "true"; +} +function hasDebugFlag(args) { + if (args) { + return args.some((arg) => /^--inspect/.test(arg) || /^--debug/.test(arg)); + } + return false; +} +function parseVMargs(params, vmargsLine) { + if (!vmargsLine) { + return; + } + const vmargs = vmargsLine.match(/(?:[^\s"]+|"[^"]*")+/g); + if (vmargs === null) { + return; + } + vmargs.forEach((arg) => { + arg = arg.replace(/(\\)?"/g, ($0, $1) => { + return $1 ? $0 : ""; + }); + arg = arg.replace(/(\\)"/g, '"'); + if (params.indexOf(arg) < 0) { + params.push(arg); + } + }); +} + +// src/markdownPreviewProvider.ts +var import_coc12 = require("coc.nvim"); +var fse3 = __toESM(require_lib()); + +// node_modules/marked/lib/marked.esm.js +function getDefaults() { + return { + async: false, + baseUrl: null, + breaks: false, + extensions: null, + gfm: true, + headerIds: true, + headerPrefix: "", + highlight: null, + langPrefix: "language-", + mangle: true, + pedantic: false, + renderer: null, + sanitize: false, + sanitizer: null, + silent: false, + smartypants: false, + tokenizer: null, + walkTokens: null, + xhtml: false + }; +} +var defaults = getDefaults(); +function changeDefaults(newDefaults) { + defaults = newDefaults; +} +var escapeTest = /[&<>"']/; +var escapeReplace = new RegExp(escapeTest.source, "g"); +var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/; +var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"); +var escapeReplacements = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}; +var getEscapeReplacement = (ch) => escapeReplacements[ch]; +function escape(html, encode) { + if (encode) { + if (escapeTest.test(html)) { + return html.replace(escapeReplace, getEscapeReplacement); + } + } else { + if (escapeTestNoEncode.test(html)) { + return html.replace(escapeReplaceNoEncode, getEscapeReplacement); + } + } + return html; +} +var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; +function unescape(html) { + return html.replace(unescapeTest, (_, n) => { + n = n.toLowerCase(); + if (n === "colon") + return ":"; + if (n.charAt(0) === "#") { + return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)); + } + return ""; + }); +} +var caret = /(^|[^\[])\^/g; +function edit(regex, opt) { + regex = typeof regex === "string" ? regex : regex.source; + opt = opt || ""; + const obj = { + replace: (name, val) => { + val = val.source || val; + val = val.replace(caret, "$1"); + regex = regex.replace(name, val); + return obj; + }, + getRegex: () => { + return new RegExp(regex, opt); + } + }; + return obj; +} +var nonWordAndColonTest = /[^\w:]/g; +var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; +function cleanUrl(sanitize, base, href) { + if (sanitize) { + let prot; + try { + prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, "").toLowerCase(); + } catch (e) { + return null; + } + if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) { + return null; + } + } + if (base && !originIndependentUrl.test(href)) { + href = resolveUrl(base, href); + } + try { + href = encodeURI(href).replace(/%25/g, "%"); + } catch (e) { + return null; + } + return href; +} +var baseUrls = {}; +var justDomain = /^[^:]+:\/*[^/]*$/; +var protocol = /^([^:]+:)[\s\S]*$/; +var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/; +function resolveUrl(base, href) { + if (!baseUrls[" " + base]) { + if (justDomain.test(base)) { + baseUrls[" " + base] = base + "/"; + } else { + baseUrls[" " + base] = rtrim(base, "/", true); + } + } + base = baseUrls[" " + base]; + const relativeBase = base.indexOf(":") === -1; + if (href.substring(0, 2) === "//") { + if (relativeBase) { + return href; + } + return base.replace(protocol, "$1") + href; + } else if (href.charAt(0) === "/") { + if (relativeBase) { + return href; + } + return base.replace(domain, "$1") + href; + } else { + return base + href; + } +} +var noopTest = { exec: function noopTest2() { +} }; +function merge(obj) { + let i = 1, target, key; + for (; i < arguments.length; i++) { + target = arguments[i]; + for (key in target) { + if (Object.prototype.hasOwnProperty.call(target, key)) { + obj[key] = target[key]; + } + } + } + return obj; +} +function splitCells(tableRow, count) { + const row = tableRow.replace(/\|/g, (match, offset, str) => { + let escaped = false, curr = offset; + while (--curr >= 0 && str[curr] === "\\") + escaped = !escaped; + if (escaped) { + return "|"; + } else { + return " |"; + } + }), cells = row.split(/ \|/); + let i = 0; + if (!cells[0].trim()) { + cells.shift(); + } + if (cells.length > 0 && !cells[cells.length - 1].trim()) { + cells.pop(); + } + if (cells.length > count) { + cells.splice(count); + } else { + while (cells.length < count) + cells.push(""); + } + for (; i < cells.length; i++) { + cells[i] = cells[i].trim().replace(/\\\|/g, "|"); + } + return cells; +} +function rtrim(str, c, invert) { + const l = str.length; + if (l === 0) { + return ""; + } + let suffLen = 0; + while (suffLen < l) { + const currChar = str.charAt(l - suffLen - 1); + if (currChar === c && !invert) { + suffLen++; + } else if (currChar !== c && invert) { + suffLen++; + } else { + break; + } + } + return str.slice(0, l - suffLen); +} +function findClosingBracket(str, b) { + if (str.indexOf(b[1]) === -1) { + return -1; + } + const l = str.length; + let level = 0, i = 0; + for (; i < l; i++) { + if (str[i] === "\\") { + i++; + } else if (str[i] === b[0]) { + level++; + } else if (str[i] === b[1]) { + level--; + if (level < 0) { + return i; + } + } + } + return -1; +} +function checkSanitizeDeprecation(opt) { + if (opt && opt.sanitize && !opt.silent) { + console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options"); + } +} +function repeatString(pattern, count) { + if (count < 1) { + return ""; + } + let result = ""; + while (count > 1) { + if (count & 1) { + result += pattern; + } + count >>= 1; + pattern += pattern; + } + return result + pattern; +} +function outputLink(cap, link, raw, lexer2) { + const href = link.href; + const title = link.title ? escape(link.title) : null; + const text = cap[1].replace(/\\([\[\]])/g, "$1"); + if (cap[0].charAt(0) !== "!") { + lexer2.state.inLink = true; + const token = { + type: "link", + raw, + href, + title, + text, + tokens: lexer2.inlineTokens(text) + }; + lexer2.state.inLink = false; + return token; + } + return { + type: "image", + raw, + href, + title, + text: escape(text) + }; +} +function indentCodeCompensation(raw, text) { + const matchIndentToCode = raw.match(/^(\s+)(?:```)/); + if (matchIndentToCode === null) { + return text; + } + const indentToCode = matchIndentToCode[1]; + return text.split("\n").map((node) => { + const matchIndentInNode = node.match(/^\s+/); + if (matchIndentInNode === null) { + return node; + } + const [indentInNode] = matchIndentInNode; + if (indentInNode.length >= indentToCode.length) { + return node.slice(indentToCode.length); + } + return node; + }).join("\n"); +} +var Tokenizer = class { + constructor(options2) { + this.options = options2 || defaults; + } + space(src) { + const cap = this.rules.block.newline.exec(src); + if (cap && cap[0].length > 0) { + return { + type: "space", + raw: cap[0] + }; + } + } + code(src) { + const cap = this.rules.block.code.exec(src); + if (cap) { + const text = cap[0].replace(/^ {1,4}/gm, ""); + return { + type: "code", + raw: cap[0], + codeBlockStyle: "indented", + text: !this.options.pedantic ? rtrim(text, "\n") : text + }; + } + } + fences(src) { + const cap = this.rules.block.fences.exec(src); + if (cap) { + const raw = cap[0]; + const text = indentCodeCompensation(raw, cap[3] || ""); + return { + type: "code", + raw, + lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2], + text + }; + } + } + heading(src) { + const cap = this.rules.block.heading.exec(src); + if (cap) { + let text = cap[2].trim(); + if (/#$/.test(text)) { + const trimmed = rtrim(text, "#"); + if (this.options.pedantic) { + text = trimmed.trim(); + } else if (!trimmed || / $/.test(trimmed)) { + text = trimmed.trim(); + } + } + return { + type: "heading", + raw: cap[0], + depth: cap[1].length, + text, + tokens: this.lexer.inline(text) + }; + } + } + hr(src) { + const cap = this.rules.block.hr.exec(src); + if (cap) { + return { + type: "hr", + raw: cap[0] + }; + } + } + blockquote(src) { + const cap = this.rules.block.blockquote.exec(src); + if (cap) { + const text = cap[0].replace(/^ *>[ \t]?/gm, ""); + const top = this.lexer.state.top; + this.lexer.state.top = true; + const tokens = this.lexer.blockTokens(text); + this.lexer.state.top = top; + return { + type: "blockquote", + raw: cap[0], + tokens, + text + }; + } + } + list(src) { + let cap = this.rules.block.list.exec(src); + if (cap) { + let raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly; + let bull = cap[1].trim(); + const isordered = bull.length > 1; + const list = { + type: "list", + raw: "", + ordered: isordered, + start: isordered ? +bull.slice(0, -1) : "", + loose: false, + items: [] + }; + bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`; + if (this.options.pedantic) { + bull = isordered ? bull : "[*+-]"; + } + const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`); + while (src) { + endEarly = false; + if (!(cap = itemRegex.exec(src))) { + break; + } + if (this.rules.block.hr.test(src)) { + break; + } + raw = cap[0]; + src = src.substring(raw.length); + line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t) => " ".repeat(3 * t.length)); + nextLine = src.split("\n", 1)[0]; + if (this.options.pedantic) { + indent = 2; + itemContents = line.trimLeft(); + } else { + indent = cap[2].search(/[^ ]/); + indent = indent > 4 ? 1 : indent; + itemContents = line.slice(indent); + indent += cap[1].length; + } + blankLine = false; + if (!line && /^ *$/.test(nextLine)) { + raw += nextLine + "\n"; + src = src.substring(nextLine.length + 1); + endEarly = true; + } + if (!endEarly) { + const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`); + const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`); + const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`); + const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`); + while (src) { + rawLine = src.split("\n", 1)[0]; + nextLine = rawLine; + if (this.options.pedantic) { + nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " "); + } + if (fencesBeginRegex.test(nextLine)) { + break; + } + if (headingBeginRegex.test(nextLine)) { + break; + } + if (nextBulletRegex.test(nextLine)) { + break; + } + if (hrRegex.test(src)) { + break; + } + if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { + itemContents += "\n" + nextLine.slice(indent); + } else { + if (blankLine) { + break; + } + if (line.search(/[^ ]/) >= 4) { + break; + } + if (fencesBeginRegex.test(line)) { + break; + } + if (headingBeginRegex.test(line)) { + break; + } + if (hrRegex.test(line)) { + break; + } + itemContents += "\n" + nextLine; + } + if (!blankLine && !nextLine.trim()) { + blankLine = true; + } + raw += rawLine + "\n"; + src = src.substring(rawLine.length + 1); + line = nextLine.slice(indent); + } + } + if (!list.loose) { + if (endsWithBlankLine) { + list.loose = true; + } else if (/\n *\n *$/.test(raw)) { + endsWithBlankLine = true; + } + } + if (this.options.gfm) { + istask = /^\[[ xX]\] /.exec(itemContents); + if (istask) { + ischecked = istask[0] !== "[ ] "; + itemContents = itemContents.replace(/^\[[ xX]\] +/, ""); + } + } + list.items.push({ + type: "list_item", + raw, + task: !!istask, + checked: ischecked, + loose: false, + text: itemContents + }); + list.raw += raw; + } + list.items[list.items.length - 1].raw = raw.trimRight(); + list.items[list.items.length - 1].text = itemContents.trimRight(); + list.raw = list.raw.trimRight(); + const l = list.items.length; + for (i = 0; i < l; i++) { + this.lexer.state.top = false; + list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []); + if (!list.loose) { + const spacers = list.items[i].tokens.filter((t) => t.type === "space"); + const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => /\n.*\n/.test(t.raw)); + list.loose = hasMultipleLineBreaks; + } + } + if (list.loose) { + for (i = 0; i < l; i++) { + list.items[i].loose = true; + } + } + return list; + } + } + html(src) { + const cap = this.rules.block.html.exec(src); + if (cap) { + const token = { + type: "html", + raw: cap[0], + pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"), + text: cap[0] + }; + if (this.options.sanitize) { + const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]); + token.type = "paragraph"; + token.text = text; + token.tokens = this.lexer.inline(text); + } + return token; + } + } + def(src) { + const cap = this.rules.block.def.exec(src); + if (cap) { + const tag = cap[1].toLowerCase().replace(/\s+/g, " "); + const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : ""; + const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3]; + return { + type: "def", + tag, + raw: cap[0], + href, + title + }; + } + } + table(src) { + const cap = this.rules.block.table.exec(src); + if (cap) { + const item = { + type: "table", + header: splitCells(cap[1]).map((c) => { + return { text: c }; + }), + align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */), + rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [] + }; + if (item.header.length === item.align.length) { + item.raw = cap[0]; + let l = item.align.length; + let i, j, k, row; + for (i = 0; i < l; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = "right"; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = "center"; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = "left"; + } else { + item.align[i] = null; + } + } + l = item.rows.length; + for (i = 0; i < l; i++) { + item.rows[i] = splitCells(item.rows[i], item.header.length).map((c) => { + return { text: c }; + }); + } + l = item.header.length; + for (j = 0; j < l; j++) { + item.header[j].tokens = this.lexer.inline(item.header[j].text); + } + l = item.rows.length; + for (j = 0; j < l; j++) { + row = item.rows[j]; + for (k = 0; k < row.length; k++) { + row[k].tokens = this.lexer.inline(row[k].text); + } + } + return item; + } + } + } + lheading(src) { + const cap = this.rules.block.lheading.exec(src); + if (cap) { + return { + type: "heading", + raw: cap[0], + depth: cap[2].charAt(0) === "=" ? 1 : 2, + text: cap[1], + tokens: this.lexer.inline(cap[1]) + }; + } + } + paragraph(src) { + const cap = this.rules.block.paragraph.exec(src); + if (cap) { + const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1]; + return { + type: "paragraph", + raw: cap[0], + text, + tokens: this.lexer.inline(text) + }; + } + } + text(src) { + const cap = this.rules.block.text.exec(src); + if (cap) { + return { + type: "text", + raw: cap[0], + text: cap[0], + tokens: this.lexer.inline(cap[0]) + }; + } + } + escape(src) { + const cap = this.rules.inline.escape.exec(src); + if (cap) { + return { + type: "escape", + raw: cap[0], + text: escape(cap[1]) + }; + } + } + tag(src) { + const cap = this.rules.inline.tag.exec(src); + if (cap) { + if (!this.lexer.state.inLink && /^/i.test(cap[0])) { + this.lexer.state.inLink = false; + } + if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this.lexer.state.inRawBlock = true; + } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this.lexer.state.inRawBlock = false; + } + return { + type: this.options.sanitize ? "text" : "html", + raw: cap[0], + inLink: this.lexer.state.inLink, + inRawBlock: this.lexer.state.inRawBlock, + text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0] + }; + } + } + link(src) { + const cap = this.rules.inline.link.exec(src); + if (cap) { + const trimmedUrl = cap[2].trim(); + if (!this.options.pedantic && /^$/.test(trimmedUrl)) { + return; + } + const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\"); + if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { + return; + } + } else { + const lastParenIndex = findClosingBracket(cap[2], "()"); + if (lastParenIndex > -1) { + const start = cap[0].indexOf("!") === 0 ? 5 : 4; + const linkLen = start + cap[1].length + lastParenIndex; + cap[2] = cap[2].substring(0, lastParenIndex); + cap[0] = cap[0].substring(0, linkLen).trim(); + cap[3] = ""; + } + } + let href = cap[2]; + let title = ""; + if (this.options.pedantic) { + const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); + if (link) { + href = link[1]; + title = link[3]; + } + } else { + title = cap[3] ? cap[3].slice(1, -1) : ""; + } + href = href.trim(); + if (/^$/.test(trimmedUrl)) { + href = href.slice(1); + } else { + href = href.slice(1, -1); + } + } + return outputLink(cap, { + href: href ? href.replace(this.rules.inline._escapes, "$1") : href, + title: title ? title.replace(this.rules.inline._escapes, "$1") : title + }, cap[0], this.lexer); + } + } + reflink(src, links) { + let cap; + if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { + let link = (cap[2] || cap[1]).replace(/\s+/g, " "); + link = links[link.toLowerCase()]; + if (!link) { + const text = cap[0].charAt(0); + return { + type: "text", + raw: text, + text + }; + } + return outputLink(cap, link, cap[0], this.lexer); + } + } + emStrong(src, maskedSrc, prevChar = "") { + let match = this.rules.inline.emStrong.lDelim.exec(src); + if (!match) + return; + if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) + return; + const nextChar = match[1] || match[2] || ""; + if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) { + const lLength = match[0].length - 1; + let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; + const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd; + endReg.lastIndex = 0; + maskedSrc = maskedSrc.slice(-1 * src.length + lLength); + while ((match = endReg.exec(maskedSrc)) != null) { + rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; + if (!rDelim) + continue; + rLength = rDelim.length; + if (match[3] || match[4]) { + delimTotal += rLength; + continue; + } else if (match[5] || match[6]) { + if (lLength % 3 && !((lLength + rLength) % 3)) { + midDelimTotal += rLength; + continue; + } + } + delimTotal -= rLength; + if (delimTotal > 0) + continue; + rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); + const raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength); + if (Math.min(lLength, rLength) % 2) { + const text2 = raw.slice(1, -1); + return { + type: "em", + raw, + text: text2, + tokens: this.lexer.inlineTokens(text2) + }; + } + const text = raw.slice(2, -2); + return { + type: "strong", + raw, + text, + tokens: this.lexer.inlineTokens(text) + }; + } + } + } + codespan(src) { + const cap = this.rules.inline.code.exec(src); + if (cap) { + let text = cap[2].replace(/\n/g, " "); + const hasNonSpaceChars = /[^ ]/.test(text); + const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text); + if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { + text = text.substring(1, text.length - 1); + } + text = escape(text, true); + return { + type: "codespan", + raw: cap[0], + text + }; + } + } + br(src) { + const cap = this.rules.inline.br.exec(src); + if (cap) { + return { + type: "br", + raw: cap[0] + }; + } + } + del(src) { + const cap = this.rules.inline.del.exec(src); + if (cap) { + return { + type: "del", + raw: cap[0], + text: cap[2], + tokens: this.lexer.inlineTokens(cap[2]) + }; + } + } + autolink(src, mangle2) { + const cap = this.rules.inline.autolink.exec(src); + if (cap) { + let text, href; + if (cap[2] === "@") { + text = escape(this.options.mangle ? mangle2(cap[1]) : cap[1]); + href = "mailto:" + text; + } else { + text = escape(cap[1]); + href = text; + } + return { + type: "link", + raw: cap[0], + text, + href, + tokens: [ + { + type: "text", + raw: text, + text + } + ] + }; + } + } + url(src, mangle2) { + let cap; + if (cap = this.rules.inline.url.exec(src)) { + let text, href; + if (cap[2] === "@") { + text = escape(this.options.mangle ? mangle2(cap[0]) : cap[0]); + href = "mailto:" + text; + } else { + let prevCapZero; + do { + prevCapZero = cap[0]; + cap[0] = this.rules.inline._backpedal.exec(cap[0])[0]; + } while (prevCapZero !== cap[0]); + text = escape(cap[0]); + if (cap[1] === "www.") { + href = "http://" + cap[0]; + } else { + href = cap[0]; + } + } + return { + type: "link", + raw: cap[0], + text, + href, + tokens: [ + { + type: "text", + raw: text, + text + } + ] + }; + } + } + inlineText(src, smartypants2) { + const cap = this.rules.inline.text.exec(src); + if (cap) { + let text; + if (this.lexer.state.inRawBlock) { + text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]; + } else { + text = escape(this.options.smartypants ? smartypants2(cap[0]) : cap[0]); + } + return { + type: "text", + raw: cap[0], + text + }; + } + } +}; +var block = { + newline: /^(?: *(?:\n|$))+/, + code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, + fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/, + hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, + heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, + blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, + list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/, + html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", + def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/, + table: noopTest, + lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, + _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, + text: /^[^\n]+/ +}; +block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/; +block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; +block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex(); +block.bullet = /(?:[*+-]|\d{1,9}[.)])/; +block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex(); +block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex(); +block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; +block._comment = /|$)/; +block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); +block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); +block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex(); +block.normal = merge({}, block); +block.gfm = merge({}, block.normal, { + table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)" +}); +block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); +block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex(); +block.pedantic = merge({}, block.normal, { + html: edit( + `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))` + ).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, + heading: /^(#{1,6})(.*)(?:\n+|$)/, + fences: noopTest, + lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, + paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex() +}); +var inline = { + escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, + autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, + url: noopTest, + tag: "^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^", + link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/, + reflink: /^!?\[(label)\]\[(ref)\]/, + nolink: /^!?\[(ref)\](?:\[\])?/, + reflinkSearch: "reflink|nolink(?!\\()", + emStrong: { + lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/, + rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/, + rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ + }, + code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, + br: /^( {2,}|\\)\n(?!\s*$)/, + del: noopTest, + text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"; +inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); +inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g; +inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g; +inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex(); +inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex(); +inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex(); +inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex(); +inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g; +inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; +inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; +inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex(); +inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; +inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex(); +inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; +inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/; +inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; +inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex(); +inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex(); +inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex(); +inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex(); +inline.normal = merge({}, inline); +inline.pedantic = merge({}, inline.normal, { + strong: { + start: /^__|\*\*/, + middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, + endAst: /\*\*(?!\*)/g, + endUnd: /__(?!_)/g + }, + em: { + start: /^_|\*/, + middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/, + endAst: /\*(?!\*)/g, + endUnd: /_(?!_)/g + }, + link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(), + reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex() +}); +inline.gfm = merge({}, inline.normal, { + escape: edit(inline.escape).replace("])", "~|])").getRegex(), + _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, + url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, + _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, + del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, + text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ 0.5) { + ch = "x" + ch.toString(16); + } + out += "&#" + ch + ";"; + } + return out; +} +var Lexer = class { + constructor(options2) { + this.tokens = []; + this.tokens.links = /* @__PURE__ */ Object.create(null); + this.options = options2 || defaults; + this.options.tokenizer = this.options.tokenizer || new Tokenizer(); + this.tokenizer = this.options.tokenizer; + this.tokenizer.options = this.options; + this.tokenizer.lexer = this; + this.inlineQueue = []; + this.state = { + inLink: false, + inRawBlock: false, + top: true + }; + const rules = { + block: block.normal, + inline: inline.normal + }; + if (this.options.pedantic) { + rules.block = block.pedantic; + rules.inline = inline.pedantic; + } else if (this.options.gfm) { + rules.block = block.gfm; + if (this.options.breaks) { + rules.inline = inline.breaks; + } else { + rules.inline = inline.gfm; + } + } + this.tokenizer.rules = rules; + } + static get rules() { + return { + block, + inline + }; + } + static lex(src, options2) { + const lexer2 = new Lexer(options2); + return lexer2.lex(src); + } + static lexInline(src, options2) { + const lexer2 = new Lexer(options2); + return lexer2.inlineTokens(src); + } + lex(src) { + src = src.replace(/\r\n|\r/g, "\n"); + this.blockTokens(src, this.tokens); + let next; + while (next = this.inlineQueue.shift()) { + this.inlineTokens(next.src, next.tokens); + } + return this.tokens; + } + blockTokens(src, tokens = []) { + if (this.options.pedantic) { + src = src.replace(/\t/g, " ").replace(/^ +$/gm, ""); + } else { + src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => { + return leading + " ".repeat(tabs.length); + }); + } + let token, lastToken, cutSrc, lastParagraphClipped; + while (src) { + if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => { + if (token = extTokenizer.call({ lexer: this }, src, tokens)) { + src = src.substring(token.raw.length); + tokens.push(token); + return true; + } + return false; + })) { + continue; + } + if (token = this.tokenizer.space(src)) { + src = src.substring(token.raw.length); + if (token.raw.length === 1 && tokens.length > 0) { + tokens[tokens.length - 1].raw += "\n"; + } else { + tokens.push(token); + } + continue; + } + if (token = this.tokenizer.code(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) { + lastToken.raw += "\n" + token.raw; + lastToken.text += "\n" + token.text; + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } else { + tokens.push(token); + } + continue; + } + if (token = this.tokenizer.fences(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.heading(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.hr(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.blockquote(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.list(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.html(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.def(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) { + lastToken.raw += "\n" + token.raw; + lastToken.text += "\n" + token.raw; + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } else if (!this.tokens.links[token.tag]) { + this.tokens.links[token.tag] = { + href: token.href, + title: token.title + }; + } + continue; + } + if (token = this.tokenizer.table(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.lheading(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + cutSrc = src; + if (this.options.extensions && this.options.extensions.startBlock) { + let startIndex = Infinity; + const tempSrc = src.slice(1); + let tempStart; + this.options.extensions.startBlock.forEach(function(getStartIndex) { + tempStart = getStartIndex.call({ lexer: this }, tempSrc); + if (typeof tempStart === "number" && tempStart >= 0) { + startIndex = Math.min(startIndex, tempStart); + } + }); + if (startIndex < Infinity && startIndex >= 0) { + cutSrc = src.substring(0, startIndex + 1); + } + } + if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { + lastToken = tokens[tokens.length - 1]; + if (lastParagraphClipped && lastToken.type === "paragraph") { + lastToken.raw += "\n" + token.raw; + lastToken.text += "\n" + token.text; + this.inlineQueue.pop(); + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } else { + tokens.push(token); + } + lastParagraphClipped = cutSrc.length !== src.length; + src = src.substring(token.raw.length); + continue; + } + if (token = this.tokenizer.text(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && lastToken.type === "text") { + lastToken.raw += "\n" + token.raw; + lastToken.text += "\n" + token.text; + this.inlineQueue.pop(); + this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text; + } else { + tokens.push(token); + } + continue; + } + if (src) { + const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); + if (this.options.silent) { + console.error(errMsg); + break; + } else { + throw new Error(errMsg); + } + } + } + this.state.top = true; + return tokens; + } + inline(src, tokens = []) { + this.inlineQueue.push({ src, tokens }); + return tokens; + } + inlineTokens(src, tokens = []) { + let token, lastToken, cutSrc; + let maskedSrc = src; + let match; + let keepPrevChar, prevChar; + if (this.tokens.links) { + const links = Object.keys(this.tokens.links); + if (links.length > 0) { + while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { + if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) { + maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); + } + } + } + } + while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { + maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + } + while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) { + maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex); + this.tokenizer.rules.inline.escapedEmSt.lastIndex--; + } + while (src) { + if (!keepPrevChar) { + prevChar = ""; + } + keepPrevChar = false; + if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => { + if (token = extTokenizer.call({ lexer: this }, src, tokens)) { + src = src.substring(token.raw.length); + tokens.push(token); + return true; + } + return false; + })) { + continue; + } + if (token = this.tokenizer.escape(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.tag(src)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && token.type === "text" && lastToken.type === "text") { + lastToken.raw += token.raw; + lastToken.text += token.text; + } else { + tokens.push(token); + } + continue; + } + if (token = this.tokenizer.link(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.reflink(src, this.tokens.links)) { + src = src.substring(token.raw.length); + lastToken = tokens[tokens.length - 1]; + if (lastToken && token.type === "text" && lastToken.type === "text") { + lastToken.raw += token.raw; + lastToken.text += token.text; + } else { + tokens.push(token); + } + continue; + } + if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.codespan(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.br(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.del(src)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (token = this.tokenizer.autolink(src, mangle)) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) { + src = src.substring(token.raw.length); + tokens.push(token); + continue; + } + cutSrc = src; + if (this.options.extensions && this.options.extensions.startInline) { + let startIndex = Infinity; + const tempSrc = src.slice(1); + let tempStart; + this.options.extensions.startInline.forEach(function(getStartIndex) { + tempStart = getStartIndex.call({ lexer: this }, tempSrc); + if (typeof tempStart === "number" && tempStart >= 0) { + startIndex = Math.min(startIndex, tempStart); + } + }); + if (startIndex < Infinity && startIndex >= 0) { + cutSrc = src.substring(0, startIndex + 1); + } + } + if (token = this.tokenizer.inlineText(cutSrc, smartypants)) { + src = src.substring(token.raw.length); + if (token.raw.slice(-1) !== "_") { + prevChar = token.raw.slice(-1); + } + keepPrevChar = true; + lastToken = tokens[tokens.length - 1]; + if (lastToken && lastToken.type === "text") { + lastToken.raw += token.raw; + lastToken.text += token.text; + } else { + tokens.push(token); + } + continue; + } + if (src) { + const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); + if (this.options.silent) { + console.error(errMsg); + break; + } else { + throw new Error(errMsg); + } + } + } + return tokens; + } +}; +var Renderer = class { + constructor(options2) { + this.options = options2 || defaults; + } + code(code, infostring, escaped) { + const lang = (infostring || "").match(/\S*/)[0]; + if (this.options.highlight) { + const out = this.options.highlight(code, lang); + if (out != null && out !== code) { + escaped = true; + code = out; + } + } + code = code.replace(/\n$/, "") + "\n"; + if (!lang) { + return "
" + (escaped ? code : escape(code, true)) + "
\n"; + } + return '
' + (escaped ? code : escape(code, true)) + "
\n"; + } + blockquote(quote) { + return `
+${quote}
+`; + } + html(html) { + return html; + } + heading(text, level, raw, slugger) { + if (this.options.headerIds) { + const id = this.options.headerPrefix + slugger.slug(raw); + return `${text} +`; + } + return `${text} +`; + } + hr() { + return this.options.xhtml ? "
\n" : "
\n"; + } + list(body, ordered, start) { + const type = ordered ? "ol" : "ul", startatt = ordered && start !== 1 ? ' start="' + start + '"' : ""; + return "<" + type + startatt + ">\n" + body + "\n"; + } + listitem(text) { + return `
  • ${text}
  • +`; + } + checkbox(checked) { + return " "; + } + paragraph(text) { + return `

    ${text}

    +`; + } + table(header, body) { + if (body) + body = `${body}`; + return "\n\n" + header + "\n" + body + "
    \n"; + } + tablerow(content) { + return ` +${content} +`; + } + tablecell(content, flags) { + const type = flags.header ? "th" : "td"; + const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`; + return tag + content + ` +`; + } + strong(text) { + return `${text}`; + } + em(text) { + return `${text}`; + } + codespan(text) { + return `${text}`; + } + br() { + return this.options.xhtml ? "
    " : "
    "; + } + del(text) { + return `${text}`; + } + link(href, title, text) { + href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); + if (href === null) { + return text; + } + let out = '
    "; + return out; + } + image(href, title, text) { + href = cleanUrl(this.options.sanitize, this.options.baseUrl, href); + if (href === null) { + return text; + } + let out = `${text}" : ">"; + return out; + } + text(text) { + return text; + } +}; +var TextRenderer = class { + strong(text) { + return text; + } + em(text) { + return text; + } + codespan(text) { + return text; + } + del(text) { + return text; + } + html(text) { + return text; + } + text(text) { + return text; + } + link(href, title, text) { + return "" + text; + } + image(href, title, text) { + return "" + text; + } + br() { + return ""; + } +}; +var Slugger = class { + constructor() { + this.seen = {}; + } + serialize(value) { + return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-"); + } + getNextSafeSlug(originalSlug, isDryRun) { + let slug = originalSlug; + let occurenceAccumulator = 0; + if (this.seen.hasOwnProperty(slug)) { + occurenceAccumulator = this.seen[originalSlug]; + do { + occurenceAccumulator++; + slug = originalSlug + "-" + occurenceAccumulator; + } while (this.seen.hasOwnProperty(slug)); + } + if (!isDryRun) { + this.seen[originalSlug] = occurenceAccumulator; + this.seen[slug] = 0; + } + return slug; + } + slug(value, options2 = {}) { + const slug = this.serialize(value); + return this.getNextSafeSlug(slug, options2.dryrun); + } +}; +var Parser = class { + constructor(options2) { + this.options = options2 || defaults; + this.options.renderer = this.options.renderer || new Renderer(); + this.renderer = this.options.renderer; + this.renderer.options = this.options; + this.textRenderer = new TextRenderer(); + this.slugger = new Slugger(); + } + static parse(tokens, options2) { + const parser2 = new Parser(options2); + return parser2.parse(tokens); + } + static parseInline(tokens, options2) { + const parser2 = new Parser(options2); + return parser2.parseInline(tokens); + } + parse(tokens, top = true) { + let out = "", i, j, k, l2, l3, row, cell, header, body, token, ordered, start, loose, itemBody, item, checked, task, checkbox, ret; + const l = tokens.length; + for (i = 0; i < l; i++) { + token = tokens[i]; + if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { + ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); + if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) { + out += ret || ""; + continue; + } + } + switch (token.type) { + case "space": { + continue; + } + case "hr": { + out += this.renderer.hr(); + continue; + } + case "heading": { + out += this.renderer.heading( + this.parseInline(token.tokens), + token.depth, + unescape(this.parseInline(token.tokens, this.textRenderer)), + this.slugger + ); + continue; + } + case "code": { + out += this.renderer.code( + token.text, + token.lang, + token.escaped + ); + continue; + } + case "table": { + header = ""; + cell = ""; + l2 = token.header.length; + for (j = 0; j < l2; j++) { + cell += this.renderer.tablecell( + this.parseInline(token.header[j].tokens), + { header: true, align: token.align[j] } + ); + } + header += this.renderer.tablerow(cell); + body = ""; + l2 = token.rows.length; + for (j = 0; j < l2; j++) { + row = token.rows[j]; + cell = ""; + l3 = row.length; + for (k = 0; k < l3; k++) { + cell += this.renderer.tablecell( + this.parseInline(row[k].tokens), + { header: false, align: token.align[k] } + ); + } + body += this.renderer.tablerow(cell); + } + out += this.renderer.table(header, body); + continue; + } + case "blockquote": { + body = this.parse(token.tokens); + out += this.renderer.blockquote(body); + continue; + } + case "list": { + ordered = token.ordered; + start = token.start; + loose = token.loose; + l2 = token.items.length; + body = ""; + for (j = 0; j < l2; j++) { + item = token.items[j]; + checked = item.checked; + task = item.task; + itemBody = ""; + if (item.task) { + checkbox = this.renderer.checkbox(checked); + if (loose) { + if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") { + item.tokens[0].text = checkbox + " " + item.tokens[0].text; + if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") { + item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text; + } + } else { + item.tokens.unshift({ + type: "text", + text: checkbox + }); + } + } else { + itemBody += checkbox; + } + } + itemBody += this.parse(item.tokens, loose); + body += this.renderer.listitem(itemBody, task, checked); + } + out += this.renderer.list(body, ordered, start); + continue; + } + case "html": { + out += this.renderer.html(token.text); + continue; + } + case "paragraph": { + out += this.renderer.paragraph(this.parseInline(token.tokens)); + continue; + } + case "text": { + body = token.tokens ? this.parseInline(token.tokens) : token.text; + while (i + 1 < l && tokens[i + 1].type === "text") { + token = tokens[++i]; + body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text); + } + out += top ? this.renderer.paragraph(body) : body; + continue; + } + default: { + const errMsg = 'Token with "' + token.type + '" type was not found.'; + if (this.options.silent) { + console.error(errMsg); + return; + } else { + throw new Error(errMsg); + } + } + } + } + return out; + } + parseInline(tokens, renderer) { + renderer = renderer || this.renderer; + let out = "", i, token, ret; + const l = tokens.length; + for (i = 0; i < l; i++) { + token = tokens[i]; + if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) { + ret = this.options.extensions.renderers[token.type].call({ parser: this }, token); + if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) { + out += ret || ""; + continue; + } + } + switch (token.type) { + case "escape": { + out += renderer.text(token.text); + break; + } + case "html": { + out += renderer.html(token.text); + break; + } + case "link": { + out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer)); + break; + } + case "image": { + out += renderer.image(token.href, token.title, token.text); + break; + } + case "strong": { + out += renderer.strong(this.parseInline(token.tokens, renderer)); + break; + } + case "em": { + out += renderer.em(this.parseInline(token.tokens, renderer)); + break; + } + case "codespan": { + out += renderer.codespan(token.text); + break; + } + case "br": { + out += renderer.br(); + break; + } + case "del": { + out += renderer.del(this.parseInline(token.tokens, renderer)); + break; + } + case "text": { + out += renderer.text(token.text); + break; + } + default: { + const errMsg = 'Token with "' + token.type + '" type was not found.'; + if (this.options.silent) { + console.error(errMsg); + return; + } else { + throw new Error(errMsg); + } + } + } + } + return out; + } +}; +function marked(src, opt, callback) { + if (typeof src === "undefined" || src === null) { + throw new Error("marked(): input parameter is undefined or null"); + } + if (typeof src !== "string") { + throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"); + } + if (typeof opt === "function") { + callback = opt; + opt = null; + } + opt = merge({}, marked.defaults, opt || {}); + checkSanitizeDeprecation(opt); + if (callback) { + const highlight = opt.highlight; + let tokens; + try { + tokens = Lexer.lex(src, opt); + } catch (e) { + return callback(e); + } + const done = function(err) { + let out; + if (!err) { + try { + if (opt.walkTokens) { + marked.walkTokens(tokens, opt.walkTokens); + } + out = Parser.parse(tokens, opt); + } catch (e) { + err = e; + } + } + opt.highlight = highlight; + return err ? callback(err) : callback(null, out); + }; + if (!highlight || highlight.length < 3) { + return done(); + } + delete opt.highlight; + if (!tokens.length) + return done(); + let pending = 0; + marked.walkTokens(tokens, function(token) { + if (token.type === "code") { + pending++; + setTimeout(() => { + highlight(token.text, token.lang, function(err, code) { + if (err) { + return done(err); + } + if (code != null && code !== token.text) { + token.text = code; + token.escaped = true; + } + pending--; + if (pending === 0) { + done(); + } + }); + }, 0); + } + }); + if (pending === 0) { + done(); + } + return; + } + function onError(e) { + e.message += "\nPlease report this to https://github.com/markedjs/marked."; + if (opt.silent) { + return "

    An error occurred:

    " + escape(e.message + "", true) + "
    "; + } + throw e; + } + try { + const tokens = Lexer.lex(src, opt); + if (opt.walkTokens) { + if (opt.async) { + return Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => { + return Parser.parse(tokens, opt); + }).catch(onError); + } + marked.walkTokens(tokens, opt.walkTokens); + } + return Parser.parse(tokens, opt); + } catch (e) { + onError(e); + } +} +marked.options = marked.setOptions = function(opt) { + merge(marked.defaults, opt); + changeDefaults(marked.defaults); + return marked; +}; +marked.getDefaults = getDefaults; +marked.defaults = defaults; +marked.use = function(...args) { + const extensions5 = marked.defaults.extensions || { renderers: {}, childTokens: {} }; + args.forEach((pack) => { + const opts = merge({}, pack); + opts.async = marked.defaults.async || opts.async; + if (pack.extensions) { + pack.extensions.forEach((ext) => { + if (!ext.name) { + throw new Error("extension name required"); + } + if (ext.renderer) { + const prevRenderer = extensions5.renderers[ext.name]; + if (prevRenderer) { + extensions5.renderers[ext.name] = function(...args2) { + let ret = ext.renderer.apply(this, args2); + if (ret === false) { + ret = prevRenderer.apply(this, args2); + } + return ret; + }; + } else { + extensions5.renderers[ext.name] = ext.renderer; + } + } + if (ext.tokenizer) { + if (!ext.level || ext.level !== "block" && ext.level !== "inline") { + throw new Error("extension level must be 'block' or 'inline'"); + } + if (extensions5[ext.level]) { + extensions5[ext.level].unshift(ext.tokenizer); + } else { + extensions5[ext.level] = [ext.tokenizer]; + } + if (ext.start) { + if (ext.level === "block") { + if (extensions5.startBlock) { + extensions5.startBlock.push(ext.start); + } else { + extensions5.startBlock = [ext.start]; + } + } else if (ext.level === "inline") { + if (extensions5.startInline) { + extensions5.startInline.push(ext.start); + } else { + extensions5.startInline = [ext.start]; + } + } + } + } + if (ext.childTokens) { + extensions5.childTokens[ext.name] = ext.childTokens; + } + }); + opts.extensions = extensions5; + } + if (pack.renderer) { + const renderer = marked.defaults.renderer || new Renderer(); + for (const prop in pack.renderer) { + const prevRenderer = renderer[prop]; + renderer[prop] = (...args2) => { + let ret = pack.renderer[prop].apply(renderer, args2); + if (ret === false) { + ret = prevRenderer.apply(renderer, args2); + } + return ret; + }; + } + opts.renderer = renderer; + } + if (pack.tokenizer) { + const tokenizer = marked.defaults.tokenizer || new Tokenizer(); + for (const prop in pack.tokenizer) { + const prevTokenizer = tokenizer[prop]; + tokenizer[prop] = (...args2) => { + let ret = pack.tokenizer[prop].apply(tokenizer, args2); + if (ret === false) { + ret = prevTokenizer.apply(tokenizer, args2); + } + return ret; + }; + } + opts.tokenizer = tokenizer; + } + if (pack.walkTokens) { + const walkTokens2 = marked.defaults.walkTokens; + opts.walkTokens = function(token) { + let values = []; + values.push(pack.walkTokens.call(this, token)); + if (walkTokens2) { + values = values.concat(walkTokens2.call(this, token)); + } + return values; + }; + } + marked.setOptions(opts); + }); +}; +marked.walkTokens = function(tokens, callback) { + let values = []; + for (const token of tokens) { + values = values.concat(callback.call(marked, token)); + switch (token.type) { + case "table": { + for (const cell of token.header) { + values = values.concat(marked.walkTokens(cell.tokens, callback)); + } + for (const row of token.rows) { + for (const cell of row) { + values = values.concat(marked.walkTokens(cell.tokens, callback)); + } + } + break; + } + case "list": { + values = values.concat(marked.walkTokens(token.items, callback)); + break; + } + default: { + if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) { + marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) { + values = values.concat(marked.walkTokens(token[childTokens], callback)); + }); + } else if (token.tokens) { + values = values.concat(marked.walkTokens(token.tokens, callback)); + } + } + } + } + return values; +}; +marked.parseInline = function(src, opt) { + if (typeof src === "undefined" || src === null) { + throw new Error("marked.parseInline(): input parameter is undefined or null"); + } + if (typeof src !== "string") { + throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"); + } + opt = merge({}, marked.defaults, opt || {}); + checkSanitizeDeprecation(opt); + try { + const tokens = Lexer.lexInline(src, opt); + if (opt.walkTokens) { + marked.walkTokens(tokens, opt.walkTokens); + } + return Parser.parseInline(tokens, opt); + } catch (e) { + e.message += "\nPlease report this to https://github.com/markedjs/marked."; + if (opt.silent) { + return "

    An error occurred:

    " + escape(e.message + "", true) + "
    "; + } + throw e; + } +}; +marked.Parser = Parser; +marked.parser = Parser.parse; +marked.Renderer = Renderer; +marked.TextRenderer = TextRenderer; +marked.Lexer = Lexer; +marked.lexer = Lexer.lex; +marked.Tokenizer = Tokenizer; +marked.Slugger = Slugger; +marked.parse = marked; +var options = marked.options; +var setOptions = marked.setOptions; +var use = marked.use; +var walkTokens = marked.walkTokens; +var parseInline = marked.parseInline; +var parser = Parser.parse; +var lexer = Lexer.lex; + +// src/markdownPreviewProvider.ts +var import_os2 = __toESM(require("os")); +var path9 = __toESM(require("path")); + +// node_modules/uuid/dist/esm-node/rng.js +var import_crypto = __toESM(require("crypto")); +function rng() { + return import_crypto.default.randomBytes(16); +} + +// node_modules/uuid/dist/esm-node/bytesToUuid.js +var byteToHex = []; +for (i = 0; i < 256; ++i) { + byteToHex[i] = (i + 256).toString(16).substr(1); +} +var i; +function bytesToUuid(buf, offset) { + var i = offset || 0; + var bth = byteToHex; + return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], "-", bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(""); +} +var bytesToUuid_default = bytesToUuid; + +// node_modules/uuid/dist/esm-node/v4.js +function v4(options2, buf, offset) { + var i = buf && offset || 0; + if (typeof options2 == "string") { + buf = options2 === "binary" ? new Array(16) : null; + options2 = null; + } + options2 = options2 || {}; + var rnds = options2.random || (options2.rng || rng)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + for (var ii = 0; ii < 16; ++ii) { + buf[i + ii] = rnds[ii]; + } + } + return buf || bytesToUuid_default(rnds); +} +var v4_default = v4; + +// src/markdownPreviewProvider.ts +var MarkdownPreviewProvider = class { + constructor() { + this.documentCache = /* @__PURE__ */ new Map(); + this.disposables = []; + } + async show(markdownFilePath, title, section, context) { + const html = await this.getHtmlContent(markdownFilePath, section, context); + let filepath = path9.join(import_os2.default.tmpdir(), `${v4_default()}.html`); + await fse3.writeFile(filepath, html); + await import_coc12.workspace.nvim.call("coc#ui#open_url", [import_coc12.Uri.file(filepath).toString()]); + } + dispose() { + for (const disposable of this.disposables) { + disposable.dispose(); + } + } + async getHtmlContent(markdownFilePath, section, context) { + const nonce = this.getNonce(); + const styles = this.getStyles(context); + let body = this.documentCache.get(markdownFilePath); + if (!body) { + let markdownString = await fse3.readFile(markdownFilePath, "utf8"); + markdownString = markdownString.replace(/__VSCODE_ENV_APPNAME_PLACEHOLDER__/, "coc.nvim"); + marked.setOptions({ + gfm: true, + breaks: true + }); + body = marked(markdownString); + this.documentCache.set(markdownFilePath, body); + } + return ` + + + + + + + ${styles} + + + + ${body} + +