import { i as L } from "./floating-ui.utils.dom-jr2suqy2.js";
const d = "ArrowUp", h = "ArrowDown", R = "ArrowLeft", T = "ArrowRight", g = "Home", e = "End", E = /* @__PURE__ */ new Set([R, T]), I = /* @__PURE__ */ new Set([R, T, g, e]), P = /* @__PURE__ */ new Set([d, h]), Y = /* @__PURE__ */ new Set([d, h, g, e]), A = /* @__PURE__ */ new Set([...E, ...P]), F = /* @__PURE__ */ new Set([...A, g, e]), N = /* @__PURE__ */ new Set([d, h, R, T, g, e]), O = "Shift", u = "Control", W = "Alt", _ = "Meta", K = /* @__PURE__ */ new Set([O, u, W, _]);
function w(t) {
  return L(t) && t.tagName === "INPUT";
}
function B(t) {
  return !!(w(t) && t.selectionStart != null || L(t) && t.tagName === "TEXTAREA");
}
function y(t, s, f, c) {
  if (!t || !s || !s.scrollTo)
    return;
  let r = t.scrollLeft, n = t.scrollTop;
  const S = t.clientWidth < t.scrollWidth, M = t.clientHeight < t.scrollHeight;
  if (S && c !== "vertical") {
    const o = p(t, s, "left"), l = a(t), i = a(s);
    f === "ltr" && (o + s.offsetWidth + i.scrollMarginRight > t.scrollLeft + t.clientWidth - l.scrollPaddingRight ? r = o + s.offsetWidth + i.scrollMarginRight - t.clientWidth + l.scrollPaddingRight : o - i.scrollMarginLeft < t.scrollLeft + l.scrollPaddingLeft && (r = o - i.scrollMarginLeft - l.scrollPaddingLeft)), f === "rtl" && (o - i.scrollMarginRight < t.scrollLeft + l.scrollPaddingLeft ? r = o - i.scrollMarginLeft - l.scrollPaddingLeft : o + s.offsetWidth + i.scrollMarginRight > t.scrollLeft + t.clientWidth - l.scrollPaddingRight && (r = o + s.offsetWidth + i.scrollMarginRight - t.clientWidth + l.scrollPaddingRight));
  }
  if (M && c !== "horizontal") {
    const o = p(t, s, "top"), l = a(t), i = a(s);
    o - i.scrollMarginTop < t.scrollTop + l.scrollPaddingTop ? n = o - i.scrollMarginTop - l.scrollPaddingTop : o + s.offsetHeight + i.scrollMarginBottom > t.scrollTop + t.clientHeight - l.scrollPaddingBottom && (n = o + s.offsetHeight + i.scrollMarginBottom - t.clientHeight + l.scrollPaddingBottom);
  }
  t.scrollTo({
    left: r,
    top: n,
    behavior: "auto"
  });
}
function p(t, s, f) {
  const c = f === "left" ? "offsetLeft" : "offsetTop";
  let r = 0;
  for (; s.offsetParent && (r += s[c], s.offsetParent !== t); )
    s = s.offsetParent;
  return r;
}
function a(t) {
  const s = getComputedStyle(t);
  return {
    scrollMarginTop: parseFloat(s.scrollMarginTop) || 0,
    scrollMarginRight: parseFloat(s.scrollMarginRight) || 0,
    scrollMarginBottom: parseFloat(s.scrollMarginBottom) || 0,
    scrollMarginLeft: parseFloat(s.scrollMarginLeft) || 0,
    scrollPaddingTop: parseFloat(s.scrollPaddingTop) || 0,
    scrollPaddingRight: parseFloat(s.scrollPaddingRight) || 0,
    scrollPaddingBottom: parseFloat(s.scrollPaddingBottom) || 0,
    scrollPaddingLeft: parseFloat(s.scrollPaddingLeft) || 0
  };
}
export {
  F as A,
  N as C,
  e as E,
  g as H,
  K as M,
  O as S,
  Y as V,
  A as a,
  h as b,
  T as c,
  R as d,
  d as e,
  P as f,
  I as g,
  E as h,
  B as i,
  y as s
};
