import g from "./index-extends.js";
import d from "./index-asyncToGenerator.js";
import p from "./index-defineProperty.js";
import s, { forwardRef as y, Component as P } from "react";
import C from "./index-getCurrentHref.js";
import I from "./index-clearUndefinedProperties.js";
import k from "./index-Process.js";
class a extends P {
  constructor(...r) {
    var e;
    super(...r), e = this, p(
      this,
      "handleClick",
      /* @__PURE__ */ (function() {
        var n = d(function* (i) {
          i.preventDefault();
          const {
            handleProcess: f
          } = e.props;
          return f(
            /* @__PURE__ */ (function() {
              var u = d(function* (t) {
                const {
                  link: c = C(),
                  display: l,
                  appId: m = t.getAppId(),
                  to: h,
                  redirectURI: _
                } = e.props;
                return t.ui(I({
                  method: "send",
                  link: c,
                  display: l,
                  app_id: m,
                  to: h,
                  redirect_uri: _
                }));
              });
              return function(t) {
                return u.apply(this, arguments);
              };
            })()
          );
        });
        return function(i) {
          return n.apply(this, arguments);
        };
      })()
    );
  }
  render() {
    const {
      children: r,
      loading: e
    } = this.props;
    return r({
      loading: e,
      handleClick: this.handleClick
    });
  }
}
p(a, "defaultProps", {
  to: void 0,
  display: void 0,
  appId: void 0,
  redirectURI: void 0
});
y((o, r) => s.createElement(k, null, ({
  loading: e,
  handleProcess: n
}) => s.createElement(a, g({}, o, {
  loading: e,
  handleProcess: n,
  ref: r
}))));
