import { a as e, i as t, r as n, t as r } from "./dist-DCjaNViz.js";
import { o as i, r as a, t as o } from "./dist-D-6_qntS.js";
import { t as s } from "./dist-BSqU5QJM.js";
import { t as c } from "./dist-BN9-Ksur.js";
import { r as l, t as u } from "./dist-CniKe8MM.js";
import { i as d, n as f, r as p, t as m } from "./es2015-gSh3xMJF.js";
import * as h from "react";
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-dialog/dist/index.mjs
var y = "Dialog", [b, ee] = e(y), [x, S] = b(y), C = (e) => {
	let { __scopeDialog: t, children: n, open: i, defaultOpen: a, onOpenChange: o, modal: s = !0 } = e, l = h.useRef(null), u = h.useRef(null), [d, f] = r({
		prop: i,
		defaultProp: a ?? !1,
		onChange: o,
		caller: y
	});
	return /* @__PURE__ */ _(x, {
		scope: t,
		triggerRef: l,
		contentRef: u,
		contentId: c(),
		titleId: c(),
		descriptionId: c(),
		open: d,
		onOpenChange: f,
		onOpenToggle: h.useCallback(() => f((e) => !e), [f]),
		modal: s,
		children: n
	});
};
C.displayName = y;
var w = "DialogTrigger", T = h.forwardRef((e, t) => {
	let { __scopeDialog: r, ...a } = e, s = S(w, r), c = i(t, s.triggerRef);
	return /* @__PURE__ */ _(o.button, {
		type: "button",
		"aria-haspopup": "dialog",
		"aria-expanded": s.open,
		"aria-controls": s.contentId,
		"data-state": G(s.open),
		...a,
		ref: c,
		onClick: n(e.onClick, s.onOpenToggle)
	});
});
T.displayName = w;
var E = "DialogPortal", [D, O] = b(E, { forceMount: void 0 }), k = (e) => {
	let { __scopeDialog: t, forceMount: n, children: r, container: i } = e, a = S(E, t);
	return /* @__PURE__ */ _(D, {
		scope: t,
		forceMount: n,
		children: h.Children.map(r, (e) => /* @__PURE__ */ _(s, {
			present: n || a.open,
			children: /* @__PURE__ */ _(u, {
				asChild: !0,
				container: i,
				children: e
			})
		}))
	});
};
k.displayName = E;
var A = "DialogOverlay", j = h.forwardRef((e, t) => {
	let n = O(A, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = S(A, e.__scopeDialog);
	return a.modal ? /* @__PURE__ */ _(s, {
		present: r || a.open,
		children: /* @__PURE__ */ _(N, {
			...i,
			ref: t
		})
	}) : null;
});
j.displayName = A;
var M = a("DialogOverlay.RemoveScroll"), N = h.forwardRef((e, t) => {
	let { __scopeDialog: n, ...r } = e, i = S(A, n);
	return /* @__PURE__ */ _(f, {
		as: M,
		allowPinchZoom: !0,
		shards: [i.contentRef],
		children: /* @__PURE__ */ _(o.div, {
			"data-state": G(i.open),
			...r,
			ref: t,
			style: {
				pointerEvents: "auto",
				...r.style
			}
		})
	});
}), P = "DialogContent", F = h.forwardRef((e, t) => {
	let n = O(P, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = S(P, e.__scopeDialog);
	return /* @__PURE__ */ _(s, {
		present: r || a.open,
		children: a.modal ? /* @__PURE__ */ _(I, {
			...i,
			ref: t
		}) : /* @__PURE__ */ _(L, {
			...i,
			ref: t
		})
	});
});
F.displayName = P;
var I = h.forwardRef((e, t) => {
	let r = S(P, e.__scopeDialog), a = h.useRef(null), o = i(t, r.contentRef, a);
	return h.useEffect(() => {
		let e = a.current;
		if (e) return m(e);
	}, []), /* @__PURE__ */ _(R, {
		...e,
		ref: o,
		trapFocus: r.open,
		disableOutsidePointerEvents: !0,
		onCloseAutoFocus: n(e.onCloseAutoFocus, (e) => {
			e.preventDefault(), r.triggerRef.current?.focus();
		}),
		onPointerDownOutside: n(e.onPointerDownOutside, (e) => {
			let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0;
			(t.button === 2 || n) && e.preventDefault();
		}),
		onFocusOutside: n(e.onFocusOutside, (e) => e.preventDefault())
	});
}), L = h.forwardRef((e, t) => {
	let n = S(P, e.__scopeDialog), r = h.useRef(!1), i = h.useRef(!1);
	return /* @__PURE__ */ _(R, {
		...e,
		ref: t,
		trapFocus: !1,
		disableOutsidePointerEvents: !1,
		onCloseAutoFocus: (t) => {
			e.onCloseAutoFocus?.(t), t.defaultPrevented || (r.current || n.triggerRef.current?.focus(), t.preventDefault()), r.current = !1, i.current = !1;
		},
		onInteractOutside: (t) => {
			e.onInteractOutside?.(t), t.defaultPrevented || (r.current = !0, t.detail.originalEvent.type === "pointerdown" && (i.current = !0));
			let a = t.target;
			n.triggerRef.current?.contains(a) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && i.current && t.preventDefault();
		}
	});
}), R = h.forwardRef((e, t) => {
	let { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: a, onCloseAutoFocus: o, ...s } = e, c = S(P, n), u = h.useRef(null), f = i(t, u);
	return p(), /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(d, {
		asChild: !0,
		loop: !0,
		trapped: r,
		onMountAutoFocus: a,
		onUnmountAutoFocus: o,
		children: /* @__PURE__ */ _(l, {
			role: "dialog",
			id: c.contentId,
			"aria-describedby": c.descriptionId,
			"aria-labelledby": c.titleId,
			"data-state": G(c.open),
			...s,
			ref: f,
			onDismiss: () => c.onOpenChange(!1)
		})
	}), /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(J, { titleId: c.titleId }), /* @__PURE__ */ _(X, {
		contentRef: u,
		descriptionId: c.descriptionId
	})] })] });
}), z = "DialogTitle", B = h.forwardRef((e, t) => {
	let { __scopeDialog: n, ...r } = e, i = S(z, n);
	return /* @__PURE__ */ _(o.h2, {
		id: i.titleId,
		...r,
		ref: t
	});
});
B.displayName = z;
var V = "DialogDescription", H = h.forwardRef((e, t) => {
	let { __scopeDialog: n, ...r } = e, i = S(V, n);
	return /* @__PURE__ */ _(o.p, {
		id: i.descriptionId,
		...r,
		ref: t
	});
});
H.displayName = V;
var U = "DialogClose", W = h.forwardRef((e, t) => {
	let { __scopeDialog: r, ...i } = e, a = S(U, r);
	return /* @__PURE__ */ _(o.button, {
		type: "button",
		...i,
		ref: t,
		onClick: n(e.onClick, () => a.onOpenChange(!1))
	});
});
W.displayName = U;
function G(e) {
	return e ? "open" : "closed";
}
var K = "DialogTitleWarning", [te, q] = t(K, {
	contentName: P,
	titleName: z,
	docsSlug: "dialog"
}), J = ({ titleId: e }) => {
	let t = q(K), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
	return h.useEffect(() => {
		e && (document.getElementById(e) || console.error(n));
	}, [n, e]), null;
}, Y = "DialogDescriptionWarning", X = ({ contentRef: e, descriptionId: t }) => {
	let n = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${q(Y).contentName}}.`;
	return h.useEffect(() => {
		let r = e.current?.getAttribute("aria-describedby");
		t && r && (document.getElementById(t) || console.warn(n));
	}, [
		n,
		e,
		t
	]), null;
}, Z = C, Q = T, ne = k, $ = j, re = F, ie = B, ae = H, oe = W;
//#endregion
export { ne as a, Q as c, $ as i, re as n, Z as o, ae as r, ie as s, oe as t };

//# sourceMappingURL=dist-CFv9lNyL.js.map