"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    VersionStruct: function() {
        return VersionStruct;
    },
    VersionRangeStruct: function() {
        return VersionRangeStruct;
    },
    isValidSemVerVersion: function() {
        return isValidSemVerVersion;
    },
    isValidSemVerRange: function() {
        return isValidSemVerRange;
    },
    assertIsSemVerVersion: function() {
        return assertIsSemVerVersion;
    },
    assertIsSemVerRange: function() {
        return assertIsSemVerRange;
    },
    gtVersion: function() {
        return gtVersion;
    },
    gtRange: function() {
        return gtRange;
    },
    satisfiesVersionRange: function() {
        return satisfiesVersionRange;
    }
});
const _semver = require("semver");
const _superstruct = require("superstruct");
const _assert = require("./assert");
const VersionStruct = (0, _superstruct.refine)((0, _superstruct.string)(), 'Version', (value)=>{
    if ((0, _semver.valid)(value) === null) {
        return `Expected SemVer version, got "${value}"`;
    }
    return true;
});
const VersionRangeStruct = (0, _superstruct.refine)((0, _superstruct.string)(), 'Version range', (value)=>{
    if ((0, _semver.validRange)(value) === null) {
        return `Expected SemVer range, got "${value}"`;
    }
    return true;
});
function isValidSemVerVersion(version) {
    return (0, _superstruct.is)(version, VersionStruct);
}
function isValidSemVerRange(versionRange) {
    return (0, _superstruct.is)(versionRange, VersionRangeStruct);
}
function assertIsSemVerVersion(version) {
    (0, _assert.assertStruct)(version, VersionStruct);
}
function assertIsSemVerRange(range) {
    (0, _assert.assertStruct)(range, VersionRangeStruct);
}
function gtVersion(version1, version2) {
    return (0, _semver.gt)(version1, version2);
}
function gtRange(version, range) {
    return (0, _semver.gtr)(version, range);
}
function satisfiesVersionRange(version, versionRange) {
    return (0, _semver.satisfies)(version, versionRange, {
        includePrerelease: true
    });
}

//# sourceMappingURL=versions.js.map