import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  createDependenciesService
} from "./chunk-7A4DW6ND.js";
import "./chunk-3N5KS75V.js";
import {
  useProjectModel
} from "./chunk-VRIBQKXZ.js";
import {
  useVeloClient
} from "./chunk-R5WNFZTS.js";
import "./chunk-RFWFU5ZV.js";
import "./chunk-C7TVBDR6.js";
import "./chunk-KDZXPOOF.js";
import "./chunk-QRGKMYDD.js";
import "./chunk-KUSCYV4K.js";
import "./chunk-NMCF7XG5.js";
import "./chunk-MHV22UIU.js";
import "./chunk-BRX4HWJE.js";
import "./chunk-ZBFOAJ5H.js";
import "./chunk-YNEGRO3E.js";
import "./chunk-YHFCDWGT.js";
import "./chunk-IVQPYJ5M.js";
import {
  Trans
} from "./chunk-MDUBZZTI.js";
import "./chunk-RPTAJN5Y.js";
import {
  Alert,
  Badge,
  Spinner,
  Text,
  useAsync
} from "./chunk-QK47PIWK.js";
import {
  require_react
} from "./chunk-TODKQSCF.js";
import "./chunk-AFPDHQYI.js";
import "./chunk-HYKBBZLS.js";
import "./chunk-C5RTKQVL.js";
import "./chunk-DGJS6KZB.js";
import "./chunk-YT5BPQDJ.js";
import "./chunk-LU3R3EBR.js";
import "./chunk-XZUGLEBK.js";
import "./chunk-AYCGCYN3.js";
import "./chunk-SDLCFZRL.js";
import {
  require_lib
} from "./chunk-WGV2XQSB.js";
import {
  __toESM,
  init_esm_shims
} from "./chunk-EXLZF52D.js";

// ../cli-site/src/components/InstallCommand/InstallCommand.tsx
init_esm_shims();
var import_react = __toESM(require_react(), 1);
var import_variant = __toESM(require_lib(), 1);
var InstallCommand = ({ packageName }) => {
  const { model } = useProjectModel();
  const veloClient = useVeloClient();
  const { status } = useAsync(async () => {
    const { projectFolder } = model;
    const service = await createDependenciesService(projectFolder, veloClient);
    await service.install(packageName);
  }, []);
  return (0, import_variant.match)(status, {
    Loading: () => /* @__PURE__ */ import_react.default.createElement(
      Spinner,
      {
        text: packageName ? /* @__PURE__ */ import_react.default.createElement(
          Trans,
          {
            i18nKey: "install_command.package.loading",
            values: { packageName },
            components: [/* @__PURE__ */ import_react.default.createElement(Text, { bold: true })]
          }
        ) : /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "install_command.all_packages.loading" })
      }
    ),
    Error: () => null,
    Success: () => /* @__PURE__ */ import_react.default.createElement(Alert, { type: "success" }, /* @__PURE__ */ import_react.default.createElement(Badge, { skin: "success" }, /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "general.success" })), " ", packageName ? /* @__PURE__ */ import_react.default.createElement(
      Trans,
      {
        i18nKey: "install_command.package.success",
        values: { packageName },
        components: [/* @__PURE__ */ import_react.default.createElement(Text, { bold: true })]
      }
    ) : /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "install_command.all_packages.success" }))
  });
};
export {
  InstallCommand
};
//# sourceMappingURL=InstallCommand-JWKI54GZ.js.map