"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 __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(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  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"(exports2) {
    "use strict";
    exports2.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 });
    };
    exports2.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"(exports2, 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(fs7) {
      if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
        patchLchmod(fs7);
      }
      if (!fs7.lutimes) {
        patchLutimes(fs7);
      }
      fs7.chown = chownFix(fs7.chown);
      fs7.fchown = chownFix(fs7.fchown);
      fs7.lchown = chownFix(fs7.lchown);
      fs7.chmod = chmodFix(fs7.chmod);
      fs7.fchmod = chmodFix(fs7.fchmod);
      fs7.lchmod = chmodFix(fs7.lchmod);
      fs7.chownSync = chownFixSync(fs7.chownSync);
      fs7.fchownSync = chownFixSync(fs7.fchownSync);
      fs7.lchownSync = chownFixSync(fs7.lchownSync);
      fs7.chmodSync = chmodFixSync(fs7.chmodSync);
      fs7.fchmodSync = chmodFixSync(fs7.fchmodSync);
      fs7.lchmodSync = chmodFixSync(fs7.lchmodSync);
      fs7.stat = statFix(fs7.stat);
      fs7.fstat = statFix(fs7.fstat);
      fs7.lstat = statFix(fs7.lstat);
      fs7.statSync = statFixSync(fs7.statSync);
      fs7.fstatSync = statFixSync(fs7.fstatSync);
      fs7.lstatSync = statFixSync(fs7.lstatSync);
      if (fs7.chmod && !fs7.lchmod) {
        fs7.lchmod = function(path18, mode, cb) {
          if (cb) process.nextTick(cb);
        };
        fs7.lchmodSync = function() {
        };
      }
      if (fs7.chown && !fs7.lchown) {
        fs7.lchown = function(path18, uid, gid, cb) {
          if (cb) process.nextTick(cb);
        };
        fs7.lchownSync = function() {
        };
      }
      if (platform2 === "win32") {
        fs7.rename = typeof fs7.rename !== "function" ? fs7.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" || er.code === "EBUSY") && Date.now() - start < 6e4) {
                setTimeout(function() {
                  fs7.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;
        })(fs7.rename);
      }
      fs7.read = typeof fs7.read !== "function" ? fs7.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(fs7, fd, buffer, offset, length, position, callback);
              }
              callback_.apply(this, arguments);
            };
          }
          return fs$read.call(fs7, fd, buffer, offset, length, position, callback);
        }
        if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
        return read;
      })(fs7.read);
      fs7.readSync = typeof fs7.readSync !== "function" ? fs7.readSync : /* @__PURE__ */ (function(fs$readSync) {
        return function(fd, buffer, offset, length, position) {
          var eagCounter = 0;
          while (true) {
            try {
              return fs$readSync.call(fs7, fd, buffer, offset, length, position);
            } catch (er) {
              if (er.code === "EAGAIN" && eagCounter < 10) {
                eagCounter++;
                continue;
              }
              throw er;
            }
          }
        };
      })(fs7.readSync);
      function patchLchmod(fs8) {
        fs8.lchmod = function(path18, mode, callback) {
          fs8.open(
            path18,
            constants.O_WRONLY | constants.O_SYMLINK,
            mode,
            function(err, fd) {
              if (err) {
                if (callback) callback(err);
                return;
              }
              fs8.fchmod(fd, mode, function(err2) {
                fs8.close(fd, function(err22) {
                  if (callback) callback(err2 || err22);
                });
              });
            }
          );
        };
        fs8.lchmodSync = function(path18, mode) {
          var fd = fs8.openSync(path18, constants.O_WRONLY | constants.O_SYMLINK, mode);
          var threw = true;
          var ret;
          try {
            ret = fs8.fchmodSync(fd, mode);
            threw = false;
          } finally {
            if (threw) {
              try {
                fs8.closeSync(fd);
              } catch (er) {
              }
            } else {
              fs8.closeSync(fd);
            }
          }
          return ret;
        };
      }
      function patchLutimes(fs8) {
        if (constants.hasOwnProperty("O_SYMLINK") && fs8.futimes) {
          fs8.lutimes = function(path18, at, mt, cb) {
            fs8.open(path18, constants.O_SYMLINK, function(er, fd) {
              if (er) {
                if (cb) cb(er);
                return;
              }
              fs8.futimes(fd, at, mt, function(er2) {
                fs8.close(fd, function(er22) {
                  if (cb) cb(er2 || er22);
                });
              });
            });
          };
          fs8.lutimesSync = function(path18, at, mt) {
            var fd = fs8.openSync(path18, constants.O_SYMLINK);
            var ret;
            var threw = true;
            try {
              ret = fs8.futimesSync(fd, at, mt);
              threw = false;
            } finally {
              if (threw) {
                try {
                  fs8.closeSync(fd);
                } catch (er) {
                }
              } else {
                fs8.closeSync(fd);
              }
            }
            return ret;
          };
        } else if (fs8.futimes) {
          fs8.lutimes = function(_a, _b, _c, cb) {
            if (cb) process.nextTick(cb);
          };
          fs8.lutimesSync = function() {
          };
        }
      }
      function chmodFix(orig) {
        if (!orig) return orig;
        return function(target, mode, cb) {
          return orig.call(fs7, 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(fs7, 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(fs7, 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(fs7, 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(fs7, target, options2, callback) : orig.call(fs7, target, callback);
        };
      }
      function statFixSync(orig) {
        if (!orig) return orig;
        return function(target, options2) {
          var stats = options2 ? orig.call(fs7, target, options2) : orig.call(fs7, 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"(exports2, module2) {
    var Stream = require("stream").Stream;
    module2.exports = legacy;
    function legacy(fs7) {
      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;
        }
        fs7.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 = fs7.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"(exports2, 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"(exports2, module2) {
    var fs7 = 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 (!fs7[gracefulQueue]) {
      queue = global[gracefulQueue] || [];
      publishQueue(fs7, queue);
      fs7.close = (function(fs$close) {
        function close(fd, cb) {
          return fs$close.call(fs7, fd, function(err) {
            if (!err) {
              resetQueue();
            }
            if (typeof cb === "function")
              cb.apply(this, arguments);
          });
        }
        Object.defineProperty(close, previousSymbol, {
          value: fs$close
        });
        return close;
      })(fs7.close);
      fs7.closeSync = (function(fs$closeSync) {
        function closeSync3(fd) {
          fs$closeSync.apply(fs7, arguments);
          resetQueue();
        }
        Object.defineProperty(closeSync3, previousSymbol, {
          value: fs$closeSync
        });
        return closeSync3;
      })(fs7.closeSync);
      if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
        process.on("exit", function() {
          debug(fs7[gracefulQueue]);
          require("assert").equal(fs7[gracefulQueue].length, 0);
        });
      }
    }
    var queue;
    if (!global[gracefulQueue]) {
      publishQueue(global, fs7[gracefulQueue]);
    }
    module2.exports = patch(clone(fs7));
    if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs7.__patched) {
      module2.exports = patch(fs7);
      fs7.__patched = true;
    }
    function patch(fs8) {
      polyfills(fs8);
      fs8.gracefulify = patch;
      fs8.createReadStream = createReadStream2;
      fs8.createWriteStream = createWriteStream2;
      var fs$readFile = fs8.readFile;
      fs8.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 = fs8.writeFile;
      fs8.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 = fs8.appendFile;
      if (fs$appendFile)
        fs8.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 = fs8.copyFile;
      if (fs$copyFile)
        fs8.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 = fs8.readdir;
      fs8.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(fs8);
        ReadStream = legStreams.ReadStream;
        WriteStream = legStreams.WriteStream;
      }
      var fs$ReadStream = fs8.ReadStream;
      if (fs$ReadStream) {
        ReadStream.prototype = Object.create(fs$ReadStream.prototype);
        ReadStream.prototype.open = ReadStream$open;
      }
      var fs$WriteStream = fs8.WriteStream;
      if (fs$WriteStream) {
        WriteStream.prototype = Object.create(fs$WriteStream.prototype);
        WriteStream.prototype.open = WriteStream$open;
      }
      Object.defineProperty(fs8, "ReadStream", {
        get: function() {
          return ReadStream;
        },
        set: function(val) {
          ReadStream = val;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(fs8, "WriteStream", {
        get: function() {
          return WriteStream;
        },
        set: function(val) {
          WriteStream = val;
        },
        enumerable: true,
        configurable: true
      });
      var FileReadStream = ReadStream;
      Object.defineProperty(fs8, "FileReadStream", {
        get: function() {
          return FileReadStream;
        },
        set: function(val) {
          FileReadStream = val;
        },
        enumerable: true,
        configurable: true
      });
      var FileWriteStream = WriteStream;
      Object.defineProperty(fs8, "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 fs8.ReadStream(path18, options2);
      }
      function createWriteStream2(path18, options2) {
        return new fs8.WriteStream(path18, options2);
      }
      var fs$open = fs8.open;
      fs8.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 fs8;
    }
    function enqueue(elem) {
      debug("ENQUEUE", elem[0].name, elem[1]);
      fs7[gracefulQueue].push(elem);
      retry();
    }
    var retryTimer;
    function resetQueue() {
      var now = Date.now();
      for (var i = 0; i < fs7[gracefulQueue].length; ++i) {
        if (fs7[gracefulQueue][i].length > 2) {
          fs7[gracefulQueue][i][3] = now;
          fs7[gracefulQueue][i][4] = now;
        }
      }
      retry();
    }
    function retry() {
      clearTimeout(retryTimer);
      retryTimer = void 0;
      if (fs7[gracefulQueue].length === 0)
        return;
      var elem = fs7[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 {
          fs7[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"(exports2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var fs7 = 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 fs7[key] === "function";
    });
    Object.keys(fs7).forEach((key) => {
      if (key === "promises") {
        return;
      }
      exports2[key] = fs7[key];
    });
    api.forEach((method) => {
      exports2[method] = u(fs7[method]);
    });
    exports2.exists = function(filename, callback) {
      if (typeof callback === "function") {
        return fs7.exists(filename, callback);
      }
      return new Promise((resolve9) => {
        return fs7.exists(filename, resolve9);
      });
    };
    exports2.read = function(fd, buffer, offset, length, position, callback) {
      if (typeof callback === "function") {
        return fs7.read(fd, buffer, offset, length, position, callback);
      }
      return new Promise((resolve9, reject) => {
        fs7.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
          if (err) return reject(err);
          resolve9({ bytesRead, buffer: buffer2 });
        });
      });
    };
    exports2.write = function(fd, buffer, ...args) {
      if (typeof args[args.length - 1] === "function") {
        return fs7.write(fd, buffer, ...args);
      }
      return new Promise((resolve9, reject) => {
        fs7.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
          if (err) return reject(err);
          resolve9({ bytesWritten, buffer: buffer2 });
        });
      });
    };
    if (typeof fs7.realpath.native === "function") {
      exports2.realpath.native = u(fs7.realpath.native);
    }
  }
});

// node_modules/fs-extra/lib/mkdirs/win32.js
var require_win32 = __commonJS({
  "node_modules/fs-extra/lib/mkdirs/win32.js"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = 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 || fs7;
      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;
          // In the case of any other error, just see if there's a dir
          // there already.  If so, then hooray!  If not, then something
          // is borked.
          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"(exports2, module2) {
    "use strict";
    var fs7 = 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 || fs7;
      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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var mkdirs = u(require_mkdirs());
    var mkdirsSync = require_mkdirs_sync();
    module2.exports = {
      mkdirs,
      mkdirsSync,
      // alias
      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"(exports2, module2) {
    "use strict";
    var fs7 = require_graceful_fs();
    var os5 = 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(os5.tmpdir(), tmpfile);
      const d = /* @__PURE__ */ new Date(1435410243862);
      fs7.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
      const fd = fs7.openSync(tmpfile, "r+");
      fs7.futimesSync(fd, d, d);
      fs7.closeSync(fd);
      return fs7.statSync(tmpfile).mtime > 1435410243e3;
    }
    function hasMillisRes(callback) {
      let tmpfile = path18.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
      tmpfile = path18.join(os5.tmpdir(), tmpfile);
      const d = /* @__PURE__ */ new Date(1435410243862);
      fs7.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
        if (err) return callback(err);
        fs7.open(tmpfile, "r+", (err2, fd) => {
          if (err2) return callback(err2);
          fs7.futimes(fd, d, d, (err3) => {
            if (err3) return callback(err3);
            fs7.close(fd, (err4) => {
              if (err4) return callback(err4);
              fs7.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) {
      fs7.open(path19, "r+", (err, fd) => {
        if (err) return callback(err);
        fs7.futimes(fd, atime, mtime, (futimesErr) => {
          fs7.close(fd, (closeErr) => {
            if (callback) callback(futimesErr || closeErr);
          });
        });
      });
    }
    function utimesMillisSync(path19, atime, mtime) {
      const fd = fs7.openSync(path19, "r+");
      fs7.futimesSync(fd, atime, mtime);
      return fs7.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"(exports2, module2) {
    "use strict";
    var fs7 = 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()) {
        fs7.stat(src, { bigint: true }, (err, srcStat) => {
          if (err) return cb(err);
          fs7.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 {
        fs7.stat(src, (err, srcStat) => {
          if (err) return cb(err);
          fs7.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 = fs7.statSync(src, { bigint: true });
      } else {
        srcStat = fs7.statSync(src);
      }
      try {
        if (nodeSupportsBigInt()) {
          destStat = fs7.statSync(dest, { bigint: true });
        } else {
          destStat = fs7.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()) {
        fs7.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 {
        fs7.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 = fs7.statSync(destParent, { bigint: true });
        } else {
          destStat = fs7.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"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = 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 (!fs7.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 ? fs7.statSync : fs7.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) {
        fs7.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 fs7.copyFileSync === "function") {
        fs7.copyFileSync(src, dest);
        fs7.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 = fs7.openSync(src, "r");
      const fdw = fs7.openSync(dest, "w", srcStat.mode);
      let pos = 0;
      while (pos < srcStat.size) {
        const bytesRead = fs7.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
        fs7.writeSync(fdw, _buff, 0, bytesRead);
        pos += bytesRead;
      }
      if (opts.preserveTimestamps) fs7.futimesSync(fdw, srcStat.atime, srcStat.mtime);
      fs7.closeSync(fdr);
      fs7.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) {
      fs7.mkdirSync(dest);
      copyDir(src, dest, opts);
      return fs7.chmodSync(dest, srcStat.mode);
    }
    function copyDir(src, dest, opts) {
      fs7.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 = fs7.readlinkSync(src);
      if (opts.dereference) {
        resolvedSrc = path18.resolve(process.cwd(), resolvedSrc);
      }
      if (!destStat) {
        return fs7.symlinkSync(resolvedSrc, dest);
      } else {
        let resolvedDest;
        try {
          resolvedDest = fs7.readlinkSync(dest);
        } catch (err) {
          if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs7.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 (fs7.statSync(dest).isDirectory() && stat2.isSrcSubdir(resolvedDest, resolvedSrc)) {
          throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
        }
        return copyLink(resolvedSrc, dest);
      }
    }
    function copyLink(resolvedSrc, dest) {
      fs7.unlinkSync(dest);
      return fs7.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"(exports2, 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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromPromise;
    var fs7 = require_fs();
    function pathExists7(path18) {
      return fs7.access(path18).then(() => true).catch(() => false);
    }
    module2.exports = {
      pathExists: u(pathExists7),
      pathExistsSync: fs7.existsSync
    };
  }
});

// node_modules/fs-extra/lib/copy/copy.js
var require_copy = __commonJS({
  "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
    "use strict";
    var fs7 = 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 ? fs7.stat : fs7.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) {
        fs7.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 fs7.copyFile === "function") {
        return fs7.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 = fs7.createReadStream(src);
      rs.on("error", (err) => cb(err)).once("open", () => {
        const ws = fs7.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) {
      fs7.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) {
      fs7.mkdir(dest, (err) => {
        if (err) return cb(err);
        copyDir(src, dest, opts, (err2) => {
          if (err2) return cb(err2);
          return fs7.chmod(dest, srcStat.mode, cb);
        });
      });
    }
    function copyDir(src, dest, opts, cb) {
      fs7.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) {
      fs7.readlink(src, (err, resolvedSrc) => {
        if (err) return cb(err);
        if (opts.dereference) {
          resolvedSrc = path18.resolve(process.cwd(), resolvedSrc);
        }
        if (!destStat) {
          return fs7.symlink(resolvedSrc, dest, cb);
        } else {
          fs7.readlink(dest, (err2, resolvedDest) => {
            if (err2) {
              if (err2.code === "EINVAL" || err2.code === "UNKNOWN") return fs7.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) {
      fs7.unlink(dest, (err) => {
        if (err) return cb(err);
        return fs7.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"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = 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] || fs7[m];
        m = m + "Sync";
        options2[m] = options2[m] || fs7[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"(exports2, 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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var fs7 = require_graceful_fs();
    var path18 = require("path");
    var mkdir = require_mkdirs2();
    var remove2 = require_remove();
    var emptyDir = u(function emptyDir2(dir, callback) {
      callback = callback || function() {
      };
      fs7.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();
          remove2.remove(item, (err2) => {
            if (err2) return callback(err2);
            deleteItem();
          });
        }
      });
    });
    function emptyDirSync(dir) {
      let items;
      try {
        items = fs7.readdirSync(dir);
      } catch (err) {
        return mkdir.mkdirsSync(dir);
      }
      items.forEach((item) => {
        item = path18.join(dir, item);
        remove2.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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var path18 = require("path");
    var fs7 = require_graceful_fs();
    var mkdir = require_mkdirs2();
    var pathExists7 = require_path_exists().pathExists;
    function createFile(file, callback) {
      function makeFile() {
        fs7.writeFile(file, "", (err) => {
          if (err) return callback(err);
          callback();
        });
      }
      fs7.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 = fs7.statSync(file);
      } catch (e) {
      }
      if (stats && stats.isFile()) return;
      const dir = path18.dirname(file);
      if (!fs7.existsSync(dir)) {
        mkdir.mkdirsSync(dir);
      }
      fs7.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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var path18 = require("path");
    var fs7 = require_graceful_fs();
    var mkdir = require_mkdirs2();
    var pathExists7 = require_path_exists().pathExists;
    function createLink(srcpath, dstpath, callback) {
      function makeLink(srcpath2, dstpath2) {
        fs7.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);
        fs7.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 = fs7.existsSync(dstpath);
      if (destinationExists) return void 0;
      try {
        fs7.lstatSync(srcpath);
      } catch (err) {
        err.message = err.message.replace("lstat", "ensureLink");
        throw err;
      }
      const dir = path18.dirname(dstpath);
      const dirExists = fs7.existsSync(dir);
      if (dirExists) return fs7.linkSync(srcpath, dstpath);
      mkdir.mkdirsSync(dir);
      return fs7.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"(exports2, module2) {
    "use strict";
    var path18 = require("path");
    var fs7 = require_graceful_fs();
    var pathExists7 = require_path_exists().pathExists;
    function symlinkPaths(srcpath, dstpath, callback) {
      if (path18.isAbsolute(srcpath)) {
        return fs7.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 fs7.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 = fs7.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 = fs7.existsSync(relativeToDst);
        if (exists) {
          return {
            "toCwd": relativeToDst,
            "toDst": srcpath
          };
        } else {
          exists = fs7.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"(exports2, module2) {
    "use strict";
    var fs7 = 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);
      fs7.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 = fs7.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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var path18 = require("path");
    var fs7 = 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 fs7.symlink(srcpath, dstpath, type2, callback);
              mkdirs(dir, (err5) => {
                if (err5) return callback(err5);
                fs7.symlink(srcpath, dstpath, type2, callback);
              });
            });
          });
        });
      });
    }
    function createSymlinkSync(srcpath, dstpath, type) {
      const destinationExists = fs7.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 = fs7.existsSync(dir);
      if (exists) return fs7.symlinkSync(srcpath, dstpath, type);
      mkdirsSync(dir);
      return fs7.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"(exports2, module2) {
    "use strict";
    var file = require_file();
    var link = require_link();
    var symlink = require_symlink();
    module2.exports = {
      // file
      createFile: file.createFile,
      createFileSync: file.createFileSync,
      ensureFile: file.createFile,
      ensureFileSync: file.createFileSync,
      // link
      createLink: link.createLink,
      createLinkSync: link.createLinkSync,
      ensureLink: link.createLink,
      ensureLinkSync: link.createLinkSync,
      // symlink
      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"(exports2, 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 fs7 = options2.fs || _fs;
      var shouldThrow = true;
      if ("throws" in options2) {
        shouldThrow = options2.throws;
      }
      fs7.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 readFileSync2(file, options2) {
      options2 = options2 || {};
      if (typeof options2 === "string") {
        options2 = { encoding: options2 };
      }
      var fs7 = options2.fs || _fs;
      var shouldThrow = true;
      if ("throws" in options2) {
        shouldThrow = options2.throws;
      }
      try {
        var content = fs7.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 EOL = "\n";
      if (typeof options2 === "object" && options2 !== null) {
        if (options2.spaces) {
          spaces = options2.spaces;
        }
        if (options2.EOL) {
          EOL = options2.EOL;
        }
      }
      var str = JSON.stringify(obj, options2 ? options2.replacer : null, spaces);
      return str.replace(/\n/g, EOL) + EOL;
    }
    function writeFile2(file, obj, options2, callback) {
      if (callback == null) {
        callback = options2;
        options2 = {};
      }
      options2 = options2 || {};
      var fs7 = options2.fs || _fs;
      var str = "";
      try {
        str = stringify(obj, options2);
      } catch (err) {
        if (callback) callback(err, null);
        return;
      }
      fs7.writeFile(file, str, options2, callback);
    }
    function writeFileSync(file, obj, options2) {
      options2 = options2 || {};
      var fs7 = options2.fs || _fs;
      var str = stringify(obj, options2);
      return fs7.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: readFileSync2,
      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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var jsonFile = require_jsonfile();
    module2.exports = {
      // jsonfile 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"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = 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 (!fs7.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"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = require_graceful_fs();
    var path18 = require("path");
    var copySync = require_copy_sync2().copySync;
    var removeSync2 = 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) {
        removeSync2(dest);
        return rename2(src, dest, overwrite);
      }
      if (fs7.existsSync(dest)) throw new Error("dest already exists.");
      return rename2(src, dest, overwrite);
    }
    function rename2(src, dest, overwrite) {
      try {
        fs7.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 removeSync2(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"(exports2, 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"(exports2, module2) {
    "use strict";
    var fs7 = require_graceful_fs();
    var path18 = require("path");
    var copy = require_copy2().copy;
    var remove2 = 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 remove2(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) {
      fs7.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 remove2(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"(exports2, 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"(exports2, module2) {
    "use strict";
    var u = require_universalify().fromCallback;
    var fs7 = 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 fs7.writeFile(file, data, encoding, callback);
        mkdir.mkdirs(dir, (err2) => {
          if (err2) return callback(err2);
          fs7.writeFile(file, data, encoding, callback);
        });
      });
    }
    function outputFileSync(file, ...args) {
      const dir = path18.dirname(file);
      if (fs7.existsSync(dir)) {
        return fs7.writeFileSync(file, ...args);
      }
      mkdir.mkdirsSync(dir);
      fs7.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"(exports2, module2) {
    "use strict";
    module2.exports = Object.assign(
      {},
      // Export promiseified graceful-fs:
      require_fs(),
      // Export extra methods:
      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 fs7 = require("fs");
    if (Object.getOwnPropertyDescriptor(fs7, "promises")) {
      Object.defineProperty(module2.exports, "promises", {
        get() {
          return fs7.promises;
        }
      });
    }
  }
});

// node_modules/semver/internal/constants.js
var require_constants = __commonJS({
  "node_modules/semver/internal/constants.js"(exports2, module2) {
    "use strict";
    var SEMVER_SPEC_VERSION = "2.0.0";
    var MAX_LENGTH = 256;
    var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
    9007199254740991;
    var MAX_SAFE_COMPONENT_LENGTH = 16;
    var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
    var RELEASE_TYPES = [
      "major",
      "premajor",
      "minor",
      "preminor",
      "patch",
      "prepatch",
      "prerelease"
    ];
    module2.exports = {
      MAX_LENGTH,
      MAX_SAFE_COMPONENT_LENGTH,
      MAX_SAFE_BUILD_LENGTH,
      MAX_SAFE_INTEGER,
      RELEASE_TYPES,
      SEMVER_SPEC_VERSION,
      FLAG_INCLUDE_PRERELEASE: 1,
      FLAG_LOOSE: 2
    };
  }
});

// node_modules/semver/internal/debug.js
var require_debug = __commonJS({
  "node_modules/semver/internal/debug.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var {
      MAX_SAFE_COMPONENT_LENGTH,
      MAX_SAFE_BUILD_LENGTH,
      MAX_LENGTH
    } = require_constants();
    var debug = require_debug();
    exports2 = module2.exports = {};
    var re = exports2.re = [];
    var safeRe = exports2.safeRe = [];
    var src = exports2.src = [];
    var safeSrc = exports2.safeSrc = [];
    var t = exports2.t = {};
    var R = 0;
    var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
    var safeRegexReplacements = [
      ["\\s", 1],
      ["\\d", MAX_LENGTH],
      [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
    ];
    var makeSafeRegex = (value) => {
      for (const [token, max] of safeRegexReplacements) {
        value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
      }
      return value;
    };
    var createToken = (name, value, isGlobal) => {
      const safe = makeSafeRegex(value);
      const index = R++;
      debug(name, index, value);
      t[name] = index;
      src[index] = value;
      safeSrc[index] = safe;
      re[index] = new RegExp(value, isGlobal ? "g" : void 0);
      safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
    };
    createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
    createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
    createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
    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.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
    createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
    createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
    createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
    createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
    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("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
    createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
    createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
    createToken("COERCERTL", src[t.COERCE], true);
    createToken("COERCERTLFULL", src[t.COERCEFULL], true);
    createToken("LONETILDE", "(?:~>?)");
    createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
    exports2.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);
    exports2.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);
    exports2.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"(exports2, module2) {
    "use strict";
    var looseOption = Object.freeze({ loose: true });
    var emptyOpts = Object.freeze({});
    var parseOptions = (options2) => {
      if (!options2) {
        return emptyOpts;
      }
      if (typeof options2 !== "object") {
        return looseOption;
      }
      return options2;
    };
    module2.exports = parseOptions;
  }
});

// node_modules/semver/internal/identifiers.js
var require_identifiers = __commonJS({
  "node_modules/semver/internal/identifiers.js"(exports2, module2) {
    "use strict";
    var numeric = /^[0-9]+$/;
    var compareIdentifiers = (a, b) => {
      if (typeof a === "number" && typeof b === "number") {
        return a === b ? 0 : a < b ? -1 : 1;
      }
      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"(exports2, module2) {
    "use strict";
    var debug = require_debug();
    var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
    var { safeRe: re, t } = require_re();
    var parseOptions = require_parse_options();
    var { compareIdentifiers } = require_identifiers();
    var SemVer = class _SemVer {
      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. Must be a string. Got type "${typeof 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);
        }
        if (this.major < other.major) {
          return -1;
        }
        if (this.major > other.major) {
          return 1;
        }
        if (this.minor < other.minor) {
          return -1;
        }
        if (this.minor > other.minor) {
          return 1;
        }
        if (this.patch < other.patch) {
          return -1;
        }
        if (this.patch > other.patch) {
          return 1;
        }
        return 0;
      }
      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("build 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);
      }
      // preminor will bump the version up to the next minor release, and immediately
      // down to pre-release. premajor and prepatch work the same way.
      inc(release2, identifier, identifierBase) {
        if (release2.startsWith("pre")) {
          if (!identifier && identifierBase === false) {
            throw new Error("invalid increment argument: identifier is empty");
          }
          if (identifier) {
            const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
            if (!match || match[1] !== identifier) {
              throw new Error(`invalid identifier: ${identifier}`);
            }
          }
        }
        switch (release2) {
          case "premajor":
            this.prerelease.length = 0;
            this.patch = 0;
            this.minor = 0;
            this.major++;
            this.inc("pre", identifier, identifierBase);
            break;
          case "preminor":
            this.prerelease.length = 0;
            this.patch = 0;
            this.minor++;
            this.inc("pre", identifier, identifierBase);
            break;
          case "prepatch":
            this.prerelease.length = 0;
            this.inc("patch", identifier, identifierBase);
            this.inc("pre", identifier, identifierBase);
            break;
          // If the input is a non-prerelease version, this acts the same as
          // prepatch.
          case "prerelease":
            if (this.prerelease.length === 0) {
              this.inc("patch", identifier, identifierBase);
            }
            this.inc("pre", identifier, identifierBase);
            break;
          case "release":
            if (this.prerelease.length === 0) {
              throw new Error(`version ${this.raw} is not a prerelease`);
            }
            this.prerelease.length = 0;
            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;
          // This probably shouldn't be used publicly.
          // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
          case "pre": {
            const base = Number(identifierBase) ? 1 : 0;
            if (this.prerelease.length === 0) {
              this.prerelease = [base];
            } else {
              let i = this.prerelease.length;
              while (--i >= 0) {
                if (typeof this.prerelease[i] === "number") {
                  this.prerelease[i]++;
                  i = -2;
                }
              }
              if (i === -1) {
                if (identifier === this.prerelease.join(".") && identifierBase === false) {
                  throw new Error("invalid increment argument: identifier already exists");
                }
                this.prerelease.push(base);
              }
            }
            if (identifier) {
              let prerelease = [identifier, base];
              if (identifierBase === false) {
                prerelease = [identifier];
              }
              if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
                if (isNaN(this.prerelease[1])) {
                  this.prerelease = prerelease;
                }
              } else {
                this.prerelease = prerelease;
              }
            }
            break;
          }
          default:
            throw new Error(`invalid increment argument: ${release2}`);
        }
        this.raw = this.format();
        if (this.build.length) {
          this.raw += `+${this.build.join(".")}`;
        }
        return this;
      }
    };
    module2.exports = SemVer;
  }
});

// node_modules/semver/functions/parse.js
var require_parse = __commonJS({
  "node_modules/semver/functions/parse.js"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var parse = (version, options2, throwErrors = false) => {
      if (version instanceof SemVer) {
        return version;
      }
      try {
        return new SemVer(version, options2);
      } catch (er) {
        if (!throwErrors) {
          return null;
        }
        throw er;
      }
    };
    module2.exports = parse;
  }
});

// node_modules/semver/functions/valid.js
var require_valid = __commonJS({
  "node_modules/semver/functions/valid.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var inc = (version, release2, options2, identifier, identifierBase) => {
      if (typeof options2 === "string") {
        identifierBase = identifier;
        identifier = options2;
        options2 = void 0;
      }
      try {
        return new SemVer(
          version instanceof SemVer ? version.version : version,
          options2
        ).inc(release2, identifier, identifierBase).version;
      } catch (er) {
        return null;
      }
    };
    module2.exports = inc;
  }
});

// node_modules/semver/functions/diff.js
var require_diff = __commonJS({
  "node_modules/semver/functions/diff.js"(exports2, module2) {
    "use strict";
    var parse = require_parse();
    var diff = (version1, version2) => {
      const v1 = parse(version1, null, true);
      const v2 = parse(version2, null, true);
      const comparison = v1.compare(v2);
      if (comparison === 0) {
        return null;
      }
      const v1Higher = comparison > 0;
      const highVersion = v1Higher ? v1 : v2;
      const lowVersion = v1Higher ? v2 : v1;
      const highHasPre = !!highVersion.prerelease.length;
      const lowHasPre = !!lowVersion.prerelease.length;
      if (lowHasPre && !highHasPre) {
        if (!lowVersion.patch && !lowVersion.minor) {
          return "major";
        }
        if (lowVersion.compareMain(highVersion) === 0) {
          if (lowVersion.minor && !lowVersion.patch) {
            return "minor";
          }
          return "patch";
        }
      }
      const prefix = highHasPre ? "pre" : "";
      if (v1.major !== v2.major) {
        return prefix + "major";
      }
      if (v1.minor !== v2.minor) {
        return prefix + "minor";
      }
      if (v1.patch !== v2.patch) {
        return prefix + "patch";
      }
      return "prerelease";
    };
    module2.exports = diff;
  }
});

// node_modules/semver/functions/major.js
var require_major = __commonJS({
  "node_modules/semver/functions/major.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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/compare.js
var require_compare = __commonJS({
  "node_modules/semver/functions/compare.js"(exports2, module2) {
    "use strict";
    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/rcompare.js
var require_rcompare = __commonJS({
  "node_modules/semver/functions/rcompare.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var compare = require_compare();
    var lt2 = (a, b, loose) => compare(a, b, loose) < 0;
    module2.exports = lt2;
  }
});

// node_modules/semver/functions/eq.js
var require_eq = __commonJS({
  "node_modules/semver/functions/eq.js"(exports2, module2) {
    "use strict";
    var compare = require_compare();
    var eq = (a, b, loose) => compare(a, b, loose) === 0;
    module2.exports = eq;
  }
});

// node_modules/semver/functions/neq.js
var require_neq = __commonJS({
  "node_modules/semver/functions/neq.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var eq = require_eq();
    var neq = require_neq();
    var gt = require_gt();
    var gte2 = require_gte();
    var lt2 = 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 lt2(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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var parse = require_parse();
    var { safeRe: 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(options2.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
      } else {
        const coerceRtlRegex = options2.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
        let next;
        while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
          if (!match || next.index + next[0].length !== match.index + match[0].length) {
            match = next;
          }
          coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
        }
        coerceRtlRegex.lastIndex = -1;
      }
      if (match === null) {
        return null;
      }
      const major = match[2];
      const minor = match[3] || "0";
      const patch = match[4] || "0";
      const prerelease = options2.includePrerelease && match[5] ? `-${match[5]}` : "";
      const build = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
      return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options2);
    };
    module2.exports = coerce;
  }
});

// node_modules/semver/functions/truncate.js
var require_truncate = __commonJS({
  "node_modules/semver/functions/truncate.js"(exports2, module2) {
    "use strict";
    var parse = require_parse();
    var constants = require_constants();
    var SemVer = require_semver();
    var truncate = (version, truncation, options2) => {
      if (!constants.RELEASE_TYPES.includes(truncation)) {
        return null;
      }
      const clonedVersion = cloneInputVersion(version, options2);
      return clonedVersion && doTruncation(clonedVersion, truncation);
    };
    var cloneInputVersion = (version, options2) => {
      const versionStringToParse = version instanceof SemVer ? version.version : version;
      return parse(versionStringToParse, options2);
    };
    var doTruncation = (version, truncation) => {
      if (isPrerelease(truncation)) {
        return version.version;
      }
      version.prerelease = [];
      switch (truncation) {
        case "major":
          version.minor = 0;
          version.patch = 0;
          break;
        case "minor":
          version.patch = 0;
          break;
      }
      return version.format();
    };
    var isPrerelease = (type) => {
      return type.startsWith("pre");
    };
    module2.exports = truncate;
  }
});

// node_modules/semver/internal/lrucache.js
var require_lrucache = __commonJS({
  "node_modules/semver/internal/lrucache.js"(exports2, module2) {
    "use strict";
    var LRUCache = class {
      constructor() {
        this.max = 1e3;
        this.map = /* @__PURE__ */ new Map();
      }
      get(key) {
        const value = this.map.get(key);
        if (value === void 0) {
          return void 0;
        } else {
          this.map.delete(key);
          this.map.set(key, value);
          return value;
        }
      }
      delete(key) {
        return this.map.delete(key);
      }
      set(key, value) {
        const deleted = this.delete(key);
        if (!deleted && value !== void 0) {
          if (this.map.size >= this.max) {
            const firstKey = this.map.keys().next().value;
            this.delete(firstKey);
          }
          this.map.set(key, value);
        }
        return this;
      }
    };
    module2.exports = LRUCache;
  }
});

// node_modules/semver/classes/range.js
var require_range = __commonJS({
  "node_modules/semver/classes/range.js"(exports2, module2) {
    "use strict";
    var SPACE_CHARACTERS = /\s+/g;
    var Range10 = class _Range {
      constructor(range, options2) {
        options2 = parseOptions(options2);
        if (range instanceof _Range) {
          if (range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease) {
            return range;
          } else {
            return new _Range(range.raw, options2);
          }
        }
        if (range instanceof Comparator) {
          this.raw = range.value;
          this.set = [[range]];
          this.formatted = void 0;
          return this;
        }
        this.options = options2;
        this.loose = !!options2.loose;
        this.includePrerelease = !!options2.includePrerelease;
        this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
        this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
        if (!this.set.length) {
          throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
        }
        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.formatted = void 0;
      }
      get range() {
        if (this.formatted === void 0) {
          this.formatted = "";
          for (let i = 0; i < this.set.length; i++) {
            if (i > 0) {
              this.formatted += "||";
            }
            const comps = this.set[i];
            for (let k = 0; k < comps.length; k++) {
              if (k > 0) {
                this.formatted += " ";
              }
              this.formatted += comps[k].toString().trim();
            }
          }
        }
        return this.formatted;
      }
      format() {
        return this.range;
      }
      toString() {
        return this.range;
      }
      parseRange(range) {
        range = range.replace(BUILDSTRIPRE, "");
        const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
        const memoKey = 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);
        debug("tilde trim", range);
        range = range.replace(re[t.CARETTRIM], caretTrimReplace);
        debug("caret trim", range);
        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 _Range)) {
          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);
              });
            });
          });
        });
      }
      // if ANY of the sets match ALL of its comparators, then pass
      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 = Range10;
    var LRU = require_lrucache();
    var cache = new LRU();
    var parseOptions = require_parse_options();
    var Comparator = require_comparator();
    var debug = require_debug();
    var SemVer = require_semver();
    var {
      safeRe: re,
      src,
      t,
      comparatorTrimReplace,
      tildeTrimReplace,
      caretTrimReplace
    } = require_re();
    var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
    var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
    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) => {
      comp = comp.replace(re[t.BUILD], "");
      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) => {
      return comp.trim().split(/\s+/).map((c) => 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) => {
      return comp.trim().split(/\s+/).map((c) => 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) => 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) => {
      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"(exports2, module2) {
    "use strict";
    var ANY = Symbol("SemVer ANY");
    var Comparator = class _Comparator {
      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;
          }
        }
        comp = comp.trim().split(/\s+/).join(" ");
        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 (this.operator === "") {
          if (this.value === "") {
            return true;
          }
          return new Range10(comp.value, options2).test(this.value);
        } else if (comp.operator === "") {
          if (comp.value === "") {
            return true;
          }
          return new Range10(this.value, options2).test(comp.semver);
        }
        options2 = parseOptions(options2);
        if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
          return false;
        }
        if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
          return false;
        }
        if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
          return true;
        }
        if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
          return true;
        }
        if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
          return true;
        }
        if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
          return true;
        }
        if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
          return true;
        }
        return false;
      }
    };
    module2.exports = Comparator;
    var parseOptions = require_parse_options();
    var { safeRe: re, t } = require_re();
    var cmp = require_cmp();
    var debug = require_debug();
    var SemVer = require_semver();
    var Range10 = require_range();
  }
});

// node_modules/semver/functions/satisfies.js
var require_satisfies = __commonJS({
  "node_modules/semver/functions/satisfies.js"(exports2, module2) {
    "use strict";
    var Range10 = require_range();
    var satisfies = (version, range, options2) => {
      try {
        range = new Range10(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"(exports2, module2) {
    "use strict";
    var Range10 = require_range();
    var toComparators = (range, options2) => new Range10(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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var Range10 = require_range();
    var maxSatisfying = (versions, range, options2) => {
      let max = null;
      let maxSV = null;
      let rangeObj = null;
      try {
        rangeObj = new Range10(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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var Range10 = require_range();
    var minSatisfying = (versions, range, options2) => {
      let min = null;
      let minSV = null;
      let rangeObj = null;
      try {
        rangeObj = new Range10(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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var Range10 = require_range();
    var gt = require_gt();
    var minVersion = (range, loose) => {
      range = new Range10(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();
            /* fallthrough */
            case "":
            case ">=":
              if (!setMin || gt(compver, setMin)) {
                setMin = compver;
              }
              break;
            case "<":
            case "<=":
              break;
            /* istanbul ignore next */
            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"(exports2, module2) {
    "use strict";
    var Range10 = require_range();
    var validRange = (range, options2) => {
      try {
        return new Range10(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"(exports2, module2) {
    "use strict";
    var SemVer = require_semver();
    var Comparator = require_comparator();
    var { ANY } = Comparator;
    var Range10 = require_range();
    var satisfies = require_satisfies();
    var gt = require_gt();
    var lt2 = require_lt();
    var lte = require_lte();
    var gte2 = require_gte();
    var outside = (version, range, hilo, options2) => {
      version = new SemVer(version, options2);
      range = new Range10(range, options2);
      let gtfn, ltefn, ltfn, comp, ecomp;
      switch (hilo) {
        case ">":
          gtfn = gt;
          ltefn = lte;
          ltfn = lt2;
          comp = ">";
          ecomp = ">=";
          break;
        case "<":
          gtfn = lt2;
          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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var Range10 = require_range();
    var intersects = (r1, r2, options2) => {
      r1 = new Range10(r1, options2);
      r2 = new Range10(r2, options2);
      return r1.intersects(r2, options2);
    };
    module2.exports = intersects;
  }
});

// node_modules/semver/ranges/simplify.js
var require_simplify = __commonJS({
  "node_modules/semver/ranges/simplify.js"(exports2, module2) {
    "use strict";
    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"(exports2, module2) {
    "use strict";
    var Range10 = 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 Range10(sub, options2);
      dom = new Range10(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 minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
    var minimumVersion = [new Comparator(">=0.0.0")];
    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 = minimumVersionWithPreRelease;
        } else {
          sub = minimumVersion;
        }
      }
      if (dom.length === 1 && dom[0].semver === ANY) {
        if (options2.includePrerelease) {
          return true;
        } else {
          dom = minimumVersion;
        }
      }
      const eqSet = /* @__PURE__ */ new Set();
      let gt, lt2;
      for (const c of sub) {
        if (c.operator === ">" || c.operator === ">=") {
          gt = higherGT(gt, c, options2);
        } else if (c.operator === "<" || c.operator === "<=") {
          lt2 = lowerLT(lt2, c, options2);
        } else {
          eqSet.add(c.semver);
        }
      }
      if (eqSet.size > 1) {
        return null;
      }
      let gtltComp;
      if (gt && lt2) {
        gtltComp = compare(gt.semver, lt2.semver, options2);
        if (gtltComp > 0) {
          return null;
        } else if (gtltComp === 0 && (gt.operator !== ">=" || lt2.operator !== "<=")) {
          return null;
        }
      }
      for (const eq of eqSet) {
        if (gt && !satisfies(eq, String(gt), options2)) {
          return null;
        }
        if (lt2 && !satisfies(eq, String(lt2), 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 = lt2 && !options2.includePrerelease && lt2.semver.prerelease.length ? lt2.semver : false;
      let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
      if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt2.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 === ">=" && !c.test(gt.semver)) {
            return false;
          }
        }
        if (lt2) {
          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(lt2, c, options2);
            if (lower === c && lower !== lt2) {
              return false;
            }
          } else if (lt2.operator === "<=" && !c.test(lt2.semver)) {
            return false;
          }
        }
        if (!c.operator && (lt2 || gt) && gtltComp !== 0) {
          return false;
        }
      }
      if (gt && hasDomLT && !lt2 && gtltComp !== 0) {
        return false;
      }
      if (lt2 && 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"(exports2, module2) {
    "use strict";
    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 lt2 = 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 truncate = require_truncate();
    var Comparator = require_comparator();
    var Range10 = 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: lt2,
      eq,
      neq,
      gte: gte2,
      lte,
      cmp,
      coerce,
      truncate,
      Comparator,
      Range: Range10,
      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,
      RELEASE_TYPES: constants.RELEASE_TYPES,
      compareIdentifiers: identifiers.compareIdentifiers,
      rcompareIdentifiers: identifiers.rcompareIdentifiers
    };
  }
});

// node_modules/vscode-jsonrpc/lib/common/is.js
var require_is = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/is.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
    function boolean(value) {
      return value === true || value === false;
    }
    exports2.boolean = boolean;
    function string(value) {
      return typeof value === "string" || value instanceof String;
    }
    exports2.string = string;
    function number(value) {
      return typeof value === "number" || value instanceof Number;
    }
    exports2.number = number;
    function error(value) {
      return value instanceof Error;
    }
    exports2.error = error;
    function func(value) {
      return typeof value === "function";
    }
    exports2.func = func;
    function array(value) {
      return Array.isArray(value);
    }
    exports2.array = array;
    function stringArray(value) {
      return array(value) && value.every((elem) => string(elem));
    }
    exports2.stringArray = stringArray;
  }
});

// node_modules/vscode-jsonrpc/lib/common/messages.js
var require_messages = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.Message = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
    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 || (exports2.ErrorCodes = ErrorCodes = {}));
    var ResponseError = class _ResponseError 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;
      }
    };
    exports2.ResponseError = ResponseError;
    var ParameterStructures = class _ParameterStructures {
      constructor(kind) {
        this.kind = kind;
      }
      static is(value) {
        return value === _ParameterStructures.auto || value === _ParameterStructures.byName || value === _ParameterStructures.byPosition;
      }
      toString() {
        return this.kind;
      }
    };
    exports2.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;
      }
    };
    exports2.AbstractMessageSignature = AbstractMessageSignature;
    var RequestType0 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 0);
      }
    };
    exports2.RequestType0 = RequestType0;
    var RequestType3 = class extends AbstractMessageSignature {
      constructor(method, _parameterStructures = ParameterStructures.auto) {
        super(method, 1);
        this._parameterStructures = _parameterStructures;
      }
      get parameterStructures() {
        return this._parameterStructures;
      }
    };
    exports2.RequestType = RequestType3;
    var RequestType1 = class extends AbstractMessageSignature {
      constructor(method, _parameterStructures = ParameterStructures.auto) {
        super(method, 1);
        this._parameterStructures = _parameterStructures;
      }
      get parameterStructures() {
        return this._parameterStructures;
      }
    };
    exports2.RequestType1 = RequestType1;
    var RequestType22 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 2);
      }
    };
    exports2.RequestType2 = RequestType22;
    var RequestType32 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 3);
      }
    };
    exports2.RequestType3 = RequestType32;
    var RequestType4 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 4);
      }
    };
    exports2.RequestType4 = RequestType4;
    var RequestType5 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 5);
      }
    };
    exports2.RequestType5 = RequestType5;
    var RequestType6 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 6);
      }
    };
    exports2.RequestType6 = RequestType6;
    var RequestType7 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 7);
      }
    };
    exports2.RequestType7 = RequestType7;
    var RequestType8 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 8);
      }
    };
    exports2.RequestType8 = RequestType8;
    var RequestType9 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 9);
      }
    };
    exports2.RequestType9 = RequestType9;
    var NotificationType2 = class extends AbstractMessageSignature {
      constructor(method, _parameterStructures = ParameterStructures.auto) {
        super(method, 1);
        this._parameterStructures = _parameterStructures;
      }
      get parameterStructures() {
        return this._parameterStructures;
      }
    };
    exports2.NotificationType = NotificationType2;
    var NotificationType0 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 0);
      }
    };
    exports2.NotificationType0 = NotificationType0;
    var NotificationType1 = class extends AbstractMessageSignature {
      constructor(method, _parameterStructures = ParameterStructures.auto) {
        super(method, 1);
        this._parameterStructures = _parameterStructures;
      }
      get parameterStructures() {
        return this._parameterStructures;
      }
    };
    exports2.NotificationType1 = NotificationType1;
    var NotificationType22 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 2);
      }
    };
    exports2.NotificationType2 = NotificationType22;
    var NotificationType3 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 3);
      }
    };
    exports2.NotificationType3 = NotificationType3;
    var NotificationType4 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 4);
      }
    };
    exports2.NotificationType4 = NotificationType4;
    var NotificationType5 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 5);
      }
    };
    exports2.NotificationType5 = NotificationType5;
    var NotificationType6 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 6);
      }
    };
    exports2.NotificationType6 = NotificationType6;
    var NotificationType7 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 7);
      }
    };
    exports2.NotificationType7 = NotificationType7;
    var NotificationType8 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 8);
      }
    };
    exports2.NotificationType8 = NotificationType8;
    var NotificationType9 = class extends AbstractMessageSignature {
      constructor(method) {
        super(method, 9);
      }
    };
    exports2.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 || (exports2.Message = Message2 = {}));
  }
});

// node_modules/vscode-jsonrpc/lib/common/linkedMap.js
var require_linkedMap = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) {
    "use strict";
    var _a;
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.LRUCache = exports2.LinkedMap = exports2.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 || (exports2.Touch = 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);
        }
      }
    };
    exports2.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));
        }
      }
    };
    exports2.LRUCache = LRUCache;
  }
});

// node_modules/vscode-jsonrpc/lib/common/disposable.js
var require_disposable = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.Disposable = void 0;
    var Disposable7;
    (function(Disposable8) {
      function create(func) {
        return {
          dispose: func
        };
      }
      Disposable8.create = create;
    })(Disposable7 || (exports2.Disposable = Disposable7 = {}));
  }
});

// node_modules/vscode-jsonrpc/lib/common/ral.js
var require_ral = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__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 = {}));
    exports2.default = RAL;
  }
});

// node_modules/vscode-jsonrpc/lib/common/events.js
var require_events = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/events.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.Emitter = exports2.Event = void 0;
    var ral_1 = require_ral();
    var Event3;
    (function(Event4) {
      const _disposable = { dispose() {
      } };
      Event4.None = function() {
        return _disposable;
      };
    })(Event3 || (exports2.Event = Event3 = {}));
    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 _Emitter {
      constructor(_options) {
        this._options = _options;
      }
      /**
       * For the public to allow to subscribe
       * to events from this Emitter
       */
      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 = _Emitter._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;
      }
      /**
       * To be kept private to fire an event to
       * subscribers
       */
      fire(event) {
        if (this._callbacks) {
          this._callbacks.invoke.call(this._callbacks, event);
        }
      }
      dispose() {
        if (this._callbacks) {
          this._callbacks.dispose();
          this._callbacks = void 0;
        }
      }
    };
    exports2.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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.CancellationTokenSource = exports2.CancellationToken = void 0;
    var ral_1 = require_ral();
    var Is = 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 || Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
      }
      CancellationToken10.is = is;
    })(CancellationToken9 || (exports2.CancellationToken = CancellationToken9 = {}));
    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();
        }
      }
    };
    exports2.CancellationTokenSource = CancellationTokenSource2;
  }
});

// node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js
var require_sharedArrayCancellation = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = void 0;
    var cancellation_1 = require_cancellation();
    var CancellationState;
    (function(CancellationState2) {
      CancellationState2.Continue = 0;
      CancellationState2.Cancelled = 1;
    })(CancellationState || (CancellationState = {}));
    var SharedArraySenderStrategy = class {
      constructor() {
        this.buffers = /* @__PURE__ */ new Map();
      }
      enableCancellation(request) {
        if (request.id === null) {
          return;
        }
        const buffer = new SharedArrayBuffer(4);
        const data = new Int32Array(buffer, 0, 1);
        data[0] = CancellationState.Continue;
        this.buffers.set(request.id, buffer);
        request.$cancellationData = buffer;
      }
      async sendCancellation(_conn, id) {
        const buffer = this.buffers.get(id);
        if (buffer === void 0) {
          return;
        }
        const data = new Int32Array(buffer, 0, 1);
        Atomics.store(data, 0, CancellationState.Cancelled);
      }
      cleanup(id) {
        this.buffers.delete(id);
      }
      dispose() {
        this.buffers.clear();
      }
    };
    exports2.SharedArraySenderStrategy = SharedArraySenderStrategy;
    var SharedArrayBufferCancellationToken = class {
      constructor(buffer) {
        this.data = new Int32Array(buffer, 0, 1);
      }
      get isCancellationRequested() {
        return Atomics.load(this.data, 0) === CancellationState.Cancelled;
      }
      get onCancellationRequested() {
        throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`);
      }
    };
    var SharedArrayBufferCancellationTokenSource = class {
      constructor(buffer) {
        this.token = new SharedArrayBufferCancellationToken(buffer);
      }
      cancel() {
      }
      dispose() {
      }
    };
    var SharedArrayReceiverStrategy = class {
      constructor() {
        this.kind = "request";
      }
      createCancellationTokenSource(request) {
        const buffer = request.$cancellationData;
        if (buffer === void 0) {
          return new cancellation_1.CancellationTokenSource();
        }
        return new SharedArrayBufferCancellationTokenSource(buffer);
      }
    };
    exports2.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;
  }
});

// node_modules/vscode-jsonrpc/lib/common/semaphore.js
var require_semaphore = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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();
        }
      }
    };
    exports2.Semaphore = Semaphore;
  }
});

// node_modules/vscode-jsonrpc/lib/common/messageReader.js
var require_messageReader = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0;
    var ral_1 = require_ral();
    var Is = require_is();
    var events_1 = require_events();
    var semaphore_1 = require_semaphore();
    var MessageReader;
    (function(MessageReader2) {
      function is(value) {
        let candidate = value;
        return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
      }
      MessageReader2.is = is;
    })(MessageReader || (exports2.MessageReader = 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: ${Is.string(error.message) ? error.message : "unknown"}`);
        }
      }
    };
    exports2.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;
        this.readSemaphore = new semaphore_1.Semaphore(1);
      }
      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) {
        try {
          this.buffer.append(data);
          while (true) {
            if (this.nextMessageLength === -1) {
              const headers = this.buffer.tryReadHeaders(true);
              if (!headers) {
                return;
              }
              const contentLength = headers.get("content-length");
              if (!contentLength) {
                this.fireError(new Error(`Header must provide a Content-Length property.
${JSON.stringify(Object.fromEntries(headers))}`));
                return;
              }
              const length = parseInt(contentLength);
              if (isNaN(length)) {
                this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`));
                return;
              }
              this.nextMessageLength = length;
            }
            const body = this.buffer.tryReadBody(this.nextMessageLength);
            if (body === void 0) {
              this.setPartialMessageTimer();
              return;
            }
            this.clearPartialMessageTimer();
            this.nextMessageLength = -1;
            this.readSemaphore.lock(async () => {
              const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body;
              const message = await this.options.contentTypeDecoder.decode(bytes, this.options);
              this.callback(message);
            }).catch((error) => {
              this.fireError(error);
            });
          }
        } catch (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);
      }
    };
    exports2.ReadableStreamMessageReader = ReadableStreamMessageReader;
  }
});

// node_modules/vscode-jsonrpc/lib/common/messageWriter.js
var require_messageWriter = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0;
    var ral_1 = require_ral();
    var Is = 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 && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write);
      }
      MessageWriter2.is = is;
    })(MessageWriter || (exports2.MessageWriter = 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: ${Is.string(error.message) ? error.message : "unknown"}`);
        }
      }
    };
    exports2.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();
      }
    };
    exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
  }
});

// node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
var require_messageBuffer = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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(lowerCaseKeys = false) {
        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 ':'
${header}`);
          }
          const key = header.substr(0, index);
          const value = header.substr(index + 1).trim();
          result.set(lowerCaseKeys ? key.toLowerCase() : 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;
      }
    };
    exports2.AbstractMessageBuffer = AbstractMessageBuffer;
  }
});

// node_modules/vscode-jsonrpc/lib/common/connection.js
var require_connection = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.createMessageConnection = exports2.ConnectionOptions = exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.RequestCancellationReceiverStrategy = exports2.IdCancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = exports2.NullLogger = exports2.ProgressType = exports2.ProgressToken = void 0;
    var ral_1 = require_ral();
    var Is = 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 || (exports2.ProgressToken = ProgressToken = {}));
    var ProgressNotification;
    (function(ProgressNotification2) {
      ProgressNotification2.type = new messages_1.NotificationType("$/progress");
    })(ProgressNotification || (ProgressNotification = {}));
    var ProgressType = class {
      constructor() {
      }
    };
    exports2.ProgressType = ProgressType;
    var StarRequestHandler;
    (function(StarRequestHandler2) {
      function is(value) {
        return Is.func(value);
      }
      StarRequestHandler2.is = is;
    })(StarRequestHandler || (StarRequestHandler = {}));
    exports2.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 || (exports2.Trace = Trace = {}));
    var TraceValues;
    (function(TraceValues2) {
      TraceValues2.Off = "off";
      TraceValues2.Messages = "messages";
      TraceValues2.Compact = "compact";
      TraceValues2.Verbose = "verbose";
    })(TraceValues || (exports2.TraceValues = TraceValues = {}));
    (function(Trace2) {
      function fromString(value) {
        if (!Is.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 || (exports2.Trace = Trace = {}));
    var TraceFormat;
    (function(TraceFormat2) {
      TraceFormat2["Text"] = "text";
      TraceFormat2["JSON"] = "json";
    })(TraceFormat || (exports2.TraceFormat = TraceFormat = {}));
    (function(TraceFormat2) {
      function fromString(value) {
        if (!Is.string(value)) {
          return TraceFormat2.Text;
        }
        value = value.toLowerCase();
        if (value === "json") {
          return TraceFormat2.JSON;
        } else {
          return TraceFormat2.Text;
        }
      }
      TraceFormat2.fromString = fromString;
    })(TraceFormat || (exports2.TraceFormat = TraceFormat = {}));
    var SetTraceNotification;
    (function(SetTraceNotification2) {
      SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace");
    })(SetTraceNotification || (exports2.SetTraceNotification = SetTraceNotification = {}));
    var LogTraceNotification;
    (function(LogTraceNotification2) {
      LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace");
    })(LogTraceNotification || (exports2.LogTraceNotification = LogTraceNotification = {}));
    var ConnectionErrors;
    (function(ConnectionErrors2) {
      ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed";
      ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed";
      ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
    })(ConnectionErrors || (exports2.ConnectionErrors = ConnectionErrors = {}));
    var ConnectionError = class _ConnectionError extends Error {
      constructor(code, message) {
        super(message);
        this.code = code;
        Object.setPrototypeOf(this, _ConnectionError.prototype);
      }
    };
    exports2.ConnectionError = ConnectionError;
    var ConnectionStrategy;
    (function(ConnectionStrategy2) {
      function is(value) {
        const candidate = value;
        return candidate && Is.func(candidate.cancelUndispatched);
      }
      ConnectionStrategy2.is = is;
    })(ConnectionStrategy || (exports2.ConnectionStrategy = ConnectionStrategy = {}));
    var IdCancellationReceiverStrategy;
    (function(IdCancellationReceiverStrategy2) {
      function is(value) {
        const candidate = value;
        return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is.func(candidate.dispose));
      }
      IdCancellationReceiverStrategy2.is = is;
    })(IdCancellationReceiverStrategy || (exports2.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {}));
    var RequestCancellationReceiverStrategy;
    (function(RequestCancellationReceiverStrategy2) {
      function is(value) {
        const candidate = value;
        return candidate && candidate.kind === "request" && Is.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is.func(candidate.dispose));
      }
      RequestCancellationReceiverStrategy2.is = is;
    })(RequestCancellationReceiverStrategy || (exports2.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {}));
    var CancellationReceiverStrategy;
    (function(CancellationReceiverStrategy2) {
      CancellationReceiverStrategy2.Message = Object.freeze({
        createCancellationTokenSource(_) {
          return new cancellation_1.CancellationTokenSource();
        }
      });
      function is(value) {
        return IdCancellationReceiverStrategy.is(value) || RequestCancellationReceiverStrategy.is(value);
      }
      CancellationReceiverStrategy2.is = is;
    })(CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = 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 && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
      }
      CancellationSenderStrategy2.is = is;
    })(CancellationSenderStrategy || (exports2.CancellationSenderStrategy = 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 || (exports2.CancellationStrategy = CancellationStrategy = {}));
    var MessageStrategy;
    (function(MessageStrategy2) {
      function is(value) {
        const candidate = value;
        return candidate && Is.func(candidate.handleMessage);
      }
      MessageStrategy2.is = is;
    })(MessageStrategy || (exports2.MessageStrategy = MessageStrategy = {}));
    var ConnectionOptions;
    (function(ConnectionOptions2) {
      function is(value) {
        const candidate = value;
        return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy));
      }
      ConnectionOptions2.is = is;
    })(ConnectionOptions || (exports2.ConnectionOptions = 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 : exports2.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 handleMessage(message) {
        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);
        }
      }
      function processMessageQueue() {
        if (messageQueue.size === 0) {
          return;
        }
        const message = messageQueue.shift();
        try {
          const messageStrategy = options2 == null ? void 0 : options2.messageStrategy;
          if (MessageStrategy.is(messageStrategy)) {
            messageStrategy.handleMessage(message, handleMessage);
          } else {
            handleMessage(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 = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage);
          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 && Is.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 && Is.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 (Is.string(responseMessage.id) || Is.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 (Is.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((error) => {
            logger2.error(`Sending notification failed.`);
            throw error;
          });
        },
        onNotification: (type, handler) => {
          throwIfClosedOrDisposed();
          let method;
          if (Is.func(type)) {
            starNotificationHandler = type;
          } else if (handler) {
            if (Is.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 (Is.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 requestMessage = {
            jsonrpc: version,
            id,
            method,
            params: messageParams
          };
          traceSendingRequest(requestMessage);
          if (typeof cancellationStrategy.sender.enableCancellation === "function") {
            cancellationStrategy.sender.enableCancellation(requestMessage);
          }
          return new Promise(async (resolve9, reject) => {
            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();
            };
            const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
            try {
              await messageWriter.write(requestMessage);
              responsePromises.set(id, responsePromise);
            } catch (error) {
              logger2.error(`Sending request failed.`);
              responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : "Unknown reason"));
              throw error;
            }
          });
        },
        onRequest: (type, handler) => {
          throwIfClosedOrDisposed();
          let method = null;
          if (StarRequestHandler.is(type)) {
            method = void 0;
            starRequestHandler = type;
          } else if (Is.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 (Is.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 (Is.func(messageWriter.dispose)) {
            messageWriter.dispose();
          }
          if (Is.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;
    }
    exports2.createMessageConnection = createMessageConnection;
  }
});

// node_modules/vscode-jsonrpc/lib/common/api.js
var require_api = __commonJS({
  "node_modules/vscode-jsonrpc/lib/common/api.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ProgressType = exports2.ProgressToken = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.AbstractMessageBuffer = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.LRUCache = exports2.Touch = exports2.LinkedMap = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.Message = exports2.RAL = void 0;
    exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = void 0;
    var messages_1 = require_messages();
    Object.defineProperty(exports2, "Message", { enumerable: true, get: function() {
      return messages_1.Message;
    } });
    Object.defineProperty(exports2, "RequestType", { enumerable: true, get: function() {
      return messages_1.RequestType;
    } });
    Object.defineProperty(exports2, "RequestType0", { enumerable: true, get: function() {
      return messages_1.RequestType0;
    } });
    Object.defineProperty(exports2, "RequestType1", { enumerable: true, get: function() {
      return messages_1.RequestType1;
    } });
    Object.defineProperty(exports2, "RequestType2", { enumerable: true, get: function() {
      return messages_1.RequestType2;
    } });
    Object.defineProperty(exports2, "RequestType3", { enumerable: true, get: function() {
      return messages_1.RequestType3;
    } });
    Object.defineProperty(exports2, "RequestType4", { enumerable: true, get: function() {
      return messages_1.RequestType4;
    } });
    Object.defineProperty(exports2, "RequestType5", { enumerable: true, get: function() {
      return messages_1.RequestType5;
    } });
    Object.defineProperty(exports2, "RequestType6", { enumerable: true, get: function() {
      return messages_1.RequestType6;
    } });
    Object.defineProperty(exports2, "RequestType7", { enumerable: true, get: function() {
      return messages_1.RequestType7;
    } });
    Object.defineProperty(exports2, "RequestType8", { enumerable: true, get: function() {
      return messages_1.RequestType8;
    } });
    Object.defineProperty(exports2, "RequestType9", { enumerable: true, get: function() {
      return messages_1.RequestType9;
    } });
    Object.defineProperty(exports2, "ResponseError", { enumerable: true, get: function() {
      return messages_1.ResponseError;
    } });
    Object.defineProperty(exports2, "ErrorCodes", { enumerable: true, get: function() {
      return messages_1.ErrorCodes;
    } });
    Object.defineProperty(exports2, "NotificationType", { enumerable: true, get: function() {
      return messages_1.NotificationType;
    } });
    Object.defineProperty(exports2, "NotificationType0", { enumerable: true, get: function() {
      return messages_1.NotificationType0;
    } });
    Object.defineProperty(exports2, "NotificationType1", { enumerable: true, get: function() {
      return messages_1.NotificationType1;
    } });
    Object.defineProperty(exports2, "NotificationType2", { enumerable: true, get: function() {
      return messages_1.NotificationType2;
    } });
    Object.defineProperty(exports2, "NotificationType3", { enumerable: true, get: function() {
      return messages_1.NotificationType3;
    } });
    Object.defineProperty(exports2, "NotificationType4", { enumerable: true, get: function() {
      return messages_1.NotificationType4;
    } });
    Object.defineProperty(exports2, "NotificationType5", { enumerable: true, get: function() {
      return messages_1.NotificationType5;
    } });
    Object.defineProperty(exports2, "NotificationType6", { enumerable: true, get: function() {
      return messages_1.NotificationType6;
    } });
    Object.defineProperty(exports2, "NotificationType7", { enumerable: true, get: function() {
      return messages_1.NotificationType7;
    } });
    Object.defineProperty(exports2, "NotificationType8", { enumerable: true, get: function() {
      return messages_1.NotificationType8;
    } });
    Object.defineProperty(exports2, "NotificationType9", { enumerable: true, get: function() {
      return messages_1.NotificationType9;
    } });
    Object.defineProperty(exports2, "ParameterStructures", { enumerable: true, get: function() {
      return messages_1.ParameterStructures;
    } });
    var linkedMap_1 = require_linkedMap();
    Object.defineProperty(exports2, "LinkedMap", { enumerable: true, get: function() {
      return linkedMap_1.LinkedMap;
    } });
    Object.defineProperty(exports2, "LRUCache", { enumerable: true, get: function() {
      return linkedMap_1.LRUCache;
    } });
    Object.defineProperty(exports2, "Touch", { enumerable: true, get: function() {
      return linkedMap_1.Touch;
    } });
    var disposable_1 = require_disposable();
    Object.defineProperty(exports2, "Disposable", { enumerable: true, get: function() {
      return disposable_1.Disposable;
    } });
    var events_1 = require_events();
    Object.defineProperty(exports2, "Event", { enumerable: true, get: function() {
      return events_1.Event;
    } });
    Object.defineProperty(exports2, "Emitter", { enumerable: true, get: function() {
      return events_1.Emitter;
    } });
    var cancellation_1 = require_cancellation();
    Object.defineProperty(exports2, "CancellationTokenSource", { enumerable: true, get: function() {
      return cancellation_1.CancellationTokenSource;
    } });
    Object.defineProperty(exports2, "CancellationToken", { enumerable: true, get: function() {
      return cancellation_1.CancellationToken;
    } });
    var sharedArrayCancellation_1 = require_sharedArrayCancellation();
    Object.defineProperty(exports2, "SharedArraySenderStrategy", { enumerable: true, get: function() {
      return sharedArrayCancellation_1.SharedArraySenderStrategy;
    } });
    Object.defineProperty(exports2, "SharedArrayReceiverStrategy", { enumerable: true, get: function() {
      return sharedArrayCancellation_1.SharedArrayReceiverStrategy;
    } });
    var messageReader_1 = require_messageReader();
    Object.defineProperty(exports2, "MessageReader", { enumerable: true, get: function() {
      return messageReader_1.MessageReader;
    } });
    Object.defineProperty(exports2, "AbstractMessageReader", { enumerable: true, get: function() {
      return messageReader_1.AbstractMessageReader;
    } });
    Object.defineProperty(exports2, "ReadableStreamMessageReader", { enumerable: true, get: function() {
      return messageReader_1.ReadableStreamMessageReader;
    } });
    var messageWriter_1 = require_messageWriter();
    Object.defineProperty(exports2, "MessageWriter", { enumerable: true, get: function() {
      return messageWriter_1.MessageWriter;
    } });
    Object.defineProperty(exports2, "AbstractMessageWriter", { enumerable: true, get: function() {
      return messageWriter_1.AbstractMessageWriter;
    } });
    Object.defineProperty(exports2, "WriteableStreamMessageWriter", { enumerable: true, get: function() {
      return messageWriter_1.WriteableStreamMessageWriter;
    } });
    var messageBuffer_1 = require_messageBuffer();
    Object.defineProperty(exports2, "AbstractMessageBuffer", { enumerable: true, get: function() {
      return messageBuffer_1.AbstractMessageBuffer;
    } });
    var connection_1 = require_connection();
    Object.defineProperty(exports2, "ConnectionStrategy", { enumerable: true, get: function() {
      return connection_1.ConnectionStrategy;
    } });
    Object.defineProperty(exports2, "ConnectionOptions", { enumerable: true, get: function() {
      return connection_1.ConnectionOptions;
    } });
    Object.defineProperty(exports2, "NullLogger", { enumerable: true, get: function() {
      return connection_1.NullLogger;
    } });
    Object.defineProperty(exports2, "createMessageConnection", { enumerable: true, get: function() {
      return connection_1.createMessageConnection;
    } });
    Object.defineProperty(exports2, "ProgressToken", { enumerable: true, get: function() {
      return connection_1.ProgressToken;
    } });
    Object.defineProperty(exports2, "ProgressType", { enumerable: true, get: function() {
      return connection_1.ProgressType;
    } });
    Object.defineProperty(exports2, "Trace", { enumerable: true, get: function() {
      return connection_1.Trace;
    } });
    Object.defineProperty(exports2, "TraceValues", { enumerable: true, get: function() {
      return connection_1.TraceValues;
    } });
    Object.defineProperty(exports2, "TraceFormat", { enumerable: true, get: function() {
      return connection_1.TraceFormat;
    } });
    Object.defineProperty(exports2, "SetTraceNotification", { enumerable: true, get: function() {
      return connection_1.SetTraceNotification;
    } });
    Object.defineProperty(exports2, "LogTraceNotification", { enumerable: true, get: function() {
      return connection_1.LogTraceNotification;
    } });
    Object.defineProperty(exports2, "ConnectionErrors", { enumerable: true, get: function() {
      return connection_1.ConnectionErrors;
    } });
    Object.defineProperty(exports2, "ConnectionError", { enumerable: true, get: function() {
      return connection_1.ConnectionError;
    } });
    Object.defineProperty(exports2, "CancellationReceiverStrategy", { enumerable: true, get: function() {
      return connection_1.CancellationReceiverStrategy;
    } });
    Object.defineProperty(exports2, "CancellationSenderStrategy", { enumerable: true, get: function() {
      return connection_1.CancellationSenderStrategy;
    } });
    Object.defineProperty(exports2, "CancellationStrategy", { enumerable: true, get: function() {
      return connection_1.CancellationStrategy;
    } });
    Object.defineProperty(exports2, "MessageStrategy", { enumerable: true, get: function() {
      return connection_1.MessageStrategy;
    } });
    var ral_1 = require_ral();
    exports2.RAL = ral_1.default;
  }
});

// node_modules/vscode-jsonrpc/lib/node/ril.js
var require_ril = __commonJS({
  "node_modules/vscode-jsonrpc/lib/node/ril.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    var util_1 = require("util");
    var api_1 = require_api();
    var MessageBuffer = class _MessageBuffer extends api_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 api_1.Disposable.create(() => this.stream.off("close", listener));
      }
      onError(listener) {
        this.stream.on("error", listener);
        return api_1.Disposable.create(() => this.stream.off("error", listener));
      }
      onEnd(listener) {
        this.stream.on("end", listener);
        return api_1.Disposable.create(() => this.stream.off("end", listener));
      }
      onData(listener) {
        this.stream.on("data", listener);
        return api_1.Disposable.create(() => this.stream.off("data", listener));
      }
    };
    var WritableStreamWrapper = class {
      constructor(stream) {
        this.stream = stream;
      }
      onClose(listener) {
        this.stream.on("close", listener);
        return api_1.Disposable.create(() => this.stream.off("close", listener));
      }
      onError(listener) {
        this.stream.on("error", listener);
        return api_1.Disposable.create(() => this.stream.off("error", listener));
      }
      onEnd(listener) {
        this.stream.on("end", listener);
        return api_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() {
        api_1.RAL.install(_ril);
      }
      RIL2.install = install;
    })(RIL || (RIL = {}));
    exports2.default = RIL;
  }
});

// node_modules/vscode-jsonrpc/lib/node/main.js
var require_main = __commonJS({
  "node_modules/vscode-jsonrpc/lib/node/main.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__exportStar || function(m, exports3) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.PortMessageWriter = exports2.PortMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0;
    var ril_1 = require_ril();
    ril_1.default.install();
    var path18 = require("path");
    var os5 = require("os");
    var crypto_1 = require("crypto");
    var net_1 = require("net");
    var api_1 = require_api();
    __exportStar(require_api(), exports2);
    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));
      }
    };
    exports2.IPCMessageReader = IPCMessageReader;
    var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
      constructor(process2) {
        super();
        this.process = process2;
        this.errorCount = 0;
        const 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() {
      }
    };
    exports2.IPCMessageWriter = IPCMessageWriter;
    var PortMessageReader = class extends api_1.AbstractMessageReader {
      constructor(port) {
        super();
        this.onData = new api_1.Emitter();
        port.on("close", () => this.fireClose);
        port.on("error", (error) => this.fireError(error));
        port.on("message", (message) => {
          this.onData.fire(message);
        });
      }
      listen(callback) {
        return this.onData.event(callback);
      }
    };
    exports2.PortMessageReader = PortMessageReader;
    var PortMessageWriter = class extends api_1.AbstractMessageWriter {
      constructor(port) {
        super();
        this.port = port;
        this.errorCount = 0;
        port.on("close", () => this.fireClose());
        port.on("error", (error) => this.fireError(error));
      }
      write(msg) {
        try {
          this.port.postMessage(msg);
          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() {
      }
    };
    exports2.PortMessageWriter = PortMessageWriter;
    var SocketMessageReader = class extends api_1.ReadableStreamMessageReader {
      constructor(socket, encoding = "utf-8") {
        super((0, ril_1.default)().stream.asReadableStream(socket), encoding);
      }
    };
    exports2.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();
      }
    };
    exports2.SocketMessageWriter = SocketMessageWriter;
    var StreamMessageReader = class extends api_1.ReadableStreamMessageReader {
      constructor(readable, encoding) {
        super((0, ril_1.default)().stream.asReadableStream(readable), encoding);
      }
    };
    exports2.StreamMessageReader = StreamMessageReader;
    var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter {
      constructor(writable, options2) {
        super((0, ril_1.default)().stream.asWritableStream(writable), options2);
      }
    };
    exports2.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(os5.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;
    }
    exports2.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;
            }
          });
        });
      });
    }
    exports2.createClientPipeTransport = createClientPipeTransport;
    function createServerPipeTransport(pipeName, encoding = "utf-8") {
      const socket = (0, net_1.createConnection)(pipeName);
      return [
        new SocketMessageReader(socket, encoding),
        new SocketMessageWriter(socket, encoding)
      ];
    }
    exports2.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;
            }
          });
        });
      });
    }
    exports2.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)
      ];
    }
    exports2.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);
    }
    exports2.createMessageConnection = createMessageConnection;
  }
});

// node_modules/vscode-jsonrpc/node.js
var require_node = __commonJS({
  "node_modules/vscode-jsonrpc/node.js"(exports2, module2) {
    "use strict";
    module2.exports = require_main();
  }
});

// node_modules/vscode-languageserver-types/lib/umd/main.js
var require_main2 = __commonJS({
  "node_modules/vscode-languageserver-types/lib/umd/main.js"(exports2, module2) {
    (function(factory) {
      if (typeof module2 === "object" && typeof module2.exports === "object") {
        var v = factory(require, exports2);
        if (v !== void 0) module2.exports = v;
      } else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
      }
    })(function(require2, exports3) {
      "use strict";
      Object.defineProperty(exports3, "__esModule", { value: true });
      exports3.TextDocument = exports3.EOL = exports3.WorkspaceFolder = exports3.InlineCompletionContext = exports3.SelectedCompletionInfo = exports3.InlineCompletionTriggerKind = exports3.InlineCompletionList = exports3.InlineCompletionItem = exports3.StringValue = exports3.InlayHint = exports3.InlayHintLabelPart = exports3.InlayHintKind = exports3.InlineValueContext = exports3.InlineValueEvaluatableExpression = exports3.InlineValueVariableLookup = exports3.InlineValueText = exports3.SemanticTokens = exports3.SemanticTokenModifiers = exports3.SemanticTokenTypes = exports3.SelectionRange = exports3.DocumentLink = exports3.FormattingOptions = exports3.CodeLens = exports3.CodeAction = exports3.CodeActionContext = exports3.CodeActionTriggerKind = exports3.CodeActionKind = exports3.DocumentSymbol = exports3.WorkspaceSymbol = exports3.SymbolInformation = exports3.SymbolTag = exports3.SymbolKind = exports3.DocumentHighlight = exports3.DocumentHighlightKind = exports3.SignatureInformation = exports3.ParameterInformation = exports3.Hover = exports3.MarkedString = exports3.CompletionList = exports3.CompletionItem = exports3.CompletionItemLabelDetails = exports3.InsertTextMode = exports3.InsertReplaceEdit = exports3.CompletionItemTag = exports3.InsertTextFormat = exports3.CompletionItemKind = exports3.MarkupContent = exports3.MarkupKind = exports3.TextDocumentItem = exports3.OptionalVersionedTextDocumentIdentifier = exports3.VersionedTextDocumentIdentifier = exports3.TextDocumentIdentifier = exports3.WorkspaceChange = exports3.WorkspaceEdit = exports3.DeleteFile = exports3.RenameFile = exports3.CreateFile = exports3.TextDocumentEdit = exports3.AnnotatedTextEdit = exports3.ChangeAnnotationIdentifier = exports3.ChangeAnnotation = exports3.TextEdit = exports3.Command = exports3.Diagnostic = exports3.CodeDescription = exports3.DiagnosticTag = exports3.DiagnosticSeverity = exports3.DiagnosticRelatedInformation = exports3.FoldingRange = exports3.FoldingRangeKind = exports3.ColorPresentation = exports3.ColorInformation = exports3.Color = exports3.LocationLink = exports3.Location = exports3.Range = exports3.Position = exports3.uinteger = exports3.integer = exports3.URI = exports3.DocumentUri = void 0;
      var DocumentUri;
      (function(DocumentUri2) {
        function is(value) {
          return typeof value === "string";
        }
        DocumentUri2.is = is;
      })(DocumentUri || (exports3.DocumentUri = DocumentUri = {}));
      var URI;
      (function(URI2) {
        function is(value) {
          return typeof value === "string";
        }
        URI2.is = is;
      })(URI || (exports3.URI = URI = {}));
      var integer;
      (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 || (exports3.integer = integer = {}));
      var uinteger;
      (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 || (exports3.uinteger = uinteger = {}));
      var Position8;
      (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;
      })(Position8 || (exports3.Position = Position8 = {}));
      var Range10;
      (function(Range11) {
        function create(one, two, three, four) {
          if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
            return { start: Position8.create(one, two), end: Position8.create(three, four) };
          } else if (Position8.is(one) && Position8.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) && Position8.is(candidate.start) && Position8.is(candidate.end);
        }
        Range11.is = is;
      })(Range10 || (exports3.Range = Range10 = {}));
      var Location5;
      (function(Location6) {
        function create(uri, range) {
          return { uri, range };
        }
        Location6.create = create;
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(candidate) && Range10.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
        }
        Location6.is = is;
      })(Location5 || (exports3.Location = Location5 = {}));
      var LocationLink;
      (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) && Range10.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range10.is(candidate.targetSelectionRange) && (Range10.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
        }
        LocationLink2.is = is;
      })(LocationLink || (exports3.LocationLink = LocationLink = {}));
      var Color;
      (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 || (exports3.Color = Color = {}));
      var ColorInformation;
      (function(ColorInformation2) {
        function create(range, color) {
          return {
            range,
            color
          };
        }
        ColorInformation2.create = create;
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(candidate) && Range10.is(candidate.range) && Color.is(candidate.color);
        }
        ColorInformation2.is = is;
      })(ColorInformation || (exports3.ColorInformation = ColorInformation = {}));
      var ColorPresentation;
      (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) || TextEdit2.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit2.is));
        }
        ColorPresentation2.is = is;
      })(ColorPresentation || (exports3.ColorPresentation = ColorPresentation = {}));
      var FoldingRangeKind;
      (function(FoldingRangeKind2) {
        FoldingRangeKind2.Comment = "comment";
        FoldingRangeKind2.Imports = "imports";
        FoldingRangeKind2.Region = "region";
      })(FoldingRangeKind || (exports3.FoldingRangeKind = FoldingRangeKind = {}));
      var FoldingRange;
      (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 || (exports3.FoldingRange = FoldingRange = {}));
      var DiagnosticRelatedInformation;
      (function(DiagnosticRelatedInformation2) {
        function create(location, message) {
          return {
            location,
            message
          };
        }
        DiagnosticRelatedInformation2.create = create;
        function is(value) {
          var candidate = value;
          return Is.defined(candidate) && Location5.is(candidate.location) && Is.string(candidate.message);
        }
        DiagnosticRelatedInformation2.is = is;
      })(DiagnosticRelatedInformation || (exports3.DiagnosticRelatedInformation = DiagnosticRelatedInformation = {}));
      var DiagnosticSeverity2;
      (function(DiagnosticSeverity3) {
        DiagnosticSeverity3.Error = 1;
        DiagnosticSeverity3.Warning = 2;
        DiagnosticSeverity3.Information = 3;
        DiagnosticSeverity3.Hint = 4;
      })(DiagnosticSeverity2 || (exports3.DiagnosticSeverity = DiagnosticSeverity2 = {}));
      var DiagnosticTag;
      (function(DiagnosticTag2) {
        DiagnosticTag2.Unnecessary = 1;
        DiagnosticTag2.Deprecated = 2;
      })(DiagnosticTag || (exports3.DiagnosticTag = DiagnosticTag = {}));
      var CodeDescription;
      (function(CodeDescription2) {
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(candidate) && Is.string(candidate.href);
        }
        CodeDescription2.is = is;
      })(CodeDescription || (exports3.CodeDescription = CodeDescription = {}));
      var Diagnostic4;
      (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) && Range10.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;
      })(Diagnostic4 || (exports3.Diagnostic = Diagnostic4 = {}));
      var Command6;
      (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;
      })(Command6 || (exports3.Command = Command6 = {}));
      var TextEdit2;
      (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) && Range10.is(candidate.range);
        }
        TextEdit3.is = is;
      })(TextEdit2 || (exports3.TextEdit = TextEdit2 = {}));
      var ChangeAnnotation;
      (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 || (exports3.ChangeAnnotation = ChangeAnnotation = {}));
      var ChangeAnnotationIdentifier;
      (function(ChangeAnnotationIdentifier2) {
        function is(value) {
          var candidate = value;
          return Is.string(candidate);
        }
        ChangeAnnotationIdentifier2.is = is;
      })(ChangeAnnotationIdentifier || (exports3.ChangeAnnotationIdentifier = ChangeAnnotationIdentifier = {}));
      var AnnotatedTextEdit;
      (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 TextEdit2.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
        }
        AnnotatedTextEdit2.is = is;
      })(AnnotatedTextEdit || (exports3.AnnotatedTextEdit = AnnotatedTextEdit = {}));
      var TextDocumentEdit3;
      (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;
      })(TextDocumentEdit3 || (exports3.TextDocumentEdit = TextDocumentEdit3 = {}));
      var CreateFile;
      (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 || (exports3.CreateFile = CreateFile = {}));
      var RenameFile2;
      (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;
      })(RenameFile2 || (exports3.RenameFile = RenameFile2 = {}));
      var DeleteFile2;
      (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;
      })(DeleteFile2 || (exports3.DeleteFile = DeleteFile2 = {}));
      var WorkspaceEdit4;
      (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) || RenameFile2.is(change) || DeleteFile2.is(change);
            } else {
              return TextDocumentEdit3.is(change);
            }
          }));
        }
        WorkspaceEdit5.is = is;
      })(WorkspaceEdit4 || (exports3.WorkspaceEdit = WorkspaceEdit4 = {}));
      var TextEditChangeImpl = (
        /** @class */
        (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 = TextEdit2.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 = TextEdit2.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 = TextEdit2.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;
        })()
      );
      var ChangeAnnotations = (
        /** @class */
        (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;
        })()
      );
      var WorkspaceChange = (
        /** @class */
        (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 (TextDocumentEdit3.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", {
            /**
             * Returns the underlying {@link WorkspaceEdit} literal
             * use to be returned from a workspace edit operation like rename.
             */
            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 = RenameFile2.create(oldUri, newUri, options2);
            } else {
              id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
              operation = RenameFile2.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 = DeleteFile2.create(uri, options2);
            } else {
              id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
              operation = DeleteFile2.create(uri, options2, id);
            }
            this._workspaceEdit.documentChanges.push(operation);
            if (id !== void 0) {
              return id;
            }
          };
          return WorkspaceChange2;
        })()
      );
      exports3.WorkspaceChange = WorkspaceChange;
      var TextDocumentIdentifier4;
      (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;
      })(TextDocumentIdentifier4 || (exports3.TextDocumentIdentifier = TextDocumentIdentifier4 = {}));
      var VersionedTextDocumentIdentifier;
      (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 || (exports3.VersionedTextDocumentIdentifier = VersionedTextDocumentIdentifier = {}));
      var OptionalVersionedTextDocumentIdentifier;
      (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 || (exports3.OptionalVersionedTextDocumentIdentifier = OptionalVersionedTextDocumentIdentifier = {}));
      var TextDocumentItem;
      (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 || (exports3.TextDocumentItem = TextDocumentItem = {}));
      var MarkupKind;
      (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 || (exports3.MarkupKind = MarkupKind = {}));
      var MarkupContent;
      (function(MarkupContent2) {
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
        }
        MarkupContent2.is = is;
      })(MarkupContent || (exports3.MarkupContent = MarkupContent = {}));
      var CompletionItemKind;
      (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 || (exports3.CompletionItemKind = CompletionItemKind = {}));
      var InsertTextFormat;
      (function(InsertTextFormat2) {
        InsertTextFormat2.PlainText = 1;
        InsertTextFormat2.Snippet = 2;
      })(InsertTextFormat || (exports3.InsertTextFormat = InsertTextFormat = {}));
      var CompletionItemTag;
      (function(CompletionItemTag2) {
        CompletionItemTag2.Deprecated = 1;
      })(CompletionItemTag || (exports3.CompletionItemTag = CompletionItemTag = {}));
      var InsertReplaceEdit;
      (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) && Range10.is(candidate.insert) && Range10.is(candidate.replace);
        }
        InsertReplaceEdit2.is = is;
      })(InsertReplaceEdit || (exports3.InsertReplaceEdit = InsertReplaceEdit = {}));
      var InsertTextMode;
      (function(InsertTextMode2) {
        InsertTextMode2.asIs = 1;
        InsertTextMode2.adjustIndentation = 2;
      })(InsertTextMode || (exports3.InsertTextMode = InsertTextMode = {}));
      var CompletionItemLabelDetails;
      (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 || (exports3.CompletionItemLabelDetails = CompletionItemLabelDetails = {}));
      var CompletionItem;
      (function(CompletionItem2) {
        function create(label) {
          return { label };
        }
        CompletionItem2.create = create;
      })(CompletionItem || (exports3.CompletionItem = CompletionItem = {}));
      var CompletionList;
      (function(CompletionList2) {
        function create(items, isIncomplete) {
          return { items: items ? items : [], isIncomplete: !!isIncomplete };
        }
        CompletionList2.create = create;
      })(CompletionList || (exports3.CompletionList = CompletionList = {}));
      var MarkedString3;
      (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;
      })(MarkedString3 || (exports3.MarkedString = MarkedString3 = {}));
      var Hover2;
      (function(Hover3) {
        function is(value) {
          var candidate = value;
          return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString3.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString3.is)) && (value.range === void 0 || Range10.is(value.range));
        }
        Hover3.is = is;
      })(Hover2 || (exports3.Hover = Hover2 = {}));
      var ParameterInformation;
      (function(ParameterInformation2) {
        function create(label, documentation) {
          return documentation ? { label, documentation } : { label };
        }
        ParameterInformation2.create = create;
      })(ParameterInformation || (exports3.ParameterInformation = ParameterInformation = {}));
      var SignatureInformation;
      (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 || (exports3.SignatureInformation = SignatureInformation = {}));
      var DocumentHighlightKind;
      (function(DocumentHighlightKind2) {
        DocumentHighlightKind2.Text = 1;
        DocumentHighlightKind2.Read = 2;
        DocumentHighlightKind2.Write = 3;
      })(DocumentHighlightKind || (exports3.DocumentHighlightKind = DocumentHighlightKind = {}));
      var DocumentHighlight;
      (function(DocumentHighlight2) {
        function create(range, kind) {
          var result = { range };
          if (Is.number(kind)) {
            result.kind = kind;
          }
          return result;
        }
        DocumentHighlight2.create = create;
      })(DocumentHighlight || (exports3.DocumentHighlight = DocumentHighlight = {}));
      var SymbolKind5;
      (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;
      })(SymbolKind5 || (exports3.SymbolKind = SymbolKind5 = {}));
      var SymbolTag;
      (function(SymbolTag2) {
        SymbolTag2.Deprecated = 1;
      })(SymbolTag || (exports3.SymbolTag = SymbolTag = {}));
      var SymbolInformation4;
      (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;
      })(SymbolInformation4 || (exports3.SymbolInformation = SymbolInformation4 = {}));
      var WorkspaceSymbol;
      (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 || (exports3.WorkspaceSymbol = WorkspaceSymbol = {}));
      var DocumentSymbol2;
      (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) && Range10.is(candidate.range) && Range10.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;
      })(DocumentSymbol2 || (exports3.DocumentSymbol = DocumentSymbol2 = {}));
      var CodeActionKind5;
      (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";
      })(CodeActionKind5 || (exports3.CodeActionKind = CodeActionKind5 = {}));
      var CodeActionTriggerKind2;
      (function(CodeActionTriggerKind3) {
        CodeActionTriggerKind3.Invoked = 1;
        CodeActionTriggerKind3.Automatic = 2;
      })(CodeActionTriggerKind2 || (exports3.CodeActionTriggerKind = CodeActionTriggerKind2 = {}));
      var CodeActionContext4;
      (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, Diagnostic4.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind2.Invoked || candidate.triggerKind === CodeActionTriggerKind2.Automatic);
        }
        CodeActionContext5.is = is;
      })(CodeActionContext4 || (exports3.CodeActionContext = CodeActionContext4 = {}));
      var CodeAction3;
      (function(CodeAction4) {
        function create(title, kindOrCommandOrEdit, kind) {
          var result = { title };
          var checkKind = true;
          if (typeof kindOrCommandOrEdit === "string") {
            checkKind = false;
            result.kind = kindOrCommandOrEdit;
          } else if (Command6.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, Diagnostic4.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command6.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit4.is(candidate.edit));
        }
        CodeAction4.is = is;
      })(CodeAction3 || (exports3.CodeAction = CodeAction3 = {}));
      var CodeLens;
      (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) && Range10.is(candidate.range) && (Is.undefined(candidate.command) || Command6.is(candidate.command));
        }
        CodeLens2.is = is;
      })(CodeLens || (exports3.CodeLens = CodeLens = {}));
      var FormattingOptions4;
      (function(FormattingOptions5) {
        function create(tabSize, insertSpaces) {
          return { tabSize, insertSpaces };
        }
        FormattingOptions5.create = create;
        function is(value) {
          var candidate = value;
          return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
        }
        FormattingOptions5.is = is;
      })(FormattingOptions4 || (exports3.FormattingOptions = FormattingOptions4 = {}));
      var DocumentLink;
      (function(DocumentLink2) {
        function create(range, target, data) {
          return { range, target, data };
        }
        DocumentLink2.create = create;
        function is(value) {
          var candidate = value;
          return Is.defined(candidate) && Range10.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
        }
        DocumentLink2.is = is;
      })(DocumentLink || (exports3.DocumentLink = DocumentLink = {}));
      var SelectionRange;
      (function(SelectionRange2) {
        function create(range, parent) {
          return { range, parent };
        }
        SelectionRange2.create = create;
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(candidate) && Range10.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
        }
        SelectionRange2.is = is;
      })(SelectionRange || (exports3.SelectionRange = SelectionRange = {}));
      var SemanticTokenTypes;
      (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 || (exports3.SemanticTokenTypes = SemanticTokenTypes = {}));
      var SemanticTokenModifiers;
      (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 || (exports3.SemanticTokenModifiers = SemanticTokenModifiers = {}));
      var SemanticTokens;
      (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 || (exports3.SemanticTokens = SemanticTokens = {}));
      var InlineValueText;
      (function(InlineValueText2) {
        function create(range, text) {
          return { range, text };
        }
        InlineValueText2.create = create;
        function is(value) {
          var candidate = value;
          return candidate !== void 0 && candidate !== null && Range10.is(candidate.range) && Is.string(candidate.text);
        }
        InlineValueText2.is = is;
      })(InlineValueText || (exports3.InlineValueText = InlineValueText = {}));
      var InlineValueVariableLookup;
      (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 && Range10.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
        }
        InlineValueVariableLookup2.is = is;
      })(InlineValueVariableLookup || (exports3.InlineValueVariableLookup = InlineValueVariableLookup = {}));
      var InlineValueEvaluatableExpression;
      (function(InlineValueEvaluatableExpression2) {
        function create(range, expression) {
          return { range, expression };
        }
        InlineValueEvaluatableExpression2.create = create;
        function is(value) {
          var candidate = value;
          return candidate !== void 0 && candidate !== null && Range10.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
        }
        InlineValueEvaluatableExpression2.is = is;
      })(InlineValueEvaluatableExpression || (exports3.InlineValueEvaluatableExpression = InlineValueEvaluatableExpression = {}));
      var InlineValueContext;
      (function(InlineValueContext2) {
        function create(frameId, stoppedLocation) {
          return { frameId, stoppedLocation };
        }
        InlineValueContext2.create = create;
        function is(value) {
          var candidate = value;
          return Is.defined(candidate) && Range10.is(value.stoppedLocation);
        }
        InlineValueContext2.is = is;
      })(InlineValueContext || (exports3.InlineValueContext = InlineValueContext = {}));
      var InlayHintKind2;
      (function(InlayHintKind3) {
        InlayHintKind3.Type = 1;
        InlayHintKind3.Parameter = 2;
        function is(value) {
          return value === 1 || value === 2;
        }
        InlayHintKind3.is = is;
      })(InlayHintKind2 || (exports3.InlayHintKind = InlayHintKind2 = {}));
      var InlayHintLabelPart;
      (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 || Location5.is(candidate.location)) && (candidate.command === void 0 || Command6.is(candidate.command));
        }
        InlayHintLabelPart2.is = is;
      })(InlayHintLabelPart || (exports3.InlayHintLabelPart = InlayHintLabelPart = {}));
      var InlayHint2;
      (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) && Position8.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind2.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit2.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;
      })(InlayHint2 || (exports3.InlayHint = InlayHint2 = {}));
      var StringValue;
      (function(StringValue2) {
        function createSnippet(value) {
          return { kind: "snippet", value };
        }
        StringValue2.createSnippet = createSnippet;
      })(StringValue || (exports3.StringValue = StringValue = {}));
      var InlineCompletionItem;
      (function(InlineCompletionItem2) {
        function create(insertText, filterText, range, command) {
          return { insertText, filterText, range, command };
        }
        InlineCompletionItem2.create = create;
      })(InlineCompletionItem || (exports3.InlineCompletionItem = InlineCompletionItem = {}));
      var InlineCompletionList;
      (function(InlineCompletionList2) {
        function create(items) {
          return { items };
        }
        InlineCompletionList2.create = create;
      })(InlineCompletionList || (exports3.InlineCompletionList = InlineCompletionList = {}));
      var InlineCompletionTriggerKind;
      (function(InlineCompletionTriggerKind2) {
        InlineCompletionTriggerKind2.Invoked = 0;
        InlineCompletionTriggerKind2.Automatic = 1;
      })(InlineCompletionTriggerKind || (exports3.InlineCompletionTriggerKind = InlineCompletionTriggerKind = {}));
      var SelectedCompletionInfo;
      (function(SelectedCompletionInfo2) {
        function create(range, text) {
          return { range, text };
        }
        SelectedCompletionInfo2.create = create;
      })(SelectedCompletionInfo || (exports3.SelectedCompletionInfo = SelectedCompletionInfo = {}));
      var InlineCompletionContext;
      (function(InlineCompletionContext2) {
        function create(triggerKind, selectedCompletionInfo) {
          return { triggerKind, selectedCompletionInfo };
        }
        InlineCompletionContext2.create = create;
      })(InlineCompletionContext || (exports3.InlineCompletionContext = InlineCompletionContext = {}));
      var WorkspaceFolder2;
      (function(WorkspaceFolder3) {
        function is(value) {
          var candidate = value;
          return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
        }
        WorkspaceFolder3.is = is;
      })(WorkspaceFolder2 || (exports3.WorkspaceFolder = WorkspaceFolder2 = {}));
      exports3.EOL = ["\n", "\r\n", "\r"];
      var TextDocument5;
      (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;
        }
      })(TextDocument5 || (exports3.TextDocument = TextDocument5 = {}));
      var FullTextDocument = (
        /** @class */
        (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 Position8.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 Position8.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;
        })()
      );
      var Is;
      (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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = exports2.MessageDirection = void 0;
    var vscode_jsonrpc_1 = require_main();
    var MessageDirection;
    (function(MessageDirection2) {
      MessageDirection2["clientToServer"] = "clientToServer";
      MessageDirection2["serverToClient"] = "serverToClient";
      MessageDirection2["both"] = "both";
    })(MessageDirection || (exports2.MessageDirection = MessageDirection = {}));
    var RegistrationType = class {
      constructor(method) {
        this.method = method;
      }
    };
    exports2.RegistrationType = RegistrationType;
    var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 {
      constructor(method) {
        super(method);
      }
    };
    exports2.ProtocolRequestType0 = ProtocolRequestType0;
    var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
      constructor(method) {
        super(method, vscode_jsonrpc_1.ParameterStructures.byName);
      }
    };
    exports2.ProtocolRequestType = ProtocolRequestType;
    var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
      constructor(method) {
        super(method);
      }
    };
    exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
    var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
      constructor(method) {
        super(method, vscode_jsonrpc_1.ParameterStructures.byName);
      }
    };
    exports2.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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
    function boolean(value) {
      return value === true || value === false;
    }
    exports2.boolean = boolean;
    function string(value) {
      return typeof value === "string" || value instanceof String;
    }
    exports2.string = string;
    function number(value) {
      return typeof value === "number" || value instanceof Number;
    }
    exports2.number = number;
    function error(value) {
      return value instanceof Error;
    }
    exports2.error = error;
    function func(value) {
      return typeof value === "function";
    }
    exports2.func = func;
    function array(value) {
      return Array.isArray(value);
    }
    exports2.array = array;
    function stringArray(value) {
      return array(value) && value.every((elem) => string(elem));
    }
    exports2.stringArray = stringArray;
    function typedArray(value, check) {
      return Array.isArray(value) && value.every(check);
    }
    exports2.typedArray = typedArray;
    function objectLiteral(value) {
      return value !== null && typeof value === "object";
    }
    exports2.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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.ImplementationRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.TypeDefinitionRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.DidChangeWorkspaceFoldersNotification = exports2.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 || (exports2.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {}));
    var DidChangeWorkspaceFoldersNotification;
    (function(DidChangeWorkspaceFoldersNotification2) {
      DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders";
      DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method);
    })(DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.ConfigurationRequest = ConfigurationRequest2 = {}));
  }
});

// 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ColorPresentationRequest = exports2.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 || (exports2.DocumentColorRequest = DocumentColorRequest = {}));
    var ColorPresentationRequest;
    (function(ColorPresentationRequest2) {
      ColorPresentationRequest2.method = "textDocument/colorPresentation";
      ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method);
    })(ColorPresentationRequest || (exports2.ColorPresentationRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.FoldingRangeRefreshRequest = exports2.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 || (exports2.FoldingRangeRequest = FoldingRangeRequest = {}));
    var FoldingRangeRefreshRequest;
    (function(FoldingRangeRefreshRequest2) {
      FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`;
      FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method);
    })(FoldingRangeRefreshRequest || (exports2.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {}));
  }
});

// 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.DeclarationRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.SelectionRangeRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.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 || (exports2.WorkDoneProgress = 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 || (exports2.WorkDoneProgressCreateRequest = 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 || (exports2.WorkDoneProgressCancelNotification = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.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 || (exports2.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {}));
    var CallHierarchyIncomingCallsRequest;
    (function(CallHierarchyIncomingCallsRequest2) {
      CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls";
      CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method);
    })(CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {}));
    var CallHierarchyOutgoingCallsRequest;
    (function(CallHierarchyOutgoingCallsRequest2) {
      CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls";
      CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method);
    })(CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = void 0;
    var messages_1 = require_messages2();
    var TokenFormat;
    (function(TokenFormat2) {
      TokenFormat2.Relative = "relative";
    })(TokenFormat || (exports2.TokenFormat = TokenFormat = {}));
    var SemanticTokensRegistrationType;
    (function(SemanticTokensRegistrationType2) {
      SemanticTokensRegistrationType2.method = "textDocument/semanticTokens";
      SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method);
    })(SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = 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 || (exports2.SemanticTokensRequest = 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 || (exports2.SemanticTokensDeltaRequest = 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 || (exports2.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {}));
    var SemanticTokensRefreshRequest;
    (function(SemanticTokensRefreshRequest2) {
      SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`;
      SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method);
    })(SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.ShowDocumentRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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 || (exports2.LinkedEditingRangeRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0;
    var messages_1 = require_messages2();
    var FileOperationPatternKind;
    (function(FileOperationPatternKind2) {
      FileOperationPatternKind2.file = "file";
      FileOperationPatternKind2.folder = "folder";
    })(FileOperationPatternKind || (exports2.FileOperationPatternKind = FileOperationPatternKind = {}));
    var WillCreateFilesRequest;
    (function(WillCreateFilesRequest2) {
      WillCreateFilesRequest2.method = "workspace/willCreateFiles";
      WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method);
    })(WillCreateFilesRequest || (exports2.WillCreateFilesRequest = WillCreateFilesRequest = {}));
    var DidCreateFilesNotification;
    (function(DidCreateFilesNotification2) {
      DidCreateFilesNotification2.method = "workspace/didCreateFiles";
      DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method);
    })(DidCreateFilesNotification || (exports2.DidCreateFilesNotification = DidCreateFilesNotification = {}));
    var WillRenameFilesRequest;
    (function(WillRenameFilesRequest2) {
      WillRenameFilesRequest2.method = "workspace/willRenameFiles";
      WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method);
    })(WillRenameFilesRequest || (exports2.WillRenameFilesRequest = WillRenameFilesRequest = {}));
    var DidRenameFilesNotification;
    (function(DidRenameFilesNotification2) {
      DidRenameFilesNotification2.method = "workspace/didRenameFiles";
      DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method);
    })(DidRenameFilesNotification || (exports2.DidRenameFilesNotification = DidRenameFilesNotification = {}));
    var DidDeleteFilesNotification;
    (function(DidDeleteFilesNotification2) {
      DidDeleteFilesNotification2.method = "workspace/didDeleteFiles";
      DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method);
    })(DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = DidDeleteFilesNotification = {}));
    var WillDeleteFilesRequest;
    (function(WillDeleteFilesRequest2) {
      WillDeleteFilesRequest2.method = "workspace/willDeleteFiles";
      WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method);
    })(WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.MonikerRequest = exports2.MonikerKind = exports2.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 || (exports2.UniquenessLevel = UniquenessLevel = {}));
    var MonikerKind;
    (function(MonikerKind2) {
      MonikerKind2.$import = "import";
      MonikerKind2.$export = "export";
      MonikerKind2.local = "local";
    })(MonikerKind || (exports2.MonikerKind = MonikerKind = {}));
    var MonikerRequest;
    (function(MonikerRequest2) {
      MonikerRequest2.method = "textDocument/moniker";
      MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method);
    })(MonikerRequest || (exports2.MonikerRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchySupertypesRequest = exports2.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 || (exports2.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {}));
    var TypeHierarchySupertypesRequest;
    (function(TypeHierarchySupertypesRequest2) {
      TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes";
      TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method);
    })(TypeHierarchySupertypesRequest || (exports2.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {}));
    var TypeHierarchySubtypesRequest;
    (function(TypeHierarchySubtypesRequest2) {
      TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes";
      TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method);
    })(TypeHierarchySubtypesRequest || (exports2.TypeHierarchySubtypesRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.InlineValueRefreshRequest = exports2.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 || (exports2.InlineValueRequest = InlineValueRequest = {}));
    var InlineValueRefreshRequest;
    (function(InlineValueRefreshRequest2) {
      InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`;
      InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method);
    })(InlineValueRefreshRequest || (exports2.InlineValueRefreshRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.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 || (exports2.InlayHintRequest = InlayHintRequest2 = {}));
    var InlayHintResolveRequest;
    (function(InlayHintResolveRequest2) {
      InlayHintResolveRequest2.method = "inlayHint/resolve";
      InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method);
    })(InlayHintResolveRequest || (exports2.InlayHintResolveRequest = InlayHintResolveRequest = {}));
    var InlayHintRefreshRequest2;
    (function(InlayHintRefreshRequest3) {
      InlayHintRefreshRequest3.method = `workspace/inlayHint/refresh`;
      InlayHintRefreshRequest3.messageDirection = messages_1.MessageDirection.serverToClient;
      InlayHintRefreshRequest3.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest3.method);
    })(InlayHintRefreshRequest2 || (exports2.InlayHintRefreshRequest = InlayHintRefreshRequest2 = {}));
  }
});

// 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = void 0;
    var vscode_jsonrpc_1 = require_main();
    var Is = require_is2();
    var messages_1 = require_messages2();
    var DiagnosticServerCancellationData;
    (function(DiagnosticServerCancellationData2) {
      function is(value) {
        const candidate = value;
        return candidate && Is.boolean(candidate.retriggerRequest);
      }
      DiagnosticServerCancellationData2.is = is;
    })(DiagnosticServerCancellationData || (exports2.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {}));
    var DocumentDiagnosticReportKind;
    (function(DocumentDiagnosticReportKind2) {
      DocumentDiagnosticReportKind2.Full = "full";
      DocumentDiagnosticReportKind2.Unchanged = "unchanged";
    })(DocumentDiagnosticReportKind || (exports2.DocumentDiagnosticReportKind = 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 || (exports2.DocumentDiagnosticRequest = 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 || (exports2.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {}));
    var DiagnosticRefreshRequest;
    (function(DiagnosticRefreshRequest2) {
      DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`;
      DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method);
    })(DiagnosticRefreshRequest || (exports2.DiagnosticRefreshRequest = 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"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = void 0;
    var vscode_languageserver_types_1 = require_main2();
    var Is = 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 || (exports2.NotebookCellKind = 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 Is.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is.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 || (exports2.ExecutionSummary = ExecutionSummary = {}));
    var NotebookCell;
    (function(NotebookCell2) {
      function create(kind, document) {
        return { kind, document };
      }
      NotebookCell2.create = create;
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is.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 (Is.objectLiteral(one) && Is.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 || (exports2.NotebookCell = 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 Is.objectLiteral(candidate) && Is.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is.typedArray(candidate.cells, NotebookCell.is);
      }
      NotebookDocument2.is = is;
    })(NotebookDocument || (exports2.NotebookDocument = NotebookDocument = {}));
    var NotebookDocumentSyncRegistrationType;
    (function(NotebookDocumentSyncRegistrationType2) {
      NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync";
      NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer;
      NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method);
    })(NotebookDocumentSyncRegistrationType || (exports2.NotebookDocumentSyncRegistrationType = 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 || (exports2.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {}));
    var NotebookCellArrayChange;
    (function(NotebookCellArrayChange2) {
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is.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 || (exports2.NotebookCellArrayChange = 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 || (exports2.DidChangeNotebookDocumentNotification = 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 || (exports2.DidSaveNotebookDocumentNotification = 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 || (exports2.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {}));
  }
});

// node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js
var require_protocol_inlineCompletion = __commonJS({
  "node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.InlineCompletionRequest = void 0;
    var messages_1 = require_messages2();
    var InlineCompletionRequest;
    (function(InlineCompletionRequest2) {
      InlineCompletionRequest2.method = "textDocument/inlineCompletion";
      InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method);
    })(InlineCompletionRequest || (exports2.InlineCompletionRequest = InlineCompletionRequest = {}));
  }
});

// node_modules/vscode-languageserver-protocol/lib/common/protocol.js
var require_protocol = __commonJS({
  "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.RelativePattern = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeErrorCodes = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.PositionEncodingKind = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.NotebookCellTextDocumentFilter = exports2.NotebookDocumentFilter = exports2.TextDocumentFilter = void 0;
    exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangesFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolResolveRequest = void 0;
    exports2.InlineCompletionRequest = exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchyPrepareRequest = void 0;
    var messages_1 = require_messages2();
    var vscode_languageserver_types_1 = require_main2();
    var Is = require_is2();
    var protocol_implementation_1 = require_protocol_implementation();
    Object.defineProperty(exports2, "ImplementationRequest", { enumerable: true, get: function() {
      return protocol_implementation_1.ImplementationRequest;
    } });
    var protocol_typeDefinition_1 = require_protocol_typeDefinition();
    Object.defineProperty(exports2, "TypeDefinitionRequest", { enumerable: true, get: function() {
      return protocol_typeDefinition_1.TypeDefinitionRequest;
    } });
    var protocol_workspaceFolder_1 = require_protocol_workspaceFolder();
    Object.defineProperty(exports2, "WorkspaceFoldersRequest", { enumerable: true, get: function() {
      return protocol_workspaceFolder_1.WorkspaceFoldersRequest;
    } });
    Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() {
      return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification;
    } });
    var protocol_configuration_1 = require_protocol_configuration();
    Object.defineProperty(exports2, "ConfigurationRequest", { enumerable: true, get: function() {
      return protocol_configuration_1.ConfigurationRequest;
    } });
    var protocol_colorProvider_1 = require_protocol_colorProvider();
    Object.defineProperty(exports2, "DocumentColorRequest", { enumerable: true, get: function() {
      return protocol_colorProvider_1.DocumentColorRequest;
    } });
    Object.defineProperty(exports2, "ColorPresentationRequest", { enumerable: true, get: function() {
      return protocol_colorProvider_1.ColorPresentationRequest;
    } });
    var protocol_foldingRange_1 = require_protocol_foldingRange();
    Object.defineProperty(exports2, "FoldingRangeRequest", { enumerable: true, get: function() {
      return protocol_foldingRange_1.FoldingRangeRequest;
    } });
    Object.defineProperty(exports2, "FoldingRangeRefreshRequest", { enumerable: true, get: function() {
      return protocol_foldingRange_1.FoldingRangeRefreshRequest;
    } });
    var protocol_declaration_1 = require_protocol_declaration();
    Object.defineProperty(exports2, "DeclarationRequest", { enumerable: true, get: function() {
      return protocol_declaration_1.DeclarationRequest;
    } });
    var protocol_selectionRange_1 = require_protocol_selectionRange();
    Object.defineProperty(exports2, "SelectionRangeRequest", { enumerable: true, get: function() {
      return protocol_selectionRange_1.SelectionRangeRequest;
    } });
    var protocol_progress_1 = require_protocol_progress();
    Object.defineProperty(exports2, "WorkDoneProgress", { enumerable: true, get: function() {
      return protocol_progress_1.WorkDoneProgress;
    } });
    Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() {
      return protocol_progress_1.WorkDoneProgressCreateRequest;
    } });
    Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() {
      return protocol_progress_1.WorkDoneProgressCancelNotification;
    } });
    var protocol_callHierarchy_1 = require_protocol_callHierarchy();
    Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() {
      return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
    } });
    Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() {
      return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
    } });
    Object.defineProperty(exports2, "CallHierarchyPrepareRequest", { enumerable: true, get: function() {
      return protocol_callHierarchy_1.CallHierarchyPrepareRequest;
    } });
    var protocol_semanticTokens_1 = require_protocol_semanticTokens();
    Object.defineProperty(exports2, "TokenFormat", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.TokenFormat;
    } });
    Object.defineProperty(exports2, "SemanticTokensRequest", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.SemanticTokensRequest;
    } });
    Object.defineProperty(exports2, "SemanticTokensDeltaRequest", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.SemanticTokensDeltaRequest;
    } });
    Object.defineProperty(exports2, "SemanticTokensRangeRequest", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.SemanticTokensRangeRequest;
    } });
    Object.defineProperty(exports2, "SemanticTokensRefreshRequest", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.SemanticTokensRefreshRequest;
    } });
    Object.defineProperty(exports2, "SemanticTokensRegistrationType", { enumerable: true, get: function() {
      return protocol_semanticTokens_1.SemanticTokensRegistrationType;
    } });
    var protocol_showDocument_1 = require_protocol_showDocument();
    Object.defineProperty(exports2, "ShowDocumentRequest", { enumerable: true, get: function() {
      return protocol_showDocument_1.ShowDocumentRequest;
    } });
    var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange();
    Object.defineProperty(exports2, "LinkedEditingRangeRequest", { enumerable: true, get: function() {
      return protocol_linkedEditingRange_1.LinkedEditingRangeRequest;
    } });
    var protocol_fileOperations_1 = require_protocol_fileOperations();
    Object.defineProperty(exports2, "FileOperationPatternKind", { enumerable: true, get: function() {
      return protocol_fileOperations_1.FileOperationPatternKind;
    } });
    Object.defineProperty(exports2, "DidCreateFilesNotification", { enumerable: true, get: function() {
      return protocol_fileOperations_1.DidCreateFilesNotification;
    } });
    Object.defineProperty(exports2, "WillCreateFilesRequest", { enumerable: true, get: function() {
      return protocol_fileOperations_1.WillCreateFilesRequest;
    } });
    Object.defineProperty(exports2, "DidRenameFilesNotification", { enumerable: true, get: function() {
      return protocol_fileOperations_1.DidRenameFilesNotification;
    } });
    Object.defineProperty(exports2, "WillRenameFilesRequest", { enumerable: true, get: function() {
      return protocol_fileOperations_1.WillRenameFilesRequest;
    } });
    Object.defineProperty(exports2, "DidDeleteFilesNotification", { enumerable: true, get: function() {
      return protocol_fileOperations_1.DidDeleteFilesNotification;
    } });
    Object.defineProperty(exports2, "WillDeleteFilesRequest", { enumerable: true, get: function() {
      return protocol_fileOperations_1.WillDeleteFilesRequest;
    } });
    var protocol_moniker_1 = require_protocol_moniker();
    Object.defineProperty(exports2, "UniquenessLevel", { enumerable: true, get: function() {
      return protocol_moniker_1.UniquenessLevel;
    } });
    Object.defineProperty(exports2, "MonikerKind", { enumerable: true, get: function() {
      return protocol_moniker_1.MonikerKind;
    } });
    Object.defineProperty(exports2, "MonikerRequest", { enumerable: true, get: function() {
      return protocol_moniker_1.MonikerRequest;
    } });
    var protocol_typeHierarchy_1 = require_protocol_typeHierarchy();
    Object.defineProperty(exports2, "TypeHierarchyPrepareRequest", { enumerable: true, get: function() {
      return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest;
    } });
    Object.defineProperty(exports2, "TypeHierarchySubtypesRequest", { enumerable: true, get: function() {
      return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest;
    } });
    Object.defineProperty(exports2, "TypeHierarchySupertypesRequest", { enumerable: true, get: function() {
      return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest;
    } });
    var protocol_inlineValue_1 = require_protocol_inlineValue();
    Object.defineProperty(exports2, "InlineValueRequest", { enumerable: true, get: function() {
      return protocol_inlineValue_1.InlineValueRequest;
    } });
    Object.defineProperty(exports2, "InlineValueRefreshRequest", { enumerable: true, get: function() {
      return protocol_inlineValue_1.InlineValueRefreshRequest;
    } });
    var protocol_inlayHint_1 = require_protocol_inlayHint();
    Object.defineProperty(exports2, "InlayHintRequest", { enumerable: true, get: function() {
      return protocol_inlayHint_1.InlayHintRequest;
    } });
    Object.defineProperty(exports2, "InlayHintResolveRequest", { enumerable: true, get: function() {
      return protocol_inlayHint_1.InlayHintResolveRequest;
    } });
    Object.defineProperty(exports2, "InlayHintRefreshRequest", { enumerable: true, get: function() {
      return protocol_inlayHint_1.InlayHintRefreshRequest;
    } });
    var protocol_diagnostic_1 = require_protocol_diagnostic();
    Object.defineProperty(exports2, "DiagnosticServerCancellationData", { enumerable: true, get: function() {
      return protocol_diagnostic_1.DiagnosticServerCancellationData;
    } });
    Object.defineProperty(exports2, "DocumentDiagnosticReportKind", { enumerable: true, get: function() {
      return protocol_diagnostic_1.DocumentDiagnosticReportKind;
    } });
    Object.defineProperty(exports2, "DocumentDiagnosticRequest", { enumerable: true, get: function() {
      return protocol_diagnostic_1.DocumentDiagnosticRequest;
    } });
    Object.defineProperty(exports2, "WorkspaceDiagnosticRequest", { enumerable: true, get: function() {
      return protocol_diagnostic_1.WorkspaceDiagnosticRequest;
    } });
    Object.defineProperty(exports2, "DiagnosticRefreshRequest", { enumerable: true, get: function() {
      return protocol_diagnostic_1.DiagnosticRefreshRequest;
    } });
    var protocol_notebook_1 = require_protocol_notebook();
    Object.defineProperty(exports2, "NotebookCellKind", { enumerable: true, get: function() {
      return protocol_notebook_1.NotebookCellKind;
    } });
    Object.defineProperty(exports2, "ExecutionSummary", { enumerable: true, get: function() {
      return protocol_notebook_1.ExecutionSummary;
    } });
    Object.defineProperty(exports2, "NotebookCell", { enumerable: true, get: function() {
      return protocol_notebook_1.NotebookCell;
    } });
    Object.defineProperty(exports2, "NotebookDocument", { enumerable: true, get: function() {
      return protocol_notebook_1.NotebookDocument;
    } });
    Object.defineProperty(exports2, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: function() {
      return protocol_notebook_1.NotebookDocumentSyncRegistrationType;
    } });
    Object.defineProperty(exports2, "DidOpenNotebookDocumentNotification", { enumerable: true, get: function() {
      return protocol_notebook_1.DidOpenNotebookDocumentNotification;
    } });
    Object.defineProperty(exports2, "NotebookCellArrayChange", { enumerable: true, get: function() {
      return protocol_notebook_1.NotebookCellArrayChange;
    } });
    Object.defineProperty(exports2, "DidChangeNotebookDocumentNotification", { enumerable: true, get: function() {
      return protocol_notebook_1.DidChangeNotebookDocumentNotification;
    } });
    Object.defineProperty(exports2, "DidSaveNotebookDocumentNotification", { enumerable: true, get: function() {
      return protocol_notebook_1.DidSaveNotebookDocumentNotification;
    } });
    Object.defineProperty(exports2, "DidCloseNotebookDocumentNotification", { enumerable: true, get: function() {
      return protocol_notebook_1.DidCloseNotebookDocumentNotification;
    } });
    var protocol_inlineCompletion_1 = require_protocol_inlineCompletion();
    Object.defineProperty(exports2, "InlineCompletionRequest", { enumerable: true, get: function() {
      return protocol_inlineCompletion_1.InlineCompletionRequest;
    } });
    var TextDocumentFilter;
    (function(TextDocumentFilter2) {
      function is(value) {
        const candidate = value;
        return Is.string(candidate) || (Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern));
      }
      TextDocumentFilter2.is = is;
    })(TextDocumentFilter || (exports2.TextDocumentFilter = TextDocumentFilter = {}));
    var NotebookDocumentFilter;
    (function(NotebookDocumentFilter2) {
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && (Is.string(candidate.notebookType) || Is.string(candidate.scheme) || Is.string(candidate.pattern));
      }
      NotebookDocumentFilter2.is = is;
    })(NotebookDocumentFilter || (exports2.NotebookDocumentFilter = NotebookDocumentFilter = {}));
    var NotebookCellTextDocumentFilter;
    (function(NotebookCellTextDocumentFilter2) {
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && (Is.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is.string(candidate.language));
      }
      NotebookCellTextDocumentFilter2.is = is;
    })(NotebookCellTextDocumentFilter || (exports2.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {}));
    var DocumentSelector2;
    (function(DocumentSelector3) {
      function is(value) {
        if (!Array.isArray(value)) {
          return false;
        }
        for (let elem of value) {
          if (!Is.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) {
            return false;
          }
        }
        return true;
      }
      DocumentSelector3.is = is;
    })(DocumentSelector2 || (exports2.DocumentSelector = DocumentSelector2 = {}));
    var RegistrationRequest;
    (function(RegistrationRequest2) {
      RegistrationRequest2.method = "client/registerCapability";
      RegistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      RegistrationRequest2.type = new messages_1.ProtocolRequestType(RegistrationRequest2.method);
    })(RegistrationRequest || (exports2.RegistrationRequest = RegistrationRequest = {}));
    var UnregistrationRequest;
    (function(UnregistrationRequest2) {
      UnregistrationRequest2.method = "client/unregisterCapability";
      UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method);
    })(UnregistrationRequest || (exports2.UnregistrationRequest = UnregistrationRequest = {}));
    var ResourceOperationKind;
    (function(ResourceOperationKind2) {
      ResourceOperationKind2.Create = "create";
      ResourceOperationKind2.Rename = "rename";
      ResourceOperationKind2.Delete = "delete";
    })(ResourceOperationKind || (exports2.ResourceOperationKind = ResourceOperationKind = {}));
    var FailureHandlingKind;
    (function(FailureHandlingKind2) {
      FailureHandlingKind2.Abort = "abort";
      FailureHandlingKind2.Transactional = "transactional";
      FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional";
      FailureHandlingKind2.Undo = "undo";
    })(FailureHandlingKind || (exports2.FailureHandlingKind = FailureHandlingKind = {}));
    var PositionEncodingKind;
    (function(PositionEncodingKind2) {
      PositionEncodingKind2.UTF8 = "utf-8";
      PositionEncodingKind2.UTF16 = "utf-16";
      PositionEncodingKind2.UTF32 = "utf-32";
    })(PositionEncodingKind || (exports2.PositionEncodingKind = PositionEncodingKind = {}));
    var StaticRegistrationOptions;
    (function(StaticRegistrationOptions2) {
      function hasId(value) {
        const candidate = value;
        return candidate && Is.string(candidate.id) && candidate.id.length > 0;
      }
      StaticRegistrationOptions2.hasId = hasId;
    })(StaticRegistrationOptions || (exports2.StaticRegistrationOptions = StaticRegistrationOptions = {}));
    var TextDocumentRegistrationOptions;
    (function(TextDocumentRegistrationOptions2) {
      function is(value) {
        const candidate = value;
        return candidate && (candidate.documentSelector === null || DocumentSelector2.is(candidate.documentSelector));
      }
      TextDocumentRegistrationOptions2.is = is;
    })(TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {}));
    var WorkDoneProgressOptions;
    (function(WorkDoneProgressOptions2) {
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is.boolean(candidate.workDoneProgress));
      }
      WorkDoneProgressOptions2.is = is;
      function hasWorkDoneProgress(value) {
        const candidate = value;
        return candidate && Is.boolean(candidate.workDoneProgress);
      }
      WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress;
    })(WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = WorkDoneProgressOptions = {}));
    var InitializeRequest;
    (function(InitializeRequest2) {
      InitializeRequest2.method = "initialize";
      InitializeRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      InitializeRequest2.type = new messages_1.ProtocolRequestType(InitializeRequest2.method);
    })(InitializeRequest || (exports2.InitializeRequest = InitializeRequest = {}));
    var InitializeErrorCodes;
    (function(InitializeErrorCodes2) {
      InitializeErrorCodes2.unknownProtocolVersion = 1;
    })(InitializeErrorCodes || (exports2.InitializeErrorCodes = InitializeErrorCodes = {}));
    var InitializedNotification;
    (function(InitializedNotification2) {
      InitializedNotification2.method = "initialized";
      InitializedNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      InitializedNotification2.type = new messages_1.ProtocolNotificationType(InitializedNotification2.method);
    })(InitializedNotification || (exports2.InitializedNotification = InitializedNotification = {}));
    var ShutdownRequest;
    (function(ShutdownRequest2) {
      ShutdownRequest2.method = "shutdown";
      ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method);
    })(ShutdownRequest || (exports2.ShutdownRequest = ShutdownRequest = {}));
    var ExitNotification;
    (function(ExitNotification2) {
      ExitNotification2.method = "exit";
      ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method);
    })(ExitNotification || (exports2.ExitNotification = ExitNotification = {}));
    var DidChangeConfigurationNotification3;
    (function(DidChangeConfigurationNotification4) {
      DidChangeConfigurationNotification4.method = "workspace/didChangeConfiguration";
      DidChangeConfigurationNotification4.messageDirection = messages_1.MessageDirection.clientToServer;
      DidChangeConfigurationNotification4.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification4.method);
    })(DidChangeConfigurationNotification3 || (exports2.DidChangeConfigurationNotification = DidChangeConfigurationNotification3 = {}));
    var MessageType2;
    (function(MessageType3) {
      MessageType3.Error = 1;
      MessageType3.Warning = 2;
      MessageType3.Info = 3;
      MessageType3.Log = 4;
      MessageType3.Debug = 5;
    })(MessageType2 || (exports2.MessageType = MessageType2 = {}));
    var ShowMessageNotification;
    (function(ShowMessageNotification2) {
      ShowMessageNotification2.method = "window/showMessage";
      ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
      ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method);
    })(ShowMessageNotification || (exports2.ShowMessageNotification = ShowMessageNotification = {}));
    var ShowMessageRequest;
    (function(ShowMessageRequest2) {
      ShowMessageRequest2.method = "window/showMessageRequest";
      ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method);
    })(ShowMessageRequest || (exports2.ShowMessageRequest = ShowMessageRequest = {}));
    var LogMessageNotification;
    (function(LogMessageNotification2) {
      LogMessageNotification2.method = "window/logMessage";
      LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
      LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method);
    })(LogMessageNotification || (exports2.LogMessageNotification = LogMessageNotification = {}));
    var TelemetryEventNotification;
    (function(TelemetryEventNotification2) {
      TelemetryEventNotification2.method = "telemetry/event";
      TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
      TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method);
    })(TelemetryEventNotification || (exports2.TelemetryEventNotification = TelemetryEventNotification = {}));
    var TextDocumentSyncKind;
    (function(TextDocumentSyncKind2) {
      TextDocumentSyncKind2.None = 0;
      TextDocumentSyncKind2.Full = 1;
      TextDocumentSyncKind2.Incremental = 2;
    })(TextDocumentSyncKind || (exports2.TextDocumentSyncKind = TextDocumentSyncKind = {}));
    var DidOpenTextDocumentNotification;
    (function(DidOpenTextDocumentNotification2) {
      DidOpenTextDocumentNotification2.method = "textDocument/didOpen";
      DidOpenTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method);
    })(DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = 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 || (exports2.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {}));
    var DidChangeTextDocumentNotification;
    (function(DidChangeTextDocumentNotification2) {
      DidChangeTextDocumentNotification2.method = "textDocument/didChange";
      DidChangeTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method);
    })(DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification = {}));
    var DidCloseTextDocumentNotification;
    (function(DidCloseTextDocumentNotification2) {
      DidCloseTextDocumentNotification2.method = "textDocument/didClose";
      DidCloseTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method);
    })(DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification = {}));
    var DidSaveTextDocumentNotification;
    (function(DidSaveTextDocumentNotification2) {
      DidSaveTextDocumentNotification2.method = "textDocument/didSave";
      DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method);
    })(DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {}));
    var TextDocumentSaveReason;
    (function(TextDocumentSaveReason2) {
      TextDocumentSaveReason2.Manual = 1;
      TextDocumentSaveReason2.AfterDelay = 2;
      TextDocumentSaveReason2.FocusOut = 3;
    })(TextDocumentSaveReason || (exports2.TextDocumentSaveReason = TextDocumentSaveReason = {}));
    var WillSaveTextDocumentNotification;
    (function(WillSaveTextDocumentNotification2) {
      WillSaveTextDocumentNotification2.method = "textDocument/willSave";
      WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method);
    })(WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {}));
    var WillSaveTextDocumentWaitUntilRequest;
    (function(WillSaveTextDocumentWaitUntilRequest2) {
      WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil";
      WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method);
    })(WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {}));
    var DidChangeWatchedFilesNotification;
    (function(DidChangeWatchedFilesNotification2) {
      DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles";
      DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer;
      DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method);
    })(DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {}));
    var FileChangeType;
    (function(FileChangeType2) {
      FileChangeType2.Created = 1;
      FileChangeType2.Changed = 2;
      FileChangeType2.Deleted = 3;
    })(FileChangeType || (exports2.FileChangeType = FileChangeType = {}));
    var RelativePattern2;
    (function(RelativePattern3) {
      function is(value) {
        const candidate = value;
        return Is.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is.string(candidate.pattern);
      }
      RelativePattern3.is = is;
    })(RelativePattern2 || (exports2.RelativePattern = RelativePattern2 = {}));
    var WatchKind;
    (function(WatchKind2) {
      WatchKind2.Create = 1;
      WatchKind2.Change = 2;
      WatchKind2.Delete = 4;
    })(WatchKind || (exports2.WatchKind = WatchKind = {}));
    var PublishDiagnosticsNotification;
    (function(PublishDiagnosticsNotification2) {
      PublishDiagnosticsNotification2.method = "textDocument/publishDiagnostics";
      PublishDiagnosticsNotification2.messageDirection = messages_1.MessageDirection.serverToClient;
      PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method);
    })(PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = PublishDiagnosticsNotification = {}));
    var CompletionTriggerKind;
    (function(CompletionTriggerKind2) {
      CompletionTriggerKind2.Invoked = 1;
      CompletionTriggerKind2.TriggerCharacter = 2;
      CompletionTriggerKind2.TriggerForIncompleteCompletions = 3;
    })(CompletionTriggerKind || (exports2.CompletionTriggerKind = CompletionTriggerKind = {}));
    var CompletionRequest;
    (function(CompletionRequest2) {
      CompletionRequest2.method = "textDocument/completion";
      CompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method);
    })(CompletionRequest || (exports2.CompletionRequest = CompletionRequest = {}));
    var CompletionResolveRequest;
    (function(CompletionResolveRequest2) {
      CompletionResolveRequest2.method = "completionItem/resolve";
      CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method);
    })(CompletionResolveRequest || (exports2.CompletionResolveRequest = CompletionResolveRequest = {}));
    var HoverRequest3;
    (function(HoverRequest4) {
      HoverRequest4.method = "textDocument/hover";
      HoverRequest4.messageDirection = messages_1.MessageDirection.clientToServer;
      HoverRequest4.type = new messages_1.ProtocolRequestType(HoverRequest4.method);
    })(HoverRequest3 || (exports2.HoverRequest = HoverRequest3 = {}));
    var SignatureHelpTriggerKind;
    (function(SignatureHelpTriggerKind2) {
      SignatureHelpTriggerKind2.Invoked = 1;
      SignatureHelpTriggerKind2.TriggerCharacter = 2;
      SignatureHelpTriggerKind2.ContentChange = 3;
    })(SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {}));
    var SignatureHelpRequest;
    (function(SignatureHelpRequest2) {
      SignatureHelpRequest2.method = "textDocument/signatureHelp";
      SignatureHelpRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method);
    })(SignatureHelpRequest || (exports2.SignatureHelpRequest = SignatureHelpRequest = {}));
    var DefinitionRequest2;
    (function(DefinitionRequest3) {
      DefinitionRequest3.method = "textDocument/definition";
      DefinitionRequest3.messageDirection = messages_1.MessageDirection.clientToServer;
      DefinitionRequest3.type = new messages_1.ProtocolRequestType(DefinitionRequest3.method);
    })(DefinitionRequest2 || (exports2.DefinitionRequest = DefinitionRequest2 = {}));
    var ReferencesRequest;
    (function(ReferencesRequest2) {
      ReferencesRequest2.method = "textDocument/references";
      ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method);
    })(ReferencesRequest || (exports2.ReferencesRequest = ReferencesRequest = {}));
    var DocumentHighlightRequest;
    (function(DocumentHighlightRequest2) {
      DocumentHighlightRequest2.method = "textDocument/documentHighlight";
      DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method);
    })(DocumentHighlightRequest || (exports2.DocumentHighlightRequest = DocumentHighlightRequest = {}));
    var DocumentSymbolRequest3;
    (function(DocumentSymbolRequest4) {
      DocumentSymbolRequest4.method = "textDocument/documentSymbol";
      DocumentSymbolRequest4.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentSymbolRequest4.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest4.method);
    })(DocumentSymbolRequest3 || (exports2.DocumentSymbolRequest = DocumentSymbolRequest3 = {}));
    var CodeActionRequest2;
    (function(CodeActionRequest3) {
      CodeActionRequest3.method = "textDocument/codeAction";
      CodeActionRequest3.messageDirection = messages_1.MessageDirection.clientToServer;
      CodeActionRequest3.type = new messages_1.ProtocolRequestType(CodeActionRequest3.method);
    })(CodeActionRequest2 || (exports2.CodeActionRequest = CodeActionRequest2 = {}));
    var CodeActionResolveRequest;
    (function(CodeActionResolveRequest2) {
      CodeActionResolveRequest2.method = "codeAction/resolve";
      CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method);
    })(CodeActionResolveRequest || (exports2.CodeActionResolveRequest = CodeActionResolveRequest = {}));
    var WorkspaceSymbolRequest2;
    (function(WorkspaceSymbolRequest3) {
      WorkspaceSymbolRequest3.method = "workspace/symbol";
      WorkspaceSymbolRequest3.messageDirection = messages_1.MessageDirection.clientToServer;
      WorkspaceSymbolRequest3.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest3.method);
    })(WorkspaceSymbolRequest2 || (exports2.WorkspaceSymbolRequest = WorkspaceSymbolRequest2 = {}));
    var WorkspaceSymbolResolveRequest;
    (function(WorkspaceSymbolResolveRequest2) {
      WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve";
      WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method);
    })(WorkspaceSymbolResolveRequest || (exports2.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {}));
    var CodeLensRequest;
    (function(CodeLensRequest2) {
      CodeLensRequest2.method = "textDocument/codeLens";
      CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method);
    })(CodeLensRequest || (exports2.CodeLensRequest = CodeLensRequest = {}));
    var CodeLensResolveRequest;
    (function(CodeLensResolveRequest2) {
      CodeLensResolveRequest2.method = "codeLens/resolve";
      CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method);
    })(CodeLensResolveRequest || (exports2.CodeLensResolveRequest = 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 || (exports2.CodeLensRefreshRequest = CodeLensRefreshRequest = {}));
    var DocumentLinkRequest;
    (function(DocumentLinkRequest2) {
      DocumentLinkRequest2.method = "textDocument/documentLink";
      DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method);
    })(DocumentLinkRequest || (exports2.DocumentLinkRequest = DocumentLinkRequest = {}));
    var DocumentLinkResolveRequest;
    (function(DocumentLinkResolveRequest2) {
      DocumentLinkResolveRequest2.method = "documentLink/resolve";
      DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method);
    })(DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {}));
    var DocumentFormattingRequest;
    (function(DocumentFormattingRequest2) {
      DocumentFormattingRequest2.method = "textDocument/formatting";
      DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method);
    })(DocumentFormattingRequest || (exports2.DocumentFormattingRequest = DocumentFormattingRequest = {}));
    var DocumentRangeFormattingRequest;
    (function(DocumentRangeFormattingRequest2) {
      DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting";
      DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method);
    })(DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {}));
    var DocumentRangesFormattingRequest;
    (function(DocumentRangesFormattingRequest2) {
      DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting";
      DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method);
    })(DocumentRangesFormattingRequest || (exports2.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {}));
    var DocumentOnTypeFormattingRequest;
    (function(DocumentOnTypeFormattingRequest2) {
      DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting";
      DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method);
    })(DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {}));
    var PrepareSupportDefaultBehavior;
    (function(PrepareSupportDefaultBehavior2) {
      PrepareSupportDefaultBehavior2.Identifier = 1;
    })(PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {}));
    var RenameRequest;
    (function(RenameRequest2) {
      RenameRequest2.method = "textDocument/rename";
      RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method);
    })(RenameRequest || (exports2.RenameRequest = RenameRequest = {}));
    var PrepareRenameRequest;
    (function(PrepareRenameRequest2) {
      PrepareRenameRequest2.method = "textDocument/prepareRename";
      PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer;
      PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method);
    })(PrepareRenameRequest || (exports2.PrepareRenameRequest = PrepareRenameRequest = {}));
    var ExecuteCommandRequest2;
    (function(ExecuteCommandRequest3) {
      ExecuteCommandRequest3.method = "workspace/executeCommand";
      ExecuteCommandRequest3.messageDirection = messages_1.MessageDirection.clientToServer;
      ExecuteCommandRequest3.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest3.method);
    })(ExecuteCommandRequest2 || (exports2.ExecuteCommandRequest = ExecuteCommandRequest2 = {}));
    var ApplyWorkspaceEditRequest;
    (function(ApplyWorkspaceEditRequest2) {
      ApplyWorkspaceEditRequest2.method = "workspace/applyEdit";
      ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient;
      ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit");
    })(ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {}));
  }
});

// node_modules/vscode-languageserver-protocol/lib/common/connection.js
var require_connection2 = __commonJS({
  "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.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);
    }
    exports2.createProtocolConnection = createProtocolConnection;
  }
});

// node_modules/vscode-languageserver-protocol/lib/common/api.js
var require_api2 = __commonJS({
  "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__exportStar || function(m, exports3) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0;
    __exportStar(require_main(), exports2);
    __exportStar(require_main2(), exports2);
    __exportStar(require_messages2(), exports2);
    __exportStar(require_protocol(), exports2);
    var connection_1 = require_connection2();
    Object.defineProperty(exports2, "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 || (exports2.LSPErrorCodes = LSPErrorCodes = {}));
  }
});

// node_modules/vscode-languageserver-protocol/lib/node/main.js
var require_main3 = __commonJS({
  "node_modules/vscode-languageserver-protocol/lib/node/main.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__exportStar || function(m, exports3) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.createProtocolConnection = void 0;
    var node_1 = require_node();
    __exportStar(require_node(), exports2);
    __exportStar(require_api2(), exports2);
    function createProtocolConnection(input, output, logger2, options2) {
      return (0, node_1.createMessageConnection)(input, output, logger2, options2);
    }
    exports2.createProtocolConnection = createProtocolConnection;
  }
});

// node_modules/lodash/lodash.js
var require_lodash = __commonJS({
  "node_modules/lodash/lodash.js"(exports2, module2) {
    (function() {
      var undefined2;
      var VERSION = "4.18.1";
      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`", INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` 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 = {
        // Latin-1 Supplement block.
        "\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",
        // Latin Extended-A block.
        "\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 = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#39;"
      };
      var htmlUnescapes = {
        "&amp;": "&",
        "&lt;": "<",
        "&gt;": ">",
        "&quot;": '"',
        "&#39;": "'"
      };
      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 exports2 == "object" && exports2 && !exports2.nodeType && exports2;
      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 Buffer3 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.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 = Buffer3 ? Buffer3.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 = /* @__PURE__ */ (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 = {
          /**
           * Used to detect `data` property values to be HTML-escaped.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "escape": reEscape,
          /**
           * Used to detect code to be evaluated.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "evaluate": reEvaluate,
          /**
           * Used to detect `data` property values to inject.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "interpolate": reInterpolate,
          /**
           * Used to reference the data object in the template text.
           *
           * @memberOf _.templateSettings
           * @type {string}
           */
          "variable": "",
          /**
           * Used to import variables into the compiled template.
           *
           * @memberOf _.templateSettings
           * @type {Object}
           */
          "imports": {
            /**
             * A reference to the `lodash` function.
             *
             * @memberOf _.templateSettings.imports
             * @type {Function}
             */
            "_": 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 && // Safari 9 has enumerable `arguments.length` in strict mode.
            (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
            isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
            isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
            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);
          var index = -1, length = path18.length;
          if (!length) {
            return true;
          }
          while (++index < length) {
            var key = toKey(path18[index]);
            if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
              return false;
            }
            if ((key === "constructor" || key === "prototype") && index < length - 1) {
              return false;
            }
          }
          var obj = parent(object, path18);
          return obj == null || delete obj[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 findIndex(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];
            baseAssignValue(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 remove2(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(findIndex);
        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(/* @__PURE__ */ (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 lt2 = 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 merge = 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 = assignWith({}, options2, settings, customDefaultsAssignIn);
          var imports = assignWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
          arrayEach(importsKeys, function(key) {
            if (reForbiddenIdentifierChars.test(key)) {
              throw new Error2(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
            }
          });
          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 = merge;
        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 = remove2;
        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 = findIndex;
        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 = lt2;
        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(exports2);
  }
});

// node_modules/fmtr/index.js
var require_fmtr = __commonJS({
  "node_modules/fmtr/index.js"(exports2, 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/expand-home-dir/index.js
var require_expand_home_dir = __commonJS({
  "node_modules/expand-home-dir/index.js"(exports2, module2) {
    var join12 = require("path").join;
    var homedir2 = process.env[process.platform == "win32" ? "USERPROFILE" : "HOME"];
    module2.exports = expandHomeDir2;
    function expandHomeDir2(path18) {
      if (!path18) return path18;
      if (path18 == "~") return homedir2;
      if (path18.slice(0, 2) != "~/") return path18;
      return join12(homedir2, path18.slice(2));
    }
  }
});

// node_modules/jdk-utils/dist/logger.js
var require_logger = __commonJS({
  "node_modules/jdk-utils/dist/logger.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.log = void 0;
    function log(...args) {
    }
    exports2.log = log;
  }
});

// node_modules/jdk-utils/dist/from/asdf.js
var require_asdf = __commonJS({
  "node_modules/jdk-utils/dist/from/asdf.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __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(os5.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 fs7.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;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/utils.js
var require_utils = __commonJS({
  "node_modules/jdk-utils/dist/utils.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.getRealHome = exports2.expandTilde = exports2.deDup = exports2.looksLikeJavaHome = exports2.JAVAC_FILENAME = exports2.JAVA_FILENAME = exports2.isArm = exports2.isLinux = exports2.isMac = exports2.isWindows = void 0;
    var fs7 = __importStar(require("fs"));
    var os_1 = require("os");
    var path_1 = require("path");
    var logger2 = __importStar(require_logger());
    exports2.isWindows = process.platform.indexOf("win") === 0;
    exports2.isMac = process.platform.indexOf("darwin") === 0;
    exports2.isLinux = process.platform.indexOf("linux") === 0;
    exports2.isArm = process.arch.indexOf("arm") === 0;
    exports2.JAVA_FILENAME = exports2.isWindows ? "java.exe" : "java";
    exports2.JAVAC_FILENAME = exports2.isWindows ? "javac.exe" : "javac";
    function looksLikeJavaHome(dir) {
      const lower = dir.toLocaleLowerCase();
      return lower.includes("jdk") || lower.includes("java");
    }
    exports2.looksLikeJavaHome = looksLikeJavaHome;
    function deDup(arr) {
      return Array.from(new Set(arr));
    }
    exports2.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;
      }
    }
    exports2.expandTilde = expandTilde;
    function getRealHome(javaHomePathLike) {
      return __awaiter(this, void 0, void 0, function* () {
        const javaBinaryPath = expandTilde((0, path_1.join)(javaHomePathLike, "bin", exports2.JAVA_FILENAME));
        try {
          const rp = yield fs7.promises.realpath(javaBinaryPath);
          return (0, path_1.dirname)((0, path_1.dirname)(rp));
        } catch (error) {
          logger2.log(error);
        }
        return void 0;
      });
    }
    exports2.getRealHome = getRealHome;
  }
});

// node_modules/jdk-utils/dist/from/envs.js
var require_envs = __commonJS({
  "node_modules/jdk-utils/dist/from/envs.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidatesFromSpecificEnv = exports2.candidatesFromPath = void 0;
    var fs7 = __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) || fs7.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);
      });
    }
    exports2.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;
      });
    }
    exports2.candidatesFromSpecificEnv = candidatesFromSpecificEnv;
  }
});

// node_modules/jdk-utils/dist/from/gradle.js
var require_gradle = __commonJS({
  "node_modules/jdk-utils/dist/from/gradle.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __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(os5.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 fs7.promises.readdir(JDK_BASE_DIR, { withFileTypes: true })) {
            if (distro.isDirectory()) {
              const distroDir = path18.join(JDK_BASE_DIR, distro.name);
              const files = yield fs7.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;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/homebrew.js
var require_homebrew = __commonJS({
  "node_modules/jdk-utils/dist/from/homebrew.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = exports2.HOMEBREW_DIR_LINUX = exports2.HOMEBREW_DIR_APPLE_SILLICON = exports2.HOMEBREW_DIR_INTEL = void 0;
    var fs7 = __importStar(require("fs"));
    var path18 = __importStar(require("path"));
    var logger_1 = require_logger();
    var utils_1 = require_utils();
    exports2.HOMEBREW_DIR_INTEL = "/usr/local/opt";
    exports2.HOMEBREW_DIR_APPLE_SILLICON = "/opt/homebrew/opt";
    exports2.HOMEBREW_DIR_LINUX = "/home/linuxbrew/.linuxbrew/opt";
    function candidates(homebrewOptPath) {
      return __awaiter(this, void 0, void 0, function* () {
        const ret = [];
        try {
          const files = yield fs7.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);
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/jabba.js
var require_jabba = __commonJS({
  "node_modules/jdk-utils/dist/from/jabba.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __importStar(require("os"));
    var path18 = __importStar(require("path"));
    var logger_1 = require_logger();
    var JABBA_DIR = path18.join(os5.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 fs7.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;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/jenv.js
var require_jenv = __commonJS({
  "node_modules/jdk-utils/dist/from/jenv.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __importStar(require("os"));
    var path18 = __importStar(require("path"));
    var logger_1 = require_logger();
    var utils_1 = require_utils();
    var JENV_DIR = path18.join(os5.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 fs7.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) => fs7.promises.realpath(file)));
          const uniqHomes = (0, utils_1.deDup)(actualHomeDirs);
          ret.push(...uniqHomes);
        } catch (error) {
          (0, logger_1.log)(error);
        }
        return ret;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/linux.js
var require_linux = __commonJS({
  "node_modules/jdk-utils/dist/from/linux.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var path18 = __importStar(require("path"));
    var logger_1 = require_logger();
    var JDK_BASE_DIRS = [
      "/usr/lib/jvm",
      "/usr/java"
      // Java 8 on CentOS?
      // ... add more if necessary
    ];
    function candidates() {
      return __awaiter(this, void 0, void 0, function* () {
        const ret = [];
        for (const baseDir of JDK_BASE_DIRS) {
          try {
            const files = yield fs7.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;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/macOS.js
var require_macOS = __commonJS({
  "node_modules/jdk-utils/dist/from/macOS.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var cp = __importStar(require("child_process"));
    var fs7 = __importStar(require("fs"));
    var os5 = __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(os5.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);
      });
    }
    exports2.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 fs7.promises.readdir(baseDir, { withFileTypes: true });
            const homedirs = files.filter((file) => file.isDirectory()).map((file) => path18.join(
              baseDir,
              file.name,
              "Contents",
              "Home"
              /** macOS specific subfolder */
            ));
            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 fs7.promises.access(javaHomeUtility, fs7.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"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __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(os5.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 fs7.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;
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/from/windows.js
var require_windows = __commonJS({
  "node_modules/jdk-utils/dist/from/windows.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.candidates = void 0;
    var fs7 = __importStar(require("fs"));
    var os5 = __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(os5.homedir(), "AppData", "Local")
    ])).filter(Boolean);
    var POPULAR_DISTRIBUTIONS = [
      "Eclipse Foundation",
      "Eclipse Adoptium",
      "Java",
      "Amazon Corretto",
      "Microsoft",
      path18.join("SapMachine", "JDK"),
      "Zulu"
      // Azul OpenJDK
    ];
    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 fs7.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);
      });
    }
    exports2.candidates = candidates;
  }
});

// node_modules/jdk-utils/dist/index.js
var require_dist = __commonJS({
  "node_modules/jdk-utils/dist/index.js"(exports2) {
    "use strict";
    var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
    exports2.getSources = exports2.getRuntime = exports2.findRuntimes = exports2.JAVA_FILENAME = exports2.JAVAC_FILENAME = void 0;
    var cp = __importStar(require("child_process"));
    var fs7 = __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(exports2, "JAVAC_FILENAME", { enumerable: true, get: function() {
      return utils_2.JAVAC_FILENAME;
    } });
    Object.defineProperty(exports2, "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((homedir2) => ({ homedir: homedir2 }));
        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;
      });
    }
    exports2.findRuntimes = findRuntimes3;
    function getRuntime3(homedir2, options2) {
      return __awaiter(this, void 0, void 0, function* () {
        let runtime = { homedir: homedir2 };
        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(homedir2)) {
            runtime.isFromGradle = true;
          }
          const aList = yield asdf.candidates();
          if (aList.includes(homedir2)) {
            runtime.isFromASDF = true;
          }
          const jList = yield jenv.candidates();
          if (jList.includes(homedir2)) {
            runtime.isFromJENV = true;
          }
          const sList = yield sdkman.candidates();
          if (sList.includes(homedir2)) {
            runtime.isFromSDKMAN = true;
          }
          const jbList = yield jabba.candidates();
          if (jbList.includes(homedir2)) {
            runtime.isFromJabba = true;
          }
          const pList = yield envs.candidatesFromPath();
          if (pList.includes(homedir2)) {
            runtime.isInPathEnv = true;
          }
          if ((yield envs.candidatesFromSpecificEnv("JAVA_HOME")) === homedir2) {
            runtime.isJavaHomeEnv = true;
          }
          if ((yield envs.candidatesFromSpecificEnv("JDK_HOME")) === homedir2) {
            runtime.isJdkHomeEnv = true;
          }
        }
        return runtime;
      });
    }
    exports2.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;
    }
    exports2.getSources = getSources2;
    function checkJavaFile(runtime) {
      return __awaiter(this, void 0, void 0, function* () {
        const { homedir: homedir2 } = runtime;
        const binary = path18.join(homedir2, "bin", utils_1.JAVA_FILENAME);
        try {
          yield fs7.promises.access(binary, fs7.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: homedir2 } = runtime;
        const binary = path18.join(homedir2, "bin", utils_1.JAVAC_FILENAME);
        try {
          yield fs7.promises.access(binary, fs7.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: homedir2 } = runtime;
        const releaseFile = path18.join(homedir2, "release");
        try {
          const content = yield fs7.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(homedir2);
          } 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(homedir2, updater) {
        var _a;
        const runtime = this.map.get(homedir2) || { homedir: homedir2 };
        this.map.set(homedir2, (_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/fs.realpath/old.js
var require_old = __commonJS({
  "node_modules/fs.realpath/old.js"(exports2) {
    var pathModule = require("path");
    var isWindows = process.platform === "win32";
    var fs7 = 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;
    exports2.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]) {
          fs7.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 = fs7.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) {
            fs7.statSync(base);
            linkTarget = fs7.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;
    };
    exports2.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]) {
          fs7.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 fs7.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);
          }
        }
        fs7.stat(base, function(err2) {
          if (err2) return cb(err2);
          fs7.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"(exports2, module2) {
    module2.exports = realpath;
    realpath.realpath = realpath;
    realpath.sync = realpathSync;
    realpath.realpathSync = realpathSync;
    realpath.monkeypatch = monkeypatch;
    realpath.unmonkeypatch = unmonkeypatch;
    var fs7 = require("fs");
    var origRealpath = fs7.realpath;
    var origRealpathSync = fs7.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() {
      fs7.realpath = realpath;
      fs7.realpathSync = realpathSync;
    }
    function unmonkeypatch() {
      fs7.realpath = origRealpath;
      fs7.realpathSync = origRealpathSync;
    }
  }
});

// node_modules/concat-map/index.js
var require_concat_map = __commonJS({
  "node_modules/concat-map/index.js"(exports2, 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"(exports2, 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"(exports2, 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, options2) {
      if (!str)
        return [];
      options2 = options2 || {};
      var max = options2.max == null ? Infinity : options2.max;
      if (str.substr(0, 2) === "{}") {
        str = "\\{\\}" + str.substr(2);
      }
      return expand(escapeBraces(str), max, 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, max, 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, max, true);
        }
        return [str];
      }
      var n;
      if (isSequence) {
        n = m.body.split(/\.\./);
      } else {
        n = parseCommaParts(m.body);
        if (n.length === 1) {
          n = expand(n[0], max, false).map(embrace);
          if (n.length === 1) {
            var post = m.post.length ? expand(m.post, max, false) : [""];
            return post.map(function(p) {
              return m.pre + n[0] + p;
            });
          }
        }
      }
      var pre = m.pre;
      var post = m.post.length ? expand(m.post, max, 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.max(Math.abs(numeric(n[2])), 1) : 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) && N.length < max; 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, max, false);
        });
      }
      for (var j = 0; j < N.length; j++) {
        for (var k = 0; k < post.length && expansions.length < max; 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"(exports2, 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.maxGlobstarRecursion = options2.maxGlobstarRecursion !== void 0 ? options2.maxGlobstarRecursion : 200;
      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) {
          /* istanbul ignore next */
          case "/": {
            return false;
          }
          case "\\":
            clearStateChar();
            escaping = true;
            continue;
          // the various stateChar values
          // for the "extglob" stuff.
          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;
            }
            if (c === "*" && stateChar === "*") 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;
          // these are mostly the same in regexp and glob
          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) {
      if (pattern.indexOf(GLOBSTAR) !== -1) {
        return this._matchGlobstar(file, pattern, partial, 0, 0);
      }
      return this._matchOne(file, pattern, partial, 0, 0);
    };
    Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
      var i;
      var firstgs = -1;
      for (i = patternIndex; i < pattern.length; i++) {
        if (pattern[i] === GLOBSTAR) {
          firstgs = i;
          break;
        }
      }
      var lastgs = -1;
      for (i = pattern.length - 1; i >= 0; i--) {
        if (pattern[i] === GLOBSTAR) {
          lastgs = i;
          break;
        }
      }
      var head = pattern.slice(patternIndex, firstgs);
      var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
      var tail = partial ? [] : pattern.slice(lastgs + 1);
      if (head.length) {
        var fileHead = file.slice(fileIndex, fileIndex + head.length);
        if (!this._matchOne(fileHead, head, partial, 0, 0)) {
          return false;
        }
        fileIndex += head.length;
      }
      var fileTailMatch = 0;
      if (tail.length) {
        if (tail.length + fileIndex > file.length) return false;
        var tailStart = file.length - tail.length;
        if (this._matchOne(file, tail, partial, tailStart, 0)) {
          fileTailMatch = tail.length;
        } else {
          if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
            return false;
          }
          tailStart--;
          if (!this._matchOne(file, tail, partial, tailStart, 0)) {
            return false;
          }
          fileTailMatch = tail.length + 1;
        }
      }
      if (!body.length) {
        var sawSome = !!fileTailMatch;
        for (i = fileIndex; i < file.length - fileTailMatch; i++) {
          var f = String(file[i]);
          sawSome = true;
          if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
            return false;
          }
        }
        return partial || sawSome;
      }
      var bodySegments = [[[], 0]];
      var currentBody = bodySegments[0];
      var nonGsParts = 0;
      var nonGsPartsSums = [0];
      for (var bi = 0; bi < body.length; bi++) {
        var b = body[bi];
        if (b === GLOBSTAR) {
          nonGsPartsSums.push(nonGsParts);
          currentBody = [[], 0];
          bodySegments.push(currentBody);
        } else {
          currentBody[0].push(b);
          nonGsParts++;
        }
      }
      var idx = bodySegments.length - 1;
      var fileLength = file.length - fileTailMatch;
      for (var si = 0; si < bodySegments.length; si++) {
        bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
      }
      return !!this._matchGlobStarBodySections(
        file,
        bodySegments,
        fileIndex,
        0,
        partial,
        0,
        !!fileTailMatch
      );
    };
    Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
      var bs = bodySegments[bodyIndex];
      if (!bs) {
        for (var i = fileIndex; i < file.length; i++) {
          sawTail = true;
          var f = file[i];
          if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
            return false;
          }
        }
        return sawTail;
      }
      var body = bs[0];
      var after = bs[1];
      while (fileIndex <= after) {
        var m = this._matchOne(
          file.slice(0, fileIndex + body.length),
          body,
          partial,
          fileIndex,
          0
        );
        if (m && globStarDepth < this.maxGlobstarRecursion) {
          var sub = this._matchGlobStarBodySections(
            file,
            bodySegments,
            fileIndex + body.length,
            bodyIndex + 1,
            partial,
            globStarDepth + 1,
            sawTail
          );
          if (sub !== false) {
            return sub;
          }
        }
        var f = file[fileIndex];
        if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
          return false;
        }
        fileIndex++;
      }
      return partial || null;
    };
    Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
      var fi, pi, fl, pl;
      for (fi = fileIndex, pi = patternIndex, 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 || p === GLOBSTAR) 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"(exports2, 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"(exports2, 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"(exports2, 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"(exports2) {
    exports2.setopts = setopts;
    exports2.ownProp = ownProp;
    exports2.makeAbs = makeAbs;
    exports2.finish = finish;
    exports2.mark = mark;
    exports2.isIgnored = isIgnored;
    exports2.childrenIgnored = childrenIgnored;
    function ownProp(obj, field) {
      return Object.prototype.hasOwnProperty.call(obj, field);
    }
    var fs7 = 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 || fs7;
      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"(exports2, module2) {
    module2.exports = globSync;
    globSync.GlobSync = GlobSync2;
    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 GlobSync2(pattern, options2).found;
    }
    function GlobSync2(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 GlobSync2))
        return new GlobSync2(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();
    }
    GlobSync2.prototype._finish = function() {
      assert.ok(this instanceof GlobSync2);
      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);
    };
    GlobSync2.prototype._process = function(pattern, index, inGlobStar) {
      assert.ok(this instanceof GlobSync2);
      var n = 0;
      while (typeof pattern[n] === "string") {
        n++;
      }
      var prefix;
      switch (n) {
        // if not, then this is rather simple
        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);
    };
    GlobSync2.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);
      }
    };
    GlobSync2.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);
    };
    GlobSync2.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;
    };
    GlobSync2.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;
      }
    };
    GlobSync2.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;
    };
    GlobSync2.prototype._readdirError = function(f, er) {
      switch (er.code) {
        case "ENOTSUP":
        // https://github.com/isaacs/node-glob/issues/205
        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":
        // not terribly unusual
        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;
      }
    };
    GlobSync2.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);
      }
    };
    GlobSync2.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);
    };
    GlobSync2.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;
    };
    GlobSync2.prototype._mark = function(p) {
      return common.mark(this, p);
    };
    GlobSync2.prototype._makeAbs = function(f) {
      return common.makeAbs(this, f);
    };
  }
});

// node_modules/wrappy/wrappy.js
var require_wrappy = __commonJS({
  "node_modules/wrappy/wrappy.js"(exports2, 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"(exports2, 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"(exports2, 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"(exports2, module2) {
    module2.exports = glob4;
    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 glob4(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);
    }
    glob4.sync = globSync;
    var GlobSync2 = glob4.GlobSync = globSync.GlobSync;
    glob4.glob = glob4;
    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;
    }
    glob4.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;
    };
    glob4.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 GlobSync2(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 sync3 = true;
      for (var i = 0; i < n; i++) {
        this._process(this.minimatch.set[i], i, false, done);
      }
      sync3 = false;
      function done() {
        --self2._processing;
        if (self2._processing <= 0) {
          if (sync3) {
            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) {
        // if not, then this is rather simple
        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":
        // https://github.com/isaacs/node-glob/issues/205
        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":
        // not terribly unusual
        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);
    };
  }
});

// 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_coc38 = require("coc.nvim");
var import_crypto2 = require("crypto");
var fs6 = __toESM(require("fs"));
var fse10 = __toESM(require_lib());
var os4 = __toESM(require("os"));
var path17 = __toESM(require("path"));
var semver2 = __toESM(require_semver2());
var import_vscode_languageserver_protocol8 = __toESM(require_main3());

// 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.CHANGE_IMPORTED_PROJECTS = "java.project.changeImportedProjects";
  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_main3());
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.8";

// src/goToDefinition.ts
var import_vscode_languageserver_protocol2 = __toESM(require_main3());
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_main3());

// 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());
        }
      },
      /**
       * An operation to flush the contents. Can be synchronous.
       */
      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 = /* @__PURE__ */ 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 GetChangeSignatureInfoRequest;
((GetChangeSignatureInfoRequest2) => {
  GetChangeSignatureInfoRequest2.type = new import_coc.RequestType("java/getChangeSignatureInfo");
})(GetChangeSignatureInfoRequest || (GetChangeSignatureInfoRequest = {}));
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,
      // tooltip,
      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();
    this.onDidProjectsDeleteEmitter = 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 onDidProjectsDelete = this.onDidProjectsDeleteEmitter.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,
      onDidProjectsDelete,
      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);
  }
  fireDidProjectsDelete(event) {
    this.onDidProjectsDeleteEmitter.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_coc12 = require("coc.nvim");
var import_fmtr = __toESM(require_fmtr());
var import_fs_extra = __toESM(require_lib());
var import_os = require("os");
var path9 = __toESM(require("path"));

// src/utils.ts
var import_coc11 = require("coc.nvim");
var fs4 = __toESM(require("fs"));
var path8 = __toESM(require("path"));

// src/requirements.ts
var import_coc10 = require("coc.nvim");
var import_expand_home_dir = __toESM(require_expand_home_dir());
var fse4 = __toESM(require_lib());
var import_jdk_utils2 = __toESM(require_dist());
var path7 = __toESM(require("path"));

// src/jre.ts
var import_coc4 = require("coc.nvim");
var import_jdk_utils = __toESM(require_dist());
var import_fs = __toESM(require("fs"));
var fse = __toESM(require_lib());
var path2 = __toESM(require("path"));
var os = __toESM(require("os"));
var JRE_VERSION = "23.0.2";
var OLD_JRE_VERSION = "17.0.8";
var supported_platforms = [
  "linux-aarch64",
  "linux-ppc64le",
  "linux-riscv64",
  "linux-x86_64",
  "macosx-aarch64",
  "macosx-x86_64",
  "win32-aarch64",
  "win32-x86_64"
];
var baseURL = "https://download.eclipse.org";
function getDownloadUrl() {
  let prefix = "";
  switch (process.platform) {
    case "darwin":
      prefix = "macosx";
      break;
    case "win32":
      prefix = "win32";
      break;
    case "linux":
      prefix = "linux";
      break;
    default:
      throw new Error("Unsupported platform: " + process.platform);
  }
  let arch = "";
  switch (process.arch) {
    case "arm":
    case "arm64":
      arch = "aarch64";
      break;
    case "ppc64":
      arch = "ppc64le";
      break;
    case "riscv64":
      arch = "riscv64";
      break;
    case "x64":
      arch = "x86_64";
      break;
    default:
      throw new Error("Unsupported  CPU architecture: " + process.arch);
  }
  let platform2 = prefix + "-" + arch;
  if (!supported_platforms.includes(platform2)) throw new Error("Unsupported platform: " + process.platform);
  return `${baseURL}/justj/jres/23/downloads/20250130_2304/org.eclipse.justj.openjdk.hotspot.jre.full.stripped-${JRE_VERSION}-${platform2}.tar.gz`;
}
function getPlatform() {
  let { platform: platform2 } = process;
  if (platform2 === "win32") return "windows";
  if (platform2 === "darwin") return "darwin";
  if (platform2 === "linux") return "linux";
  return void 0;
}
function getPackageName() {
  let platform2 = getPlatform();
  if (!platform2) return void 0;
  if (platform2 === "windows") return "javajre-windows-64";
  let isArm = process.arch.indexOf("arm") === 0;
  return `javajre-${platform2}-${isArm ? "arm" : ""}64`;
}
function checkJavac(javaHome) {
  let file = path2.join(javaHome, "bin", import_jdk_utils.JAVAC_FILENAME);
  if (fse.existsSync(file)) return true;
  if (import_fs.default.existsSync(javaHome)) import_fs.default.rmSync(javaHome, { recursive: true, force: true });
  return false;
}
async function checkAndDownloadJRE(context) {
  var _a;
  let javaHome;
  let packageName = getPackageName();
  if (packageName) {
    javaHome = path2.join(context.storagePath, `jdk-${OLD_JRE_VERSION}`, packageName, "jre");
    if (checkJavac(javaHome)) return javaHome;
  }
  javaHome = path2.join(context.storagePath, `jdk-${JRE_VERSION}-${process.platform}-${process.arch}`);
  if (checkJavac(javaHome)) return javaHome;
  let url;
  try {
    url = getDownloadUrl();
  } catch (e) {
    context.logger.error(`Unable to download JRE:`, e.message);
    return void 0;
  }
  const tmpfolder = import_fs.default.mkdtempSync(path2.join(os.tmpdir(), "coc-java-"));
  await import_coc4.window.withProgress({ title: `Installing jre from ${baseURL}` }, (progress, token) => {
    return (0, import_coc4.download)(url, {
      dest: tmpfolder,
      extract: "untar",
      strip: 0,
      onProgress: (percent) => {
        progress.report({ message: `Downloaded ${percent}%` });
      }
    }, token);
  });
  fse.moveSync(tmpfolder, javaHome, { overwrite: true });
  if (checkJavac(javaHome)) {
    const runtime = await (0, import_jdk_utils.getRuntime)(javaHome, { withVersion: true });
    if (((_a = runtime == null ? void 0 : runtime.version) == null ? void 0 : _a.major) >= 23) {
      return javaHome;
    }
  }
  return void 0;
}

// src/settings.ts
var import_coc9 = require("coc.nvim");
var fs3 = __toESM(require("fs"));
var path6 = __toESM(require("path"));

// src/lombokSupport.ts
var import_coc8 = require("coc.nvim");
var fse3 = __toESM(require_lib());
var glob = __toESM(require_glob());
var path5 = __toESM(require("path"));
var semver = __toESM(require_semver2());

// src/runtimeStatusBarProvider.ts
var import_coc7 = require("coc.nvim");
var fse2 = __toESM(require_lib());
var path4 = __toESM(require("path"));

// src/languageStatusItemFactory.ts
var import_coc6 = require("coc.nvim");
var path3 = __toESM(require("path"));

// src/serverStatusBarProvider.ts
var import_coc5 = 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_coc5.window.createStatusBarItem(Number.MAX_VALUE);
      import_coc5.window.onDidChangeActiveTextEditor((editor) => {
        var _a, _b;
        let doc = editor == null ? void 0 : editor.document;
        if (doc && import_coc5.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_coc5.window.activeTextEditor) == null ? void 0 : _a.document;
    return doc && import_coc5.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 = "" /* 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_coc6.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_coc6.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_coc6.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 = path3.basename(buildFilePath);
      const item = import_coc6.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 = path3.basename(buildFilePath);
    item.text = fileName;
    item.command = getOpenBuildFileCommand(buildFilePath);
  }
  BuildFileStatusItemFactory2.update = update;
  function getOpenBuildFileCommand(buildFilePath) {
    const relativePath = import_coc6.workspace.asRelativePath(buildFilePath);
    return {
      title: `Open Config File ${relativePath}`,
      command: Commands.OPEN_BROWSER,
      arguments: [import_coc6.Uri.file(buildFilePath)]
    };
  }
})(BuildFileStatusItemFactory || (BuildFileStatusItemFactory = {}));

// 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_coc7.Uri.file(path4.join(storagePath2, "..", "..")).fsPath;
    }
    if (!supportsLanguageStatus()) {
      if (this.isAdvancedStatusBarItem) {
      } else {
        this.statusBarItem = import_coc7.window.createStatusBarItem(0);
      }
    }
    let projectUriStrings;
    try {
      projectUriStrings = await getAllJavaProjects(false);
    } catch (e) {
      return;
    }
    for (const uri of projectUriStrings) {
      this.javaProjects.set(import_coc7.Uri.parse(uri).fsPath, void 0);
    }
    if (!supportsLanguageStatus()) {
      this.statusBarItem.command = StatusCommands.configureJavaRuntimeCommand;
    }
    this.disposables.push(import_coc7.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_coc7.window.activeTextEditor);
    }));
    this.disposables.push(apiManager.getApiInstance().onDidClasspathUpdate(async (e) => {
      for (const projectPath of this.javaProjects.keys()) {
        if (path4.relative(projectPath, e.fsPath) === "") {
          this.javaProjects.set(projectPath, void 0);
          await this.updateItem(context, import_coc7.window.activeTextEditor);
          return;
        }
      }
    }));
    await this.updateItem(context, import_coc7.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_coc7.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_coc7.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_PROJECT_SETTINGS, import_coc7.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_coc7.Uri.parse(doc.uri).fsPath : void 0;
    if (!textEditor || !fileName || path4.extname(fileName) !== ".java" && !supportsLanguageStatus()) {
      (_a = this.statusBarItem) == null ? void 0 : _a.hide();
      return;
    }
    const uri = import_coc7.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 = path4.join(projectPath, buildFileName);
      if (await fse2.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 unkownVersion = "999.999.999";
var compatibleVersion = "1.18.0";
var activeLombokPath = void 0;
var isLombokStatusBarInitialized = false;
var isLombokCommandInitialized = false;
var isExtensionLombok = false;
var projectLombokPath = void 0;
function isLombokSupportEnabled() {
  return import_coc8.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() {
  const lombokHome = path5.resolve(__dirname, "../server");
  const lombokJar = glob.sync("lombok*.jar", { cwd: lombokHome });
  if (lombokJar === void 0 || lombokJar.length === 0) {
    import_coc8.window.showWarningMessage(`Lombok missing in extension path`);
    return;
  }
  const lombokJarPath = `${lombokHome}/${lombokJar[0]}`;
  if (!fse3.existsSync(lombokJarPath)) {
    import_coc8.window.showWarningMessage(`Lombok found but not accessible`);
    return;
  }
  return lombokJarPath;
}
function lombokPath2Version(lombokPath) {
  if (!lombokPath) return "";
  const matches = lombokJarRegex.exec(lombokPath);
  if (matches.length > 0) {
    return matches[0].split(".jar")[0];
  }
  import_coc8.window.showWarningMessage(`Lombok ${lombokPath} jar name mismatch`);
  return "lombok";
}
function lombokPath2VersionNumber(lombokPath) {
  const lombokVersionTag = lombokPath2Version(lombokPath).split("-");
  if ((lombokVersionTag == null ? void 0 : lombokVersionTag.length) > 1) {
    return lombokVersionTag[1];
  }
  import_coc8.window.showWarningMessage(`Lombok ${lombokPath} missing version tag`);
  return unkownVersion;
}
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 && fse3.existsSync(lombokJarPath)) {
    if (isCompatibleLombokVersion(lombokPath2VersionNumber(lombokJarPath))) {
      isExtensionLombok = false;
    } else {
      cleanupLombokCache(context);
      import_coc8.window.showWarningMessage(`The configured lombok ${lombokPath2VersionNumber(lombokJarPath)} is not supported, falling back ${lombokPath2VersionNumber(getExtensionLombokPath())}`);
    }
  }
  if (isExtensionLombok) {
    lombokJarPath = getExtensionLombokPath();
  }
  if (!lombokJarPath) {
    import_coc8.window.showWarningMessage(`Could not resolve valid lombok jar from vmargs or builtin.`);
    return;
  }
  const lombokAgentParam = `-javaagent:${lombokJarPath}`;
  params.push(lombokAgentParam);
  updateActiveLombokPath(lombokJarPath);
  createLogger().info(`Starting server with lombok support ${lombokJarPath}`);
}
async function checkLombokDependency(context, projectUri) {
  if (!isLombokSupportEnabled()) {
    return;
  }
  let versionChange = false;
  let lombokFound = false;
  let currentLombokVersion = void 0;
  let previousLombokVersion = void 0;
  let currentLombokClasspath = void 0;
  const projectUris = projectUri ? [projectUri.toString()] : await getAllJavaProjects();
  for (const projectUri2 of projectUris) {
    const classpathResult = await apiManager.getApiInstance().getClasspaths(projectUri2, { scope: "test" });
    for (const classpath of classpathResult.classpaths) {
      if (lombokJarRegex.test(classpath)) {
        currentLombokClasspath = classpath;
        if (activeLombokPath && !isExtensionLombok) {
          currentLombokVersion = lombokPath2Version(classpath);
          previousLombokVersion = lombokPath2Version(activeLombokPath);
          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_coc8.window.showInformationMessage(msg, action).then((selection) => {
      if (action === selection) {
        import_coc8.commands.executeCommand(restartId);
      }
    });
  }
}
function registerLombokConfigureCommand(context) {
  context.subscriptions.push(import_coc8.commands.registerCommand(Commands.LOMBOK_CONFIGURE, async (buildFilePath) => {
    const extensionLombokPath = getExtensionLombokPath();
    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_coc8.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_coc8.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_coc8.window.showInformationMessage(msg, action).then((selection) => {
        if (action === selection) {
          import_coc8.commands.executeCommand(restartId);
        }
      });
    } else {
      const msg = `Current Lombok version is ${isExtensionLombok ? "extension's" : "project's"} version. Nothing to do.`;
      import_coc8.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/settings.ts
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_coc9.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 = path6.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_coc9.window.showWarningMessage(msg, action).then((selection) => {
        if (action === selection) {
          import_coc9.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_coc9.window.showWarningMessage(msg, action).then((selection) => {
          if (action === selection) {
            import_coc9.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_coc9.window.showWarningMessage(msg, action).then((selection) => {
          if (action === selection) {
            import_coc9.commands.executeCommand(restartId);
          }
        });
      }
    }
    oldConfig = newConfig;
  });
}
function excludeProjectSettingsFiles() {
  if (import_coc9.workspace.workspaceFolders && import_coc9.workspace.workspaceFolders.length) {
    import_coc9.workspace.workspaceFolders.forEach((folder) => {
      excludeProjectSettingsFilesForWorkspace(import_coc9.Uri.parse(folder.uri));
    });
  }
}
function excludeProjectSettingsFilesForWorkspace(workspaceUri) {
  const javaConfig = getJavaConfiguration();
  const checkExclusionConfig = javaConfig.get(EXCLUDE_FILE_CONFIG);
  if (checkExclusionConfig) {
    const config = import_coc9.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_coc9.ConfigurationTarget.Workspace);
      } else {
        const globalValue = excludedInspectedValue.globalValue = excludedInspectedValue.globalValue || {};
        for (const hiddenFile of needExcludeFiles) {
          globalValue[hiddenFile] = true;
        }
        config.update("exclude", globalValue, import_coc9.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) || hasConfigKeyChanged("transport", oldConfig2, newConfig) || hasConfigKeyChanged("diagnostic.filter", oldConfig2, newConfig) || hasConfigKeyChanged("jdt.ls.javac.enabled", oldConfig2, newConfig) || hasConfigKeyChanged("completion.engine", oldConfig2, newConfig);
}
function hasConfigKeyChanged(key, oldConfig2, newConfig) {
  return oldConfig2.get(key) !== newConfig.get(key);
}
function getJavaEncoding() {
  const config = import_coc9.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_coc9.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_coc9.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_coc9.workspace.getConfiguration().update("java.jdt.ls.java.home", void 0, import_coc9.ConfigurationTarget.Workspace);
        }
      });
      isVerified = globalState.get(key);
    }
    if (!isVerified) {
      javaHome = import_coc9.workspace.getConfiguration().inspect("java.jdt.ls.java.home").globalValue;
    }
  }
  if (!javaHome) {
    preference = "java.home";
    javaHome = import_coc9.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_coc9.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_coc9.workspace.getConfiguration().update("java.home", void 0, import_coc9.ConfigurationTarget.Workspace);
          }
        });
        isVerified = globalState2.get(key2);
      }
      if (!isVerified) {
        javaHome = import_coc9.workspace.getConfiguration().inspect("java.home").globalValue;
      }
    }
  }
  const vmargs = import_coc9.workspace.getConfiguration().inspect("java.jdt.ls.vmargs").workspaceValue;
  if (vmargs !== void 0) {
    const isWorkspaceTrusted = import_coc9.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_coc9.workspace.workspaceFolders && isInWorkspaceFolder(agentFlag, import_coc9.workspace.workspaceFolders))) {
        await import_coc9.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_coc9.workspace.getConfiguration().update("java.jdt.ls.vmargs", void 0, import_coc9.ConfigurationTarget.Workspace);
          }
        });
      }
    }
  }
  return {
    javaHome,
    preference
  };
}
function getKey(prefix, storagePath2, value) {
  const workspacePath = path6.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 !path6.isAbsolute(loc) || workspaceFolders.some((dir) => loc.startsWith(import_coc9.Uri.parse(dir.uri).fsPath));
}
function getJavaServerMode() {
  return import_coc9.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_coc9.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_coc9.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_coc9.workspace.getConfiguration().update(key, property, import_coc9.ConfigurationTarget.Global);
    }
    unregisterGradleWrapperPromptDialog(sha256);
  });
}
function unregisterGradleWrapperPromptDialog(sha256) {
  const index = gradleWrapperPromptDialogs.indexOf(sha256);
  if (index > -1) {
    gradleWrapperPromptDialogs.splice(index, 1);
  }
}

// src/requirements.ts
var import_fs2 = require("fs");
var cachedJdks;
var cachedJreNames;
async function resolveRequirements(context) {
  let toolingJre = await checkAndDownloadJRE(context);
  let toolingJreVersion = await getMajorVersion(toolingJre);
  return new Promise(async (resolve9, reject) => {
    var _a;
    const requiredJdkVersion = "on" === getJavaConfiguration().get("jdt.ls.javac.enabled") ? 23 : 17;
    const javaPreferences = await checkJavaPreferences(context);
    const preferenceName = javaPreferences.preference;
    let javaHome = javaPreferences.javaHome;
    let javaVersion = 0;
    if (javaHome) {
      const source = `${preferenceName} variable defined in coc-settings.json`;
      javaHome = (0, import_expand_home_dir.default)(javaHome);
      if (!await fse4.pathExists(javaHome)) {
        invalidJavaHome(reject, `The ${source} points to a missing or inaccessible folder (${javaHome})`);
      } else if (!await fse4.pathExists(path7.resolve(javaHome, "bin", import_jdk_utils2.JAVAC_FILENAME))) {
        let msg;
        if (await fse4.pathExists(path7.resolve(javaHome, import_jdk_utils2.JAVAC_FILENAME))) {
          msg = `'bin' should be removed from the ${source} (${javaHome})`;
        } else {
          msg = `The ${source} (${javaHome}) does not point to a JDK.`;
        }
        invalidJavaHome(reject, msg);
      }
      javaVersion = await getMajorVersion(javaHome);
      if (preferenceName === "java.jdt.ls.java.home" || !toolingJre) {
        if (javaVersion >= requiredJdkVersion) {
          toolingJre = javaHome;
          toolingJreVersion = javaVersion;
        } else {
          const neverShow = context.workspaceState.get("java.home.failsMinRequiredFirstTime");
          if (!neverShow) {
            context.workspaceState.update("java.home.failsMinRequiredFirstTime", true);
            import_coc10.window.showInformationMessage(`The Java runtime set by 'java.jdt.ls.java.home' does not meet the minimum required version of '${requiredJdkVersion}' and will not be used.`);
          }
        }
      }
    }
    const javaRuntimes = await (0, import_jdk_utils2.findRuntimes)({ checkJavac: true, withVersion: true, withTags: true });
    if (!toolingJre) {
      sortJdksByVersion(javaRuntimes);
      const validJdks = javaRuntimes.filter((r) => r.version.major >= requiredJdkVersion);
      if (validJdks.length > 0) {
        sortJdksBySource(validJdks);
        javaHome = validJdks[0].homedir;
        javaVersion = validJdks[0].version.major;
        toolingJre = javaHome;
        toolingJreVersion = javaVersion;
      }
    } else {
      if (javaHome) {
        createLogger().info(`Use the JDK from '${preferenceName}' setting as the initial default project JDK.`);
      } else if (javaRuntimes.length) {
        sortJdksBySource(javaRuntimes);
        javaHome = javaRuntimes[0].homedir;
        javaVersion = (_a = javaRuntimes[0].version) == null ? void 0 : _a.major;
        createLogger().info(`Use the JDK from '${(0, import_jdk_utils2.getSources)(javaRuntimes[0])}' as the initial default project JDK.`);
      } else if (javaHome = await findDefaultRuntimeFromSettings()) {
        javaVersion = await getMajorVersion(javaHome);
        createLogger().info("Use the JDK from 'java.configuration.runtimes' as the initial default project JDK.");
      } else {
        openJDKDownload(reject, "Please download and install a JDK to compile your project. You can configure your projects with different JDKs by the setting ['java.configuration.runtimes'](https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements#java.configuration.runtimes)");
      }
    }
    if (!toolingJre || toolingJreVersion < requiredJdkVersion) {
      openJDKDownload(reject, `Java ${requiredJdkVersion} or more recent is required to run the Java extension. Please download and install a recent JDK. You can still compile your projects with older JDKs by configuring ['java.configuration.runtimes'](https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements#java.configuration.runtimes)`);
    }
    resolve9({
      tooling_jre: toolingJre,
      tooling_jre_version: toolingJreVersion,
      java_home: javaHome,
      java_version: javaVersion
    });
  });
}
async function findDefaultRuntimeFromSettings() {
  const runtimes = import_coc10.workspace.getConfiguration().get("java.configuration.runtimes");
  if (Array.isArray(runtimes) && runtimes.length) {
    let candidate;
    for (const runtime of runtimes) {
      if (!runtime || typeof runtime !== "object" || !runtime.path) {
        continue;
      }
      const jr = await (0, import_jdk_utils2.getRuntime)(runtime.path);
      if (jr) {
        candidate = jr.homedir;
      }
      if (runtime.default) {
        break;
      }
    }
    return candidate;
  }
  return void 0;
}
function getSupportedJreNames() {
  return cachedJreNames;
}
async function listJdks(force) {
  if (force || !cachedJdks) {
    cachedJdks = await (0, import_jdk_utils2.findRuntimes)({ checkJavac: true, withVersion: true, withTags: true }).then((jdks) => jdks.filter((jdk) => {
      return (0, import_fs2.existsSync)(path7.join(jdk.homedir, "lib", "rt.jar")) || (0, import_fs2.existsSync)(path7.join(jdk.homedir, "jre", "lib", "rt.jar")) || (0, import_fs2.existsSync)(path7.join(jdk.homedir, "lib", "jrt-fs.jar"));
    }));
  }
  return [].concat(cachedJdks);
}
function sortJdksBySource(jdks) {
  const rankedJdks = jdks;
  const sources = ["JDK_HOME", "JAVA_HOME", "PATH"];
  for (const [index, source] of sources.entries()) {
    for (const jdk of rankedJdks) {
      if (jdk.rank === void 0 && (0, import_jdk_utils2.getSources)(jdk).includes(source)) {
        jdk.rank = index;
      }
    }
  }
  rankedJdks.filter((jdk) => jdk.rank === void 0).forEach((jdk) => jdk.rank = sources.length);
  rankedJdks.sort((a, b) => a.rank - b.rank);
}
function sortJdksByVersion(jdks) {
  jdks.sort((a, b) => {
    var _a, _b;
    return (((_a = b.version) == null ? void 0 : _a.major) ?? 0) - (((_b = a.version) == null ? void 0 : _b.major) ?? 0);
  });
}
function openJDKDownload(reject, cause) {
  const jdkUrl = getJdkUrl();
  reject({
    message: cause,
    label: "Get the Java Development Kit",
    command: Commands.OPEN_BROWSER,
    commandParam: import_coc10.Uri.parse(jdkUrl)
  });
}
function getJdkUrl() {
  let jdkUrl = "https://developers.redhat.com/products/openjdk/download/?sc_cid=701f2000000RWTnAAO";
  if (process.platform === "darwin") {
    jdkUrl = "https://adoptopenjdk.net/";
  }
  return jdkUrl;
}
function invalidJavaHome(reject, cause) {
  if (cause.indexOf("java.home") > -1) {
    reject({
      message: cause,
      label: "Open settings",
      command: Commands.OPEN_JSON_SETTINGS
    });
  } else {
    reject({
      message: cause
    });
  }
}
async function getMajorVersion(javaHome) {
  var _a;
  if (!javaHome) {
    return 0;
  }
  const runtime = await (0, import_jdk_utils2.getRuntime)(javaHome, { withVersion: true });
  return ((_a = runtime == null ? void 0 : runtime.version) == null ? void 0 : _a.major) || 0;
}

// src/utils.ts
function getJavaConfiguration() {
  return import_coc11.workspace.getConfiguration("java");
}
function isPreferenceOverridden(section) {
  const config = import_coc11.workspace.getConfiguration();
  return config.inspect(section).workspaceFolderValue !== void 0 || config.inspect(section).workspaceValue !== void 0 || config.inspect(section).globalValue !== void 0;
}
function deleteDirectory(dir) {
  if (fs4.existsSync(dir)) {
    fs4.readdirSync(dir).forEach((child) => {
      const entry = path8.join(dir, child);
      if (fs4.lstatSync(entry).isDirectory()) {
        deleteDirectory(entry);
      } else {
        fs4.unlinkSync(entry);
      }
    });
    fs4.rmdirSync(dir);
  }
}
function getTimestamp2(file) {
  if (!fs4.existsSync(file)) {
    return -1;
  }
  const stat2 = fs4.statSync(file);
  return stat2.mtimeMs;
}
function ensureExists(folder) {
  if (fs4.existsSync(folder)) {
    return;
  }
  ensureExists(path8.dirname(folder));
  fs4.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(path8.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_coc11.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.GET_ALL_JAVA_PROJECTS);
  if (excludeDefaultProject) {
    projectUris = projectUris.filter((uriString) => {
      const projectPath = import_coc11.Uri.parse(uriString).fsPath;
      return path8.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_coc11.workspace.findFiles(
      convertToGlob(inclusionFilePatterns, inclusionFolderPatterns),
      null
      /* force not use default exclusion */
    ));
  }
  const inclusionBlob = convertToGlob(inclusionFilePatterns);
  const exclusionBlob = getExclusionBlob();
  if (inclusionBlob) {
    buildFiles.push(...await import_coc11.workspace.findFiles(inclusionBlob, exclusionBlob));
  }
  return buildFiles;
}
function getDirectoriesByBuildFile(inclusions, exclusions, fileName) {
  return inclusions.filter((fsPath) => fsPath.endsWith(fileName)).map((fsPath) => {
    return path8.dirname(fsPath);
  }).filter((inclusion) => {
    return !exclusions.includes(inclusion);
  });
}
function getJavaConfig(javaHome) {
  var _a;
  const origConfig = getJavaConfiguration();
  const javaConfig = JSON.parse(JSON.stringify(origConfig));
  const editorConfig = import_coc11.workspace.getConfiguration("editor");
  javaConfig.home = javaHome;
  javaConfig.project.outputPath = origConfig.inspect("project.outputPath").workspaceValue;
  javaConfig.project.sourcePaths = origConfig.inspect("project.sourcePaths").workspaceValue;
  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";
  }
  const javacSupport = javaConfig.jdt.ls.javac.enabled;
  switch (javacSupport) {
    case "on":
      javaConfig.jdt.ls.javac.enabled = true;
      break;
    case "off":
      javaConfig.jdt.ls.javac.enabled = false;
      break;
    default:
      javaConfig.jdt.ls.javac.enabled = false;
      break;
  }
  if (javaConfig.completion.matchCase === "auto") {
    javaConfig.completion.matchCase = "firstLetter";
  }
  const guessMethodArguments = javaConfig.completion.guessMethodArguments;
  if (guessMethodArguments === "auto") {
    javaConfig.completion.guessMethodArguments = isInsider ? "off" : "insertBestGuessedArguments";
  }
  if (!isPreferenceOverridden("java.implementationCodeLens") && typeof ((_a = javaConfig.implementationsCodeLens) == null ? void 0 : _a.enabled) === "boolean") {
    const deprecatedImplementations = javaConfig.implementationsCodeLens.enabled;
    javaConfig.implementationCodeLens = deprecatedImplementations ? "types" : "none";
  }
  return javaConfig;
}
async function addAutoDetectedJdks(configuredJREs) {
  var _a;
  const autoDetectedJREs = await listJdks();
  sortJdksByVersion(autoDetectedJREs);
  sortJdksBySource(autoDetectedJREs);
  const addedJreNames = /* @__PURE__ */ new Set();
  const supportedJreNames = getSupportedJreNames();
  for (const jre of configuredJREs) {
    if (jre.name) {
      addedJreNames.add(jre.name);
    }
  }
  for (const jre of autoDetectedJREs) {
    const majorVersion = ((_a = jre.version) == null ? void 0 : _a.major) ?? 0;
    if (!majorVersion) {
      continue;
    }
    let jreName = `JavaSE-${majorVersion}`;
    if (majorVersion <= 5) {
      jreName = `J2SE-1.${majorVersion}`;
    } else if (majorVersion <= 8) {
      jreName = `JavaSE-1.${majorVersion}`;
    }
    if (addedJreNames.has(jreName) || !(supportedJreNames == null ? void 0 : supportedJreNames.includes(jreName))) {
      continue;
    }
    configuredJREs.push({
      name: jreName,
      path: jre.homedir
    });
    addedJreNames.add(jreName);
  }
  return configuredJREs;
}
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_coc12.workspace.onDidCreateFiles) {
    context.subscriptions.push(import_coc12.workspace.onDidCreateFiles(handleNewJavaFiles));
  }
  if (import_coc12.workspace.onWillRenameFiles) {
    context.subscriptions.push(import_coc12.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_coc12.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_coc12.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_coc12.Uri.parse(textDocuments[i].uri).fsPath;
      const typeName = resolveTypeName(fileName);
      const isPackageInfo = typeName === "package-info";
      const isModuleInfo = typeName === "module-info";
      const date = /* @__PURE__ */ new Date();
      const context = {
        fileName: path9.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_coc12.workspace.jumpTo(textDocuments[i].uri);
      if (textDocuments[i].getText()) {
        continue;
      }
      import_coc12.snippetManager.insertSnippet(new import_coc12.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 = path9.dirname(oldUri.fsPath);
  const newDir = path9.dirname(newUri.fsPath);
  return !path9.relative(oldDir, newDir);
}
function resolveTypeName(filePath) {
  const fileName = path9.basename(filePath);
  const extName = path9.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 = path9.relative(sourcePath, path9.dirname(filePath));
      return relative5.replace(/[\/\\]/g, ".");
    }
  }
  return "";
}
function isPrefix(parentPath, filePath) {
  const relative5 = path9.relative(parentPath, filePath);
  return !relative5 || !relative5.startsWith("..") && !path9.isAbsolute(relative5);
}
var COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance";
async function isVersionLessThan(fileUri, targetVersion) {
  let projectSettings = {};
  try {
    projectSettings = await import_coc12.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_coc13 = require("coc.nvim");
var fs5 = __toESM(require("fs"));
var fse5 = __toESM(require_lib());
var glob2 = __toESM(require_glob());
var net = __toESM(require("net"));
var os2 = __toESM(require("os"));
var path10 = __toESM(require("path"));
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 (os2.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 = path10.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",
    // See https://github.com/redhat-developer/vscode-java/issues/2264
    // It requires the internal API sun.nio.fs.WindowsFileAttributes.isDirectoryLink() to check if a Windows directory is symlink.
    "--add-opens",
    "java.base/sun.nio.fs=ALL-UNNAMED"
  );
  const javacEnabled = "on" === getJavaConfiguration().get("jdt.ls.javac.enabled");
  if (javacEnabled) {
    params.push(
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
      "--add-opens",
      "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
      "--add-opens",
      "jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.taglets.snippet=ALL-UNNAMED --add-opens jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.taglets=ALL-UNNAMED",
      "-DICompilationUnitResolver=org.eclipse.jdt.core.dom.JavacCompilationUnitResolver",
      "-DCompilationUnit.DOM_BASED_OPERATIONS=true",
      "-DAbstractImageBuilder.compilerFactory=org.eclipse.jdt.internal.javac.JavacCompilerFactory"
    );
    if ("dom" === getJavaConfiguration().get("completion.engine")) {
      params.push("-DCompilationUnit.codeComplete.DOM_BASED_OPERATIONS=true");
    }
    ;
  }
  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_coc13.workspace.getConfiguration().get("java.import.generatesMetadataFilesAtProjectRoot");
  if (metadataLocation !== void 0) {
    params.push(`-Djava.import.generatesMetadataFilesAtProjectRoot=${metadataLocation}`);
  }
  let vmargsCheck = import_coc13.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_coc13.workspace.workspaceFolders && isInWorkspaceFolder(agentFlag, import_coc13.workspace.workspaceFolders))) {
        vmargsCheck = import_coc13.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}${path10.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_coc13.workspace.expand(directory);
    if (!fs5.existsSync(directory)) {
      directory = void 0;
    }
  }
  const serverHome = directory ? directory : path10.resolve(__dirname, "../server");
  const launchersFound = glob2.sync("**/plugins/org.eclipse.equinox.launcher_*.jar", { cwd: serverHome });
  if (launchersFound.length) {
    params.push("-jar");
    params.push(path10.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(path10.resolve(__dirname, "../server", configDir));
  } else if (directory) {
    console.log(`Starting jdt.ls ${isSyntaxServer ? "(syntax)" : "(standard)"} from custom directory ${directory}`);
    params.push(path10.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 (!fs5.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 ? path10.join(process.env.APPDATA, ".jdt", "index") : path10.join(os2.homedir(), ".jdt", "index");
        break;
      case "darwin":
        location = path10.join(os2.homedir(), "Library", "Caches", ".jdt", "index");
        break;
      case "linux":
        location = process.env.XDG_CACHE_HOME ? path10.join(process.env.XDG_CACHE_HOME, ".jdt", "index") : path10.join(os2.homedir(), ".cache", ".jdt", "index");
        break;
      default:
        const globalStoragePath = context.storagePath;
        location = globalStoragePath ? path10.join(globalStoragePath, "index") : void 0;
    }
  } else {
    location = location.startsWith(`~${path10.sep}`) ? path10.join(os2.homedir(), location.slice(2)) : location;
  }
  return location;
}
function resolveConfiguration(context, configDir) {
  ensureExists(context.storagePath);
  const extensionPath = path10.resolve(context.extensionPath, "package.json");
  const packageFile = JSON.parse(fs5.readFileSync(extensionPath, "utf8"));
  let version;
  if (packageFile) {
    version = packageFile.version;
  } else {
    version = "0.0.0";
  }
  let configuration = path10.resolve(context.storagePath, version);
  ensureExists(configuration);
  configuration = path10.resolve(configuration, configDir);
  ensureExists(configuration);
  const configIniName = "config.ini";
  const configIni = path10.resolve(configuration, configIniName);
  const ini = path10.resolve(__dirname, "../server", configDir, configIniName);
  if (!fs5.existsSync(configIni)) {
    fs5.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);
    }
  });
}
function removeEquinoxFragmentOnDarwinX64(context) {
  const extensionPath = context.extensionPath;
  const matches = new glob2.GlobSync(`${extensionPath}/server/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64*.jar`).found;
  for (const fragment of matches) {
    fse5.removeSync(fragment);
    createLogger().info(`Removing Equinox launcher fragment : ${fragment}`);
  }
}

// src/markdownPreviewProvider.ts
var import_coc14 = require("coc.nvim");
var fse6 = __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,
    hooks: 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 = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
};
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 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 && /^<a /i.test(cap[0])) {
        this.lexer.state.inLink = true;
      } else if (this.lexer.state.inLink && /^<\/a>/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)) {
        if (!/>$/.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(href)) {
        if (this.options.pedantic && !/>$/.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]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\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+|$)/,
  // regex template, placeholders will be replaced according to different paragraph
  // interruption rules of commonmark and the original markdown spec:
  _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 = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
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", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
block.normal = { ...block };
block.gfm = {
  ...block.normal,
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
  // Cells
};
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", "</?(?:tag)(?: +|\\n|/?>)|<(?: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", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
block.pedantic = {
  ...block.normal,
  html: edit(
    `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\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: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
  fences: noopTest,
  // fences not supported
  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:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
  // CDATA section
  link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
  reflink: /^!?\[(label)\]\[(ref)\]/,
  nolink: /^!?\[(ref)\](?:\[\])?/,
  reflinkSearch: "reflink|nolink(?!\\()",
  emStrong: {
    lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
    //        (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left.  (5) and (6) can be either Left or Right.
    //          () Skip orphan inside strong                                      () Consume to delim     (1) #***                (2) a***#, a***                             (3) #***a, ***a                 (4) ***#              (5) #***#                 (6) a***a
    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*])/
    // ^- Not allowed for _
  },
  code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
  br: /^( {2,}|\\)\n(?!\s*$)/,
  del: noopTest,
  text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
  punctuation: /^([\spunctuation])/
};
inline._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
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 = { ...inline };
inline.pedantic = {
  ...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 = {
  ...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]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
};
inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
inline.breaks = {
  ...inline.gfm,
  br: edit(inline.br).replace("{2,}", "*").getRegex(),
  text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
};
function smartypants(text) {
  return text.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026");
}
function mangle(text) {
  let out = "", i, ch;
  const l = text.length;
  for (i = 0; i < l; i++) {
    ch = text.charCodeAt(i);
    if (Math.random() > 0.5) {
      ch = "x" + ch.toString(16);
    }
    out += "&#" + ch + ";";
  }
  return out;
}
var Lexer = class _Lexer {
  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;
  }
  /**
   * Expose Rules
   */
  static get rules() {
    return {
      block,
      inline
    };
  }
  /**
   * Static Lex Method
   */
  static lex(src, options2) {
    const lexer2 = new _Lexer(options2);
    return lexer2.lex(src);
  }
  /**
   * Static Lex Inline Method
   */
  static lexInline(src, options2) {
    const lexer2 = new _Lexer(options2);
    return lexer2.inlineTokens(src);
  }
  /**
   * Preprocessing
   */
  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;
  }
  /**
   * Lexing
   */
  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;
  }
  /**
   * Lexing/Compiling
   */
  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 "<pre><code>" + (escaped ? code : escape(code, true)) + "</code></pre>\n";
    }
    return '<pre><code class="' + this.options.langPrefix + escape(lang) + '">' + (escaped ? code : escape(code, true)) + "</code></pre>\n";
  }
  /**
   * @param {string} quote
   */
  blockquote(quote) {
    return `<blockquote>
${quote}</blockquote>
`;
  }
  html(html) {
    return html;
  }
  /**
   * @param {string} text
   * @param {string} level
   * @param {string} raw
   * @param {any} slugger
   */
  heading(text, level, raw, slugger) {
    if (this.options.headerIds) {
      const id = this.options.headerPrefix + slugger.slug(raw);
      return `<h${level} id="${id}">${text}</h${level}>
`;
    }
    return `<h${level}>${text}</h${level}>
`;
  }
  hr() {
    return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
  }
  list(body, ordered, start) {
    const type = ordered ? "ol" : "ul", startatt = ordered && start !== 1 ? ' start="' + start + '"' : "";
    return "<" + type + startatt + ">\n" + body + "</" + type + ">\n";
  }
  /**
   * @param {string} text
   */
  listitem(text) {
    return `<li>${text}</li>
`;
  }
  checkbox(checked) {
    return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
  }
  /**
   * @param {string} text
   */
  paragraph(text) {
    return `<p>${text}</p>
`;
  }
  /**
   * @param {string} header
   * @param {string} body
   */
  table(header, body) {
    if (body) body = `<tbody>${body}</tbody>`;
    return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
  }
  /**
   * @param {string} content
   */
  tablerow(content) {
    return `<tr>
${content}</tr>
`;
  }
  tablecell(content, flags) {
    const type = flags.header ? "th" : "td";
    const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`;
    return tag + content + `</${type}>
`;
  }
  /**
   * span level renderer
   * @param {string} text
   */
  strong(text) {
    return `<strong>${text}</strong>`;
  }
  /**
   * @param {string} text
   */
  em(text) {
    return `<em>${text}</em>`;
  }
  /**
   * @param {string} text
   */
  codespan(text) {
    return `<code>${text}</code>`;
  }
  br() {
    return this.options.xhtml ? "<br/>" : "<br>";
  }
  /**
   * @param {string} text
   */
  del(text) {
    return `<del>${text}</del>`;
  }
  /**
   * @param {string} href
   * @param {string} title
   * @param {string} text
   */
  link(href, title, text) {
    href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
    if (href === null) {
      return text;
    }
    let out = '<a href="' + href + '"';
    if (title) {
      out += ' title="' + title + '"';
    }
    out += ">" + text + "</a>";
    return out;
  }
  /**
   * @param {string} href
   * @param {string} title
   * @param {string} text
   */
  image(href, title, text) {
    href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
    if (href === null) {
      return text;
    }
    let out = `<img src="${href}" alt="${text}"`;
    if (title) {
      out += ` title="${title}"`;
    }
    out += this.options.xhtml ? "/>" : ">";
    return out;
  }
  text(text) {
    return text;
  }
};
var TextRenderer = class {
  // no need for block level renderers
  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 = {};
  }
  /**
   * @param {string} value
   */
  serialize(value) {
    return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
  }
  /**
   * Finds the next safe (unique) slug to use
   * @param {string} originalSlug
   * @param {boolean} isDryRun
   */
  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;
  }
  /**
   * Convert string to unique id
   * @param {object} [options]
   * @param {boolean} [options.dryrun] Generates the next unique slug without
   * updating the internal accumulator.
   */
  slug(value, options2 = {}) {
    const slug = this.serialize(value);
    return this.getNextSafeSlug(slug, options2.dryrun);
  }
};
var Parser = class _Parser {
  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 Method
   */
  static parse(tokens, options2) {
    const parser2 = new _Parser(options2);
    return parser2.parse(tokens);
  }
  /**
   * Static Parse Inline Method
   */
  static parseInline(tokens, options2) {
    const parser2 = new _Parser(options2);
    return parser2.parseInline(tokens);
  }
  /**
   * Parse Loop
   */
  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;
  }
  /**
   * Parse Inline Tokens
   */
  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;
  }
};
var Hooks = class {
  constructor(options2) {
    this.options = options2 || defaults;
  }
  static passThroughHooks = /* @__PURE__ */ new Set([
    "preprocess",
    "postprocess"
  ]);
  /**
   * Process markdown before marked
   */
  preprocess(markdown) {
    return markdown;
  }
  /**
   * Process HTML after marked is finished
   */
  postprocess(html) {
    return html;
  }
};
function onError(silent, async, callback) {
  return (e) => {
    e.message += "\nPlease report this to https://github.com/markedjs/marked.";
    if (silent) {
      const msg = "<p>An error occurred:</p><pre>" + escape(e.message + "", true) + "</pre>";
      if (async) {
        return Promise.resolve(msg);
      }
      if (callback) {
        callback(null, msg);
        return;
      }
      return msg;
    }
    if (async) {
      return Promise.reject(e);
    }
    if (callback) {
      callback(e);
      return;
    }
    throw e;
  };
}
function parseMarkdown(lexer2, parser2) {
  return (src, opt, callback) => {
    if (typeof opt === "function") {
      callback = opt;
      opt = null;
    }
    const origOpt = { ...opt };
    opt = { ...marked.defaults, ...origOpt };
    const throwError = onError(opt.silent, opt.async, callback);
    if (typeof src === "undefined" || src === null) {
      return throwError(new Error("marked(): input parameter is undefined or null"));
    }
    if (typeof src !== "string") {
      return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
    }
    checkSanitizeDeprecation(opt);
    if (opt.hooks) {
      opt.hooks.options = opt;
    }
    if (callback) {
      const highlight = opt.highlight;
      let tokens;
      try {
        if (opt.hooks) {
          src = opt.hooks.preprocess(src);
        }
        tokens = lexer2(src, opt);
      } catch (e) {
        return throwError(e);
      }
      const done = function(err) {
        let out;
        if (!err) {
          try {
            if (opt.walkTokens) {
              marked.walkTokens(tokens, opt.walkTokens);
            }
            out = parser2(tokens, opt);
            if (opt.hooks) {
              out = opt.hooks.postprocess(out);
            }
          } catch (e) {
            err = e;
          }
        }
        opt.highlight = highlight;
        return err ? throwError(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;
    }
    if (opt.async) {
      return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html) => opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
    }
    try {
      if (opt.hooks) {
        src = opt.hooks.preprocess(src);
      }
      const tokens = lexer2(src, opt);
      if (opt.walkTokens) {
        marked.walkTokens(tokens, opt.walkTokens);
      }
      let html = parser2(tokens, opt);
      if (opt.hooks) {
        html = opt.hooks.postprocess(html);
      }
      return html;
    } catch (e) {
      return throwError(e);
    }
  };
}
function marked(src, opt, callback) {
  return parseMarkdown(Lexer.lex, Parser.parse)(src, opt, callback);
}
marked.options = marked.setOptions = function(opt) {
  marked.defaults = { ...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 = { ...pack };
    opts.async = marked.defaults.async || opts.async || false;
    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.hooks) {
      const hooks = marked.defaults.hooks || new Hooks();
      for (const prop in pack.hooks) {
        const prevHook = hooks[prop];
        if (Hooks.passThroughHooks.has(prop)) {
          hooks[prop] = (arg) => {
            if (marked.defaults.async) {
              return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2) => {
                return prevHook.call(hooks, ret2);
              });
            }
            const ret = pack.hooks[prop].call(hooks, arg);
            return prevHook.call(hooks, ret);
          };
        } else {
          hooks[prop] = (...args2) => {
            let ret = pack.hooks[prop].apply(hooks, args2);
            if (ret === false) {
              ret = prevHook.apply(hooks, args2);
            }
            return ret;
          };
        }
      }
      opts.hooks = hooks;
    }
    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 = parseMarkdown(Lexer.lexInline, Parser.parseInline);
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.Hooks = Hooks;
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 path11 = __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() {
    // a cache maps document path to rendered html
    this.documentCache = /* @__PURE__ */ new Map();
    this.disposables = [];
  }
  async show(markdownFilePath, title, section, context) {
    const html = await this.getHtmlContent(markdownFilePath, section, context);
    let filepath = path11.join(import_os2.default.tmpdir(), `${v4_default()}.html`);
    await fse6.writeFile(filepath, html);
    await import_coc14.workspace.nvim.call("coc#ui#open_url", [import_coc14.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 fse6.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 `
            <!DOCTYPE html>
            <html>
            <head>
                <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src file:; img-src 'self' file: https: data:; script-src 'nonce-${nonce}';"/>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                ${styles}
                <base href="${import_coc14.Uri.file(markdownFilePath).toString()}">
            </head>
            <body class="vscode-body scrollBeyondLastLine wordWrap showEditorSelection">
                ${body}
                <button class="btn floating-bottom-right" id="back-to-top-btn">
                    <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
                        <path fill-rule="evenodd" clip-rule="evenodd" d="M8 6.04042L3.02022 11.0202L2.31311 10.3131L7.64644 4.97976L8.35355 4.97976L13.6869 10.3131L12.9798 11.0202L8 6.04042Z"/>
                    </svg>
                </button>
                <script nonce="${nonce}">
                    (function() {
                        var element = document.querySelector('[id^="${section}"]');
                        if (element) {
                            element.scrollIntoView(true);
                        }
                        var backToTopBtn = document.getElementById('back-to-top-btn');
                        if (backToTopBtn) {
                            backToTopBtn.onclick = () => document.documentElement.scrollTop = 0;
                        }
                    })();
                </script>
            </body>
            </html>
        `;
  }
  getStyles(context) {
    const styles = [
      import_coc14.Uri.file(path11.join(context.extensionPath, "webview-resources", "highlight.css")),
      import_coc14.Uri.file(path11.join(context.extensionPath, "webview-resources", "markdown.css")),
      import_coc14.Uri.file(path11.join(context.extensionPath, "webview-resources", "document.css"))
    ];
    return styles.map((styleUri) => `<link rel="stylesheet" type="text/css" href="${styleUri.toString()}">`).join("\n");
  }
  getNonce() {
    let text = "";
    const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    for (let i = 0; i < 32; i++) {
      text += possible.charAt(Math.floor(Math.random() * possible.length));
    }
    return text;
  }
};
var markdownPreviewProvider = new MarkdownPreviewProvider();

// src/outputInfoCollector.ts
var import_coc15 = require("coc.nvim");
var OutputInfoCollector = class {
  constructor(name) {
    this.name = name;
    this.channel = null;
    this.channel = import_coc15.window.createOutputChannel(name);
  }
  get content() {
    return this.channel.content;
  }
  append(value) {
    createLogger().info(value);
    this.channel.append(value);
  }
  appendLine(value) {
    createLogger().info(value);
    this.channel.appendLine(value);
  }
  replace(value) {
    this.clear();
    this.append(value);
  }
  clear() {
    this.channel.clear();
  }
  show(preserveFocus) {
    this.channel.show(preserveFocus);
  }
  hide() {
    this.channel.hide();
  }
  dispose() {
    this.channel.dispose();
  }
};

// src/plugin.ts
var import_coc16 = require("coc.nvim");
var path12 = __toESM(require("path"));
var existingExtensions = [];
var buildFilePatterns = [];
function collectJavaExtensions(extensions5) {
  const result = [];
  if (extensions5 && extensions5.length) {
    for (const extension of extensions5) {
      const contributesSection = extension.packageJSON["contributes"];
      if (contributesSection) {
        const javaExtensions = contributesSection["javaExtensions"];
        if (Array.isArray(javaExtensions) && javaExtensions.length) {
          for (const javaExtensionPath of javaExtensions) {
            result.push(path12.resolve(extension.extensionPath, javaExtensionPath));
          }
        }
      }
    }
  }
  const userBundles = getJavaConfiguration().get("jdt.ls.bundles");
  for (const bundle of userBundles) {
    result.push(bundle);
  }
  existingExtensions = result.slice();
  return result;
}
function collectBuildFilePattern(extensions5) {
  const result = [];
  if (extensions5 && extensions5.length) {
    for (const extension of extensions5) {
      const contributesSection = extension.packageJSON["contributes"];
      if (contributesSection) {
        const buildFilePatterns2 = contributesSection["javaBuildFilePatterns"];
        if (Array.isArray(buildFilePatterns2) && buildFilePatterns2.length) {
          result.push(...buildFilePatterns2);
        }
      }
    }
  }
  buildFilePatterns = result.slice();
  return result;
}
function getBundlesToReload() {
  const previousContributions = [...existingExtensions];
  const currentContributions = collectJavaExtensions(import_coc16.extensions.all);
  if (isContributedPartUpdated(previousContributions, currentContributions)) {
    return currentContributions;
  }
  return [];
}
async function onExtensionChange(extensions5) {
  if (isContributedPartUpdated(buildFilePatterns, collectBuildFilePattern(extensions5))) {
    return promptToReload();
  }
  const bundlesToRefresh = getBundlesToReload();
  if (bundlesToRefresh.length) {
    const success = await import_coc16.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.REFRESH_BUNDLES, bundlesToRefresh);
    if (!success) {
      return promptToReload();
    }
  }
}
function promptToReload() {
  const msg = `Java Extension Contributions changed, reloading coc.nvim is required for the changes to take effect.`;
  const action = "Reload";
  const restartId = Commands.RELOAD_WINDOW;
  import_coc16.window.showWarningMessage(msg, action).then((selection) => {
    if (action === selection) {
      import_coc16.commands.executeCommand(restartId);
    }
  });
}
function isContributedPartUpdated(oldContributedPart, newContributedPart) {
  if (!oldContributedPart) {
    return false;
  }
  const oldContribution = new Set(oldContributedPart.slice());
  const newContribution = newContributedPart;
  const hasChanged = oldContribution.size !== newContribution.length;
  if (!hasChanged) {
    for (const newExtension of newContribution) {
      if (!oldContribution.has(newExtension)) {
        return true;
      }
    }
  }
  return hasChanged;
}

// src/providerDispatcher.ts
var import_coc17 = require("coc.nvim");
var import_vscode_languageserver_protocol4 = __toESM(require_main3());
function registerClientProviders(context, options2) {
  const hoverProvider = new ClientHoverProvider();
  context.subscriptions.push(import_coc17.languages.registerHoverProvider(["java"], hoverProvider));
  const symbolProvider = createDocumentSymbolProvider();
  context.subscriptions.push(import_coc17.languages.registerDocumentSymbolProvider(["java"], symbolProvider));
  const jdtProvider = createJDTContentProvider(options2);
  context.subscriptions.push(import_coc17.workspace.registerTextDocumentContentProvider("jdt", jdtProvider));
  overwriteWorkspaceSymbolProvider(context);
  return {
    handles: [hoverProvider, symbolProvider, jdtProvider]
  };
}
var ClientHoverProvider = class {
  async provideHover(document, position, token) {
    const languageClient = await getActiveLanguageClient();
    if (!languageClient) {
      return void 0;
    }
    const serverMode = apiManager.getApiInstance().serverMode;
    if (serverMode === "Standard" /* standard */) {
      if (!this.delegateProvider) {
        this.delegateProvider = createClientHoverProvider(languageClient);
      }
      const hover = await this.delegateProvider.provideHover(document, position, token);
      return fixJdtSchemeHoverLinks(hover);
    } else {
      const params = {
        textDocument: { uri: document.uri },
        position
      };
      const hoverResponse = await languageClient.sendRequest(import_vscode_languageserver_protocol4.HoverRequest.type, params, token);
      const hover = hoverResponse;
      return fixJdtSchemeHoverLinks(hover);
    }
  }
};
function createJDTContentProvider(options2) {
  return {
    onDidChange: options2.contentProviderEvent,
    provideTextDocumentContent: async (uri, token) => {
      const languageClient = await getActiveLanguageClient();
      if (!languageClient) {
        return "";
      }
      const content = await languageClient.sendRequest(ClassFileContentsRequest.type, { uri: uri.toString() }, token);
      import_coc17.workspace.nvim.command("setfiletype java", true);
      return content ?? "";
    }
  };
}
function createDocumentSymbolProvider() {
  return {
    provideDocumentSymbols: async (document, token) => {
      const languageClient = await getActiveLanguageClient();
      if (!languageClient) {
        return [];
      }
      const params = {
        textDocument: { uri: document.uri }
      };
      const symbolResponse = await languageClient.sendRequest(import_vscode_languageserver_protocol4.DocumentSymbolRequest.type, params, token);
      if (!symbolResponse || !symbolResponse.length) {
        return [];
      }
      return symbolResponse;
    }
  };
}
var START_OF_DOCUMENT = import_coc17.Range.create(0, 0, 0, 0);
function createWorkspaceSymbolProvider(existingWorkspaceSymbolProvider) {
  return {
    provideWorkspaceSymbols: async (query, token) => {
      const result = existingWorkspaceSymbolProvider.provideWorkspaceSymbols(query, token);
      if (query.indexOf(".") > -1) {
        return new Promise((resolve9) => {
          result.then((symbols) => {
            if (symbols === null) {
              resolve9(null);
            } else {
              resolve9(symbols == null ? void 0 : symbols.map((s) => {
                s.name = `${s.containerName}.${s.name}`;
                return s;
              }));
            }
          });
        });
      }
      return result;
    },
    resolveWorkspaceSymbol: async (symbol, token) => {
      const range = symbol.location.range;
      if (range && equals(range, START_OF_DOCUMENT)) {
        return symbol;
      }
      await getActiveLanguageClient();
      const serializableSymbol = {
        name: symbol.name,
        // Cannot serialize SymbolKind as number, because GSON + lsp4j.SymbolKind expect a name.
        kind: getSymbolKind(symbol.kind),
        location: {
          uri: symbol.location.uri,
          range: symbol.location.range
        },
        containerName: symbol.containerName
      };
      const response = await import_coc17.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.RESOLVE_WORKSPACE_SYMBOL, JSON.stringify(serializableSymbol));
      if (token.isCancellationRequested) {
        return void 0;
      }
      return response;
    }
  };
}
function overwriteWorkspaceSymbolProvider(context) {
  const disposable = apiManager.getApiInstance().onDidServerModeChange(async (mode) => {
    if (mode === "Standard" /* standard */) {
      const feature = (await getActiveLanguageClient())["getFeature"](import_vscode_languageserver_protocol4.WorkspaceSymbolRequest.method);
      const providers = feature.getProviders();
      if (providers && providers.length > 0) {
        feature.dispose();
        const workspaceSymbolProvider = createWorkspaceSymbolProvider(providers[0]);
        context.subscriptions.push(import_coc17.languages.registerWorkspaceSymbolProvider(workspaceSymbolProvider));
        disposable.dispose();
      }
    }
  });
}
var REPLACE_JDT_LINKS_PATTERN = /(\[(?:[^\]])+\]\()(jdt:\/\/(?:(?:(?:\\\))|([^)]))+))\)/g;
function fixJdtSchemeHoverLinks(hover) {
  const newContents = [];
  if (Array.isArray(hover.contents)) {
    for (const content of hover.contents) {
      if (typeof content["value"] === "string") {
        const newContent = content.value.replace(REPLACE_JDT_LINKS_PATTERN, (_substring, group1, group2) => {
          const uri = `command:${Commands.OPEN_FILE}?${encodeURI(JSON.stringify([encodeURIComponent(group2)]))}`;
          return `${group1}${uri})`;
        });
        const mdString = { language: "markdown", value: newContent };
        newContents.push(mdString);
      } else {
        newContents.push(content);
      }
    }
    hover.contents = newContents;
  }
  return hover;
}
function getSymbolKind(kind) {
  switch (kind) {
    case import_coc17.SymbolKind.File:
      return "File";
    case import_coc17.SymbolKind.Module:
      return "Module";
    case import_coc17.SymbolKind.Namespace:
      return "Namespace";
    case import_coc17.SymbolKind.Package:
      return "Package";
    case import_coc17.SymbolKind.Class:
      return "Class";
    case import_coc17.SymbolKind.Method:
      return "Method";
    case import_coc17.SymbolKind.Property:
      return "Property";
    case import_coc17.SymbolKind.Field:
      return "Field";
    case import_coc17.SymbolKind.Constructor:
      return "Constructor";
    case import_coc17.SymbolKind.Enum:
      return "Enum";
    case import_coc17.SymbolKind.Interface:
      return "Interface";
    case import_coc17.SymbolKind.Function:
      return "Function";
    case import_coc17.SymbolKind.Variable:
      return "Variable";
    case import_coc17.SymbolKind.Constant:
      return "Constant";
    case import_coc17.SymbolKind.String:
      return "String";
    case import_coc17.SymbolKind.Number:
      return "Number";
    case import_coc17.SymbolKind.Boolean:
      return "Boolean";
    case import_coc17.SymbolKind.Array:
      return "Array";
    case import_coc17.SymbolKind.Object:
      return "Object";
    case import_coc17.SymbolKind.Key:
      return "Key";
    case import_coc17.SymbolKind.Null:
      return "Null";
    case import_coc17.SymbolKind.EnumMember:
      return "EnumMember";
    case import_coc17.SymbolKind.Struct:
      return "Struct";
    case import_coc17.SymbolKind.Event:
      return "Event";
    case import_coc17.SymbolKind.Operator:
      return "Operator";
    case import_coc17.SymbolKind.TypeParameter:
      return "TypeParameter";
    default:
      return "Unknown";
  }
}

// src/recommendation/handlerImpl.ts
var import_coc18 = require("coc.nvim");
var KEY_RECOMMENDATION_USER_CHOICE_MAP = "recommendationUserChoice";
async function installExtensionCmdHandler(extensionName4, displayName) {
  return import_coc18.window.withProgress({ title: `Installing ${displayName || extensionName4}...` }, (progress) => {
    return import_coc18.commands.executeCommand("workbench.extensions.installExtension", extensionName4);
  }).then(() => {
    import_coc18.window.showInformationMessage(`Successfully installed ${displayName || extensionName4}.`);
  });
}
var UserChoice = /* @__PURE__ */ ((UserChoice2) => {
  UserChoice2["install"] = "Install";
  UserChoice2["never"] = "Never";
  UserChoice2["later"] = "Later";
  return UserChoice2;
})(UserChoice || {});
var HandlerImpl = class {
  constructor(context) {
    this.userChoice = () => {
      return context.globalState.get(KEY_RECOMMENDATION_USER_CHOICE_MAP, {});
    };
    this.storeUserChoice = (choice) => {
      context.globalState.update(KEY_RECOMMENDATION_USER_CHOICE_MAP, choice);
    };
  }
  isExtensionInstalled(extName) {
    return !!import_coc18.extensions.getExtensionById(extName);
  }
  canRecommendExtension(extName) {
    return this.userChoice()[extName] !== "Never" /* never */ && !this.isExtensionInstalled(extName);
  }
  async handle(extName, message) {
    if (this.isExtensionInstalled(extName)) {
      return;
    }
    const choice = this.userChoice();
    if (choice[extName] === "Never" /* never */) {
      return;
    }
    const actions = Object.values(UserChoice);
    const answer = await import_coc18.window.showInformationMessage(message, ...actions);
    if (answer === "Install" /* install */) {
      await installExtensionCmdHandler(extName, extName);
    }
    choice[extName] = answer;
    this.storeUserChoice(choice);
  }
};

// src/recommendation/dependencyAnalytics.ts
var import_coc19 = require("coc.nvim");
var EXTENSION_NAME = "redhat.fabric8-analytics";
var GH_ORG_URL = `https://github.com/fabric8-analytics`;
var RECOMMENDATION_MESSAGE = `Do you want to install the [Dependency Analytics](${GH_ORG_URL}) extension to stay informed about vulnerable dependencies in pom.xml files?`;
var JAVA_DEPENDENCY_ANALYTICS_SHOW = "java.recommendations.dependency.analytics.show";
function isPomDotXml(uri) {
  return !!uri.path && uri.path.toLowerCase().endsWith("pom.xml");
}
function initialize(context, handler) {
  const show = import_coc19.workspace.getConfiguration().get(JAVA_DEPENDENCY_ANALYTICS_SHOW);
  if (true) return;
  if (!show) {
    return;
  }
  if (!handler.canRecommendExtension(EXTENSION_NAME)) {
    return;
  }
  context.subscriptions.push(import_coc19.workspace.onDidOpenTextDocument((e) => {
    if (isPomDotXml(import_coc19.Uri.parse(e.uri))) {
      handler.handle(EXTENSION_NAME, RECOMMENDATION_MESSAGE);
    }
  }));
  const isPomDotXmlOpened = import_coc19.workspace.textDocuments.findIndex((doc) => isPomDotXml(import_coc19.Uri.parse(doc.uri))) !== -1;
  if (isPomDotXmlOpened) {
    handler.handle(EXTENSION_NAME, RECOMMENDATION_MESSAGE);
  }
}

// src/recommendation/index.ts
function initialize2(context) {
  const handler = new HandlerImpl(context);
  initialize(context, handler);
}

// src/standardLanguageClient.ts
var import_coc36 = require("coc.nvim");
var fse9 = __toESM(require_lib());
var import_jdk_utils3 = __toESM(require_dist());
var net2 = __toESM(require("net"));
var path16 = __toESM(require("path"));
var import_vscode_languageserver_protocol6 = __toESM(require_main3());

// src/buildpath.ts
var import_coc20 = require("coc.nvim");
async function requestFolder(defaultValue) {
  const folder = await import_coc20.workspace.nvim.callAsync("coc#util#with_callback", ["input", ["Select Folder: ", defaultValue ?? "", "dir"]]);
  if (folder) return import_coc20.Uri.file(folder);
  return void 0;
}
function registerCommands(context) {
  context.subscriptions.push(import_coc20.commands.registerCommand(Commands.ADD_TO_SOURCEPATH_CMD, async (uri) => {
    if (!uri) uri = await requestFolder(import_coc20.workspace.cwd);
    if (!uri) return;
    const result = await import_coc20.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.ADD_TO_SOURCEPATH, uri.toString());
    if (result.status) {
      if (result.sourcePaths) {
        getJavaConfiguration().update("project.sourcePaths", result.sourcePaths, import_coc20.ConfigurationTarget.WorkspaceFolder);
      }
      import_coc20.window.showInformationMessage(result.message ? result.message : "Successfully added the folder to the source path.");
    } else {
      import_coc20.window.showErrorMessage(result.message);
    }
  }));
  context.subscriptions.push(import_coc20.commands.registerCommand(Commands.REMOVE_FROM_SOURCEPATH_CMD, async (uri) => {
    if (!uri) uri = await requestFolder(import_coc20.workspace.cwd);
    if (!uri) return;
    const result = await import_coc20.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.REMOVE_FROM_SOURCEPATH, uri.toString());
    if (result.status) {
      if (result.sourcePaths) {
        getJavaConfiguration().update("project.sourcePaths", result.sourcePaths, import_coc20.ConfigurationTarget.WorkspaceFolder);
      }
      import_coc20.window.showInformationMessage(result.message ? result.message : "Successfully removed the folder from the source path.");
    } else {
      import_coc20.window.showErrorMessage(result.message);
    }
  }));
  context.subscriptions.push(import_coc20.commands.registerCommand(Commands.LIST_SOURCEPATHS_CMD, async () => {
    const result = await import_coc20.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.LIST_SOURCEPATHS);
    if (result.status) {
      if (!result.data || !result.data.length) {
        import_coc20.window.showInformationMessage("No Java source directories found in the workspace, please use the command 'Add Folder to Java Source Path' first.");
      } else {
        import_coc20.window.showQuickPick(result.data.map((sourcePath) => {
          return {
            label: sourcePath.displayPath,
            detail: `$(file-directory) ${sourcePath.projectType} Project: ${sourcePath.projectName}`
          };
        }), { placeholder: "All Java source directories recognized by the workspace." });
      }
    } else {
      import_coc20.window.showErrorMessage(result.message);
    }
  }));
}

// src/codeActionProvider.ts
var import_coc21 = require("coc.nvim");
var javaRefactorKinds = /* @__PURE__ */ new Map([
  [import_coc21.CodeActionKind.Refactor, "java-refactoring"],
  [import_coc21.CodeActionKind.RefactorExtract, "extract-to-constant"],
  [import_coc21.CodeActionKind.RefactorExtract + ".function", "extract-to-method"],
  [import_coc21.CodeActionKind.RefactorExtract + ".constant", "extract-to-constant"],
  [import_coc21.CodeActionKind.RefactorExtract + ".variable", "extract-to-local-variable"],
  [import_coc21.CodeActionKind.RefactorExtract + ".field", "extract-to-field"],
  [import_coc21.CodeActionKind.RefactorInline, "inline-constant"],
  [import_coc21.CodeActionKind.Refactor + ".move", "move"],
  [import_coc21.CodeActionKind.Refactor + ".assign", "assign-to-variable"],
  [import_coc21.CodeActionKind.Refactor + ".introduce.parameter", "introduce-parameter"]
]);
var RefactorDocumentProvider = class {
  provideCodeActions() {
    return [];
  }
};
RefactorDocumentProvider.metadata = {
  providedCodeActionKinds: [
    import_coc21.CodeActionKind.Refactor
  ]
};

// src/gradle/gradleCodeActionProvider.ts
var import_coc22 = require("coc.nvim");
var fse7 = __toESM(require_lib());
var path13 = __toESM(require("path"));
var UPGRADE_GRADLE_WRAPPER_TITLE = "Upgrade Gradle Wrapper";
var WRAPPER_PROPERTIES_DESCRIPTOR = "gradle/wrapper/gradle-wrapper.properties";
var GRADLE_PROBLEM_ID = 524288;
var GRADLE_INVALID_TYPE_CODE_ID = GRADLE_PROBLEM_ID + 1;
var GradleCodeActionProvider = class {
  provideCodeActions(document, range, context, token) {
    var _a;
    if (((_a = context == null ? void 0 : context.diagnostics) == null ? void 0 : _a.length) && context.diagnostics[0].source === "Java") {
      return this.provideGradleCodeActions(document, context.diagnostics);
    }
    return [];
  }
  async provideGradleCodeActions(document, diagnostics) {
    var _a;
    const codeActions = [];
    for (const diagnostic of diagnostics) {
      if ((_a = diagnostic.message) == null ? void 0 : _a.startsWith("The build file has been changed")) {
        const reloadProjectAction = import_coc22.CodeAction.create("Reload project", import_coc22.CodeActionKind.QuickFix);
        reloadProjectAction.command = {
          title: "Reload Project",
          command: Commands.CONFIGURATION_UPDATE,
          arguments: [document.uri]
        };
        codeActions.push(reloadProjectAction);
        continue;
      }
      const documentUri = document.uri.toString();
      if (documentUri.endsWith(WRAPPER_PROPERTIES_DESCRIPTOR) && diagnostic.code === GRADLE_INVALID_TYPE_CODE_ID.toString()) {
        const projectPath = path13.resolve(import_coc22.Uri.parse(documentUri).fsPath, "..", "..", "..").normalize();
        if (await fse7.pathExists(projectPath)) {
          const projectUri = import_coc22.Uri.file(projectPath).toString();
          const upgradeWrapperCommand = {
            title: UPGRADE_GRADLE_WRAPPER_TITLE,
            command: Commands.UPGRADE_GRADLE_WRAPPER,
            arguments: [projectUri]
          };
          const codeAction = import_coc22.CodeAction.create(UPGRADE_GRADLE_WRAPPER_TITLE, import_coc22.CodeActionKind.QuickFix + ".gradle");
          codeAction.command = upgradeWrapperCommand;
          codeActions.push(codeAction);
        }
      }
    }
    return codeActions;
  }
};
var gradleCodeActionMetadata = {
  providedCodeActionKinds: [
    import_coc22.CodeActionKind.QuickFix + ".gradle"
  ]
};

// src/inlayHintsProvider.ts
var import_coc23 = require("coc.nvim");
var JavaInlayHintsProvider = class {
  constructor(client) {
    this.client = client;
    this.onDidChange = new import_coc23.Emitter();
    this.onDidChangeInlayHints = this.onDidChange.event;
    this.client.onRequest(InlayHintRefreshRequest.type, async () => {
      this.onDidChange.fire();
    });
  }
  async provideInlayHints(document, range, token) {
    const requestParams = {
      textDocument: { uri: document.uri },
      range
    };
    try {
      const values = await this.client.sendRequest(InlayHintRequest.type, requestParams, token);
      if (token.isCancellationRequested) {
        return [];
      }
      return asInlayHints(values, this.client);
    } catch (error) {
      return this.client.handleFailedRequest(InlayHintRequest.type, token, error, []);
    }
  }
};
var InlayHintRequest;
((InlayHintRequest2) => {
  InlayHintRequest2.type = new import_coc23.RequestType("textDocument/inlayHint");
})(InlayHintRequest || (InlayHintRequest = {}));
var InlayHintRefreshRequest;
((InlayHintRefreshRequest2) => {
  InlayHintRefreshRequest2.type = new import_coc23.RequestType("workspace/inlayHint/refresh");
})(InlayHintRefreshRequest || (InlayHintRefreshRequest = {}));
async function asInlayHints(values, client) {
  if (!Array.isArray(values)) {
    return void 0;
  }
  return values.map((lsHint) => asInlayHint(lsHint, client));
}
function asInlayHint(value, client) {
  const label = value.label;
  const result = import_coc23.InlayHint.create(value.position, label);
  result.paddingRight = true;
  result.kind = import_coc23.InlayHintKind.Parameter;
  return result;
}

// src/pom/pomCodeActionProvider.ts
var import_coc24 = require("coc.nvim");
var import_vscode_languageserver_protocol5 = __toESM(require_main3());
var PomCodeActionProvider = class {
  constructor(context) {
    context.subscriptions.push(import_coc24.commands.registerCommand("_java.projectConfiguration.saveAndUpdate", async (uri) => {
      await import_coc24.workspace.openTextDocument(uri);
      await import_coc24.workspace.nvim.command("noa w");
      import_coc24.commands.executeCommand(Commands.CONFIGURATION_UPDATE, uri);
    }));
  }
  provideCodeActions(document, range, context, token) {
    var _a;
    if (((_a = context == null ? void 0 : context.diagnostics) == null ? void 0 : _a.length) && context.diagnostics[0].source === "Java") {
      return this.collectCodeActions(document, context.diagnostics);
    }
    return void 0;
  }
  collectCodeActions(document, diagnostics) {
    var _a, _b;
    const codeActions = [];
    for (const diagnostic of diagnostics) {
      if ((_a = diagnostic.message) == null ? void 0 : _a.startsWith("Plugin execution not covered by lifecycle configuration")) {
        const indentation = this.getNewTextIndentation(document, diagnostic);
        const saveAndUpdateConfigCommand = {
          title: "Save and reload project",
          command: "_java.projectConfiguration.saveAndUpdate",
          arguments: [document.uri]
        };
        const action1 = import_coc24.CodeAction.create("Enable this execution in project configuration phase", import_coc24.CodeActionKind.QuickFix + ".pom");
        let edit2 = { documentChanges: [] };
        action1.edit = edit2;
        edit2.documentChanges.push(
          import_vscode_languageserver_protocol5.TextDocumentEdit.create(
            { uri: document.uri, version: document.version },
            [
              import_vscode_languageserver_protocol5.TextEdit.insert(diagnostic.range.end, `${indentation}<?m2e execute onConfiguration?>`)
            ]
          )
        );
        action1.command = saveAndUpdateConfigCommand;
        codeActions.push(action1);
        const action2 = import_coc24.CodeAction.create("Enable this execution in project build phase", import_coc24.CodeActionKind.QuickFix + ".pom");
        action2.edit = { documentChanges: [] };
        action2.edit.documentChanges.push(
          import_vscode_languageserver_protocol5.TextDocumentEdit.create(
            { uri: document.uri, version: document.version },
            [
              import_vscode_languageserver_protocol5.TextEdit.insert(diagnostic.range.end, `${indentation}<?m2e execute onConfiguration,onIncremental?>`)
            ]
          )
        );
        action2.command = saveAndUpdateConfigCommand;
        codeActions.push(action2);
        const action3 = import_coc24.CodeAction.create("Mark this execution as ignored in pom.xml", import_coc24.CodeActionKind.QuickFix + ".pom");
        action3.edit = { documentChanges: [] };
        action3.edit.documentChanges.push(
          import_vscode_languageserver_protocol5.TextDocumentEdit.create(
            { uri: document.uri, version: document.version },
            [
              import_vscode_languageserver_protocol5.TextEdit.insert(diagnostic.range.end, `${indentation}<?m2e ignore?>`)
            ]
          )
        );
        action3.command = saveAndUpdateConfigCommand;
        codeActions.push(action3);
      } else if ((_b = diagnostic.message) == null ? void 0 : _b.startsWith("The build file has been changed")) {
        const reloadProjectAction = import_coc24.CodeAction.create("Reload project", import_coc24.CodeActionKind.QuickFix);
        reloadProjectAction.command = {
          title: "Reload Project",
          command: Commands.CONFIGURATION_UPDATE,
          arguments: [document.uri]
        };
        codeActions.push(reloadProjectAction);
      }
    }
    return codeActions;
  }
  getNewTextIndentation(document, diagnostic) {
    const textline = document.lineAt(diagnostic.range.end.line);
    if (textline.text.lastIndexOf("</execution>") > diagnostic.range.end.character) {
      return "";
    }
    let tabSize = 2;
    let insertSpaces = true;
    const activeEditor = import_coc24.window.activeTextEditor;
    if (activeEditor && activeEditor.document.uri.toString() === document.uri.toString()) {
      tabSize = Number(activeEditor.options.tabSize);
      insertSpaces = Boolean(activeEditor.options.insertSpaces);
    }
    const lineSeparator = "\n";
    let newIndentation = lineSeparator + textline.text.substring(0, textline.firstNonWhitespaceCharacterIndex);
    if (insertSpaces) {
      for (let i = 0; i < tabSize; i++) {
        newIndentation += " ";
      }
    } else {
      newIndentation += "	";
    }
    return newIndentation;
  }
};
var pomCodeActionMetadata = {
  providedCodeActionKinds: [
    import_coc24.CodeActionKind.QuickFix + ".pom"
  ]
};

// src/refactorAction.ts
var import_coc28 = require("coc.nvim");
var import_fs3 = require("fs");
var path15 = __toESM(require("path"));

// src/refactoring/changeSignature.ts
var import_coc26 = require("coc.nvim");

// src/standardLanguageClientUtils.ts
var import_coc25 = require("coc.nvim");
var fse8 = __toESM(require_lib());
var path14 = __toESM(require("path"));
async function applyRefactorEdit(languageClient, refactorEdit) {
  if (!refactorEdit) {
    return;
  }
  if (refactorEdit.errorMessage) {
    import_coc25.window.showErrorMessage(refactorEdit.errorMessage);
    return;
  }
  if (refactorEdit.edit) {
    const edit2 = refactorEdit.edit;
    if (edit2) {
      await import_coc25.workspace.applyEdit(edit2);
    }
  }
  if (refactorEdit.command) {
    await new Promise((resolve9) => setTimeout(resolve9, 400));
    if (refactorEdit.command.arguments) {
      await import_coc25.commands.executeCommand(refactorEdit.command.command, ...refactorEdit.command.arguments);
    } else {
      await import_coc25.commands.executeCommand(refactorEdit.command.command);
    }
  }
}
async function projectConfigurationUpdate(languageClient, uris) {
  var _a;
  let resources = [];
  if (!uris) {
    const uri = (_a = import_coc25.window.activeTextEditor) == null ? void 0 : _a.document.uri;
    const activeFileUri = uri ? import_coc25.Uri.parse(uri) : void 0;
    if (activeFileUri && isJavaConfigFile(activeFileUri.fsPath)) {
      resources = [activeFileUri];
    } else {
      resources = await askForProjects(activeFileUri, "Please select the project(s) to update.");
    }
  } else if (uris instanceof import_coc25.Uri) {
    resources.push(uris);
  } else if (Array.isArray(uris)) {
    for (const uri of uris) {
      if (uri instanceof import_coc25.Uri) {
        resources.push(uri);
      }
    }
  } else if ("uri" in uris) {
    resources.push(import_coc25.Uri.parse(uris.uri));
  }
  if (resources.length === 1) {
    languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
      uri: resources[0].toString()
    });
  } else if (resources.length > 1) {
    languageClient.sendNotification(ProjectConfigurationUpdateRequest.typeV2, {
      identifiers: resources.map((r) => {
        return { uri: r.toString() };
      })
    });
  }
}
function isJavaConfigFile(filePath) {
  const fileName = path14.basename(filePath);
  if (buildFilePatterns.length == 0) return false;
  const regEx = new RegExp(buildFilePatterns.map((r) => `(${r})`).join("|"), "i");
  return regEx.test(fileName);
}
async function askForProjects(activeFileUri, placeHolder, canPickMany = true) {
  const projectPicks = await generateProjectPicks(activeFileUri);
  if (!(projectPicks == null ? void 0 : projectPicks.length)) {
    return [];
  } else if (projectPicks.length === 1) {
    return [import_coc25.Uri.file(projectPicks[0].detail)];
  }
  const choices = await import_coc25.window.showQuickPick(projectPicks, {
    matchOnDescription: true,
    placeholder: placeHolder,
    canPickMany
  });
  if (!choices) {
    return [];
  }
  if (Array.isArray(choices)) {
    return choices.map((c) => import_coc25.Uri.file(c.detail));
  }
  return [import_coc25.Uri.file(choices.detail)];
}
async function generateProjectPicks(activeFileUri) {
  let projectUriStrings;
  try {
    projectUriStrings = await getAllJavaProjects();
  } catch (e) {
    return void 0;
  }
  const projectPicks = projectUriStrings.map((uriString) => {
    const projectPath = import_coc25.Uri.parse(uriString).fsPath;
    return {
      label: path14.basename(projectPath),
      detail: projectPath
    };
  }).filter(Boolean);
  if ((activeFileUri == null ? void 0 : activeFileUri.scheme) === "file") {
    const candidatePath = activeFileUri.fsPath;
    let belongingIndex = -1;
    for (let i = 0; i < projectPicks.length; i++) {
      if (candidatePath.startsWith(projectPicks[i].detail)) {
        if (belongingIndex < 0 || projectPicks[i].detail.length > projectPicks[belongingIndex].detail.length) {
          belongingIndex = i;
        }
      }
    }
    if (belongingIndex >= 0) {
      projectPicks[belongingIndex].picked = true;
    }
  }
  return projectPicks;
}
async function upgradeGradle(projectUri, version) {
  const useWrapper = import_coc25.workspace.getConfiguration().get("java.import.gradle.wrapper.enabled");
  if (!useWrapper) {
    await import_coc25.workspace.getConfiguration().update("java.import.gradle.wrapper.enabled", true, import_coc25.ConfigurationTarget.Workspace);
  }
  const result = await import_coc25.window.withProgress({
    title: "Upgrading Gradle wrapper...",
    cancellable: true
  }, (_progress, token) => {
    return import_coc25.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.UPGRADE_GRADLE_WRAPPER, projectUri, version, token);
  });
  if (result) {
    if (fse8.pathExists(result)) {
      const content = await fse8.readFile(result);
      const offset = content.toString().indexOf("distributionUrl");
      if (offset >= 0) {
        const document = await import_coc25.workspace.openTextDocument(result);
        const position = document.textDocument.positionAt(offset);
        const distributionUrlRange = document.getWordRangeAtPosition(position);
        await import_coc25.workspace.jumpTo(document.uri);
        await import_coc25.window.selectRange(import_coc25.Range.create(distributionUrlRange.start, import_coc25.Position.create(distributionUrlRange.start.line + 1, 0)));
      }
    }
    import_coc25.commands.executeCommand(Commands.IMPORT_PROJECTS_CMD);
  }
}

// src/refactoring/changeSignature.ts
function computeParamValue(type, value) {
  if (value === null || value.length === 0) {
    switch (type) {
      case "int":
      case "byte":
      case "long":
      case "float":
      case "double":
        value = "0";
        break;
      case "boolean":
        value = "false";
        break;
      default:
        value = "null";
        break;
    }
  }
  return value;
}
function readLineUserValue(line) {
  const separator = line.lastIndexOf(":");
  const whitespace = line.lastIndexOf(" ");
  const index = Math.max(separator, whitespace);
  return line.substring(index + 1);
}
async function renderChangeSignaturePanel(languageClient, command, params, formattingOptions, signature) {
  const highlightsNamespace = await import_coc26.nvim.createNamespace("changeSignatureNamespace");
  const buffer = await import_coc26.nvim.createNewBuffer(false, true);
  const data = [
    `Access type: ${signature.modifier}`,
    `Method name: ${signature.methodName}`,
    `Return type: ${signature.returnType}`,
    `Parameters:`
  ];
  for (const param of signature.parameters ?? []) {
    data.push(`- ${param.originalIndex}: ${param.type} ${param.name}`);
  }
  const cols = parseInt(await import_coc26.nvim.exec("echo &columns", true), 10);
  const rows = parseInt(await import_coc26.nvim.exec("echo &lines", true), 10);
  const width = Math.floor(cols * 0.65);
  const height = Math.floor(rows * 0.5);
  const header = "-".repeat(Math.max(width, 3));
  const hint = [
    header,
    "Labels are used to parse the values. Keep them!",
    "Accept the change & close the window: [n]<cr>",
    "Abort the change & close the window: [n]<q>",
    "Parameters:",
    " - Definition is order sensitive",
    " - New param format: `- <type> <name> [value]`",
    " - Existing param format: `- <n>: <type> <name>`",
    "   * [value] default value for new paramters",
    "   * `-` keep dash prefix for all paramters",
    "   * <n> marks the original paramter index",
    "   * don't change index for moved params",
    "   * don't add index for new entries"
  ];
  const lines = data.concat(hint);
  buffer.setLines(lines);
  buffer.setOption("bufhidden", "wipe");
  buffer.setOption("buftype", "nofile");
  buffer.setOption("filetype", "refactor");
  buffer.setOption("modified", false);
  buffer.setOption("modifiable", true);
  const close = async () => {
    import_coc26.nvim.command("close", true);
  };
  const refactor = async () => {
    const lines2 = await buffer.getLines();
    let isDelegate = false;
    let accessType = signature.modifier;
    let methodName = signature.methodName;
    let returnType = signature.returnType;
    let preview = false;
    let expectNextParam = false;
    let parameters = [];
    let newParamIndex = signature.parameters.length;
    for (const line of lines2 ?? []) {
      if (line.startsWith("---")) {
        break;
      } else if (expectNextParam && line.startsWith("- ")) {
        let match = RegExp(/- (\d+:) ([^ ]+) (\w+)/).exec(line);
        if (match) {
          let [_, index, type, name] = match;
          parameters.push({
            name,
            type,
            originalIndex: parseInt(index)
          });
        } else {
          let match2 = RegExp(/- ([^ ]+) (\w+) ?(.*)/).exec(line);
          if (match2) {
            let [_, type, name, value] = match2;
            value = computeParamValue(type, value);
            parameters.push({
              type,
              name,
              defaultValue: value,
              originalIndex: newParamIndex
            });
            newParamIndex++;
          }
        }
      } else if (line.startsWith("Access type:")) {
        accessType = readLineUserValue(line);
      } else if (line.startsWith("Method name:")) {
        methodName = readLineUserValue(line);
      } else if (line.startsWith("Parameters:")) {
        expectNextParam = true;
      } else if (line.startsWith("Return type:")) {
        returnType = readLineUserValue(line);
      }
    }
    const clientWorkspaceEdit = await languageClient.sendRequest(GetRefactorEditRequest.type, {
      command,
      context: params,
      options: formattingOptions,
      commandArguments: [signature.methodIdentifier, isDelegate, methodName, accessType, returnType, parameters, signature.exceptions, preview]
    });
    if (clientWorkspaceEdit == null ? void 0 : clientWorkspaceEdit.edit) {
      await applyRefactorEdit(languageClient, clientWorkspaceEdit);
    }
    close();
  };
  import_coc26.workspace.registerLocalKeymap(buffer.id, "n", "<cr>", refactor, true);
  import_coc26.workspace.registerLocalKeymap(buffer.id, "n", "q", close, true);
  const highlights = [
    [0, "Access type:", "Identifier", signature.modifier, "Keyword"],
    [1, "Method name:", "Identifier", signature.methodName, "Title"],
    [2, "Return type:", "Identifier", signature.returnType, "Type"],
    [3, "Parameters:", "Identifier", "", "Type"]
  ];
  for (const hl of highlights ?? []) {
    buffer.setExtMark(highlightsNamespace, hl[0], 0, {
      end_col: hl[1].length,
      end_line: hl[0],
      hl_group: hl[2]
    });
    buffer.setExtMark(highlightsNamespace, hl[0], hl[1].length, {
      end_col: hl[1].length + hl[3].length + 1,
      end_line: hl[0],
      hl_group: hl[4]
    });
  }
  buffer.setExtMark(highlightsNamespace, data.length, 0, {
    hl_group: "Comment",
    end_line: lines.length
  });
  const win = await import_coc26.nvim.openFloatWindow(buffer, true, {
    style: "minimal",
    border: "single",
    relative: "editor",
    focusable: true,
    height,
    width,
    row: Math.floor((rows - height) * 0.5),
    col: Math.floor((cols - width) * 0.5)
  });
  win.setOption("list", false);
  win.setOption("number", false);
  win.setOption("fillchars", "eob: ");
  win.setOption("relativenumber", false);
}

// src/refactoring/extractInterface.ts
var import_coc27 = require("coc.nvim");
async function getExtractInterfaceArguments(languageClient, params) {
  if (!params || !params.range) {
    return [];
  }
  const extractInterfaceResponse = await languageClient.sendRequest(CheckExtractInterfaceStatusRequest.type, params);
  if (!extractInterfaceResponse) {
    return [];
  }
  let step = 0 /* selectMember */;
  let resultHandleIdentifiers;
  let interfaceName;
  let selectPackageNodeItem;
  while (step !== void 0) {
    switch (step) {
      case 0 /* selectMember */:
        const items = extractInterfaceResponse.members.map((item) => {
          return {
            label: item.parameters ? `${item.name}(${item.parameters.join(", ")})` : item.name,
            description: item.typeName,
            handleIdentifier: item.handleIdentifier,
            picked: resultHandleIdentifiers === void 0 ? false : resultHandleIdentifiers.includes(item.handleIdentifier)
          };
        });
        const members = await import_coc27.window.showQuickPick(items, {
          title: "Extract Interface (1/3): Select members",
          placeholder: "Please select members to declare in the interface: ",
          // ignoreFocusOut: true,
          matchOnDescription: true,
          canPickMany: true
        });
        if (!members) {
          return [];
        }
        resultHandleIdentifiers = members.map((item) => item.handleIdentifier);
        if (!resultHandleIdentifiers) {
          return [];
        }
        step = 1 /* specifyInterfaceName */;
        break;
      case 1 /* specifyInterfaceName */:
        const specifyInterfaceNameDisposables = [];
        const specifyInterfaceNamePromise = new Promise(async (resolve9, _reject) => {
          const inputBox = await import_coc27.window.createInputBox(
            "Extract Interface (2/3): Specify interface name",
            interfaceName === void 0 ? extractInterfaceResponse.subTypeName : interfaceName,
            {
              placeholder: "Please specify the new interface name: "
            }
          );
          specifyInterfaceNameDisposables.push(
            inputBox,
            // inputBox.onDidTriggerButton((button) => {
            //   if (button === vscode.QuickInputButtons.Back) {
            //     step = Step.selectMember
            //     resolve(false)
            //   }
            // }),
            inputBox.onDidFinish((value) => {
              if (!value) return resolve9(void 0);
              resolve9(value);
            })
          );
        });
        try {
          const result = await specifyInterfaceNamePromise;
          if (result === false) {
            step = 0 /* selectMember */;
          } else if (result === void 0) {
            return [];
          } else {
            interfaceName = result;
            step = 2 /* selectPackage */;
          }
        } finally {
          specifyInterfaceNameDisposables.forEach((d) => d.dispose());
        }
        break;
      case 2 /* selectPackage */:
        const selectPackageDisposables = [];
        const packageNodeItems = extractInterfaceResponse.destinationResponse.destinations.sort((node1, node2) => {
          return node1.isParentOfSelectedFile ? -1 : 0;
        }).map((packageNode) => {
          const packageUri = packageNode.uri ? import_coc27.Uri.parse(packageNode.uri) : null;
          const displayPath = packageUri ? import_coc27.workspace.asRelativePath(packageUri, true) : packageNode.path;
          return {
            label: (packageNode.isParentOfSelectedFile ? "* " : "") + packageNode.displayName,
            description: displayPath,
            packageNode
          };
        });
        const selectPackagePromise = new Promise(async (resolve9, _reject) => {
          const quickPick = await import_coc27.window.createQuickPick();
          quickPick.items = packageNodeItems;
          quickPick.title = "Extract Interface (3/3): Specify package";
          selectPackageDisposables.push(
            quickPick,
            quickPick.onDidFinish((items2) => {
              if (items2.length > 0) {
                return resolve9(items2[0]);
              }
              resolve9(void 0);
            })
          );
          quickPick.show();
        });
        try {
          const result = await selectPackagePromise;
          if (result === false) {
            step = 1 /* specifyInterfaceName */;
          } else if (result === void 0) {
            return [];
          } else {
            selectPackageNodeItem = result;
            step = void 0;
          }
        } finally {
          selectPackageDisposables.forEach((d) => d.dispose());
        }
        break;
      default:
        return [];
    }
  }
  return [resultHandleIdentifiers, interfaceName, selectPackageNodeItem.packageNode];
}
async function revealExtractedInterface(refactorEdit) {
  var _a;
  if ((_a = refactorEdit == null ? void 0 : refactorEdit.edit) == null ? void 0 : _a.documentChanges) {
    for (const change of refactorEdit.edit.documentChanges) {
      if ("kind" in change && change.kind === "create") {
        for (const document of import_coc27.workspace.textDocuments) {
          if (document.uri.toString() === import_coc27.Uri.parse(change.uri).toString()) {
            await import_coc27.workspace.jumpTo(document.uri);
            return;
          }
        }
      }
    }
  }
}

// src/refactorAction.ts
function registerCommands2(languageClient, context) {
  registerApplyRefactorCommand(languageClient, context);
}
function registerApplyRefactorCommand(languageClient, context) {
  context.subscriptions.push(import_coc28.commands.registerCommand(Commands.RENAME_COMMAND, async (position) => {
    try {
      const uri = import_coc28.Uri.parse(position.uri);
      const document = await import_coc28.workspace.openTextDocument(uri);
      if (document === null) {
        return;
      }
      const renamePosition = document.textDocument.positionAt(position.offset);
      await import_coc28.commands.executeCommand("editor.action.rename", [
        document.uri,
        renamePosition
      ]);
    } catch (error) {
    }
  }, null, true));
  context.subscriptions.push(import_coc28.commands.registerCommand(Commands.APPLY_REFACTORING_COMMAND, async (command, params, commandInfo) => {
    if (command === "extractVariable" || command === "assignVariable" || command === "extractVariableAllOccurrence" || command === "extractConstant" || command === "extractMethod" || command === "extractField" || command === "extractInterface" || command === "assignField" || command === "changeSignature" || command === "convertVariableToField" || command === "invertVariable" || command === "introduceParameter" || command === "convertAnonymousClassToNestedCommand") {
      const currentEditor = import_coc28.window.activeTextEditor;
      if (!currentEditor || !currentEditor.options) {
        return;
      }
      const formattingOptions = {
        tabSize: currentEditor.options.tabSize,
        insertSpaces: currentEditor.options.insertSpaces
      };
      const commandArguments = [];
      if (command === "extractField") {
        if (!params || !import_coc28.Range.is(params.range)) {
          return;
        }
        if (params.range.start.character === params.range.end.character && params.range.start.line === params.range.end.line) {
          const expression = await getExpression(command, params, languageClient);
          if (!expression) {
            return;
          }
          if (expression.params && Array.isArray(expression.params)) {
            const initializeIn = await resolveScopes(expression.params);
            if (!initializeIn) {
              return;
            }
            commandArguments.push(initializeIn);
          }
          commandArguments.push(expression);
        } else {
          if (commandInfo.initializedScopes && Array.isArray(commandInfo.initializedScopes)) {
            const initializeIn = await resolveScopes(commandInfo.initializedScopes);
            if (!initializeIn) {
              return;
            }
            commandArguments.push(initializeIn);
          }
        }
      } else if (command === "convertVariableToField") {
        if (commandInfo.initializedScopes && Array.isArray(commandInfo.initializedScopes)) {
          const initializeIn = await resolveScopes(commandInfo.initializedScopes);
          if (!initializeIn) {
            return;
          }
          commandArguments.push(initializeIn);
        }
      } else if (command === "extractMethod" || command === "extractVariableAllOccurrence" || command === "extractVariable" || command === "extractConstant") {
        if (!params || !params.range) {
          return;
        }
        if (params.range.start.character === params.range.end.character && params.range.start.line === params.range.end.line) {
          const expression = await getExpression(command, params, languageClient);
          if (!expression) {
            return;
          }
          commandArguments.push(expression);
        }
      } else if (command === "extractInterface") {
        const args = await getExtractInterfaceArguments(languageClient, params);
        if (args.length === 0) {
          return;
        }
        commandArguments.push(...args);
      } else if (command === "changeSignature") {
        const changeSignatureInfo = await languageClient.sendRequest(GetChangeSignatureInfoRequest.type, params);
        if (changeSignatureInfo.errorMessage !== void 0) {
          import_coc28.window.showWarningMessage(changeSignatureInfo.errorMessage);
          return;
        }
        await renderChangeSignaturePanel(languageClient, command, params, formattingOptions, changeSignatureInfo);
        return;
      }
      const result = await languageClient.sendRequest(GetRefactorEditRequest.type, {
        command,
        context: params,
        options: formattingOptions,
        commandArguments
      });
      await applyRefactorEdit(languageClient, result);
      if (command === "extractInterface") {
        await revealExtractedInterface(result);
      }
    } else if (command === "moveFile") {
      if (!(commandInfo == null ? void 0 : commandInfo.uri)) {
        return;
      }
      await moveFile(languageClient, [import_coc28.Uri.parse(commandInfo.uri)]);
    } else if (command === "moveInstanceMethod") {
      await moveInstanceMethod(languageClient, params, commandInfo);
    } else if (command === "moveStaticMember") {
      await moveStaticMember(languageClient, params, commandInfo);
    } else if (command === "moveType") {
      await moveType(languageClient, params, commandInfo);
    }
  }, null, true));
}
async function resolveScopes(scopes) {
  let initializeIn;
  if (scopes.length === 1) {
    initializeIn = scopes[0];
  } else if (scopes.length > 1) {
    initializeIn = await import_coc28.window.showQuickPick(scopes, {
      placeholder: "Initialize the field in"
    });
    if (!initializeIn) {
      return void 0;
    }
  }
  return initializeIn;
}
async function getExpression(command, params, languageClient) {
  const expressions = await languageClient.sendRequest(InferSelectionRequest.type, {
    command,
    context: params
  });
  const options2 = [];
  for (const expression of expressions) {
    const extractItem = {
      label: expression.name,
      length: expression.length,
      offset: expression.offset,
      params: expression.params
    };
    options2.push(extractItem);
  }
  let resultItem;
  if (options2.length === 1) {
    resultItem = options2[0];
  } else if (options2.length > 1) {
    let commandMessage;
    switch (command) {
      case "extractMethod":
        commandMessage = "extract to method";
        break;
      case "extractVariableAllOccurrence":
      case "extractVariable":
        commandMessage = "extract to variable";
        break;
      case "extractConstant":
        commandMessage = "extract to constant";
        break;
      case "extractField":
        commandMessage = "extract to field";
        break;
      default:
        return void 0;
    }
    resultItem = await import_coc28.window.showQuickPick(options2, {
      placeholder: `Select an expression you want to ${commandMessage}`
    });
  }
  if (!resultItem) {
    return void 0;
  }
  const resultExpression = {
    name: resultItem.label,
    length: resultItem.length,
    offset: resultItem.offset,
    params: resultItem.params
  };
  return resultExpression;
}
async function moveFile(languageClient, fileUris) {
  if (!hasCommonParent(fileUris)) {
    import_coc28.window.showErrorMessage("Moving files from different directories are not supported. Please make sure they are from the same directory.");
    return;
  }
  const moveDestinations = await languageClient.sendRequest(GetMoveDestinationsRequest.type, {
    moveKind: "moveResource",
    sourceUris: fileUris.map((uri) => uri.toString()),
    params: null
  });
  if (!moveDestinations || !moveDestinations.destinations || !moveDestinations.destinations.length) {
    import_coc28.window.showErrorMessage("Cannot find available Java packages to move the selected files to.");
    return;
  }
  const packageNodeItems = moveDestinations.destinations.map((packageNode) => {
    const packageUri2 = packageNode.uri ? import_coc28.Uri.parse(packageNode.uri) : null;
    const displayPath = packageUri2 ? import_coc28.workspace.asRelativePath(packageUri2, true) : packageNode.path;
    return {
      label: (packageNode.isParentOfSelectedFile ? "* " : "") + packageNode.displayName,
      description: displayPath,
      packageNode
    };
  });
  const placeholder = fileUris.length === 1 ? `Choose the target package for ${getFileNameFromUri(fileUris[0])}.` : `Choose the target package for ${fileUris.length} selected files.`;
  const selectPackageNodeItem = await import_coc28.window.showQuickPick(packageNodeItems, {
    placeholder
  });
  if (!selectPackageNodeItem) {
    return;
  }
  const packageUri = selectPackageNodeItem.packageNode.uri ? import_coc28.Uri.parse(selectPackageNodeItem.packageNode.uri) : null;
  if (packageUri && packageUri.fsPath) {
    const duplicatedFiles = [];
    const moveUris = [];
    for (const uri of fileUris) {
      const fileName = getFileNameFromUri(uri);
      if ((0, import_fs3.existsSync)(path15.join(packageUri.fsPath, fileName))) {
        duplicatedFiles.push(fileName);
      } else {
        moveUris.push(uri);
      }
    }
    if (duplicatedFiles.length) {
      import_coc28.window.showWarningMessage(`The files '${duplicatedFiles.join(",")}' already exist in the package '${selectPackageNodeItem.packageNode.displayName}'. The move operation will ignore them.`);
    }
    if (!moveUris.length) {
      return;
    }
    fileUris = moveUris;
  }
  const refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
    moveKind: "moveResource",
    sourceUris: fileUris.map((uri) => uri.toString()),
    params: null,
    destination: selectPackageNodeItem.packageNode,
    updateReferences: true
  });
  await applyRefactorEdit(languageClient, refactorEdit);
  if (refactorEdit && refactorEdit.edit) {
    await saveEdit(refactorEdit.edit);
  }
}
function getFileNameFromUri(uri) {
  return uri.fsPath.replace(/^.*[\\\/]/, "");
}
function hasCommonParent(uris) {
  if (uris === null || uris.length <= 1) {
    return true;
  }
  const firstParent = path15.dirname(uris[0].fsPath);
  for (let i = 1; i < uris.length; i++) {
    const parent = path15.dirname(uris[i].fsPath);
    if (path15.relative(firstParent, parent) !== ".") {
      return false;
    }
  }
  return true;
}
async function saveEdit(edit2) {
  if (!edit2) {
    return;
  }
  const touchedFiles = /* @__PURE__ */ new Set();
  if (edit2.changes) {
    for (const uri of Object.keys(edit2.changes)) {
      touchedFiles.add(uri);
    }
  }
  if (edit2.documentChanges) {
    for (const change of edit2.documentChanges) {
      const kind = change.kind;
      if (kind === "rename") {
        if (touchedFiles.has(change.oldUri)) {
          touchedFiles.delete(change.oldUri);
          touchedFiles.add(change.newUri);
        }
      } else if (kind === "delete") {
        if (touchedFiles.has(change.uri)) {
          touchedFiles.delete(change.uri);
        }
      } else if (!kind) {
        touchedFiles.add(change.textDocument.uri);
      }
    }
  }
  for (const fileUri of touchedFiles) {
    const uri = import_coc28.Uri.parse(fileUri);
    const document = await import_coc28.workspace.openTextDocument(uri);
    if (document === null) {
      continue;
    }
    import_coc28.workspace.nvim.command("w", true);
  }
}
async function moveInstanceMethod(languageClient, params, commandInfo) {
  const moveDestinations = await languageClient.sendRequest(GetMoveDestinationsRequest.type, {
    moveKind: "moveInstanceMethod",
    sourceUris: [params.textDocument.uri],
    params
  });
  if (moveDestinations && moveDestinations.errorMessage) {
    import_coc28.window.showErrorMessage(moveDestinations.errorMessage);
    return;
  }
  if (!moveDestinations || !moveDestinations.destinations || !moveDestinations.destinations.length) {
    import_coc28.window.showErrorMessage("Cannot find possible class targets to move the selected method to.");
    return;
  }
  const destinationNodeItems = moveDestinations.destinations.map((destination) => {
    return {
      label: `${destination.type} ${destination.name}`,
      description: destination.isField ? "Field" : "Method Parameter",
      destination
    };
  });
  const methodName = commandInfo && commandInfo.displayName ? commandInfo.displayName : "";
  const selected = await import_coc28.window.showQuickPick(destinationNodeItems, {
    placeholder: `Select the new class for the instance method ${methodName}.`
  });
  if (!selected) {
    return;
  }
  const refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
    moveKind: "moveInstanceMethod",
    sourceUris: [params.textDocument.uri],
    params,
    destination: selected.destination
  });
  await applyRefactorEdit(languageClient, refactorEdit);
}
async function moveStaticMember(languageClient, params, commandInfo) {
  const memberName = commandInfo && commandInfo.displayName ? commandInfo.displayName : "";
  const exclude = /* @__PURE__ */ new Set();
  if (commandInfo.enclosingTypeName) {
    exclude.add(commandInfo.enclosingTypeName);
    if (commandInfo.memberType === 55 || commandInfo.memberType === 71 || commandInfo.memberType === 81) {
      exclude.add(`${commandInfo.enclosingTypeName}.${commandInfo.displayName}`);
    }
  }
  const projectName = commandInfo ? commandInfo.projectName : null;
  const picked = await selectTargetClass(languageClient, `Select the new class for the static member ${memberName}.`, projectName, exclude);
  if (picked) {
    const refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
      moveKind: "moveStaticMember",
      sourceUris: [params.textDocument.uri],
      params,
      destination: picked
    });
    await applyRefactorEdit(languageClient, refactorEdit);
  }
}
async function selectTargetClass(languageClient, placeholder, projectName, exclude) {
  const picked = await import_coc28.window.showQuickPick(
    languageClient.sendRequest(SearchSymbols.type, {
      query: "*",
      projectName,
      sourceOnly: true
    }).then((types) => {
      if (types && types.length) {
        return types.filter((type) => {
          const typeName = type.containerName ? `${type.containerName}.${type.name}` : type.name;
          return !exclude.has(typeName);
        }).sort((a, b) => {
          if (a.name < b.name) {
            return -1;
          } else if (a.name > b.name) {
            return 1;
          }
          return 0;
        }).map(((symbol) => {
          return {
            label: symbol.name,
            description: symbol.containerName,
            symbolNode: symbol
          };
        }));
      } else {
        return [{
          label: "No result found",
          alwaysShow: true,
          description: "",
          symbolNode: null
        }];
      }
    }),
    {
      placeholder
    }
  );
  return picked ? picked.symbolNode : null;
}
async function moveType(languageClient, params, commandInfo) {
  if (!commandInfo || !commandInfo.supportedDestinationKinds) {
    return;
  }
  const destinationPickItems = commandInfo.supportedDestinationKinds.map((kind) => {
    if (kind === "newFile") {
      return {
        label: `Move type ${commandInfo.displayName} to new file`,
        kind
      };
    } else {
      return {
        label: `Move type ${commandInfo.displayName} to another class`,
        kind
      };
    }
  });
  if (!destinationPickItems.length) {
    return;
  }
  const picked = await import_coc28.window.showQuickPick(destinationPickItems, {
    placeholder: "What would you like to do?"
  });
  if (!picked) {
    return;
  }
  let refactorEdit;
  if (picked.kind === "newFile") {
    refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
      moveKind: "moveTypeToNewFile",
      sourceUris: [params.textDocument.uri],
      params
    });
  } else {
    const exclude = /* @__PURE__ */ new Set();
    if (commandInfo.enclosingTypeName) {
      exclude.add(commandInfo.enclosingTypeName);
      exclude.add(`${commandInfo.enclosingTypeName}.${commandInfo.displayName}`);
    }
    const picked2 = await selectTargetClass(languageClient, `Select the new class for the type ${commandInfo.displayName}.`, commandInfo.projectName, exclude);
    if (picked2) {
      refactorEdit = await languageClient.sendRequest(MoveRequest.type, {
        moveKind: "moveTypeToClass",
        sourceUris: [params.textDocument.uri],
        params,
        destination: picked2
      });
    }
  }
  await applyRefactorEdit(languageClient, refactorEdit);
}

// src/serverStatus.ts
var import_coc30 = require("coc.nvim");

// src/serverTasks.ts
var import_coc29 = require("coc.nvim");
var tasks = [];
var emitter = new import_coc29.Emitter();
var suggestedTaskEntrySize = 10;
var serverTasks;
((serverTasks2) => {
  serverTasks2.onDidUpdateServerTask = emitter.event;
  function updateServerTask(report) {
    applyReport(report);
    emitter.fire(tasks);
  }
  serverTasks2.updateServerTask = updateServerTask;
  function suggestTaskEntrySize(size) {
    if (size > suggestedTaskEntrySize) {
      suggestedTaskEntrySize = size;
    }
  }
  serverTasks2.suggestTaskEntrySize = suggestTaskEntrySize;
  function getHistory() {
    return tasks;
  }
  serverTasks2.getHistory = getHistory;
})(serverTasks || (serverTasks = {}));
function organizeTasks() {
  let newArray = tasks;
  if (tasks.length > suggestedTaskEntrySize) {
    newArray = recycleTasks(tasks, suggestedTaskEntrySize);
  }
  newArray.sort((a, b) => {
    const ai = a.complete ? 0 : 1, bi = a.complete ? 0 : 1;
    return ai - bi;
  });
  tasks = newArray;
}
function recycleTasks(tasks2, length) {
  const newArray = [], delta = tasks2.length - length;
  let skipped = 0;
  tasks2.forEach((task) => {
    if (skipped < delta && task.complete) {
      skipped++;
      return;
    }
    newArray.push(task);
  });
  return newArray;
}
function applyReport(report) {
  const index = tasks.findIndex((o) => o.id = report.id);
  if (index === -1) {
    tasks.push(report);
  } else {
    tasks[index] = report;
  }
  organizeTasks();
}

// src/serverStatus.ts
var emitter2 = new import_coc30.Emitter();
var status = "Ready" /* ready */;
var isBusy = false;
function fireEvent() {
  if (isBusy) {
    emitter2.fire("Busy" /* busy */);
    return;
  }
  emitter2.fire(status);
}
var serverStatus;
((serverStatus2) => {
  let hasError = false;
  serverStatus2.onServerStatusChanged = emitter2.event;
  function initialize3() {
    serverTasks.onDidUpdateServerTask((tasks2) => {
      isBusy = tasks2.some((task) => !task.complete);
      fireEvent();
    });
  }
  serverStatus2.initialize = initialize3;
  function updateServerStatus(newStatus) {
    if (newStatus === "Busy" /* busy */) {
      throw new Error("Busy status cannot be set directly.");
    }
    if (newStatus === "Error" /* error */ || newStatus === "Warning" /* warning */) {
      hasError = true;
    } else if (hasError) {
      return;
    }
    status = newStatus;
    fireEvent();
  }
  serverStatus2.updateServerStatus = updateServerStatus;
  function hasErrors() {
    return hasError;
  }
  serverStatus2.hasErrors = hasErrors;
  function errorResolved() {
    hasError = false;
  }
  serverStatus2.errorResolved = errorResolved;
})(serverStatus || (serverStatus = {}));

// src/serverTaskPresenter.ts
var import_coc31 = require("coc.nvim");
var JAVA_SERVER_TASK_PRESENTER_TASK_NAME = "Java Build Status";
var bufnr;
var serverTaskPresenter;
((serverTaskPresenter2) => {
  async function presentServerTaskView() {
    let { nvim: nvim3 } = import_coc31.workspace;
    let winid = -1;
    if (bufnr) {
      let loaded = await nvim3.call("bufloaded", [bufnr]);
      if (!loaded) bufnr = void 0;
      if (bufnr) {
        winid = await nvim3.call("bufwinid", [bufnr]);
      }
    }
    if (!bufnr) {
      let buf = await nvim3.createNewBuffer(false, true);
      bufnr = buf.id;
      await buf.setOption("bufhidden", "wipe");
    }
    if (!bufnr) return;
    if (winid == -1) {
      nvim3.command(`belowright 10sp +b\\ ${bufnr}`, true);
    }
    await refreshLines(serverTasks.getHistory());
    activationProgressNotification.hide();
  }
  serverTaskPresenter2.presentServerTaskView = presentServerTaskView;
})(serverTaskPresenter || (serverTaskPresenter = {}));
async function refreshLines(tasks2) {
  if (!bufnr) return;
  let loaded = await import_coc31.workspace.nvim.call("bufloaded", [bufnr]);
  if (!loaded) return;
  let lines = [JAVA_SERVER_TASK_PRESENTER_TASK_NAME];
  for (let task of tasks2) {
    lines.push(printTask(task));
  }
  let buf = import_coc31.workspace.nvim.createBuffer(bufnr);
  await buf.setLines(lines, { start: 0, end: -1, strictIndexing: false });
}
serverTasks.onDidUpdateServerTask(async (tasks2) => {
  await refreshLines(tasks2);
});
function printTask(report) {
  if (report.complete) {
    return `${report.id.slice(0, 8)} ${report.task} [Done]`;
  }
  return `${report.id.slice(0, 8)} ${report.task}: ${report.status} [${report.workDone}/${report.totalWork}]`;
}
var ActivationProgressNotification = class {
  constructor() {
    this.hideEmitter = new import_coc31.Emitter();
    this.onHide = this.hideEmitter.event;
    this.disposables = [];
  }
  showProgress() {
    if (!import_coc31.workspace.workspaceFolders) {
      return;
    }
    const showBuildStatusEnabled = getJavaConfiguration().get("showBuildStatusOnStart.enabled");
    if (typeof showBuildStatusEnabled === "string" || showBuildStatusEnabled instanceof String) {
      if (showBuildStatusEnabled !== "notification") {
        return;
      }
    } else if (!showBuildStatusEnabled) {
      return;
    }
    const isProgressReportEnabled = getJavaConfiguration().get("progressReports.enabled");
    const title = isProgressReportEnabled ? "Opening Java Projects" : "Opening Java Projects...";
    import_coc31.window.withProgress({
      title,
      cancellable: false
    }, (progress, _token) => {
      return new Promise((resolve9) => {
        let interval;
        if (isProgressReportEnabled) {
          interval = setInterval(() => {
            const tasks2 = serverTasks.getHistory();
            if (tasks2.length == 0) {
              progress.report({ message: "" });
            } else {
              const msg = printTask(tasks2[tasks2.length - 1]);
              progress.report({ message: msg });
            }
          });
        }
        this.onHide(() => {
          clearInterval(interval);
          for (const disposable of this.disposables) {
            disposable.dispose();
          }
          return resolve9();
        });
      });
    });
  }
  hide() {
    this.hideEmitter.fire();
  }
};
var activationProgressNotification = new ActivationProgressNotification();

// src/sourceAction.ts
var import_coc32 = require("coc.nvim");
function registerCommands3(languageClient, context) {
  registerOverrideMethodsCommand(languageClient, context);
  registerHashCodeEqualsCommand(languageClient, context);
  registerOrganizeImportsCommand(languageClient, context);
  registerCleanupCommand(languageClient, context);
  registerChooseImportCommand(context);
  registerGenerateToStringCommand(languageClient, context);
  registerGenerateAccessorsCommand(languageClient, context);
  registerGenerateConstructorsCommand(languageClient, context);
  registerGenerateDelegateMethodsCommand(languageClient, context);
}
function registerOverrideMethodsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.OVERRIDE_METHODS_PROMPT, async (params) => {
    var _a;
    const result = await languageClient.sendRequest(ListOverridableMethodsRequest.type, params);
    if (!((_a = result == null ? void 0 : result.methods) == null ? void 0 : _a.length)) {
      import_coc32.window.showWarningMessage("No overridable methods found in the super type.");
      return;
    }
    result.methods.sort((a, b) => {
      const declaringClass = a.declaringClass.localeCompare(b.declaringClass);
      if (declaringClass !== 0) {
        return declaringClass;
      }
      const methodName = a.name.localeCompare(b.name);
      if (methodName !== 0) {
        return methodName;
      }
      return a.parameters.length - b.parameters.length;
    });
    const quickPickItems = result.methods.map((method) => {
      return {
        label: `${method.name}(${method.parameters.join(",")})`,
        description: `${method.declaringClassType}: ${method.declaringClass}`,
        picked: method.unimplemented,
        originalMethod: method
      };
    });
    const selectedItems = await import_coc32.window.showQuickPick(quickPickItems, {
      canPickMany: true,
      placeholder: `Select methods to override or implement in ${result.type}`
    });
    if (!(selectedItems == null ? void 0 : selectedItems.length)) {
      return;
    }
    const workspaceEdit = await languageClient.sendRequest(AddOverridableMethodsRequest.type, {
      context: params,
      overridableMethods: selectedItems.map((item) => item.originalMethod)
    });
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}
function registerCleanupCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.MANUAL_CLEANUP, async () => {
    const textDocument = import_coc32.TextDocumentIdentifier.create(import_coc32.window.activeTextEditor.document.uri);
    const workspaceEdit = await languageClient.sendRequest(CleanupRequest.type, textDocument);
    await import_coc32.workspace.applyEdit(workspaceEdit);
    import_coc32.window.showWarningMessage("Applied cleanup, :w to save changes");
  }));
}
function registerHashCodeEqualsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.HASHCODE_EQUALS_PROMPT, async (params) => {
    var _a, _b;
    const result = await languageClient.sendRequest(CheckHashCodeEqualsStatusRequest.type, params);
    if (!((_a = result == null ? void 0 : result.fields) == null ? void 0 : _a.length)) {
      import_coc32.window.showErrorMessage(`The operation is not applicable to the type ${result.type}.`);
      return;
    }
    let regenerate = false;
    if ((_b = result == null ? void 0 : result.existingMethods) == null ? void 0 : _b.length) {
      const ans = await import_coc32.window.showInformationMessage(`Methods ${result.existingMethods.join(" and ")} already ${result.existingMethods.length === 1 ? "exists" : "exist"} in the Class '${result.type}'. Do you want to regenerate the implementation?`, "Regenerate", "Cancel");
      if (ans !== "Regenerate") {
        return;
      }
      regenerate = true;
    }
    const fieldItems = result.fields.map((field) => {
      return {
        label: `${field.name}: ${field.type}`,
        picked: field.isSelected || field.isField,
        originalField: field
      };
    });
    const selectedFields = await import_coc32.window.showQuickPick(fieldItems, {
      canPickMany: true,
      placeholder: "Select the fields to include in the hashCode() and equals() methods."
    });
    if (!(selectedFields == null ? void 0 : selectedFields.length)) {
      return;
    }
    const workspaceEdit = await languageClient.sendRequest(GenerateHashCodeEqualsRequest.type, {
      context: params,
      fields: selectedFields.map((item) => item.originalField),
      regenerate
    });
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}
function registerOrganizeImportsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.ORGANIZE_IMPORTS, async (params) => {
    const workspaceEdit = await languageClient.sendRequest(OrganizeImportsRequest.type, params);
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}
function registerChooseImportCommand(context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.CHOOSE_IMPORTS, async (uri, selections, restoreExistingImports) => {
    const chosen = [];
    const fileUri = import_coc32.Uri.parse(uri);
    for (const element of selections) {
      const selection = element;
      await import_coc32.workspace.jumpTo(fileUri, selection.range.start);
      await import_coc32.window.selectRange(selection.range);
      const candidates = selection.candidates;
      const items = candidates.map((item) => {
        return {
          label: item.fullyQualifiedName,
          origin: item
        };
      });
      const fullyQualifiedName = candidates[0].fullyQualifiedName;
      const typeName = fullyQualifiedName.substring(fullyQualifiedName.lastIndexOf(".") + 1);
      const disposables = [];
      try {
        const pick = await new Promise((resolve9, reject) => {
          import_coc32.window.createQuickPick({
            placeholder: `Choose type '${typeName}' to import`,
            items,
            title: restoreExistingImports ? "Add All Missing Imports" : "Organize Imports",
            matchOnDescription: true
          }).then((input) => {
            disposables.push(
              input.onDidFinish((items2) => {
                if (Array.isArray(items2) && items2.length > 0) {
                  return resolve9(items2[0]);
                }
                reject(void 0);
              })
            );
            input.show();
          }, reject);
        });
        chosen.push(pick ? pick.origin : null);
      } catch (err) {
        break;
      } finally {
        disposables.forEach((d) => d.dispose());
      }
    }
    return chosen;
  }, null, true));
}
function registerGenerateToStringCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.GENERATE_TOSTRING_PROMPT, async (params) => {
    var _a;
    const result = await languageClient.sendRequest(CheckToStringStatusRequest.type, params);
    if (!result) {
      return;
    }
    if (result.exists) {
      const ans = await import_coc32.window.showInformationMessage(`Method 'toString()' already exists in the Class '${result.type}'. Do you want to replace the implementation?`, "Replace", "Cancel");
      if (ans !== "Replace") {
        return;
      }
    }
    let fields = [];
    if ((_a = result == null ? void 0 : result.fields) == null ? void 0 : _a.length) {
      const fieldItems = result.fields.map((field) => {
        return {
          label: `${field.name}: ${field.type}`,
          picked: field.isSelected || field.isField,
          originalField: field
        };
      });
      const selectedFields = await import_coc32.window.showQuickPick(fieldItems, {
        canPickMany: true,
        placeholder: "Select the fields to include in the toString() method."
      });
      if (!selectedFields) {
        return;
      }
      fields = selectedFields.map((item) => item.originalField);
    }
    const workspaceEdit = await languageClient.sendRequest(GenerateToStringRequest.type, {
      context: params,
      fields
    });
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}
function registerGenerateAccessorsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.GENERATE_ACCESSORS_PROMPT, async (params) => {
    await generateAccessors(languageClient, params);
  }, null, true));
}
async function generateAccessors(languageClient, params) {
  const accessors = await languageClient.sendRequest(AccessorCodeActionRequest.type, params);
  if (!(accessors == null ? void 0 : accessors.length)) {
    return;
  }
  const accessorItems = accessors.map((accessor) => {
    const description = [];
    if (accessor.generateGetter) {
      description.push("getter");
    }
    if (accessor.generateSetter) {
      description.push("setter");
    }
    return {
      label: `${accessor.fieldName}: ${accessor.typeName}`,
      description: (accessor.isStatic ? "static " : "") + description.join(", "),
      originalField: accessor,
      picked: true
    };
  });
  let accessorsKind;
  switch (params.kind) {
    case 2 /* both */:
      accessorsKind = "getters and setters";
      break;
    case 0 /* getter */:
      accessorsKind = "getters";
      break;
    case 1 /* setter */:
      accessorsKind = "setters";
      break;
    default:
      return;
  }
  const selectedAccessors = await import_coc32.window.showQuickPick(accessorItems, {
    canPickMany: true,
    placeholder: `Select the fields to generate ${accessorsKind}`
  });
  if (!(selectedAccessors == null ? void 0 : selectedAccessors.length)) {
    return;
  }
  const workspaceEdit = await languageClient.sendRequest(GenerateAccessorsRequest.type, {
    context: params,
    accessors: selectedAccessors.map((item) => item.originalField)
  });
  await import_coc32.workspace.applyEdit(workspaceEdit);
}
function registerGenerateConstructorsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.GENERATE_CONSTRUCTORS_PROMPT, async (params) => {
    var _a;
    const status2 = await languageClient.sendRequest(CheckConstructorStatusRequest.type, params);
    if (!((_a = status2 == null ? void 0 : status2.constructors) == null ? void 0 : _a.length)) {
      return;
    }
    let selectedConstructors = status2.constructors;
    let selectedFields = [];
    if (status2.constructors.length > 1) {
      const constructorItems = status2.constructors.map((constructor) => {
        return {
          label: `${constructor.name}(${constructor.parameters.join(",")})`,
          originalConstructor: constructor
        };
      });
      const selectedConstructorItems = await import_coc32.window.showQuickPick(constructorItems, {
        canPickMany: true,
        placeholder: "Select super class constructor(s)."
      });
      if (!(selectedConstructorItems == null ? void 0 : selectedConstructorItems.length)) {
        return;
      }
      selectedConstructors = selectedConstructorItems.map((item) => item.originalConstructor);
    }
    if (status2.fields.length) {
      const fieldItems = status2.fields.map((field) => {
        return {
          label: `${field.name}: ${field.type}`,
          picked: field.isSelected || field.isField,
          originalField: field
        };
      });
      const selectedFieldItems = await import_coc32.window.showQuickPick(fieldItems, {
        canPickMany: true,
        placeholder: "Select fields to initialize by constructor(s)."
      });
      if (!selectedFieldItems) {
        return;
      }
      selectedFields = selectedFieldItems.map((item) => item.originalField);
    }
    const workspaceEdit = await languageClient.sendRequest(GenerateConstructorsRequest.type, {
      context: params,
      constructors: selectedConstructors,
      fields: selectedFields
    });
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}
function registerGenerateDelegateMethodsCommand(languageClient, context) {
  context.subscriptions.push(import_coc32.commands.registerCommand(Commands.GENERATE_DELEGATE_METHODS_PROMPT, async (params) => {
    var _a;
    const status2 = await languageClient.sendRequest(CheckDelegateMethodsStatusRequest.type, params);
    if (!((_a = status2 == null ? void 0 : status2.delegateFields) == null ? void 0 : _a.length)) {
      import_coc32.window.showWarningMessage("All delegatable methods are already implemented.");
      return;
    }
    let selectedDelegateField = status2.delegateFields[0];
    if (status2.delegateFields.length > 1) {
      const fieldItems = status2.delegateFields.map((delegateField) => {
        return {
          label: `${delegateField.field.name}: ${delegateField.field.type}`,
          originalField: delegateField
        };
      });
      const selectedFieldItem = await import_coc32.window.showQuickPick(fieldItems, {
        placeholder: "Select target to generate delegates for."
      });
      if (!selectedFieldItem) {
        return;
      }
      selectedDelegateField = selectedFieldItem.originalField;
    }
    const delegateEntryItems = selectedDelegateField.delegateMethods.map((delegateMethod) => {
      return {
        label: `${selectedDelegateField.field.name}.${delegateMethod.name}(${delegateMethod.parameters.join(",")})`,
        originalField: selectedDelegateField.field,
        originalMethod: delegateMethod
      };
    });
    if (!delegateEntryItems.length) {
      import_coc32.window.showWarningMessage("All delegatable methods are already implemented.");
      return;
    }
    const selectedDelegateEntryItems = await import_coc32.window.showQuickPick(delegateEntryItems, {
      canPickMany: true,
      placeholder: "Select methods to generate delegates for."
    });
    if (!(selectedDelegateEntryItems == null ? void 0 : selectedDelegateEntryItems.length)) {
      return;
    }
    const delegateEntries = selectedDelegateEntryItems.map((item) => {
      return {
        field: item.originalField,
        delegateMethod: item.originalMethod
      };
    });
    const workspaceEdit = await languageClient.sendRequest(GenerateDelegateMethodsRequest.type, {
      context: params,
      delegateEntries
    });
    await import_coc32.workspace.applyEdit(workspaceEdit);
  }, null, true));
}

// src/typeHierarchy/protocol.ts
var TypeHierarchyItem = class {
};

// src/typeHierarchy/typeHierarchyTree.ts
var import_coc35 = require("coc.nvim");

// src/typeHierarchy/model.ts
var import_coc34 = require("coc.nvim");

// src/typeHierarchy/util.ts
var import_coc33 = require("coc.nvim");
function toSingleLSPTypeHierarchyItem(client, typeHierarchyItem) {
  if (!typeHierarchyItem) {
    return void 0;
  }
  return {
    name: typeHierarchyItem.name,
    detail: typeHierarchyItem.detail,
    kind: typeHierarchyItem.kind,
    deprecated: typeHierarchyItem.deprecated,
    uri: typeHierarchyItem.uri,
    range: typeHierarchyItem.range,
    selectionRange: typeHierarchyItem.selectionRange,
    parents: void 0,
    children: void 0,
    data: typeHierarchyItem.data
  };
}
function toTypeHierarchyItem(client, lspTypeHierarchyItem, direction) {
  if (!lspTypeHierarchyItem) {
    return void 0;
  }
  let parents;
  let children;
  if (direction === 1 /* parents */ || direction === 2 /* both */) {
    if (lspTypeHierarchyItem.parents) {
      parents = [];
      for (const parent of lspTypeHierarchyItem.parents) {
        parents.push(toTypeHierarchyItem(client, parent, 1 /* parents */));
      }
      parents = parents.sort((a, b) => {
        return a.kind.toString() === b.kind.toString() ? a.name.localeCompare(b.name) : b.kind.toString().localeCompare(a.kind.toString());
      });
    }
  }
  if (direction === 0 /* children */ || direction === 2 /* both */) {
    if (lspTypeHierarchyItem.children) {
      children = [];
      for (const child of lspTypeHierarchyItem.children) {
        children.push(toTypeHierarchyItem(client, child, 0 /* children */));
      }
      children = children.sort((a, b) => {
        return a.kind.toString() === b.kind.toString() ? a.name.localeCompare(b.name) : b.kind.toString().localeCompare(a.kind.toString());
      });
    }
  }
  return {
    name: lspTypeHierarchyItem.name,
    detail: lspTypeHierarchyItem.detail,
    kind: lspTypeHierarchyItem.kind,
    deprecated: lspTypeHierarchyItem.deprecated,
    uri: lspTypeHierarchyItem.uri,
    range: lspTypeHierarchyItem.range,
    selectionRange: lspTypeHierarchyItem.selectionRange,
    parents,
    children,
    data: lspTypeHierarchyItem.data,
    expand: false
  };
}
async function resolveTypeHierarchy(client, typeHierarchyItem, direction, token) {
  const lspTypeHierarchyItem = toSingleLSPTypeHierarchyItem(client, typeHierarchyItem);
  let resolvedLSPItem;
  try {
    resolvedLSPItem = await import_coc33.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.RESOLVE_TYPE_HIERARCHY, JSON.stringify(lspTypeHierarchyItem), JSON.stringify(direction), JSON.stringify(1), token);
  } catch (e) {
    return void 0;
  }
  const resolvedItem = toTypeHierarchyItem(client, resolvedLSPItem, direction);
  if (!resolvedItem) {
    return void 0;
  }
  resolvedItem.expand = typeHierarchyItem.expand;
  return resolvedItem;
}
async function getRootItem(client, typeHierarchyItem, token) {
  if (!typeHierarchyItem) {
    return void 0;
  }
  if (!typeHierarchyItem.parents) {
    const resolvedItem = await resolveTypeHierarchy(client, typeHierarchyItem, 1 /* parents */, token);
    if (!resolvedItem || !resolvedItem.parents) {
      return typeHierarchyItem;
    } else {
      typeHierarchyItem.parents = resolvedItem.parents;
    }
  }
  if (typeHierarchyItem.parents.length === 0) {
    return typeHierarchyItem;
  } else {
    for (const parent of typeHierarchyItem.parents) {
      if (parent.kind === import_coc33.SymbolKind.Class) {
        parent.children = [typeHierarchyItem];
        parent.expand = true;
        return getRootItem(client, parent, token);
      }
    }
    return typeHierarchyItem;
  }
}
function getSymbolKind2(kind) {
  switch (kind) {
    case import_coc33.SymbolKind.File:
      return "File";
    case import_coc33.SymbolKind.Module:
      return "Module";
    case import_coc33.SymbolKind.Namespace:
      return "Namespace";
    case import_coc33.SymbolKind.Package:
      return "Package";
    case import_coc33.SymbolKind.Class:
      return "Class";
    case import_coc33.SymbolKind.Method:
      return "Method";
    case import_coc33.SymbolKind.Property:
      return "Property";
    case import_coc33.SymbolKind.Field:
      return "Field";
    case import_coc33.SymbolKind.Constructor:
      return "Constructor";
    case import_coc33.SymbolKind.Enum:
      return "Enum";
    case import_coc33.SymbolKind.Interface:
      return "Interface";
    case import_coc33.SymbolKind.Function:
      return "Function";
    case import_coc33.SymbolKind.Variable:
      return "Variable";
    case import_coc33.SymbolKind.Constant:
      return "Constant";
    case import_coc33.SymbolKind.String:
      return "String";
    case import_coc33.SymbolKind.Number:
      return "Number";
    case import_coc33.SymbolKind.Boolean:
      return "Boolean";
    case import_coc33.SymbolKind.Array:
      return "Array";
    case import_coc33.SymbolKind.Object:
      return "Object";
    case import_coc33.SymbolKind.Key:
      return "Key";
    case import_coc33.SymbolKind.Null:
      return "Null";
    case import_coc33.SymbolKind.EnumMember:
      return "EnumMember";
    case import_coc33.SymbolKind.Struct:
      return "Struct";
    case import_coc33.SymbolKind.Event:
      return "Event";
    case import_coc33.SymbolKind.Operator:
      return "Operator";
    case import_coc33.SymbolKind.TypeParameter:
      return "TypeParameter";
    default:
      return "Unknown";
  }
}

// src/typeHierarchy/model.ts
var TypeHierarchyTreeInput = class _TypeHierarchyTreeInput {
  constructor(location, direction, token, item) {
    this.location = location;
    this.direction = direction;
    this.token = token;
    this.contextValue = "javaTypeHierarchy";
    this.baseItem = item;
    switch (direction) {
      case 2 /* both */:
        this.title = "Class Hierarchy";
        break;
      case 1 /* parents */:
        this.title = "Supertype Hierarchy";
        break;
      case 0 /* children */:
        this.title = "Subtype Hierarchy";
        break;
      default:
        return;
    }
  }
  async resolve() {
    if (!this.client) {
      this.client = await getActiveLanguageClient();
    }
    await new Promise((resolve9) => setTimeout(() => {
      resolve9();
    }, 500));
    this.rootItem = this.direction === 2 /* both */ ? await getRootItem(this.client, this.baseItem, this.token) : this.baseItem;
    const model = new TypeHierarchyModel(this.rootItem, this.direction, this.baseItem);
    const provider = new TypeHierarchyTreeDataProvider(model, this.client, this.token);
    const treeModel = {
      provider,
      message: void 0,
      navigation: model,
      dispose() {
        provider.dispose();
      }
    };
    return treeModel;
  }
  with(location) {
    return new _TypeHierarchyTreeInput(location, this.direction, this.token, this.baseItem);
  }
};
var TypeHierarchyModel = class {
  constructor(rootItem, direction, baseItem) {
    this.rootItem = rootItem;
    this.direction = direction;
    this.baseItem = baseItem;
    this.onDidChange = new import_coc34.Emitter();
    this.onDidChangeEvent = this.onDidChange.event;
  }
  getBaseItem() {
    return this.baseItem;
  }
  getDirection() {
    return this.direction;
  }
  getRootItem() {
    return this.rootItem;
  }
  location(item) {
    return import_coc34.Location.create(item.uri, item.range);
  }
  nearest(uri, _position) {
    return this.baseItem;
  }
  next(from) {
    return from;
  }
  previous(from) {
    return from;
  }
};
var _TypeHierarchyTreeDataProvider = class _TypeHierarchyTreeDataProvider {
  constructor(model, client, token) {
    this.model = model;
    this.client = client;
    this.token = token;
    this.emitter = new import_coc34.Emitter();
    this.onDidChangeTreeData = this.emitter.event;
    this.modelListener = model.onDidChangeEvent((e) => this.emitter.fire(e instanceof TypeHierarchyItem ? e : void 0));
    this.lazyLoad = import_coc34.workspace.getConfiguration().get("java.typeHierarchy.lazyLoad");
    this.labels = import_coc34.workspace.getConfiguration().get("suggest.completionItemKindLabels", {});
  }
  dispose() {
    this.emitter.dispose();
    this.modelListener.dispose();
  }
  async getTreeItem(element) {
    if (!element) {
      return void 0;
    }
    const treeItem = element === this.model.getBaseItem() ? new import_coc34.TreeItem({ label: element.name, highlights: [[0, element.name.length]] }) : new import_coc34.TreeItem(element.name);
    treeItem.description = element.detail;
    treeItem.icon = this.getIcon(element.kind);
    if (!element.selectionRange) return void 0;
    let start = element.selectionRange.start;
    treeItem.command = element.uri ? {
      command: Commands.OPEN_TYPE_HIERARCHY_LOCATION,
      title: "Open Type Definition Location",
      arguments: [element.uri, start]
    } : void 0;
    treeItem.id = `${element.data}${Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}`;
    if (element.expand) {
      treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Expanded;
    } else if (this.model.getDirection() === 0 /* children */ || this.model.getDirection() === 2 /* both */) {
      if (element === this.model.getBaseItem()) {
        if (!element.children) {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Collapsed;
        } else if (element.children.length === 0) {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.None;
        } else {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Expanded;
        }
      } else {
        if (!element.children) {
          if (this.lazyLoad) {
            treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Collapsed;
            return treeItem;
          }
          const resolvedItem = await resolveTypeHierarchy(this.client, element, this.model.getDirection(), this.token);
          if (!resolvedItem) {
            return void 0;
          }
          element.children = resolvedItem.children;
        }
        treeItem.collapsibleState = element.children.length === 0 ? import_coc34.TreeItemCollapsibleState.None : import_coc34.TreeItemCollapsibleState.Collapsed;
      }
    } else if (this.model.getDirection() === 1 /* parents */) {
      if (element === this.model.getBaseItem()) {
        if (!element.parents) {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Collapsed;
        } else if (element.parents.length === 0) {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.None;
        } else {
          treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Expanded;
        }
      } else {
        if (!element.parents) {
          if (this.lazyLoad) {
            treeItem.collapsibleState = import_coc34.TreeItemCollapsibleState.Collapsed;
            return treeItem;
          }
          const resolvedItem = await resolveTypeHierarchy(this.client, element, this.model.getDirection(), this.token);
          if (!resolvedItem) {
            return void 0;
          }
          element.parents = resolvedItem.parents;
        }
        treeItem.collapsibleState = element.parents.length === 0 ? import_coc34.TreeItemCollapsibleState.None : import_coc34.TreeItemCollapsibleState.Collapsed;
      }
    }
    return treeItem;
  }
  async resolveActions(item, typeHierarchyItem) {
    let actions = [];
    actions.push({
      title: "Base on this Type",
      handler: async (item2) => {
        await import_coc34.commands.executeCommand(Commands.CHANGE_BASE_TYPE, item2);
      }
    });
    if (this.model.getDirection() != 2 /* both */ && this.model.getBaseItem().kind != import_coc34.SymbolKind.Enum) {
      actions.push({
        title: "Show Class Hierarchy",
        handler: async (item2) => {
          await import_coc34.commands.executeCommand(Commands.SHOW_CLASS_HIERARCHY);
        }
      });
    }
    if (this.model.getDirection() != 1 /* parents */) {
      actions.push({
        title: "Show Supertype Hierarchy",
        handler: async (item2) => {
          await import_coc34.commands.executeCommand(Commands.SHOW_SUPERTYPE_HIERARCHY);
        }
      });
    }
    if (this.model.getDirection() != 0 /* children */) {
      actions.push({
        title: "Show Subtype Hierarchy",
        handler: async (item2) => {
          await import_coc34.commands.executeCommand(Commands.SHOW_SUBTYPE_HIERARCHY);
        }
      });
    }
    return actions;
  }
  async getChildren(element) {
    if (!element) {
      return [this.model.getRootItem()];
    }
    if (this.model.getDirection() === 0 /* children */ || this.model.getDirection() === 2 /* both */) {
      if (!element.children) {
        if (_TypeHierarchyTreeDataProvider.isWhiteListType(element)) {
          return [_TypeHierarchyTreeDataProvider.getFakeItem(element)];
        }
        const resolvedItem = await resolveTypeHierarchy(this.client, element, this.model.getDirection(), this.token);
        if (!resolvedItem) {
          return void 0;
        }
        element.children = resolvedItem.children;
        if (element.children.length === 0) {
          this.emitter.fire(element);
        }
      }
      return element.children;
    } else if (this.model.getDirection() === 1 /* parents */) {
      if (!element.parents) {
        const resolvedItem = await resolveTypeHierarchy(this.client, element, this.model.getDirection(), this.token);
        if (!resolvedItem) {
          return void 0;
        }
        element.parents = resolvedItem.parents;
        if (element.parents.length === 0) {
          this.emitter.fire(element);
        }
      }
      return element.parents;
    }
    return void 0;
  }
  getIcon(kind) {
    let { labels } = this;
    let kindText = getSymbolKind2(kind);
    let defaultIcon = typeof labels["default"] === "string" ? labels["default"] : kindText[0].toLowerCase();
    let text = kindText == "Unknown" ? "" : labels[kindText[0].toLowerCase() + kindText.slice(1)];
    if (!text) text = defaultIcon;
    return {
      text,
      hlGroup: kindText == "Unknown" ? "CocSymbolDefault" : `CocSymbol${kindText}`
    };
  }
  static isWhiteListType(item) {
    if (item.name === "Object" && item.detail === "java.lang") {
      return true;
    }
    return false;
  }
  static getFakeItem(item) {
    let message;
    if (item.name === "Object" && item.detail === "java.lang") {
      message = "All classes are subtypes of java.lang.Object.";
    }
    return {
      name: message,
      kind: void 0,
      children: [],
      parents: [],
      detail: void 0,
      uri: void 0,
      range: void 0,
      selectionRange: void 0,
      data: void 0,
      deprecated: false,
      expand: false
    };
  }
};
_TypeHierarchyTreeDataProvider.themeIconIds = [
  "symbol-file",
  "symbol-module",
  "symbol-namespace",
  "symbol-package",
  "symbol-class",
  "symbol-method",
  "symbol-property",
  "symbol-field",
  "symbol-constructor",
  "symbol-enum",
  "symbol-interface",
  "symbol-function",
  "symbol-variable",
  "symbol-constant",
  "symbol-string",
  "symbol-number",
  "symbol-boolean",
  "symbol-array",
  "symbol-object",
  "symbol-key",
  "symbol-null",
  "symbol-enum-member",
  "symbol-struct",
  "symbol-event",
  "symbol-operator",
  "symbol-type-parameter"
];
var TypeHierarchyTreeDataProvider = _TypeHierarchyTreeDataProvider;

// src/typeHierarchy/typeHierarchyTree.ts
var TypeHierarchyTree = class {
  constructor() {
    this.initialized = false;
  }
  async initialize() {
    let winid;
    let splitCommand = import_coc35.workspace.getConfiguration("typeHierarchy", null).get("splitCommand", "botright 30vs");
    let nvim3 = import_coc35.workspace.nvim;
    import_coc35.commands.registerCommand(Commands.OPEN_TYPE_HIERARCHY_LOCATION, async (uri, position) => {
      if (winid) {
        let win = nvim3.createWindow(winid);
        let valid = await win.valid;
        if (valid) {
          await nvim3.call("win_gotoid", [winid]);
        }
        await import_coc35.workspace.jumpTo(uri, position, "edit");
      } else {
        await import_coc35.workspace.jumpTo(uri, position, "edit");
      }
    });
    this.api = {
      setInput: async (input) => {
        let id = await nvim3.eval('get(w:,"cocViewId",v:null)');
        if (!id) winid = await nvim3.call("win_getid", []);
        let symbol = await Promise.resolve(input.resolve());
        if (!symbol) return;
        let treeView = import_coc35.window.createTreeView("types", {
          treeDataProvider: symbol.provider,
          enableFilter: true
        });
        treeView.title = input.title;
        treeView.onDidChangeVisibility((e) => {
          if (!e.visible) {
            symbol.dispose();
            treeView.dispose();
          }
        });
        await treeView.show(splitCommand);
      }
    };
    this.client = await getActiveLanguageClient();
    this.initialized = true;
  }
  async setTypeHierarchy(location, direction) {
    if (!this.initialized) {
      await this.initialize();
    }
    if (!this.api) {
      return;
    }
    if (this.cancelTokenSource) {
      this.cancelTokenSource.cancel();
    }
    this.cancelTokenSource = new import_coc35.CancellationTokenSource();
    const textDocument = import_coc35.TextDocumentIdentifier.create(location.uri.toString());
    const position = import_coc35.Position.create(location.range.start.line, location.range.start.character);
    const params = {
      textDocument,
      position
    };
    let lspItem;
    try {
      lspItem = await import_coc35.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.OPEN_TYPE_HIERARCHY, JSON.stringify(params), JSON.stringify(direction), JSON.stringify(0), this.cancelTokenSource.token);
    } catch (e) {
      return;
    }
    if (!lspItem) {
      showNoLocationFound("No Type Hierarchy found");
      return;
    }
    const symbolKind = lspItem.kind;
    if (direction === 2 /* both */ && symbolKind === import_coc35.SymbolKind.Interface) {
      direction = 0 /* children */;
    }
    const item = toTypeHierarchyItem(this.client, lspItem, direction);
    const input = new TypeHierarchyTreeInput(location, direction, this.cancelTokenSource.token, item);
    item.expand = true;
    this.location = location;
    this.direction = direction;
    this.baseItem = item;
    this.api.setInput(input);
  }
  changeDirection(direction) {
    if (!this.api) {
      return;
    }
    if (this.cancelTokenSource) {
      this.cancelTokenSource.cancel();
    }
    this.cancelTokenSource = new import_coc35.CancellationTokenSource();
    this.baseItem.children = void 0;
    this.baseItem.parents = void 0;
    const input = new TypeHierarchyTreeInput(this.location, direction, this.cancelTokenSource.token, this.baseItem);
    this.direction = direction;
    this.api.setInput(input);
  }
  async changeBaseItem(item) {
    if (!this.api) {
      return;
    }
    if (this.cancelTokenSource) {
      this.cancelTokenSource.cancel();
    }
    this.cancelTokenSource = new import_coc35.CancellationTokenSource();
    item.parents = void 0;
    item.children = void 0;
    const location = import_coc35.Location.create(item.uri, item.selectionRange);
    const newLocation = await this.isValidRequestPosition(import_coc35.Uri.parse(location.uri), location.range.start) ? location : this.location;
    const input = new TypeHierarchyTreeInput(newLocation, this.direction, this.cancelTokenSource.token, item);
    this.location = newLocation;
    this.baseItem = item;
    item.expand = true;
    this.api.setInput(input);
  }
  async isValidRequestPosition(uri, position) {
    const doc = await import_coc35.workspace.openTextDocument(uri);
    let range = doc.getWordRangeAtPosition(position);
    if (!range) {
      range = doc.getWordRangeAtPosition(position, ".*$<>{}?[]()");
    }
    return Boolean(range);
  }
};
var typeHierarchyTree = new TypeHierarchyTree();

// src/standardLanguageClient.ts
var extensionName = "Language Support for Java";
var GRADLE_CHECKSUM = "gradle/checksum/prompt";
var GET_JDK = "Get the Java Development Kit";
var USE_JAVA = "Use Java ";
var AS_GRADLE_JVM = " as Gradle JVM";
var UPGRADE_GRADLE = "Upgrade Gradle to ";
var GRADLE_IMPORT_JVM = "java.import.gradle.java.home";
var JAVA_SELECTOR = [
  { scheme: "file", language: "java", pattern: "**/*.java" },
  { scheme: "jdt", language: "java", pattern: "**/*.class" },
  { scheme: "untitled", language: "java", pattern: "**/*.java" }
];
var StandardLanguageClient = class {
  constructor() {
    this.status = "Uninitialized" /* uninitialized */;
  }
  async initialize(context, requirements, clientOptions, workspacePath, jdtEventEmitter2) {
    if (this.status !== "Uninitialized" /* uninitialized */) {
      return;
    }
    const hasImported = await fse9.pathExists(path16.join(workspacePath, ".metadata", ".plugins"));
    if (import_coc36.workspace.getConfiguration().get("java.showBuildStatusOnStart.enabled") === "terminal") {
      import_coc36.commands.executeCommand(Commands.SHOW_SERVER_TASK_STATUS);
    }
    context.subscriptions.push(import_coc36.commands.registerCommand(Commands.RUNTIME_VALIDATION_OPEN, () => {
    }));
    serverStatus.initialize();
    serverStatus.onServerStatusChanged((status2) => {
      if (status2 === "Busy" /* busy */) {
        serverStatusBarProvider.setBusy();
      } else if (status2 === "Error" /* error */) {
        serverStatusBarProvider.setError();
      } else if (status2 === "Warning" /* warning */) {
        serverStatusBarProvider.setWarning();
      } else {
        serverStatusBarProvider.setReady();
      }
    });
    let serverOptions;
    const port = process.env["SERVER_PORT"];
    if (!port) {
      const lsPort = process.env["JDTLS_CLIENT_PORT"];
      if (!lsPort) {
        serverOptions = prepareExecutable(requirements, workspacePath, getJavaConfig(requirements.java_home), context, false);
      } else {
        serverOptions = () => {
          const socket = net2.connect(lsPort);
          const result = {
            writer: socket,
            reader: socket
          };
          return Promise.resolve(result);
        };
      }
    } else {
      serverOptions = awaitServerConnection.bind(null, port);
    }
    this.languageClient = new import_coc36.LanguageClient("java", extensionName, serverOptions, clientOptions);
    import_coc36.services.registerLanguageClient(this.languageClient);
    this.languageClient.onReady().then(() => {
      activationProgressNotification.showProgress();
      this.languageClient.onNotification(StatusNotification.type, (report) => {
        switch (report.type) {
          case "ServiceReady":
            apiManager.updateServerMode("Standard" /* standard */);
            apiManager.fireDidServerModeChange("Standard" /* standard */);
            apiManager.resolveServerReadyPromise();
            if (import_coc36.extensions.onDidActiveExtension) {
              import_coc36.extensions.onDidActiveExtension(async () => {
                await onExtensionChange(import_coc36.extensions.all);
              });
            }
            activationProgressNotification.hide();
            if (!hasImported) {
              showImportFinishNotification(context);
            }
            checkLombokDependency(context);
            apiManager.getApiInstance().onDidClasspathUpdate((uri) => {
              checkLombokDependency(context, uri);
            });
            break;
          case "Started":
            this.status = "Started" /* started */;
            serverStatus.updateServerStatus("Ready" /* ready */);
            apiManager.updateStatus("Started" /* started */);
            break;
          case "Error":
            this.status = "Error" /* error */;
            serverStatus.updateServerStatus("Error" /* error */);
            apiManager.updateStatus("Error" /* error */);
            break;
          case "ProjectStatus":
            if (report.message === "WARNING") {
              serverStatus.updateServerStatus("Warning" /* warning */);
            } else if (report.message === "OK") {
              this.status = "Started" /* started */;
              serverStatus.errorResolved();
              serverStatus.updateServerStatus("Ready" /* ready */);
            }
            return;
          case "Starting":
          case "Message":
            break;
        }
        if (!serverStatus.hasErrors()) {
          serverStatusBarProvider.updateTooltip(report.message);
        }
      });
      this.languageClient.onNotification(ProgressReportNotification.type, (progress) => {
        serverTasks.updateServerTask(progress);
      });
      this.languageClient.onNotification(EventNotification.type, async (notification) => {
        var _a;
        switch (notification.eventType) {
          case 100 /* classpathUpdated */:
            apiManager.fireDidClasspathUpdate(import_coc36.Uri.parse(notification.data));
            break;
          case 200 /* projectsImported */: {
            const projectUris = [];
            if (notification.data) {
              for (const uriString of notification.data) {
                projectUris.push(import_coc36.Uri.parse(uriString));
              }
            }
            if (projectUris.length > 0) {
              apiManager.fireDidProjectsImport(projectUris);
            }
            break;
          }
          case 210 /* projectsDeleted */: {
            const projectUris = [];
            if (notification.data) {
              for (const uriString of notification.data) {
                projectUris.push(import_coc36.Uri.parse(uriString));
              }
            }
            if (projectUris.length > 0) {
              apiManager.fireDidProjectsDelete(projectUris);
            }
            break;
          }
          case 300 /* incompatibleGradleJdkIssue */:
            const options2 = [];
            const info = notification.data;
            const highestJavaVersion = Number(info.highestJavaVersion);
            let runtimes = await (0, import_jdk_utils3.findRuntimes)({ checkJavac: true, withVersion: true, withTags: true });
            runtimes = runtimes.filter((runtime) => {
              return runtime.version.major <= highestJavaVersion;
            });
            sortJdksByVersion(runtimes);
            sortJdksBySource(runtimes);
            options2.push(UPGRADE_GRADLE + info.recommendedGradleVersion);
            if (!runtimes.length) {
              options2.push(GET_JDK);
            } else {
              options2.push(USE_JAVA + runtimes[0].version.major + AS_GRADLE_JVM);
            }
            this.showGradleCompatibilityIssueNotification(info.message, options2, info.projectUri, info.recommendedGradleVersion, (_a = runtimes[0]) == null ? void 0 : _a.homedir);
            break;
          case 400 /* upgradeGradleWrapper */:
            const neverShow = context.globalState.get("java.neverShowUpgradeWrapperNotification");
            if (!neverShow) {
              const upgradeInfo = notification.data;
              const option = `Upgrade to ${upgradeInfo.recommendedGradleVersion}`;
              import_coc36.window.showWarningMessage(upgradeInfo.message, option, "Don't show again").then(async (choice) => {
                if (choice === option) {
                  await upgradeGradle(upgradeInfo.projectUri, upgradeInfo.recommendedGradleVersion);
                } else if (choice === "Don't show again") {
                  context.globalState.update("java.neverShowUpgradeWrapperNotification", true);
                }
              });
            }
            break;
          default:
            break;
        }
      });
      this.languageClient.onNotification(ActionableNotification.type, (notification) => {
        let show = null;
        switch (notification.severity) {
          case import_vscode_languageserver_protocol6.MessageType.Log:
            show = logNotification;
            break;
          case import_vscode_languageserver_protocol6.MessageType.Info:
            show = import_coc36.window.showInformationMessage.bind(import_coc36.window);
            break;
          case import_vscode_languageserver_protocol6.MessageType.Warning:
            show = import_coc36.window.showWarningMessage.bind(import_coc36.window);
            break;
          case import_vscode_languageserver_protocol6.MessageType.Error:
            show = import_coc36.window.showErrorMessage.bind(import_coc36.window);
            break;
        }
        if (!show) {
          return;
        }
        const titles = notification.commands.map((a) => a.title);
        show(notification.message, ...titles).then((selection) => {
          for (const action of notification.commands) {
            if (action.title === selection) {
              const args = action.arguments ? action.arguments : [];
              import_coc36.commands.executeCommand(action.command, ...args);
              break;
            }
          }
        });
      });
      this.languageClient.onRequest(ExecuteClientCommandRequest.type, (params) => {
        return import_coc36.commands.executeCommand(params.command, ...params.arguments);
      });
      this.languageClient.onNotification(ServerNotification.type, (params) => {
        import_coc36.commands.executeCommand(params.command, ...params.arguments);
      });
      this.languageClient.onRequest(import_vscode_languageserver_protocol6.ConfigurationRequest.type, (params) => {
        const result = [];
        const activeEditor = import_coc36.window.activeTextEditor;
        const currUri = activeEditor == null ? void 0 : activeEditor.document.uri;
        for (const item of params.items) {
          const scopeUri = item.scopeUri && import_coc36.Uri.parse(item.scopeUri);
          if (scopeUri && scopeUri.toString() === currUri) {
            if (item.section === "java.format.insertSpaces") {
              result.push(activeEditor.options.insertSpaces);
            } else if (item.section === "java.format.tabSize") {
              result.push(activeEditor.options.tabSize);
            } else {
              result.push(null);
            }
          } else {
            result.push(import_coc36.workspace.getConfiguration(null, scopeUri).get(
              item.section,
              null
              /* defaultValue */
            ));
          }
        }
        return result;
      });
    });
    this.registerCommandsForStandardServer(context, jdtEventEmitter2);
    registerFileEventHandlers(this.languageClient, context);
    collectBuildFilePattern(import_coc36.extensions.all);
    this.status = "Initialized" /* initialized */;
  }
  showGradleCompatibilityIssueNotification(message, options2, projectUri, gradleVersion, newJavaHome) {
    import_coc36.window.showErrorMessage(`${message} [Learn More](https://docs.gradle.org/current/userguide/compatibility.html)`, ...options2).then(async (choice) => {
      if (choice === GET_JDK) {
        import_coc36.commands.executeCommand(Commands.OPEN_BROWSER, import_coc36.Uri.parse(getJdkUrl()));
      } else if (choice.startsWith(USE_JAVA)) {
        await import_coc36.workspace.getConfiguration().update(GRADLE_IMPORT_JVM, newJavaHome, import_coc36.ConfigurationTarget.Global);
        import_coc36.commands.executeCommand("workbench.action.openSettings", GRADLE_IMPORT_JVM);
        import_coc36.commands.executeCommand(Commands.IMPORT_PROJECTS_CMD);
      } else if (choice.startsWith(UPGRADE_GRADLE)) {
        await upgradeGradle(projectUri, gradleVersion);
      }
    });
  }
  registerCommandsForStandardServer(context, jdtEventEmitter2) {
    context.subscriptions.push(import_coc36.commands.registerCommand(Commands.IMPORT_PROJECTS_CMD, async () => {
      return await import_coc36.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.IMPORT_PROJECTS);
    }));
    context.subscriptions.push(import_coc36.commands.registerCommand(Commands.OPEN_OUTPUT, () => this.languageClient.outputChannel.show()));
    context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_SERVER_TASK_STATUS, () => serverTaskPresenter.presentServerTaskView()));
    this.languageClient.onReady().then(() => {
      context.subscriptions.push(import_coc36.commands.registerCommand(GRADLE_CHECKSUM, (wrapper, sha256) => {
        setGradleWrapperChecksum(wrapper, sha256);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_JAVA_REFERENCES, (uri, position, locations) => {
        import_coc36.commands.executeCommand(Commands.SHOW_REFERENCES, uri, position, locations);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_JAVA_IMPLEMENTATIONS, (uri, position, locations) => {
        import_coc36.commands.executeCommand(Commands.SHOW_REFERENCES, import_coc36.Uri.parse(uri), position, locations);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.CONFIGURATION_UPDATE, (uri) => projectConfigurationUpdate(this.languageClient, uri)));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.IGNORE_INCOMPLETE_CLASSPATH, () => setIncompleteClasspathSeverity("ignore"), null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.IGNORE_INCOMPLETE_CLASSPATH_HELP, () => {
        import_coc36.commands.executeCommand(Commands.OPEN_BROWSER, "https://github.com/redhat-developer/vscode-java/wiki/%22Classpath-is-incomplete%22-warning");
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.PROJECT_CONFIGURATION_STATUS, (uri, status2) => setProjectConfigurationUpdate(this.languageClient, uri, status2), null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.NULL_ANALYSIS_SET_MODE, (status2) => setNullAnalysisStatus(status2), null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.APPLY_WORKSPACE_EDIT, (obj) => {
        return import_coc36.workspace.applyEdit(obj);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.NAVIGATE_TO_SUPER_IMPLEMENTATION_COMMAND, async (location) => {
        var _a;
        let superImplLocation;
        if (!location) {
          if (!import_coc36.window.activeTextEditor) return;
          if (((_a = import_coc36.window.activeTextEditor) == null ? void 0 : _a.document.languageId) !== "java") return;
          location = import_coc36.Uri.parse(import_coc36.window.activeTextEditor.document.uri);
        }
        let position = await import_coc36.window.getCursorPosition();
        if (location instanceof import_coc36.Uri) {
          const params = {
            textDocument: {
              uri: location.toString()
            },
            position
          };
          const response = await this.languageClient.sendRequest(FindLinks.type, {
            type: "superImplementation",
            position: params
          });
          if (response && response.length > 0) {
            const superImpl = response[0];
            superImplLocation = import_coc36.Location.create(
              superImpl.uri,
              superImpl.range
            );
          }
        } else {
          superImplLocation = import_coc36.Location.create(
            import_coc36.Uri.parse(decodeBase64(location.uri)).toString(),
            location.range
          );
        }
        if (superImplLocation) {
          await import_coc36.workspace.jumpTo(superImplLocation.uri, superImplLocation.range.start);
          return import_coc36.window.selectRange(superImplLocation.range);
        } else {
          return showNoLocationFound("No super implementation found");
        }
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_TYPE_HIERARCHY, async (location) => {
        var _a;
        let position = await import_coc36.window.getCursorPosition();
        if (location instanceof import_coc36.Uri) {
          typeHierarchyTree.setTypeHierarchy(import_coc36.Location.create(location.toString(), import_coc36.Range.create(position, position)), 2 /* both */);
        } else {
          if (((_a = import_coc36.window.activeTextEditor) == null ? void 0 : _a.document.languageId) !== "java") return;
          typeHierarchyTree.setTypeHierarchy(import_coc36.Location.create(import_coc36.window.activeTextEditor.document.uri, import_coc36.Range.create(position, position)), 2 /* both */);
        }
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_CLASS_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(2 /* both */);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_SUPERTYPE_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(1 /* parents */);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.SHOW_SUBTYPE_HIERARCHY, () => {
        typeHierarchyTree.changeDirection(0 /* children */);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.CHANGE_BASE_TYPE, async (item) => {
        typeHierarchyTree.changeBaseItem(item);
      }, null, true));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.BUILD_PROJECT, async (uris, isFullBuild, token) => {
        var _a;
        let resources = [];
        if (uris instanceof import_coc36.Uri) {
          resources.push(uris);
        } else if (Array.isArray(uris)) {
          for (const uri of uris) {
            if (uri instanceof import_coc36.Uri) {
              resources.push(uri);
            }
          }
        }
        if (!resources.length) {
          let doc = (_a = import_coc36.window.activeTextEditor) == null ? void 0 : _a.document;
          resources = await askForProjects(
            doc ? import_coc36.Uri.parse(doc.uri) : void 0,
            "Please select the project(s) to rebuild."
          );
          if (!(resources == null ? void 0 : resources.length)) {
            return;
          }
        }
        const params = {
          identifiers: resources.map(((u) => {
            return { uri: u.toString() };
          })),
          // we can consider expose 'isFullBuild' according to users' feedback,
          // currently set it to true by default.
          isFullBuild: isFullBuild === void 0 ? true : isFullBuild
        };
        return import_coc36.window.withProgress({ title: "Rebuild" }, async (p) => {
          p.report({ message: "Rebuilding projects..." });
          return new Promise(async (resolve9, reject) => {
            const start = (/* @__PURE__ */ new Date()).getTime();
            let res;
            try {
              res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) : await this.languageClient.sendRequest(BuildProjectRequest.type, params);
            } catch (error) {
              if (error && error.code === -32800) {
                res = 3 /* cancelled */;
              }
              reject(error);
            }
            const elapsed = (/* @__PURE__ */ new Date()).getTime() - start;
            const humanVisibleDelay = elapsed < 1e3 ? 1e3 : 0;
            if (res == 2 /* withError */) {
              showCompileBuildDiagnostics();
              import_coc36.window.showWarningMessage("Build finished with errors");
            } else if (res == 1 /* succeed */) {
              import_coc36.window.showInformationMessage("Build finished successfully");
            } else if (res == 3 /* cancelled */) {
              import_coc36.window.showWarningMessage("Build process was canceled");
            } else {
              import_coc36.window.showErrorMessage("Build process failed");
            }
            setTimeout(() => {
              resolve9();
            }, humanVisibleDelay);
          });
        });
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.COMPILE_WORKSPACE, (isFullCompile, token) => {
        return import_coc36.window.withProgress({ title: "Compiling" }, async (p) => {
          if (typeof isFullCompile !== "boolean") {
            const selection = await import_coc36.window.showQuickPick(["Incremental", "Full"], { placeholder: "please choose compile type:" });
            isFullCompile = selection !== "Incremental";
          }
          p.report({ message: "Compiling workspace..." });
          return new Promise(async (resolve9, reject) => {
            const start = (/* @__PURE__ */ new Date()).getTime();
            let res;
            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) {
                res = 3 /* cancelled */;
              } else {
                reject(error);
              }
            }
            const elapsed = (/* @__PURE__ */ new Date()).getTime() - start;
            const humanVisibleDelay = elapsed < 1e3 ? 1e3 : 0;
            if (res == 2 /* withError */) {
              showCompileBuildDiagnostics();
              import_coc36.window.showWarningMessage("Compilation for workspace finished with errors");
            } else if (res == 1 /* succeed */) {
              import_coc36.window.showInformationMessage("Compilation for workspace finished successfully");
            } else if (res == 3 /* cancelled */) {
              import_coc36.window.showWarningMessage("Compilation process was canceled");
            } else {
              import_coc36.window.showErrorMessage("Compilation process failed");
            }
            setTimeout(() => {
              resolve9(res);
            }, humanVisibleDelay);
          });
        });
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.UPDATE_SOURCE_ATTACHMENT_CMD, async (classFileUri) => {
        if (!classFileUri) {
          classFileUri = import_coc36.window.activeTextEditor ? import_coc36.Uri.parse(import_coc36.window.activeTextEditor.document.uri) : void 0;
          if (!classFileUri || classFileUri.scheme !== "file") return;
        }
        const resolveRequest = {
          classFileUri: classFileUri.toString()
        };
        const resolveResult = await import_coc36.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.RESOLVE_SOURCE_ATTACHMENT, JSON.stringify(resolveRequest));
        if (resolveResult.errorMessage) {
          import_coc36.window.showErrorMessage(resolveResult.errorMessage);
          return false;
        }
        const attributes = resolveResult.attributes || {};
        const defaultPath = attributes.sourceAttachmentPath || attributes.jarPath;
        const sourcePath = await import_coc36.workspace.nvim.callAsync("coc#util#with_callback", ["input", ["Source File: ", defaultPath ?? "", "file"]]);
        if (!sourcePath) return;
        if (!sourcePath.endsWith(".jar") && !sourcePath.endsWith(".zip")) {
          import_coc36.window.showWarningMessage(`Source file must be a jar or zip file.`);
          return;
        }
        const updateRequest = {
          classFileUri: classFileUri.toString(),
          attributes: {
            ...attributes,
            sourceAttachmentPath: sourcePath
          }
        };
        const updateResult = await import_coc36.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.UPDATE_SOURCE_ATTACHMENT, JSON.stringify(updateRequest));
        if (updateResult.errorMessage) {
          import_coc36.window.showErrorMessage(updateResult.errorMessage);
          return false;
        }
        jdtEventEmitter2.fire(classFileUri);
        return true;
      }));
      registerCommands(context);
      registerCommands3(this.languageClient, context);
      registerCommands2(this.languageClient, context);
      excludeProjectSettingsFiles();
      context.subscriptions.push(import_coc36.languages.registerCodeActionProvider([{ scheme: "file", language: "java" }], new RefactorDocumentProvider(), "java", RefactorDocumentProvider.metadata.providedCodeActionKinds.slice()));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.LEARN_MORE_ABOUT_REFACTORING, async (kind) => {
        const sectionId = javaRefactorKinds.get(kind) || "";
        markdownPreviewProvider.show(context.asAbsolutePath(path16.join("document", `${Commands.LEARN_MORE_ABOUT_REFACTORING}.md`)), "Java Refactoring", sectionId, context);
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.CREATE_MODULE_INFO_COMMAND, async () => {
        var _a;
        let doc = (_a = import_coc36.window.activeTextEditor) == null ? void 0 : _a.document;
        const uri = await askForProjects(
          doc ? import_coc36.Uri.parse(doc.uri) : void 0,
          "Please select the project to create module-info.java",
          false
        );
        if (!(uri == null ? void 0 : uri.length)) {
          return;
        }
        const moduleInfoUri = await import_coc36.commands.executeCommand(
          Commands.EXECUTE_WORKSPACE_COMMAND,
          Commands.CREATE_MODULE_INFO,
          uri[0].toString()
        );
        if (moduleInfoUri) {
          await import_coc36.workspace.jumpTo(moduleInfoUri);
        }
      }));
      context.subscriptions.push(import_coc36.commands.registerCommand(Commands.UPGRADE_GRADLE_WRAPPER, (projectUri, version) => {
        upgradeGradle(projectUri, version);
      }));
      import_coc36.languages.registerCodeActionProvider([{
        language: "xml",
        scheme: "file",
        pattern: "**/pom.xml"
      }], new PomCodeActionProvider(context), "java", pomCodeActionMetadata.providedCodeActionKinds.slice());
      import_coc36.languages.registerCodeActionProvider([{
        scheme: "file",
        pattern: "**/{gradle/wrapper/gradle-wrapper.properties,build.gradle,build.gradle.kts,settings.gradle,settings.gradle.kts}"
      }], new GradleCodeActionProvider(), "java", gradleCodeActionMetadata.providedCodeActionKinds.slice());
      if (import_coc36.languages.registerInlayHintsProvider) {
        context.subscriptions.push(import_coc36.languages.registerInlayHintsProvider(JAVA_SELECTOR, new JavaInlayHintsProvider(this.languageClient)));
      }
    });
  }
  start() {
    if (this.languageClient && this.status === "Initialized" /* initialized */) {
      this.languageClient.start();
      this.status = "Starting" /* starting */;
    }
  }
  stop() {
    this.status = "Stopping" /* stopping */;
    if (this.languageClient) {
      try {
        return this.languageClient.stop();
      } finally {
        this.languageClient = null;
      }
    }
    return Promise.resolve();
  }
  getClient() {
    return this.languageClient;
  }
  getClientStatus() {
    return this.status;
  }
};
async function showImportFinishNotification(context) {
  const neverShow = context.globalState.get("java.neverShowImportFinishNotification");
  if (!neverShow) {
    let choice;
    const options2 = ["Don't show again"];
    if (serverStatus.hasErrors()) {
      options2.unshift("Show errors");
      choice = await import_coc36.window.showWarningMessage("Errors occurred during import of Java projects.", ...options2);
    } else {
      const projectUris = await getAllJavaProjects();
      if (projectUris.length === 0) {
        return;
      }
      if (import_coc36.extensions.getExtensionById("vscjava.vscode-java-dependency")) {
        options2.unshift("View projects");
      }
      choice = await import_coc36.window.showInformationMessage("Projects are imported into workspace.", ...options2);
    }
    if (choice === "Don't show again") {
      context.globalState.update("java.neverShowImportFinishNotification", true);
    } else if (choice === "View projects") {
      import_coc36.commands.executeCommand("javaProjectExplorer.focus");
    } else if (choice === "Show errors") {
      import_coc36.workspace.nvim.command("CocList diagnostics", true);
    }
  }
}
async function showCompileBuildDiagnostics() {
  const diagnostics = await import_coc36.diagnosticManager.getDiagnosticList();
  const normalized = import_coc36.Uri.parse(import_coc36.workspace.getWorkspaceFolder(import_coc36.workspace.cwd).uri);
  const workingDirectoryList = diagnostics.filter((item) => isParentFolder(normalized.fsPath, item.file));
  const errorDiagnostics = workingDirectoryList.filter((item) => isErrorDiagnostic(item.level));
  const filesDiagnostics = errorDiagnostics.filter((item) => isFileDiagnostic(item));
  const quickFixList = await import_coc36.workspace.getQuickfixList(filesDiagnostics.map((item) => item.location));
  const quickListConfig = { title: `[JDTLS] Compile & Build project [${formatDate(/* @__PURE__ */ new Date())}]`, items: quickFixList };
  await import_coc36.nvim.call("setqflist", [[], " ", quickListConfig]);
  let openCommand = await import_coc36.nvim.getVar("coc_quickfix_open_command");
  import_coc36.nvim.command(typeof openCommand === "string" ? openCommand : "copen", true);
}
function logNotification(message) {
  return new Promise(() => {
    createLogger().trace(message);
  });
}
function setIncompleteClasspathSeverity(severity) {
  const config = getJavaConfiguration();
  const section = "errors.incompleteClasspath.severity";
  config.update(section, severity, true).then(
    () => createLogger().info(`${section} globally set to ${severity}`),
    (error) => createLogger().error(error)
  );
}
function setProjectConfigurationUpdate(languageClient, uri, status2) {
  const config = getJavaConfiguration();
  const section = "configuration.updateBuildConfiguration";
  const st = FeatureStatus[status2];
  config.update(section, st).then(
    () => createLogger().info(`${section} set to ${st}`),
    (error) => createLogger().error(error)
  );
  if (status2 !== 0 /* disabled */) {
    projectConfigurationUpdate(languageClient, uri);
  }
}
function setNullAnalysisStatus(status2) {
  const config = getJavaConfiguration();
  const section = "compile.nullAnalysis.mode";
  const st = FeatureStatus[status2];
  config.update(section, st).then(
    () => createLogger().info(`${section} set to ${st}`),
    (error) => createLogger().error(error)
  );
}
function decodeBase64(text) {
  return Buffer.from(text, "base64").toString("ascii");
}
function fileStartsWith(dir, pdir) {
  return dir.toLowerCase().startsWith(pdir.toLowerCase());
}
function normalizeFilePath(filepath) {
  return import_coc36.Uri.file(path16.resolve(path16.normalize(filepath))).fsPath;
}
function isErrorDiagnostic(level) {
  return level == import_coc36.DiagnosticSeverity.Error;
}
function isFileDiagnostic(item) {
  const basename8 = path16.basename(item.file);
  const extension = path16.extname(item.file);
  return basename8 == "pom.xml" || basename8 === "build.gradle" || extension === ".java";
}
function isParentFolder(folder, filepath) {
  let pdir = normalizeFilePath(folder);
  let dir = normalizeFilePath(filepath);
  return fileStartsWith(dir, pdir) && dir[pdir.length] == path16.sep;
}
function formatDate(date) {
  const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
  const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  const dayOfWeek = weekdays[date.getDay()];
  const month = months[date.getMonth()];
  const dayOfMonth = date.getDate();
  const hours = date.getHours().toString().padStart(2, "0");
  const minutes = date.getMinutes().toString().padStart(2, "0");
  const seconds = date.getSeconds().toString().padStart(2, "0");
  const year = date.getFullYear();
  return `${dayOfWeek} ${month} ${dayOfMonth} ${hours}:${minutes}:${seconds} ${year}`;
}
function showNoLocationFound(message) {
  import_coc36.window.showWarningMessage(message);
}

// src/syntaxLanguageClient.ts
var import_coc37 = require("coc.nvim");
var net3 = __toESM(require("net"));
var import_vscode_languageserver_protocol7 = __toESM(require_main3());
var extensionName2 = "Language Support for Java (Syntax Server)";
var SyntaxLanguageClient = class {
  constructor() {
    this.status = "Uninitialized" /* uninitialized */;
  }
  initialize(requirements, clientOptions, serverOptions) {
    const newClientOptions = Object.assign({}, clientOptions, {
      middleware: {
        workspace: {
          didChangeConfiguration: () => {
            this.languageClient.sendNotification(import_vscode_languageserver_protocol7.DidChangeConfigurationNotification.type, {
              settings: {
                java: getJavaConfig(requirements.java_home)
              }
            });
          }
        }
      },
      errorHandler: new ClientErrorHandler(extensionName2),
      initializationFailedHandler: (error) => {
        createLogger().error(`Failed to initialize ${extensionName2} due to ${error && error.toString()}`);
        return true;
      },
      outputChannel: new OutputInfoCollector("java-syntax"),
      outputChannelName: "java-syntax"
    });
    const lsPort = process.env["SYNTAXLS_CLIENT_PORT"];
    if (!serverOptions && lsPort) {
      serverOptions = () => {
        const socket = net3.connect(lsPort);
        const result = {
          writer: socket,
          reader: socket
        };
        return Promise.resolve(result);
      };
    }
    if (serverOptions) {
      this.languageClient = new import_coc37.LanguageClient("java", extensionName2, serverOptions, newClientOptions);
      this.languageClient.onReady().then(() => {
        this.languageClient.onNotification(StatusNotification.type, (report) => {
          switch (report.type) {
            case "Started":
              this.status = "Started" /* started */;
              apiManager.updateStatus("Started" /* started */);
              break;
            case "Error":
              this.status = "Error" /* error */;
              apiManager.updateStatus("Error" /* error */);
              break;
            default:
              break;
          }
          if (apiManager.getApiInstance().serverMode === "LightWeight" /* lightWeight */) {
            apiManager.fireDidServerModeChange("LightWeight" /* lightWeight */);
          }
        });
      });
    }
    this.status = "Initialized" /* initialized */;
  }
  start() {
    if (this.languageClient) {
      this.languageClient.start();
      this.status = "Starting" /* starting */;
    }
  }
  stop() {
    this.status = "Stopping" /* stopping */;
    if (this.languageClient) {
      try {
        return this.languageClient.stop();
      } finally {
        this.languageClient = null;
      }
    }
    return Promise.resolve();
  }
  isAlive() {
    return !!this.languageClient && this.status !== "Stopping" /* stopping */;
  }
  getClient() {
    return this.languageClient;
  }
};

// src/extension.ts
var glob3 = require_glob();
var syntaxClient = new SyntaxLanguageClient();
var standardClient = new StandardLanguageClient();
var jdtEventEmitter = new import_coc38.Emitter();
var extensionName3 = "Language Support for Java";
var storagePath;
var clientLogFile;
async function showOOMMessage() {
  const CONFIGURE = "Increase Memory ..";
  const result = await import_coc38.window.showErrorMessage(
    "The Java Language Server encountered an OutOfMemory error. Some language features may not work due to limited memory. ",
    CONFIGURE
  );
  if (result === CONFIGURE) {
    let jvmArgs = getJavaConfiguration().get("jdt.ls.vmargs");
    const results = MAX_HEAP_SIZE_EXTRACTOR.exec(jvmArgs);
    if (results && results[0]) {
      const maxMemArg = results[0];
      const maxMemValue = Number(results[1]);
      const newMaxMemArg = maxMemArg.replace(maxMemValue.toString(), (maxMemValue * 2).toString());
      jvmArgs = jvmArgs.replace(maxMemArg, newMaxMemArg);
      await import_coc38.workspace.getConfiguration().update("java.jdt.ls.vmargs", jvmArgs, import_coc38.ConfigurationTarget.Workspace);
    }
  }
}
var HEAP_DUMP_FOLDER_EXTRACTOR = new RegExp(`${HEAP_DUMP_LOCATION}(?:'([^']+)'|"([^"]+)"|([^\\s]+))`);
var MAX_HEAP_SIZE_EXTRACTOR = new RegExp(`-Xmx([0-9]+)[kKmMgG]`);
function getHeapDumpFolderFromSettings() {
  const jvmArgs = getJavaConfiguration().get("jdt.ls.vmargs");
  const results = HEAP_DUMP_FOLDER_EXTRACTOR.exec(jvmArgs);
  if (!results || !results[0]) {
    return void 0;
  }
  return results[1] || results[2] || results[3];
}
async function activate(context) {
  let enabled = getJavaConfiguration().get("enabled", true);
  if (!enabled) return void 0;
  context.subscriptions.push(markdownPreviewProvider);
  context.subscriptions.push(import_coc38.commands.registerCommand(Commands.TEMPLATE_VARIABLES, async () => {
    markdownPreviewProvider.show(context.asAbsolutePath(path17.join("document", `${Commands.TEMPLATE_VARIABLES}.md`)), "Predefined Variables", "", context);
  }, null, true));
  context.subscriptions.push(import_coc38.commands.registerCommand(Commands.NOT_COVERED_EXECUTION, async () => {
    markdownPreviewProvider.show(context.asAbsolutePath(path17.join("document", `_java.notCoveredExecution.md`)), "Not Covered Maven Plugin Execution", "", context);
  }));
  storagePath = context.storagePath;
  if (!storagePath) {
    storagePath = getTempWorkspace();
  }
  context.subscriptions.push(import_coc38.commands.registerCommand(Commands.MEATDATA_FILES_GENERATION, async () => {
    markdownPreviewProvider.show(context.asAbsolutePath(path17.join("document", `_java.metadataFilesGeneration.md`)), "Metadata Files Generation", "", context);
  }, null, true));
  context.subscriptions.push(import_coc38.commands.registerCommand(Commands.LEARN_MORE_ABOUT_CLEAN_UPS, async () => {
    markdownPreviewProvider.show(context.asAbsolutePath(path17.join("document", `${Commands.LEARN_MORE_ABOUT_CLEAN_UPS}.md`)), "Java Clean Ups", "java-clean-ups", context);
  }));
  clientLogFile = path17.join(storagePath, "client.log");
  initializeLogFile(clientLogFile);
  enableJavadocSymbols();
  initialize2(context);
  registerOutOfMemoryDetection(storagePath);
  cleanJavaWorkspaceStorage();
  serverStatusBarProvider.initialize(context);
  if (process.platform === "darwin" && process.arch === "x64") {
    try {
      if (semver2.lt(os4.release(), "20.0.0")) {
        removeEquinoxFragmentOnDarwinX64(context);
      }
    } catch (error) {
    }
  }
  return resolveRequirements(context).catch((error) => {
    import_coc38.window.showErrorMessage(error.message, error.label).then((selection) => {
      if (error.label && error.label === selection && error.command) {
        import_coc38.commands.executeCommand(error.command, error.commandParam);
      }
    });
    throw error;
  }).then(async (requirements) => {
    const triggerFiles = await getTriggerFiles();
    return new Promise(async (resolve9) => {
      const id = (0, import_crypto2.createHash)("md5").update(import_coc38.workspace.root).digest("hex");
      const workspacePath = path17.resolve(`${storagePath}/jdt_ws_${id}`);
      const syntaxServerWorkspacePath = path17.resolve(`${storagePath}/ss_ws`);
      let serverMode = getJavaServerMode();
      const isWorkspaceTrusted = import_coc38.workspace.isTrusted;
      if (isWorkspaceTrusted !== void 0 && !isWorkspaceTrusted) {
        serverMode = "LightWeight" /* lightWeight */;
      }
      const isDebugModeByClientPort = !!process.env["SYNTAXLS_CLIENT_PORT"] || !!process.env["JDTLS_CLIENT_PORT"];
      const requireSyntaxServer = serverMode !== "Standard" /* standard */ && (!isDebugModeByClientPort || !!process.env["SYNTAXLS_CLIENT_PORT"]);
      let requireStandardServer = serverMode !== "LightWeight" /* lightWeight */ && (!isDebugModeByClientPort || !!process.env["JDTLS_CLIENT_PORT"]);
      const clientOptions = {
        // Register the server for java
        documentSelector: [
          { scheme: "file", language: "java" },
          { scheme: "jdt", language: "java" },
          { scheme: "untitled", language: "java" }
        ],
        synchronize: {
          configurationSection: ["java"]
        },
        initializationOptions: {
          bundles: collectJavaExtensions(import_coc38.extensions.all),
          workspaceFolders: import_coc38.workspace.workspaceFolders ? import_coc38.workspace.workspaceFolders.map((f) => f.uri.toString()) : null,
          settings: {
            java: getJavaConfig(requirements.java_home)
          },
          extendedClientCapabilities: {
            progressReportProvider: getJavaConfiguration().get("progressReports.enabled"),
            classFileContentsSupport: true,
            overrideMethodsPromptSupport: true,
            hashCodeEqualsPromptSupport: true,
            advancedOrganizeImportsSupport: true,
            generateToStringPromptSupport: true,
            advancedGenerateAccessorsSupport: true,
            generateConstructorsPromptSupport: true,
            generateDelegateMethodsPromptSupport: true,
            advancedExtractRefactoringSupport: true,
            inferSelectionSupport: ["extractMethod", "extractVariable", "extractField"],
            moveRefactoringSupport: true,
            clientHoverProvider: true,
            clientDocumentSymbolProvider: true,
            gradleChecksumWrapperPromptSupport: true,
            advancedIntroduceParameterRefactoringSupport: true,
            actionableRuntimeNotificationSupport: true,
            shouldLanguageServerExitOnShutdown: true,
            onCompletionItemSelectedCommand: "editor.action.triggerParameterHints",
            extractInterfaceSupport: true,
            advancedUpgradeGradleSupport: true,
            executeClientCommandSupport: true
          },
          triggerFiles
        },
        middleware: {
          workspace: {
            didChangeConfiguration: () => {
              return standardClient.getClient().sendNotification(import_vscode_languageserver_protocol8.DidChangeConfigurationNotification.type.method, {
                settings: {
                  java: getJavaConfig(requirements.java_home)
                }
              });
            }
          },
          provideSelectionRanges: (document, positions, token, next) => {
            if (import_coc38.events.insertMode) return void 0;
            return next(document, positions, token);
          },
          // https://github.com/redhat-developer/vscode-java/issues/2130
          // include all diagnostics for the current line in the CodeActionContext params for the performance reason
          provideCodeActions: (document, range, context2, token, _) => {
            const client = standardClient.getClient();
            const params = {
              textDocument: { uri: document.uri },
              range,
              context: context2
            };
            const showAt = getJavaConfiguration().get("quickfix.showAt");
            if (showAt === "line" && range.start.line === range.end.line && range.start.character === range.end.character) {
              const textLine = document.lineAt(params.range.start.line);
              if (textLine !== null) {
                const diagnostics = client.diagnostics.get(document.uri);
                const allDiagnostics = [];
                for (const diagnostic of diagnostics) {
                  if (rangeIntersect(textLine.range, diagnostic.range)) {
                    const newLen = allDiagnostics.push(diagnostic);
                    if (newLen > 1e3) {
                      break;
                    }
                  }
                }
                const codeActionContext = {
                  diagnostics: allDiagnostics,
                  only: context2.only,
                  triggerKind: import_coc38.CodeActionTriggerKind.Invoked
                };
                params.context = codeActionContext;
              }
            }
            return client.sendRequest(import_vscode_languageserver_protocol8.CodeActionRequest.type.method, params, token).then((values) => {
              if (values === null) return void 0;
              return values;
            }, (error) => {
              return client.handleFailedRequest(import_vscode_languageserver_protocol8.CodeActionRequest.type, token, error, []);
            });
          }
        },
        revealOutputChannelOn: import_coc38.RevealOutputChannelOn.Never,
        errorHandler: new ClientErrorHandler(extensionName3),
        initializationFailedHandler: (error) => {
          createLogger().error(`Failed to initialize ${extensionName3} due to ${error && error.toString()}`);
          return true;
        },
        outputChannel: requireStandardServer ? new OutputInfoCollector("java") : void 0,
        outputChannelName: "java"
      };
      const detectJdksAtStart = getJavaConfiguration().get("configuration.detectJdks");
      if (detectJdksAtStart) {
        const javaConfig = clientOptions.initializationOptions.settings.java;
        const userRuntimes = javaConfig.configuration.runtimes;
        javaConfig.configuration.runtimes = await addAutoDetectedJdks(userRuntimes);
        createLogger().info(`Server configured with the following runtimes: ${JSON.stringify(javaConfig.configuration.runtimes, null, 2)}`);
      }
      apiManager.initialize(requirements, serverMode);
      resolve9(apiManager.getApiInstance());
      if (requireSyntaxServer) {
        if (process.env["SYNTAXLS_CLIENT_PORT"]) {
          syntaxClient.initialize(requirements, clientOptions);
        } else {
          syntaxClient.initialize(requirements, clientOptions, prepareExecutable(requirements, syntaxServerWorkspacePath, getJavaConfig(requirements.java_home), context, true));
        }
        syntaxClient.start();
        serverStatusBarProvider.showLightWeightStatus();
      }
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.EXECUTE_WORKSPACE_COMMAND, (command, ...rest) => {
        const api = apiManager.getApiInstance();
        if (api.serverMode === "LightWeight" /* lightWeight */) {
          import_coc38.window.showWarningMessage(`The command: ${command} is not supported in LightWeight mode. See: https://github.com/redhat-developer/vscode-java/issues/1480`);
          return;
        }
        let token;
        let commandArgs = rest;
        if (rest && rest.length && import_coc38.CancellationToken.is(rest[rest.length - 1])) {
          token = rest[rest.length - 1];
          commandArgs = rest.slice(0, rest.length - 1);
        }
        const params = {
          command,
          arguments: commandArgs
        };
        if (token) {
          return standardClient.getClient().sendRequest(import_vscode_languageserver_protocol8.ExecuteCommandRequest.type, params, token);
        } else {
          return standardClient.getClient().sendRequest(import_vscode_languageserver_protocol8.ExecuteCommandRequest.type, params);
        }
      }, null, true));
      const cleanWorkspaceExists = fs6.existsSync(path17.join(workspacePath, cleanWorkspaceFileName));
      if (cleanWorkspaceExists) {
        try {
          cleanupLombokCache(context);
          deleteDirectory(workspacePath);
          deleteDirectory(syntaxServerWorkspacePath);
        } catch (error) {
          import_coc38.window.showErrorMessage(`Failed to delete ${workspacePath}: ${error}`);
        }
      }
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_SERVER_LOG, () => openServerLogFile(workspacePath)));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_SERVER_STDOUT_LOG, () => openRollingServerLogFile(workspacePath, ".out-jdt.ls")));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_SERVER_STDERR_LOG, () => openRollingServerLogFile(workspacePath, ".error-jdt.ls")));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_CLIENT_LOG, () => openClientLogFile(clientLogFile)));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_LOGS, () => openLogs()));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_FORMATTER, async () => openFormatter(context.extensionPath)));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.OPEN_FILE, async (uri) => {
        const parsedUri = import_coc38.Uri.parse(uri);
        await import_coc38.workspace.jumpTo(parsedUri);
      }, null, true));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.CLEAN_WORKSPACE, (force) => cleanWorkspace(workspacePath, force)));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.CLEAN_SHARED_INDEXES, () => cleanSharedIndexes(context)));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.GET_WORKSPACE_PATH, () => workspacePath));
      context.subscriptions.push(import_coc38.commands.registerCommand(Commands.REFRESH_BUNDLES_COMMAND, () => {
        return getBundlesToReload();
      }));
      context.subscriptions.push(onConfigurationChange(workspacePath, context));
      import_coc38.commands.registerCommand(Commands.SWITCH_SERVER_MODE, async (switchTo, force = false) => {
        const isWorkspaceTrusted2 = import_coc38.workspace.isTrusted;
        if (isWorkspaceTrusted2 !== void 0 && !isWorkspaceTrusted2) {
          const button = "Manage Workspace Trust";
          const choice2 = await import_coc38.window.showInformationMessage("For security concern, Java language server cannot be switched to Standard mode in untrusted workspaces.", button);
          if (choice2 === button) {
            import_coc38.commands.executeCommand("workbench.trust.manage");
          }
          return;
        }
        const clientStatus = standardClient.getClientStatus();
        if (clientStatus === "Starting" /* starting */ || clientStatus === "Started" /* started */) {
          return;
        }
        const api = apiManager.getApiInstance();
        if (api.serverMode === switchTo || api.serverMode === "Standard" /* standard */) {
          return;
        }
        let choice;
        if (force) {
          choice = "Yes";
        } else {
          choice = await import_coc38.window.showInformationMessage("Are you sure you want to switch the Java language server to Standard mode?", "Yes", "No");
        }
        if (choice === "Yes") {
          await startStandardServer(context, requirements, clientOptions, workspacePath);
        }
      }, null, true);
      context.subscriptions.push(serverStatusBarProvider);
      context.subscriptions.push(runtimeStatusBarProvider);
      registerClientProviders(context, { contentProviderEvent: jdtEventEmitter.event });
      apiManager.getApiInstance().onDidServerModeChange((event) => {
        if (event === "Standard" /* standard */) {
          syntaxClient.stop();
          setServerStatus(true);
          runtimeStatusBarProvider.initialize(context);
        }
      });
      if (serverMode === "Hybrid" /* hybrid */ && !await fse10.pathExists(path17.join(workspacePath, ".metadata", ".plugins"))) {
        const config = getJavaConfiguration();
        const importOnStartupSection = "project.importOnFirstTimeStartup";
        const importOnStartup = config.get(importOnStartupSection);
        if (importOnStartup === "disabled") {
          requireStandardServer = false;
        } else if (importOnStartup === "interactive" && await workspaceContainsBuildFiles()) {
          requireStandardServer = await promptUserForStandardServer(config);
        } else {
          requireStandardServer = true;
        }
      }
      if (requireStandardServer) {
        await startStandardServer(context, requirements, clientOptions, workspacePath);
      }
    });
  });
}
async function startStandardServer(context, requirements, clientOptions, workspacePath) {
  if (standardClient.getClientStatus() !== "Uninitialized" /* uninitialized */) {
    return;
  }
  const checkConflicts = await ensureNoBuildToolConflicts(context, clientOptions);
  if (!checkConflicts) {
    return;
  }
  if (apiManager.getApiInstance().serverMode === "LightWeight" /* lightWeight */) {
    apiManager.getApiInstance().serverMode = "Hybrid" /* hybrid */;
    apiManager.fireDidServerModeChange("Hybrid" /* hybrid */);
  }
  await standardClient.initialize(context, requirements, clientOptions, workspacePath, jdtEventEmitter);
  standardClient.start();
  serverStatusBarProvider.showStandardStatus();
}
async function workspaceContainsBuildFiles() {
  const inclusionPatterns = getBuildFilePatterns();
  const inclusionPatternsFromNegatedExclusion = getInclusionPatternsFromNegatedExclusion();
  if (inclusionPatterns.length > 0 && inclusionPatternsFromNegatedExclusion.length > 0 && (await import_coc38.workspace.findFiles(
    convertToGlob(inclusionPatterns, inclusionPatternsFromNegatedExclusion),
    null,
    1
    /* maxResults */
  )).length > 0) {
    return true;
  }
  const inclusionBlob = convertToGlob(inclusionPatterns);
  const exclusionBlob = getExclusionBlob();
  if (inclusionBlob && (await import_coc38.workspace.findFiles(
    inclusionBlob,
    exclusionBlob,
    1
    /* maxResults */
  )).length > 0) {
    return true;
  }
  return false;
}
async function ensureNoBuildToolConflicts(context, clientOptions) {
  const isMavenEnabled = getJavaConfiguration().get("import.maven.enabled");
  const isGradleEnabled = getJavaConfiguration().get("import.gradle.enabled");
  if (isMavenEnabled && isGradleEnabled) {
    let activeBuildTool = context.workspaceState.get(ACTIVE_BUILD_TOOL_STATE);
    if (!activeBuildTool) {
      if (!await hasBuildToolConflicts()) {
        return true;
      }
      activeBuildTool = await import_coc38.window.showInformationMessage("Build tool conflicts are detected in workspace. Which one would you like to use?", "Use Maven", "Use Gradle");
    }
    if (!activeBuildTool) {
      return false;
    } else if (activeBuildTool.toLocaleLowerCase().includes("maven")) {
      clientOptions.initializationOptions.settings.java.import.gradle.enabled = false;
      context.workspaceState.update(ACTIVE_BUILD_TOOL_STATE, "maven");
    } else if (activeBuildTool.toLocaleLowerCase().includes("gradle")) {
      clientOptions.initializationOptions.settings.java.import.maven.enabled = false;
      context.workspaceState.update(ACTIVE_BUILD_TOOL_STATE, "gradle");
    } else {
      throw new Error(`Unknown build tool: ${activeBuildTool}`);
    }
  }
  return true;
}
async function promptUserForStandardServer(config) {
  const choice = await import_coc38.window.showInformationMessage("The workspace contains Java projects. Would you like to import them?", "Yes", "Always", "Later");
  switch (choice) {
    case "Always":
      await config.update("project.importOnFirstTimeStartup", "automatic", import_coc38.ConfigurationTarget.Global);
      return true;
    case "Yes":
      return true;
    case "Later":
    default:
      const importHintSection = "project.importHint";
      const dontShowAgain = "Don't Show Again";
      const showHint = config.get(importHintSection);
      if (showHint && standardClient.getClientStatus() === "Uninitialized" /* uninitialized */) {
        const showRocketEmoji = process.platform === "win32" || process.platform === "darwin";
        const message = `Java Language Server is running in LightWeight mode. Click the ${showRocketEmoji ? "\u{1F680}" : "Rocket"} icon in the status bar if you want to import the projects later.`;
        import_coc38.window.showInformationMessage(message, dontShowAgain).then((selection) => {
          if (selection && selection === dontShowAgain) {
            config.update(importHintSection, false, import_coc38.ConfigurationTarget.Global);
          }
        });
      }
      return false;
  }
}
function deactivate() {
  return Promise.all([
    standardClient.stop(),
    syntaxClient.stop()
  ]);
}
async function getActiveLanguageClient() {
  let languageClient;
  const api = apiManager.getApiInstance();
  if (api.serverMode === "Standard" /* standard */) {
    languageClient = standardClient.getClient();
  } else {
    languageClient = syntaxClient.getClient();
  }
  if (!languageClient) {
    return void 0;
  }
  await languageClient.onReady();
  return languageClient;
}
function enableJavadocSymbols() {
}
function getTempWorkspace() {
  return path17.resolve(os4.tmpdir(), `vscodesws_${makeRandomHexString(5)}`);
}
function makeRandomHexString(length) {
  const chars = ["0", "1", "2", "3", "4", "5", "6", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  let result = "";
  for (let i = 0; i < length; i++) {
    const idx = Math.floor(chars.length * Math.random());
    result += chars[idx];
  }
  return result;
}
async function cleanWorkspace(workspacePath, force) {
  if (!force) {
    const doIt = "Reload and delete";
    const selection = await import_coc38.window.showWarningMessage("Are you sure you want to clean the Java language server workspace?", "Cancel", doIt);
    if (selection !== doIt) {
      return;
    }
  }
  ensureExists(workspacePath);
  const file = path17.join(workspacePath, cleanWorkspaceFileName);
  fs6.closeSync(fs6.openSync(file, "w"));
  import_coc38.commands.executeCommand(Commands.RELOAD_WINDOW);
}
async function cleanSharedIndexes(context) {
  const sharedIndexLocation = getSharedIndexCache(context);
  if (sharedIndexLocation && fs6.existsSync(sharedIndexLocation)) {
    const doIt = "Clean and Reload";
    const ans = await import_coc38.window.showWarningMessage(
      "The shared indexes might be in use by other workspaces, do you want to clear it? New indexes will be built after reloading.",
      doIt,
      "Cancel"
    );
    if (ans === doIt) {
      deleteDirectory(sharedIndexLocation);
      import_coc38.commands.executeCommand(Commands.RELOAD_WINDOW);
    }
  }
}
function openServerLogFile(workspacePath) {
  const serverLogFile = path17.join(workspacePath, ".metadata", ".log");
  return openLogFile(serverLogFile, "Could not open Java Language Server log file");
}
function openRollingServerLogFile(workspacePath, filename) {
  return new Promise((resolve9) => {
    const dirname7 = path17.join(workspacePath, ".metadata");
    glob3(`${filename}-*`, { cwd: dirname7 }, (err, files) => {
      if (!err && files.length > 0) {
        files.sort();
        const logFile = path17.join(dirname7, files[files.length - 1]);
        openLogFile(logFile, `Could not open Java Language Server log file ${filename}`).then((result) => resolve9(result));
      } else {
        resolve9(false);
      }
    });
  });
}
function openClientLogFile(logFile) {
  return new Promise((resolve9) => {
    const filename = path17.basename(logFile);
    const dirname7 = path17.dirname(logFile);
    glob3(`${filename}.*`, { cwd: dirname7 }, (err, files) => {
      if (!err && files.length > 0) {
        files.sort((a, b) => {
          const dateA = a.slice(11, 21), dateB = b.slice(11, 21);
          if (dateA === dateB) {
            if (a.length > 22 && b.length > 22) {
              const extA = a.slice(22), extB = b.slice(22);
              return parseInt(extA) - parseInt(extB);
            } else {
              return a.length - b.length;
            }
          } else {
            return dateA < dateB ? -1 : 1;
          }
        });
        logFile = path17.join(dirname7, files[files.length - 1]);
      }
      openLogFile(logFile, "Could not open Java extension log file").then((result) => resolve9(result));
    });
  });
}
async function openLogs() {
  await import_coc38.commands.executeCommand(Commands.OPEN_CLIENT_LOG);
  await import_coc38.commands.executeCommand(Commands.OPEN_SERVER_LOG);
  await import_coc38.commands.executeCommand(Commands.OPEN_SERVER_STDOUT_LOG);
  await import_coc38.commands.executeCommand(Commands.OPEN_SERVER_STDERR_LOG);
}
function openLogFile(logFile, openingFailureWarning) {
  if (!fs6.existsSync(logFile)) {
    return import_coc38.window.showWarningMessage("No log file available").then(() => false);
  }
  return import_coc38.workspace.openTextDocument(logFile).then((doc) => {
    if (!doc) {
      return false;
    }
    return import_coc38.workspace.jumpTo(doc.uri).then(() => true);
  }, () => false).then((didOpen) => {
    if (!didOpen) {
      import_coc38.window.showWarningMessage(openingFailureWarning);
    }
    return didOpen;
  });
}
async function openFormatter(extensionPath) {
  const defaultFormatter = path17.join(extensionPath, "formatters", "eclipse-formatter.xml");
  const formatterUrl = getJavaConfiguration().get("format.settings.url");
  if (formatterUrl && formatterUrl.length > 0) {
    if (isRemote(formatterUrl)) {
      return import_coc38.commands.executeCommand(Commands.OPEN_BROWSER, import_coc38.Uri.parse(formatterUrl));
    } else {
      const document = getPath(formatterUrl);
      if (document && fs6.existsSync(document)) {
        return openDocument(extensionPath, document, defaultFormatter, null);
      }
    }
  }
  const global2 = import_coc38.workspace.workspaceFolders === void 0;
  const fileName = formatterUrl || "eclipse-formatter.xml";
  let file;
  let relativePath;
  if (!global2) {
    const workspacePath = import_coc38.Uri.parse(import_coc38.workspace.workspaceFolders[0].uri).fsPath;
    file = path17.join(workspacePath, fileName);
    relativePath = fileName;
  } else {
    const root = path17.join(extensionPath, "..", "redhat.java");
    ensureExists(root);
    file = path17.join(root, fileName);
  }
  if (!fs6.existsSync(file)) {
    addFormatter(extensionPath, file, defaultFormatter, relativePath);
  } else {
    if (formatterUrl) {
      getJavaConfiguration().update("format.settings.url", relativePath !== null ? relativePath : file, global2);
      openDocument(extensionPath, file, file, defaultFormatter);
    } else {
      addFormatter(extensionPath, file, defaultFormatter, relativePath);
    }
  }
}
function getPath(f) {
  if (import_coc38.workspace.workspaceFolders && !path17.isAbsolute(f)) {
    import_coc38.workspace.workspaceFolders.forEach((wf) => {
      const fsPath = import_coc38.Uri.parse(wf.uri).fsPath;
      const file = path17.resolve(fsPath, f);
      if (fs6.existsSync(file)) {
        return file;
      }
    });
  } else {
    return path17.resolve(f);
  }
  return null;
}
function openDocument(extensionPath, formatterUrl, defaultFormatter, relativePath) {
  return import_coc38.workspace.openTextDocument(formatterUrl).then((doc) => {
    if (!doc) {
      addFormatter(extensionPath, formatterUrl, defaultFormatter, relativePath);
    }
    return import_coc38.workspace.jumpTo(doc.uri).then(() => {
      return true;
    });
  }, () => false).then((didOpen) => {
    if (!didOpen) {
      import_coc38.window.showWarningMessage("Could not open Formatter Settings file");
      addFormatter(extensionPath, formatterUrl, defaultFormatter, relativePath);
    } else {
      return didOpen;
    }
  });
}
function isRemote(f) {
  return f !== null && f.startsWith("http:/") || f.startsWith("https:/") || f.startsWith("file:/");
}
async function addFormatter(extensionPath, formatterUrl, defaultFormatter, relativePath) {
  await import_coc38.window.requestInput("please enter URL or Path:", relativePath ? relativePath : formatterUrl, { position: "center" }).then((f) => {
    if (f) {
      const global2 = import_coc38.workspace.workspaceFolders === void 0;
      if (isRemote(f)) {
        import_coc38.commands.executeCommand(Commands.OPEN_BROWSER, import_coc38.Uri.parse(f));
        getJavaConfiguration().update("format.settings.url", f, global2);
      } else {
        if (!path17.isAbsolute(f)) {
          const fileName = f;
          if (!global2) {
            let fsPath = import_coc38.Uri.parse(import_coc38.workspace.workspaceFolders[0].uri).fsPath;
            f = path17.join(fsPath, fileName);
            relativePath = fileName;
          } else {
            const root = path17.join(extensionPath, "..", "redhat.java");
            ensureExists(root);
            f = path17.join(root, fileName);
          }
        } else {
          relativePath = null;
        }
        getJavaConfiguration().update("format.settings.url", relativePath !== null ? relativePath : f, global2);
        if (!fs6.existsSync(f)) {
          const name = relativePath !== null ? relativePath : f;
          const msg = `' ${name} ' does not exist. Do you want to create it?`;
          const action = "Yes";
          import_coc38.window.showWarningMessage(msg, action, "No").then((selection) => {
            if (action === selection) {
              try {
                ensureExists(path17.dirname(f));
                fs6.createReadStream(defaultFormatter).pipe(fs6.createWriteStream(f)).on("finish", () => openDocument(extensionPath, f, defaultFormatter, relativePath));
              } catch (error) {
                import_coc38.window.showErrorMessage(`Failed to create ${f}: ${error}`);
              }
            }
          });
        } else {
          openDocument(extensionPath, f, defaultFormatter, relativePath);
        }
      }
    }
  });
}
async function getTriggerFiles() {
  const openedJavaFiles = [];
  const activeJavaFile = getJavaFilePathOfTextDocument(import_coc38.window.activeTextEditor && import_coc38.window.activeTextEditor.document);
  if (activeJavaFile) {
    openedJavaFiles.push(import_coc38.Uri.file(activeJavaFile).toString());
  }
  if (!import_coc38.workspace.workspaceFolders) {
    return openedJavaFiles;
  }
  await Promise.all(import_coc38.workspace.workspaceFolders.map(async (rootFolder) => {
    const uri = import_coc38.Uri.parse(rootFolder.uri);
    if (uri.scheme !== "file") {
      return;
    }
    const rootPath = path17.normalize(uri.fsPath);
    if (isPrefix2(rootPath, activeJavaFile)) {
      return;
    }
    for (const textEditor of import_coc38.window.visibleTextEditors) {
      const javaFileInTextEditor = getJavaFilePathOfTextDocument(textEditor.document);
      if (isPrefix2(rootPath, javaFileInTextEditor)) {
        openedJavaFiles.push(import_coc38.Uri.file(javaFileInTextEditor).toString());
        return;
      }
    }
    for (const textDocument of import_coc38.workspace.documents) {
      const javaFileInTextDocument = getJavaFilePathOfTextDocument(textDocument);
      if (isPrefix2(rootPath, javaFileInTextDocument)) {
        openedJavaFiles.push(import_coc38.Uri.file(javaFileInTextDocument).toString());
        return;
      }
    }
    const javaFilesUnderRoot = await import_coc38.workspace.findFiles(new import_coc38.RelativePattern(rootFolder, "*.java"), void 0, 1);
    for (const javaFile of javaFilesUnderRoot) {
      if (isPrefix2(rootPath, javaFile.fsPath)) {
        openedJavaFiles.push(javaFile.toString());
        return;
      }
    }
    const javaFilesInCommonPlaces = await import_coc38.workspace.findFiles(new import_coc38.RelativePattern(rootFolder, "{src, test}/**/*.java"), void 0, 1);
    for (const javaFile of javaFilesInCommonPlaces) {
      if (isPrefix2(rootPath, javaFile.fsPath)) {
        openedJavaFiles.push(javaFile.toString());
        return;
      }
    }
  }));
  return openedJavaFiles;
}
function getJavaFilePathOfTextDocument(document) {
  if (document) {
    const resource = import_coc38.Uri.parse(document.uri);
    if (resource.scheme === "file" && resource.fsPath.endsWith(".java")) {
      return path17.normalize(resource.fsPath);
    }
  }
  return void 0;
}
function isPrefix2(parentPath, childPath) {
  if (!childPath) {
    return false;
  }
  const relative5 = path17.relative(parentPath, childPath);
  return !!relative5 && !relative5.startsWith("..") && !path17.isAbsolute(relative5);
}
async function cleanJavaWorkspaceStorage() {
  const configCacheLimit = getJavaConfiguration().get("configuration.workspaceCacheLimit");
  if (!storagePath || !configCacheLimit || storagePath.includes("vscodesws")) {
    return;
  }
  const limit = configCacheLimit * 864e5;
  const currTime = (/* @__PURE__ */ new Date()).valueOf();
  const wsRoot = storagePath;
  if (fs6.existsSync(wsRoot)) {
    new glob3.Glob(`${wsRoot}/**/jdt_ws`, (_err, matches) => {
      for (const javaWSCache of matches) {
        const entry = path17.dirname(javaWSCache);
        const entryModTime = fs6.statSync(entry).mtimeMs;
        if (currTime - entryModTime > limit) {
          createLogger().info(`Removing workspace storage folder : ${entry}`);
          deleteDirectory(entry);
        }
      }
    });
  }
}
function registerOutOfMemoryDetection(storagePath2) {
  const heapDumpFolder = getHeapDumpFolderFromSettings() || storagePath2;
  chokidar.watch(`${heapDumpFolder}/java_*.hprof`, { ignoreInitial: true }).on("add", (path18) => {
    if (heapDumpFolder === storagePath2) {
      fse10.remove(path18);
    }
    showOOMMessage();
  });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  activate,
  deactivate,
  getActiveLanguageClient
});
/*! Bundled license information:

lodash/lodash.js:
  (**
   * @license
   * Lodash <https://lodash.com/>
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)
*/
