import process__default from 'node:process';
import a from './index5.mjs';
import { x as K } from './main.mjs';
import { i18n } from './index2.mjs';
import '../shared/ccjk.BAGoDD49.mjs';
import 'module';
import 'node:child_process';
import 'node:path';
import 'node:stream';
import 'node:readline';
import 'node:fs';
import 'node:url';
import '../shared/ccjk.bQ7Dh1g4.mjs';

async function executeCcusage(args = []) {
  try {
    const command = "npx";
    const commandArgs = ["ccusage@latest", ...args || []];
    console.log(a.green(i18n.t("tools:runningCcusage")));
    console.log(a.gray(`$ npx ccusage@latest ${(args || []).join(" ")}`));
    console.log("");
    await K(command, commandArgs, {
      nodeOptions: {
        stdio: "inherit"
      }
    });
  } catch (error) {
    console.error(a.red(i18n.t("tools:ccusageFailed")));
    console.error(a.yellow(i18n.t("tools:checkNetworkConnection")));
    if (process__default.env.DEBUG) {
      console.error(a.gray(i18n.t("tools:errorDetails")), error);
    }
    if (process__default.env.NODE_ENV !== "test") {
      process__default.exit(1);
    }
    throw error;
  }
}

export { executeCcusage };
