function resolvePath(relativePath, target, config = {}) {
  const {
    outputStructure = "monorepo",
    backendDir = "backend",
    frontendDir = "frontend",
    baseDir = "."
  } = config;
  if (outputStructure === "standalone") {
    return baseDir === "." ? relativePath : `${baseDir}/${relativePath}`;
  }
  const prefix = target === "backend" ? backendDir : target === "frontend" ? frontendDir : "shared";
  return `${prefix}/${relativePath}`;
}
function resolveImportPath(from, to, importPath, config = {}) {
  const { outputStructure = "monorepo" } = config;
  if (outputStructure === "standalone") {
    if (from === "frontend" && to === "backend") {
      throw new Error("Frontend cannot directly import from backend in standalone mode. Use API calls.");
    }
    return importPath;
  }
  if (from === to) {
    return importPath;
  }
  if (from === "frontend" && to === "shared") {
    return `../../shared/${importPath}`;
  }
  if (from === "backend" && to === "shared") {
    return `../../shared/${importPath}`;
  }
  return importPath;
}
function getApiBaseUrl(config) {
  const { outputStructure = "monorepo", apiBaseUrl } = config;
  if (apiBaseUrl) {
    return apiBaseUrl;
  }
  if (outputStructure === "standalone") {
    return "${VITE_API_BASE_URL}";
  }
  const port = config.serverPort || 3e3;
  return `http://localhost:${port}`;
}
function getPathConfig(context) {
  return {
    outputStructure: context.configuration?.outputStructure || "monorepo",
    backendDir: context.configuration?.backendDir || "backend",
    frontendDir: context.configuration?.frontendDir || "frontend",
    baseDir: context.configuration?.baseDir || ".",
    apiBaseUrl: context.configuration?.apiBaseUrl,
    serverPort: context.configuration?.environments?.development?.server?.port || context.manifest?.configuration?.environments?.development?.server?.port
  };
}
export {
  getApiBaseUrl,
  getPathConfig,
  resolveImportPath,
  resolvePath
};
