import f from "react";
import a from "../../../../../../_virtual/index5.js";
import G from "../../../../popper.js@1.16.1/node_modules/popper.js/dist/esm/popper.js";
import B from "../../../../../../_virtual/cjs.js";
import P from "../../../../is-lite@0.8.2/node_modules/is-lite/esm/index.js";
import ne from "../../../../tree-changes@0.9.3/node_modules/tree-changes/esm/index.js";
import L from "react-dom";
function z(t, r) {
  var o = Object.keys(t);
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(t);
    r && (i = i.filter(function(e) {
      return Object.getOwnPropertyDescriptor(t, e).enumerable;
    })), o.push.apply(o, i);
  }
  return o;
}
function y(t) {
  for (var r = 1; r < arguments.length; r++) {
    var o = arguments[r] != null ? arguments[r] : {};
    r % 2 ? z(Object(o), !0).forEach(function(i) {
      O(t, i, o[i]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : z(Object(o)).forEach(function(i) {
      Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(o, i));
    });
  }
  return t;
}
function A(t, r) {
  if (!(t instanceof r))
    throw new TypeError("Cannot call a class as a function");
}
function re(t, r) {
  for (var o = 0; o < r.length; o++) {
    var i = r[o];
    i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, K(i.key), i);
  }
}
function x(t, r, o) {
  return r && re(t.prototype, r), Object.defineProperty(t, "prototype", {
    writable: !1
  }), t;
}
function O(t, r, o) {
  return r = K(r), r in t ? Object.defineProperty(t, r, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[r] = o, t;
}
function S(t, r) {
  if (typeof r != "function" && r !== null)
    throw new TypeError("Super expression must either be null or a function");
  t.prototype = Object.create(r && r.prototype, {
    constructor: {
      value: t,
      writable: !0,
      configurable: !0
    }
  }), Object.defineProperty(t, "prototype", {
    writable: !1
  }), r && $(t, r);
}
function D(t) {
  return D = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  }, D(t);
}
function $(t, r) {
  return $ = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(i, e) {
    return i.__proto__ = e, i;
  }, $(t, r);
}
function oe() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
  if (typeof Proxy == "function") return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function ie(t, r) {
  if (t == null) return {};
  var o = {}, i = Object.keys(t), e, n;
  for (n = 0; n < i.length; n++)
    e = i[n], !(r.indexOf(e) >= 0) && (o[e] = t[e]);
  return o;
}
function V(t, r) {
  if (t == null) return {};
  var o = ie(t, r), i, e;
  if (Object.getOwnPropertySymbols) {
    var n = Object.getOwnPropertySymbols(t);
    for (e = 0; e < n.length; e++)
      i = n[e], !(r.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(t, i) && (o[i] = t[i]);
  }
  return o;
}
function k(t) {
  if (t === void 0)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return t;
}
function ae(t, r) {
  if (r && (typeof r == "object" || typeof r == "function"))
    return r;
  if (r !== void 0)
    throw new TypeError("Derived constructors may only return object or undefined");
  return k(t);
}
function N(t) {
  var r = oe();
  return function() {
    var i = D(t), e;
    if (r) {
      var n = D(this).constructor;
      e = Reflect.construct(i, arguments, n);
    } else
      e = i.apply(this, arguments);
    return ae(this, e);
  };
}
function se(t, r) {
  if (typeof t != "object" || t === null) return t;
  var o = t[Symbol.toPrimitive];
  if (o !== void 0) {
    var i = o.call(t, r);
    if (typeof i != "object") return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (r === "string" ? String : Number)(t);
}
function K(t) {
  var r = se(t, "string");
  return typeof r == "symbol" ? r : String(r);
}
var le = { flip: { padding: 20 }, preventOverflow: { padding: 10 } }, pe = "The typeValidator argument must be a function with the signature function(props, propName, componentName).", fe = "The error message is optional, but must be a string if provided.";
function ue(t, r, o, i) {
  return typeof t == "boolean" ? t : typeof t == "function" ? t(r, o, i) : t ? !!t : !1;
}
function ce(t, r) {
  return Object.hasOwnProperty.call(t, r);
}
function de(t, r, o, i) {
  return new Error("Required ".concat(t[r], " `").concat(r, "` was not specified in `").concat(o, "`."));
}
function he(t, r) {
  if (typeof t != "function")
    throw new TypeError(pe);
  if (r && typeof r != "string")
    throw new TypeError(fe);
}
function U(t, r, o) {
  return he(t, o), function(i, e, n) {
    for (var l = arguments.length, p = new Array(l > 3 ? l - 3 : 0), s = 3; s < l; s++)
      p[s - 3] = arguments[s];
    return ue(r, i, e, n) ? ce(i, e) ? t.apply(void 0, [i, e, n].concat(p)) : de(i, e, n) : t.apply(void 0, [i, e, n].concat(p));
  };
}
var c = { INIT: "init", IDLE: "idle", OPENING: "opening", OPEN: "open", CLOSING: "closing" }, T = L.createPortal !== void 0;
function _() {
  return !!(typeof window < "u" && window.document && window.document.createElement);
}
function q() {
  return "ontouchstart" in window && /Mobi/.test(navigator.userAgent);
}
function j(t) {
  var r = t.title, o = t.data, i = t.warn, e = i === void 0 ? !1 : i, n = t.debug, l = n === void 0 ? !1 : n, p = e ? console.warn || console.error : console.log;
  l && r && o && (console.groupCollapsed("%creact-floater: ".concat(r), "color: #9b00ff; font-weight: bold; font-size: 12px;"), Array.isArray(o) ? o.forEach(function(s) {
    P.plainObject(s) && s.key ? p.apply(console, [s.key, s.value]) : p.apply(console, [s]);
  }) : p.apply(console, [o]), console.groupEnd());
}
function ge(t, r, o) {
  var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
  t.addEventListener(r, o, i);
}
function me(t, r, o) {
  var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
  t.removeEventListener(r, o, i);
}
function ve(t, r, o) {
  var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, e;
  e = function(l) {
    o(l), me(t, r, e);
  }, ge(t, r, e, i);
}
function H() {
}
var Y = /* @__PURE__ */ function(t) {
  S(o, t);
  var r = N(o);
  function o() {
    return A(this, o), r.apply(this, arguments);
  }
  return x(o, [{ key: "componentDidMount", value: function() {
    _() && (this.node || this.appendNode(), T || this.renderPortal());
  } }, { key: "componentDidUpdate", value: function() {
    _() && (T || this.renderPortal());
  } }, { key: "componentWillUnmount", value: function() {
    !_() || !this.node || (T || L.unmountComponentAtNode(this.node), this.node && this.node.parentNode === document.body && (document.body.removeChild(this.node), this.node = void 0));
  } }, { key: "appendNode", value: function() {
    var e = this.props, n = e.id, l = e.zIndex;
    this.node || (this.node = document.createElement("div"), n && (this.node.id = n), l && (this.node.style.zIndex = l), document.body.appendChild(this.node));
  } }, { key: "renderPortal", value: function() {
    if (!_()) return null;
    var e = this.props, n = e.children, l = e.setRef;
    if (this.node || this.appendNode(), T)
      return /* @__PURE__ */ L.createPortal(n, this.node);
    var p = L.unstable_renderSubtreeIntoContainer(this, n.length > 1 ? /* @__PURE__ */ f.createElement("div", null, n) : n[0], this.node);
    return l(p), null;
  } }, { key: "renderReact16", value: function() {
    var e = this.props, n = e.hasChildren, l = e.placement, p = e.target;
    return n ? this.renderPortal() : p || l === "center" ? this.renderPortal() : null;
  } }, { key: "render", value: function() {
    return T ? this.renderReact16() : null;
  } }]), o;
}(f.Component);
O(Y, "propTypes", { children: a.oneOfType([a.element, a.array]), hasChildren: a.bool, id: a.oneOfType([a.string, a.number]), placement: a.string, setRef: a.func.isRequired, target: a.oneOfType([a.object, a.string]), zIndex: a.number });
var Z = /* @__PURE__ */ function(t) {
  S(o, t);
  var r = N(o);
  function o() {
    return A(this, o), r.apply(this, arguments);
  }
  return x(o, [{ key: "parentStyle", get: function() {
    var e = this.props, n = e.placement, l = e.styles, p = l.arrow.length, s = { pointerEvents: "none", position: "absolute", width: "100%" };
    return n.startsWith("top") ? (s.bottom = 0, s.left = 0, s.right = 0, s.height = p) : n.startsWith("bottom") ? (s.left = 0, s.right = 0, s.top = 0, s.height = p) : n.startsWith("left") ? (s.right = 0, s.top = 0, s.bottom = 0) : n.startsWith("right") && (s.left = 0, s.top = 0), s;
  } }, { key: "render", value: function() {
    var e = this.props, n = e.placement, l = e.setArrowRef, p = e.styles, s = p.arrow, d = s.color, u = s.display, m = s.length, g = s.margin, v = s.position, E = s.spread, b = { display: u, position: v }, C, R = E, h = m;
    return n.startsWith("top") ? (C = "0,0 ".concat(R / 2, ",").concat(h, " ").concat(R, ",0"), b.bottom = 0, b.marginLeft = g, b.marginRight = g) : n.startsWith("bottom") ? (C = "".concat(R, ",").concat(h, " ").concat(R / 2, ",0 0,").concat(h), b.top = 0, b.marginLeft = g, b.marginRight = g) : n.startsWith("left") ? (h = E, R = m, C = "0,0 ".concat(R, ",").concat(h / 2, " 0,").concat(h), b.right = 0, b.marginTop = g, b.marginBottom = g) : n.startsWith("right") && (h = E, R = m, C = "".concat(R, ",").concat(h, " ").concat(R, ",0 0,").concat(h / 2), b.left = 0, b.marginTop = g, b.marginBottom = g), /* @__PURE__ */ f.createElement("div", { className: "__floater__arrow", style: this.parentStyle }, /* @__PURE__ */ f.createElement("span", { ref: l, style: b }, /* @__PURE__ */ f.createElement("svg", { width: R, height: h, version: "1.1", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ f.createElement("polygon", { points: C, fill: d }))));
  } }]), o;
}(f.Component);
O(Z, "propTypes", { placement: a.string.isRequired, setArrowRef: a.func.isRequired, styles: a.object.isRequired });
var ye = ["color", "height", "width"];
function J(t) {
  var r = t.handleClick, o = t.styles, i = o.color, e = o.height, n = o.width, l = V(o, ye);
  return /* @__PURE__ */ f.createElement("button", { "aria-label": "close", onClick: r, style: l, type: "button" }, /* @__PURE__ */ f.createElement("svg", { width: "".concat(n, "px"), height: "".concat(e, "px"), viewBox: "0 0 18 18", version: "1.1", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid" }, /* @__PURE__ */ f.createElement("g", null, /* @__PURE__ */ f.createElement("path", { d: "M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z", fill: i }))));
}
J.propTypes = { handleClick: a.func.isRequired, styles: a.object.isRequired };
function Q(t) {
  var r = t.content, o = t.footer, i = t.handleClick, e = t.open, n = t.positionWrapper, l = t.showCloseButton, p = t.title, s = t.styles, d = { content: /* @__PURE__ */ f.isValidElement(r) ? r : /* @__PURE__ */ f.createElement("div", { className: "__floater__content", style: s.content }, r) };
  return p && (d.title = /* @__PURE__ */ f.isValidElement(p) ? p : /* @__PURE__ */ f.createElement("div", { className: "__floater__title", style: s.title }, p)), o && (d.footer = /* @__PURE__ */ f.isValidElement(o) ? o : /* @__PURE__ */ f.createElement("div", { className: "__floater__footer", style: s.footer }, o)), (l || n) && !P.boolean(e) && (d.close = /* @__PURE__ */ f.createElement(J, { styles: s.close, handleClick: i })), /* @__PURE__ */ f.createElement("div", { className: "__floater__container", style: s.container }, d.close, d.title, d.content, d.footer);
}
Q.propTypes = { content: a.node.isRequired, footer: a.node, handleClick: a.func.isRequired, open: a.bool, positionWrapper: a.bool.isRequired, showCloseButton: a.bool.isRequired, styles: a.object.isRequired, title: a.node };
var X = /* @__PURE__ */ function(t) {
  S(o, t);
  var r = N(o);
  function o() {
    return A(this, o), r.apply(this, arguments);
  }
  return x(o, [{ key: "style", get: function() {
    var e = this.props, n = e.disableAnimation, l = e.component, p = e.placement, s = e.hideArrow, d = e.status, u = e.styles, m = u.arrow.length, g = u.floater, v = u.floaterCentered, E = u.floaterClosing, b = u.floaterOpening, C = u.floaterWithAnimation, R = u.floaterWithComponent, h = {};
    return s || (p.startsWith("top") ? h.padding = "0 0 ".concat(m, "px") : p.startsWith("bottom") ? h.padding = "".concat(m, "px 0 0") : p.startsWith("left") ? h.padding = "0 ".concat(m, "px 0 0") : p.startsWith("right") && (h.padding = "0 0 0 ".concat(m, "px"))), [c.OPENING, c.OPEN].indexOf(d) !== -1 && (h = y(y({}, h), b)), d === c.CLOSING && (h = y(y({}, h), E)), d === c.OPEN && !n && (h = y(y({}, h), C)), p === "center" && (h = y(y({}, h), v)), l && (h = y(y({}, h), R)), y(y({}, g), h);
  } }, { key: "render", value: function() {
    var e = this.props, n = e.component, l = e.handleClick, p = e.hideArrow, s = e.setFloaterRef, d = e.status, u = {}, m = ["__floater"];
    return n ? /* @__PURE__ */ f.isValidElement(n) ? u.content = /* @__PURE__ */ f.cloneElement(n, { closeFn: l }) : u.content = n({ closeFn: l }) : u.content = /* @__PURE__ */ f.createElement(Q, this.props), d === c.OPEN && m.push("__floater__open"), p || (u.arrow = /* @__PURE__ */ f.createElement(Z, this.props)), /* @__PURE__ */ f.createElement("div", { ref: s, className: m.join(" "), style: this.style }, /* @__PURE__ */ f.createElement("div", { className: "__floater__body" }, u.content, u.arrow));
  } }]), o;
}(f.Component);
O(X, "propTypes", { component: a.oneOfType([a.func, a.element]), content: a.node, disableAnimation: a.bool.isRequired, footer: a.node, handleClick: a.func.isRequired, hideArrow: a.bool.isRequired, open: a.bool, placement: a.string.isRequired, positionWrapper: a.bool.isRequired, setArrowRef: a.func.isRequired, setFloaterRef: a.func.isRequired, showCloseButton: a.bool, status: a.string.isRequired, styles: a.object.isRequired, title: a.node });
var ee = /* @__PURE__ */ function(t) {
  S(o, t);
  var r = N(o);
  function o() {
    return A(this, o), r.apply(this, arguments);
  }
  return x(o, [{ key: "render", value: function() {
    var e = this.props, n = e.children, l = e.handleClick, p = e.handleMouseEnter, s = e.handleMouseLeave, d = e.setChildRef, u = e.setWrapperRef, m = e.style, g = e.styles, v;
    if (n)
      if (f.Children.count(n) === 1)
        if (!/* @__PURE__ */ f.isValidElement(n))
          v = /* @__PURE__ */ f.createElement("span", null, n);
        else {
          var E = P.function(n.type) ? "innerRef" : "ref";
          v = /* @__PURE__ */ f.cloneElement(f.Children.only(n), O({}, E, d));
        }
      else
        v = n;
    return v ? /* @__PURE__ */ f.createElement("span", { ref: u, style: y(y({}, g), m), onClick: l, onMouseEnter: p, onMouseLeave: s }, v) : null;
  } }]), o;
}(f.Component);
O(ee, "propTypes", { children: a.node, handleClick: a.func.isRequired, handleMouseEnter: a.func.isRequired, handleMouseLeave: a.func.isRequired, setChildRef: a.func.isRequired, setWrapperRef: a.func.isRequired, style: a.object, styles: a.object.isRequired });
var be = { zIndex: 100 };
function we(t) {
  var r = B(be, t.options || {});
  return { wrapper: { cursor: "help", display: "inline-flex", flexDirection: "column", zIndex: r.zIndex }, wrapperPosition: { left: -1e3, position: "absolute", top: -1e3, visibility: "hidden" }, floater: { display: "inline-block", filter: "drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))", maxWidth: 300, opacity: 0, position: "relative", transition: "opacity 0.3s", visibility: "hidden", zIndex: r.zIndex }, floaterOpening: { opacity: 1, visibility: "visible" }, floaterWithAnimation: { opacity: 1, transition: "opacity 0.3s, transform 0.2s", visibility: "visible" }, floaterWithComponent: { maxWidth: "100%" }, floaterClosing: { opacity: 0, visibility: "visible" }, floaterCentered: { left: "50%", position: "fixed", top: "50%", transform: "translate(-50%, -50%)" }, container: { backgroundColor: "#fff", color: "#666", minHeight: 60, minWidth: 200, padding: 20, position: "relative", zIndex: 10 }, title: { borderBottom: "1px solid #555", color: "#555", fontSize: 18, marginBottom: 5, paddingBottom: 6, paddingRight: 18 }, content: { fontSize: 15 }, close: { backgroundColor: "transparent", border: 0, borderRadius: 0, color: "#555", fontSize: 0, height: 15, outline: "none", padding: 10, position: "absolute", right: 0, top: 0, width: 15, WebkitAppearance: "none" }, footer: { borderTop: "1px solid #ccc", fontSize: 13, marginTop: 10, paddingTop: 5 }, arrow: { color: "#fff", display: "inline-flex", length: 16, margin: 8, position: "absolute", spread: 32 }, options: r };
}
var Re = ["arrow", "flip", "offset"], Oe = ["position", "top", "right", "bottom", "left"], te = /* @__PURE__ */ function(t) {
  S(o, t);
  var r = N(o);
  function o(i) {
    var e;
    return A(this, o), e = r.call(this, i), O(k(e), "setArrowRef", function(n) {
      e.arrowRef = n;
    }), O(k(e), "setChildRef", function(n) {
      e.childRef = n;
    }), O(k(e), "setFloaterRef", function(n) {
      e.floaterRef = n;
    }), O(k(e), "setWrapperRef", function(n) {
      e.wrapperRef = n;
    }), O(k(e), "handleTransitionEnd", function() {
      var n = e.state.status, l = e.props.callback;
      e.wrapperPopper && e.wrapperPopper.instance.update(), e.setState({ status: n === c.OPENING ? c.OPEN : c.IDLE }, function() {
        var p = e.state.status;
        l(p === c.OPEN ? "open" : "close", e.props);
      });
    }), O(k(e), "handleClick", function() {
      var n = e.props, l = n.event, p = n.open;
      if (!P.boolean(p)) {
        var s = e.state, d = s.positionWrapper, u = s.status;
        (e.event === "click" || e.event === "hover" && d) && (j({ title: "click", data: [{ event: l, status: u === c.OPEN ? "closing" : "opening" }], debug: e.debug }), e.toggle());
      }
    }), O(k(e), "handleMouseEnter", function() {
      var n = e.props, l = n.event, p = n.open;
      if (!(P.boolean(p) || q())) {
        var s = e.state.status;
        e.event === "hover" && s === c.IDLE && (j({ title: "mouseEnter", data: [{ key: "originalEvent", value: l }], debug: e.debug }), clearTimeout(e.eventDelayTimeout), e.toggle());
      }
    }), O(k(e), "handleMouseLeave", function() {
      var n = e.props, l = n.event, p = n.eventDelay, s = n.open;
      if (!(P.boolean(s) || q())) {
        var d = e.state, u = d.status, m = d.positionWrapper;
        e.event === "hover" && (j({ title: "mouseLeave", data: [{ key: "originalEvent", value: l }], debug: e.debug }), p ? [c.OPENING, c.OPEN].indexOf(u) !== -1 && !m && !e.eventDelayTimeout && (e.eventDelayTimeout = setTimeout(function() {
          delete e.eventDelayTimeout, e.toggle();
        }, p * 1e3)) : e.toggle(c.IDLE));
      }
    }), e.state = { currentPlacement: i.placement, needsUpdate: !1, positionWrapper: i.wrapperOptions.position && !!i.target, status: c.INIT, statusWrapper: c.INIT }, e._isMounted = !1, e.hasMounted = !1, _() && window.addEventListener("load", function() {
      e.popper && e.popper.instance.update(), e.wrapperPopper && e.wrapperPopper.instance.update();
    }), e;
  }
  return x(o, [{ key: "componentDidMount", value: function() {
    if (_()) {
      var e = this.state.positionWrapper, n = this.props, l = n.children, p = n.open, s = n.target;
      this._isMounted = !0, j({ title: "init", data: { hasChildren: !!l, hasTarget: !!s, isControlled: P.boolean(p), positionWrapper: e, target: this.target, floater: this.floaterRef }, debug: this.debug }), this.hasMounted || (this.initPopper(), this.hasMounted = !0), !l && s && P.boolean(p);
    }
  } }, { key: "componentDidUpdate", value: function(e, n) {
    if (_()) {
      var l = this.props, p = l.autoOpen, s = l.open, d = l.target, u = l.wrapperOptions, m = ne(n, this.state), g = m.changedFrom, v = m.changed;
      if (e.open !== s) {
        var E;
        P.boolean(s) && (E = s ? c.OPENING : c.CLOSING), this.toggle(E);
      }
      (e.wrapperOptions.position !== u.position || e.target !== d) && this.changeWrapperPosition(this.props), v("status", c.IDLE) && s ? this.toggle(c.OPEN) : g("status", c.INIT, c.IDLE) && p && this.toggle(c.OPEN), this.popper && v("status", c.OPENING) && this.popper.instance.update(), this.floaterRef && (v("status", c.OPENING) || v("status", c.CLOSING)) && ve(this.floaterRef, "transitionend", this.handleTransitionEnd), v("needsUpdate", !0) && this.rebuildPopper();
    }
  } }, { key: "componentWillUnmount", value: function() {
    _() && (this._isMounted = !1, this.popper && this.popper.instance.destroy(), this.wrapperPopper && this.wrapperPopper.instance.destroy());
  } }, { key: "initPopper", value: function() {
    var e = this, n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.target, l = this.state.positionWrapper, p = this.props, s = p.disableFlip, d = p.getPopper, u = p.hideArrow, m = p.offset, g = p.placement, v = p.wrapperOptions, E = g === "top" || g === "bottom" ? "flip" : ["right", "bottom-end", "top-end", "left", "top-start", "bottom-start"];
    if (g === "center")
      this.setState({ status: c.IDLE });
    else if (n && this.floaterRef) {
      var b = this.options, C = b.arrow, R = b.flip, h = b.offset, M = V(b, Re);
      new G(n, this.floaterRef, { placement: g, modifiers: y({ arrow: y({ enabled: !u, element: this.arrowRef }, C), flip: y({ enabled: !s, behavior: E }, R), offset: y({ offset: "0, ".concat(m, "px") }, h) }, M), onCreate: function(w) {
        var I;
        if (e.popper = w, !((I = e.floaterRef) !== null && I !== void 0 && I.isConnected)) {
          e.setState({ needsUpdate: !0 });
          return;
        }
        d(w, "floater"), e._isMounted && e.setState({ currentPlacement: w.placement, status: c.IDLE }), g !== w.placement && setTimeout(function() {
          w.instance.update();
        }, 1);
      }, onUpdate: function(w) {
        e.popper = w;
        var I = e.state.currentPlacement;
        e._isMounted && w.placement !== I && e.setState({ currentPlacement: w.placement });
      } });
    }
    if (l) {
      var F = P.undefined(v.offset) ? 0 : v.offset;
      new G(this.target, this.wrapperRef, { placement: v.placement || g, modifiers: { arrow: { enabled: !1 }, offset: { offset: "0, ".concat(F, "px") }, flip: { enabled: !1 } }, onCreate: function(w) {
        e.wrapperPopper = w, e._isMounted && e.setState({ statusWrapper: c.IDLE }), d(w, "wrapper"), g !== w.placement && setTimeout(function() {
          w.instance.update();
        }, 1);
      } });
    }
  } }, { key: "rebuildPopper", value: function() {
    var e = this;
    this.floaterRefInterval = setInterval(function() {
      var n;
      (n = e.floaterRef) !== null && n !== void 0 && n.isConnected && (clearInterval(e.floaterRefInterval), e.setState({ needsUpdate: !1 }), e.initPopper());
    }, 50);
  } }, { key: "changeWrapperPosition", value: function(e) {
    var n = e.target, l = e.wrapperOptions;
    this.setState({ positionWrapper: l.position && !!n });
  } }, { key: "toggle", value: function(e) {
    var n = this.state.status, l = n === c.OPEN ? c.CLOSING : c.OPENING;
    P.undefined(e) || (l = e), this.setState({ status: l });
  } }, { key: "debug", get: function() {
    var e = this.props.debug;
    return e || _() && "ReactFloaterDebug" in window && !!window.ReactFloaterDebug;
  } }, { key: "event", get: function() {
    var e = this.props, n = e.disableHoverToClick, l = e.event;
    return l === "hover" && q() && !n ? "click" : l;
  } }, { key: "options", get: function() {
    var e = this.props.options;
    return B(le, e || {});
  } }, { key: "styles", get: function() {
    var e = this, n = this.state, l = n.status, p = n.positionWrapper, s = n.statusWrapper, d = this.props.styles, u = B(we(d), d);
    if (p) {
      var m;
      [c.IDLE].indexOf(l) === -1 || [c.IDLE].indexOf(s) === -1 ? m = u.wrapperPosition : m = this.wrapperPopper.styles, u.wrapper = y(y({}, u.wrapper), m);
    }
    if (this.target) {
      var g = window.getComputedStyle(this.target);
      this.wrapperStyles ? u.wrapper = y(y({}, u.wrapper), this.wrapperStyles) : ["relative", "static"].indexOf(g.position) === -1 && (this.wrapperStyles = {}, p || (Oe.forEach(function(v) {
        e.wrapperStyles[v] = g[v];
      }), u.wrapper = y(y({}, u.wrapper), this.wrapperStyles), this.target.style.position = "relative", this.target.style.top = "auto", this.target.style.right = "auto", this.target.style.bottom = "auto", this.target.style.left = "auto"));
    }
    return u;
  } }, { key: "target", get: function() {
    if (!_()) return null;
    var e = this.props.target;
    return e ? P.domElement(e) ? e : document.querySelector(e) : this.childRef || this.wrapperRef;
  } }, { key: "render", value: function() {
    var e = this.state, n = e.currentPlacement, l = e.positionWrapper, p = e.status, s = this.props, d = s.children, u = s.component, m = s.content, g = s.disableAnimation, v = s.footer, E = s.hideArrow, b = s.id, C = s.open, R = s.showCloseButton, h = s.style, M = s.target, F = s.title, W = /* @__PURE__ */ f.createElement(ee, { handleClick: this.handleClick, handleMouseEnter: this.handleMouseEnter, handleMouseLeave: this.handleMouseLeave, setChildRef: this.setChildRef, setWrapperRef: this.setWrapperRef, style: h, styles: this.styles.wrapper }, d), w = {};
    return l ? w.wrapperInPortal = W : w.wrapperAsChildren = W, /* @__PURE__ */ f.createElement("span", null, /* @__PURE__ */ f.createElement(Y, { hasChildren: !!d, id: b, placement: n, setRef: this.setFloaterRef, target: M, zIndex: this.styles.options.zIndex }, /* @__PURE__ */ f.createElement(X, { component: u, content: m, disableAnimation: g, footer: v, handleClick: this.handleClick, hideArrow: E || n === "center", open: C, placement: n, positionWrapper: l, setArrowRef: this.setArrowRef, setFloaterRef: this.setFloaterRef, showCloseButton: R, status: p, styles: this.styles, title: F }), w.wrapperInPortal), w.wrapperAsChildren);
  } }]), o;
}(f.Component);
O(te, "propTypes", { autoOpen: a.bool, callback: a.func, children: a.node, component: U(a.oneOfType([a.func, a.element]), function(t) {
  return !t.content;
}), content: U(a.node, function(t) {
  return !t.component;
}), debug: a.bool, disableAnimation: a.bool, disableFlip: a.bool, disableHoverToClick: a.bool, event: a.oneOf(["hover", "click"]), eventDelay: a.number, footer: a.node, getPopper: a.func, hideArrow: a.bool, id: a.oneOfType([a.string, a.number]), offset: a.number, open: a.bool, options: a.object, placement: a.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto", "center"]), showCloseButton: a.bool, style: a.object, styles: a.object, target: a.oneOfType([a.object, a.string]), title: a.node, wrapperOptions: a.shape({ offset: a.number, placement: a.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto"]), position: a.bool }) });
O(te, "defaultProps", { autoOpen: !1, callback: H, debug: !1, disableAnimation: !1, disableFlip: !1, disableHoverToClick: !1, event: "click", eventDelay: 0.4, getPopper: H, hideArrow: !1, offset: 15, placement: "bottom", showCloseButton: !1, styles: {}, target: null, wrapperOptions: { position: !1 } });
export {
  te as default
};
//# sourceMappingURL=index.js.map
