"use strict";
const browserslist_1 = require("../../external/browserslist");
const semver_1 = require("../../external/semver");
// IMPORTANT: Do not use destructuring here - use direct assignment instead.
// tsgo has a bug that incorrectly transpiles destructured exports, resulting in
// `exports.SomeName = void 0;` which causes runtime errors.
// See: https://github.com/SocketDev/socket-packageurl-js/issues/3
const ObjectFreeze = Object.freeze;
// Under the hood browserlist uses the node-releases package which is out of date:
// https://github.com/chicoxyzzy/node-releases/issues/37
//
// So we maintain a manual version list for now.
// https://nodejs.org/en/about/previous-releases#looking-for-the-latest-release-of-a-version-branch
//
// Updated May 10th, 2025.
const manualNext = '24.0.1';
const manualCurr = '22.15.0';
const manualPrev = '20.19.1';
const manualLast = '18.20.8';
const query = (0, browserslist_1)('maintained node versions')
    // Trim value, e.g. 'node 22.15.0' to '22.15.0'.
    .map((s) => s.slice(5 /*'node '.length*/));
// browsersList returns results in descending order.
const queryNext = query.at(0) ?? manualNext;
const queryCurr = query.at(1) ?? manualCurr;
const queryPrev = query.at(2) ?? manualPrev;
const queryLast = query.at(-1) ?? manualLast;
const next = semver_1.gt(manualNext, queryNext) ? manualNext : queryNext;
const current = semver_1.maxSatisfying([queryCurr, manualCurr], `^${semver_1.major(queryCurr)}`);
const previous = semver_1.maxSatisfying([queryPrev, manualPrev], `^${semver_1.major(queryPrev)}`);
const last = semver_1.lt(manualLast, queryLast) ? manualLast : queryLast;
module.exports = ObjectFreeze(Object.assign([last, previous, current, next], {
    last,
    previous,
    current,
    next,
}));
//# sourceMappingURL=maintained-node-versions.js.map