import { j as t, b as d, B as n, G as p, I as m } from "./index-c65ca4a4.mjs";
const c = ({ label: s, text: e = "", hint: i, onRegenerate: a }) => {
  const [o, r] = d(!1), l = () => {
    navigator.clipboard.writeText(e), r(!0), setTimeout(() => r(!1), 2e3);
  };
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
    /* @__PURE__ */ t.jsx("div", { className: "p-0 pr-4 text-sm text-grey-600 md:py-1", children: s }),
    /* @__PURE__ */ t.jsxs("div", { className: "group/api-keys relative mb-3 overflow-hidden rounded py-1 text-sm hover:bg-grey-50 md:mb-0 md:p-1", children: [
      e,
      i,
      /* @__PURE__ */ t.jsxs("div", { className: "visible absolute right-0 top-[50%] flex translate-y-[-50%] gap-1 bg-white pl-1 text-sm group-hover/api-keys:visible md:invisible", children: [
        a && /* @__PURE__ */ t.jsx(n, { color: "outline", label: "Regenerate", size: "sm", onClick: a }),
        /* @__PURE__ */ t.jsx(n, { color: "outline", label: o ? "Copied" : "Copy", size: "sm", onClick: l })
      ] })
    ] })
  ] });
}, u = ({ keys: s }) => /* @__PURE__ */ t.jsx("div", { className: "grid grid-cols-1 md:grid-cols-[max-content_1fr]", children: s.map((e) => /* @__PURE__ */ t.jsx(c, { ...e }, e.label)) }), x = p({
  method: "POST",
  path: ({ integrationId: s, apiKeyId: e }) => `/integrations/${s}/api_key/${e}/refresh/`,
  body: ({ integrationId: s }) => ({ integrations: [{ id: s }] }),
  updateQueries: {
    dataType: m,
    update: (s, e) => e && {
      ...e,
      integrations: e.integrations.map((i) => s.integrations.find(({ id: o }) => o === i.id) || i)
    }
  }
});
export {
  u as A,
  x as u
};
//# sourceMappingURL=apiKeys-03faf508.mjs.map
