import { l as e } from "./rafScheduler-CYaktF5t.js";
import { t } from "./createLucideIcon-C-kpPCU2.js";
import { t as n } from "./chevron-right-BfEHxLF2.js";
import { D as r, I as i, L as a, M as o, R as s, t as c, y as l, z as u } from "./TopicQuickPicker-CM1HfziA.js";
import * as d from "react";
import f, { createContext as p, useCallback as m, useContext as h, useEffect as g, useId as _, useImperativeHandle as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S, useSyncExternalStore as C } from "react";
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
var D = t("GripVertical", [
	["circle", {
		cx: "9",
		cy: "12",
		r: "1",
		key: "1vctgf"
	}],
	["circle", {
		cx: "9",
		cy: "5",
		r: "1",
		key: "hp0tcf"
	}],
	["circle", {
		cx: "9",
		cy: "19",
		r: "1",
		key: "fkjjf6"
	}],
	["circle", {
		cx: "15",
		cy: "12",
		r: "1",
		key: "1tmaij"
	}],
	["circle", {
		cx: "15",
		cy: "5",
		r: "1",
		key: "19l28e"
	}],
	["circle", {
		cx: "15",
		cy: "19",
		r: "1",
		key: "f4zoj3"
	}]
]), O = t("Upload", [
	["path", {
		d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
		key: "ih7n3h"
	}],
	["polyline", {
		points: "17 8 12 3 7 8",
		key: "t8dd8p"
	}],
	["line", {
		x1: "12",
		x2: "12",
		y1: "3",
		y2: "15",
		key: "widbto"
	}]
]);
//#endregion
//#region node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs
/* @__NO_SIDE_EFFECTS__ */
function k(e) {
	let t = /* @__PURE__ */ A(e), n = d.forwardRef((e, n) => {
		let { children: r, ...i } = e, a = d.Children.toArray(r), o = a.find(te);
		if (o) {
			let e = o.props.children, r = a.map((t) => t === o ? d.Children.count(e) > 1 ? d.Children.only(null) : d.isValidElement(e) ? e.props.children : null : t);
			return /* @__PURE__ */ T(t, {
				...i,
				ref: n,
				children: d.isValidElement(e) ? d.cloneElement(e, void 0, r) : null
			});
		}
		return /* @__PURE__ */ T(t, {
			...i,
			ref: n,
			children: r
		});
	});
	return n.displayName = `${e}.Slot`, n;
}
/* @__NO_SIDE_EFFECTS__ */
function A(e) {
	let t = d.forwardRef((e, t) => {
		let { children: n, ...r } = e;
		if (d.isValidElement(n)) {
			let e = re(n), i = ne(r, n.props);
			return n.type !== d.Fragment && (i.ref = t ? a(t, e) : e), d.cloneElement(n, i);
		}
		return d.Children.count(n) > 1 ? d.Children.only(null) : null;
	});
	return t.displayName = `${e}.SlotClone`, t;
}
var ee = Symbol("radix.slottable");
function te(e) {
	return d.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === ee;
}
function ne(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 re(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 ie(e) {
	let t = e + "CollectionProvider", [n, r] = u(t), [i, a] = n(t, {
		collectionRef: { current: null },
		itemMap: /* @__PURE__ */ new Map()
	}), o = (e) => {
		let { scope: t, children: n } = e, r = f.useRef(null), a = f.useRef(/* @__PURE__ */ new Map()).current;
		return /* @__PURE__ */ T(i, {
			scope: t,
			itemMap: a,
			collectionRef: r,
			children: n
		});
	};
	o.displayName = t;
	let c = e + "CollectionSlot", l = /* @__PURE__ */ k(c), d = f.forwardRef((e, t) => {
		let { scope: n, children: r } = e;
		return /* @__PURE__ */ T(l, {
			ref: s(t, a(c, n).collectionRef),
			children: r
		});
	});
	d.displayName = c;
	let p = e + "CollectionItemSlot", m = "data-radix-collection-item", h = /* @__PURE__ */ k(p), g = f.forwardRef((e, t) => {
		let { scope: n, children: r, ...i } = e, o = f.useRef(null), c = s(t, o), l = a(p, n);
		return f.useEffect(() => (l.itemMap.set(o, {
			ref: o,
			...i
		}), () => void l.itemMap.delete(o))), /* @__PURE__ */ T(h, {
			[m]: "",
			ref: c,
			children: r
		});
	});
	g.displayName = p;
	function _(t) {
		let n = a(e + "CollectionConsumer", t);
		return f.useCallback(() => {
			let e = n.collectionRef.current;
			if (!e) return [];
			let t = Array.from(e.querySelectorAll(`[${m}]`));
			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: o,
			Slot: d,
			ItemSlot: g
		},
		_,
		r
	];
}
//#endregion
//#region node_modules/@radix-ui/react-direction/dist/index.mjs
var ae = d.createContext(void 0);
function oe(e) {
	let t = d.useContext(ae);
	return e || t || "ltr";
}
//#endregion
//#region node_modules/@radix-ui/number/dist/index.mjs
function se(e, [t, n]) {
	return Math.min(n, Math.max(t, e));
}
//#endregion
//#region node_modules/@radix-ui/react-use-previous/dist/index.mjs
function ce(e) {
	let t = d.useRef({
		value: e,
		previous: e
	});
	return d.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
}
//#endregion
//#region node_modules/@radix-ui/react-slider/dist/index.mjs
var le = ["PageUp", "PageDown"], ue = [
	"ArrowUp",
	"ArrowDown",
	"ArrowLeft",
	"ArrowRight"
], de = {
	"from-left": [
		"Home",
		"PageDown",
		"ArrowDown",
		"ArrowLeft"
	],
	"from-right": [
		"Home",
		"PageDown",
		"ArrowDown",
		"ArrowRight"
	],
	"from-bottom": [
		"Home",
		"PageDown",
		"ArrowDown",
		"ArrowLeft"
	],
	"from-top": [
		"Home",
		"PageDown",
		"ArrowUp",
		"ArrowLeft"
	]
}, j = "Slider", [fe, pe, me] = ie(j), [he, ge] = u(j, [me]), [_e, M] = he(j), ve = d.forwardRef((e, t) => {
	let { name: n, min: r = 0, max: a = 100, step: o = 1, orientation: s = "horizontal", disabled: c = !1, minStepsBetweenThumbs: u = 0, defaultValue: f = [r], value: p, onValueChange: m = () => {}, onValueCommit: h = () => {}, inverted: g = !1, form: _, ...v } = e, y = d.useRef(/* @__PURE__ */ new Set()), b = d.useRef(0), x = s === "horizontal" ? xe : Se, [S = [], C] = l({
		prop: p,
		defaultProp: f,
		onChange: (e) => {
			[...y.current][b.current]?.focus(), m(e);
		}
	}), w = d.useRef(S);
	function E(e) {
		k(e, Ie(S, e));
	}
	function D(e) {
		k(e, b.current);
	}
	function O() {
		let e = w.current[b.current];
		S[b.current] !== e && h(S);
	}
	function k(e, t, { commit: n } = { commit: !1 }) {
		let i = Ve(o), s = se(He(Math.round((e - r) / o) * o + r, i), [r, a]);
		C((e = []) => {
			let r = Ne(e, s, t);
			if (ze(r, u * o)) {
				b.current = r.indexOf(s);
				let t = String(r) !== String(e);
				return t && n && h(r), t ? r : e;
			} else return e;
		});
	}
	return /* @__PURE__ */ T(_e, {
		scope: e.__scopeSlider,
		name: n,
		disabled: c,
		min: r,
		max: a,
		valueIndexToChangeRef: b,
		thumbs: y.current,
		values: S,
		orientation: s,
		form: _,
		children: /* @__PURE__ */ T(fe.Provider, {
			scope: e.__scopeSlider,
			children: /* @__PURE__ */ T(fe.Slot, {
				scope: e.__scopeSlider,
				children: /* @__PURE__ */ T(x, {
					"aria-disabled": c,
					"data-disabled": c ? "" : void 0,
					...v,
					ref: t,
					onPointerDown: i(v.onPointerDown, () => {
						c || (w.current = S);
					}),
					min: r,
					max: a,
					inverted: g,
					onSlideStart: c ? void 0 : E,
					onSlideMove: c ? void 0 : D,
					onSlideEnd: c ? void 0 : O,
					onHomeKeyDown: () => !c && k(r, 0, { commit: !0 }),
					onEndKeyDown: () => !c && k(a, S.length - 1, { commit: !0 }),
					onStepKeyDown: ({ event: e, direction: t }) => {
						if (!c) {
							let n = le.includes(e.key) || e.shiftKey && ue.includes(e.key) ? 10 : 1, r = b.current, i = S[r];
							k(i + o * n * t, r, { commit: !0 });
						}
					}
				})
			})
		})
	});
});
ve.displayName = j;
var [ye, be] = he(j, {
	startEdge: "left",
	endEdge: "right",
	size: "width",
	direction: 1
}), xe = d.forwardRef((e, t) => {
	let { min: n, max: r, dir: i, inverted: a, onSlideStart: o, onSlideMove: c, onSlideEnd: l, onStepKeyDown: u, ...f } = e, [p, m] = d.useState(null), h = s(t, (e) => m(e)), g = d.useRef(void 0), _ = oe(i), v = _ === "ltr", y = v && !a || !v && a;
	function b(e) {
		let t = g.current || p.getBoundingClientRect(), i = Be([0, t.width], y ? [n, r] : [r, n]);
		return g.current = t, i(e - t.left);
	}
	return /* @__PURE__ */ T(ye, {
		scope: e.__scopeSlider,
		startEdge: y ? "left" : "right",
		endEdge: y ? "right" : "left",
		direction: y ? 1 : -1,
		size: "width",
		children: /* @__PURE__ */ T(Ce, {
			dir: _,
			"data-orientation": "horizontal",
			...f,
			ref: h,
			style: {
				...f.style,
				"--radix-slider-thumb-transform": "translateX(-50%)"
			},
			onSlideStart: (e) => {
				let t = b(e.clientX);
				o?.(t);
			},
			onSlideMove: (e) => {
				let t = b(e.clientX);
				c?.(t);
			},
			onSlideEnd: () => {
				g.current = void 0, l?.();
			},
			onStepKeyDown: (e) => {
				let t = de[y ? "from-left" : "from-right"].includes(e.key);
				u?.({
					event: e,
					direction: t ? -1 : 1
				});
			}
		})
	});
}), Se = d.forwardRef((e, t) => {
	let { min: n, max: r, inverted: i, onSlideStart: a, onSlideMove: o, onSlideEnd: c, onStepKeyDown: l, ...u } = e, f = d.useRef(null), p = s(t, f), m = d.useRef(void 0), h = !i;
	function g(e) {
		let t = m.current || f.current.getBoundingClientRect(), i = Be([0, t.height], h ? [r, n] : [n, r]);
		return m.current = t, i(e - t.top);
	}
	return /* @__PURE__ */ T(ye, {
		scope: e.__scopeSlider,
		startEdge: h ? "bottom" : "top",
		endEdge: h ? "top" : "bottom",
		size: "height",
		direction: h ? 1 : -1,
		children: /* @__PURE__ */ T(Ce, {
			"data-orientation": "vertical",
			...u,
			ref: p,
			style: {
				...u.style,
				"--radix-slider-thumb-transform": "translateY(50%)"
			},
			onSlideStart: (e) => {
				let t = g(e.clientY);
				a?.(t);
			},
			onSlideMove: (e) => {
				let t = g(e.clientY);
				o?.(t);
			},
			onSlideEnd: () => {
				m.current = void 0, c?.();
			},
			onStepKeyDown: (e) => {
				let t = de[h ? "from-bottom" : "from-top"].includes(e.key);
				l?.({
					event: e,
					direction: t ? -1 : 1
				});
			}
		})
	});
}), Ce = d.forwardRef((e, t) => {
	let { __scopeSlider: n, onSlideStart: r, onSlideMove: a, onSlideEnd: s, onHomeKeyDown: c, onEndKeyDown: l, onStepKeyDown: u, ...d } = e, f = M(j, n);
	return /* @__PURE__ */ T(o.span, {
		...d,
		ref: t,
		onKeyDown: i(e.onKeyDown, (e) => {
			e.key === "Home" ? (c(e), e.preventDefault()) : e.key === "End" ? (l(e), e.preventDefault()) : le.concat(ue).includes(e.key) && (u(e), e.preventDefault());
		}),
		onPointerDown: i(e.onPointerDown, (e) => {
			let t = e.target;
			t.setPointerCapture(e.pointerId), e.preventDefault(), f.thumbs.has(t) ? t.focus() : r(e);
		}),
		onPointerMove: i(e.onPointerMove, (e) => {
			e.target.hasPointerCapture(e.pointerId) && a(e);
		}),
		onPointerUp: i(e.onPointerUp, (e) => {
			let t = e.target;
			t.hasPointerCapture(e.pointerId) && (t.releasePointerCapture(e.pointerId), s(e));
		})
	});
}), we = "SliderTrack", Te = d.forwardRef((e, t) => {
	let { __scopeSlider: n, ...r } = e, i = M(we, n);
	return /* @__PURE__ */ T(o.span, {
		"data-disabled": i.disabled ? "" : void 0,
		"data-orientation": i.orientation,
		...r,
		ref: t
	});
});
Te.displayName = we;
var Ee = "SliderRange", De = d.forwardRef((e, t) => {
	let { __scopeSlider: n, ...r } = e, i = M(Ee, n), a = be(Ee, n), c = s(t, d.useRef(null)), l = i.values.length, u = i.values.map((e) => Pe(e, i.min, i.max)), f = l > 1 ? Math.min(...u) : 0, p = 100 - Math.max(...u);
	return /* @__PURE__ */ T(o.span, {
		"data-orientation": i.orientation,
		"data-disabled": i.disabled ? "" : void 0,
		...r,
		ref: c,
		style: {
			...e.style,
			[a.startEdge]: f + "%",
			[a.endEdge]: p + "%"
		}
	});
});
De.displayName = Ee;
var Oe = "SliderThumb", ke = d.forwardRef((e, t) => {
	let n = pe(e.__scopeSlider), [r, i] = d.useState(null), a = s(t, (e) => i(e)), o = d.useMemo(() => r ? n().findIndex((e) => e.ref.current === r) : -1, [n, r]);
	return /* @__PURE__ */ T(Ae, {
		...e,
		ref: a,
		index: o
	});
}), Ae = d.forwardRef((e, t) => {
	let { __scopeSlider: n, index: a, name: c, ...l } = e, u = M(Oe, n), f = be(Oe, n), [p, m] = d.useState(null), h = s(t, (e) => m(e)), g = p ? u.form || !!p.closest("form") : !0, _ = r(p), v = u.values[a], y = v === void 0 ? 0 : Pe(v, u.min, u.max), b = Fe(a, u.values.length), x = _?.[f.size], S = x ? Le(x, y, f.direction) : 0;
	return d.useEffect(() => {
		if (p) return u.thumbs.add(p), () => {
			u.thumbs.delete(p);
		};
	}, [p, u.thumbs]), /* @__PURE__ */ E("span", {
		style: {
			transform: "var(--radix-slider-thumb-transform)",
			position: "absolute",
			[f.startEdge]: `calc(${y}% + ${S}px)`
		},
		children: [/* @__PURE__ */ T(fe.ItemSlot, {
			scope: e.__scopeSlider,
			children: /* @__PURE__ */ T(o.span, {
				role: "slider",
				"aria-label": e["aria-label"] || b,
				"aria-valuemin": u.min,
				"aria-valuenow": v,
				"aria-valuemax": u.max,
				"aria-orientation": u.orientation,
				"data-orientation": u.orientation,
				"data-disabled": u.disabled ? "" : void 0,
				tabIndex: u.disabled ? void 0 : 0,
				...l,
				ref: h,
				style: v === void 0 ? { display: "none" } : e.style,
				onFocus: i(e.onFocus, () => {
					u.valueIndexToChangeRef.current = a;
				})
			})
		}), g && /* @__PURE__ */ T(Me, {
			name: c ?? (u.name ? u.name + (u.values.length > 1 ? "[]" : "") : void 0),
			form: u.form,
			value: v
		}, a)]
	});
});
ke.displayName = Oe;
var je = "RadioBubbleInput", Me = d.forwardRef(({ __scopeSlider: e, value: t, ...n }, r) => {
	let i = d.useRef(null), a = s(i, r), c = ce(t);
	return d.useEffect(() => {
		let e = i.current;
		if (!e) return;
		let n = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(n, "value").set;
		if (c !== t && r) {
			let n = new Event("input", { bubbles: !0 });
			r.call(e, t), e.dispatchEvent(n);
		}
	}, [c, t]), /* @__PURE__ */ T(o.input, {
		style: { display: "none" },
		...n,
		ref: a,
		defaultValue: t
	});
});
Me.displayName = je;
function Ne(e = [], t, n) {
	let r = [...e];
	return r[n] = t, r.sort((e, t) => e - t);
}
function Pe(e, t, n) {
	return se(100 / (n - t) * (e - t), [0, 100]);
}
function Fe(e, t) {
	if (t > 2) return `Value ${e + 1} of ${t}`;
	if (t === 2) return ["Minimum", "Maximum"][e];
}
function Ie(e, t) {
	if (e.length === 1) return 0;
	let n = e.map((e) => Math.abs(e - t)), r = Math.min(...n);
	return n.indexOf(r);
}
function Le(e, t, n) {
	let r = e / 2;
	return (r - Be([0, 50], [0, r])(t) * n) * n;
}
function Re(e) {
	return e.slice(0, -1).map((t, n) => e[n + 1] - t);
}
function ze(e, t) {
	if (t > 0) {
		let n = Re(e);
		return Math.min(...n) >= t;
	}
	return !0;
}
function Be(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 Ve(e) {
	return (String(e).split(".")[1] || "").length;
}
function He(e, t) {
	let n = 10 ** t;
	return Math.round(e * n) / n;
}
var Ue = ve, We = Te, Ge = De, Ke = ke, qe = ({ value: e, onChange: t, onCommit: n, min: r = 0, max: i = 1, step: a = .01, disabled: o, className: s }) => /* @__PURE__ */ E(Ue, {
	className: `relative flex w-full touch-none select-none items-center ${s ?? ""}`,
	value: [e],
	min: r,
	max: i,
	step: a,
	disabled: o,
	onValueChange: ([e]) => {
		e !== void 0 && t(e);
	},
	onValueCommit: n,
	children: [/* @__PURE__ */ T(We, {
		className: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-zinc-700/50",
		children: /* @__PURE__ */ T(Ge, { className: "absolute h-full bg-primary" })
	}), /* @__PURE__ */ T(Ke, { className: "block h-3.5 w-3.5 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })]
}), Je = ({ title: e, description: t, defaultOpen: r = !0, children: i }) => {
	let [a, o] = S(r);
	return /* @__PURE__ */ E("div", {
		className: "rounded-md border border-border bg-card/40",
		children: [/* @__PURE__ */ E("button", {
			type: "button",
			onClick: () => o((e) => !e),
			className: "flex w-full items-center gap-1.5 px-2 py-1.5 text-left",
			"aria-expanded": a,
			children: [/* @__PURE__ */ T(n, { className: `h-3.5 w-3.5 shrink-0 transition-transform ${a ? "rotate-90" : ""}` }), /* @__PURE__ */ T("span", {
				className: "text-xs font-semibold",
				children: e
			})]
		}), a && /* @__PURE__ */ E("div", {
			className: "px-2 pb-2 space-y-2",
			children: [t && /* @__PURE__ */ T("div", {
				className: "text-[10px] text-muted-foreground",
				children: t
			}), i]
		})]
	});
}, Ye = ({ label: e, help: t, error: n, orientation: r = "stacked", children: i }) => r === "row" ? /* @__PURE__ */ E("div", {
	className: "flex items-center justify-between gap-2",
	children: [/* @__PURE__ */ E("div", {
		className: "flex flex-col min-w-0",
		children: [/* @__PURE__ */ T("span", {
			className: "text-xs",
			children: e
		}), t && /* @__PURE__ */ T("span", {
			className: "text-[10px] text-muted-foreground",
			children: t
		})]
	}), /* @__PURE__ */ T("div", {
		className: "shrink-0",
		children: i
	})]
}) : /* @__PURE__ */ E("label", {
	className: "flex flex-col gap-1",
	children: [
		/* @__PURE__ */ T("span", {
			className: "text-xs",
			children: e
		}),
		t && /* @__PURE__ */ T("span", {
			className: "text-[10px] text-muted-foreground",
			children: t
		}),
		i,
		n && /* @__PURE__ */ T("span", {
			className: "text-[10px] text-destructive",
			children: n
		})
	]
}), Xe = ({ value: e, onChange: t, placeholder: n, disabled: r, name: i }) => /* @__PURE__ */ T("input", {
	type: "text",
	name: i,
	value: e,
	placeholder: n,
	disabled: r,
	onChange: (e) => t(e.target.value),
	className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:opacity-50"
}), Ze = ({ value: e, onChange: t, min: n, max: r, step: i, disabled: a, name: o }) => /* @__PURE__ */ T("input", {
	type: "number",
	name: o,
	value: Number.isFinite(e) ? e : 0,
	min: n,
	max: r,
	step: i,
	disabled: a,
	onChange: (e) => {
		let n = Number(e.target.value);
		Number.isFinite(n) && t(n);
	},
	className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:opacity-50"
}), Qe = ({ value: e, onChange: t, placeholder: n, rows: r = 6, disabled: i, name: a }) => /* @__PURE__ */ T("textarea", {
	name: a,
	value: e,
	rows: r,
	placeholder: n,
	disabled: i,
	onChange: (e) => t(e.target.value),
	className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-[10px] font-mono leading-tight focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:opacity-50 resize-y"
});
function $e({ value: e, options: t, onChange: n, disabled: r, name: i }) {
	return /* @__PURE__ */ T("select", {
		name: i,
		value: e,
		disabled: r,
		onChange: (e) => n(e.target.value),
		className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:opacity-50",
		children: t.map((e) => /* @__PURE__ */ T("option", {
			value: e.value,
			disabled: e.disabled,
			children: e.label
		}, e.value))
	});
}
var et = ({ value: e, onChange: t, min: n = 0, max: r = 1, step: i = .01, disabled: a }) => {
	let o = x(null);
	return /* @__PURE__ */ T("div", {
		className: "min-w-0",
		children: /* @__PURE__ */ T(qe, {
			value: e,
			onChange: m((e) => {
				o.current != null && cancelAnimationFrame(o.current), o.current = requestAnimationFrame(() => {
					o.current = null, t(e);
				});
			}, [t]),
			min: n,
			max: r,
			step: i,
			disabled: a,
			onCommit: m(([e]) => {
				o.current != null && (cancelAnimationFrame(o.current), o.current = null), e !== void 0 && t(e);
			}, [t])
		})
	});
}, tt = ({ checked: e, onChange: t, disabled: n }) => /* @__PURE__ */ T("input", {
	type: "checkbox",
	checked: e,
	disabled: n,
	onChange: (e) => t(e.target.checked),
	className: "h-3.5 w-3.5 accent-primary disabled:opacity-50"
}), nt = ({ value: e, onChange: t, topics: n, typeIncludes: r, topicTypeMatches: i, nameIncludes: a, placeholder: o, disabled: s, name: l }) => /* @__PURE__ */ E(w, { children: [l != null && l.length > 0 ? /* @__PURE__ */ T("input", {
	type: "hidden",
	name: l,
	value: e,
	readOnly: !0,
	"aria-hidden": !0
}) : null, /* @__PURE__ */ T(c, {
	value: e,
	onChange: t,
	topics: n,
	typeIncludes: r,
	topicTypeMatches: i,
	nameIncludes: a,
	placeholder: o,
	disabled: s,
	className: "w-full min-w-0"
})] }), rt = ({ value: e, onChange: t, placeholder: n = "https:// or package://", disabled: r, name: i }) => /* @__PURE__ */ T("input", {
	type: "url",
	name: i,
	value: e,
	placeholder: n,
	disabled: r,
	onChange: (e) => t(e.target.value),
	className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:opacity-50"
}), it = ({ accept: e, onRead: t, label: n = "Choose file…", disabled: r, name: i }) => {
	let a = _();
	return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("input", {
		id: a,
		type: "file",
		name: i ?? a,
		accept: e,
		disabled: r,
		className: "hidden",
		onChange: async (e) => {
			let n = e.target.files?.[0];
			if (e.target.value = "", n) try {
				t(await n.text(), n);
			} catch (e) {
				console.warn("[FileInput] Failed to read file", e);
			}
		}
	}), /* @__PURE__ */ T("button", {
		type: "button",
		onClick: () => document.getElementById(a)?.click(),
		disabled: r,
		className: "w-full border border-input rounded-sm bg-background px-2 py-1 text-xs hover:bg-accent disabled:opacity-50",
		children: n
	})] });
}, at = () => ({
	urdfSourceType: "file",
	urdfTopic: "",
	jointStateTopic: "",
	urdfFileName: "",
	urdfFileContent: "",
	meshStrategy: "localUpload",
	packageName: "",
	packageBaseUrl: "",
	framePrefix: "",
	rotateMeshVisuals: !1,
	visualRpyOffset: [
		0,
		0,
		0
	],
	fallbackMeshColor: "#94a3b8",
	showGrid: !0,
	showAxes: !0,
	manualJointPositions: {},
	followLiveJointState: !1,
	settingsPanelPercent: 35
});
//#endregion
//#region node_modules/react-resizable-panels/dist/react-resizable-panels.js
function ot(e, t) {
	let n = getComputedStyle(e);
	return t * parseFloat(n.fontSize);
}
function st(e, t) {
	let n = getComputedStyle(e.ownerDocument.body);
	return t * parseFloat(n.fontSize);
}
function ct(e) {
	return e / 100 * window.innerHeight;
}
function lt(e) {
	return e / 100 * window.innerWidth;
}
function ut(e) {
	switch (typeof e) {
		case "number": return [e, "px"];
		case "string": {
			let t = parseFloat(e);
			return e.endsWith("%") ? [t, "%"] : e.endsWith("px") ? [t, "px"] : e.endsWith("rem") ? [t, "rem"] : e.endsWith("em") ? [t, "em"] : e.endsWith("vh") ? [t, "vh"] : e.endsWith("vw") ? [t, "vw"] : [t, "%"];
		}
	}
}
function N({ groupSize: e, panelElement: t, styleProp: n }) {
	let r, [i, a] = ut(n);
	switch (a) {
		case "%":
			r = i / 100 * e;
			break;
		case "px":
			r = i;
			break;
		case "rem":
			r = st(t, i);
			break;
		case "em":
			r = ot(t, i);
			break;
		case "vh":
			r = ct(i);
			break;
		case "vw":
			r = lt(i);
			break;
	}
	return r;
}
function P(e) {
	return parseFloat(e.toFixed(3));
}
function F({ group: e }) {
	let { orientation: t, panels: n } = e;
	return n.reduce((e, n) => (e += t === "horizontal" ? n.element.offsetWidth : n.element.offsetHeight, e), 0);
}
function dt(e) {
	let { panels: t } = e, n = F({ group: e });
	return n === 0 ? t.map((e) => ({
		groupResizeBehavior: e.panelConstraints.groupResizeBehavior,
		collapsedSize: 0,
		collapsible: e.panelConstraints.collapsible === !0,
		defaultSize: void 0,
		disabled: e.panelConstraints.disabled,
		minSize: 0,
		maxSize: 100,
		panelId: e.id
	})) : t.map((e) => {
		let { element: t, panelConstraints: r } = e, i = 0;
		r.collapsedSize !== void 0 && (i = P(N({
			groupSize: n,
			panelElement: t,
			styleProp: r.collapsedSize
		}) / n * 100));
		let a;
		r.defaultSize !== void 0 && (a = P(N({
			groupSize: n,
			panelElement: t,
			styleProp: r.defaultSize
		}) / n * 100));
		let o = 0;
		r.minSize !== void 0 && (o = P(N({
			groupSize: n,
			panelElement: t,
			styleProp: r.minSize
		}) / n * 100));
		let s = 100;
		return r.maxSize !== void 0 && (s = P(N({
			groupSize: n,
			panelElement: t,
			styleProp: r.maxSize
		}) / n * 100)), {
			groupResizeBehavior: r.groupResizeBehavior,
			collapsedSize: i,
			collapsible: r.collapsible === !0,
			defaultSize: a,
			disabled: r.disabled,
			minSize: o,
			maxSize: s,
			panelId: e.id
		};
	});
}
function I(e, t = "Assertion error") {
	if (!e) throw Error(t);
}
function ft(e, t) {
	return Array.from(t).sort(e === "horizontal" ? pt : mt);
}
function pt(e, t) {
	let n = e.element.offsetLeft - t.element.offsetLeft;
	return n === 0 ? e.element.offsetWidth - t.element.offsetWidth : n;
}
function mt(e, t) {
	let n = e.element.offsetTop - t.element.offsetTop;
	return n === 0 ? e.element.offsetHeight - t.element.offsetHeight : n;
}
function ht(e) {
	return typeof e == "object" && !!e && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
}
function gt(e, t) {
	return {
		x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(Math.abs(e.x - t.left), Math.abs(e.x - t.right)),
		y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(Math.abs(e.y - t.top), Math.abs(e.y - t.bottom))
	};
}
function _t({ orientation: e, rects: t, targetRect: n }) {
	let r = {
		x: n.x + n.width / 2,
		y: n.y + n.height / 2
	}, i, a = Number.MAX_VALUE;
	for (let n of t) {
		let { x: t, y: o } = gt(r, n), s = e === "horizontal" ? t : o;
		s < a && (a = s, i = n);
	}
	return I(i, "No rect found"), i;
}
var vt;
function yt() {
	return vt === void 0 && (vt = typeof matchMedia == "function" ? !!matchMedia("(pointer:coarse)").matches : !1), vt;
}
function bt(e) {
	let { element: t, orientation: n, panels: r, separators: i } = e, a = ft(n, Array.from(t.children).filter(ht).map((e) => ({ element: e }))).map(({ element: e }) => e), o = [], s = !1, c = !1, l = -1, u = -1, d = 0, f, p = [];
	{
		let e = -1;
		for (let t of a) t.hasAttribute("data-panel") && (e++, t.hasAttribute("data-disabled") || (d++, l === -1 && (l = e), u = e));
	}
	if (d > 1) {
		let t = -1;
		for (let d of a) if (d.hasAttribute("data-panel")) {
			t++;
			let i = r.find((e) => e.element === d);
			if (i) {
				if (f) {
					let r = f.element.getBoundingClientRect(), a = d.getBoundingClientRect(), m;
					if (c) {
						let e = n === "horizontal" ? new DOMRect(r.right, r.top, 0, r.height) : new DOMRect(r.left, r.bottom, r.width, 0), t = n === "horizontal" ? new DOMRect(a.left, a.top, 0, a.height) : new DOMRect(a.left, a.top, a.width, 0);
						switch (p.length) {
							case 0:
								m = [e, t];
								break;
							case 1: {
								let i = p[0];
								m = [i, _t({
									orientation: n,
									rects: [r, a],
									targetRect: i.element.getBoundingClientRect()
								}) === r ? t : e];
								break;
							}
							default:
								m = p;
								break;
						}
					} else m = p.length ? p : [n === "horizontal" ? new DOMRect(r.right, a.top, a.left - r.right, a.height) : new DOMRect(a.left, r.bottom, a.width, a.top - r.bottom)];
					for (let n of m) {
						let r = "width" in n ? n : n.element.getBoundingClientRect(), a = yt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
						if (r.width < a) {
							let e = a - r.width;
							r = new DOMRect(r.x - e / 2, r.y, r.width + e, r.height);
						}
						if (r.height < a) {
							let e = a - r.height;
							r = new DOMRect(r.x, r.y - e / 2, r.width, r.height + e);
						}
						!s && !(t <= l || t > u) && o.push({
							group: e,
							groupSize: F({ group: e }),
							panels: [f, i],
							separator: "width" in n ? void 0 : n,
							rect: r
						}), s = !1;
					}
				}
				c = !1, f = i, p = [];
			}
		} else if (d.hasAttribute("data-separator")) {
			d.ariaDisabled !== null && (s = !0);
			let e = i.find((e) => e.element === d);
			e ? p.push(e) : (f = void 0, p = []);
		} else c = !0;
	}
	return o;
}
var xt = class {
	#e = {};
	addListener(e, t) {
		let n = this.#e[e];
		return n === void 0 ? this.#e[e] = [t] : n.includes(t) || n.push(t), () => {
			this.removeListener(e, t);
		};
	}
	emit(e, t) {
		let n = this.#e[e];
		if (n !== void 0) if (n.length === 1) n[0].call(null, t);
		else {
			let e = !1, r = null, i = Array.from(n);
			for (let n = 0; n < i.length; n++) {
				let a = i[n];
				try {
					a.call(null, t);
				} catch (t) {
					r === null && (e = !0, r = t);
				}
			}
			if (e) throw r;
		}
	}
	removeAllListeners() {
		this.#e = {};
	}
	removeListener(e, t) {
		let n = this.#e[e];
		if (n !== void 0) {
			let e = n.indexOf(t);
			e >= 0 && n.splice(e, 1);
		}
	}
}, L = /* @__PURE__ */ new Map(), St = new xt();
function Ct(e) {
	L = new Map(L), L.delete(e);
}
function wt(e, t) {
	for (let [t] of L) if (t.id === e) return t;
}
function R(e, t) {
	for (let [t, n] of L) if (t.id === e) return n;
	if (t) throw Error(`Could not find data for Group with id ${e}`);
}
function z() {
	return L;
}
function Tt(e, t) {
	return St.addListener("groupChange", (n) => {
		n.group.id === e && t(n);
	});
}
function B(e, t) {
	let n = L.get(e);
	L = new Map(L), L.set(e, t), St.emit("groupChange", {
		group: e,
		prev: n,
		next: t
	});
}
function Et(e, t, n) {
	let r, i = {
		x: Infinity,
		y: Infinity
	};
	for (let a of t) {
		let t = gt(n, a.rect);
		switch (e) {
			case "horizontal":
				t.x <= i.x && (r = a, i = t);
				break;
			case "vertical":
				t.y <= i.y && (r = a, i = t);
				break;
		}
	}
	return r ? {
		distance: i,
		hitRegion: r
	} : void 0;
}
function Dt(e) {
	return typeof e == "object" && !!e && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
}
function Ot(e, t) {
	if (e === t) throw Error("Cannot compare node with itself");
	let n = {
		a: Pt(e),
		b: Pt(t)
	}, r;
	for (; n.a.at(-1) === n.b.at(-1);) r = n.a.pop(), n.b.pop();
	I(r, "Stacking order can only be calculated for elements with a common ancestor");
	let i = {
		a: Nt(Mt(n.a)),
		b: Nt(Mt(n.b))
	};
	if (i.a === i.b) {
		let e = r.childNodes, t = {
			a: n.a.at(-1),
			b: n.b.at(-1)
		}, i = e.length;
		for (; i--;) {
			let n = e[i];
			if (n === t.a) return 1;
			if (n === t.b) return -1;
		}
	}
	return Math.sign(i.a - i.b);
}
var kt = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
function At(e) {
	let t = getComputedStyle(Ft(e) ?? e).display;
	return t === "flex" || t === "inline-flex";
}
function jt(e) {
	let t = getComputedStyle(e);
	return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || At(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || kt.test(t.willChange) || t.webkitOverflowScrolling === "touch");
}
function Mt(e) {
	let t = e.length;
	for (; t--;) {
		let n = e[t];
		if (I(n, "Missing node"), jt(n)) return n;
	}
	return null;
}
function Nt(e) {
	return e && Number(getComputedStyle(e).zIndex) || 0;
}
function Pt(e) {
	let t = [];
	for (; e;) t.push(e), e = Ft(e);
	return t;
}
function Ft(e) {
	let { parentNode: t } = e;
	return Dt(t) ? t.host : t;
}
function It(e, t) {
	return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
}
function Lt({ groupElement: e, hitRegion: t, pointerEventTarget: n }) {
	if (!ht(n) || n.contains(e) || e.contains(n)) return !0;
	if (Ot(n, e) > 0) {
		let r = n;
		for (; r;) {
			if (r.contains(e)) return !0;
			if (It(r.getBoundingClientRect(), t)) return !1;
			r = r.parentElement;
		}
	}
	return !0;
}
function Rt(e, t) {
	let n = [];
	return t.forEach((t, r) => {
		if (r.disabled) return;
		let i = bt(r), a = Et(r.orientation, i, {
			x: e.clientX,
			y: e.clientY
		});
		a && a.distance.x <= 0 && a.distance.y <= 0 && Lt({
			groupElement: r.element,
			hitRegion: a.hitRegion.rect,
			pointerEventTarget: e.target
		}) && n.push(a.hitRegion);
	}), n;
}
function zt(e, t) {
	if (e.length !== t.length) return !1;
	for (let n = 0; n < e.length; n++) if (e[n] != t[n]) return !1;
	return !0;
}
function V(e, t, n = 0) {
	return Math.abs(P(e) - P(t)) <= n;
}
function H(e, t) {
	return V(e, t) ? 0 : e > t ? 1 : -1;
}
function U({ overrideDisabledPanels: e, panelConstraints: t, prevSize: n, size: r }) {
	let { collapsedSize: i = 0, collapsible: a, disabled: o, maxSize: s = 100, minSize: c = 0 } = t;
	if (o && !e) return n;
	if (H(r, c) < 0) if (a) {
		let e = (i + c) / 2;
		r = H(r, e) < 0 ? i : c;
	} else r = c;
	return r = Math.min(s, r), r = P(r), r;
}
function W({ delta: e, initialLayout: t, panelConstraints: n, pivotIndices: r, prevLayout: i, trigger: a }) {
	if (V(e, 0)) return t;
	let o = a === "imperative-api", s = Object.values(t), c = Object.values(i), l = [...s], [u, d] = r;
	I(u != null, "Invalid first pivot index"), I(d != null, "Invalid second pivot index");
	let f = 0;
	switch (a) {
		case "keyboard":
			{
				let t = e < 0 ? d : u, r = n[t];
				I(r, `Panel constraints not found for index ${t}`);
				let { collapsedSize: i = 0, collapsible: a, minSize: o = 0 } = r;
				if (a) {
					let n = s[t];
					if (I(n != null, `Previous layout not found for panel index ${t}`), V(n, i)) {
						let t = o - n;
						H(t, Math.abs(e)) > 0 && (e = e < 0 ? 0 - t : t);
					}
				}
			}
			{
				let t = e < 0 ? u : d, r = n[t];
				I(r, `No panel constraints found for index ${t}`);
				let { collapsedSize: i = 0, collapsible: a, minSize: o = 0 } = r;
				if (a) {
					let n = s[t];
					if (I(n != null, `Previous layout not found for panel index ${t}`), V(n, o)) {
						let t = n - i;
						H(t, Math.abs(e)) > 0 && (e = e < 0 ? 0 - t : t);
					}
				}
			}
			break;
		default: {
			let t = e < 0 ? d : u, r = n[t];
			I(r, `Panel constraints not found for index ${t}`);
			let i = s[t], { collapsible: a, collapsedSize: o, minSize: c } = r;
			if (a && H(i, c) < 0) if (e > 0) {
				let t = c - o, n = t / 2;
				H(i + e, c) < 0 && (e = H(e, n) <= 0 ? 0 : t);
			} else {
				let t = c - o, n = 100 - t / 2;
				H(i - e, c) < 0 && (e = H(100 + e, n) > 0 ? 0 : -t);
			}
			break;
		}
	}
	{
		let t = e < 0 ? 1 : -1, r = e < 0 ? d : u, i = 0;
		for (;;) {
			let e = s[r];
			I(e != null, `Previous layout not found for panel index ${r}`);
			let a = U({
				overrideDisabledPanels: o,
				panelConstraints: n[r],
				prevSize: e,
				size: 100
			}) - e;
			if (i += a, r += t, r < 0 || r >= n.length) break;
		}
		let a = Math.min(Math.abs(e), Math.abs(i));
		e = e < 0 ? 0 - a : a;
	}
	{
		let t = e < 0 ? u : d;
		for (; t >= 0 && t < n.length;) {
			let r = Math.abs(e) - Math.abs(f), i = s[t];
			I(i != null, `Previous layout not found for panel index ${t}`);
			let a = i - r, c = U({
				overrideDisabledPanels: o,
				panelConstraints: n[t],
				prevSize: i,
				size: a
			});
			if (!V(i, c) && (f += i - c, l[t] = c, f.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, { numeric: !0 }) >= 0)) break;
			e < 0 ? t-- : t++;
		}
	}
	if (zt(c, l)) return i;
	{
		let t = e < 0 ? d : u, r = s[t];
		I(r != null, `Previous layout not found for panel index ${t}`);
		let i = r + f, a = U({
			overrideDisabledPanels: o,
			panelConstraints: n[t],
			prevSize: r,
			size: i
		});
		if (l[t] = a, !V(a, i)) {
			let t = i - a, r = e < 0 ? d : u;
			for (; r >= 0 && r < n.length;) {
				let i = l[r];
				I(i != null, `Previous layout not found for panel index ${r}`);
				let a = i + t, s = U({
					overrideDisabledPanels: o,
					panelConstraints: n[r],
					prevSize: i,
					size: a
				});
				if (V(i, s) || (t -= s - i, l[r] = s), V(t, 0)) break;
				e > 0 ? r-- : r++;
			}
		}
	}
	if (!V(Object.values(l).reduce((e, t) => t + e, 0), 100, .1)) return i;
	let p = Object.keys(i);
	return l.reduce((e, t, n) => (e[p[n]] = t, e), {});
}
function G(e, t) {
	if (Object.keys(e).length !== Object.keys(t).length) return !1;
	for (let n in e) if (t[n] === void 0 || H(e[n], t[n]) !== 0) return !1;
	return !0;
}
function K({ layout: e, panelConstraints: t }) {
	let n = Object.values(e), r = [...n], i = r.reduce((e, t) => e + t, 0);
	if (r.length !== t.length) throw Error(`Invalid ${t.length} panel layout: ${r.map((e) => `${e}%`).join(", ")}`);
	if (!V(i, 100) && r.length > 0) for (let e = 0; e < t.length; e++) {
		let t = r[e];
		I(t != null, `No layout data found for index ${e}`), r[e] = 100 / i * t;
	}
	let a = 0;
	for (let e = 0; e < t.length; e++) {
		let i = n[e];
		I(i != null, `No layout data found for index ${e}`);
		let o = r[e];
		I(o != null, `No layout data found for index ${e}`);
		let s = U({
			overrideDisabledPanels: !0,
			panelConstraints: t[e],
			prevSize: i,
			size: o
		});
		o != s && (a += o - s, r[e] = s);
	}
	if (!V(a, 0)) for (let e = 0; e < t.length; e++) {
		let n = r[e];
		I(n != null, `No layout data found for index ${e}`);
		let i = n + a, o = U({
			overrideDisabledPanels: !0,
			panelConstraints: t[e],
			prevSize: n,
			size: i
		});
		if (n !== o && (a -= o - n, r[e] = o, V(a, 0))) break;
	}
	let o = Object.keys(e);
	return r.reduce((e, t, n) => (e[o[n]] = t, e), {});
}
function Bt({ groupId: e, panelId: t }) {
	let n = () => {
		let t = z();
		for (let [n, { defaultLayoutDeferred: r, derivedPanelConstraints: i, layout: a, groupSize: o, separatorToPanels: s }] of t) if (n.id === e) return {
			defaultLayoutDeferred: r,
			derivedPanelConstraints: i,
			group: n,
			groupSize: o,
			layout: a,
			separatorToPanels: s
		};
		throw Error(`Group ${e} not found`);
	}, r = () => {
		let e = n().derivedPanelConstraints.find((e) => e.panelId === t);
		if (e !== void 0) return e;
		throw Error(`Panel constraints not found for Panel ${t}`);
	}, i = () => {
		let e = n().group.panels.find((e) => e.id === t);
		if (e !== void 0) return e;
		throw Error(`Layout not found for Panel ${t}`);
	}, a = () => {
		let e = n().layout[t];
		if (e !== void 0) return e;
		throw Error(`Layout not found for Panel ${t}`);
	}, o = ({ nextSize: e, panels: n, prevLayout: r, derivedPanelConstraints: i }) => {
		let o = a(), s = n.findIndex((e) => e.id === t), c = s === 0, l = s === n.length - 1;
		if (l && e < o && (c || n.slice(0, s).every((e, t) => {
			let n = i[t];
			return n?.collapsible && V(n.collapsedSize, r[n.panelId]);
		}))) {
			let e = n.slice(0, s).reduce((e, t) => e + r[t.id], 0);
			return {
				...r,
				[t]: P(100 - e)
			};
		}
		return W({
			delta: l ? o - e : e - o,
			initialLayout: r,
			panelConstraints: i,
			pivotIndices: l ? [s - 1, s] : [s, s + 1],
			prevLayout: r,
			trigger: "imperative-api"
		});
	}, s = (e) => {
		if (e === a()) return;
		let { defaultLayoutDeferred: t, derivedPanelConstraints: r, group: i, groupSize: s, layout: c, separatorToPanels: l } = n(), u = K({
			layout: o({
				nextSize: e,
				panels: i.panels,
				prevLayout: c,
				derivedPanelConstraints: r
			}),
			panelConstraints: r
		});
		G(c, u) || B(i, {
			defaultLayoutDeferred: t,
			derivedPanelConstraints: r,
			groupSize: s,
			layout: u,
			separatorToPanels: l
		});
	};
	return {
		collapse: () => {
			let { collapsible: e, collapsedSize: t } = r(), { mutableValues: n } = i(), o = a();
			e && o !== t && (n.expandToSize = o, s(t));
		},
		expand: () => {
			let { collapsible: e, collapsedSize: t, minSize: n } = r(), { mutableValues: o } = i(), c = a();
			if (e && c === t) {
				let e = o.expandToSize ?? n;
				e === 0 && (e = 1), s(e);
			}
		},
		getSize: () => {
			let { group: e } = n(), t = a(), { element: r } = i();
			return {
				asPercentage: t,
				inPixels: e.orientation === "horizontal" ? r.offsetWidth : r.offsetHeight
			};
		},
		isCollapsed: () => {
			let { collapsible: e, collapsedSize: t } = r(), n = a();
			return e && V(t, n);
		},
		resize: (e) => {
			let { group: t } = n(), { element: r } = i(), a = F({ group: t });
			s(P(N({
				groupSize: a,
				panelElement: r,
				styleProp: e
			}) / a * 100));
		}
	};
}
function Vt(e) {
	e.defaultPrevented || Rt(e, z()).forEach((t) => {
		if (t.separator && !t.separator.disableDoubleClick) {
			let n = t.panels.find((e) => e.panelConstraints.defaultSize !== void 0);
			if (n) {
				let r = n.panelConstraints.defaultSize, i = Bt({
					groupId: t.group.id,
					panelId: n.id
				});
				i && r !== void 0 && (i.resize(r), e.preventDefault());
			}
		}
	});
}
function Ht(e) {
	let t = z();
	for (let [n] of t) if (n.separators.some((t) => t.element === e)) return n;
	throw Error("Could not find parent Group for separator element");
}
function Ut({ groupId: e }) {
	let t = () => {
		let t = z();
		for (let [n, r] of t) if (n.id === e) return {
			group: n,
			...r
		};
		throw Error(`Could not find Group with id "${e}"`);
	};
	return {
		getLayout() {
			let { defaultLayoutDeferred: e, layout: n } = t();
			return e ? {} : n;
		},
		setLayout(e) {
			let { defaultLayoutDeferred: n, derivedPanelConstraints: r, group: i, groupSize: a, layout: o, separatorToPanels: s } = t(), c = K({
				layout: e,
				panelConstraints: r
			});
			return n ? o : (G(o, c) || B(i, {
				defaultLayoutDeferred: n,
				derivedPanelConstraints: r,
				groupSize: a,
				layout: c,
				separatorToPanels: s
			}), c);
		}
	};
}
function q(e, t) {
	let n = Ht(e), r = R(n.id, !0), i = n.separators.find((t) => t.element === e);
	I(i, "Matching separator not found");
	let a = r.separatorToPanels.get(i);
	I(a, "Matching panels not found");
	let o = a.map((e) => n.panels.indexOf(e)), s = Ut({ groupId: n.id }).getLayout(), c = K({
		layout: W({
			delta: t,
			initialLayout: s,
			panelConstraints: r.derivedPanelConstraints,
			pivotIndices: o,
			prevLayout: s,
			trigger: "keyboard"
		}),
		panelConstraints: r.derivedPanelConstraints
	});
	G(s, c) || B(n, {
		defaultLayoutDeferred: r.defaultLayoutDeferred,
		derivedPanelConstraints: r.derivedPanelConstraints,
		groupSize: r.groupSize,
		layout: c,
		separatorToPanels: r.separatorToPanels
	});
}
function Wt(e) {
	if (e.defaultPrevented) return;
	let t = e.currentTarget, n = Ht(t);
	if (!n.disabled) switch (e.key) {
		case "ArrowDown":
			e.preventDefault(), n.orientation === "vertical" && q(t, 5);
			break;
		case "ArrowLeft":
			e.preventDefault(), n.orientation === "horizontal" && q(t, -5);
			break;
		case "ArrowRight":
			e.preventDefault(), n.orientation === "horizontal" && q(t, 5);
			break;
		case "ArrowUp":
			e.preventDefault(), n.orientation === "vertical" && q(t, -5);
			break;
		case "End":
			e.preventDefault(), q(t, 100);
			break;
		case "Enter": {
			e.preventDefault();
			let n = Ht(t), { derivedPanelConstraints: r, layout: i, separatorToPanels: a } = R(n.id, !0), o = n.separators.find((e) => e.element === t);
			I(o, "Matching separator not found");
			let s = a.get(o);
			I(s, "Matching panels not found");
			let c = s[0], l = r.find((e) => e.panelId === c.id);
			if (I(l, "Panel metadata not found"), l.collapsible) {
				let e = i[c.id];
				q(t, (l.collapsedSize === e ? n.mutableState.expandedPanelSizes[c.id] ?? l.minSize : l.collapsedSize) - e);
			}
			break;
		}
		case "F6": {
			e.preventDefault();
			let n = Ht(t).separators.map((e) => e.element), r = Array.from(n).findIndex((t) => t === e.currentTarget);
			I(r !== null, "Index not found"), n[e.shiftKey ? r > 0 ? r - 1 : n.length - 1 : r + 1 < n.length ? r + 1 : 0].focus({ preventScroll: !0 });
			break;
		}
		case "Home":
			e.preventDefault(), q(t, -100);
			break;
	}
}
var J = {
	cursorFlags: 0,
	state: "inactive"
}, Gt = new xt();
function Y() {
	return J;
}
function Kt(e) {
	return Gt.addListener("change", e);
}
function qt(e) {
	let t = J, n = { ...J };
	n.cursorFlags = e, J = n, Gt.emit("change", {
		prev: t,
		next: n
	});
}
function X(e) {
	let t = J;
	J = e, Gt.emit("change", {
		prev: t,
		next: e
	});
}
function Jt(e) {
	if (e.defaultPrevented || e.pointerType === "mouse" && e.button > 0) return;
	let t = z(), n = Rt(e, t), r = /* @__PURE__ */ new Map(), i = !1;
	n.forEach((e) => {
		e.separator && (i || (i = !0, e.separator.element.focus({
			focusVisible: !1,
			preventScroll: !0
		})));
		let n = t.get(e.group);
		n && r.set(e.group, n.layout);
	}), X({
		cursorFlags: 0,
		hitRegions: n,
		initialLayoutMap: r,
		pointerDownAtPoint: {
			x: e.clientX,
			y: e.clientY
		},
		state: "active"
	}), n.length && e.preventDefault();
}
var Yt = (e) => e, Xt = () => {}, Zt = 1, Qt = 2, $t = 4, en = 8, tn = 3, nn = 12, rn;
function an() {
	return rn === void 0 && (rn = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (rn = !0)), rn;
}
function on({ cursorFlags: e, groups: t, state: n }) {
	let r = 0, i = 0;
	switch (n) {
		case "active":
		case "hover": t.forEach((e) => {
			if (!e.mutableState.disableCursor) switch (e.orientation) {
				case "horizontal":
					r++;
					break;
				case "vertical":
					i++;
					break;
			}
		});
	}
	if (!(r === 0 && i === 0)) {
		switch (n) {
			case "active":
				if (e && an()) {
					let t = (e & Zt) !== 0, n = (e & Qt) !== 0, r = (e & $t) !== 0, i = (e & en) !== 0;
					if (t) return r ? "se-resize" : i ? "ne-resize" : "e-resize";
					if (n) return r ? "sw-resize" : i ? "nw-resize" : "w-resize";
					if (r) return "s-resize";
					if (i) return "n-resize";
				}
				break;
		}
		return an() ? r > 0 && i > 0 ? "move" : r > 0 ? "ew-resize" : "ns-resize" : r > 0 && i > 0 ? "grab" : r > 0 ? "col-resize" : "row-resize";
	}
}
var sn = /* @__PURE__ */ new WeakMap();
function cn(e) {
	if (e.defaultView === null || e.defaultView === void 0) return;
	let { prevStyle: t, styleSheet: n } = sn.get(e) ?? {};
	n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && (Object.isExtensible(e.adoptedStyleSheets) ? e.adoptedStyleSheets.push(n) : e.adoptedStyleSheets = [...e.adoptedStyleSheets, n]));
	let r = Y();
	switch (r.state) {
		case "active":
		case "hover": {
			let e = on({
				cursorFlags: r.cursorFlags,
				groups: r.hitRegions.map((e) => e.group),
				state: r.state
			}), i = `*, *:hover {cursor: ${e} !important; }`;
			if (t === i) return;
			t = i, e ? n.cssRules.length === 0 ? n.insertRule(i) : n.replaceSync(i) : n.cssRules.length === 1 && n.deleteRule(0);
			break;
		}
		case "inactive":
			t = void 0, n.cssRules.length === 1 && n.deleteRule(0);
			break;
	}
	sn.set(e, {
		prevStyle: t,
		styleSheet: n
	});
}
function ln({ document: e, event: t, hitRegions: n, initialLayoutMap: r, mountedGroups: i, pointerDownAtPoint: a, prevCursorFlags: o }) {
	let s = 0;
	n.forEach((e) => {
		let { group: n, groupSize: o } = e, { orientation: c, panels: l } = n, { disableCursor: u } = n.mutableState, d = 0;
		d = a ? c === "horizontal" ? (t.clientX - a.x) / o * 100 : (t.clientY - a.y) / o * 100 : c === "horizontal" ? t.clientX < 0 ? -100 : 100 : t.clientY < 0 ? -100 : 100;
		let f = r.get(n), p = i.get(n);
		if (!f || !p) return;
		let { defaultLayoutDeferred: m, derivedPanelConstraints: h, groupSize: g, layout: _, separatorToPanels: v } = p;
		if (h && _ && v) {
			let t = W({
				delta: d,
				initialLayout: f,
				panelConstraints: h,
				pivotIndices: e.panels.map((e) => l.indexOf(e)),
				prevLayout: _,
				trigger: "mouse-or-touch"
			});
			if (G(t, _)) {
				if (d !== 0 && !u) switch (c) {
					case "horizontal":
						s |= d < 0 ? Zt : Qt;
						break;
					case "vertical":
						s |= d < 0 ? $t : en;
						break;
				}
			} else B(e.group, {
				defaultLayoutDeferred: m,
				derivedPanelConstraints: h,
				groupSize: g,
				layout: t,
				separatorToPanels: v
			});
		}
	});
	let c = 0;
	t.movementX === 0 ? c |= o & tn : c |= s & tn, t.movementY === 0 ? c |= o & nn : c |= s & nn, qt(c), cn(e);
}
function un(e) {
	let t = z(), n = Y();
	switch (n.state) {
		case "active": ln({
			document: e.currentTarget,
			event: e,
			hitRegions: n.hitRegions,
			initialLayoutMap: n.initialLayoutMap,
			mountedGroups: t,
			prevCursorFlags: n.cursorFlags
		});
	}
}
function dn(e) {
	if (e.defaultPrevented) return;
	let t = Y(), n = z();
	switch (t.state) {
		case "active":
			if (e.buttons === 0) {
				X({
					cursorFlags: 0,
					state: "inactive"
				}), t.hitRegions.forEach((e) => {
					let t = R(e.group.id, !0);
					B(e.group, t);
				});
				return;
			}
			for (let n of t.hitRegions) if (n.separator) {
				let { element: t } = n.separator;
				t.hasPointerCapture?.(e.pointerId) || t.setPointerCapture?.(e.pointerId);
			}
			ln({
				document: e.currentTarget,
				event: e,
				hitRegions: t.hitRegions,
				initialLayoutMap: t.initialLayoutMap,
				mountedGroups: n,
				pointerDownAtPoint: t.pointerDownAtPoint,
				prevCursorFlags: t.cursorFlags
			});
			break;
		default: {
			let r = Rt(e, n);
			r.length === 0 ? t.state !== "inactive" && X({
				cursorFlags: 0,
				state: "inactive"
			}) : X({
				cursorFlags: 0,
				hitRegions: r,
				state: "hover"
			}), cn(e.currentTarget);
			break;
		}
	}
}
function fn(e) {
	if (e.relatedTarget instanceof HTMLIFrameElement) switch (Y().state) {
		case "hover": X({
			cursorFlags: 0,
			state: "inactive"
		});
	}
}
function pn(e) {
	if (e.defaultPrevented || e.pointerType === "mouse" && e.button > 0) return;
	let t = Y();
	switch (t.state) {
		case "active": X({
			cursorFlags: 0,
			state: "inactive"
		}), t.hitRegions.length > 0 && (cn(e.currentTarget), t.hitRegions.forEach((e) => {
			let t = R(e.group.id, !0);
			B(e.group, t);
		}), e.preventDefault());
	}
}
function mn(e) {
	let t = 0, n = 0, r = {};
	for (let i of e) if (i.defaultSize !== void 0) {
		t++;
		let e = P(i.defaultSize);
		n += e, r[i.panelId] = e;
	} else r[i.panelId] = void 0;
	let i = e.length - t;
	if (i !== 0) {
		let t = P((100 - n) / i);
		for (let n of e) n.defaultSize === void 0 && (r[n.panelId] = t);
	}
	return r;
}
function hn(e, t, n) {
	if (!n[0]) return;
	let r = e.panels.find((e) => e.element === t);
	if (!r || !r.onResize) return;
	let i = F({ group: e }), a = e.orientation === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o = r.mutableValues.prevSize, s = {
		asPercentage: P(a / i * 100),
		inPixels: a
	};
	r.mutableValues.prevSize = s, r.onResize(s, r.id, o);
}
function gn(e, t) {
	if (Object.keys(e).length !== Object.keys(t).length) return !1;
	for (let n in e) if (e[n] !== t[n]) return !1;
	return !0;
}
function _n({ group: e, nextGroupSize: t, prevGroupSize: n, prevLayout: r }) {
	if (n <= 0 || t <= 0 || n === t) return r;
	let i = 0, a = 0, o = !1, s = /* @__PURE__ */ new Map(), c = [];
	for (let l of e.panels) {
		let e = r[l.id] ?? 0;
		switch (l.panelConstraints.groupResizeBehavior) {
			case "preserve-pixel-size": {
				o = !0;
				let r = P(e / 100 * n / t * 100);
				s.set(l.id, r), i += r;
				break;
			}
			default:
				c.push(l.id), a += e;
				break;
		}
	}
	if (!o || c.length === 0) return r;
	let l = 100 - i, u = { ...r };
	if (s.forEach((e, t) => {
		u[t] = e;
	}), a > 0) for (let e of c) u[e] = P((r[e] ?? 0) / a * l);
	else {
		let e = P(l / c.length);
		for (let t of c) u[t] = e;
	}
	return u;
}
function vn(e, t) {
	let n = e.map((e) => e.id), r = Object.keys(t);
	if (n.length !== r.length) return !1;
	for (let e of n) if (!r.includes(e)) return !1;
	return !0;
}
var Z = /* @__PURE__ */ new Map();
function yn(e) {
	let t = !0;
	I(e.element.ownerDocument.defaultView, "Cannot register an unmounted Group");
	let n = e.element.ownerDocument.defaultView.ResizeObserver, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = new n((n) => {
		for (let r of n) {
			let { borderBoxSize: n, target: i } = r;
			if (i === e.element) {
				if (t) {
					let t = F({ group: e });
					if (t === 0) return;
					let n = R(e.id);
					if (!n) return;
					let r = dt(e), i = n.defaultLayoutDeferred ? mn(r) : n.layout, a = K({
						layout: _n({
							group: e,
							nextGroupSize: t,
							prevGroupSize: n.groupSize,
							prevLayout: i
						}),
						panelConstraints: r
					});
					if (!n.defaultLayoutDeferred && G(n.layout, a) && gn(n.derivedPanelConstraints, r) && n.groupSize === t) return;
					B(e, {
						defaultLayoutDeferred: !1,
						derivedPanelConstraints: r,
						groupSize: t,
						layout: a,
						separatorToPanels: n.separatorToPanels
					});
				}
			} else hn(e, i, n);
		}
	});
	a.observe(e.element), e.panels.forEach((e) => {
		I(!r.has(e.id), `Panel ids must be unique; id "${e.id}" was used more than once`), r.add(e.id), e.onResize && a.observe(e.element);
	});
	let o = F({ group: e }), s = dt(e), c = e.panels.map(({ id: e }) => e).join(","), l = e.mutableState.defaultLayout;
	l && (vn(e.panels, l) || (l = void 0));
	let u = K({
		layout: e.mutableState.layouts[c] ?? l ?? mn(s),
		panelConstraints: s
	}), d = e.element.ownerDocument;
	Z.set(d, (Z.get(d) ?? 0) + 1);
	let f = /* @__PURE__ */ new Map();
	return bt(e).forEach((e) => {
		e.separator && f.set(e.separator, e.panels);
	}), B(e, {
		defaultLayoutDeferred: o === 0,
		derivedPanelConstraints: s,
		groupSize: o,
		layout: u,
		separatorToPanels: f
	}), e.separators.forEach((e) => {
		I(!i.has(e.id), `Separator ids must be unique; id "${e.id}" was used more than once`), i.add(e.id), e.element.addEventListener("keydown", Wt);
	}), Z.get(d) === 1 && (d.addEventListener("dblclick", Vt, !0), d.addEventListener("pointerdown", Jt, !0), d.addEventListener("pointerleave", un), d.addEventListener("pointermove", dn), d.addEventListener("pointerout", fn), d.addEventListener("pointerup", pn, !0)), function() {
		t = !1, Z.set(d, Math.max(0, (Z.get(d) ?? 0) - 1)), Ct(e), e.separators.forEach((e) => {
			e.element.removeEventListener("keydown", Wt);
		}), Z.get(d) || (d.removeEventListener("dblclick", Vt, !0), d.removeEventListener("pointerdown", Jt, !0), d.removeEventListener("pointerleave", un), d.removeEventListener("pointermove", dn), d.removeEventListener("pointerout", fn), d.removeEventListener("pointerup", pn, !0)), a.disconnect();
	};
}
function bn() {
	let [e, t] = S({});
	return [e, m(() => t({}), [])];
}
function xn(e) {
	let t = _();
	return `${e ?? t}`;
}
var Q = typeof window < "u" ? y : g;
function $(e) {
	let t = x(e);
	return Q(() => {
		t.current = e;
	}, [e]), m((...e) => t.current?.(...e), [t]);
}
function Sn(...e) {
	return $((t) => {
		e.forEach((e) => {
			if (e) switch (typeof e) {
				case "function":
					e(t);
					break;
				case "object":
					e.current = t;
					break;
			}
		});
	});
}
function Cn(e) {
	let t = x({ ...e });
	return Q(() => {
		for (let n in e) t.current[n] = e[n];
	}, [e]), t.current;
}
var wn = p(null);
function Tn(e, t) {
	let n = x({
		getLayout: () => ({}),
		setLayout: Yt
	});
	v(t, () => n.current, []), Q(() => {
		Object.assign(n.current, Ut({ groupId: e }));
	});
}
function En({ children: e, className: t, defaultLayout: n, disableCursor: r, disabled: i, elementRef: a, groupRef: o, id: s, onLayoutChange: c, onLayoutChanged: l, orientation: u = "horizontal", resizeTargetMinimumSize: d = {
	coarse: 20,
	fine: 10
}, style: f, ...p }) {
	let m = x({
		onLayoutChange: {},
		onLayoutChanged: {}
	}), h = $((e) => {
		G(m.current.onLayoutChange, e) || (m.current.onLayoutChange = e, c?.(e));
	}), _ = $((e) => {
		G(m.current.onLayoutChanged, e) || (m.current.onLayoutChanged = e, l?.(e));
	}), v = xn(s), y = x(null), [S, C] = bn(), w = x({
		lastExpandedPanelSizes: {},
		layouts: {},
		panels: [],
		resizeTargetMinimumSize: d,
		separators: []
	}), E = Sn(y, a);
	Tn(v, o);
	let D = $((e, t) => {
		let r = Y(), i = wt(e), a = R(e);
		if (a) {
			let e = !1;
			switch (r.state) {
				case "active":
					e = r.hitRegions.some((e) => e.group === i);
					break;
			}
			return {
				flexGrow: a.layout[t] ?? 1,
				pointerEvents: e ? "none" : void 0
			};
		}
		if (n?.[t]) return { flexGrow: n?.[t] };
	}), O = Cn({
		defaultLayout: n,
		disableCursor: r
	}), k = b(() => ({
		get disableCursor() {
			return !!O.disableCursor;
		},
		getPanelStyles: D,
		id: v,
		orientation: u,
		registerPanel: (e) => {
			let t = w.current;
			return t.panels = ft(u, [...t.panels, e]), C(), () => {
				t.panels = t.panels.filter((t) => t !== e), C();
			};
		},
		registerSeparator: (e) => {
			let t = w.current;
			return t.separators = ft(u, [...t.separators, e]), C(), () => {
				t.separators = t.separators.filter((t) => t !== e), C();
			};
		},
		updatePanelProps: (e, { disabled: t }) => {
			let n = w.current.panels.find((t) => t.id === e);
			n && (n.panelConstraints.disabled = t);
			let r = wt(v), i = R(v);
			r && i && B(r, {
				...i,
				derivedPanelConstraints: dt(r)
			});
		},
		updateSeparatorProps: (e, { disabled: t, disableDoubleClick: n }) => {
			let r = w.current.separators.find((t) => t.id === e);
			r && (r.disabled = t, r.disableDoubleClick = n);
		}
	}), [
		D,
		v,
		C,
		u,
		O
	]), A = x(null);
	return Q(() => {
		let e = y.current;
		if (e === null) return;
		let t = w.current, n;
		if (O.defaultLayout !== void 0 && Object.keys(O.defaultLayout).length === t.panels.length) {
			n = {};
			for (let e of t.panels) {
				let t = O.defaultLayout[e.id];
				t !== void 0 && (n[e.id] = t);
			}
		}
		let r = {
			disabled: !!i,
			element: e,
			id: v,
			mutableState: {
				defaultLayout: n,
				disableCursor: !!O.disableCursor,
				expandedPanelSizes: w.current.lastExpandedPanelSizes,
				layouts: w.current.layouts
			},
			orientation: u,
			panels: t.panels,
			resizeTargetMinimumSize: t.resizeTargetMinimumSize,
			separators: t.separators
		};
		A.current = r;
		let a = yn(r), { defaultLayoutDeferred: o, derivedPanelConstraints: s, layout: c } = R(r.id, !0);
		!o && s.length > 0 && (h(c), _(c));
		let l = Tt(v, (e) => {
			let { defaultLayoutDeferred: t, derivedPanelConstraints: n, layout: i } = e.next;
			if (t || n.length === 0) return;
			let a = r.panels.map(({ id: e }) => e).join(",");
			r.mutableState.layouts[a] = i, n.forEach((t) => {
				if (t.collapsible) {
					let { layout: n } = e.prev ?? {};
					if (n) {
						let e = V(t.collapsedSize, i[t.panelId]), a = V(t.collapsedSize, n[t.panelId]);
						e && !a && (r.mutableState.expandedPanelSizes[t.panelId] = n[t.panelId]);
					}
				}
			});
			let o = Y().state !== "active";
			h(i), o && _(i);
		});
		return () => {
			A.current = null, a(), l();
		};
	}, [
		i,
		v,
		_,
		h,
		u,
		S,
		O
	]), g(() => {
		let e = A.current;
		e && (e.mutableState.defaultLayout = n, e.mutableState.disableCursor = !!r);
	}), /* @__PURE__ */ T(wn.Provider, {
		value: k,
		children: /* @__PURE__ */ T("div", {
			...p,
			className: t,
			"data-group": !0,
			"data-testid": v,
			id: v,
			ref: E,
			style: {
				height: "100%",
				width: "100%",
				overflow: "hidden",
				...f,
				display: "flex",
				flexDirection: u === "horizontal" ? "row" : "column",
				flexWrap: "nowrap",
				touchAction: u === "horizontal" ? "pan-y" : "pan-x"
			},
			children: e
		})
	});
}
En.displayName = "Group";
function Dn() {
	let e = h(wn);
	return I(e, "Group Context not found; did you render a Panel or Separator outside of a Group?"), e;
}
function On(e, t) {
	let { id: n } = Dn(), r = x({
		collapse: Xt,
		expand: Xt,
		getSize: () => ({
			asPercentage: 0,
			inPixels: 0
		}),
		isCollapsed: () => !1,
		resize: Xt
	});
	v(t, () => r.current, []), Q(() => {
		Object.assign(r.current, Bt({
			groupId: n,
			panelId: e
		}));
	});
}
function kn({ children: e, className: t, collapsedSize: n = "0%", collapsible: r = !1, defaultSize: i, disabled: a, elementRef: o, groupResizeBehavior: s = "preserve-relative-size", id: c, maxSize: l = "100%", minSize: u = "0%", onResize: d, panelRef: f, style: p, ...m }) {
	let h = !!c, _ = xn(c), v = Cn({ disabled: a }), y = x(null), b = Sn(y, o), { getPanelStyles: S, id: w, orientation: E, registerPanel: D, updatePanelProps: O } = Dn(), k = d !== null, A = $((e, t, n) => {
		d?.(e, c, n);
	});
	Q(() => {
		let e = y.current;
		if (e !== null) return D({
			element: e,
			id: _,
			idIsStable: h,
			mutableValues: {
				expandToSize: void 0,
				prevSize: void 0
			},
			onResize: k ? A : void 0,
			panelConstraints: {
				groupResizeBehavior: s,
				collapsedSize: n,
				collapsible: r,
				defaultSize: i,
				disabled: v.disabled,
				maxSize: l,
				minSize: u
			}
		});
	}, [
		s,
		n,
		r,
		i,
		k,
		_,
		h,
		l,
		u,
		A,
		D,
		v
	]), g(() => {
		O(_, { disabled: a });
	}, [
		a,
		_,
		O
	]), On(_, f);
	let ee = () => {
		let e = S(w, _);
		if (e) return JSON.stringify(e);
	}, te = C((e) => Tt(w, e), ee, ee), ne;
	return ne = te ? JSON.parse(te) : i === void 0 ? { flexGrow: 1 } : {
		flexGrow: void 0,
		flexShrink: void 0,
		flexBasis: i
	}, /* @__PURE__ */ T("div", {
		...m,
		"data-disabled": a || void 0,
		"data-panel": !0,
		"data-testid": _,
		id: _,
		ref: b,
		style: {
			...An,
			display: "flex",
			flexBasis: 0,
			flexShrink: 1,
			overflow: "visible",
			...ne
		},
		children: /* @__PURE__ */ T("div", {
			className: t,
			style: {
				maxHeight: "100%",
				maxWidth: "100%",
				flexGrow: 1,
				overflow: "auto",
				...p,
				touchAction: E === "horizontal" ? "pan-y" : "pan-x"
			},
			children: e
		})
	});
}
kn.displayName = "Panel";
var An = {
	minHeight: 0,
	maxHeight: "100%",
	height: "auto",
	minWidth: 0,
	maxWidth: "100%",
	width: "auto",
	border: "none",
	borderWidth: 0,
	padding: 0,
	margin: 0
};
function jn({ layout: e, panelConstraints: t, panelId: n, panelIndex: r }) {
	let i, a, o = e[n], s = t.find((e) => e.panelId === n);
	if (s) {
		let c = s.maxSize, l = s.collapsible ? s.collapsedSize : s.minSize, u = [r, r + 1];
		a = K({
			layout: W({
				delta: l - o,
				initialLayout: e,
				panelConstraints: t,
				pivotIndices: u,
				prevLayout: e
			}),
			panelConstraints: t
		})[n], i = K({
			layout: W({
				delta: c - o,
				initialLayout: e,
				panelConstraints: t,
				pivotIndices: u,
				prevLayout: e
			}),
			panelConstraints: t
		})[n];
	}
	return {
		valueControls: n,
		valueMax: i,
		valueMin: a,
		valueNow: o
	};
}
function Mn({ children: e, className: t, disabled: n, disableDoubleClick: r, elementRef: i, id: a, style: o, ...s }) {
	let c = xn(a), l = Cn({
		disabled: n,
		disableDoubleClick: r
	}), [u, d] = S({}), [f, p] = S("inactive"), [m, h] = S(!1), _ = x(null), v = Sn(_, i), { disableCursor: y, id: b, orientation: C, registerSeparator: w, updateSeparatorProps: E } = Dn(), D = C === "horizontal" ? "vertical" : "horizontal";
	Q(() => {
		let e = _.current;
		if (e !== null) {
			let t = {
				disabled: l.disabled,
				disableDoubleClick: l.disableDoubleClick,
				element: e,
				id: c
			}, n = w(t), r = Kt((e) => {
				p(e.next.state !== "inactive" && e.next.hitRegions.some((e) => e.separator === t) ? e.next.state : "inactive");
			}), i = Tt(b, (e) => {
				let { derivedPanelConstraints: n, layout: r, separatorToPanels: i } = e.next, a = i.get(t);
				if (a) {
					let e = a[0], t = a.indexOf(e);
					d(jn({
						layout: r,
						panelConstraints: n,
						panelId: e.id,
						panelIndex: t
					}));
				}
			});
			return () => {
				r(), i(), n();
			};
		}
	}, [
		b,
		c,
		w,
		l
	]), g(() => {
		E(c, {
			disabled: n,
			disableDoubleClick: r
		});
	}, [
		n,
		r,
		c,
		E
	]);
	let O;
	n && !y && (O = "not-allowed");
	let k;
	if (n) k = "disabled";
	else switch (f) {
		case "active":
			k = "active";
			break;
		default: k = m ? "focus" : f;
	}
	return /* @__PURE__ */ T("div", {
		...s,
		"aria-controls": u.valueControls,
		"aria-disabled": n || void 0,
		"aria-orientation": D,
		"aria-valuemax": u.valueMax,
		"aria-valuemin": u.valueMin,
		"aria-valuenow": u.valueNow,
		children: e,
		className: t,
		"data-separator": k,
		"data-testid": c,
		id: c,
		onBlur: () => h(!1),
		onFocus: () => h(!0),
		ref: v,
		role: "separator",
		style: {
			flexBasis: "auto",
			cursor: O,
			...o,
			flexGrow: 0,
			flexShrink: 0,
			touchAction: "none"
		},
		tabIndex: n ? void 0 : 0
	});
}
Mn.displayName = "Separator";
//#endregion
//#region src/shared/ui/resizable.tsx
var Nn = ({ className: t, ...n }) => /* @__PURE__ */ T(En, {
	className: e("min-h-0 min-w-0 flex-1 data-[panel-group-direction=vertical]:flex-col", t),
	...n
}), Pn = ({ className: t, ...n }) => /* @__PURE__ */ T(kn, {
	className: e("min-h-0 min-w-0", t),
	...n
}), Fn = ({ className: t, withHandle: n, ...r }) => /* @__PURE__ */ T(Mn, {
	className: e("relative hidden h-full w-0.5 shrink-0 bg-border/70 transition-colors hover:bg-primary/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 md:block aria-[orientation=horizontal]:h-0.5 aria-[orientation=horizontal]:w-full", t),
	...r,
	children: n ? /* @__PURE__ */ T("div", {
		className: "absolute left-1/2 top-1/2 z-10 flex h-6 w-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-sm border border-border bg-background",
		children: /* @__PURE__ */ T(D, { className: "h-3.5 w-3.5 text-muted-foreground" })
	}) : null
});
//#endregion
export { ce as _, it as a, ie as b, Je as c, tt as d, Xe as f, qe as g, rt as h, at as i, $e as l, nt as m, Pn as n, Ye as o, Qe as p, Nn as r, Ze as s, Fn as t, et as u, se as v, O as x, oe as y };
