/* Socket Lib - Built with esbuild */
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 __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);
var versions_exports = {};
__export(versions_exports, {
  coerceVersion: () => coerceVersion,
  compareVersions: () => compareVersions,
  filterVersions: () => filterVersions,
  getMajorVersion: () => getMajorVersion,
  getMinorVersion: () => getMinorVersion,
  getPatchVersion: () => getPatchVersion,
  incrementVersion: () => incrementVersion,
  isEqual: () => isEqual,
  isGreaterThan: () => isGreaterThan,
  isGreaterThanOrEqual: () => isGreaterThanOrEqual,
  isLessThan: () => isLessThan,
  isLessThanOrEqual: () => isLessThanOrEqual,
  isValidVersion: () => isValidVersion,
  maxVersion: () => maxVersion,
  minVersion: () => minVersion,
  parseVersion: () => parseVersion,
  satisfiesVersion: () => satisfiesVersion,
  sortVersions: () => sortVersions,
  sortVersionsDesc: () => sortVersionsDesc,
  versionDiff: () => versionDiff
});
module.exports = __toCommonJS(versions_exports);
var import_semver = __toESM(require("./external/semver"));
function coerceVersion(version) {
  const coerced = import_semver.default.coerce(version);
  return coerced?.version;
}
function compareVersions(v1, v2) {
  try {
    return import_semver.default.compare(v1, v2);
  } catch {
    return void 0;
  }
}
function filterVersions(versions, range) {
  return versions.filter((v) => import_semver.default.satisfies(v, range));
}
function getMajorVersion(version) {
  const parsed = import_semver.default.parse(version);
  return parsed?.major;
}
function getMinorVersion(version) {
  const parsed = import_semver.default.parse(version);
  return parsed?.minor;
}
function getPatchVersion(version) {
  const parsed = import_semver.default.parse(version);
  return parsed?.patch;
}
function incrementVersion(version, release, identifier) {
  return import_semver.default.inc(version, release, identifier) || void 0;
}
function isEqual(version1, version2) {
  return import_semver.default.eq(version1, version2);
}
function isGreaterThan(version1, version2) {
  return import_semver.default.gt(version1, version2);
}
function isGreaterThanOrEqual(version1, version2) {
  return import_semver.default.gte(version1, version2);
}
function isLessThan(version1, version2) {
  return import_semver.default.lt(version1, version2);
}
function isLessThanOrEqual(version1, version2) {
  return import_semver.default.lte(version1, version2);
}
function isValidVersion(version) {
  return import_semver.default.valid(version) !== null;
}
function maxVersion(versions) {
  return import_semver.default.maxSatisfying(versions, "*") || void 0;
}
function minVersion(versions) {
  return import_semver.default.minSatisfying(versions, "*") || void 0;
}
function parseVersion(version) {
  const parsed = import_semver.default.parse(version);
  if (!parsed) {
    return void 0;
  }
  return {
    major: parsed.major,
    minor: parsed.minor,
    patch: parsed.patch,
    prerelease: parsed.prerelease,
    build: parsed.build
  };
}
function satisfiesVersion(version, range) {
  return import_semver.default.satisfies(version, range);
}
function sortVersions(versions) {
  return import_semver.default.sort([...versions]);
}
function sortVersionsDesc(versions) {
  return import_semver.default.rsort([...versions]);
}
function versionDiff(version1, version2) {
  return import_semver.default.diff(version1, version2) || void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  coerceVersion,
  compareVersions,
  filterVersions,
  getMajorVersion,
  getMinorVersion,
  getPatchVersion,
  incrementVersion,
  isEqual,
  isGreaterThan,
  isGreaterThanOrEqual,
  isLessThan,
  isLessThanOrEqual,
  isValidVersion,
  maxVersion,
  minVersion,
  parseVersion,
  satisfiesVersion,
  sortVersions,
  sortVersionsDesc,
  versionDiff
});
//# sourceMappingURL=versions.js.map
