"use strict";
/* 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 sorts_exports = {};
__export(sorts_exports, {
  compareSemver: () => compareSemver,
  compareStr: () => compareStr,
  localeCompare: () => localeCompare,
  naturalCompare: () => naturalCompare,
  naturalSorter: () => naturalSorter
});
module.exports = __toCommonJS(sorts_exports);
var fastSort = __toESM(require("./external/fast-sort.js"));
var semver = __toESM(require("./external/semver.js"));
// @__NO_SIDE_EFFECTS__
function compareSemver(a, b) {
  const validA = semver.valid(a);
  const validB = semver.valid(b);
  if (!validA && !validB) {
    return 0;
  }
  if (!validA) {
    return -1;
  }
  if (!validB) {
    return 1;
  }
  return semver.compare(a, b);
}
// @__NO_SIDE_EFFECTS__
function compareStr(a, b) {
  return a < b ? -1 : a > b ? 1 : 0;
}
let _localeCompare;
// @__NO_SIDE_EFFECTS__
function localeCompare(x, y) {
  if (_localeCompare === void 0) {
    _localeCompare = new Intl.Collator().compare;
  }
  return _localeCompare(x, y);
}
let _naturalCompare;
// @__NO_SIDE_EFFECTS__
function naturalCompare(x, y) {
  if (_naturalCompare === void 0) {
    _naturalCompare = new Intl.Collator(
      // The `undefined` locale means it uses the default locale of the user's
      // environment.
      void 0,
      {
        // Enables numeric sorting: numbers in strings are compared by value,
        // e.g. 'file2' comes before 'file10' as numbers and not 'file10' before
        // 'file2' as plain text.
        numeric: true,
        // Makes the comparison case-insensitive and ignores diacritics, e.g.
        // 'a', 'A', and 'á' are treated as equivalent.
        sensitivity: "base"
      }
    ).compare;
  }
  return _naturalCompare(x, y);
}
let _naturalSorter;
// @__NO_SIDE_EFFECTS__
function naturalSorter(arrayToSort) {
  if (_naturalSorter === void 0) {
    _naturalSorter = fastSort.createNewSortInstance({
      comparer: naturalCompare
    });
  }
  return _naturalSorter(arrayToSort);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  compareSemver,
  compareStr,
  localeCompare,
  naturalCompare,
  naturalSorter
});
