"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_smol_manifest = require('../../smol/manifest.js');

//#region src/eco/manifest/get-package-versions.ts
/**
* @file `getPackageVersions(lockfile, name)` — returns all `PackageRef`s that
*   match the given name in a `ParsedLockfile`. Returns an empty array when no
*   match exists.
*/
function jsGetPackageVersions(lockfile, name) {
	const idx = lockfile._index[name];
	if (idx === void 0) return [];
	if (typeof idx === "number") {
		const pkg = lockfile.packages[idx];
		return pkg ? [pkg] : [];
	}
	const result = [];
	for (let i = 0, { length } = idx; i < length; i++) {
		const pkg = lockfile.packages[idx[i]];
		if (pkg) result[result.length] = pkg;
	}
	return result;
}
const _smol = /* @__PURE__ */ require_smol_manifest.getSmolManifest();
const getPackageVersions = _smol ? _smol.getPackageVersions : jsGetPackageVersions;

//#endregion
exports.getPackageVersions = getPackageVersions;
exports.jsGetPackageVersions = jsGetPackageVersions;