"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var parse_exports = {};
__export(parse_exports, {
  jsParse: () => jsParse,
  parse: () => parse
});
module.exports = __toCommonJS(parse_exports);
var import_manifest_error = require("./manifest-error");
var import_detect_format = require("./detect-format");
var import_parse_lockfile = require("./parse-lockfile");
var import_parse_manifest = require("./parse-manifest");
var import_manifest = require("../../smol/manifest");
function jsParse(filename, content) {
  const format = (0, import_detect_format.detectFormat)(filename);
  if (!format) {
    throw new import_manifest_error.ManifestError(
      `Unknown file format: ${filename}`,
      "ERR_UNKNOWN_FORMAT"
    );
  }
  if (format.type === "manifest") {
    return (0, import_parse_manifest.parseManifest)(content, format.ecosystem);
  }
  return (0, import_parse_lockfile.parseLockfile)(content, format.ecosystem, format.format);
}
const _smol = (0, import_manifest.getSmolManifest)();
const smolParse = _smol ? (filename, content) => _smol.parse(filename, content) : void 0;
const parse = smolParse ?? jsParse;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  jsParse,
  parse
});
