import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  Spinner,
  Text,
  require_lib,
  require_react,
  useAsync,
  useDevCenterClient,
  useProjectModel
} from "./chunk-ESTYQVMX.js";
import {
  __toESM,
  init_esm_shims
} from "./chunk-4EFJZ3GQ.js";

// src/components/AddPermissionCommand/index.ts
init_esm_shims();

// src/components/AddPermissionCommand/AddPermissionCommand.tsx
init_esm_shims();
var import_react = __toESM(require_react(), 1);
var import_variant = __toESM(require_lib(), 1);
var AddPermissionCommand = ({ permissionId }) => {
  const { model } = useProjectModel();
  const { addPermission } = useDevCenterClient();
  const { status } = useAsync(async () => {
    const data = await addPermission({
      appId: model.config.appId,
      permissionId
    });
    return data;
  }, []);
  return (0, import_variant.match)(status, {
    Loading: () => /* @__PURE__ */ import_react.default.createElement(Spinner, null),
    Error: () => null,
    Success: () => /* @__PURE__ */ import_react.default.createElement(Text, null, "Permission added successfully")
  });
};
export {
  AddPermissionCommand
};
//# sourceMappingURL=AddPermissionCommand-7QIFVBXV.js.map