import { getImageTag } from './GPDDKHCR.js';
import { getImageName } from './KWRJPB5T.js';
import { init_esm_shims, __name } from './6AHA7PAZ.js';
import { constantCase } from 'es-toolkit';
import { join } from 'path';

// src/github/matrix.ts
init_esm_shims();
var TAG_SEPARATORS = [
  "-",
  "_"
];
var generateGithubMatrix = /* @__PURE__ */ __name((images, directory, versionCombinations) => {
  const createImageEntry = /* @__PURE__ */ __name(([imageId, image]) => {
    const imageName = getImageName(image.name);
    const tags = TAG_SEPARATORS.map((separator) => getImageTag(image, separator));
    return {
      entry: {
        id: imageId,
        name: image.name,
        build_args: Object.entries({
          ...image.versions,
          ...image.dependencies
        }).sort().map(([key, value]) => `${constantCase(key)}_VERSION=${value}`),
        directory: join(directory, "docker", image.name),
        image_name: imageName,
        tags
      },
      image
    };
  }, "createImageEntry");
  const results = Object.entries(images).map(createImageEntry);
  const imageEntries = results.map((r) => r.entry);
  const mirroredImages = results.filter((result) => result.image.mirrorRegistries?.length).flatMap((result) => result.image.mirrorRegistries.map((mirror) => ({
    id: result.entry.id,
    name: result.entry.name,
    image_name: result.entry.image_name,
    tags: result.entry.tags,
    mirror
  })));
  const activeImages = [];
  if (versionCombinations) {
    const activeImageIds = new Set(versionCombinations.flatMap((combo) => Object.values(combo.images)));
    activeImages.push(...activeImageIds);
  }
  return {
    images: imageEntries,
    mirroredImages,
    activeImages
  };
}, "generateGithubMatrix");

export { generateGithubMatrix };
//# sourceMappingURL=VF2UWSC3.js.map
//# sourceMappingURL=VF2UWSC3.js.map