import { a as e, r as t, t as n } from "./dist-DCjaNViz.js";
import { o as r, t as i } from "./dist-D-6_qntS.js";
import { t as a } from "./dist-BSqU5QJM.js";
import { n as o, t as s } from "./utils-CHlhTiFC.js";
import { t as c } from "./dist-C2Jrcfwk.js";
import { t as l } from "./check-BgqCbxkW.js";
import { t as u } from "./dist-CGH4Pssf.js";
import { t as d } from "./dist-CMeIjpjM.js";
import { t as f } from "./label-BSFReMzI.js";
import * as p from "react";
import m from "react";
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-checkbox/dist/index.mjs
var v = "Checkbox", [y, b] = e(v), [x, S] = y(v);
function C(e) {
	let { __scopeCheckbox: t, checked: r, children: i, defaultChecked: a, disabled: o, form: s, name: c, onCheckedChange: l, required: u, value: d = "on", internal_do_not_use_render: f } = e, [m, h] = n({
		prop: r,
		defaultProp: a ?? !1,
		onChange: l,
		caller: v
	}), [_, y] = p.useState(null), [b, S] = p.useState(null), C = p.useRef(!1), w = _ ? !!s || !!_.closest("form") : !0, T = {
		checked: m,
		disabled: o,
		setChecked: h,
		control: _,
		setControl: y,
		name: c,
		form: s,
		value: d,
		hasConsumerStoppedPropagationRef: C,
		required: u,
		defaultChecked: M(a) ? !1 : a,
		isFormControl: w,
		bubbleInput: b,
		setBubbleInput: S
	};
	return /* @__PURE__ */ g(x, {
		scope: t,
		...T,
		children: j(f) ? f(T) : i
	});
}
var w = "CheckboxTrigger", T = p.forwardRef(({ __scopeCheckbox: e, onKeyDown: n, onClick: a, ...o }, s) => {
	let { control: c, value: l, disabled: u, checked: d, required: f, setControl: m, setChecked: h, hasConsumerStoppedPropagationRef: _, isFormControl: v, bubbleInput: y } = S(w, e), b = r(s, m), x = p.useRef(d);
	return p.useEffect(() => {
		let e = c?.form;
		if (e) {
			let t = () => h(x.current);
			return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
		}
	}, [c, h]), /* @__PURE__ */ g(i.button, {
		type: "button",
		role: "checkbox",
		"aria-checked": M(d) ? "mixed" : d,
		"aria-required": f,
		"data-state": N(d),
		"data-disabled": u ? "" : void 0,
		disabled: u,
		value: l,
		...o,
		ref: b,
		onKeyDown: t(n, (e) => {
			e.key === "Enter" && e.preventDefault();
		}),
		onClick: t(a, (e) => {
			h((e) => M(e) ? !0 : !e), y && v && (_.current = e.isPropagationStopped(), _.current || e.stopPropagation());
		})
	});
});
T.displayName = w;
var E = p.forwardRef((e, t) => {
	let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
	return /* @__PURE__ */ g(C, {
		__scopeCheckbox: n,
		checked: i,
		defaultChecked: a,
		disabled: s,
		required: o,
		onCheckedChange: l,
		name: r,
		form: u,
		value: c,
		internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(T, {
			...d,
			ref: t,
			__scopeCheckbox: n
		}), e && /* @__PURE__ */ g(A, { __scopeCheckbox: n })] })
	});
});
E.displayName = v;
var D = "CheckboxIndicator", O = p.forwardRef((e, t) => {
	let { __scopeCheckbox: n, forceMount: r, ...o } = e, s = S(D, n);
	return /* @__PURE__ */ g(a, {
		present: r || M(s.checked) || s.checked === !0,
		children: /* @__PURE__ */ g(i.span, {
			"data-state": N(s.checked),
			"data-disabled": s.disabled ? "" : void 0,
			...o,
			ref: t,
			style: {
				pointerEvents: "none",
				...e.style
			}
		})
	});
});
O.displayName = D;
var k = "CheckboxBubbleInput", A = p.forwardRef(({ __scopeCheckbox: e, ...t }, n) => {
	let { control: a, hasConsumerStoppedPropagationRef: o, checked: s, defaultChecked: c, required: l, disabled: f, name: m, value: h, form: _, bubbleInput: v, setBubbleInput: y } = S(k, e), b = r(n, y), x = u(s), C = d(a);
	p.useEffect(() => {
		let e = v;
		if (!e) return;
		let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set, r = !o.current;
		if (x !== s && n) {
			let t = new Event("click", { bubbles: r });
			e.indeterminate = M(s), n.call(e, M(s) ? !1 : s), e.dispatchEvent(t);
		}
	}, [
		v,
		x,
		s,
		o
	]);
	let w = p.useRef(M(s) ? !1 : s);
	return /* @__PURE__ */ g(i.input, {
		type: "checkbox",
		"aria-hidden": !0,
		defaultChecked: c ?? w.current,
		required: l,
		disabled: f,
		name: m,
		value: h,
		form: _,
		...t,
		tabIndex: -1,
		ref: b,
		style: {
			...t.style,
			...C,
			position: "absolute",
			pointerEvents: "none",
			opacity: 0,
			margin: 0,
			transform: "translateX(-100%)"
		}
	});
});
A.displayName = k;
function j(e) {
	return typeof e == "function";
}
function M(e) {
	return e === "indeterminate";
}
function N(e) {
	return M(e) ? "indeterminate" : e ? "checked" : "unchecked";
}
//#endregion
//#region src/components/ui/checkbox.tsx
var P = c("peer h-4 w-4 shrink-0 rounded-0 bg-primary-white dark:bg-primary-gray-650 focus-visible:outline-hidden focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50", {
	variants: {
		color: {
			blue: "border-primary-blue-600 hover:bg-primary-blue-100 dark:border-primary-blue-400 dark:hover:bg-primary-blue-200",
			red: "border-accent-dark-red hover:bg-accent-light-red dark:border-accent-red dark:hover:bg-accent-light-red",
			black: "border-primary-gray-700 hover:bg-primary-gray-400 dark:border-primary-gray-100 dark:hover:bg-primary-gray-550",
			custom: "border-custom-color-600 hover:bg-custom-color-100 dark:border-custom-color-400 dark:hover:bg-custom-color-200"
		},
		variant: {
			light: "border",
			normal: "border-2"
		}
	},
	defaultVariants: {
		color: "red",
		variant: "normal"
	}
}), F = c("h-4 w-4", {
	variants: {
		color: {
			blue: "stroke-primary-blue-600 dark:stroke-primary-blue-400",
			red: "stroke-accent-dark-red dark:stroke-accent-red",
			black: "stroke-primary-gray-700 dark:stroke-primary-gray-100",
			custom: "stroke-custom-color-600 dark:stroke-custom-color-400"
		},
		variant: {
			light: "-mt-px",
			normal: "-mt-0.5"
		}
	},
	defaultVariants: {
		color: "red",
		variant: "normal"
	}
}), I = m.forwardRef(({ className: e, labelClassName: t, checkBoxClassName: n, checkIconClassName: r, label: i, color: a, variant: c, ...u }, d) => {
	let p = u.id || o();
	return /* @__PURE__ */ _("div", {
		className: s("flex flex-row gap-2 items-center", e),
		children: [/* @__PURE__ */ g(E, {
			...u,
			ref: d,
			className: s(P({
				color: a,
				variant: c
			}), n),
			id: p,
			children: /* @__PURE__ */ g(O, {
				className: s("flex items-center justify-center text-current"),
				children: /* @__PURE__ */ g(l, {
					className: s(F({
						color: a,
						variant: c
					}), r),
					strokeWidth: c === "light" ? 2 : 4
				})
			})
		}), i ? /* @__PURE__ */ g(f, {
			className: s("mt-0.5 text-base!", t),
			htmlFor: p,
			children: i
		}) : null]
	});
});
I.displayName = E.displayName;
//#endregion
export { I as t };

//# sourceMappingURL=checkbox-DdJA0iKE.js.map