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

//# sourceMappingURL=composite2.js.map