import { jsx as a, jsxs as y } from "react/jsx-runtime";
/* empty css                  */
import { classNames as t } from "./index-classNames.js";
import { ComponentContainer as N } from "./index-ComponentContainer.js";
import "react";
import { Text as m } from "./index-Text.js";
const W = (h) => {
  const {
    value: b,
    onChange: i,
    size: o = "small",
    children: e,
    labelPos: c = "right",
    labelColor: s,
    labelClassName: d,
    labelReplacements: u,
    testId: g,
    labelType: p,
    labelFontWeight: f,
    readOnly: l,
    disabled: r = !1,
    loading: v = !1,
    className: w = ""
  } = h;
  return a(N, {
    className: "vanguard-switch",
    testId: g,
    children: y("label", {
      style: {
        color: s
      },
      className: t("vanguard-switch-label", w, r ? "vanguard-switch-label-disabled" : "", l ? "vanguard-switch-label-readonly" : ""),
      children: [c === "left" ? typeof e == "string" ? a(m, {
        color: r ? "--button-primary-disabled-background-color" : s,
        className: t("vanguard-switch-label-left", d),
        children: e
      }) : e : null, v ? a("div", {
        className: t(`vanguard-switch-${o}`, "loader-container"),
        children: a("div", {
          className: "loader-spinner"
        })
      }) : a("input", {
        onClick: (n) => {
          l && n.preventDefault();
        },
        className: `vanguard-switch-input vanguard-switch-${o}`,
        type: "checkbox",
        onChange: (n) => {
          l || i && i(n);
        },
        checked: b === !0,
        disabled: r
      }), c === "right" ? typeof e == "string" ? a(m, {
        disabled: l,
        replacements: u,
        type: p,
        fontWeight: f,
        color: r ? "--button-primary-disabled-background-color" : s,
        className: t("vanguard-switch-label-right", d),
        children: e
      }) : e : null]
    })
  });
};
export {
  W as Switch
};
