const p = (c, o, n = 470) => {
  if (!o) return;
  const t = o.closest(".panel-scroll-content"), e = t == null ? void 0 : t.closest("[data-radix-scroll-area-viewport]");
  if (!(!t || !e))
    if (c) {
      const l = o.getBoundingClientRect(), s = e.getBoundingClientRect();
      if (window.innerHeight - l.bottom < n) {
        t.style.paddingBottom = `${n + 20}px`;
        const a = l.top - s.top + e.scrollTop - Math.max(20, (e.clientHeight - n) / 2);
        e.scrollTo({
          top: Math.max(0, a),
          behavior: "smooth"
        });
      }
    } else
      t.style.paddingBottom = "0px";
};
export {
  p as handlePopoverScroll
};
//# sourceMappingURL=popover.js.map
