'use strict';

var VO65XOWD_cjs = require('./VO65XOWD.cjs');

// src/core/compatibility.ts
VO65XOWD_cjs.init_cjs_shims();
function findBestCompatibleCombination(userVersions, matrix) {
  const scoredCombinations = matrix.combinations.map((combo) => {
    let matchScore = 0;
    let conflicts = 0;
    for (const [tool, userVersion] of Object.entries(userVersions)) {
      const comboVersion = combo.versions[tool];
      if (comboVersion !== void 0) {
        if (comboVersion === userVersion) {
          matchScore++;
        } else {
          conflicts++;
        }
      }
    }
    return {
      combo,
      matchScore,
      conflicts
    };
  });
  scoredCombinations.sort((a, b) => {
    if (a.conflicts !== b.conflicts) {
      return a.conflicts - b.conflicts;
    }
    return b.matchScore - a.matchScore;
  });
  return scoredCombinations[0]?.combo;
}
VO65XOWD_cjs.__name(findBestCompatibleCombination, "findBestCompatibleCombination");

exports.findBestCompatibleCombination = findBestCompatibleCombination;
//# sourceMappingURL=JJXZWB7K.cjs.map
//# sourceMappingURL=JJXZWB7K.cjs.map