import { n as e, t } from "./dist-CTlQcJNK.js";
import { a as n } from "./dist-koa_pEtu.js";
import * as r from "react";
import i from "react";
import { jsx as a } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs
/* @__NO_SIDE_EFFECTS__ */
function o(e) {
	let t = /* @__PURE__ */ s(e), n = r.forwardRef((e, n) => {
		let { children: i, ...o } = e, s = r.Children.toArray(i), c = s.find(l);
		if (c) {
			let e = c.props.children, i = s.map((t) => t === c ? r.Children.count(e) > 1 ? r.Children.only(null) : r.isValidElement(e) ? e.props.children : null : t);
			return /* @__PURE__ */ a(t, {
				...o,
				ref: n,
				children: r.isValidElement(e) ? r.cloneElement(e, void 0, i) : null
			});
		}
		return /* @__PURE__ */ a(t, {
			...o,
			ref: n,
			children: i
		});
	});
	return n.displayName = `${e}.Slot`, n;
}
/* @__NO_SIDE_EFFECTS__ */
function s(e) {
	let n = r.forwardRef((e, n) => {
		let { children: i, ...a } = e;
		if (r.isValidElement(i)) {
			let e = d(i), o = u(a, i.props);
			return i.type !== r.Fragment && (o.ref = n ? t(n, e) : e), r.cloneElement(i, o);
		}
		return r.Children.count(i) > 1 ? r.Children.only(null) : null;
	});
	return n.displayName = `${e}.SlotClone`, n;
}
var c = Symbol("radix.slottable");
function l(e) {
	return r.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === c;
}
function u(e, t) {
	let n = { ...t };
	for (let r in t) {
		let i = e[r], a = t[r];
		/^on[A-Z]/.test(r) ? i && a ? n[r] = (...e) => {
			let t = a(...e);
			return i(...e), t;
		} : i && (n[r] = i) : r === "style" ? n[r] = {
			...i,
			...a
		} : r === "className" && (n[r] = [i, a].filter(Boolean).join(" "));
	}
	return {
		...e,
		...n
	};
}
function d(e) {
	let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
	return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
}
//#endregion
//#region node_modules/@radix-ui/react-collection/dist/index.mjs
function f(t) {
	let r = t + "CollectionProvider", [s, c] = n(r), [l, u] = s(r, {
		collectionRef: { current: null },
		itemMap: /* @__PURE__ */ new Map()
	}), d = (e) => {
		let { scope: t, children: n } = e, r = i.useRef(null), o = i.useRef(/* @__PURE__ */ new Map()).current;
		return /* @__PURE__ */ a(l, {
			scope: t,
			itemMap: o,
			collectionRef: r,
			children: n
		});
	};
	d.displayName = r;
	let f = t + "CollectionSlot", p = /* @__PURE__ */ o(f), m = i.forwardRef((t, n) => {
		let { scope: r, children: i } = t;
		return /* @__PURE__ */ a(p, {
			ref: e(n, u(f, r).collectionRef),
			children: i
		});
	});
	m.displayName = f;
	let h = t + "CollectionItemSlot", g = "data-radix-collection-item", _ = /* @__PURE__ */ o(h), v = i.forwardRef((t, n) => {
		let { scope: r, children: o, ...s } = t, c = i.useRef(null), l = e(n, c), d = u(h, r);
		return i.useEffect(() => (d.itemMap.set(c, {
			ref: c,
			...s
		}), () => void d.itemMap.delete(c))), /* @__PURE__ */ a(_, {
			[g]: "",
			ref: l,
			children: o
		});
	});
	v.displayName = h;
	function y(e) {
		let n = u(t + "CollectionConsumer", e);
		return i.useCallback(() => {
			let e = n.collectionRef.current;
			if (!e) return [];
			let t = Array.from(e.querySelectorAll(`[${g}]`));
			return Array.from(n.itemMap.values()).sort((e, n) => t.indexOf(e.ref.current) - t.indexOf(n.ref.current));
		}, [n.collectionRef, n.itemMap]);
	}
	return [
		{
			Provider: d,
			Slot: m,
			ItemSlot: v
		},
		y,
		c
	];
}
//#endregion
export { f as t };

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