import { aJ as l, aK as i, ba as m, aP as p } from "./index-GTnBs7av.js";
import { useState as d } from "react";
var a = function(n) {
  switch (typeof n) {
    case "string":
      return n;
    case "boolean":
      return n ? "true" : "false";
    case "number":
      return isFinite(n) ? n : "";
    default:
      return "";
  }
}, E = function(n, t, e, o) {
  return t = t || "&", e = e || "=", n === null && (n = void 0), typeof n == "object" ? Object.keys(n).map(function(r) {
    var s = encodeURIComponent(a(r)) + e;
    return Array.isArray(n[r]) ? n[r].map(function(f) {
      return s + encodeURIComponent(a(f));
    }).join(t) : s + encodeURIComponent(a(n[r]));
  }).filter(Boolean).join(t) : o ? encodeURIComponent(a(o)) + e + encodeURIComponent(a(n)) : "";
}, u;
u = E;
var c = /* @__PURE__ */ ((n) => (n.ACCOUNTS_STEP = "accounts", n.EVENT_TYPES_STEP = "event-types", n.CONFIGURE_STEP = "configure", n))(c || {});
const g = ({
  slug: n,
  step: t,
  teamId: e
}) => {
  const o = { slug: n };
  e && (o.teamId = e);
  const r = u(o);
  return `/apps/installation/${t}?${r}`;
};
function P(n) {
  const [t, e] = d(!1), o = l(null), r = () => {
    o.mutate({
      type: "office365_video",
      variant: "conferencing",
      slug: "msteams",
      returnTo: p + g({
        slug: "msteams",
        step: c.EVENT_TYPES_STEP
      })
    });
  };
  return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
    n.render({
      onClick() {
        e(!0);
      },
      disabled: t
    }),
    /* @__PURE__ */ i.jsx(m, { open: t, onOpenChange: e, handleSubmit: r })
  ] });
}
export {
  P as default
};
