'use strict';

var FOFSZBOK_cjs = require('./FOFSZBOK.cjs');
var KSZMBVFB_cjs = require('./KSZMBVFB.cjs');
var U7VZULNU_cjs = require('./U7VZULNU.cjs');
var path = require('path');

// src/utils/docker.ts
U7VZULNU_cjs.init_cjs_shims();
var getImageUriForTool = /* @__PURE__ */ U7VZULNU_cjs.__name((tool, version, separator = "_") => {
  const [image] = FOFSZBOK_cjs.findMatrixForTool(tool).flatMap((combination) => {
    const imageId = combination.images[tool];
    if (!imageId) {
      return [];
    }
    const image2 = KSZMBVFB_cjs.images[imageId];
    return !image2 ? [] : FOFSZBOK_cjs.findToolVersionsForCombination(combination)[tool] === version ? [
      image2
    ] : [];
  });
  if (!image) {
    throw new Error(`No version combination found for tool ${tool} with version ${version}`);
  }
  return getImageUri(image, separator);
}, "getImageUriForTool");
var getImageUri = /* @__PURE__ */ U7VZULNU_cjs.__name((image, separator = "_") => path.join(FOFSZBOK_cjs.ECR_REGISTRY, FOFSZBOK_cjs.ECR_IMAGE_DIRECTORY, `${FOFSZBOK_cjs.getImageName(image.name)}:${getImageTag(image, separator)}`), "getImageUri");
var getImageTag = /* @__PURE__ */ U7VZULNU_cjs.__name(({ versions, patch }, separator = "_") => [
  ...Object.entries(versions).sort().flat(),
  ...patch ? [
    "patch",
    patch
  ] : []
].join(separator), "getImageTag");
var getVolumeName = /* @__PURE__ */ U7VZULNU_cjs.__name((volume) => {
  if (volume.type === "host") {
    return `${volume.hostPath}:${volume.containerPath}`;
  }
  const components = [
    "lz-tooling-cache",
    volume.name
  ];
  if (!volume.shared) {
    const packageName = process.env.npm_package_name;
    if (!packageName) {
      throw new Error("npm_package_name environment variable not defined");
    }
    components.push(path.basename(packageName));
  }
  return `${components.join("-")}:${volume.containerPath}`;
}, "getVolumeName");

exports.getImageTag = getImageTag;
exports.getImageUri = getImageUri;
exports.getImageUriForTool = getImageUriForTool;
exports.getVolumeName = getVolumeName;
//# sourceMappingURL=36UU6CJU.cjs.map
//# sourceMappingURL=36UU6CJU.cjs.map