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 "./utils-CHlhTiFC.js";
import { t as o } from "./dist-C2Jrcfwk.js";
import { t as s } from "./check-BgqCbxkW.js";
import { t as c } from "./x-C46k3qiu.js";
import { P as l } from "./Typography.js";
import { t as u } from "./dist-CGH4Pssf.js";
import { t as d } from "./dist-CMeIjpjM.js";
import * as f from "react";
import p, { useState as m } from "react";
import { jsx as h, jsxs as g } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-switch/dist/index.mjs
var _ = "Switch", [v, y] = e(_), [b, x] = v(_), S = f.forwardRef((e, a) => {
	let { __scopeSwitch: o, name: s, checked: c, defaultChecked: l, required: u, disabled: d, value: p = "on", onCheckedChange: m, form: v, ...y } = e, [x, S] = f.useState(null), C = r(a, (e) => S(e)), w = f.useRef(!1), T = x ? v || !!x.closest("form") : !0, [O, k] = n({
		prop: c,
		defaultProp: l ?? !1,
		onChange: m,
		caller: _
	});
	return /* @__PURE__ */ g(b, {
		scope: o,
		checked: O,
		disabled: d,
		children: [/* @__PURE__ */ h(i.button, {
			type: "button",
			role: "switch",
			"aria-checked": O,
			"aria-required": u,
			"data-state": D(O),
			"data-disabled": d ? "" : void 0,
			disabled: d,
			value: p,
			...y,
			ref: C,
			onClick: t(e.onClick, (e) => {
				k((e) => !e), T && (w.current = e.isPropagationStopped(), w.current || e.stopPropagation());
			})
		}), T && /* @__PURE__ */ h(E, {
			control: x,
			bubbles: !w.current,
			name: s,
			value: p,
			checked: O,
			required: u,
			disabled: d,
			form: v,
			style: { transform: "translateX(-100%)" }
		})]
	});
});
S.displayName = _;
var C = "SwitchThumb", w = f.forwardRef((e, t) => {
	let { __scopeSwitch: n, ...r } = e, a = x(C, n);
	return /* @__PURE__ */ h(i.span, {
		"data-state": D(a.checked),
		"data-disabled": a.disabled ? "" : void 0,
		...r,
		ref: t
	});
});
w.displayName = C;
var T = "SwitchBubbleInput", E = f.forwardRef(({ __scopeSwitch: e, control: t, checked: n, bubbles: i = !0, ...a }, o) => {
	let s = f.useRef(null), c = r(s, o), l = u(n), p = d(t);
	return f.useEffect(() => {
		let e = s.current;
		if (!e) return;
		let t = window.HTMLInputElement.prototype, r = Object.getOwnPropertyDescriptor(t, "checked").set;
		if (l !== n && r) {
			let t = new Event("click", { bubbles: i });
			r.call(e, n), e.dispatchEvent(t);
		}
	}, [
		l,
		n,
		i
	]), /* @__PURE__ */ h("input", {
		type: "checkbox",
		"aria-hidden": !0,
		defaultChecked: n,
		...a,
		tabIndex: -1,
		ref: c,
		style: {
			...a.style,
			...p,
			position: "absolute",
			pointerEvents: "none",
			opacity: 0,
			margin: 0
		}
	});
});
E.displayName = T;
function D(e) {
	return e ? "checked" : "unchecked";
}
var O = S, k = w, A = o("peer inline-flex h-[30px] w-[60px] shrink-0 cursor-pointer items-center rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-primary-blue-100 disabled:cursor-not-allowed disabled:opacity-50", {
	variants: {
		color: {
			blue: "bg-primary-gray-400 data-[state=checked]:bg-primary-blue-600 dark:bg-primary-gray-550 dark:data-[state=checked]:bg-primary-blue-400",
			red: "bg-primary-gray-400 data-[state=checked]:bg-accent-dark-red dark:bg-primary-gray-550 dark:data-[state=checked]:bg-accent-red",
			black: "bg-primary-gray-400 data-[state=checked]:bg-primary-gray-600 dark:bg-primary-gray-550 dark:data-[state=checked]:bg-primary-gray-300",
			custom: "bg-primary-gray-400 data-[state=checked]:bg-custom-color-600"
		},
		size: {
			small: "h-[20px] w-[40px]",
			normal: "h-[30px] w-[60px]"
		}
	},
	defaultVariants: {
		color: "blue",
		size: "normal"
	}
}), j = o("bg-primary-white pointer-events-none block rounded-full shadow-lg ring-0 transition-transform data-[state=unchecked]:translate-x-[4px] data-[state=unchecked]:rtl:translate-x-[-2px]", {
	variants: {
		size: {
			small: "h-[14px] w-[14px] ",
			normal: "h-[22px] w-[22px] "
		},
		showIconWithSize: {
			yes_with_small: "data-[state=checked]:translate-x-[8px] data-[state=checked]:rtl:translate-x-[-8px]",
			no_with_small: "data-[state=checked]:translate-x-[22px] data-[state=checked]:rtl:translate-x-[-22px]",
			yes_with_normal: "data-[state=checked]:translate-x-[12px] data-[state=checked]:rtl:translate-x-[-12px]",
			no_with_normal: "data-[state=checked]:translate-x-[32px] data-[state=checked]:rtl:translate-x-[-32px]"
		}
	},
	defaultVariants: {
		size: "normal",
		showIconWithSize: "no_with_normal"
	}
}), M = p.forwardRef(({ className: e, showValue: t = !1, showIcon: n = !0, values: r = ["On", "Off"], onCheckedChange: i, color: o, size: u = "normal", ...d }, f) => {
	let [p, _] = m(d.defaultChecked || !1);
	return /* @__PURE__ */ g("div", {
		className: "flex gap-2 items-center",
		children: [/* @__PURE__ */ g(O, {
			...d,
			className: a(A({
				color: o,
				size: u
			}), e),
			ref: f,
			onCheckedChange: (e) => {
				_(e), i?.(e);
			},
			children: [
				n && p ? /* @__PURE__ */ h(s, {
					size: u === "normal" ? 14 : 10,
					className: u === "normal" ? "ml-2 rtl:mr-2 rtl:ml-0 text-primary-white" : "ml-1 rtl:mr-1 rtl:ml-0 text-primary-white"
				}) : null,
				/* @__PURE__ */ h(k, { className: a(j({
					size: u,
					showIconWithSize: n ? `yes_with_${u}` : `no_with_${u}`
				})) }),
				n && !p ? /* @__PURE__ */ h(c, {
					size: u === "normal" ? 14 : 10,
					className: u === "normal" ? "ml-3 rtl:mr-3 rtl:ml-0" : "ml-2 rtl:mr-2 rtl:ml-0"
				}) : null
			]
		}), t ? /* @__PURE__ */ h(l, {
			size: "base",
			marginBottom: "none",
			leading: "none",
			children: p ? r[0] : r[1]
		}) : null]
	});
});
M.displayName = O.displayName;
//#endregion
export { M as t };

//# sourceMappingURL=switch-Bibn6a10.js.map