import { t as e } from "./utils-B7XIe3qq.js";
import { n as t } from "./dist-CTlQcJNK.js";
import { a as n, o as r, t as i } from "./dist-koa_pEtu.js";
import { t as a } from "./dist-CpMqmV-i.js";
import { t as o } from "./dist-C0wG5dwG.js";
import { t as s } from "./dist-BBVMDH9A.js";
import { t as c } from "./dist-DGayZ3ok2.js";
import { t as l } from "./dist-DxtM7vvP.js";
import { a as u, i as d, n as f, r as p, t as m } from "./dist-CbqFryer.js";
import { t as h } from "./dist-CcNjOWyQ.js";
import * as g from "react";
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.mjs
var b = Symbol("radix.slottable");
/* @__NO_SIDE_EFFECTS__ */
function x(e) {
	let t = ({ children: e }) => /* @__PURE__ */ v(_, { children: e });
	return t.displayName = `${e}.Slottable`, t.__radixId = b, t;
}
//#endregion
//#region node_modules/@radix-ui/react-tooltip/dist/index.mjs
var [S, C] = n("Tooltip", [u]), w = u(), T = "TooltipProvider", E = 700, D = "tooltip.open", [O, k] = S(T), A = (e) => {
	let { __scopeTooltip: t, delayDuration: n = E, skipDelayDuration: r = 300, disableHoverableContent: i = !1, children: a } = e, o = g.useRef(!0), s = g.useRef(!1), c = g.useRef(0);
	return g.useEffect(() => {
		let e = c.current;
		return () => window.clearTimeout(e);
	}, []), /* @__PURE__ */ v(O, {
		scope: t,
		isOpenDelayedRef: o,
		delayDuration: n,
		onOpen: g.useCallback(() => {
			window.clearTimeout(c.current), o.current = !1;
		}, []),
		onClose: g.useCallback(() => {
			window.clearTimeout(c.current), c.current = window.setTimeout(() => o.current = !0, r);
		}, [r]),
		isPointerInTransitRef: s,
		onPointerInTransitChange: g.useCallback((e) => {
			s.current = e;
		}, []),
		disableHoverableContent: i,
		children: a
	});
};
A.displayName = T;
var j = "Tooltip", [M, N] = S(j), P = (e) => {
	let { __scopeTooltip: t, children: n, open: r, defaultOpen: i, onOpenChange: s, disableHoverableContent: c, delayDuration: l } = e, u = k(j, e.__scopeTooltip), f = w(t), [p, m] = g.useState(null), h = a(), _ = g.useRef(0), y = c ?? u.disableHoverableContent, b = l ?? u.delayDuration, x = g.useRef(!1), [S, C] = o({
		prop: r,
		defaultProp: i ?? !1,
		onChange: (e) => {
			e ? (u.onOpen(), document.dispatchEvent(new CustomEvent(D))) : u.onClose(), s?.(e);
		},
		caller: j
	}), T = g.useMemo(() => S ? x.current ? "delayed-open" : "instant-open" : "closed", [S]), E = g.useCallback(() => {
		window.clearTimeout(_.current), _.current = 0, x.current = !1, C(!0);
	}, [C]), O = g.useCallback(() => {
		window.clearTimeout(_.current), _.current = 0, C(!1);
	}, [C]), A = g.useCallback(() => {
		window.clearTimeout(_.current), _.current = window.setTimeout(() => {
			x.current = !0, C(!0), _.current = 0;
		}, b);
	}, [b, C]);
	return g.useEffect(() => () => {
		_.current &&= (window.clearTimeout(_.current), 0);
	}, []), /* @__PURE__ */ v(d, {
		...f,
		children: /* @__PURE__ */ v(M, {
			scope: t,
			contentId: h,
			open: S,
			stateAttribute: T,
			trigger: p,
			onTriggerChange: m,
			onTriggerEnter: g.useCallback(() => {
				u.isOpenDelayedRef.current ? A() : E();
			}, [
				u.isOpenDelayedRef,
				A,
				E
			]),
			onTriggerLeave: g.useCallback(() => {
				y ? O() : (window.clearTimeout(_.current), _.current = 0);
			}, [O, y]),
			onOpen: E,
			onClose: O,
			disableHoverableContent: y,
			children: n
		})
	});
};
P.displayName = j;
var F = "TooltipTrigger", I = g.forwardRef((e, n) => {
	let { __scopeTooltip: a, ...o } = e, s = N(F, a), c = k(F, a), l = w(a), u = t(n, g.useRef(null), s.onTriggerChange), d = g.useRef(!1), f = g.useRef(!1), p = g.useCallback(() => d.current = !1, []);
	return g.useEffect(() => () => document.removeEventListener("pointerup", p), [p]), /* @__PURE__ */ v(m, {
		asChild: !0,
		...l,
		children: /* @__PURE__ */ v(i.button, {
			"aria-describedby": s.open ? s.contentId : void 0,
			"data-state": s.stateAttribute,
			...o,
			ref: u,
			onPointerMove: r(e.onPointerMove, (e) => {
				e.pointerType !== "touch" && !f.current && !c.isPointerInTransitRef.current && (s.onTriggerEnter(), f.current = !0);
			}),
			onPointerLeave: r(e.onPointerLeave, () => {
				s.onTriggerLeave(), f.current = !1;
			}),
			onPointerDown: r(e.onPointerDown, () => {
				s.open && s.onClose(), d.current = !0, document.addEventListener("pointerup", p, { once: !0 });
			}),
			onFocus: r(e.onFocus, () => {
				d.current || s.onOpen();
			}),
			onBlur: r(e.onBlur, s.onClose),
			onClick: r(e.onClick, s.onClose)
		})
	});
});
I.displayName = F;
var L = "TooltipPortal", [R, z] = S(L, { forceMount: void 0 }), B = (e) => {
	let { __scopeTooltip: t, forceMount: n, children: r, container: i } = e, a = N(L, t);
	return /* @__PURE__ */ v(R, {
		scope: t,
		forceMount: n,
		children: /* @__PURE__ */ v(l, {
			present: n || a.open,
			children: /* @__PURE__ */ v(c, {
				asChild: !0,
				container: i,
				children: r
			})
		})
	});
};
B.displayName = L;
var V = "TooltipContent", H = g.forwardRef((e, t) => {
	let n = z(V, e.__scopeTooltip), { forceMount: r = n.forceMount, side: i = "top", ...a } = e, o = N(V, e.__scopeTooltip);
	return /* @__PURE__ */ v(l, {
		present: r || o.open,
		children: o.disableHoverableContent ? /* @__PURE__ */ v(K, {
			side: i,
			...a,
			ref: t
		}) : /* @__PURE__ */ v(ee, {
			side: i,
			...a,
			ref: t
		})
	});
}), ee = g.forwardRef((e, n) => {
	let r = N(V, e.__scopeTooltip), i = k(V, e.__scopeTooltip), a = g.useRef(null), o = t(n, a), [s, c] = g.useState(null), { trigger: l, onClose: u } = r, d = a.current, { onPointerInTransitChange: f } = i, p = g.useCallback(() => {
		c(null), f(!1);
	}, [f]), m = g.useCallback((e, t) => {
		let n = e.currentTarget, r = {
			x: e.clientX,
			y: e.clientY
		}, i = X(r, Y(r, n.getBoundingClientRect())), a = Z(t.getBoundingClientRect());
		c(te([...i, ...a])), f(!0);
	}, [f]);
	return g.useEffect(() => () => p(), [p]), g.useEffect(() => {
		if (l && d) {
			let e = (e) => m(e, d), t = (e) => m(e, l);
			return l.addEventListener("pointerleave", e), d.addEventListener("pointerleave", t), () => {
				l.removeEventListener("pointerleave", e), d.removeEventListener("pointerleave", t);
			};
		}
	}, [
		l,
		d,
		m,
		p
	]), g.useEffect(() => {
		if (s) {
			let e = (e) => {
				let t = e.target, n = {
					x: e.clientX,
					y: e.clientY
				}, r = l?.contains(t) || d?.contains(t), i = !Q(n, s);
				r ? p() : i && (p(), u());
			};
			return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
		}
	}, [
		l,
		d,
		s,
		u,
		p
	]), /* @__PURE__ */ v(K, {
		...e,
		ref: o
	});
}), [U, W] = S(j, { isInside: !1 }), G = /* @__PURE__ */ x("TooltipContent"), K = g.forwardRef((e, t) => {
	let { __scopeTooltip: n, children: r, "aria-label": i, onEscapeKeyDown: a, onPointerDownOutside: o, ...c } = e, l = N(V, n), u = w(n), { onClose: d } = l;
	return g.useEffect(() => (document.addEventListener(D, d), () => document.removeEventListener(D, d)), [d]), g.useEffect(() => {
		if (l.trigger) {
			let e = (e) => {
				e.target?.contains(l.trigger) && d();
			};
			return window.addEventListener("scroll", e, { capture: !0 }), () => window.removeEventListener("scroll", e, { capture: !0 });
		}
	}, [l.trigger, d]), /* @__PURE__ */ v(s, {
		asChild: !0,
		disableOutsidePointerEvents: !1,
		onEscapeKeyDown: a,
		onPointerDownOutside: o,
		onFocusOutside: (e) => e.preventDefault(),
		onDismiss: d,
		children: /* @__PURE__ */ y(p, {
			"data-state": l.stateAttribute,
			...u,
			...c,
			ref: t,
			style: {
				...c.style,
				"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
				"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
				"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
				"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
				"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
			},
			children: [/* @__PURE__ */ v(G, { children: r }), /* @__PURE__ */ v(U, {
				scope: n,
				isInside: !0,
				children: /* @__PURE__ */ v(h, {
					id: l.contentId,
					role: "tooltip",
					children: i || r
				})
			})]
		})
	});
});
H.displayName = V;
var q = "TooltipArrow", J = g.forwardRef((e, t) => {
	let { __scopeTooltip: n, ...r } = e, i = w(n);
	return W(q, n).isInside ? null : /* @__PURE__ */ v(f, {
		...i,
		...r,
		ref: t
	});
});
J.displayName = q;
function Y(e, t) {
	let n = Math.abs(t.top - e.y), r = Math.abs(t.bottom - e.y), i = Math.abs(t.right - e.x), a = Math.abs(t.left - e.x);
	switch (Math.min(n, r, i, a)) {
		case a: return "left";
		case i: return "right";
		case n: return "top";
		case r: return "bottom";
		default: throw Error("unreachable");
	}
}
function X(e, t, n = 5) {
	let r = [];
	switch (t) {
		case "top":
			r.push({
				x: e.x - n,
				y: e.y + n
			}, {
				x: e.x + n,
				y: e.y + n
			});
			break;
		case "bottom":
			r.push({
				x: e.x - n,
				y: e.y - n
			}, {
				x: e.x + n,
				y: e.y - n
			});
			break;
		case "left":
			r.push({
				x: e.x + n,
				y: e.y - n
			}, {
				x: e.x + n,
				y: e.y + n
			});
			break;
		case "right":
			r.push({
				x: e.x - n,
				y: e.y - n
			}, {
				x: e.x - n,
				y: e.y + n
			});
			break;
	}
	return r;
}
function Z(e) {
	let { top: t, right: n, bottom: r, left: i } = e;
	return [
		{
			x: i,
			y: t
		},
		{
			x: n,
			y: t
		},
		{
			x: n,
			y: r
		},
		{
			x: i,
			y: r
		}
	];
}
function Q(e, t) {
	let { x: n, y: r } = e, i = !1;
	for (let e = 0, a = t.length - 1; e < t.length; a = e++) {
		let o = t[e], s = t[a], c = o.x, l = o.y, u = s.x, d = s.y;
		l > r != d > r && n < (u - c) * (r - l) / (d - l) + c && (i = !i);
	}
	return i;
}
function te(e) {
	let t = e.slice();
	return t.sort((e, t) => e.x < t.x ? -1 : e.x > t.x ? 1 : e.y < t.y ? -1 : e.y > t.y ? 1 : 0), ne(t);
}
function ne(e) {
	if (e.length <= 1) return e.slice();
	let t = [];
	for (let n = 0; n < e.length; n++) {
		let r = e[n];
		for (; t.length >= 2;) {
			let e = t[t.length - 1], n = t[t.length - 2];
			if ((e.x - n.x) * (r.y - n.y) >= (e.y - n.y) * (r.x - n.x)) t.pop();
			else break;
		}
		t.push(r);
	}
	t.pop();
	let n = [];
	for (let t = e.length - 1; t >= 0; t--) {
		let r = e[t];
		for (; n.length >= 2;) {
			let e = n[n.length - 1], t = n[n.length - 2];
			if ((e.x - t.x) * (r.y - t.y) >= (e.y - t.y) * (r.x - t.x)) n.pop();
			else break;
		}
		n.push(r);
	}
	return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
}
var re = A, ie = P, ae = I, oe = B, $ = H, se = J;
//#endregion
//#region src/react/primitives/tooltip.tsx
function ce({ delayDuration: e = 300, ...t }) {
	return /* @__PURE__ */ v(re, {
		delayDuration: e,
		...t
	});
}
function le({ ...e }) {
	return /* @__PURE__ */ v(ie, { ...e });
}
function ue({ ...e }) {
	return /* @__PURE__ */ v(ae, { ...e });
}
function de({ className: t, sideOffset: n = 6, ...r }) {
	return /* @__PURE__ */ v(oe, { children: /* @__PURE__ */ v($, {
		sideOffset: n,
		className: e("z-50 overflow-hidden rounded-lg px-3 py-1.5 text-xs", "border-border-glass bg-surface-secondary/95 border shadow-lg backdrop-blur-xl", "text-content-primary", "animate-in fade-in-0 zoom-in-95", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", "data-[side=top]:slide-in-from-bottom-2", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", t),
		...r
	}) });
}
function fe({ className: t, ...n }) {
	return /* @__PURE__ */ v(se, {
		className: e("fill-surface-secondary/95", t),
		...n
	});
}
//#endregion
export { ue as a, ce as i, fe as n, de as r, le as t };

//# sourceMappingURL=tooltip-DuC73a5E.js.map