'use strict';

var _24WEKBY3_cjs = require('./24WEKBY3.cjs');
var esToolkit = require('es-toolkit');

// src/utils/finder.ts
_24WEKBY3_cjs.init_cjs_shims();
var findToolByName = /* @__PURE__ */ _24WEKBY3_cjs.__name(({ tools }, toolName) => {
  const tool = tools.find((tool2) => tool2.name === toolName);
  if (!tool) {
    throw new Error(`Tool '${toolName}' not found`);
  }
  return tool;
}, "findToolByName");
var getImageName = /* @__PURE__ */ _24WEKBY3_cjs.__name((basename) => `${basename}-tooling`, "getImageName");
var getToolDefaultVersion = /* @__PURE__ */ _24WEKBY3_cjs.__name((context, toolName) => {
  const combination = context.versionCombinations[0];
  if (!combination) {
    return null;
  }
  const version = findToolVersionsForCombination(context, combination)[toolName];
  if (!version) {
    console.warn(`No default version found for tool '${toolName}' in matrix`);
    return null;
  }
  return version;
}, "getToolDefaultVersion");
var findToolVersionsForCombination = /* @__PURE__ */ _24WEKBY3_cjs.__name(({ images }, combination) => Object.fromEntries(Object.entries(combination.images).map(([tool, imageId]) => {
  const version = images[imageId].versions[tool];
  if (!version) {
    throw new Error(`Tool ${tool} not found in Docker image: ${imageId}`);
  }
  return [
    tool,
    version
  ];
})), "findToolVersionsForCombination");
var getToolSupportedVersions = /* @__PURE__ */ _24WEKBY3_cjs.__name((context, toolName) => [
  ...new Set(context.versionCombinations.map((combination) => findToolVersionsForCombination(context, combination)[toolName]).filter(esToolkit.isString))
].sort(), "getToolSupportedVersions");

exports.findToolByName = findToolByName;
exports.findToolVersionsForCombination = findToolVersionsForCombination;
exports.getImageName = getImageName;
exports.getToolDefaultVersion = getToolDefaultVersion;
exports.getToolSupportedVersions = getToolSupportedVersions;
//# sourceMappingURL=5GPMTH2I.cjs.map
//# sourceMappingURL=5GPMTH2I.cjs.map