import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  useBackendAsAServiceClient
} from "./chunk-FEA7FYAB.js";
import {
  useProjectModel
} from "./chunk-RDF2RA4E.js";
import "./chunk-WFQIXGJV.js";
import "./chunk-ECBO3UFC.js";
import "./chunk-YNEGRO3E.js";
import {
  SiteAuthProvider
} from "./chunk-HWT3LUJJ.js";
import "./chunk-TOBTRYZF.js";
import "./chunk-7WVNO7VU.js";
import "./chunk-RPTAJN5Y.js";
import {
  Alert,
  Spinner,
  useAsync
} from "./chunk-YL4347CI.js";
import {
  require_react
} from "./chunk-TODKQSCF.js";
import "./chunk-AFPDHQYI.js";
import "./chunk-HYKBBZLS.js";
import "./chunk-C5RTKQVL.js";
import "./chunk-SVUXJRFD.js";
import "./chunk-YT5BPQDJ.js";
import "./chunk-LU3R3EBR.js";
import "./chunk-XZUGLEBK.js";
import "./chunk-VASURI4S.js";
import "./chunk-SDLCFZRL.js";
import {
  require_lib
} from "./chunk-MTT3QXBC.js";
import {
  __toESM,
  init_esm_shims
} from "./chunk-EXLZF52D.js";

// ../cli-astro-commands/src/components/EnvRemoveCommand/index.ts
init_esm_shims();

// ../cli-astro-commands/src/components/EnvRemoveCommand/EnvRemoveCommand.tsx
init_esm_shims();
var import_react2 = __toESM(require_react(), 1);

// ../cli-astro-commands/src/components/EnvRemoveCommand/EnvRemove.tsx
init_esm_shims();
var import_react = __toESM(require_react(), 1);
var import_variant = __toESM(require_lib(), 1);
var ENV_NAME = "prod";
var EnvRemove = ({ variableKey }) => {
  const { model } = useProjectModel();
  const backendAsAServiceClient = useBackendAsAServiceClient();
  const { status } = useAsync(async () => {
    await backendAsAServiceClient.removeAppEnvironmentVariable(
      model.config.appId,
      ENV_NAME,
      variableKey
    );
  }, []);
  return (0, import_variant.match)(status, {
    Loading: () => /* @__PURE__ */ import_react.default.createElement(Spinner, { text: "Removing environment variable..." }),
    Success: () => /* @__PURE__ */ import_react.default.createElement(Alert, { type: "success" }, '"', variableKey, '" was successfully removed from "', ENV_NAME, `" environment. Note: This only removes the variable from the remote environment. It won't delete it from .env.local.`),
    Error: () => null,
    NotRequested: () => null
  });
};

// ../cli-astro-commands/src/components/EnvRemoveCommand/EnvRemoveCommand.tsx
var EnvRemoveCommand = ({ variableKey }) => {
  const {
    model: { config }
  } = useProjectModel();
  let commandTree = /* @__PURE__ */ import_react2.default.createElement(EnvRemove, { variableKey });
  if (config.projectType === "Site") {
    commandTree = /* @__PURE__ */ import_react2.default.createElement(SiteAuthProvider, { siteId: config.siteId }, commandTree);
  }
  return commandTree;
};
export {
  EnvRemoveCommand
};
//# sourceMappingURL=EnvRemoveCommand-LY52SB46.js.map