import {
  a as It
} from "./chunk-C72GMZR5.js";
import {
  a as ae
} from "./chunk-ENVCLMEU.js";
import {
  a as Rr
} from "./chunk-VEVXVIEO.js";
import {
  a as n,
  c as Ft,
  e as st
} from "./chunk-IO47FP3U.js";

// ../node_modules/react-fast-compare/index.js
var rr = Ft((_f, tr) => {
  var so = typeof Element < "u", fo = typeof Map == "function", po = typeof Set == "function", uo = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
  function et(e, t) {
    if (e === t) return !0;
    if (e && t && typeof e == "object" && typeof t == "object") {
      if (e.constructor !== t.constructor) return !1;
      var r, o, i;
      if (Array.isArray(e)) {
        if (r = e.length, r != t.length) return !1;
        for (o = r; o-- !== 0; )
          if (!et(e[o], t[o])) return !1;
        return !0;
      }
      var a;
      if (fo && e instanceof Map && t instanceof Map) {
        if (e.size !== t.size) return !1;
        for (a = e.entries(); !(o = a.next()).done; )
          if (!t.has(o.value[0])) return !1;
        for (a = e.entries(); !(o = a.next()).done; )
          if (!et(o.value[1], t.get(o.value[0]))) return !1;
        return !0;
      }
      if (po && e instanceof Set && t instanceof Set) {
        if (e.size !== t.size) return !1;
        for (a = e.entries(); !(o = a.next()).done; )
          if (!t.has(o.value[0])) return !1;
        return !0;
      }
      if (uo && ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
        if (r = e.length, r != t.length) return !1;
        for (o = r; o-- !== 0; )
          if (e[o] !== t[o]) return !1;
        return !0;
      }
      if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
      if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof t.valueOf == "function") return e.valueOf() === t.valueOf();
      if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof t.toString == "function") return e.toString() === t.toString();
      if (i = Object.keys(e), r = i.length, r !== Object.keys(t).length) return !1;
      for (o = r; o-- !== 0; )
        if (!Object.prototype.hasOwnProperty.call(t, i[o])) return !1;
      if (so && e instanceof Element) return !1;
      for (o = r; o-- !== 0; )
        if (!((i[o] === "_owner" || i[o] === "__v" || i[o] === "__o") && e.$$typeof) && !et(e[i[o]], t[i[o]]))
          return !1;
      return !0;
    }
    return e !== e && t !== t;
  }
  n(et, "equal");
  tr.exports = /* @__PURE__ */ n(function(t, r) {
    try {
      return et(t, r);
    } catch (o) {
      if ((o.message || "").match(/stack|recursion/i))
        return console.warn("react-fast-compare cannot handle circular refs"), !1;
      throw o;
    }
  }, "isEqual");
});

// ../node_modules/warning/warning.js
var fr = Ft((ip, sr) => {
  "use strict";
  var vo = !0, ar = /* @__PURE__ */ n(function() {
  }, "warning");
  vo && (ir = /* @__PURE__ */ n(function(t, r) {
    var o = arguments.length;
    r = new Array(o > 1 ? o - 1 : 0);
    for (var i = 1; i < o; i++)
      r[i - 1] = arguments[i];
    var a = 0, u = "Warning: " + t.replace(/%s/g, function() {
      return r[a++];
    });
    typeof console < "u" && console.error(u);
    try {
      throw new Error(u);
    } catch {
    }
  }, "printWarning"), ar = /* @__PURE__ */ n(function(e, t, r) {
    var o = arguments.length;
    r = new Array(o > 2 ? o - 2 : 0);
    for (var i = 2; i < o; i++)
      r[i - 2] = arguments[i];
    if (t === void 0)
      throw new Error(
        "`warning(condition, format, ...args)` requires a warning message argument"
      );
    e || ir.apply(null, [t].concat(r));
  }, "warning"));
  var ir;
  sr.exports = ar;
});

// src/components/components/tooltip/WithTooltip.tsx
import Ue, { useCallback as Oo, useEffect as Ro, useState as Po } from "react";
import Eo from "react-dom";
import { global as Co } from "@storybook/global";

// ../node_modules/react-popper-tooltip/dist/esm/react-popper-tooltip.js
import * as A from "react";

// ../node_modules/react-popper/lib/esm/Popper.js
import * as rt from "react";

// ../node_modules/react-popper/lib/esm/Manager.js
import * as se from "react";
var Pr = se.createContext(), Er = se.createContext();

// ../node_modules/react-popper/lib/esm/utils.js
import * as Ye from "react";
var ft = /* @__PURE__ */ n(function(t) {
  return t.reduce(function(r, o) {
    var i = o[0], a = o[1];
    return r[i] = a, r;
  }, {});
}, "fromEntries"), pt = typeof window < "u" && window.document && window.document.createElement ? Ye.useLayoutEffect : Ye.useEffect;

// ../node_modules/react-popper/lib/esm/usePopper.js
import * as ue from "react";
import * as or from "react-dom";

// ../node_modules/@popperjs/core/lib/enums.js
var B = "top", $ = "bottom", N = "right", k = "left", _e = "auto", fe = [B, $, N, k], re = "start", ve = "end", Ut = "clippingParents", Ge = "viewport", Ee = "popper", qt = "reference", ut = fe.reduce(function(e, t) {
  return e.concat([t + "-" + re, t + "-" + ve]);
}, []), Je = [].concat(fe, [_e]).reduce(function(e, t) {
  return e.concat([t, t + "-" + re, t + "-" + ve]);
}, []), Cr = "beforeRead", Sr = "read", Ar = "afterRead", Tr = "beforeMain", Lr = "main", Mr = "afterMain", Dr = "beforeWrite", Wr = "write", Br = "afterWrite", zt = [Cr, Sr, Ar, Tr, Lr, Mr, Dr, Wr, Br];

// ../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
function H(e) {
  return e ? (e.nodeName || "").toLowerCase() : null;
}
n(H, "getNodeName");

// ../node_modules/@popperjs/core/lib/dom-utils/getWindow.js
function D(e) {
  if (e == null)
    return window;
  if (e.toString() !== "[object Window]") {
    var t = e.ownerDocument;
    return t && t.defaultView || window;
  }
  return e;
}
n(D, "getWindow");

// ../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
function X(e) {
  var t = D(e).Element;
  return e instanceof t || e instanceof Element;
}
n(X, "isElement");
function j(e) {
  var t = D(e).HTMLElement;
  return e instanceof t || e instanceof HTMLElement;
}
n(j, "isHTMLElement");
function Ce(e) {
  if (typeof ShadowRoot > "u")
    return !1;
  var t = D(e).ShadowRoot;
  return e instanceof t || e instanceof ShadowRoot;
}
n(Ce, "isShadowRoot");

// ../node_modules/@popperjs/core/lib/modifiers/applyStyles.js
function kr(e) {
  var t = e.state;
  Object.keys(t.elements).forEach(function(r) {
    var o = t.styles[r] || {}, i = t.attributes[r] || {}, a = t.elements[r];
    !j(a) || !H(a) || (Object.assign(a.style, o), Object.keys(i).forEach(function(u) {
      var p = i[u];
      p === !1 ? a.removeAttribute(u) : a.setAttribute(u, p === !0 ? "" : p);
    }));
  });
}
n(kr, "applyStyles");
function Nr(e) {
  var t = e.state, r = {
    popper: {
      position: t.options.strategy,
      left: "0",
      top: "0",
      margin: "0"
    },
    arrow: {
      position: "absolute"
    },
    reference: {}
  };
  return Object.assign(t.elements.popper.style, r.popper), t.styles = r, t.elements.arrow && Object.assign(t.elements.arrow.style, r.arrow), function() {
    Object.keys(t.elements).forEach(function(o) {
      var i = t.elements[o], a = t.attributes[o] || {}, u = Object.keys(t.styles.hasOwnProperty(o) ? t.styles[o] : r[o]), p = u.reduce(function(f, s) {
        return f[s] = "", f;
      }, {});
      !j(i) || !H(i) || (Object.assign(i.style, p), Object.keys(a).forEach(function(f) {
        i.removeAttribute(f);
      }));
    });
  };
}
n(Nr, "effect");
var De = {
  name: "applyStyles",
  enabled: !0,
  phase: "write",
  fn: kr,
  effect: Nr,
  requires: ["computeStyles"]
};

// ../node_modules/@popperjs/core/lib/utils/getBasePlacement.js
function V(e) {
  return e.split("-")[0];
}
n(V, "getBasePlacement");

// ../node_modules/@popperjs/core/lib/utils/math.js
var J = Math.max, ge = Math.min, oe = Math.round;

// ../node_modules/@popperjs/core/lib/utils/userAgent.js
function Se() {
  var e = navigator.userAgentData;
  return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
    return t.brand + "/" + t.version;
  }).join(" ") : navigator.userAgent;
}
n(Se, "getUAString");

// ../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js
function We() {
  return !/^((?!chrome|android).)*safari/i.test(Se());
}
n(We, "isLayoutViewport");

// ../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
function Y(e, t, r) {
  t === void 0 && (t = !1), r === void 0 && (r = !1);
  var o = e.getBoundingClientRect(), i = 1, a = 1;
  t && j(e) && (i = e.offsetWidth > 0 && oe(o.width) / e.offsetWidth || 1, a = e.offsetHeight > 0 && oe(o.height) / e.offsetHeight || 1);
  var u = X(e) ? D(e) : window, p = u.visualViewport, f = !We() && r, s = (o.left + (f && p ? p.offsetLeft : 0)) / i, l = (o.top + (f && p ? p.offsetTop : 0)) / a, m = o.width / i, d = o.height / a;
  return {
    width: m,
    height: d,
    top: l,
    right: s + m,
    bottom: l + d,
    left: s,
    x: s,
    y: l
  };
}
n(Y, "getBoundingClientRect");

// ../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
function he(e) {
  var t = Y(e), r = e.offsetWidth, o = e.offsetHeight;
  return Math.abs(t.width - r) <= 1 && (r = t.width), Math.abs(t.height - o) <= 1 && (o = t.height), {
    x: e.offsetLeft,
    y: e.offsetTop,
    width: r,
    height: o
  };
}
n(he, "getLayoutRect");

// ../node_modules/@popperjs/core/lib/dom-utils/contains.js
function Be(e, t) {
  var r = t.getRootNode && t.getRootNode();
  if (e.contains(t))
    return !0;
  if (r && Ce(r)) {
    var o = t;
    do {
      if (o && e.isSameNode(o))
        return !0;
      o = o.parentNode || o.host;
    } while (o);
  }
  return !1;
}
n(Be, "contains");

// ../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
function q(e) {
  return D(e).getComputedStyle(e);
}
n(q, "getComputedStyle");

// ../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
function lt(e) {
  return ["table", "td", "th"].indexOf(H(e)) >= 0;
}
n(lt, "isTableElement");

// ../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function I(e) {
  return ((X(e) ? e.ownerDocument : (
    // $FlowFixMe[prop-missing]
    e.document
  )) || window.document).documentElement;
}
n(I, "getDocumentElement");

// ../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
function ne(e) {
  return H(e) === "html" ? e : (
    // this is a quicker (but less type safe) way to save quite some bytes from the bundle
    // $FlowFixMe[incompatible-return]
    // $FlowFixMe[prop-missing]
    e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
    e.parentNode || // DOM Element detected
    (Ce(e) ? e.host : null) || // ShadowRoot detected
    // $FlowFixMe[incompatible-call]: HTMLElement is a Node
    I(e)
  );
}
n(ne, "getParentNode");

// ../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function Xt(e) {
  return !j(e) || // https://github.com/popperjs/popper-core/issues/837
  q(e).position === "fixed" ? null : e.offsetParent;
}
n(Xt, "getTrueOffsetParent");
function $r(e) {
  var t = /firefox/i.test(Se()), r = /Trident/i.test(Se());
  if (r && j(e)) {
    var o = q(e);
    if (o.position === "fixed")
      return null;
  }
  var i = ne(e);
  for (Ce(i) && (i = i.host); j(i) && ["html", "body"].indexOf(H(i)) < 0; ) {
    var a = q(i);
    if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none")
      return i;
    i = i.parentNode;
  }
  return null;
}
n($r, "getContainingBlock");
function K(e) {
  for (var t = D(e), r = Xt(e); r && lt(r) && q(r).position === "static"; )
    r = Xt(r);
  return r && (H(r) === "html" || H(r) === "body" && q(r).position === "static") ? t : r || $r(e) || t;
}
n(K, "getOffsetParent");

// ../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
function ye(e) {
  return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
}
n(ye, "getMainAxisFromPlacement");

// ../node_modules/@popperjs/core/lib/utils/within.js
function xe(e, t, r) {
  return J(e, ge(t, r));
}
n(xe, "within");
function Yt(e, t, r) {
  var o = xe(e, t, r);
  return o > r ? r : o;
}
n(Yt, "withinMaxClamp");

// ../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
function ke() {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0
  };
}
n(ke, "getFreshSideObject");

// ../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
function Ne(e) {
  return Object.assign({}, ke(), e);
}
n(Ne, "mergePaddingObject");

// ../node_modules/@popperjs/core/lib/utils/expandToHashMap.js
function $e(e, t) {
  return t.reduce(function(r, o) {
    return r[o] = e, r;
  }, {});
}
n($e, "expandToHashMap");

// ../node_modules/@popperjs/core/lib/modifiers/arrow.js
var jr = /* @__PURE__ */ n(function(t, r) {
  return t = typeof t == "function" ? t(Object.assign({}, r.rects, {
    placement: r.placement
  })) : t, Ne(typeof t != "number" ? t : $e(t, fe));
}, "toPaddingObject");
function Hr(e) {
  var t, r = e.state, o = e.name, i = e.options, a = r.elements.arrow, u = r.modifiersData.popperOffsets, p = V(r.placement), f = ye(p), s = [k, N].indexOf(p) >= 0, l = s ? "height" : "width";
  if (!(!a || !u)) {
    var m = jr(i.padding, r), d = he(a), c = f === "y" ? B : k, O = f === "y" ? $ : N, h = r.rects.reference[l] + r.rects.reference[f] - u[f] - r.rects.popper[l], v = u[f] - r.rects.reference[f], R = K(a), T = R ? f === "y" ? R.clientHeight || 0 : R.clientWidth || 0 : 0, L = h / 2 - v / 2, g = m[c], w = T - d[l] - m[O], y = T / 2 - d[l] / 2 + L, E = xe(g, y, w), C = f;
    r.modifiersData[o] = (t = {}, t[C] = E, t.centerOffset = E - y, t);
  }
}
n(Hr, "arrow");
function Vr(e) {
  var t = e.state, r = e.options, o = r.element, i = o === void 0 ? "[data-popper-arrow]" : o;
  i != null && (typeof i == "string" && (i = t.elements.popper.querySelector(i), !i) || Be(t.elements.popper, i) && (t.elements.arrow = i));
}
n(Vr, "effect");
var ct = {
  name: "arrow",
  enabled: !0,
  phase: "main",
  fn: Hr,
  effect: Vr,
  requires: ["popperOffsets"],
  requiresIfExists: ["preventOverflow"]
};

// ../node_modules/@popperjs/core/lib/utils/getVariation.js
function _(e) {
  return e.split("-")[1];
}
n(_, "getVariation");

// ../node_modules/@popperjs/core/lib/modifiers/computeStyles.js
var Fr = {
  top: "auto",
  right: "auto",
  bottom: "auto",
  left: "auto"
};
function Ir(e, t) {
  var r = e.x, o = e.y, i = t.devicePixelRatio || 1;
  return {
    x: oe(r * i) / i || 0,
    y: oe(o * i) / i || 0
  };
}
n(Ir, "roundOffsetsByDPR");
function _t(e) {
  var t, r = e.popper, o = e.popperRect, i = e.placement, a = e.variation, u = e.offsets, p = e.position, f = e.gpuAcceleration, s = e.adaptive, l = e.roundOffsets, m = e.isFixed, d = u.x, c = d === void 0 ? 0 : d, O = u.y, h = O === void 0 ? 0 : O, v = typeof l == "function" ? l({
    x: c,
    y: h
  }) : {
    x: c,
    y: h
  };
  c = v.x, h = v.y;
  var R = u.hasOwnProperty("x"), T = u.hasOwnProperty("y"), L = k, g = B, w = window;
  if (s) {
    var y = K(r), E = "clientHeight", C = "clientWidth";
    if (y === D(r) && (y = I(r), q(y).position !== "static" && p === "absolute" && (E = "scrollHeight", C = "scrollWidth")), y = y, i === B || (i === k || i === N) && a === ve) {
      g = $;
      var x = m && y === w && w.visualViewport ? w.visualViewport.height : (
        // $FlowFixMe[prop-missing]
        y[E]
      );
      h -= x - o.height, h *= f ? 1 : -1;
    }
    if (i === k || (i === B || i === $) && a === ve) {
      L = N;
      var b = m && y === w && w.visualViewport ? w.visualViewport.width : (
        // $FlowFixMe[prop-missing]
        y[C]
      );
      c -= b - o.width, c *= f ? 1 : -1;
    }
  }
  var M = Object.assign({
    position: p
  }, s && Fr), U = l === !0 ? Ir({
    x: c,
    y: h
  }, D(r)) : {
    x: c,
    y: h
  };
  if (c = U.x, h = U.y, f) {
    var F;
    return Object.assign({}, M, (F = {}, F[g] = T ? "0" : "", F[L] = R ? "0" : "", F.transform = (w.devicePixelRatio || 1) <= 1 ? "translate(" + c + "px, " + h + "px)" : "translate3d(" + c + "px, " + h + "px, 0)", F));
  }
  return Object.assign({}, M, (t = {}, t[g] = T ? h + "px" : "", t[L] = R ? c + "px" : "", t.transform = "", t));
}
n(_t, "mapToStyles");
function Ur(e) {
  var t = e.state, r = e.options, o = r.gpuAcceleration, i = o === void 0 ? !0 : o, a = r.adaptive, u = a === void 0 ? !0 : a, p = r.roundOffsets, f = p === void 0 ? !0 : p, s = {
    placement: V(t.placement),
    variation: _(t.placement),
    popper: t.elements.popper,
    popperRect: t.rects.popper,
    gpuAcceleration: i,
    isFixed: t.options.strategy === "fixed"
  };
  t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, _t(Object.assign({}, s, {
    offsets: t.modifiersData.popperOffsets,
    position: t.options.strategy,
    adaptive: u,
    roundOffsets: f
  })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, _t(Object.assign({}, s, {
    offsets: t.modifiersData.arrow,
    position: "absolute",
    adaptive: !1,
    roundOffsets: f
  })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
    "data-popper-placement": t.placement
  });
}
n(Ur, "computeStyles");
var je = {
  name: "computeStyles",
  enabled: !0,
  phase: "beforeWrite",
  fn: Ur,
  data: {}
};

// ../node_modules/@popperjs/core/lib/modifiers/eventListeners.js
var Ke = {
  passive: !0
};
function qr(e) {
  var t = e.state, r = e.instance, o = e.options, i = o.scroll, a = i === void 0 ? !0 : i, u = o.resize, p = u === void 0 ? !0 : u, f = D(t.elements.popper), s = [].concat(t.scrollParents.reference, t.scrollParents.popper);
  return a && s.forEach(function(l) {
    l.addEventListener("scroll", r.update, Ke);
  }), p && f.addEventListener("resize", r.update, Ke), function() {
    a && s.forEach(function(l) {
      l.removeEventListener("scroll", r.update, Ke);
    }), p && f.removeEventListener("resize", r.update, Ke);
  };
}
n(qr, "effect");
var He = {
  name: "eventListeners",
  enabled: !0,
  phase: "write",
  fn: /* @__PURE__ */ n(function() {
  }, "fn"),
  effect: qr,
  data: {}
};

// ../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
var zr = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function Ae(e) {
  return e.replace(/left|right|bottom|top/g, function(t) {
    return zr[t];
  });
}
n(Ae, "getOppositePlacement");

// ../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
var Xr = {
  start: "end",
  end: "start"
};
function Qe(e) {
  return e.replace(/start|end/g, function(t) {
    return Xr[t];
  });
}
n(Qe, "getOppositeVariationPlacement");

// ../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
function we(e) {
  var t = D(e), r = t.pageXOffset, o = t.pageYOffset;
  return {
    scrollLeft: r,
    scrollTop: o
  };
}
n(we, "getWindowScroll");

// ../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
function be(e) {
  return Y(I(e)).left + we(e).scrollLeft;
}
n(be, "getWindowScrollBarX");

// ../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
function mt(e, t) {
  var r = D(e), o = I(e), i = r.visualViewport, a = o.clientWidth, u = o.clientHeight, p = 0, f = 0;
  if (i) {
    a = i.width, u = i.height;
    var s = We();
    (s || !s && t === "fixed") && (p = i.offsetLeft, f = i.offsetTop);
  }
  return {
    width: a,
    height: u,
    x: p + be(e),
    y: f
  };
}
n(mt, "getViewportRect");

// ../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
function dt(e) {
  var t, r = I(e), o = we(e), i = (t = e.ownerDocument) == null ? void 0 : t.body, a = J(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), u = J(r.scrollHeight, r.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), p = -o.scrollLeft + be(e), f = -o.scrollTop;
  return q(i || r).direction === "rtl" && (p += J(r.clientWidth, i ? i.clientWidth : 0) - a), {
    width: a,
    height: u,
    x: p,
    y: f
  };
}
n(dt, "getDocumentRect");

// ../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
function Oe(e) {
  var t = q(e), r = t.overflow, o = t.overflowX, i = t.overflowY;
  return /auto|scroll|overlay|hidden/.test(r + i + o);
}
n(Oe, "isScrollParent");

// ../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
function Ze(e) {
  return ["html", "body", "#document"].indexOf(H(e)) >= 0 ? e.ownerDocument.body : j(e) && Oe(e) ? e : Ze(ne(e));
}
n(Ze, "getScrollParent");

// ../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
function pe(e, t) {
  var r;
  t === void 0 && (t = []);
  var o = Ze(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), a = D(o), u = i ? [a].concat(a.visualViewport || [], Oe(o) ? o : []) : o, p = t.concat(u);
  return i ? p : (
    // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
    p.concat(pe(ne(u)))
  );
}
n(pe, "listScrollParents");

// ../node_modules/@popperjs/core/lib/utils/rectToClientRect.js
function Te(e) {
  return Object.assign({}, e, {
    left: e.x,
    top: e.y,
    right: e.x + e.width,
    bottom: e.y + e.height
  });
}
n(Te, "rectToClientRect");

// ../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
function Yr(e, t) {
  var r = Y(e, !1, t === "fixed");
  return r.top = r.top + e.clientTop, r.left = r.left + e.clientLeft, r.bottom = r.top + e.clientHeight, r.right = r.left + e.clientWidth, r.width = e.clientWidth, r.height = e.clientHeight, r.x = r.left, r.y = r.top, r;
}
n(Yr, "getInnerBoundingClientRect");
function Gt(e, t, r) {
  return t === Ge ? Te(mt(e, r)) : X(t) ? Yr(t, r) : Te(dt(I(e)));
}
n(Gt, "getClientRectFromMixedType");
function _r(e) {
  var t = pe(ne(e)), r = ["absolute", "fixed"].indexOf(q(e).position) >= 0, o = r && j(e) ? K(e) : e;
  return X(o) ? t.filter(function(i) {
    return X(i) && Be(i, o) && H(i) !== "body";
  }) : [];
}
n(_r, "getClippingParents");
function vt(e, t, r, o) {
  var i = t === "clippingParents" ? _r(e) : [].concat(t), a = [].concat(i, [r]), u = a[0], p = a.reduce(function(f, s) {
    var l = Gt(e, s, o);
    return f.top = J(l.top, f.top), f.right = ge(l.right, f.right), f.bottom = ge(l.bottom, f.bottom), f.left = J(l.left, f.left), f;
  }, Gt(e, u, o));
  return p.width = p.right - p.left, p.height = p.bottom - p.top, p.x = p.left, p.y = p.top, p;
}
n(vt, "getClippingRect");

// ../node_modules/@popperjs/core/lib/utils/computeOffsets.js
function Ve(e) {
  var t = e.reference, r = e.element, o = e.placement, i = o ? V(o) : null, a = o ? _(o) : null, u = t.x + t.width / 2 - r.width / 2, p = t.y + t.height / 2 - r.height / 2, f;
  switch (i) {
    case B:
      f = {
        x: u,
        y: t.y - r.height
      };
      break;
    case $:
      f = {
        x: u,
        y: t.y + t.height
      };
      break;
    case N:
      f = {
        x: t.x + t.width,
        y: p
      };
      break;
    case k:
      f = {
        x: t.x - r.width,
        y: p
      };
      break;
    default:
      f = {
        x: t.x,
        y: t.y
      };
  }
  var s = i ? ye(i) : null;
  if (s != null) {
    var l = s === "y" ? "height" : "width";
    switch (a) {
      case re:
        f[s] = f[s] - (t[l] / 2 - r[l] / 2);
        break;
      case ve:
        f[s] = f[s] + (t[l] / 2 - r[l] / 2);
        break;
      default:
    }
  }
  return f;
}
n(Ve, "computeOffsets");

// ../node_modules/@popperjs/core/lib/utils/detectOverflow.js
function z(e, t) {
  t === void 0 && (t = {});
  var r = t, o = r.placement, i = o === void 0 ? e.placement : o, a = r.strategy, u = a === void 0 ? e.strategy : a, p = r.boundary, f = p === void 0 ? Ut : p, s = r.rootBoundary, l = s === void 0 ? Ge : s, m = r.elementContext, d = m === void 0 ? Ee : m, c = r.altBoundary, O = c === void 0 ? !1 : c, h = r.padding, v = h === void 0 ? 0 : h, R = Ne(typeof v != "number" ? v : $e(v, fe)), T = d === Ee ? qt : Ee, L = e.rects.popper, g = e.elements[O ? T : d], w = vt(X(g) ? g : g.contextElement || I(e.elements.popper), f, l, u), y = Y(e.elements.reference), E = Ve({
    reference: y,
    element: L,
    strategy: "absolute",
    placement: i
  }), C = Te(Object.assign({}, L, E)), x = d === Ee ? C : y, b = {
    top: w.top - x.top + R.top,
    bottom: x.bottom - w.bottom + R.bottom,
    left: w.left - x.left + R.left,
    right: x.right - w.right + R.right
  }, M = e.modifiersData.offset;
  if (d === Ee && M) {
    var U = M[i];
    Object.keys(b).forEach(function(F) {
      var Z = [N, $].indexOf(F) >= 0 ? 1 : -1, S = [B, $].indexOf(F) >= 0 ? "y" : "x";
      b[F] += U[S] * Z;
    });
  }
  return b;
}
n(z, "detectOverflow");

// ../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
function gt(e, t) {
  t === void 0 && (t = {});
  var r = t, o = r.placement, i = r.boundary, a = r.rootBoundary, u = r.padding, p = r.flipVariations, f = r.allowedAutoPlacements, s = f === void 0 ? Je : f, l = _(o), m = l ? p ? ut : ut.filter(function(O) {
    return _(O) === l;
  }) : fe, d = m.filter(function(O) {
    return s.indexOf(O) >= 0;
  });
  d.length === 0 && (d = m);
  var c = d.reduce(function(O, h) {
    return O[h] = z(e, {
      placement: h,
      boundary: i,
      rootBoundary: a,
      padding: u
    })[V(h)], O;
  }, {});
  return Object.keys(c).sort(function(O, h) {
    return c[O] - c[h];
  });
}
n(gt, "computeAutoPlacement");

// ../node_modules/@popperjs/core/lib/modifiers/flip.js
function Gr(e) {
  if (V(e) === _e)
    return [];
  var t = Ae(e);
  return [Qe(e), t, Qe(t)];
}
n(Gr, "getExpandedFallbackPlacements");
function Jr(e) {
  var t = e.state, r = e.options, o = e.name;
  if (!t.modifiersData[o]._skip) {
    for (var i = r.mainAxis, a = i === void 0 ? !0 : i, u = r.altAxis, p = u === void 0 ? !0 : u, f = r.fallbackPlacements, s = r.padding, l = r.boundary, m = r.rootBoundary, d = r.altBoundary, c = r.flipVariations, O = c === void 0 ? !0 : c, h = r.allowedAutoPlacements, v = t.options.placement, R = V(v), T = R === v, L = f || (T || !O ? [Ae(v)] : Gr(v)), g = [v].concat(L).reduce(function(Pe, ie) {
      return Pe.concat(V(ie) === _e ? gt(t, {
        placement: ie,
        boundary: l,
        rootBoundary: m,
        padding: s,
        flipVariations: O,
        allowedAutoPlacements: h
      }) : ie);
    }, []), w = t.rects.reference, y = t.rects.popper, E = /* @__PURE__ */ new Map(), C = !0, x = g[0], b = 0; b < g.length; b++) {
      var M = g[b], U = V(M), F = _(M) === re, Z = [B, $].indexOf(U) >= 0, S = Z ? "width" : "height", P = z(t, {
        placement: M,
        boundary: l,
        rootBoundary: m,
        altBoundary: d,
        padding: s
      }), W = Z ? F ? N : k : F ? $ : B;
      w[S] > y[S] && (W = Ae(W));
      var ee = Ae(W), Q = [];
      if (a && Q.push(P[U] <= 0), p && Q.push(P[W] <= 0, P[ee] <= 0), Q.every(function(Pe) {
        return Pe;
      })) {
        x = M, C = !1;
        break;
      }
      E.set(M, Q);
    }
    if (C)
      for (var ce = O ? 3 : 1, Re = /* @__PURE__ */ n(function(ie) {
        var Me = g.find(function(ze) {
          var me = E.get(ze);
          if (me)
            return me.slice(0, ie).every(function(nt) {
              return nt;
            });
        });
        if (Me)
          return x = Me, "break";
      }, "_loop"), te = ce; te > 0; te--) {
        var qe = Re(te);
        if (qe === "break") break;
      }
    t.placement !== x && (t.modifiersData[o]._skip = !0, t.placement = x, t.reset = !0);
  }
}
n(Jr, "flip");
var ht = {
  name: "flip",
  enabled: !0,
  phase: "main",
  fn: Jr,
  requiresIfExists: ["offset"],
  data: {
    _skip: !1
  }
};

// ../node_modules/@popperjs/core/lib/modifiers/hide.js
function Jt(e, t, r) {
  return r === void 0 && (r = {
    x: 0,
    y: 0
  }), {
    top: e.top - t.height - r.y,
    right: e.right - t.width + r.x,
    bottom: e.bottom - t.height + r.y,
    left: e.left - t.width - r.x
  };
}
n(Jt, "getSideOffsets");
function Kt(e) {
  return [B, N, $, k].some(function(t) {
    return e[t] >= 0;
  });
}
n(Kt, "isAnySideFullyClipped");
function Kr(e) {
  var t = e.state, r = e.name, o = t.rects.reference, i = t.rects.popper, a = t.modifiersData.preventOverflow, u = z(t, {
    elementContext: "reference"
  }), p = z(t, {
    altBoundary: !0
  }), f = Jt(u, o), s = Jt(p, i, a), l = Kt(f), m = Kt(s);
  t.modifiersData[r] = {
    referenceClippingOffsets: f,
    popperEscapeOffsets: s,
    isReferenceHidden: l,
    hasPopperEscaped: m
  }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
    "data-popper-reference-hidden": l,
    "data-popper-escaped": m
  });
}
n(Kr, "hide");
var yt = {
  name: "hide",
  enabled: !0,
  phase: "main",
  requiresIfExists: ["preventOverflow"],
  fn: Kr
};

// ../node_modules/@popperjs/core/lib/modifiers/offset.js
function Qr(e, t, r) {
  var o = V(e), i = [k, B].indexOf(o) >= 0 ? -1 : 1, a = typeof r == "function" ? r(Object.assign({}, t, {
    placement: e
  })) : r, u = a[0], p = a[1];
  return u = u || 0, p = (p || 0) * i, [k, N].indexOf(o) >= 0 ? {
    x: p,
    y: u
  } : {
    x: u,
    y: p
  };
}
n(Qr, "distanceAndSkiddingToXY");
function Zr(e) {
  var t = e.state, r = e.options, o = e.name, i = r.offset, a = i === void 0 ? [0, 0] : i, u = Je.reduce(function(l, m) {
    return l[m] = Qr(m, t.rects, a), l;
  }, {}), p = u[t.placement], f = p.x, s = p.y;
  t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += f, t.modifiersData.popperOffsets.y += s), t.modifiersData[o] = u;
}
n(Zr, "offset");
var xt = {
  name: "offset",
  enabled: !0,
  phase: "main",
  requires: ["popperOffsets"],
  fn: Zr
};

// ../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
function eo(e) {
  var t = e.state, r = e.name;
  t.modifiersData[r] = Ve({
    reference: t.rects.reference,
    element: t.rects.popper,
    strategy: "absolute",
    placement: t.placement
  });
}
n(eo, "popperOffsets");
var Fe = {
  name: "popperOffsets",
  enabled: !0,
  phase: "read",
  fn: eo,
  data: {}
};

// ../node_modules/@popperjs/core/lib/utils/getAltAxis.js
function wt(e) {
  return e === "x" ? "y" : "x";
}
n(wt, "getAltAxis");

// ../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
function to(e) {
  var t = e.state, r = e.options, o = e.name, i = r.mainAxis, a = i === void 0 ? !0 : i, u = r.altAxis, p = u === void 0 ? !1 : u, f = r.boundary, s = r.rootBoundary, l = r.altBoundary, m = r.padding, d = r.tether, c = d === void 0 ? !0 : d, O = r.tetherOffset, h = O === void 0 ? 0 : O, v = z(t, {
    boundary: f,
    rootBoundary: s,
    padding: m,
    altBoundary: l
  }), R = V(t.placement), T = _(t.placement), L = !T, g = ye(R), w = wt(g), y = t.modifiersData.popperOffsets, E = t.rects.reference, C = t.rects.popper, x = typeof h == "function" ? h(Object.assign({}, t.rects, {
    placement: t.placement
  })) : h, b = typeof x == "number" ? {
    mainAxis: x,
    altAxis: x
  } : Object.assign({
    mainAxis: 0,
    altAxis: 0
  }, x), M = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, U = {
    x: 0,
    y: 0
  };
  if (y) {
    if (a) {
      var F, Z = g === "y" ? B : k, S = g === "y" ? $ : N, P = g === "y" ? "height" : "width", W = y[g], ee = W + v[Z], Q = W - v[S], ce = c ? -C[P] / 2 : 0, Re = T === re ? E[P] : C[P], te = T === re ? -C[P] : -E[P], qe = t.elements.arrow, Pe = c && qe ? he(qe) : {
        width: 0,
        height: 0
      }, ie = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ke(), Me = ie[Z], ze = ie[S], me = xe(0, E[P], Pe[P]), nt = L ? E[P] / 2 - ce - me - Me - b.mainAxis : Re - me - Me - b.mainAxis, hr = L ? -E[P] / 2 + ce + me + ze + b.mainAxis : te + me + ze + b.mainAxis, it = t.elements.arrow && K(t.elements.arrow), yr = it ? g === "y" ? it.clientTop || 0 : it.clientLeft || 0 : 0, Dt = (F = M?.[g]) != null ? F : 0, xr = W + nt - Dt - yr, wr = W + hr - Dt, Wt = xe(c ? ge(ee, xr) : ee, W, c ? J(Q, wr) : Q);
      y[g] = Wt, U[g] = Wt - W;
    }
    if (p) {
      var Bt, br = g === "x" ? B : k, Or = g === "x" ? $ : N, de = y[w], Xe = w === "y" ? "height" : "width", kt = de + v[br], Nt = de - v[Or], at = [B, k].indexOf(R) !== -1, $t = (Bt = M?.[w]) != null ? Bt : 0, jt = at ? kt : de - E[Xe] - C[Xe] - $t + b.altAxis, Ht = at ? de + E[Xe] + C[Xe] - $t - b.altAxis : Nt, Vt = c && at ? Yt(jt, de, Ht) : xe(c ? jt : kt, de, c ? Ht : Nt);
      y[w] = Vt, U[w] = Vt - de;
    }
    t.modifiersData[o] = U;
  }
}
n(to, "preventOverflow");
var bt = {
  name: "preventOverflow",
  enabled: !0,
  phase: "main",
  fn: to,
  requiresIfExists: ["offset"]
};

// ../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
function Ot(e) {
  return {
    scrollLeft: e.scrollLeft,
    scrollTop: e.scrollTop
  };
}
n(Ot, "getHTMLElementScroll");

// ../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
function Rt(e) {
  return e === D(e) || !j(e) ? we(e) : Ot(e);
}
n(Rt, "getNodeScroll");

// ../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
function ro(e) {
  var t = e.getBoundingClientRect(), r = oe(t.width) / e.offsetWidth || 1, o = oe(t.height) / e.offsetHeight || 1;
  return r !== 1 || o !== 1;
}
n(ro, "isElementScaled");
function Pt(e, t, r) {
  r === void 0 && (r = !1);
  var o = j(t), i = j(t) && ro(t), a = I(t), u = Y(e, i, r), p = {
    scrollLeft: 0,
    scrollTop: 0
  }, f = {
    x: 0,
    y: 0
  };
  return (o || !o && !r) && ((H(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  Oe(a)) && (p = Rt(t)), j(t) ? (f = Y(t, !0), f.x += t.clientLeft, f.y += t.clientTop) : a && (f.x = be(a))), {
    x: u.left + p.scrollLeft - f.x,
    y: u.top + p.scrollTop - f.y,
    width: u.width,
    height: u.height
  };
}
n(Pt, "getCompositeRect");

// ../node_modules/@popperjs/core/lib/utils/orderModifiers.js
function oo(e) {
  var t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), o = [];
  e.forEach(function(a) {
    t.set(a.name, a);
  });
  function i(a) {
    r.add(a.name);
    var u = [].concat(a.requires || [], a.requiresIfExists || []);
    u.forEach(function(p) {
      if (!r.has(p)) {
        var f = t.get(p);
        f && i(f);
      }
    }), o.push(a);
  }
  return n(i, "sort"), e.forEach(function(a) {
    r.has(a.name) || i(a);
  }), o;
}
n(oo, "order");
function Et(e) {
  var t = oo(e);
  return zt.reduce(function(r, o) {
    return r.concat(t.filter(function(i) {
      return i.phase === o;
    }));
  }, []);
}
n(Et, "orderModifiers");

// ../node_modules/@popperjs/core/lib/utils/debounce.js
function Ct(e) {
  var t;
  return function() {
    return t || (t = new Promise(function(r) {
      Promise.resolve().then(function() {
        t = void 0, r(e());
      });
    })), t;
  };
}
n(Ct, "debounce");

// ../node_modules/@popperjs/core/lib/utils/mergeByName.js
function St(e) {
  var t = e.reduce(function(r, o) {
    var i = r[o.name];
    return r[o.name] = i ? Object.assign({}, i, o, {
      options: Object.assign({}, i.options, o.options),
      data: Object.assign({}, i.data, o.data)
    }) : o, r;
  }, {});
  return Object.keys(t).map(function(r) {
    return t[r];
  });
}
n(St, "mergeByName");

// ../node_modules/@popperjs/core/lib/createPopper.js
var Qt = {
  placement: "bottom",
  modifiers: [],
  strategy: "absolute"
};
function Zt() {
  for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
    t[r] = arguments[r];
  return !t.some(function(o) {
    return !(o && typeof o.getBoundingClientRect == "function");
  });
}
n(Zt, "areValidElements");
function Le(e) {
  e === void 0 && (e = {});
  var t = e, r = t.defaultModifiers, o = r === void 0 ? [] : r, i = t.defaultOptions, a = i === void 0 ? Qt : i;
  return /* @__PURE__ */ n(function(p, f, s) {
    s === void 0 && (s = a);
    var l = {
      placement: "bottom",
      orderedModifiers: [],
      options: Object.assign({}, Qt, a),
      modifiersData: {},
      elements: {
        reference: p,
        popper: f
      },
      attributes: {},
      styles: {}
    }, m = [], d = !1, c = {
      state: l,
      setOptions: /* @__PURE__ */ n(function(R) {
        var T = typeof R == "function" ? R(l.options) : R;
        h(), l.options = Object.assign({}, a, l.options, T), l.scrollParents = {
          reference: X(p) ? pe(p) : p.contextElement ? pe(p.contextElement) : [],
          popper: pe(f)
        };
        var L = Et(St([].concat(o, l.options.modifiers)));
        return l.orderedModifiers = L.filter(function(g) {
          return g.enabled;
        }), O(), c.update();
      }, "setOptions"),
      // Sync update – it will always be executed, even if not necessary. This
      // is useful for low frequency updates where sync behavior simplifies the
      // logic.
      // For high frequency updates (e.g. `resize` and `scroll` events), always
      // prefer the async Popper#update method
      forceUpdate: /* @__PURE__ */ n(function() {
        if (!d) {
          var R = l.elements, T = R.reference, L = R.popper;
          if (Zt(T, L)) {
            l.rects = {
              reference: Pt(T, K(L), l.options.strategy === "fixed"),
              popper: he(L)
            }, l.reset = !1, l.placement = l.options.placement, l.orderedModifiers.forEach(function(b) {
              return l.modifiersData[b.name] = Object.assign({}, b.data);
            });
            for (var g = 0; g < l.orderedModifiers.length; g++) {
              if (l.reset === !0) {
                l.reset = !1, g = -1;
                continue;
              }
              var w = l.orderedModifiers[g], y = w.fn, E = w.options, C = E === void 0 ? {} : E, x = w.name;
              typeof y == "function" && (l = y({
                state: l,
                options: C,
                name: x,
                instance: c
              }) || l);
            }
          }
        }
      }, "forceUpdate"),
      // Async and optimistically optimized update – it will not be executed if
      // not necessary (debounced to run at most once-per-tick)
      update: Ct(function() {
        return new Promise(function(v) {
          c.forceUpdate(), v(l);
        });
      }),
      destroy: /* @__PURE__ */ n(function() {
        h(), d = !0;
      }, "destroy")
    };
    if (!Zt(p, f))
      return c;
    c.setOptions(s).then(function(v) {
      !d && s.onFirstUpdate && s.onFirstUpdate(v);
    });
    function O() {
      l.orderedModifiers.forEach(function(v) {
        var R = v.name, T = v.options, L = T === void 0 ? {} : T, g = v.effect;
        if (typeof g == "function") {
          var w = g({
            state: l,
            name: R,
            instance: c,
            options: L
          }), y = /* @__PURE__ */ n(function() {
          }, "noopFn");
          m.push(w || y);
        }
      });
    }
    n(O, "runModifierEffects");
    function h() {
      m.forEach(function(v) {
        return v();
      }), m = [];
    }
    return n(h, "cleanupModifierEffects"), c;
  }, "createPopper");
}
n(Le, "popperGenerator");
var no = Le();

// ../node_modules/@popperjs/core/lib/popper-lite.js
var io = [He, Fe, je, De], er = Le({
  defaultModifiers: io
});

// ../node_modules/@popperjs/core/lib/popper.js
var ao = [He, Fe, je, De, xt, ht, bt, ct, yt], At = Le({
  defaultModifiers: ao
});

// ../node_modules/react-popper/lib/esm/usePopper.js
var nr = st(rr());
var lo = [], tt = /* @__PURE__ */ n(function(t, r, o) {
  o === void 0 && (o = {});
  var i = ue.useRef(null), a = {
    onFirstUpdate: o.onFirstUpdate,
    placement: o.placement || "bottom",
    strategy: o.strategy || "absolute",
    modifiers: o.modifiers || lo
  }, u = ue.useState({
    styles: {
      popper: {
        position: a.strategy,
        left: "0",
        top: "0"
      },
      arrow: {
        position: "absolute"
      }
    },
    attributes: {}
  }), p = u[0], f = u[1], s = ue.useMemo(function() {
    return {
      name: "updateState",
      enabled: !0,
      phase: "write",
      fn: /* @__PURE__ */ n(function(c) {
        var O = c.state, h = Object.keys(O.elements);
        or.flushSync(function() {
          f({
            styles: ft(h.map(function(v) {
              return [v, O.styles[v] || {}];
            })),
            attributes: ft(h.map(function(v) {
              return [v, O.attributes[v]];
            }))
          });
        });
      }, "fn"),
      requires: ["computeStyles"]
    };
  }, []), l = ue.useMemo(function() {
    var d = {
      onFirstUpdate: a.onFirstUpdate,
      placement: a.placement,
      strategy: a.strategy,
      modifiers: [].concat(a.modifiers, [s, {
        name: "applyStyles",
        enabled: !1
      }])
    };
    return (0, nr.default)(i.current, d) ? i.current || d : (i.current = d, d);
  }, [a.onFirstUpdate, a.placement, a.strategy, a.modifiers, s]), m = ue.useRef();
  return pt(function() {
    m.current && m.current.setOptions(l);
  }, [l]), pt(function() {
    if (!(t == null || r == null)) {
      var d = o.createPopper || At, c = d(t, r, l);
      return m.current = c, function() {
        c.destroy(), m.current = null;
      };
    }
  }, [t, r, o.createPopper]), {
    state: m.current ? m.current.state : null,
    styles: p.styles,
    attributes: p.attributes,
    update: m.current ? m.current.update : null,
    forceUpdate: m.current ? m.current.forceUpdate : null
  };
}, "usePopper");

// ../node_modules/react-popper/lib/esm/Reference.js
var go = st(fr());
import * as Tt from "react";

// ../node_modules/react-popper-tooltip/dist/esm/react-popper-tooltip.js
function lr(e) {
  var t = A.useRef(e);
  return t.current = e, A.useCallback(function() {
    return t.current;
  }, []);
}
n(lr, "useGetLatest");
var ho = /* @__PURE__ */ n(function() {
}, "noop");
function yo(e) {
  var t = e.initial, r = e.value, o = e.onChange, i = o === void 0 ? ho : o;
  if (t === void 0 && r === void 0)
    throw new TypeError('Either "value" or "initial" variable must be set. Now both are undefined');
  var a = A.useState(t), u = a[0], p = a[1], f = lr(u), s = A.useCallback(function(m) {
    var d = f(), c = typeof m == "function" ? m(d) : m;
    typeof c.persist == "function" && c.persist(), p(c), typeof i == "function" && i(c);
  }, [f, i]), l = r !== void 0;
  return [l ? r : u, l ? i : s];
}
n(yo, "useControlledState");
function cr(e, t) {
  return e === void 0 && (e = 0), t === void 0 && (t = 0), function() {
    return {
      width: 0,
      height: 0,
      top: t,
      right: e,
      bottom: t,
      left: e,
      x: 0,
      y: 0,
      toJSON: /* @__PURE__ */ n(function() {
        return null;
      }, "toJSON")
    };
  };
}
n(cr, "generateBoundingClientRect");
var xo = ["styles", "attributes"], pr = {
  getBoundingClientRect: cr()
}, ur = {
  closeOnOutsideClick: !0,
  closeOnTriggerHidden: !1,
  defaultVisible: !1,
  delayHide: 0,
  delayShow: 0,
  followCursor: !1,
  interactive: !1,
  mutationObserverOptions: {
    attributes: !0,
    childList: !0,
    subtree: !0
  },
  offset: [0, 6],
  trigger: "hover"
};
function mr(e, t) {
  var r, o, i;
  e === void 0 && (e = {}), t === void 0 && (t = {});
  var a = Object.keys(ur).reduce(function(S, P) {
    var W;
    return ae({}, S, (W = {}, W[P] = S[P] !== void 0 ? S[P] : ur[P], W));
  }, e), u = A.useMemo(
    function() {
      return [{
        name: "offset",
        options: {
          offset: a.offset
        }
      }];
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Array.isArray(a.offset) ? a.offset : []
  ), p = ae({}, t, {
    placement: t.placement || a.placement,
    modifiers: t.modifiers || u
  }), f = A.useState(null), s = f[0], l = f[1], m = A.useState(null), d = m[0], c = m[1], O = yo({
    initial: a.defaultVisible,
    value: a.visible,
    onChange: a.onVisibleChange
  }), h = O[0], v = O[1], R = A.useRef();
  A.useEffect(function() {
    return function() {
      return clearTimeout(R.current);
    };
  }, []);
  var T = tt(a.followCursor ? pr : s, d, p), L = T.styles, g = T.attributes, w = It(T, xo), y = w.update, E = lr({
    visible: h,
    triggerRef: s,
    tooltipRef: d,
    finalConfig: a
  }), C = A.useCallback(
    function(S) {
      return Array.isArray(a.trigger) ? a.trigger.includes(S) : a.trigger === S;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    Array.isArray(a.trigger) ? a.trigger : [a.trigger]
  ), x = A.useCallback(function() {
    clearTimeout(R.current), R.current = window.setTimeout(function() {
      return v(!1);
    }, a.delayHide);
  }, [a.delayHide, v]), b = A.useCallback(function() {
    clearTimeout(R.current), R.current = window.setTimeout(function() {
      return v(!0);
    }, a.delayShow);
  }, [a.delayShow, v]), M = A.useCallback(function() {
    E().visible ? x() : b();
  }, [E, x, b]);
  A.useEffect(function() {
    if (E().finalConfig.closeOnOutsideClick) {
      var S = /* @__PURE__ */ n(function(W) {
        var ee, Q = E(), ce = Q.tooltipRef, Re = Q.triggerRef, te = (W.composedPath == null || (ee = W.composedPath()) == null ? void 0 : ee[0]) || W.target;
        te instanceof Node && ce != null && Re != null && !ce.contains(te) && !Re.contains(te) && x();
      }, "handleClickOutside");
      return document.addEventListener("mousedown", S), function() {
        return document.removeEventListener("mousedown", S);
      };
    }
  }, [E, x]), A.useEffect(function() {
    if (!(s == null || !C("click")))
      return s.addEventListener("click", M), function() {
        return s.removeEventListener("click", M);
      };
  }, [s, C, M]), A.useEffect(function() {
    if (!(s == null || !C("double-click")))
      return s.addEventListener("dblclick", M), function() {
        return s.removeEventListener("dblclick", M);
      };
  }, [s, C, M]), A.useEffect(function() {
    if (!(s == null || !C("right-click"))) {
      var S = /* @__PURE__ */ n(function(W) {
        W.preventDefault(), M();
      }, "preventDefaultAndToggle");
      return s.addEventListener("contextmenu", S), function() {
        return s.removeEventListener("contextmenu", S);
      };
    }
  }, [s, C, M]), A.useEffect(function() {
    if (!(s == null || !C("focus")))
      return s.addEventListener("focus", b), s.addEventListener("blur", x), function() {
        s.removeEventListener("focus", b), s.removeEventListener("blur", x);
      };
  }, [s, C, b, x]), A.useEffect(function() {
    if (!(s == null || !C("hover")))
      return s.addEventListener("mouseenter", b), s.addEventListener("mouseleave", x), function() {
        s.removeEventListener("mouseenter", b), s.removeEventListener("mouseleave", x);
      };
  }, [s, C, b, x]), A.useEffect(function() {
    if (!(d == null || !C("hover") || !E().finalConfig.interactive))
      return d.addEventListener("mouseenter", b), d.addEventListener("mouseleave", x), function() {
        d.removeEventListener("mouseenter", b), d.removeEventListener("mouseleave", x);
      };
  }, [d, C, b, x, E]);
  var U = w == null || (r = w.state) == null || (o = r.modifiersData) == null || (i = o.hide) == null ? void 0 : i.isReferenceHidden;
  A.useEffect(function() {
    a.closeOnTriggerHidden && U && x();
  }, [a.closeOnTriggerHidden, x, U]), A.useEffect(function() {
    if (!a.followCursor || s == null) return;
    function S(P) {
      var W = P.clientX, ee = P.clientY;
      pr.getBoundingClientRect = cr(W, ee), y?.();
    }
    return n(S, "setMousePosition"), s.addEventListener("mousemove", S), function() {
      return s.removeEventListener("mousemove", S);
    };
  }, [a.followCursor, s, y]), A.useEffect(function() {
    if (!(d == null || y == null || a.mutationObserverOptions == null)) {
      var S = new MutationObserver(y);
      return S.observe(d, a.mutationObserverOptions), function() {
        return S.disconnect();
      };
    }
  }, [a.mutationObserverOptions, d, y]);
  var F = /* @__PURE__ */ n(function(P) {
    return P === void 0 && (P = {}), ae({}, P, {
      style: ae({}, P.style, L.popper)
    }, g.popper, {
      "data-popper-interactive": a.interactive
    });
  }, "getTooltipProps"), Z = /* @__PURE__ */ n(function(P) {
    return P === void 0 && (P = {}), ae({}, P, g.arrow, {
      style: ae({}, P.style, L.arrow),
      "data-popper-arrow": !0
    });
  }, "getArrowProps");
  return ae({
    getArrowProps: Z,
    getTooltipProps: F,
    setTooltipRef: c,
    setTriggerRef: l,
    tooltipRef: d,
    triggerRef: s,
    visible: h
  }, w);
}
n(mr, "usePopperTooltip");

// src/components/components/tooltip/WithTooltip.tsx
import { styled as gr } from "storybook/theming";

// src/components/components/tooltip/Tooltip.tsx
var dr = st(Rr(), 1);
import Lt from "react";
import { lighten as Ie, styled as vr } from "storybook/theming";
var G = (0, dr.default)(1e3)(
  (e, t, r, o = 0) => t.split("-")[0] === e ? r : o
), le = 8, wo = vr.div(
  {
    position: "absolute",
    borderStyle: "solid"
  },
  ({ placement: e }) => {
    let t = 0, r = 0;
    switch (!0) {
      case (e.startsWith("left") || e.startsWith("right")): {
        r = 8;
        break;
      }
      case (e.startsWith("top") || e.startsWith("bottom")): {
        t = 8;
        break;
      }
      default:
    }
    return { transform: `translate3d(${t}px, ${r}px, 0px)` };
  },
  ({ theme: e, color: t, placement: r }) => ({
    bottom: `${G("top", r, `${le * -1}px`, "auto")}`,
    top: `${G("bottom", r, `${le * -1}px`, "auto")}`,
    right: `${G("left", r, `${le * -1}px`, "auto")}`,
    left: `${G("right", r, `${le * -1}px`, "auto")}`,
    borderBottomWidth: `${G("top", r, "0", le)}px`,
    borderTopWidth: `${G("bottom", r, "0", le)}px`,
    borderRightWidth: `${G("left", r, "0", le)}px`,
    borderLeftWidth: `${G("right", r, "0", le)}px`,
    borderTopColor: G(
      "top",
      r,
      e.color[t] || t || e.base === "light" ? Ie(e.background.app) : e.background.app,
      "transparent"
    ),
    borderBottomColor: G(
      "bottom",
      r,
      e.color[t] || t || e.base === "light" ? Ie(e.background.app) : e.background.app,
      "transparent"
    ),
    borderLeftColor: G(
      "left",
      r,
      e.color[t] || t || e.base === "light" ? Ie(e.background.app) : e.background.app,
      "transparent"
    ),
    borderRightColor: G(
      "right",
      r,
      e.color[t] || t || e.base === "light" ? Ie(e.background.app) : e.background.app,
      "transparent"
    )
  })
), bo = vr.div(
  ({ hidden: e }) => ({
    display: e ? "none" : "inline-block",
    zIndex: 2147483647,
    colorScheme: "light dark"
  }),
  ({ theme: e, color: t, hasChrome: r }) => r ? {
    background: t && e.color[t] || t || e.base === "light" ? Ie(e.background.app) : e.background.app,
    filter: `
            drop-shadow(0px 5px 5px rgba(0,0,0,0.05))
            drop-shadow(0 1px 3px rgba(0,0,0,0.1))
          `,
    borderRadius: e.appBorderRadius + 2,
    fontSize: e.typography.size.s1
  } : {}
), Mt = Lt.forwardRef(
  ({
    placement: e = "top",
    hasChrome: t = !0,
    children: r,
    arrowProps: o = {},
    tooltipRef: i,
    color: a,
    withArrows: u,
    ...p
  }, f) => Lt.createElement(bo, { "data-testid": "tooltip", hasChrome: t, ref: f, ...p, color: a }, t && u && Lt.createElement(wo, { placement: e, ...o, color: a }), r)
);
Mt.displayName = "Tooltip";

// src/components/components/tooltip/WithTooltip.tsx
var { document: ot } = Co, So = gr.div`
  display: inline-block;
  cursor: ${(e) => e.trigger === "hover" || e.trigger?.includes("hover") ? "default" : "pointer"};
`, Ao = gr.g`
  cursor: ${(e) => e.trigger === "hover" || e.trigger?.includes("hover") ? "default" : "pointer"};
`, To = /* @__PURE__ */ n(({
  svg: e = !1,
  trigger: t = "click",
  closeOnOutsideClick: r = !1,
  placement: o = "top",
  modifiers: i = [
    {
      name: "preventOverflow",
      options: {
        padding: 8
      }
    },
    {
      name: "offset",
      options: {
        offset: [8, 8]
      }
    },
    {
      name: "arrow",
      options: {
        padding: 8
      }
    }
  ],
  hasChrome: a = !0,
  defaultVisible: u = !1,
  withArrows: p,
  offset: f,
  tooltip: s,
  children: l,
  closeOnTriggerHidden: m,
  mutationObserverOptions: d,
  delayHide: c = t === "hover" ? 200 : 0,
  visible: O,
  interactive: h,
  delayShow: v = t === "hover" ? 400 : 0,
  strategy: R,
  followCursor: T,
  onVisibleChange: L,
  ...g
}) => {
  let w = e ? Ao : So, {
    getArrowProps: y,
    getTooltipProps: E,
    setTooltipRef: C,
    setTriggerRef: x,
    visible: b,
    state: M
  } = mr(
    {
      trigger: t,
      placement: o,
      defaultVisible: u,
      delayHide: c,
      interactive: h,
      closeOnOutsideClick: r,
      closeOnTriggerHidden: m,
      onVisibleChange: L,
      delayShow: v,
      followCursor: T,
      mutationObserverOptions: d,
      visible: O,
      offset: f
    },
    {
      modifiers: i,
      strategy: R
    }
  ), U = b ? Ue.createElement(
    Mt,
    {
      placement: M?.placement,
      ref: C,
      hasChrome: a,
      arrowProps: y(),
      withArrows: p,
      ...E()
    },
    typeof s == "function" ? s({ onHide: /* @__PURE__ */ n(() => L(!1), "onHide") }) : s
  ) : null;
  return Ue.createElement(Ue.Fragment, null, Ue.createElement(w, { trigger: t, ref: x, ...g }, l), b && Eo.createPortal(U, ot.body));
}, "WithTooltipPure"), Bp = /* @__PURE__ */ n(({
  startOpen: e = !1,
  onVisibleChange: t,
  ...r
}) => {
  let [o, i] = Po(e), a = Oo(
    (u) => {
      t && t(u) === !1 || i(u);
    },
    [t]
  );
  return Ro(() => {
    let u = /* @__PURE__ */ n(() => a(!1), "hide");
    ot.addEventListener("keydown", u, !1);
    let p = Array.from(ot.getElementsByTagName("iframe")), f = [];
    return p.forEach((s) => {
      let l = /* @__PURE__ */ n(() => {
        try {
          s.contentWindow.document && (s.contentWindow.document.addEventListener("click", u), f.push(() => {
            try {
              s.contentWindow.document.removeEventListener("click", u);
            } catch {
            }
          }));
        } catch {
        }
      }, "bind");
      l(), s.addEventListener("load", l), f.push(() => {
        s.removeEventListener("load", l);
      });
    }), () => {
      ot.removeEventListener("keydown", u), f.forEach((s) => {
        s();
      });
    };
  }), Ue.createElement(To, { ...r, visible: o, onVisibleChange: a });
}, "WithToolTipState");

export {
  To as a,
  Bp as b
};
