import { D as e, E as t, Lt as n, Nt as r, On as i, Pt as a, Tn as o, Zn as s, _ as c, b as l, et as u, g as d, k as f, mt as p, o as m, qt as h, tr as g, v as _, xt as v, y } from "./runtime-core.esm-bundler-Ci9kEgM7.js";
import { c as b, l as x } from "./vue.runtime.esm-bundler-CWCE91rd.js";
import { C as S, O as C, S as w, X as T, b as E, p as D, x as O, y as k } from "./Button-CzGEASGR.js";
import { A, b as j } from "./dist-D5YmEqpM.js";
import { b as M } from "./Tooltip-CmrGYuQV.js";
import { r as N, t as P } from "./VisuallyHiddenInput-BKQ13hRt.js";
import { t as F } from "./Label-DshmQcFV.js";
var [I, L] = C(`SwitchRoot`), R = f({ __name: `SwitchRoot`, props: { defaultValue: { type: null, required: false }, modelValue: { type: null, required: false, default: void 0 }, disabled: { type: Boolean, required: false }, id: { type: String, required: false }, value: { type: String, required: false, default: `on` }, trueValue: { type: null, required: false, default: () => true }, falseValue: { type: null, required: false, default: () => false }, asChild: { type: Boolean, required: false }, as: { type: null, required: false, default: `button` }, name: { type: String, required: false }, required: { type: Boolean, required: false } }, emits: [`update:modelValue`], setup(e2, { emit: t2 }) {
  let n2 = e2, r2 = t2, { disabled: a2 } = o(n2), s2 = j(n2, `modelValue`, r2, { defaultValue: n2.defaultValue ?? n2.falseValue, passive: n2.modelValue === void 0 }), c2 = d(() => s2.value === n2.trueValue);
  function l2() {
    a2.value || (s2.value = c2.value ? n2.falseValue : n2.trueValue);
  }
  let { forwardRef: f2, currentElement: m2 } = M(), g2 = N(m2), C2 = d(() => n2.id && m2.value ? document.querySelector(`[for="${n2.id}"]`)?.innerText : void 0);
  return L({ checked: c2, toggleCheck: l2, disabled: a2 }), (e3, t3) => (p(), _(i(S), u(e3.$attrs, { id: e3.id, ref: i(f2), role: `switch`, type: e3.as === `button` ? `button` : void 0, value: e3.value, "aria-label": e3.$attrs[`aria-label`] || C2.value, "aria-checked": c2.value, "aria-required": e3.required, "data-state": c2.value ? `checked` : `unchecked`, "data-disabled": i(a2) ? `` : void 0, "as-child": e3.asChild, as: e3.as, disabled: i(a2), onClick: l2, onKeydown: b(x(l2, [`prevent`]), [`enter`]) }), { default: h(() => [v(e3.$slots, `default`, { modelValue: i(s2), checked: c2.value }), i(g2) && e3.name ? (p(), _(i(P), { key: 0, type: `checkbox`, name: e3.name, disabled: i(a2), required: e3.required, value: e3.value, checked: c2.value }, null, 8, [`name`, `disabled`, `required`, `value`, `checked`])) : y(`v-if`, true)]), _: 3 }, 16, [`id`, `type`, `value`, `aria-label`, `aria-checked`, `aria-required`, `data-state`, `data-disabled`, `as-child`, `as`, `disabled`, `onKeydown`]));
} }), z = f({ __name: `SwitchThumb`, props: { asChild: { type: Boolean, required: false }, as: { type: null, required: false, default: `span` } }, setup(e2) {
  let t2 = I();
  return M(), (e3, n2) => (p(), _(i(S), { "data-state": i(t2).checked.value ? `checked` : `unchecked`, "data-disabled": i(t2).disabled.value ? `` : void 0, "as-child": e3.asChild, as: e3.as }, { default: h(() => [v(e3.$slots, `default`)]), _: 3 }, 8, [`data-state`, `data-disabled`, `as-child`, `as`]));
} }), B = { slots: { root: `relative flex items-start`, base: [`inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-3 data-[state=unchecked]:bg-accented`, `transition-[background] duration-200`], container: `flex items-center`, thumb: `group pointer-events-none rounded-full bg-default shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center`, icon: [`absolute shrink-0 group-data-[state=unchecked]:text-dimmed opacity-0 size-10/12`, `transition-[color,opacity] duration-200`], wrapper: `ms-2`, label: `block font-medium text-default`, description: `text-muted` }, variants: { color: { primary: { base: `data-[state=checked]:bg-primary outline-primary/25`, icon: `group-data-[state=checked]:text-primary` }, secondary: { base: `data-[state=checked]:bg-secondary outline-secondary/25`, icon: `group-data-[state=checked]:text-secondary` }, success: { base: `data-[state=checked]:bg-success outline-success/25`, icon: `group-data-[state=checked]:text-success` }, info: { base: `data-[state=checked]:bg-info outline-info/25`, icon: `group-data-[state=checked]:text-info` }, warning: { base: `data-[state=checked]:bg-warning outline-warning/25`, icon: `group-data-[state=checked]:text-warning` }, error: { base: `data-[state=checked]:bg-error outline-error/25`, icon: `group-data-[state=checked]:text-error` }, neutral: { base: `data-[state=checked]:bg-inverted outline-inverted/25`, icon: `group-data-[state=checked]:text-highlighted` } }, size: { xs: { base: `w-7`, container: `h-4`, thumb: `size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3`, wrapper: `text-xs` }, sm: { base: `w-8`, container: `h-4`, thumb: `size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5`, wrapper: `text-xs` }, md: { base: `w-9`, container: `h-5`, thumb: `size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4`, wrapper: `text-sm` }, lg: { base: `w-10`, container: `h-5`, thumb: `size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5`, wrapper: `text-sm` }, xl: { base: `w-11`, container: `h-6`, thumb: `size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5`, wrapper: `text-base` } }, checked: { true: { icon: `group-data-[state=checked]:opacity-100` } }, unchecked: { true: { icon: `group-data-[state=unchecked]:opacity-100` } }, loading: { true: { icon: `animate-spin` } }, highlight: { true: `` }, required: { true: { label: `after:content-['*'] after:ms-0.5 after:text-error` } }, disabled: { true: { root: `opacity-75`, base: `cursor-not-allowed`, label: `cursor-not-allowed`, description: `cursor-not-allowed` } } }, compoundVariants: [{ color: `primary`, highlight: true, class: { base: `ring ring-primary` } }, { color: `secondary`, highlight: true, class: { base: `ring ring-secondary` } }, { color: `success`, highlight: true, class: { base: `ring ring-success` } }, { color: `info`, highlight: true, class: { base: `ring ring-info` } }, { color: `warning`, highlight: true, class: { base: `ring ring-warning` } }, { color: `error`, highlight: true, class: { base: `ring ring-error` } }, { color: `neutral`, highlight: true, class: { base: `ring ring-inverted` } }], defaultVariants: { color: `primary`, size: `md` } }, V = Object.assign({ inheritAttrs: false }, { __name: `Switch`, props: { as: { type: null, required: false }, color: { type: null, required: false }, size: { type: null, required: false }, highlight: { type: Boolean, required: false }, loading: { type: Boolean, required: false }, loadingIcon: { type: null, required: false }, checkedIcon: { type: null, required: false }, uncheckedIcon: { type: null, required: false }, label: { type: String, required: false }, description: { type: String, required: false }, class: { type: null, required: false }, ui: { type: Object, required: false }, disabled: { type: Boolean, required: false }, id: { type: String, required: false }, name: { type: String, required: false }, required: { type: Boolean, required: false }, value: { type: String, required: false }, defaultValue: { type: null, required: false }, modelValue: { type: null, required: false }, trueValue: { type: null, required: false }, falseValue: { type: null, required: false } }, emits: [`change`, `update:modelValue`], setup(o2, { emit: f2 }) {
  let b2 = o2, x2 = n(), C2 = f2, j2 = w(`switch`, b2), M2 = T(), N2 = O(A(j2, `required`, `value`, `defaultValue`, `modelValue`, `trueValue`, `falseValue`), C2), { id: P2, emitFormChange: I2, emitFormInput: L2, size: V2, color: H, highlight: U, name: W, disabled: G, ariaAttrs: K } = D(b2), q = P2.value ?? a(), J = r(), Y = d(() => {
    let { "data-state": e2, ...t2 } = J;
    return t2;
  }), X = d(() => E({ extend: E(B), ...M2.ui?.switch || {} })({ size: V2.value ?? j2.size, color: H.value ?? j2.color, highlight: U.value ?? j2.highlight, required: j2.required, loading: j2.loading, disabled: G.value || j2.loading }));
  function Z(e2) {
    C2(`change`, new Event(`change`, { target: { value: e2 } })), I2(), L2();
  }
  return (n2, r2) => (p(), _(i(S), { as: i(j2).as, "data-slot": `root`, class: s(X.value.root({ class: [i(j2).ui?.root, i(j2).class] })) }, { default: h(() => [c(`div`, { "data-slot": `container`, class: s(X.value.container({ class: i(j2).ui?.container })) }, [e(i(R), u({ id: i(q) }, { ...i(N2), ...Y.value, ...i(K) }, { name: i(W), disabled: i(G) || i(j2).loading, "data-slot": `base`, class: X.value.base({ class: i(j2).ui?.base }), "onUpdate:modelValue": Z }), { default: h(() => [e(i(z), { "data-slot": `thumb`, class: s(X.value.thumb({ class: i(j2).ui?.thumb })) }, { default: h(() => [i(j2).loading ? (p(), _(k, { key: 0, name: i(j2).loadingIcon || i(M2).ui.icons.loading, "data-slot": `icon`, class: s(X.value.icon({ class: i(j2).ui?.icon, checked: true, unchecked: true })) }, null, 8, [`name`, `class`])) : (p(), l(m, { key: 1 }, [i(j2).checkedIcon ? (p(), _(k, { key: 0, name: i(j2).checkedIcon, "data-slot": `icon`, class: s(X.value.icon({ class: i(j2).ui?.icon, checked: true })) }, null, 8, [`name`, `class`])) : y(``, true), i(j2).uncheckedIcon ? (p(), _(k, { key: 1, name: i(j2).uncheckedIcon, "data-slot": `icon`, class: s(X.value.icon({ class: i(j2).ui?.icon, unchecked: true })) }, null, 8, [`name`, `class`])) : y(``, true)], 64))]), _: 1 }, 8, [`class`])]), _: 1 }, 16, [`id`, `name`, `disabled`, `class`])], 2), i(j2).label || x2.label || i(j2).description || x2.description ? (p(), l(`div`, { key: 0, "data-slot": `wrapper`, class: s(X.value.wrapper({ class: i(j2).ui?.wrapper })) }, [i(j2).label || x2.label ? (p(), _(i(F), { key: 0, for: i(q), "data-slot": `label`, class: s(X.value.label({ class: i(j2).ui?.label })) }, { default: h(() => [v(n2.$slots, `label`, { label: i(j2).label }, () => [t(g(i(j2).label), 1)])]), _: 3 }, 8, [`for`, `class`])) : y(``, true), i(j2).description || x2.description ? (p(), l(`p`, { key: 1, "data-slot": `description`, class: s(X.value.description({ class: i(j2).ui?.description })) }, [v(n2.$slots, `description`, { description: i(j2).description }, () => [t(g(i(j2).description), 1)])], 2)) : y(``, true)], 2)) : y(``, true)]), _: 3 }, 8, [`as`, `class`]));
} });
export {
  V as t
};
