import {
  findWorkspaceRoot
} from "./chunk-2F7SMIKE.js";
import {
  joinPaths
} from "./chunk-WBQEFUVW.js";
import {
  __name,
  init_esm_shims
} from "./chunk-65NJ2BNV.js";

// src/utilities/get-default-config.ts
init_esm_shims();
import { STORM_DEFAULT_HOMEPAGE, STORM_DEFAULT_LICENSE } from "@storm-software/config";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
var DEFAULT_COLOR_CONFIG = {
  "light": {
    "background": "#fafafa",
    "foreground": "#1d1e22",
    "brand": "#1fb2a6",
    "alternate": "#db2777",
    "help": "#5C4EE5",
    "success": "#087f5b",
    "info": "#0550ae",
    "warning": "#e3b341",
    "danger": "#D8314A",
    "positive": "#22c55e",
    "negative": "#dc2626"
  },
  "dark": {
    "background": "#1d1e22",
    "foreground": "#cbd5e1",
    "brand": "#2dd4bf",
    "alternate": "#db2777",
    "help": "#818cf8",
    "success": "#10b981",
    "info": "#58a6ff",
    "warning": "#f3d371",
    "danger": "#D8314A",
    "positive": "#22c55e",
    "negative": "#dc2626"
  }
};
var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
  let license = STORM_DEFAULT_LICENSE;
  let homepage = STORM_DEFAULT_HOMEPAGE;
  let name = void 0;
  let namespace = void 0;
  let repository = void 0;
  const workspaceRoot = findWorkspaceRoot(root);
  if (existsSync(join(workspaceRoot, "package.json"))) {
    const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
    if (file) {
      const packageJson = JSON.parse(file);
      if (packageJson.name) {
        name = packageJson.name;
      }
      if (packageJson.namespace) {
        namespace = packageJson.namespace;
      }
      if (packageJson.repository) {
        if (typeof packageJson.repository === "string") {
          repository = packageJson.repository;
        } else if (packageJson.repository.url) {
          repository = packageJson.repository.url;
        }
      }
      if (packageJson.license) {
        license = packageJson.license;
      }
      if (packageJson.homepage) {
        homepage = packageJson.homepage;
      }
    }
  }
  return {
    workspaceRoot,
    name,
    namespace,
    repository,
    license,
    homepage,
    docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
    licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`
  };
}, "getDefaultConfig");

export {
  DEFAULT_COLOR_CONFIG,
  getDefaultConfig
};
