import { t as e } from "./utils-CHlhTiFC.js";
import { t } from "./x-C46k3qiu.js";
import { a as n, c as r, i, n as a, o, r as s, s as c, t as l } from "./dist-CFv9lNyL.js";
import * as u from "react";
import d, { useEffect as f, useLayoutEffect as p, useMemo as m } from "react";
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
//#region node_modules/vaul/dist/index.mjs
function v(e) {
	if (!e || typeof document > "u") return;
	let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
	n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
}
var y = d.createContext({
	drawerRef: { current: null },
	overlayRef: { current: null },
	onPress: () => {},
	onRelease: () => {},
	onDrag: () => {},
	onNestedDrag: () => {},
	onNestedOpenChange: () => {},
	onNestedRelease: () => {},
	openProp: void 0,
	dismissible: !1,
	isOpen: !1,
	isDragging: !1,
	keyboardIsOpen: { current: !1 },
	snapPointsOffset: null,
	snapPoints: null,
	handleOnly: !1,
	modal: !1,
	shouldFade: !1,
	activeSnapPoint: null,
	onOpenChange: () => {},
	setActiveSnapPoint: () => {},
	closeDrawer: () => {},
	direction: "bottom",
	shouldAnimate: { current: !0 },
	shouldScaleBackground: !1,
	setBackgroundColorOnScale: !0,
	noBodyStyles: !1,
	container: null,
	autoFocus: !1
}), b = () => {
	let e = d.useContext(y);
	if (!e) throw Error("useDrawerContext must be used within a Drawer.Root");
	return e;
};
v("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");
function x() {
	let e = navigator.userAgent;
	return typeof window < "u" && (/Firefox/.test(e) && /Mobile/.test(e) || /FxiOS/.test(e));
}
function S() {
	return D(/^Mac/);
}
function C() {
	return D(/^iPhone/);
}
function w() {
	return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
}
function T() {
	return D(/^iPad/) || S() && navigator.maxTouchPoints > 1;
}
function E() {
	return C() || T();
}
function D(e) {
	return typeof window < "u" && window.navigator != null ? e.test(window.navigator.platform) : void 0;
}
var O = 24, k = typeof window < "u" ? p : f;
function A(...e) {
	return (...t) => {
		for (let n of e) typeof n == "function" && n(...t);
	};
}
var j = typeof document < "u" && window.visualViewport;
function ee(e) {
	let t = window.getComputedStyle(e);
	return /(auto|scroll)/.test(t.overflow + t.overflowX + t.overflowY);
}
function te(e) {
	for (ee(e) && (e = e.parentElement); e && !ee(e);) e = e.parentElement;
	return e || document.scrollingElement || document.documentElement;
}
var M = new Set([
	"checkbox",
	"radio",
	"range",
	"color",
	"file",
	"image",
	"button",
	"submit",
	"reset"
]), N = 0, ne;
function re(e = {}) {
	let { isDisabled: t } = e;
	k(() => {
		if (!t) return N++, N === 1 && E() && (ne = ie()), () => {
			N--, N === 0 && ne?.();
		};
	}, [t]);
}
function ie() {
	let e, t = 0, n = (n) => {
		e = te(n.target), !(e === document.documentElement && e === document.body) && (t = n.changedTouches[0].pageY);
	}, r = (n) => {
		if (!e || e === document.documentElement || e === document.body) {
			n.preventDefault();
			return;
		}
		let r = n.changedTouches[0].pageY, i = e.scrollTop, a = e.scrollHeight - e.clientHeight;
		a !== 0 && ((i <= 0 && r > t || i >= a && r < t) && n.preventDefault(), t = r);
	}, i = (e) => {
		let t = e.target;
		oe(t) && t !== document.activeElement && (e.preventDefault(), t.style.transform = "translateY(-2000px)", t.focus(), requestAnimationFrame(() => {
			t.style.transform = "";
		}));
	}, a = (e) => {
		let t = e.target;
		oe(t) && (t.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
			t.style.transform = "", j && (j.height < window.innerHeight ? requestAnimationFrame(() => {
				ae(t);
			}) : j.addEventListener("resize", () => ae(t), { once: !0 }));
		}));
	}, o = () => {
		window.scrollTo(0, 0);
	}, s = window.pageXOffset, c = window.pageYOffset, l = A(P(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
	window.scrollTo(0, 0);
	let u = A(F(document, "touchstart", n, {
		passive: !1,
		capture: !0
	}), F(document, "touchmove", r, {
		passive: !1,
		capture: !0
	}), F(document, "touchend", i, {
		passive: !1,
		capture: !0
	}), F(document, "focus", a, !0), F(window, "scroll", o));
	return () => {
		l(), u(), window.scrollTo(s, c);
	};
}
function P(e, t, n) {
	let r = e.style[t];
	return e.style[t] = n, () => {
		e.style[t] = r;
	};
}
function F(e, t, n, r) {
	return e.addEventListener(t, n, r), () => {
		e.removeEventListener(t, n, r);
	};
}
function ae(e) {
	let t = document.scrollingElement || document.documentElement;
	for (; e && e !== t;) {
		let t = te(e);
		if (t !== document.documentElement && t !== document.body && t !== e) {
			let n = t.getBoundingClientRect().top, r = e.getBoundingClientRect().top;
			e.getBoundingClientRect().bottom > t.getBoundingClientRect().bottom + O && (t.scrollTop += r - n);
		}
		e = t.parentElement;
	}
}
function oe(e) {
	return e instanceof HTMLInputElement && !M.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
}
function se(e, t) {
	typeof e == "function" ? e(t) : e != null && (e.current = t);
}
function I(...e) {
	return (t) => e.forEach((e) => se(e, t));
}
function L(...e) {
	return u.useCallback(I(...e), e);
}
var R = /* @__PURE__ */ new WeakMap();
function z(e, t, n = !1) {
	if (!e || !(e instanceof HTMLElement)) return;
	let r = {};
	Object.entries(t).forEach(([t, n]) => {
		if (t.startsWith("--")) {
			e.style.setProperty(t, n);
			return;
		}
		r[t] = e.style[t], e.style[t] = n;
	}), !n && R.set(e, r);
}
function ce(e, t) {
	if (!e || !(e instanceof HTMLElement)) return;
	let n = R.get(e);
	n && (e.style[t] = n[t]);
}
var B = (e) => {
	switch (e) {
		case "top":
		case "bottom": return !0;
		case "left":
		case "right": return !1;
		default: return e;
	}
};
function le(e, t) {
	if (!e) return null;
	let n = window.getComputedStyle(e), r = n.transform || n.webkitTransform || n.mozTransform, i = r.match(/^matrix3d\((.+)\)$/);
	return i ? parseFloat(i[1].split(", ")[B(t) ? 13 : 12]) : (i = r.match(/^matrix\((.+)\)$/), i ? parseFloat(i[1].split(", ")[B(t) ? 5 : 4]) : null);
}
function ue(e) {
	return 8 * (Math.log(e + 1) - 2);
}
function V(e, t) {
	if (!e) return () => {};
	let n = e.style.cssText;
	return Object.assign(e.style, t), () => {
		e.style.cssText = n;
	};
}
var H = {
	DURATION: .5,
	EASE: [
		.32,
		.72,
		0,
		1
	]
}, de = .4, fe = .25, pe = 100, me = 8, U = 16, he = 26, ge = "vaul-dragging";
function W(e) {
	let t = d.useRef(e);
	return d.useEffect(() => {
		t.current = e;
	}), d.useMemo(() => (...e) => t.current == null ? void 0 : t.current.call(t, ...e), []);
}
function G({ defaultProp: e, onChange: t }) {
	let n = d.useState(e), [r] = n, i = d.useRef(r), a = W(t);
	return d.useEffect(() => {
		i.current !== r && (a(r), i.current = r);
	}, [
		r,
		i,
		a
	]), n;
}
function _e({ prop: e, defaultProp: t, onChange: n = () => {} }) {
	let [r, i] = G({
		defaultProp: t,
		onChange: n
	}), a = e !== void 0, o = a ? e : r, s = W(n);
	return [o, d.useCallback((t) => {
		if (a) {
			let n = typeof t == "function" ? t(e) : t;
			n !== e && s(n);
		} else i(t);
	}, [
		a,
		e,
		i,
		s
	])];
}
function ve({ activeSnapPointProp: e, setActiveSnapPointProp: t, snapPoints: n, drawerRef: r, overlayRef: i, fadeFromIndex: a, onSnapPointChange: o, direction: s = "bottom", container: c, snapToSequentialPoint: l }) {
	let [u, f] = _e({
		prop: e,
		defaultProp: n?.[0],
		onChange: t
	}), [p, m] = d.useState(typeof window < "u" ? {
		innerWidth: window.innerWidth,
		innerHeight: window.innerHeight
	} : void 0);
	d.useEffect(() => {
		function e() {
			m({
				innerWidth: window.innerWidth,
				innerHeight: window.innerHeight
			});
		}
		return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
	}, []);
	let h = d.useMemo(() => u === n?.[n.length - 1] || null, [n, u]), g = d.useMemo(() => n?.findIndex((e) => e === u) ?? null, [n, u]), _ = n && n.length > 0 && (a || a === 0) && !Number.isNaN(a) && n[a] === u || !n, v = d.useMemo(() => {
		let e = c ? {
			width: c.getBoundingClientRect().width,
			height: c.getBoundingClientRect().height
		} : typeof window < "u" ? {
			width: window.innerWidth,
			height: window.innerHeight
		} : {
			width: 0,
			height: 0
		};
		return n?.map((t) => {
			let n = typeof t == "string", r = 0;
			if (n && (r = parseInt(t, 10)), B(s)) {
				let i = n ? r : p ? t * e.height : 0;
				return p ? s === "bottom" ? e.height - i : -e.height + i : i;
			}
			let i = n ? r : p ? t * e.width : 0;
			return p ? s === "right" ? e.width - i : -e.width + i : i;
		}) ?? [];
	}, [
		n,
		p,
		c
	]), y = d.useMemo(() => g === null ? null : v?.[g], [v, g]), b = d.useCallback((e) => {
		let t = v?.findIndex((t) => t === e) ?? null;
		o(t), z(r.current, {
			transition: `transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			transform: B(s) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)`
		}), v && t !== v.length - 1 && a !== void 0 && t !== a && t < a ? z(i.current, {
			transition: `opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			opacity: "0"
		}) : z(i.current, {
			transition: `opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			opacity: "1"
		}), f(n?.[Math.max(t, 0)]);
	}, [
		r.current,
		n,
		v,
		a,
		i,
		f
	]);
	d.useEffect(() => {
		if (u || e) {
			let t = n?.findIndex((t) => t === e || t === u) ?? -1;
			v && t !== -1 && typeof v[t] == "number" && b(v[t]);
		}
	}, [
		u,
		e,
		n,
		v,
		b
	]);
	function x({ draggedDistance: e, closeDrawer: t, velocity: r, dismissible: o }) {
		if (a === void 0) return;
		let c = s === "bottom" || s === "right" ? (y ?? 0) - e : (y ?? 0) + e, u = g === a - 1, d = g === 0, f = e > 0;
		if (u && z(i.current, { transition: `opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})` }), !l && r > 2 && !f) {
			o ? t() : b(v[0]);
			return;
		}
		if (!l && r > 2 && f && v && n) {
			b(v[n.length - 1]);
			return;
		}
		let p = v?.reduce((e, t) => typeof e != "number" || typeof t != "number" ? e : Math.abs(t - c) < Math.abs(e - c) ? t : e), m = B(s) ? window.innerHeight : window.innerWidth;
		if (r > de && Math.abs(e) < m * .4) {
			let e = f ? 1 : -1;
			if (e > 0 && h && n) {
				b(v[n.length - 1]);
				return;
			}
			if (d && e < 0 && o && t(), g === null) return;
			b(v[g + e]);
			return;
		}
		b(p);
	}
	function S({ draggedDistance: e }) {
		if (y === null) return;
		let t = s === "bottom" || s === "right" ? y - e : y + e;
		(s === "bottom" || s === "right") && t < v[v.length - 1] || (s === "top" || s === "left") && t > v[v.length - 1] || z(r.current, { transform: B(s) ? `translate3d(0, ${t}px, 0)` : `translate3d(${t}px, 0, 0)` });
	}
	function C(e, t) {
		if (!n || typeof g != "number" || !v || a === void 0) return null;
		let r = g === a - 1;
		if (g >= a && t) return 0;
		if (r && !t) return 1;
		if (!_ && !r) return null;
		let i = r ? g + 1 : g - 1, o = r ? v[i] - v[i - 1] : v[i + 1] - v[i], s = e / Math.abs(o);
		return r ? 1 - s : s;
	}
	return {
		isLastSnapPoint: h,
		activeSnapPoint: u,
		shouldFade: _,
		getPercentageDragged: C,
		setActiveSnapPoint: f,
		activeSnapPointIndex: g,
		onRelease: x,
		onDrag: S,
		snapPointsOffset: v
	};
}
function ye() {
	let { direction: e, isOpen: t, shouldScaleBackground: n, setBackgroundColorOnScale: r, noBodyStyles: i } = b(), a = d.useRef(null), o = m(() => document.body.style.backgroundColor, []);
	function s() {
		return (window.innerWidth - he) / window.innerWidth;
	}
	d.useEffect(() => {
		if (t && n) {
			a.current && clearTimeout(a.current);
			let t = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
			if (!t) return;
			r && !i && V(document.body, { background: "black" }), V(t, {
				transformOrigin: B(e) ? "top" : "left",
				transitionProperty: "transform, border-radius",
				transitionDuration: `${H.DURATION}s`,
				transitionTimingFunction: `cubic-bezier(${H.EASE.join(",")})`
			});
			let n = V(t, {
				borderRadius: `${me}px`,
				overflow: "hidden",
				...B(e) ? { transform: `scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)` } : { transform: `scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)` }
			});
			return () => {
				n(), a.current = window.setTimeout(() => {
					o ? document.body.style.background = o : document.body.style.removeProperty("background");
				}, H.DURATION * 1e3);
			};
		}
	}, [
		t,
		n,
		o
	]);
}
var K = null;
function be({ isOpen: e, modal: t, nested: n, hasBeenOpened: r, preventScrollRestoration: i, noBodyStyles: a }) {
	let [o, s] = d.useState(() => typeof window < "u" ? window.location.href : ""), c = d.useRef(0), l = d.useCallback(() => {
		if (w() && K === null && e && !a) {
			K = {
				position: document.body.style.position,
				top: document.body.style.top,
				left: document.body.style.left,
				height: document.body.style.height,
				right: "unset"
			};
			let { scrollX: e, innerHeight: t } = window;
			document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
				top: `${-c.current}px`,
				left: `${-e}px`,
				right: "0px",
				height: "auto"
			}), window.setTimeout(() => window.requestAnimationFrame(() => {
				let e = t - window.innerHeight;
				e && c.current >= t && (document.body.style.top = `${-(c.current + e)}px`);
			}), 300);
		}
	}, [e]), u = d.useCallback(() => {
		if (w() && K !== null && !a) {
			let e = -parseInt(document.body.style.top, 10), t = -parseInt(document.body.style.left, 10);
			Object.assign(document.body.style, K), window.requestAnimationFrame(() => {
				if (i && o !== window.location.href) {
					s(window.location.href);
					return;
				}
				window.scrollTo(t, e);
			}), K = null;
		}
	}, [o]);
	return d.useEffect(() => {
		function e() {
			c.current = window.scrollY;
		}
		return e(), window.addEventListener("scroll", e), () => {
			window.removeEventListener("scroll", e);
		};
	}, []), d.useEffect(() => {
		if (t) return () => {
			typeof document > "u" || document.querySelector("[data-vaul-drawer]") || u();
		};
	}, [t, u]), d.useEffect(() => {
		n || !r || (e ? (!window.matchMedia("(display-mode: standalone)").matches && l(), t || window.setTimeout(() => {
			u();
		}, 500)) : u());
	}, [
		e,
		r,
		o,
		t,
		n,
		l,
		u
	]), { restorePositionSetting: u };
}
function q({ open: e, onOpenChange: t, children: n, onDrag: r, onRelease: i, snapPoints: a, shouldScaleBackground: s = !1, setBackgroundColorOnScale: c = !0, closeThreshold: l = fe, scrollLockTimeout: u = pe, dismissible: f = !0, handleOnly: p = !1, fadeFromIndex: m = a && a.length - 1, activeSnapPoint: h, setActiveSnapPoint: g, fixed: _, modal: v = !0, onClose: b, nested: S, noBodyStyles: C = !1, direction: w = "bottom", defaultOpen: T = !1, disablePreventScroll: D = !0, snapToSequentialPoint: O = !1, preventScrollRestoration: k = !1, repositionInputs: A = !0, onAnimationEnd: j, container: ee, autoFocus: te = !1 }) {
	let [M = !1, N] = _e({
		defaultProp: T,
		prop: e,
		onChange: (e) => {
			t?.(e), !e && !S && je(), setTimeout(() => {
				j?.(e);
			}, H.DURATION * 1e3), e && !v && typeof window < "u" && window.requestAnimationFrame(() => {
				document.body.style.pointerEvents = "auto";
			}), e || (document.body.style.pointerEvents = "auto");
		}
	}), [ne, ie] = d.useState(!1), [P, F] = d.useState(!1), [ae, se] = d.useState(!1), I = d.useRef(null), L = d.useRef(null), R = d.useRef(null), V = d.useRef(null), W = d.useRef(null), G = d.useRef(!1), ye = d.useRef(null), K = d.useRef(0), q = d.useRef(!1), xe = d.useRef(!T), Se = d.useRef(0), J = d.useRef(null), Ce = d.useRef(J.current?.getBoundingClientRect().height || 0), we = d.useRef(J.current?.getBoundingClientRect().width || 0), Te = d.useRef(0), { activeSnapPoint: Ee, activeSnapPointIndex: Y, setActiveSnapPoint: De, onRelease: Oe, snapPointsOffset: X, onDrag: ke, shouldFade: Z, getPercentageDragged: Ae } = ve({
		snapPoints: a,
		activeSnapPointProp: h,
		setActiveSnapPointProp: g,
		drawerRef: J,
		fadeFromIndex: m,
		overlayRef: I,
		onSnapPointChange: d.useCallback((e) => {
			a && e === X.length - 1 && (L.current = /* @__PURE__ */ new Date());
		}, []),
		direction: w,
		container: ee,
		snapToSequentialPoint: O
	});
	re({ isDisabled: !M || P || !v || ae || !ne || !A || !D });
	let { restorePositionSetting: je } = be({
		isOpen: M,
		modal: v,
		nested: S ?? !1,
		hasBeenOpened: ne,
		preventScrollRestoration: k,
		noBodyStyles: C
	});
	function Q() {
		return (window.innerWidth - he) / window.innerWidth;
	}
	function Me(e) {
		!f && !a || J.current && !J.current.contains(e.target) || (Ce.current = J.current?.getBoundingClientRect().height || 0, we.current = J.current?.getBoundingClientRect().width || 0, F(!0), R.current = /* @__PURE__ */ new Date(), E() && window.addEventListener("touchend", () => G.current = !1, { once: !0 }), e.target.setPointerCapture(e.pointerId), K.current = B(w) ? e.pageY : e.pageX);
	}
	function Ne(e, t) {
		let n = e, r = window.getSelection()?.toString(), i = J.current ? le(J.current, w) : null, a = /* @__PURE__ */ new Date();
		if (n.tagName === "SELECT" || n.hasAttribute("data-vaul-no-drag") || n.closest("[data-vaul-no-drag]")) return !1;
		if (w === "right" || w === "left") return !0;
		if (L.current && a.getTime() - L.current.getTime() < 500) return !1;
		if (i !== null && (w === "bottom" ? i > 0 : i < 0)) return !0;
		if (r && r.length > 0) return !1;
		if (W.current && a.getTime() - W.current.getTime() < u && i === 0 || t) return W.current = a, !1;
		for (; n;) {
			if (n.scrollHeight > n.clientHeight) {
				if (n.scrollTop !== 0) return W.current = /* @__PURE__ */ new Date(), !1;
				if (n.getAttribute("role") === "dialog") return !0;
			}
			n = n.parentNode;
		}
		return !0;
	}
	function Pe(e) {
		if (J.current && P) {
			let t = w === "bottom" || w === "right" ? 1 : -1, n = (K.current - (B(w) ? e.pageY : e.pageX)) * t, i = n > 0, o = a && !f && !i;
			if (o && Y === 0) return;
			let c = Math.abs(n), l = document.querySelector("[data-vaul-drawer-wrapper]"), u = c / (w === "bottom" || w === "top" ? Ce.current : we.current), d = Ae(c, i);
			if (d !== null && (u = d), o && u >= 1 || !G.current && !Ne(e.target, i)) return;
			if (J.current.classList.add(ge), G.current = !0, z(J.current, { transition: "none" }), z(I.current, { transition: "none" }), a && ke({ draggedDistance: n }), i && !a) {
				let e = ue(n), r = Math.min(e * -1, 0) * t;
				z(J.current, { transform: B(w) ? `translate3d(0, ${r}px, 0)` : `translate3d(${r}px, 0, 0)` });
				return;
			}
			let p = 1 - u;
			if ((Z || m && Y === m - 1) && (r?.(e, u), z(I.current, {
				opacity: `${p}`,
				transition: "none"
			}, !0)), l && I.current && s) {
				let e = Math.min(Q() + u * (1 - Q()), 1), t = 8 - u * 8, n = Math.max(0, 14 - u * 14);
				z(l, {
					borderRadius: `${t}px`,
					transform: B(w) ? `scale(${e}) translate3d(0, ${n}px, 0)` : `scale(${e}) translate3d(${n}px, 0, 0)`,
					transition: "none"
				}, !0);
			}
			if (!a) {
				let e = c * t;
				z(J.current, { transform: B(w) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)` });
			}
		}
	}
	d.useEffect(() => {
		window.requestAnimationFrame(() => {
			xe.current = !0;
		});
	}, []), d.useEffect(() => {
		var e;
		function t() {
			if (!J.current || !A) return;
			let e = document.activeElement;
			if (oe(e) || q.current) {
				let e = window.visualViewport?.height || 0, t = window.innerHeight, n = t - e, r = J.current.getBoundingClientRect().height || 0, i = r > t * .8;
				Te.current ||= r;
				let o = J.current.getBoundingClientRect().top;
				if (Math.abs(Se.current - n) > 60 && (q.current = !q.current), a && a.length > 0 && X && Y) {
					let e = X[Y] || 0;
					n += e;
				}
				if (Se.current = n, r > e || q.current) {
					let t = J.current.getBoundingClientRect().height, r = t;
					t > e && (r = e - (i ? o : he)), _ ? J.current.style.height = `${t - Math.max(n, 0)}px` : J.current.style.height = `${Math.max(r, e - o)}px`;
				} else x() || (J.current.style.height = `${Te.current}px`);
				a && a.length > 0 && !q.current ? J.current.style.bottom = "0px" : J.current.style.bottom = `${Math.max(n, 0)}px`;
			}
		}
		return (e = window.visualViewport) == null || e.addEventListener("resize", t), () => window.visualViewport?.removeEventListener("resize", t);
	}, [
		Y,
		a,
		X
	]);
	function $(e) {
		Ie(), b?.(), e || N(!1), setTimeout(() => {
			a && De(a[0]);
		}, H.DURATION * 1e3);
	}
	function Fe() {
		if (!J.current) return;
		let e = document.querySelector("[data-vaul-drawer-wrapper]"), t = le(J.current, w);
		z(J.current, {
			transform: "translate3d(0, 0, 0)",
			transition: `transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`
		}), z(I.current, {
			transition: `opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			opacity: "1"
		}), s && t && t > 0 && M && z(e, {
			borderRadius: `${me}px`,
			overflow: "hidden",
			...B(w) ? {
				transform: `scale(${Q()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
				transformOrigin: "top"
			} : {
				transform: `scale(${Q()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
				transformOrigin: "left"
			},
			transitionProperty: "transform, border-radius",
			transitionDuration: `${H.DURATION}s`,
			transitionTimingFunction: `cubic-bezier(${H.EASE.join(",")})`
		}, !0);
	}
	function Ie() {
		!P || !J.current || (J.current.classList.remove(ge), G.current = !1, F(!1), V.current = /* @__PURE__ */ new Date());
	}
	function Le(e) {
		if (!P || !J.current) return;
		J.current.classList.remove(ge), G.current = !1, F(!1), V.current = /* @__PURE__ */ new Date();
		let t = le(J.current, w);
		if (!e || !Ne(e.target, !1) || !t || Number.isNaN(t) || R.current === null) return;
		let n = V.current.getTime() - R.current.getTime(), r = K.current - (B(w) ? e.pageY : e.pageX), o = Math.abs(r) / n;
		if (o > .05 && (se(!0), setTimeout(() => {
			se(!1);
		}, 200)), a) {
			Oe({
				draggedDistance: r * (w === "bottom" || w === "right" ? 1 : -1),
				closeDrawer: $,
				velocity: o,
				dismissible: f
			}), i?.(e, !0);
			return;
		}
		if (w === "bottom" || w === "right" ? r > 0 : r < 0) {
			Fe(), i?.(e, !0);
			return;
		}
		if (o > de) {
			$(), i?.(e, !1);
			return;
		}
		let s = Math.min(J.current.getBoundingClientRect().height ?? 0, window.innerHeight), c = Math.min(J.current.getBoundingClientRect().width ?? 0, window.innerWidth);
		if (Math.abs(t) >= (w === "left" || w === "right" ? c : s) * l) {
			$(), i?.(e, !1);
			return;
		}
		i?.(e, !0), Fe();
	}
	d.useEffect(() => (M && (z(document.documentElement, { scrollBehavior: "auto" }), L.current = /* @__PURE__ */ new Date()), () => {
		ce(document.documentElement, "scrollBehavior");
	}), [M]);
	function Re(e) {
		let t = e ? (window.innerWidth - U) / window.innerWidth : 1, n = e ? -U : 0;
		ye.current && window.clearTimeout(ye.current), z(J.current, {
			transition: `transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			transform: B(w) ? `scale(${t}) translate3d(0, ${n}px, 0)` : `scale(${t}) translate3d(${n}px, 0, 0)`
		}), !e && J.current && (ye.current = setTimeout(() => {
			let e = le(J.current, w);
			z(J.current, {
				transition: "none",
				transform: B(w) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)`
			});
		}, 500));
	}
	function ze(e, t) {
		if (t < 0) return;
		let n = (window.innerWidth - U) / window.innerWidth, r = n + t * (1 - n), i = -U + t * U;
		z(J.current, {
			transform: B(w) ? `scale(${r}) translate3d(0, ${i}px, 0)` : `scale(${r}) translate3d(${i}px, 0, 0)`,
			transition: "none"
		});
	}
	function Be(e, t) {
		let n = B(w) ? window.innerHeight : window.innerWidth, r = t ? (n - U) / n : 1, i = t ? -U : 0;
		t && z(J.current, {
			transition: `transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,
			transform: B(w) ? `scale(${r}) translate3d(0, ${i}px, 0)` : `scale(${r}) translate3d(${i}px, 0, 0)`
		});
	}
	return d.useEffect(() => {
		v || window.requestAnimationFrame(() => {
			document.body.style.pointerEvents = "auto";
		});
	}, [v]), /* @__PURE__ */ d.createElement(o, {
		defaultOpen: T,
		onOpenChange: (e) => {
			!f && !e || (e ? ie(!0) : $(!0), N(e));
		},
		open: M
	}, /* @__PURE__ */ d.createElement(y.Provider, { value: {
		activeSnapPoint: Ee,
		snapPoints: a,
		setActiveSnapPoint: De,
		drawerRef: J,
		overlayRef: I,
		onOpenChange: t,
		onPress: Me,
		onRelease: Le,
		onDrag: Pe,
		dismissible: f,
		shouldAnimate: xe,
		handleOnly: p,
		isOpen: M,
		isDragging: P,
		shouldFade: Z,
		closeDrawer: $,
		onNestedDrag: ze,
		onNestedOpenChange: Re,
		onNestedRelease: Be,
		keyboardIsOpen: q,
		modal: v,
		snapPointsOffset: X,
		activeSnapPointIndex: Y,
		direction: w,
		shouldScaleBackground: s,
		setBackgroundColorOnScale: c,
		noBodyStyles: C,
		container: ee,
		autoFocus: te
	} }, n));
}
var xe = /* @__PURE__ */ d.forwardRef(function({ ...e }, t) {
	let { overlayRef: n, snapPoints: r, onRelease: a, shouldFade: o, isOpen: s, modal: c, shouldAnimate: l } = b(), u = L(t, n), f = r && r.length > 0;
	if (!c) return null;
	let p = d.useCallback((e) => a(e), [a]);
	return /* @__PURE__ */ d.createElement(i, {
		onMouseUp: p,
		ref: u,
		"data-vaul-overlay": "",
		"data-vaul-snap-points": s && f ? "true" : "false",
		"data-vaul-snap-points-overlay": s && o ? "true" : "false",
		"data-vaul-animate": l?.current ? "true" : "false",
		...e
	});
});
xe.displayName = "Drawer.Overlay";
var Se = /* @__PURE__ */ d.forwardRef(function({ onPointerDownOutside: e, style: t, onOpenAutoFocus: n, ...r }, i) {
	let { drawerRef: o, onPress: s, onRelease: c, onDrag: l, keyboardIsOpen: u, snapPointsOffset: f, activeSnapPointIndex: p, modal: m, isOpen: h, direction: g, snapPoints: _, container: v, handleOnly: y, shouldAnimate: x, autoFocus: S } = b(), [C, w] = d.useState(!1), T = L(i, o), E = d.useRef(null), D = d.useRef(null), O = d.useRef(!1), k = _ && _.length > 0;
	ye();
	let A = (e, t, n = 0) => {
		if (O.current) return !0;
		let r = Math.abs(e.y), i = Math.abs(e.x), a = i > r, o = ["bottom", "right"].includes(t) ? 1 : -1;
		if (t === "left" || t === "right") {
			if (!(e.x * o < 0) && i >= 0 && i <= n) return a;
		} else if (!(e.y * o < 0) && r >= 0 && r <= n) return !a;
		return O.current = !0, !0;
	};
	d.useEffect(() => {
		k && window.requestAnimationFrame(() => {
			w(!0);
		});
	}, []);
	function j(e) {
		E.current = null, O.current = !1, c(e);
	}
	return /* @__PURE__ */ d.createElement(a, {
		"data-vaul-drawer-direction": g,
		"data-vaul-drawer": "",
		"data-vaul-delayed-snap-points": C ? "true" : "false",
		"data-vaul-snap-points": h && k ? "true" : "false",
		"data-vaul-custom-container": v ? "true" : "false",
		"data-vaul-animate": x?.current ? "true" : "false",
		...r,
		ref: T,
		style: f && f.length > 0 ? {
			"--snap-point-height": `${f[p ?? 0]}px`,
			...t
		} : t,
		onPointerDown: (e) => {
			y || (r.onPointerDown == null || r.onPointerDown.call(r, e), E.current = {
				x: e.pageX,
				y: e.pageY
			}, s(e));
		},
		onOpenAutoFocus: (e) => {
			n?.(e), S || e.preventDefault();
		},
		onPointerDownOutside: (t) => {
			if (e?.(t), !m || t.defaultPrevented) {
				t.preventDefault();
				return;
			}
			u.current &&= !1;
		},
		onFocusOutside: (e) => {
			if (!m) {
				e.preventDefault();
				return;
			}
		},
		onPointerMove: (e) => {
			if (D.current = e, y || (r.onPointerMove == null || r.onPointerMove.call(r, e), !E.current)) return;
			let t = e.pageY - E.current.y, n = e.pageX - E.current.x, i = e.pointerType === "touch" ? 10 : 2;
			A({
				x: n,
				y: t
			}, g, i) ? l(e) : (Math.abs(n) > i || Math.abs(t) > i) && (E.current = null);
		},
		onPointerUp: (e) => {
			r.onPointerUp == null || r.onPointerUp.call(r, e), E.current = null, O.current = !1, c(e);
		},
		onPointerOut: (e) => {
			r.onPointerOut == null || r.onPointerOut.call(r, e), j(D.current);
		},
		onContextMenu: (e) => {
			r.onContextMenu == null || r.onContextMenu.call(r, e), D.current && j(D.current);
		}
	});
});
Se.displayName = "Drawer.Content";
var J = 250, Ce = 120, we = /* @__PURE__ */ d.forwardRef(function({ preventCycle: e = !1, children: t, ...n }, r) {
	let { closeDrawer: i, isDragging: a, snapPoints: o, activeSnapPoint: s, setActiveSnapPoint: c, dismissible: l, handleOnly: u, isOpen: f, onPress: p, onDrag: m } = b(), h = d.useRef(null), g = d.useRef(!1);
	function _() {
		if (g.current) {
			x();
			return;
		}
		window.setTimeout(() => {
			v();
		}, Ce);
	}
	function v() {
		if (a || e || g.current) {
			x();
			return;
		}
		if (x(), !o || o.length === 0) {
			l || i();
			return;
		}
		if (s === o[o.length - 1] && l) {
			i();
			return;
		}
		let t = o.findIndex((e) => e === s);
		if (t === -1) return;
		let n = o[t + 1];
		c(n);
	}
	function y() {
		h.current = window.setTimeout(() => {
			g.current = !0;
		}, J);
	}
	function x() {
		h.current && window.clearTimeout(h.current), g.current = !1;
	}
	return /* @__PURE__ */ d.createElement("div", {
		onClick: _,
		onPointerCancel: x,
		onPointerDown: (e) => {
			u && p(e), y();
		},
		onPointerMove: (e) => {
			u && m(e);
		},
		ref: r,
		"data-vaul-drawer-visible": f ? "true" : "false",
		"data-vaul-handle": "",
		"aria-hidden": "true",
		...n
	}, /* @__PURE__ */ d.createElement("span", {
		"data-vaul-handle-hitarea": "",
		"aria-hidden": "true"
	}, t));
});
we.displayName = "Drawer.Handle";
function Te({ onDrag: e, onOpenChange: t, open: n, ...r }) {
	let { onNestedDrag: i, onNestedOpenChange: a, onNestedRelease: o } = b();
	if (!i) throw Error("Drawer.NestedRoot must be placed in another drawer");
	return /* @__PURE__ */ d.createElement(q, {
		nested: !0,
		open: n,
		onClose: () => {
			a(!1);
		},
		onDrag: (t, n) => {
			i(t, n), e?.(t, n);
		},
		onOpenChange: (e) => {
			e && a(e), t?.(e);
		},
		onRelease: o,
		...r
	});
}
function Ee(e) {
	let t = b(), { container: r = t.container, ...i } = e;
	return /* @__PURE__ */ d.createElement(n, {
		container: r,
		...i
	});
}
var Y = {
	Root: q,
	NestedRoot: Te,
	Content: Se,
	Overlay: xe,
	Trigger: r,
	Portal: Ee,
	Handle: we,
	Close: l,
	Title: c,
	Description: s
};
//#endregion
//#region src/components/ui/drawer.tsx
function De({ direction: e, ...t }) {
	return /* @__PURE__ */ g(Y.Root, {
		"data-slot": "drawer",
		modal: !0,
		direction: e || "right",
		snapPoints: [],
		closeThreshold: 1,
		...t
	});
}
function Oe({ ...e }) {
	return /* @__PURE__ */ g(Y.Trigger, {
		"data-slot": "drawer-trigger",
		...e
	});
}
function X({ ...e }) {
	return /* @__PURE__ */ g(Y.Portal, {
		"data-slot": "drawer-portal",
		...e
	});
}
function ke({ ...e }) {
	return /* @__PURE__ */ g(Y.Close, {
		"data-slot": "drawer-close",
		...e
	});
}
function Z({ className: t, ...n }) {
	return /* @__PURE__ */ g(Y.Overlay, {
		"data-slot": "drawer-overlay",
		className: e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-[30px]", t),
		...n
	});
}
function Ae({ className: n, children: r, inPortal: i = !1, overlayClassName: a, closeButtonClassName: o, ...s }) {
	let c = /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Z, { className: a }), /* @__PURE__ */ _(Y.Content, {
		"data-slot": "drawer-content",
		className: e("group/drawer-content bg-primary-white dark:bg-primary-black fixed z-50 flex h-auto flex-col px-[6px] sm:px-3", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh]", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh]", "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-[95%] sm:data-[vaul-drawer-direction=right]:w-[83.33%]", "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-[95%] sm:data-[vaul-drawer-direction=right]:w-[83.33%]", n),
		...s,
		children: [/* @__PURE__ */ g(ke, {
			asChild: !0,
			children: /* @__PURE__ */ g("button", {
				className: e("fixed top-4 p-2 rounded-full bg-primary-gray-200 dark:bg-primary-gray-650 transition-all", "group-data-[vaul-drawer-direction=right]/drawer-content:mr-4 group-data-[vaul-drawer-direction=right]/drawer-content:right-0 sm:group-data-[vaul-drawer-direction=right]/drawer-content:mr-[8.33%] sm:group-data-[vaul-drawer-direction=right]/drawer-content:right-[100%]", "group-data-[vaul-drawer-direction=left]/drawer-content:ml-4 group-data-[vaul-drawer-direction=left]/drawer-content:left-0 sm:group-data-[vaul-drawer-direction=left]/drawer-content:ml-[8.33%] sm:group-data-[vaul-drawer-direction=left]/drawer-content:left-[100%]", "group-data-[vaul-drawer-direction=top]/drawer-content:hidden", "group-data-[vaul-drawer-direction=bottom]/drawer-content:hidden", o),
				type: "button",
				children: /* @__PURE__ */ g(t, {
					size: 32,
					strokeWidth: 1
				})
			})
		}), /* @__PURE__ */ g("div", {
			style: {
				userSelect: "text",
				touchAction: "auto"
			},
			className: "pt-[4.375rem] px-[0.75rem] md:pt-0 md:pr-[1.5rem] md:pl-[2rem] h-screen undp-scrollbar",
			children: r
		})]
	})] });
	return i ? /* @__PURE__ */ g(X, {
		"data-slot": "drawer-portal",
		children: c
	}) : c;
}
function je({ className: t, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "drawer-header",
		className: e("mt-0 mr-0 ml-[1.875rem] md:mt-[6rem] md:ml-[6rem] group-data-[vaul-drawer-direction=left]:mt-24 group-data-[vaul-drawer-direction=right]:mt-24 group-data-[vaul-drawer-direction=right]:mr-24 group-data-[vaul-drawer-direction=top]:mt-24 group-data-[vaul-drawer-direction=bottom]:mt-24 group-data-[vaul-drawer-direction=top]:ml-24 group-data-[vaul-drawer-direction=bottom]:ml-24 group-data-[vaul-drawer-direction=left]:mt-24 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left", t),
		...n
	});
}
function Q({ className: t, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "drawer-body",
		className: e("mt-20 sm:mt-10", t),
		...n
	});
}
function Me({ className: t, ...n }) {
	return /* @__PURE__ */ g("div", {
		"data-slot": "drawer-footer",
		className: e("mt-auto flex flex-col gap-2 p-4 absolute bottom-0", t),
		...n
	});
}
function Ne({ ...t }) {
	return /* @__PURE__ */ g(Y.Title, {
		"data-slot": "drawer-title",
		...t,
		className: e("font-heading mb-4 text-[1.563rem] leading-[1.1] uppercase font-bold md:text-[3.438rem]", t.className)
	});
}
function Pe({ ...t }) {
	return /* @__PURE__ */ g(Y.Description, {
		"data-slot": "drawer-description",
		...t,
		className: e("text-[1.25rem] mb-4 leading-[1.15] font-semibold md:text-[2.188rem]", t.className)
	});
}
//#endregion
export { Pe as a, Z as c, Oe as d, Ae as i, X as l, Q as n, Me as o, ke as r, je as s, De as t, Ne as u };

//# sourceMappingURL=drawer-TkKCZ_7g.js.map