import * as c from "react";
import P, { useState as lt } from "react";
import { h as _, u as O, P as W, c as he, S as Se, b as L, a as it, g as st } from "./index.DTgp6yvu.js";
import { jsx as w, jsxs as ut, Fragment as dt } from "react/jsx-runtime";
import { u as ft, d as Fe, P as J } from "./theme.BGpzuiJ2.js";
var oe = "focusScope.autoFocusOnMount", ae = "focusScope.autoFocusOnUnmount", we = { bubbles: !1, cancelable: !0 }, vt = "FocusScope", ht = c.forwardRef((e, t) => {
  const {
    loop: r = !1,
    trapped: n = !1,
    onMountAutoFocus: o,
    onUnmountAutoFocus: l,
    ...i
  } = e, [a, u] = c.useState(null), d = _(o), f = _(l), v = c.useRef(null), h = O(t, (s) => u(s)), m = c.useRef({
    paused: !1,
    pause() {
      this.paused = !0;
    },
    resume() {
      this.paused = !1;
    }
  }).current;
  c.useEffect(() => {
    if (n) {
      let s = function(E) {
        if (m.paused || !a) return;
        const C = E.target;
        a.contains(C) ? v.current = C : k(v.current, { select: !0 });
      }, g = function(E) {
        if (m.paused || !a) return;
        const C = E.relatedTarget;
        C !== null && (a.contains(C) || k(v.current, { select: !0 }));
      }, p = function(E) {
        if (document.activeElement === document.body)
          for (const y of E)
            y.removedNodes.length > 0 && k(a);
      };
      document.addEventListener("focusin", s), document.addEventListener("focusout", g);
      const S = new MutationObserver(p);
      return a && S.observe(a, { childList: !0, subtree: !0 }), () => {
        document.removeEventListener("focusin", s), document.removeEventListener("focusout", g), S.disconnect();
      };
    }
  }, [n, a, m.paused]), c.useEffect(() => {
    if (a) {
      Ce.add(m);
      const s = document.activeElement;
      if (!a.contains(s)) {
        const p = new CustomEvent(oe, we);
        a.addEventListener(oe, d), a.dispatchEvent(p), p.defaultPrevented || (mt(wt(Ne(a)), { select: !0 }), document.activeElement === s && k(a));
      }
      return () => {
        a.removeEventListener(oe, d), setTimeout(() => {
          const p = new CustomEvent(ae, we);
          a.addEventListener(ae, f), a.dispatchEvent(p), p.defaultPrevented || k(s ?? document.body, { select: !0 }), a.removeEventListener(ae, f), Ce.remove(m);
        }, 0);
      };
    }
  }, [a, d, f, m]);
  const b = c.useCallback(
    (s) => {
      if (!r && !n || m.paused) return;
      const g = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, p = document.activeElement;
      if (g && p) {
        const S = s.currentTarget, [E, C] = pt(S);
        E && C ? !s.shiftKey && p === C ? (s.preventDefault(), r && k(E, { select: !0 })) : s.shiftKey && p === E && (s.preventDefault(), r && k(C, { select: !0 })) : p === S && s.preventDefault();
      }
    },
    [r, n, m.paused]
  );
  return /* @__PURE__ */ w(W.div, { tabIndex: -1, ...i, ref: h, onKeyDown: b });
});
ht.displayName = vt;
function mt(e, { select: t = !1 } = {}) {
  const r = document.activeElement;
  for (const n of e)
    if (k(n, { select: t }), document.activeElement !== r) return;
}
function pt(e) {
  const t = Ne(e), r = Ee(t, e), n = Ee(t.reverse(), e);
  return [r, n];
}
function Ne(e) {
  const t = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
    acceptNode: (n) => {
      const o = n.tagName === "INPUT" && n.type === "hidden";
      return n.disabled || n.hidden || o ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
    }
  });
  for (; r.nextNode(); ) t.push(r.currentNode);
  return t;
}
function Ee(e, t) {
  for (const r of e)
    if (!bt(r, { upTo: t })) return r;
}
function bt(e, { upTo: t }) {
  if (getComputedStyle(e).visibility === "hidden") return !0;
  for (; e; ) {
    if (t !== void 0 && e === t) return !1;
    if (getComputedStyle(e).display === "none") return !0;
    e = e.parentElement;
  }
  return !1;
}
function gt(e) {
  return e instanceof HTMLInputElement && "select" in e;
}
function k(e, { select: t = !1 } = {}) {
  if (e && e.focus) {
    const r = document.activeElement;
    e.focus({ preventScroll: !0 }), e !== r && gt(e) && t && e.select();
  }
}
var Ce = St();
function St() {
  let e = [];
  return {
    add(t) {
      const r = e[0];
      t !== r && (r == null || r.pause()), e = ye(e, t), e.unshift(t);
    },
    remove(t) {
      var r;
      e = ye(e, t), (r = e[0]) == null || r.resume();
    }
  };
}
function ye(e, t) {
  const r = [...e], n = r.indexOf(t);
  return n !== -1 && r.splice(n, 1), r;
}
function wt(e) {
  return e.filter((t) => t.tagName !== "A");
}
var ce = 0;
function Br() {
  c.useEffect(() => {
    const e = document.querySelectorAll("[data-radix-focus-guard]");
    return document.body.insertAdjacentElement("afterbegin", e[0] ?? Re()), document.body.insertAdjacentElement("beforeend", e[1] ?? Re()), ce++, () => {
      ce === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), ce--;
    };
  }, []);
}
function Re() {
  const e = document.createElement("span");
  return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
}
var M = function() {
  return M = Object.assign || function(t) {
    for (var r, n = 1, o = arguments.length; n < o; n++) {
      r = arguments[n];
      for (var l in r) Object.prototype.hasOwnProperty.call(r, l) && (t[l] = r[l]);
    }
    return t;
  }, M.apply(this, arguments);
};
function _e(e, t) {
  var r = {};
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
      t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
  return r;
}
function Et(e, t, r) {
  if (r || arguments.length === 2) for (var n = 0, o = t.length, l; n < o; n++)
    (l || !(n in t)) && (l || (l = Array.prototype.slice.call(t, 0, n)), l[n] = t[n]);
  return e.concat(l || Array.prototype.slice.call(t));
}
var Z = "right-scroll-bar-position", $ = "width-before-scroll-bar", Ct = "with-scroll-bars-hidden", yt = "--removed-body-scroll-bar-size";
function le(e, t) {
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
}
function Rt(e, t) {
  var r = lt(function() {
    return {
      // value
      value: e,
      // last callback
      callback: t,
      // "memoized" public interface
      facade: {
        get current() {
          return r.value;
        },
        set current(n) {
          var o = r.value;
          o !== n && (r.value = n, r.callback(n, o));
        }
      }
    };
  })[0];
  return r.callback = t, r.facade;
}
var Tt = typeof window < "u" ? c.useLayoutEffect : c.useEffect, Te = /* @__PURE__ */ new WeakMap();
function Pt(e, t) {
  var r = Rt(null, function(n) {
    return e.forEach(function(o) {
      return le(o, n);
    });
  });
  return Tt(function() {
    var n = Te.get(r);
    if (n) {
      var o = new Set(n), l = new Set(e), i = r.current;
      o.forEach(function(a) {
        l.has(a) || le(a, null);
      }), l.forEach(function(a) {
        o.has(a) || le(a, i);
      });
    }
    Te.set(r, e);
  }, [e]), r;
}
function At(e) {
  return e;
}
function xt(e, t) {
  t === void 0 && (t = At);
  var r = [], n = !1, o = {
    read: function() {
      if (n)
        throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
      return r.length ? r[r.length - 1] : e;
    },
    useMedium: function(l) {
      var i = t(l, n);
      return r.push(i), function() {
        r = r.filter(function(a) {
          return a !== i;
        });
      };
    },
    assignSyncMedium: function(l) {
      for (n = !0; r.length; ) {
        var i = r;
        r = [], i.forEach(l);
      }
      r = {
        push: function(a) {
          return l(a);
        },
        filter: function() {
          return r;
        }
      };
    },
    assignMedium: function(l) {
      n = !0;
      var i = [];
      if (r.length) {
        var a = r;
        r = [], a.forEach(l), i = r;
      }
      var u = function() {
        var f = i;
        i = [], f.forEach(l);
      }, d = function() {
        return Promise.resolve().then(u);
      };
      d(), r = {
        push: function(f) {
          i.push(f), d();
        },
        filter: function(f) {
          return i = i.filter(f), r;
        }
      };
    }
  };
  return o;
}
function It(e) {
  e === void 0 && (e = {});
  var t = xt(null);
  return t.options = M({ async: !0, ssr: !1 }, e), t;
}
var Me = function(e) {
  var t = e.sideCar, r = _e(e, ["sideCar"]);
  if (!t)
    throw new Error("Sidecar: please provide `sideCar` property to import the right car");
  var n = t.read();
  if (!n)
    throw new Error("Sidecar medium not found");
  return c.createElement(n, M({}, r));
};
Me.isSideCarExport = !0;
function Lt(e, t) {
  return e.useMedium(t), Me;
}
var Oe = It(), ie = function() {
}, ee = c.forwardRef(function(e, t) {
  var r = c.useRef(null), n = c.useState({
    onScrollCapture: ie,
    onWheelCapture: ie,
    onTouchMoveCapture: ie
  }), o = n[0], l = n[1], i = e.forwardProps, a = e.children, u = e.className, d = e.removeScrollBar, f = e.enabled, v = e.shards, h = e.sideCar, m = e.noIsolation, b = e.inert, s = e.allowPinchZoom, g = e.as, p = g === void 0 ? "div" : g, S = e.gapMode, E = _e(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = h, y = Pt([r, t]), A = M(M({}, E), o);
  return c.createElement(
    c.Fragment,
    null,
    f && c.createElement(C, { sideCar: Oe, removeScrollBar: d, shards: v, noIsolation: m, inert: b, setCallbacks: l, allowPinchZoom: !!s, lockRef: r, gapMode: S }),
    i ? c.cloneElement(c.Children.only(a), M(M({}, A), { ref: y })) : c.createElement(p, M({}, A, { className: u, ref: y }), a)
  );
});
ee.defaultProps = {
  enabled: !0,
  removeScrollBar: !0,
  inert: !1
};
ee.classNames = {
  fullWidth: $,
  zeroRight: Z
};
var Ft = function() {
  if (typeof __webpack_nonce__ < "u")
    return __webpack_nonce__;
};
function Nt() {
  if (!document)
    return null;
  var e = document.createElement("style");
  e.type = "text/css";
  var t = Ft();
  return t && e.setAttribute("nonce", t), e;
}
function _t(e, t) {
  e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
}
function Mt(e) {
  var t = document.head || document.getElementsByTagName("head")[0];
  t.appendChild(e);
}
var Ot = function() {
  var e = 0, t = null;
  return {
    add: function(r) {
      e == 0 && (t = Nt()) && (_t(t, r), Mt(t)), e++;
    },
    remove: function() {
      e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
    }
  };
}, Dt = function() {
  var e = Ot();
  return function(t, r) {
    c.useEffect(function() {
      return e.add(t), function() {
        e.remove();
      };
    }, [t && r]);
  };
}, De = function() {
  var e = Dt(), t = function(r) {
    var n = r.styles, o = r.dynamic;
    return e(n, o), null;
  };
  return t;
}, kt = {
  left: 0,
  top: 0,
  right: 0,
  gap: 0
}, se = function(e) {
  return parseInt(e || "", 10) || 0;
}, Wt = function(e) {
  var t = window.getComputedStyle(document.body), r = t[e === "padding" ? "paddingLeft" : "marginLeft"], n = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
  return [se(r), se(n), se(o)];
}, Bt = function(e) {
  if (e === void 0 && (e = "margin"), typeof window > "u")
    return kt;
  var t = Wt(e), r = document.documentElement.clientWidth, n = window.innerWidth;
  return {
    left: t[0],
    top: t[1],
    right: t[2],
    gap: Math.max(0, n - r + t[2] - t[0])
  };
}, Ht = De(), z = "data-scroll-locked", Ut = function(e, t, r, n) {
  var o = e.left, l = e.top, i = e.right, a = e.gap;
  return r === void 0 && (r = "margin"), `
  .`.concat(Ct, ` {
   overflow: hidden `).concat(n, `;
   padding-right: `).concat(a, "px ").concat(n, `;
  }
  body[`).concat(z, `] {
    overflow: hidden `).concat(n, `;
    overscroll-behavior: contain;
    `).concat([
    t && "position: relative ".concat(n, ";"),
    r === "margin" && `
    padding-left: `.concat(o, `px;
    padding-top: `).concat(l, `px;
    padding-right: `).concat(i, `px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a, "px ").concat(n, `;
    `),
    r === "padding" && "padding-right: ".concat(a, "px ").concat(n, ";")
  ].filter(Boolean).join(""), `
  }
  
  .`).concat(Z, ` {
    right: `).concat(a, "px ").concat(n, `;
  }
  
  .`).concat($, ` {
    margin-right: `).concat(a, "px ").concat(n, `;
  }
  
  .`).concat(Z, " .").concat(Z, ` {
    right: 0 `).concat(n, `;
  }
  
  .`).concat($, " .").concat($, ` {
    margin-right: 0 `).concat(n, `;
  }
  
  body[`).concat(z, `] {
    `).concat(yt, ": ").concat(a, `px;
  }
`);
}, Pe = function() {
  var e = parseInt(document.body.getAttribute(z) || "0", 10);
  return isFinite(e) ? e : 0;
}, Yt = function() {
  c.useEffect(function() {
    return document.body.setAttribute(z, (Pe() + 1).toString()), function() {
      var e = Pe() - 1;
      e <= 0 ? document.body.removeAttribute(z) : document.body.setAttribute(z, e.toString());
    };
  }, []);
}, zt = function(e) {
  var t = e.noRelative, r = e.noImportant, n = e.gapMode, o = n === void 0 ? "margin" : n;
  Yt();
  var l = c.useMemo(function() {
    return Bt(o);
  }, [o]);
  return c.createElement(Ht, { styles: Ut(l, !t, o, r ? "" : "!important") });
}, fe = !1;
if (typeof window < "u")
  try {
    var X = Object.defineProperty({}, "passive", {
      get: function() {
        return fe = !0, !0;
      }
    });
    window.addEventListener("test", X, X), window.removeEventListener("test", X, X);
  } catch {
    fe = !1;
  }
var H = fe ? { passive: !1 } : !1, Vt = function(e) {
  return e.tagName === "TEXTAREA";
}, ke = function(e, t) {
  var r = window.getComputedStyle(e);
  return (
    // not-not-scrollable
    r[t] !== "hidden" && // contains scroll inside self
    !(r.overflowY === r.overflowX && !Vt(e) && r[t] === "visible")
  );
}, Xt = function(e) {
  return ke(e, "overflowY");
}, Kt = function(e) {
  return ke(e, "overflowX");
}, Ae = function(e, t) {
  var r = t.ownerDocument, n = t;
  do {
    typeof ShadowRoot < "u" && n instanceof ShadowRoot && (n = n.host);
    var o = We(e, n);
    if (o) {
      var l = Be(e, n), i = l[1], a = l[2];
      if (i > a)
        return !0;
    }
    n = n.parentNode;
  } while (n && n !== r.body);
  return !1;
}, Gt = function(e) {
  var t = e.scrollTop, r = e.scrollHeight, n = e.clientHeight;
  return [
    t,
    r,
    n
  ];
}, jt = function(e) {
  var t = e.scrollLeft, r = e.scrollWidth, n = e.clientWidth;
  return [
    t,
    r,
    n
  ];
}, We = function(e, t) {
  return e === "v" ? Xt(t) : Kt(t);
}, Be = function(e, t) {
  return e === "v" ? Gt(t) : jt(t);
}, Zt = function(e, t) {
  return e === "h" && t === "rtl" ? -1 : 1;
}, $t = function(e, t, r, n, o) {
  var l = Zt(e, window.getComputedStyle(t).direction), i = l * n, a = r.target, u = t.contains(a), d = !1, f = i > 0, v = 0, h = 0;
  do {
    var m = Be(e, a), b = m[0], s = m[1], g = m[2], p = s - g - l * b;
    (b || p) && We(e, a) && (v += p, h += b), a instanceof ShadowRoot ? a = a.host : a = a.parentNode;
  } while (
    // portaled content
    !u && a !== document.body || // self content
    u && (t.contains(a) || t === a)
  );
  return (f && Math.abs(v) < 1 || !f && Math.abs(h) < 1) && (d = !0), d;
}, K = function(e) {
  return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
}, xe = function(e) {
  return [e.deltaX, e.deltaY];
}, Ie = function(e) {
  return e && "current" in e ? e.current : e;
}, qt = function(e, t) {
  return e[0] === t[0] && e[1] === t[1];
}, Qt = function(e) {
  return `
  .block-interactivity-`.concat(e, ` {pointer-events: none;}
  .allow-interactivity-`).concat(e, ` {pointer-events: all;}
`);
}, Jt = 0, U = [];
function er(e) {
  var t = c.useRef([]), r = c.useRef([0, 0]), n = c.useRef(), o = c.useState(Jt++)[0], l = c.useState(De)[0], i = c.useRef(e);
  c.useEffect(function() {
    i.current = e;
  }, [e]), c.useEffect(function() {
    if (e.inert) {
      document.body.classList.add("block-interactivity-".concat(o));
      var s = Et([e.lockRef.current], (e.shards || []).map(Ie), !0).filter(Boolean);
      return s.forEach(function(g) {
        return g.classList.add("allow-interactivity-".concat(o));
      }), function() {
        document.body.classList.remove("block-interactivity-".concat(o)), s.forEach(function(g) {
          return g.classList.remove("allow-interactivity-".concat(o));
        });
      };
    }
  }, [e.inert, e.lockRef.current, e.shards]);
  var a = c.useCallback(function(s, g) {
    if ("touches" in s && s.touches.length === 2)
      return !i.current.allowPinchZoom;
    var p = K(s), S = r.current, E = "deltaX" in s ? s.deltaX : S[0] - p[0], C = "deltaY" in s ? s.deltaY : S[1] - p[1], y, A = s.target, I = Math.abs(E) > Math.abs(C) ? "h" : "v";
    if ("touches" in s && I === "h" && A.type === "range")
      return !1;
    var R = Ae(I, A);
    if (!R)
      return !0;
    if (R ? y = I : (y = I === "v" ? "h" : "v", R = Ae(I, A)), !R)
      return !1;
    if (!n.current && "changedTouches" in s && (E || C) && (n.current = y), !y)
      return !0;
    var T = n.current || y;
    return $t(T, g, s, T === "h" ? E : C);
  }, []), u = c.useCallback(function(s) {
    var g = s;
    if (!(!U.length || U[U.length - 1] !== l)) {
      var p = "deltaY" in g ? xe(g) : K(g), S = t.current.filter(function(y) {
        return y.name === g.type && (y.target === g.target || g.target === y.shadowParent) && qt(y.delta, p);
      })[0];
      if (S && S.should) {
        g.cancelable && g.preventDefault();
        return;
      }
      if (!S) {
        var E = (i.current.shards || []).map(Ie).filter(Boolean).filter(function(y) {
          return y.contains(g.target);
        }), C = E.length > 0 ? a(g, E[0]) : !i.current.noIsolation;
        C && g.cancelable && g.preventDefault();
      }
    }
  }, []), d = c.useCallback(function(s, g, p, S) {
    var E = { name: s, delta: g, target: p, should: S, shadowParent: tr(p) };
    t.current.push(E), setTimeout(function() {
      t.current = t.current.filter(function(C) {
        return C !== E;
      });
    }, 1);
  }, []), f = c.useCallback(function(s) {
    r.current = K(s), n.current = void 0;
  }, []), v = c.useCallback(function(s) {
    d(s.type, xe(s), s.target, a(s, e.lockRef.current));
  }, []), h = c.useCallback(function(s) {
    d(s.type, K(s), s.target, a(s, e.lockRef.current));
  }, []);
  c.useEffect(function() {
    return U.push(l), e.setCallbacks({
      onScrollCapture: v,
      onWheelCapture: v,
      onTouchMoveCapture: h
    }), document.addEventListener("wheel", u, H), document.addEventListener("touchmove", u, H), document.addEventListener("touchstart", f, H), function() {
      U = U.filter(function(s) {
        return s !== l;
      }), document.removeEventListener("wheel", u, H), document.removeEventListener("touchmove", u, H), document.removeEventListener("touchstart", f, H);
    };
  }, []);
  var m = e.removeScrollBar, b = e.inert;
  return c.createElement(
    c.Fragment,
    null,
    b ? c.createElement(l, { styles: Qt(o) }) : null,
    m ? c.createElement(zt, { gapMode: e.gapMode }) : null
  );
}
function tr(e) {
  for (var t = null; e !== null; )
    e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
  return t;
}
const rr = Lt(Oe, er);
var nr = c.forwardRef(function(e, t) {
  return c.createElement(ee, M({}, e, { ref: t, sideCar: rr }));
});
nr.classNames = ee.classNames;
var or = function(e) {
  if (typeof document > "u")
    return null;
  var t = Array.isArray(e) ? e[0] : e;
  return t.ownerDocument.body;
}, Y = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), j = {}, ue = 0, He = function(e) {
  return e && (e.host || He(e.parentNode));
}, ar = function(e, t) {
  return t.map(function(r) {
    if (e.contains(r))
      return r;
    var n = He(r);
    return n && e.contains(n) ? n : (console.error("aria-hidden", r, "in not contained inside", e, ". Doing nothing"), null);
  }).filter(function(r) {
    return !!r;
  });
}, cr = function(e, t, r, n) {
  var o = ar(t, Array.isArray(e) ? e : [e]);
  j[r] || (j[r] = /* @__PURE__ */ new WeakMap());
  var l = j[r], i = [], a = /* @__PURE__ */ new Set(), u = new Set(o), d = function(v) {
    !v || a.has(v) || (a.add(v), d(v.parentNode));
  };
  o.forEach(d);
  var f = function(v) {
    !v || u.has(v) || Array.prototype.forEach.call(v.children, function(h) {
      if (a.has(h))
        f(h);
      else
        try {
          var m = h.getAttribute(n), b = m !== null && m !== "false", s = (Y.get(h) || 0) + 1, g = (l.get(h) || 0) + 1;
          Y.set(h, s), l.set(h, g), i.push(h), s === 1 && b && G.set(h, !0), g === 1 && h.setAttribute(r, "true"), b || h.setAttribute(n, "true");
        } catch (p) {
          console.error("aria-hidden: cannot operate on ", h, p);
        }
    });
  };
  return f(t), a.clear(), ue++, function() {
    i.forEach(function(v) {
      var h = Y.get(v) - 1, m = l.get(v) - 1;
      Y.set(v, h), l.set(v, m), h || (G.has(v) || v.removeAttribute(n), G.delete(v)), m || v.removeAttribute(r);
    }), ue--, ue || (Y = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), j = {});
  };
}, Hr = function(e, t, r) {
  r === void 0 && (r = "data-aria-hidden");
  var n = Array.from(Array.isArray(e) ? e : [e]), o = or(e);
  return o ? (n.push.apply(n, Array.from(o.querySelectorAll("[aria-live], script"))), cr(n, o, r, "aria-hidden")) : function() {
    return null;
  };
};
const Ur = (e) => {
  if (!c.isValidElement(e)) throw Error(`Expected a single React Element child, but got: ${c.Children.toArray(e).map((t) => typeof t == "object" && "type" in t && typeof t.type == "string" ? t.type : typeof t).join(", ")}`);
  return e;
};
function lr(e) {
  const t = e + "CollectionProvider", [r, n] = he(t), [o, l] = r(
    t,
    { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
  ), i = (m) => {
    const { scope: b, children: s } = m, g = P.useRef(null), p = P.useRef(/* @__PURE__ */ new Map()).current;
    return /* @__PURE__ */ w(o, { scope: b, itemMap: p, collectionRef: g, children: s });
  };
  i.displayName = t;
  const a = e + "CollectionSlot", u = P.forwardRef(
    (m, b) => {
      const { scope: s, children: g } = m, p = l(a, s), S = O(b, p.collectionRef);
      return /* @__PURE__ */ w(Se, { ref: S, children: g });
    }
  );
  u.displayName = a;
  const d = e + "CollectionItemSlot", f = "data-radix-collection-item", v = P.forwardRef(
    (m, b) => {
      const { scope: s, children: g, ...p } = m, S = P.useRef(null), E = O(b, S), C = l(d, s);
      return P.useEffect(() => (C.itemMap.set(S, { ref: S, ...p }), () => void C.itemMap.delete(S))), /* @__PURE__ */ w(Se, { [f]: "", ref: E, children: g });
    }
  );
  v.displayName = d;
  function h(m) {
    const b = l(e + "CollectionConsumer", m);
    return P.useCallback(() => {
      const g = b.collectionRef.current;
      if (!g) return [];
      const p = Array.from(g.querySelectorAll(`[${f}]`));
      return Array.from(b.itemMap.values()).sort(
        (C, y) => p.indexOf(C.ref.current) - p.indexOf(y.ref.current)
      );
    }, [b.collectionRef, b.itemMap]);
  }
  return [
    { Provider: i, Slot: u, ItemSlot: v },
    h,
    n
  ];
}
var de = "rovingFocusGroup.onEntryFocus", ir = { bubbles: !1, cancelable: !0 }, te = "RovingFocusGroup", [ve, Ue, sr] = lr(te), [ur, Yr] = he(
  te,
  [sr]
), [dr, fr] = ur(te), Ye = c.forwardRef(
  (e, t) => /* @__PURE__ */ w(ve.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ w(ve.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ w(vr, { ...e, ref: t }) }) })
);
Ye.displayName = te;
var vr = c.forwardRef((e, t) => {
  const {
    __scopeRovingFocusGroup: r,
    orientation: n,
    loop: o = !1,
    dir: l,
    currentTabStopId: i,
    defaultCurrentTabStopId: a,
    onCurrentTabStopIdChange: u,
    onEntryFocus: d,
    preventScrollOnEntryFocus: f = !1,
    ...v
  } = e, h = c.useRef(null), m = O(t, h), b = Fe(l), [s = null, g] = it({
    prop: i,
    defaultProp: a,
    onChange: u
  }), [p, S] = c.useState(!1), E = _(d), C = Ue(r), y = c.useRef(!1), [A, I] = c.useState(0);
  return c.useEffect(() => {
    const R = h.current;
    if (R)
      return R.addEventListener(de, E), () => R.removeEventListener(de, E);
  }, [E]), /* @__PURE__ */ w(
    dr,
    {
      scope: r,
      orientation: n,
      dir: b,
      loop: o,
      currentTabStopId: s,
      onItemFocus: c.useCallback(
        (R) => g(R),
        [g]
      ),
      onItemShiftTab: c.useCallback(() => S(!0), []),
      onFocusableItemAdd: c.useCallback(
        () => I((R) => R + 1),
        []
      ),
      onFocusableItemRemove: c.useCallback(
        () => I((R) => R - 1),
        []
      ),
      children: /* @__PURE__ */ w(
        W.div,
        {
          tabIndex: p || A === 0 ? -1 : 0,
          "data-orientation": n,
          ...v,
          ref: m,
          style: { outline: "none", ...e.style },
          onMouseDown: L(e.onMouseDown, () => {
            y.current = !0;
          }),
          onFocus: L(e.onFocus, (R) => {
            const T = !y.current;
            if (R.target === R.currentTarget && T && !p) {
              const x = new CustomEvent(de, ir);
              if (R.currentTarget.dispatchEvent(x), !x.defaultPrevented) {
                const N = C().filter((B) => B.focusable), ge = N.find((B) => B.active), at = N.find((B) => B.id === s), ct = [ge, at, ...N].filter(
                  Boolean
                ).map((B) => B.ref.current);
                Xe(ct, f);
              }
            }
            y.current = !1;
          }),
          onBlur: L(e.onBlur, () => S(!1))
        }
      )
    }
  );
}), ze = "RovingFocusGroupItem", Ve = c.forwardRef(
  (e, t) => {
    const {
      __scopeRovingFocusGroup: r,
      focusable: n = !0,
      active: o = !1,
      tabStopId: l,
      ...i
    } = e, a = ft(), u = l || a, d = fr(ze, r), f = d.currentTabStopId === u, v = Ue(r), { onFocusableItemAdd: h, onFocusableItemRemove: m } = d;
    return c.useEffect(() => {
      if (n)
        return h(), () => m();
    }, [n, h, m]), /* @__PURE__ */ w(
      ve.ItemSlot,
      {
        scope: r,
        id: u,
        focusable: n,
        active: o,
        children: /* @__PURE__ */ w(
          W.span,
          {
            tabIndex: f ? 0 : -1,
            "data-orientation": d.orientation,
            ...i,
            ref: t,
            onMouseDown: L(e.onMouseDown, (b) => {
              n ? d.onItemFocus(u) : b.preventDefault();
            }),
            onFocus: L(e.onFocus, () => d.onItemFocus(u)),
            onKeyDown: L(e.onKeyDown, (b) => {
              if (b.key === "Tab" && b.shiftKey) {
                d.onItemShiftTab();
                return;
              }
              if (b.target !== b.currentTarget) return;
              const s = pr(b, d.orientation, d.dir);
              if (s !== void 0) {
                if (b.metaKey || b.ctrlKey || b.altKey || b.shiftKey) return;
                b.preventDefault();
                let p = v().filter((S) => S.focusable).map((S) => S.ref.current);
                if (s === "last") p.reverse();
                else if (s === "prev" || s === "next") {
                  s === "prev" && p.reverse();
                  const S = p.indexOf(b.currentTarget);
                  p = d.loop ? br(p, S + 1) : p.slice(S + 1);
                }
                setTimeout(() => Xe(p));
              }
            })
          }
        )
      }
    );
  }
);
Ve.displayName = ze;
var hr = {
  ArrowLeft: "prev",
  ArrowUp: "prev",
  ArrowRight: "next",
  ArrowDown: "next",
  PageUp: "first",
  Home: "first",
  PageDown: "last",
  End: "last"
};
function mr(e, t) {
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
}
function pr(e, t, r) {
  const n = mr(e.key, r);
  if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(n)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(n)))
    return hr[n];
}
function Xe(e, t = !1) {
  const r = document.activeElement;
  for (const n of e)
    if (n === r || (n.focus({ preventScroll: t }), document.activeElement !== r)) return;
}
function br(e, t) {
  return e.map((r, n) => e[(t + n) % e.length]);
}
var zr = Ye, Vr = Ve;
const gr = P.forwardRef((e, t) => P.createElement("svg", { width: "9", height: "9", viewBox: "0 0 9 9", fill: "currentcolor", xmlns: "http://www.w3.org/2000/svg", ...e, ref: t }, P.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z" })));
gr.displayName = "ThickDividerHorizontalIcon";
const Sr = P.forwardRef((e, t) => P.createElement("svg", { width: "9", height: "9", viewBox: "0 0 9 9", fill: "currentcolor", xmlns: "http://www.w3.org/2000/svg", ...e, ref: t }, P.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z" })));
Sr.displayName = "ThickCheckIcon";
const wr = P.forwardRef((e, t) => P.createElement("svg", { width: "9", height: "9", viewBox: "0 0 9 9", fill: "currentcolor", xmlns: "http://www.w3.org/2000/svg", ...e, ref: t }, P.createElement("path", { d: "M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z" })));
wr.displayName = "ChevronDownIcon";
const Er = P.forwardRef((e, t) => P.createElement("svg", { width: "9", height: "9", viewBox: "0 0 9 9", fill: "currentcolor", xmlns: "http://www.w3.org/2000/svg", ...e, ref: t }, P.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z" })));
Er.displayName = "ThickChevronRightIcon";
function Cr(e, [t, r]) {
  return Math.min(r, Math.max(t, e));
}
function yr(e, t) {
  return c.useReducer((r, n) => t[r][n] ?? r, e);
}
var me = "ScrollArea", [Ke, Xr] = he(me), [Rr, F] = Ke(me), Ge = c.forwardRef(
  (e, t) => {
    const {
      __scopeScrollArea: r,
      type: n = "hover",
      dir: o,
      scrollHideDelay: l = 600,
      ...i
    } = e, [a, u] = c.useState(null), [d, f] = c.useState(null), [v, h] = c.useState(null), [m, b] = c.useState(null), [s, g] = c.useState(null), [p, S] = c.useState(0), [E, C] = c.useState(0), [y, A] = c.useState(!1), [I, R] = c.useState(!1), T = O(t, (N) => u(N)), x = Fe(o);
    return /* @__PURE__ */ w(
      Rr,
      {
        scope: r,
        type: n,
        dir: x,
        scrollHideDelay: l,
        scrollArea: a,
        viewport: d,
        onViewportChange: f,
        content: v,
        onContentChange: h,
        scrollbarX: m,
        onScrollbarXChange: b,
        scrollbarXEnabled: y,
        onScrollbarXEnabledChange: A,
        scrollbarY: s,
        onScrollbarYChange: g,
        scrollbarYEnabled: I,
        onScrollbarYEnabledChange: R,
        onCornerWidthChange: S,
        onCornerHeightChange: C,
        children: /* @__PURE__ */ w(
          W.div,
          {
            dir: x,
            ...i,
            ref: T,
            style: {
              position: "relative",
              // Pass corner sizes as CSS vars to reduce re-renders of context consumers
              "--radix-scroll-area-corner-width": p + "px",
              "--radix-scroll-area-corner-height": E + "px",
              ...e.style
            }
          }
        )
      }
    );
  }
);
Ge.displayName = me;
var je = "ScrollAreaViewport", Ze = c.forwardRef(
  (e, t) => {
    const { __scopeScrollArea: r, children: n, nonce: o, ...l } = e, i = F(je, r), a = c.useRef(null), u = O(t, a, i.onViewportChange);
    return /* @__PURE__ */ ut(dt, { children: [
      /* @__PURE__ */ w(
        "style",
        {
          dangerouslySetInnerHTML: {
            __html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
          },
          nonce: o
        }
      ),
      /* @__PURE__ */ w(
        W.div,
        {
          "data-radix-scroll-area-viewport": "",
          ...l,
          ref: u,
          style: {
            /**
             * We don't support `visible` because the intention is to have at least one scrollbar
             * if this component is used and `visible` will behave like `auto` in that case
             * https://developer.mozilla.org/en-US/docs/Web/CSS/overflowed#description
             *
             * We don't handle `auto` because the intention is for the native implementation
             * to be hidden if using this component. We just want to ensure the node is scrollable
             * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
             * the browser from having to work out whether to render native scrollbars or not,
             * we tell it to with the intention of hiding them in CSS.
             */
            overflowX: i.scrollbarXEnabled ? "scroll" : "hidden",
            overflowY: i.scrollbarYEnabled ? "scroll" : "hidden",
            ...e.style
          },
          children: /* @__PURE__ */ w("div", { ref: i.onContentChange, style: { minWidth: "100%", display: "table" }, children: n })
        }
      )
    ] });
  }
);
Ze.displayName = je;
var D = "ScrollAreaScrollbar", $e = c.forwardRef(
  (e, t) => {
    const { forceMount: r, ...n } = e, o = F(D, e.__scopeScrollArea), { onScrollbarXEnabledChange: l, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
    return c.useEffect(() => (a ? l(!0) : i(!0), () => {
      a ? l(!1) : i(!1);
    }), [a, l, i]), o.type === "hover" ? /* @__PURE__ */ w(Tr, { ...n, ref: t, forceMount: r }) : o.type === "scroll" ? /* @__PURE__ */ w(Pr, { ...n, ref: t, forceMount: r }) : o.type === "auto" ? /* @__PURE__ */ w(qe, { ...n, ref: t, forceMount: r }) : o.type === "always" ? /* @__PURE__ */ w(pe, { ...n, ref: t }) : null;
  }
);
$e.displayName = D;
var Tr = c.forwardRef((e, t) => {
  const { forceMount: r, ...n } = e, o = F(D, e.__scopeScrollArea), [l, i] = c.useState(!1);
  return c.useEffect(() => {
    const a = o.scrollArea;
    let u = 0;
    if (a) {
      const d = () => {
        window.clearTimeout(u), i(!0);
      }, f = () => {
        u = window.setTimeout(() => i(!1), o.scrollHideDelay);
      };
      return a.addEventListener("pointerenter", d), a.addEventListener("pointerleave", f), () => {
        window.clearTimeout(u), a.removeEventListener("pointerenter", d), a.removeEventListener("pointerleave", f);
      };
    }
  }, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ w(J, { present: r || l, children: /* @__PURE__ */ w(
    qe,
    {
      "data-state": l ? "visible" : "hidden",
      ...n,
      ref: t
    }
  ) });
}), Pr = c.forwardRef((e, t) => {
  const { forceMount: r, ...n } = e, o = F(D, e.__scopeScrollArea), l = e.orientation === "horizontal", i = ne(() => u("SCROLL_END"), 100), [a, u] = yr("hidden", {
    hidden: {
      SCROLL: "scrolling"
    },
    scrolling: {
      SCROLL_END: "idle",
      POINTER_ENTER: "interacting"
    },
    interacting: {
      SCROLL: "interacting",
      POINTER_LEAVE: "idle"
    },
    idle: {
      HIDE: "hidden",
      SCROLL: "scrolling",
      POINTER_ENTER: "interacting"
    }
  });
  return c.useEffect(() => {
    if (a === "idle") {
      const d = window.setTimeout(() => u("HIDE"), o.scrollHideDelay);
      return () => window.clearTimeout(d);
    }
  }, [a, o.scrollHideDelay, u]), c.useEffect(() => {
    const d = o.viewport, f = l ? "scrollLeft" : "scrollTop";
    if (d) {
      let v = d[f];
      const h = () => {
        const m = d[f];
        v !== m && (u("SCROLL"), i()), v = m;
      };
      return d.addEventListener("scroll", h), () => d.removeEventListener("scroll", h);
    }
  }, [o.viewport, l, u, i]), /* @__PURE__ */ w(J, { present: r || a !== "hidden", children: /* @__PURE__ */ w(
    pe,
    {
      "data-state": a === "hidden" ? "hidden" : "visible",
      ...n,
      ref: t,
      onPointerEnter: L(e.onPointerEnter, () => u("POINTER_ENTER")),
      onPointerLeave: L(e.onPointerLeave, () => u("POINTER_LEAVE"))
    }
  ) });
}), qe = c.forwardRef((e, t) => {
  const r = F(D, e.__scopeScrollArea), { forceMount: n, ...o } = e, [l, i] = c.useState(!1), a = e.orientation === "horizontal", u = ne(() => {
    if (r.viewport) {
      const d = r.viewport.offsetWidth < r.viewport.scrollWidth, f = r.viewport.offsetHeight < r.viewport.scrollHeight;
      i(a ? d : f);
    }
  }, 10);
  return V(r.viewport, u), V(r.content, u), /* @__PURE__ */ w(J, { present: n || l, children: /* @__PURE__ */ w(
    pe,
    {
      "data-state": l ? "visible" : "hidden",
      ...o,
      ref: t
    }
  ) });
}), pe = c.forwardRef((e, t) => {
  const { orientation: r = "vertical", ...n } = e, o = F(D, e.__scopeScrollArea), l = c.useRef(null), i = c.useRef(0), [a, u] = c.useState({
    content: 0,
    viewport: 0,
    scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
  }), d = rt(a.viewport, a.content), f = {
    ...n,
    sizes: a,
    onSizesChange: u,
    hasThumb: d > 0 && d < 1,
    onThumbChange: (h) => l.current = h,
    onThumbPointerUp: () => i.current = 0,
    onThumbPointerDown: (h) => i.current = h
  };
  function v(h, m) {
    return Nr(h, i.current, a, m);
  }
  return r === "horizontal" ? /* @__PURE__ */ w(
    Ar,
    {
      ...f,
      ref: t,
      onThumbPositionChange: () => {
        if (o.viewport && l.current) {
          const h = o.viewport.scrollLeft, m = Le(h, a, o.dir);
          l.current.style.transform = `translate3d(${m}px, 0, 0)`;
        }
      },
      onWheelScroll: (h) => {
        o.viewport && (o.viewport.scrollLeft = h);
      },
      onDragScroll: (h) => {
        o.viewport && (o.viewport.scrollLeft = v(h, o.dir));
      }
    }
  ) : r === "vertical" ? /* @__PURE__ */ w(
    xr,
    {
      ...f,
      ref: t,
      onThumbPositionChange: () => {
        if (o.viewport && l.current) {
          const h = o.viewport.scrollTop, m = Le(h, a);
          l.current.style.transform = `translate3d(0, ${m}px, 0)`;
        }
      },
      onWheelScroll: (h) => {
        o.viewport && (o.viewport.scrollTop = h);
      },
      onDragScroll: (h) => {
        o.viewport && (o.viewport.scrollTop = v(h));
      }
    }
  ) : null;
}), Ar = c.forwardRef((e, t) => {
  const { sizes: r, onSizesChange: n, ...o } = e, l = F(D, e.__scopeScrollArea), [i, a] = c.useState(), u = c.useRef(null), d = O(t, u, l.onScrollbarXChange);
  return c.useEffect(() => {
    u.current && a(getComputedStyle(u.current));
  }, [u]), /* @__PURE__ */ w(
    Je,
    {
      "data-orientation": "horizontal",
      ...o,
      ref: d,
      sizes: r,
      style: {
        bottom: 0,
        left: l.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
        right: l.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
        "--radix-scroll-area-thumb-width": re(r) + "px",
        ...e.style
      },
      onThumbPointerDown: (f) => e.onThumbPointerDown(f.x),
      onDragScroll: (f) => e.onDragScroll(f.x),
      onWheelScroll: (f, v) => {
        if (l.viewport) {
          const h = l.viewport.scrollLeft + f.deltaX;
          e.onWheelScroll(h), ot(h, v) && f.preventDefault();
        }
      },
      onResize: () => {
        u.current && l.viewport && i && n({
          content: l.viewport.scrollWidth,
          viewport: l.viewport.offsetWidth,
          scrollbar: {
            size: u.current.clientWidth,
            paddingStart: Q(i.paddingLeft),
            paddingEnd: Q(i.paddingRight)
          }
        });
      }
    }
  );
}), xr = c.forwardRef((e, t) => {
  const { sizes: r, onSizesChange: n, ...o } = e, l = F(D, e.__scopeScrollArea), [i, a] = c.useState(), u = c.useRef(null), d = O(t, u, l.onScrollbarYChange);
  return c.useEffect(() => {
    u.current && a(getComputedStyle(u.current));
  }, [u]), /* @__PURE__ */ w(
    Je,
    {
      "data-orientation": "vertical",
      ...o,
      ref: d,
      sizes: r,
      style: {
        top: 0,
        right: l.dir === "ltr" ? 0 : void 0,
        left: l.dir === "rtl" ? 0 : void 0,
        bottom: "var(--radix-scroll-area-corner-height)",
        "--radix-scroll-area-thumb-height": re(r) + "px",
        ...e.style
      },
      onThumbPointerDown: (f) => e.onThumbPointerDown(f.y),
      onDragScroll: (f) => e.onDragScroll(f.y),
      onWheelScroll: (f, v) => {
        if (l.viewport) {
          const h = l.viewport.scrollTop + f.deltaY;
          e.onWheelScroll(h), ot(h, v) && f.preventDefault();
        }
      },
      onResize: () => {
        u.current && l.viewport && i && n({
          content: l.viewport.scrollHeight,
          viewport: l.viewport.offsetHeight,
          scrollbar: {
            size: u.current.clientHeight,
            paddingStart: Q(i.paddingTop),
            paddingEnd: Q(i.paddingBottom)
          }
        });
      }
    }
  );
}), [Ir, Qe] = Ke(D), Je = c.forwardRef((e, t) => {
  const {
    __scopeScrollArea: r,
    sizes: n,
    hasThumb: o,
    onThumbChange: l,
    onThumbPointerUp: i,
    onThumbPointerDown: a,
    onThumbPositionChange: u,
    onDragScroll: d,
    onWheelScroll: f,
    onResize: v,
    ...h
  } = e, m = F(D, r), [b, s] = c.useState(null), g = O(t, (T) => s(T)), p = c.useRef(null), S = c.useRef(""), E = m.viewport, C = n.content - n.viewport, y = _(f), A = _(u), I = ne(v, 10);
  function R(T) {
    if (p.current) {
      const x = T.clientX - p.current.left, N = T.clientY - p.current.top;
      d({ x, y: N });
    }
  }
  return c.useEffect(() => {
    const T = (x) => {
      const N = x.target;
      (b == null ? void 0 : b.contains(N)) && y(x, C);
    };
    return document.addEventListener("wheel", T, { passive: !1 }), () => document.removeEventListener("wheel", T, { passive: !1 });
  }, [E, b, C, y]), c.useEffect(A, [n, A]), V(b, I), V(m.content, I), /* @__PURE__ */ w(
    Ir,
    {
      scope: r,
      scrollbar: b,
      hasThumb: o,
      onThumbChange: _(l),
      onThumbPointerUp: _(i),
      onThumbPositionChange: A,
      onThumbPointerDown: _(a),
      children: /* @__PURE__ */ w(
        W.div,
        {
          ...h,
          ref: g,
          style: { position: "absolute", ...h.style },
          onPointerDown: L(e.onPointerDown, (T) => {
            T.button === 0 && (T.target.setPointerCapture(T.pointerId), p.current = b.getBoundingClientRect(), S.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", m.viewport && (m.viewport.style.scrollBehavior = "auto"), R(T));
          }),
          onPointerMove: L(e.onPointerMove, R),
          onPointerUp: L(e.onPointerUp, (T) => {
            const x = T.target;
            x.hasPointerCapture(T.pointerId) && x.releasePointerCapture(T.pointerId), document.body.style.webkitUserSelect = S.current, m.viewport && (m.viewport.style.scrollBehavior = ""), p.current = null;
          })
        }
      )
    }
  );
}), q = "ScrollAreaThumb", et = c.forwardRef(
  (e, t) => {
    const { forceMount: r, ...n } = e, o = Qe(q, e.__scopeScrollArea);
    return /* @__PURE__ */ w(J, { present: r || o.hasThumb, children: /* @__PURE__ */ w(Lr, { ref: t, ...n }) });
  }
), Lr = c.forwardRef(
  (e, t) => {
    const { __scopeScrollArea: r, style: n, ...o } = e, l = F(q, r), i = Qe(q, r), { onThumbPositionChange: a } = i, u = O(
      t,
      (v) => i.onThumbChange(v)
    ), d = c.useRef(), f = ne(() => {
      d.current && (d.current(), d.current = void 0);
    }, 100);
    return c.useEffect(() => {
      const v = l.viewport;
      if (v) {
        const h = () => {
          if (f(), !d.current) {
            const m = _r(v, a);
            d.current = m, a();
          }
        };
        return a(), v.addEventListener("scroll", h), () => v.removeEventListener("scroll", h);
      }
    }, [l.viewport, f, a]), /* @__PURE__ */ w(
      W.div,
      {
        "data-state": i.hasThumb ? "visible" : "hidden",
        ...o,
        ref: u,
        style: {
          width: "var(--radix-scroll-area-thumb-width)",
          height: "var(--radix-scroll-area-thumb-height)",
          ...n
        },
        onPointerDownCapture: L(e.onPointerDownCapture, (v) => {
          const m = v.target.getBoundingClientRect(), b = v.clientX - m.left, s = v.clientY - m.top;
          i.onThumbPointerDown({ x: b, y: s });
        }),
        onPointerUp: L(e.onPointerUp, i.onThumbPointerUp)
      }
    );
  }
);
et.displayName = q;
var be = "ScrollAreaCorner", tt = c.forwardRef(
  (e, t) => {
    const r = F(be, e.__scopeScrollArea), n = !!(r.scrollbarX && r.scrollbarY);
    return r.type !== "scroll" && n ? /* @__PURE__ */ w(Fr, { ...e, ref: t }) : null;
  }
);
tt.displayName = be;
var Fr = c.forwardRef((e, t) => {
  const { __scopeScrollArea: r, ...n } = e, o = F(be, r), [l, i] = c.useState(0), [a, u] = c.useState(0), d = !!(l && a);
  return V(o.scrollbarX, () => {
    var v;
    const f = ((v = o.scrollbarX) == null ? void 0 : v.offsetHeight) || 0;
    o.onCornerHeightChange(f), u(f);
  }), V(o.scrollbarY, () => {
    var v;
    const f = ((v = o.scrollbarY) == null ? void 0 : v.offsetWidth) || 0;
    o.onCornerWidthChange(f), i(f);
  }), d ? /* @__PURE__ */ w(
    W.div,
    {
      ...n,
      ref: t,
      style: {
        width: l,
        height: a,
        position: "absolute",
        right: o.dir === "ltr" ? 0 : void 0,
        left: o.dir === "rtl" ? 0 : void 0,
        bottom: 0,
        ...e.style
      }
    }
  ) : null;
});
function Q(e) {
  return e ? parseInt(e, 10) : 0;
}
function rt(e, t) {
  const r = e / t;
  return isNaN(r) ? 0 : r;
}
function re(e) {
  const t = rt(e.viewport, e.content), r = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, n = (e.scrollbar.size - r) * t;
  return Math.max(n, 18);
}
function Nr(e, t, r, n = "ltr") {
  const o = re(r), l = o / 2, i = t || l, a = o - i, u = r.scrollbar.paddingStart + i, d = r.scrollbar.size - r.scrollbar.paddingEnd - a, f = r.content - r.viewport, v = n === "ltr" ? [0, f] : [f * -1, 0];
  return nt([u, d], v)(e);
}
function Le(e, t, r = "ltr") {
  const n = re(t), o = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, l = t.scrollbar.size - o, i = t.content - t.viewport, a = l - n, u = r === "ltr" ? [0, i] : [i * -1, 0], d = Cr(e, u);
  return nt([0, i], [0, a])(d);
}
function nt(e, t) {
  return (r) => {
    if (e[0] === e[1] || t[0] === t[1]) return t[0];
    const n = (t[1] - t[0]) / (e[1] - e[0]);
    return t[0] + n * (r - e[0]);
  };
}
function ot(e, t) {
  return e > 0 && e < t;
}
var _r = (e, t = () => {
}) => {
  let r = { left: e.scrollLeft, top: e.scrollTop }, n = 0;
  return function o() {
    const l = { left: e.scrollLeft, top: e.scrollTop }, i = r.left !== l.left, a = r.top !== l.top;
    (i || a) && t(), r = l, n = window.requestAnimationFrame(o);
  }(), () => window.cancelAnimationFrame(n);
};
function ne(e, t) {
  const r = _(e), n = c.useRef(0);
  return c.useEffect(() => () => window.clearTimeout(n.current), []), c.useCallback(() => {
    window.clearTimeout(n.current), n.current = window.setTimeout(r, t);
  }, [r, t]);
}
function V(e, t) {
  const r = _(t);
  st(() => {
    let n = 0;
    if (e) {
      const o = new ResizeObserver(() => {
        cancelAnimationFrame(n), n = window.requestAnimationFrame(r);
      });
      return o.observe(e), () => {
        window.cancelAnimationFrame(n), o.unobserve(e);
      };
    }
  }, [e, r]);
}
var Kr = Ge, Gr = Ze, jr = $e, Zr = et, $r = tt;
export {
  $r as C,
  ht as F,
  Vr as I,
  nr as R,
  jr as S,
  Zr as T,
  Gr as V,
  Ur as a,
  Cr as b,
  lr as c,
  Yr as d,
  zr as e,
  Kr as f,
  Hr as h,
  wr as i,
  Er as l,
  Sr as t,
  Br as u
};
//# sourceMappingURL=index.Ha48YvQU.js.map
