import { jsxs as U, Fragment as I, jsx as T } from "react/jsx-runtime";
import { useState as A } from "react";
import { u as O, aH as _, W as S } from "./index-C62tPk5p.js";
var P = /* @__PURE__ */ ((r) => (r.ACCOUNTS_STEP = "accounts", r.EVENT_TYPES_STEP = "event-types", r.CONFIGURE_STEP = "configure", r))(P || {}), s = {}, E, C;
function x() {
  if (C) return E;
  C = 1;
  function r(e, n) {
    return Object.prototype.hasOwnProperty.call(e, n);
  }
  return E = function(e, n, t, u) {
    n = n || "&", t = t || "=";
    var o = {};
    if (typeof e != "string" || e.length === 0)
      return o;
    var c = /\+/g;
    e = e.split(n);
    var a = 1e3;
    u && typeof u.maxKeys == "number" && (a = u.maxKeys);
    var d = e.length;
    a > 0 && d > a && (d = a);
    for (var p = 0; p < d; ++p) {
      var f = e[p].replace(c, "%20"), m = f.indexOf(t), y, g, i, l;
      m >= 0 ? (y = f.substr(0, m), g = f.substr(m + 1)) : (y = f, g = ""), i = decodeURIComponent(y), l = decodeURIComponent(g), r(o, i) ? Array.isArray(o[i]) ? o[i].push(l) : o[i] = [o[i], l] : o[i] = l;
    }
    return o;
  }, E;
}
var h, R;
function N() {
  if (R) return h;
  R = 1;
  var r = function(e) {
    switch (typeof e) {
      case "string":
        return e;
      case "boolean":
        return e ? "true" : "false";
      case "number":
        return isFinite(e) ? e : "";
      default:
        return "";
    }
  };
  return h = function(e, n, t, u) {
    return n = n || "&", t = t || "=", e === null && (e = void 0), typeof e == "object" ? Object.keys(e).map(function(o) {
      var c = encodeURIComponent(r(o)) + t;
      return Array.isArray(e[o]) ? e[o].map(function(a) {
        return c + encodeURIComponent(r(a));
      }).join(n) : c + encodeURIComponent(r(e[o]));
    }).filter(Boolean).join(n) : u ? encodeURIComponent(r(u)) + t + encodeURIComponent(r(e)) : "";
  }, h;
}
var v;
function b() {
  return v || (v = 1, s.decode = s.parse = x(), s.encode = s.stringify = N()), s;
}
var w = b();
const B = ({
  slug: r,
  step: e,
  teamId: n
}) => {
  const t = { slug: r };
  n && (t.teamId = n);
  const u = w.stringify(t);
  return `/apps/installation/${e}?${u}`;
};
function M(r) {
  const [e, n] = A(!1), t = O(null), u = () => {
    t.mutate({
      type: "office365_video",
      variant: "conferencing",
      slug: "msteams",
      returnTo: S + B({
        slug: "msteams",
        step: P.EVENT_TYPES_STEP
      })
    });
  };
  return /* @__PURE__ */ U(I, { children: [
    r.render({
      onClick() {
        n(!0);
      },
      disabled: e
    }),
    /* @__PURE__ */ T(_, { open: e, onOpenChange: n, handleSubmit: u })
  ] });
}
export {
  M as default
};
