import { t as e } from "./utils-B7XIe3qq.js";
import { n as t } from "./dist-CTlQcJNK.js";
import { a as n, o as r, r as i, t as a } from "./dist-koa_pEtu.js";
import { t as o } from "./dist-RmXz0NYF.js";
import { t as s } from "./dist-DxtM7vvP.js";
import { t as c } from "./dist-CVCn7F_m.js";
import { t as l } from "./dist-Dm7Xaded.js";
import * as u from "react";
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-scroll-area/dist/index.mjs
function m(e, t) {
	return u.useReducer((e, n) => t[e][n] ?? e, e);
}
var h = "ScrollArea", [g, _] = n(h), [v, y] = g(h), b = u.forwardRef((e, n) => {
	let { __scopeScrollArea: r, type: i = "hover", dir: o, scrollHideDelay: s = 600, ...l } = e, [d, p] = u.useState(null), [m, h] = u.useState(null), [g, _] = u.useState(null), [y, b] = u.useState(null), [x, S] = u.useState(null), [C, w] = u.useState(0), [T, E] = u.useState(0), [D, O] = u.useState(!1), [k, A] = u.useState(!1), j = t(n, (e) => p(e)), M = c(o);
	return /* @__PURE__ */ f(v, {
		scope: r,
		type: i,
		dir: M,
		scrollHideDelay: s,
		scrollArea: d,
		viewport: m,
		onViewportChange: h,
		content: g,
		onContentChange: _,
		scrollbarX: y,
		onScrollbarXChange: b,
		scrollbarXEnabled: D,
		onScrollbarXEnabledChange: O,
		scrollbarY: x,
		onScrollbarYChange: S,
		scrollbarYEnabled: k,
		onScrollbarYEnabledChange: A,
		onCornerWidthChange: w,
		onCornerHeightChange: E,
		children: /* @__PURE__ */ f(a.div, {
			dir: M,
			...l,
			ref: j,
			style: {
				position: "relative",
				"--radix-scroll-area-corner-width": C + "px",
				"--radix-scroll-area-corner-height": T + "px",
				...e.style
			}
		})
	});
});
b.displayName = h;
var x = "ScrollAreaViewport", S = u.forwardRef((e, n) => {
	let { __scopeScrollArea: r, children: i, nonce: o, ...s } = e, c = y(x, r), l = t(n, u.useRef(null), c.onViewportChange);
	return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("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__ */ f(a.div, {
		"data-radix-scroll-area-viewport": "",
		...s,
		ref: l,
		style: {
			overflowX: c.scrollbarXEnabled ? "scroll" : "hidden",
			overflowY: c.scrollbarYEnabled ? "scroll" : "hidden",
			...e.style
		},
		children: /* @__PURE__ */ f("div", {
			ref: c.onContentChange,
			style: {
				minWidth: "100%",
				display: "table"
			},
			children: i
		})
	})] });
});
S.displayName = x;
var C = "ScrollAreaScrollbar", w = u.forwardRef((e, t) => {
	let { forceMount: n, ...r } = e, i = y(C, e.__scopeScrollArea), { onScrollbarXEnabledChange: a, onScrollbarYEnabledChange: o } = i, s = e.orientation === "horizontal";
	return u.useEffect(() => (s ? a(!0) : o(!0), () => {
		s ? a(!1) : o(!1);
	}), [
		s,
		a,
		o
	]), i.type === "hover" ? /* @__PURE__ */ f(T, {
		...r,
		ref: t,
		forceMount: n
	}) : i.type === "scroll" ? /* @__PURE__ */ f(E, {
		...r,
		ref: t,
		forceMount: n
	}) : i.type === "auto" ? /* @__PURE__ */ f(D, {
		...r,
		ref: t,
		forceMount: n
	}) : i.type === "always" ? /* @__PURE__ */ f(O, {
		...r,
		ref: t
	}) : null;
});
w.displayName = C;
var T = u.forwardRef((e, t) => {
	let { forceMount: n, ...r } = e, i = y(C, e.__scopeScrollArea), [a, o] = u.useState(!1);
	return u.useEffect(() => {
		let e = i.scrollArea, t = 0;
		if (e) {
			let n = () => {
				window.clearTimeout(t), o(!0);
			}, r = () => {
				t = window.setTimeout(() => o(!1), i.scrollHideDelay);
			};
			return e.addEventListener("pointerenter", n), e.addEventListener("pointerleave", r), () => {
				window.clearTimeout(t), e.removeEventListener("pointerenter", n), e.removeEventListener("pointerleave", r);
			};
		}
	}, [i.scrollArea, i.scrollHideDelay]), /* @__PURE__ */ f(s, {
		present: n || a,
		children: /* @__PURE__ */ f(D, {
			"data-state": a ? "visible" : "hidden",
			...r,
			ref: t
		})
	});
}), E = u.forwardRef((e, t) => {
	let { forceMount: n, ...i } = e, a = y(C, e.__scopeScrollArea), o = e.orientation === "horizontal", c = J(() => d("SCROLL_END"), 100), [l, d] = m("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 u.useEffect(() => {
		if (l === "idle") {
			let e = window.setTimeout(() => d("HIDE"), a.scrollHideDelay);
			return () => window.clearTimeout(e);
		}
	}, [
		l,
		a.scrollHideDelay,
		d
	]), u.useEffect(() => {
		let e = a.viewport, t = o ? "scrollLeft" : "scrollTop";
		if (e) {
			let n = e[t], r = () => {
				let r = e[t];
				n !== r && (d("SCROLL"), c()), n = r;
			};
			return e.addEventListener("scroll", r), () => e.removeEventListener("scroll", r);
		}
	}, [
		a.viewport,
		o,
		d,
		c
	]), /* @__PURE__ */ f(s, {
		present: n || l !== "hidden",
		children: /* @__PURE__ */ f(O, {
			"data-state": l === "hidden" ? "hidden" : "visible",
			...i,
			ref: t,
			onPointerEnter: r(e.onPointerEnter, () => d("POINTER_ENTER")),
			onPointerLeave: r(e.onPointerLeave, () => d("POINTER_LEAVE"))
		})
	});
}), D = u.forwardRef((e, t) => {
	let n = y(C, e.__scopeScrollArea), { forceMount: r, ...i } = e, [a, o] = u.useState(!1), c = e.orientation === "horizontal", l = J(() => {
		if (n.viewport) {
			let e = n.viewport.offsetWidth < n.viewport.scrollWidth, t = n.viewport.offsetHeight < n.viewport.scrollHeight;
			o(c ? e : t);
		}
	}, 10);
	return Y(n.viewport, l), Y(n.content, l), /* @__PURE__ */ f(s, {
		present: r || a,
		children: /* @__PURE__ */ f(O, {
			"data-state": a ? "visible" : "hidden",
			...i,
			ref: t
		})
	});
}), O = u.forwardRef((e, t) => {
	let { orientation: n = "vertical", ...r } = e, i = y(C, e.__scopeScrollArea), a = u.useRef(null), o = u.useRef(0), [s, c] = u.useState({
		content: 0,
		viewport: 0,
		scrollbar: {
			size: 0,
			paddingStart: 0,
			paddingEnd: 0
		}
	}), l = V(s.viewport, s.content), d = {
		...r,
		sizes: s,
		onSizesChange: c,
		hasThumb: l > 0 && l < 1,
		onThumbChange: (e) => a.current = e,
		onThumbPointerUp: () => o.current = 0,
		onThumbPointerDown: (e) => o.current = e
	};
	function p(e, t) {
		return U(e, o.current, s, t);
	}
	return n === "horizontal" ? /* @__PURE__ */ f(k, {
		...d,
		ref: t,
		onThumbPositionChange: () => {
			if (i.viewport && a.current) {
				let e = i.viewport.scrollLeft, t = W(e, s, i.dir);
				a.current.style.transform = `translate3d(${t}px, 0, 0)`;
			}
		},
		onWheelScroll: (e) => {
			i.viewport && (i.viewport.scrollLeft = e);
		},
		onDragScroll: (e) => {
			i.viewport && (i.viewport.scrollLeft = p(e, i.dir));
		}
	}) : n === "vertical" ? /* @__PURE__ */ f(A, {
		...d,
		ref: t,
		onThumbPositionChange: () => {
			if (i.viewport && a.current) {
				let e = i.viewport.scrollTop, t = W(e, s);
				a.current.style.transform = `translate3d(0, ${t}px, 0)`;
			}
		},
		onWheelScroll: (e) => {
			i.viewport && (i.viewport.scrollTop = e);
		},
		onDragScroll: (e) => {
			i.viewport && (i.viewport.scrollTop = p(e));
		}
	}) : null;
}), k = u.forwardRef((e, n) => {
	let { sizes: r, onSizesChange: i, ...a } = e, o = y(C, e.__scopeScrollArea), [s, c] = u.useState(), l = u.useRef(null), d = t(n, l, o.onScrollbarXChange);
	return u.useEffect(() => {
		l.current && c(getComputedStyle(l.current));
	}, [l]), /* @__PURE__ */ f(N, {
		"data-orientation": "horizontal",
		...a,
		ref: d,
		sizes: r,
		style: {
			bottom: 0,
			left: o.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
			right: o.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
			"--radix-scroll-area-thumb-width": H(r) + "px",
			...e.style
		},
		onThumbPointerDown: (t) => e.onThumbPointerDown(t.x),
		onDragScroll: (t) => e.onDragScroll(t.x),
		onWheelScroll: (t, n) => {
			if (o.viewport) {
				let r = o.viewport.scrollLeft + t.deltaX;
				e.onWheelScroll(r), K(r, n) && t.preventDefault();
			}
		},
		onResize: () => {
			l.current && o.viewport && s && i({
				content: o.viewport.scrollWidth,
				viewport: o.viewport.offsetWidth,
				scrollbar: {
					size: l.current.clientWidth,
					paddingStart: B(s.paddingLeft),
					paddingEnd: B(s.paddingRight)
				}
			});
		}
	});
}), A = u.forwardRef((e, n) => {
	let { sizes: r, onSizesChange: i, ...a } = e, o = y(C, e.__scopeScrollArea), [s, c] = u.useState(), l = u.useRef(null), d = t(n, l, o.onScrollbarYChange);
	return u.useEffect(() => {
		l.current && c(getComputedStyle(l.current));
	}, [l]), /* @__PURE__ */ f(N, {
		"data-orientation": "vertical",
		...a,
		ref: d,
		sizes: r,
		style: {
			top: 0,
			right: o.dir === "ltr" ? 0 : void 0,
			left: o.dir === "rtl" ? 0 : void 0,
			bottom: "var(--radix-scroll-area-corner-height)",
			"--radix-scroll-area-thumb-height": H(r) + "px",
			...e.style
		},
		onThumbPointerDown: (t) => e.onThumbPointerDown(t.y),
		onDragScroll: (t) => e.onDragScroll(t.y),
		onWheelScroll: (t, n) => {
			if (o.viewport) {
				let r = o.viewport.scrollTop + t.deltaY;
				e.onWheelScroll(r), K(r, n) && t.preventDefault();
			}
		},
		onResize: () => {
			l.current && o.viewport && s && i({
				content: o.viewport.scrollHeight,
				viewport: o.viewport.offsetHeight,
				scrollbar: {
					size: l.current.clientHeight,
					paddingStart: B(s.paddingTop),
					paddingEnd: B(s.paddingBottom)
				}
			});
		}
	});
}), [j, M] = g(C), N = u.forwardRef((e, n) => {
	let { __scopeScrollArea: i, sizes: s, hasThumb: c, onThumbChange: l, onThumbPointerUp: d, onThumbPointerDown: p, onThumbPositionChange: m, onDragScroll: h, onWheelScroll: g, onResize: _, ...v } = e, b = y(C, i), [x, S] = u.useState(null), w = t(n, (e) => S(e)), T = u.useRef(null), E = u.useRef(""), D = b.viewport, O = s.content - s.viewport, k = o(g), A = o(m), M = J(_, 10);
	function N(e) {
		T.current && h({
			x: e.clientX - T.current.left,
			y: e.clientY - T.current.top
		});
	}
	return u.useEffect(() => {
		let e = (e) => {
			let t = e.target;
			x?.contains(t) && k(e, O);
		};
		return document.addEventListener("wheel", e, { passive: !1 }), () => document.removeEventListener("wheel", e, { passive: !1 });
	}, [
		D,
		x,
		O,
		k
	]), u.useEffect(A, [s, A]), Y(x, M), Y(b.content, M), /* @__PURE__ */ f(j, {
		scope: i,
		scrollbar: x,
		hasThumb: c,
		onThumbChange: o(l),
		onThumbPointerUp: o(d),
		onThumbPositionChange: A,
		onThumbPointerDown: o(p),
		children: /* @__PURE__ */ f(a.div, {
			...v,
			ref: w,
			style: {
				position: "absolute",
				...v.style
			},
			onPointerDown: r(e.onPointerDown, (e) => {
				e.button === 0 && (e.target.setPointerCapture(e.pointerId), T.current = x.getBoundingClientRect(), E.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", b.viewport && (b.viewport.style.scrollBehavior = "auto"), N(e));
			}),
			onPointerMove: r(e.onPointerMove, N),
			onPointerUp: r(e.onPointerUp, (e) => {
				let t = e.target;
				t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId), document.body.style.webkitUserSelect = E.current, b.viewport && (b.viewport.style.scrollBehavior = ""), T.current = null;
			})
		})
	});
}), P = "ScrollAreaThumb", F = u.forwardRef((e, t) => {
	let { forceMount: n, ...r } = e, i = M(P, e.__scopeScrollArea);
	return /* @__PURE__ */ f(s, {
		present: n || i.hasThumb,
		children: /* @__PURE__ */ f(I, {
			ref: t,
			...r
		})
	});
}), I = u.forwardRef((e, n) => {
	let { __scopeScrollArea: i, style: o, ...s } = e, c = y(P, i), l = M(P, i), { onThumbPositionChange: d } = l, p = t(n, (e) => l.onThumbChange(e)), m = u.useRef(void 0), h = J(() => {
		m.current &&= (m.current(), void 0);
	}, 100);
	return u.useEffect(() => {
		let e = c.viewport;
		if (e) {
			let t = () => {
				h(), m.current || (m.current = q(e, d), d());
			};
			return d(), e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
		}
	}, [
		c.viewport,
		h,
		d
	]), /* @__PURE__ */ f(a.div, {
		"data-state": l.hasThumb ? "visible" : "hidden",
		...s,
		ref: p,
		style: {
			width: "var(--radix-scroll-area-thumb-width)",
			height: "var(--radix-scroll-area-thumb-height)",
			...o
		},
		onPointerDownCapture: r(e.onPointerDownCapture, (e) => {
			let t = e.target.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
			l.onThumbPointerDown({
				x: n,
				y: r
			});
		}),
		onPointerUp: r(e.onPointerUp, l.onThumbPointerUp)
	});
});
F.displayName = P;
var L = "ScrollAreaCorner", R = u.forwardRef((e, t) => {
	let n = y(L, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
	return n.type !== "scroll" && r ? /* @__PURE__ */ f(z, {
		...e,
		ref: t
	}) : null;
});
R.displayName = L;
var z = u.forwardRef((e, t) => {
	let { __scopeScrollArea: n, ...r } = e, i = y(L, n), [o, s] = u.useState(0), [c, l] = u.useState(0), d = !!(o && c);
	return Y(i.scrollbarX, () => {
		let e = i.scrollbarX?.offsetHeight || 0;
		i.onCornerHeightChange(e), l(e);
	}), Y(i.scrollbarY, () => {
		let e = i.scrollbarY?.offsetWidth || 0;
		i.onCornerWidthChange(e), s(e);
	}), d ? /* @__PURE__ */ f(a.div, {
		...r,
		ref: t,
		style: {
			width: o,
			height: c,
			position: "absolute",
			right: i.dir === "ltr" ? 0 : void 0,
			left: i.dir === "rtl" ? 0 : void 0,
			bottom: 0,
			...e.style
		}
	}) : null;
});
function B(e) {
	return e ? parseInt(e, 10) : 0;
}
function V(e, t) {
	let n = e / t;
	return isNaN(n) ? 0 : n;
}
function H(e) {
	let t = V(e.viewport, e.content), n = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, r = (e.scrollbar.size - n) * t;
	return Math.max(r, 18);
}
function U(e, t, n, r = "ltr") {
	let i = H(n), a = i / 2, o = t || a, s = i - o, c = n.scrollbar.paddingStart + o, l = n.scrollbar.size - n.scrollbar.paddingEnd - s, u = n.content - n.viewport, d = r === "ltr" ? [0, u] : [u * -1, 0];
	return G([c, l], d)(e);
}
function W(e, t, n = "ltr") {
	let r = H(t), i = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, a = t.scrollbar.size - i, o = t.content - t.viewport, s = a - r, c = l(e, n === "ltr" ? [0, o] : [o * -1, 0]);
	return G([0, o], [0, s])(c);
}
function G(e, t) {
	return (n) => {
		if (e[0] === e[1] || t[0] === t[1]) return t[0];
		let r = (t[1] - t[0]) / (e[1] - e[0]);
		return t[0] + r * (n - e[0]);
	};
}
function K(e, t) {
	return e > 0 && e < t;
}
var q = (e, t = () => {}) => {
	let n = {
		left: e.scrollLeft,
		top: e.scrollTop
	}, r = 0;
	return (function i() {
		let a = {
			left: e.scrollLeft,
			top: e.scrollTop
		}, o = n.left !== a.left, s = n.top !== a.top;
		(o || s) && t(), n = a, r = window.requestAnimationFrame(i);
	})(), () => window.cancelAnimationFrame(r);
};
function J(e, t) {
	let n = o(e), r = u.useRef(0);
	return u.useEffect(() => () => window.clearTimeout(r.current), []), u.useCallback(() => {
		window.clearTimeout(r.current), r.current = window.setTimeout(n, t);
	}, [n, t]);
}
function Y(e, t) {
	let n = o(t);
	i(() => {
		let t = 0;
		if (e) {
			let r = new ResizeObserver(() => {
				cancelAnimationFrame(t), t = window.requestAnimationFrame(n);
			});
			return r.observe(e), () => {
				window.cancelAnimationFrame(t), r.unobserve(e);
			};
		}
	}, [e, n]);
}
var X = b, Z = S, Q = R;
//#endregion
//#region src/react/primitives/scroll-area.tsx
function ee({ className: t, children: n, ...r }) {
	return /* @__PURE__ */ p(X, {
		"data-slot": "scroll-area",
		className: e("relative overflow-hidden", t),
		...r,
		children: [
			/* @__PURE__ */ f(Z, {
				"data-slot": "scroll-area-viewport",
				className: "h-full w-full rounded-[inherit] [&>div]:!block",
				children: n
			}),
			/* @__PURE__ */ f($, {}),
			/* @__PURE__ */ f(Q, {})
		]
	});
}
function $({ className: t, orientation: n = "vertical", ...r }) {
	return /* @__PURE__ */ f(w, {
		"data-slot": "scroll-area-scrollbar",
		orientation: n,
		className: e("flex touch-none select-none transition-colors", n === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px", n === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px", t),
		...r,
		children: /* @__PURE__ */ f(F, {
			"data-slot": "scroll-area-thumb",
			className: "bg-border-glass relative flex-1 rounded-full"
		})
	});
}
//#endregion
export { $ as n, ee as t };

//# sourceMappingURL=scroll-area-CR1iK8Af.js.map