'use strict';

var _24WEKBY3_cjs = require('./24WEKBY3.cjs');
var path = require('path');
var z = require('zod');
var commonNodeUtils = require('@layerzerolabs/common-node-utils');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var z__namespace = /*#__PURE__*/_interopNamespace(z);

// src/config.ts
_24WEKBY3_cjs.init_cjs_shims();
var registryConfigCache;
var getRegistryConfig = /* @__PURE__ */ _24WEKBY3_cjs.__name(async () => {
  if (!registryConfigCache) {
    const envRegistry = process.env.VM_TOOLING_REGISTRY;
    const envImageDirectory = process.env.VM_TOOLING_IMAGE_DIRECTORY;
    if (envRegistry && envImageDirectory) {
      registryConfigCache = {
        registry: envRegistry,
        imageDirectory: envImageDirectory
      };
    } else {
      const workspaceRoot = await commonNodeUtils.getFullyQualifiedRepoRootPath();
      const configPath = path.join(workspaceRoot, "configs", "vm-tooling", "values", "docker-image-repo.ts");
      const module = await import(configPath);
      registryConfigCache = module.default;
    }
  }
  return registryConfigCache;
}, "getRegistryConfig");
var volumeMappingBaseSchema = z__namespace.object({
  containerPath: z__namespace.string()
});
var hostVolumeMappingSchema = volumeMappingBaseSchema.extend({
  type: z__namespace.literal("host"),
  hostPath: z__namespace.string()
});
var isolateVolumeMappingSchema = volumeMappingBaseSchema.extend({
  type: z__namespace.literal("isolate"),
  name: z__namespace.string(),
  shared: z__namespace.optional(z__namespace.boolean()),
  locked: z__namespace.optional(z__namespace.boolean())
});
var volumeMappingSchema = z__namespace.union([
  hostVolumeMappingSchema,
  isolateVolumeMappingSchema
]);
var DockerRegistryMirror = /* @__PURE__ */ (function(DockerRegistryMirror2) {
  DockerRegistryMirror2["PUBLIC_GAR"] = "public-gar";
  return DockerRegistryMirror2;
})({});
var getImageDirectory = /* @__PURE__ */ _24WEKBY3_cjs.__name(async () => (await getRegistryConfig()).imageDirectory, "getImageDirectory");
var getRegistry = /* @__PURE__ */ _24WEKBY3_cjs.__name(async () => (await getRegistryConfig()).registry, "getRegistry");

exports.DockerRegistryMirror = DockerRegistryMirror;
exports.getImageDirectory = getImageDirectory;
exports.getRegistry = getRegistry;
exports.volumeMappingSchema = volumeMappingSchema;
//# sourceMappingURL=2NTYK3VO.cjs.map
//# sourceMappingURL=2NTYK3VO.cjs.map