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

//#region src/versions/parse.ts
/**
* @file Parsing helpers — `coerceVersion` rounds a sloppy input ("1.2") up to a
*   valid semver triple, `parseVersion` returns `{major, minor, patch,
*   prerelease, build}`, and the `getMajor*` / `getMinor*` / `getPatchVersion`
*   accessors return a single component. `isValidVersion` is also here because
*   validation is effectively "did parse succeed". All go through the vendored
*   `semver` directly — smol-versions doesn't expose the parsed shape.
*/
/**
* Coerce a version string to valid semver format.
*
* @example
*   ;```typescript
*   coerceVersion('1.2') // '1.2.0'
*   coerceVersion('v3') // '3.0.0'
*   coerceVersion('abc') // undefined
*   ```
*/
function coerceVersion(version) {
	return require_versions__internal.getSemver().coerce(version)?.version;
}
/**
* Get the major version number from a version string.
*
* @example
*   ;```typescript
*   getMajorVersion('3.2.1') // 3
*   ```
*/
function getMajorVersion(version) {
	return require_versions__internal.getSemver().parse(version)?.major;
}
/**
* Get the minor version number from a version string.
*
* @example
*   ;```typescript
*   getMinorVersion('3.2.1') // 2
*   ```
*/
function getMinorVersion(version) {
	return require_versions__internal.getSemver().parse(version)?.minor;
}
/**
* Get the patch version number from a version string.
*
* @example
*   ;```typescript
*   getPatchVersion('3.2.1') // 1
*   ```
*/
function getPatchVersion(version) {
	return require_versions__internal.getSemver().parse(version)?.patch;
}
/**
* Validate if a string is a valid semantic version.
*
* @example
*   ;```typescript
*   isValidVersion('1.2.3') // true
*   isValidVersion('abc') // false
*   ```
*/
function isValidVersion(version) {
	/* c8 ignore next - External semver call */
	return require_versions__internal.impl.valid(version) != null;
}
/**
* Parse a version string and return major, minor, patch components.
*
* @example
*   ;```typescript
*   parseVersion('1.2.3')
*   // { major: 1, minor: 2, patch: 3, prerelease: [], build: [] }
*   ```
*/
function parseVersion(version) {
	const parsed = require_versions__internal.getSemver().parse(version);
	if (!parsed) return;
	return {
		major: parsed.major,
		minor: parsed.minor,
		patch: parsed.patch,
		prerelease: parsed.prerelease,
		build: parsed.build
	};
}

//#endregion
exports.coerceVersion = coerceVersion;
exports.getMajorVersion = getMajorVersion;
exports.getMinorVersion = getMinorVersion;
exports.getPatchVersion = getPatchVersion;
exports.isValidVersion = isValidVersion;
exports.parseVersion = parseVersion;