import { jsx as e, Fragment as g } from "react/jsx-runtime";
import { r as i, q as f, s as b, t as S, W as v } from "./index-T-3isYi5.js";
import { useMemo as C, useState as w } from "react";
import { A as E } from "./AppCard-JgJMoBtw.js";
import T from "./EventTypeAppSettingsInterface-I63G3hao.js";
const $ = function({
  app: a,
  eventType: p,
  eventTypeFormMetadata: c,
  onAppInstallSuccess: m
}) {
  const t = i.useSearchParams(), { t: h } = f(), s = i.usePathname(), d = C(
    () => `${s}${t ? `?${t.toString()}` : ""}`,
    [s, t]
  ), { getAppData: n, setAppData: l, disabled: u } = b(), [o, A] = w(n("enabled")), y = S(c), r = !o && y;
  return /* @__PURE__ */ e(
    E,
    {
      onAppInstallSuccess: m,
      returnTo: v + d,
      app: a,
      switchChecked: o,
      switchOnClick: (P) => {
        A(P);
      },
      description: /* @__PURE__ */ e(g, { children: "Add bitcoin lightning payments to your events" }),
      disableSwitch: r,
      switchTooltip: r ? h("other_payment_app_enabled") : void 0,
      children: /* @__PURE__ */ e(
        T,
        {
          eventType: p,
          slug: a.slug,
          disabled: u,
          getAppData: n,
          setAppData: l
        }
      )
    }
  );
};
export {
  $ as default
};
