import { jsx as o } from "react/jsx-runtime";
import { q as f, r as y, s as E, t as P, W as C } from "./index-T-3isYi5.js";
import { useState as g } from "react";
import { A as v } from "./AppCard-JgJMoBtw.js";
import { u as w } from "./useIsAppEnabled-SudDKIHz.js";
import S from "./EventTypeAppSettingsInterface-D2d9b1Ms.js";
const L = function({
  app: t,
  eventType: e,
  eventTypeFormMetadata: p,
  onAppInstallSuccess: r
}) {
  var n;
  const { t: i } = f(), m = y.usePathname(), { getAppData: a, setAppData: c, disabled: d } = E(), { enabled: l, updateEnabled: u } = w(t), h = P(p), [A, _] = g(a("enabled")), s = !A && h;
  return /* @__PURE__ */ o(
    v,
    {
      onAppInstallSuccess: r,
      returnTo: `${C}${m}?tabName=apps`,
      app: t,
      switchChecked: l,
      switchOnClick: (b) => {
        u(b);
      },
      teamId: ((n = e.team) == null ? void 0 : n.id) || void 0,
      disableSwitch: s,
      switchTooltip: s ? i("other_payment_app_enabled") : void 0,
      children: /* @__PURE__ */ o(
        S,
        {
          eventType: e,
          slug: t.slug,
          disabled: d,
          getAppData: a,
          setAppData: c
        }
      )
    }
  );
};
export {
  L as default
};
