import { cn as h, Y as i, X as y, d5 as b, P as m, a2 as S, bI as w, Z as o, c2 as g, az as C, c3 as p, N as f, bS as v, d6 as k, U as P, F as a, d7 as F, a6 as s, G as u, a7 as n, a8 as l, af as d, bJ as V, a9 as x, cP as E, d8 as $, cR as M, d9 as O, aa as N, ac as R, bL as I, av as L, cU as U } from "./603b75d9.js";
import { useContext as c } from "react";
import { formDataChildren as j, FormDataPropertyView as B } from "./f9847c56.js";
import "react-dom";
const T = [h, {
  label: i("switchComp.open"),
  value: "true",
  description: i("switchComp.openDesc")
}, {
  label: i("switchComp.close"),
  value: "false",
  description: i("switchComp.closeDesc")
}], W = (t) => L`
    .ant-switch-handle::before {
      background: ${t.handle};
    }
    button {
      background-image: none;
      background: ${t.unchecked};
      &.ant-switch-checked {
        background: ${t.checked};
        &:hover:not(.ant-switch-disabled) {
          background: ${U(t.checked, 0.2)}
        }
      }
    }
  `, z = y.div`
  min-height: 32px;
  display: flex;
  align-items: center;
  // Can respond to drag & select events when disabled
  ${(t) => t.disabled && `
    cursor: not-allowed;
    >button:disabled {
      pointer-events: none;
    }
  `};
  ${(t) => t.$style && W(t.$style)}
`;
function A(t) {
  return t && t.hasOwnProperty("unChecked") ? {
    label: t.label,
    handle: t.handle,
    unchecked: t.unChecked,
    checked: t.checked
  } : t;
}
let D = function() {
  const t = {
    value: b("value"),
    label: m,
    onEvent: S(T),
    disabled: w,
    style: o(g, "style"),
    animationStyle: o(C, "animationStyle"),
    labelStyle: o(p.filter((e) => ["accent", "validate"].includes(e.name) === !1), "labelStyle"),
    viewRef: f,
    inputFieldStyle: v(o(k, "inputFieldStyle"), A),
    ...j
  };
  return new P(t, (e) => e.label({
    style: e.style,
    labelStyle: e.labelStyle,
    inputFieldStyle: e.inputFieldStyle,
    animationStyle: e.animationStyle,
    children: /* @__PURE__ */ a(z, {
      disabled: e.disabled,
      $style: e.inputFieldStyle,
      children: /* @__PURE__ */ a(F, {
        checked: e.value.value,
        disabled: e.disabled,
        ref: e.viewRef,
        onChange: (r) => {
          e.value.onChange(r), e.onEvent("change"), e.onEvent(r ? "true" : "false");
        }
      })
    })
  })).setPropertyViewFn((e) => /* @__PURE__ */ s(u, {
    children: [/* @__PURE__ */ a(n, {
      name: l.basic,
      children: e.value.propertyView({
        label: i("switchComp.defaultValue")
      })
    }), /* @__PURE__ */ a(B, {
      ...e
    }), ["logic", "both"].includes(c(d).editorModeStatus) && /* @__PURE__ */ s(n, {
      name: l.interaction,
      children: [e.onEvent.getPropertyView(), V(e), x(e)]
    }), ["layout", "both"].includes(c(d).editorModeStatus) && e.label.getPropertyView(), ["layout", "both"].includes(c(d).editorModeStatus) && /* @__PURE__ */ s(u, {
      children: [/* @__PURE__ */ a(n, {
        name: l.style,
        children: e.style.getPropertyView()
      }), /* @__PURE__ */ a(n, {
        name: l.labelStyle,
        children: e.labelStyle.getPropertyView()
      }), /* @__PURE__ */ a(n, {
        name: l.inputFieldStyle,
        children: e.inputFieldStyle.getPropertyView()
      }), /* @__PURE__ */ a(n, {
        name: l.animationStyle,
        hasTooltip: !0,
        children: e.animationStyle.getPropertyView()
      })]
    })]
  })).setExposeMethodConfigs(E([$, M, O])).build();
}();
const Y = N(D, [new R("value", i("switchComp.valueDesc")), ...I]);
export {
  Y as SwitchComp
};
