import { N as i, u as m, a as c, b as l, c as u, d as g, e as f, H as p, L as h, j as o, M as x, T as I } from "./index-c65ca4a4.mjs";
import { F as L } from "./Form-f4ced0f0.mjs";
const M = () => {
  const s = m(), { updateRoute: a } = c(), [n, r] = l(""), { mutateAsync: d } = u(), e = g();
  return f(() => {
    e != null && e.isLimited("customIntegrations") && e.errorIfWouldGoOverLimit("customIntegrations").catch((t) => {
      t instanceof p && (i.show(h, {
        prompt: t.message || "Your current plan doesn't support more custom integrations."
      }), s.remove(), a("integrations"));
    });
  }, [e, s, a]), /* @__PURE__ */ o.jsx(
    x,
    {
      afterClose: () => {
        a("integrations");
      },
      okColor: "black",
      okLabel: "Add",
      size: "sm",
      testId: "add-integration-modal",
      title: "Add integration",
      onOk: async () => {
        const t = await d({ name: n });
        s.remove(), a({ route: `integrations/show/${t.integrations[0].id}` });
      },
      children: /* @__PURE__ */ o.jsx("div", { className: "mt-5", children: /* @__PURE__ */ o.jsx(
        L,
        {
          marginBottom: !1,
          marginTop: !1,
          children: /* @__PURE__ */ o.jsx(
            I,
            {
              placeholder: "Custom integration",
              title: "Name",
              value: n,
              onChange: (t) => r(t.target.value)
            }
          )
        }
      ) })
    }
  );
}, A = i.create(M);
export {
  A as default
};
//# sourceMappingURL=AddIntegrationModal-74b358a4.mjs.map
