import { cn as u, Y as t, X as c, d5 as d, bI as s, a2 as p, Z as C, c2 as m, N as h, F as a, d7 as i, a6 as v, G as w, bJ as b } from "./603b75d9.js";
import { C as g } from "./4963ac97.js";
import { ColumnValueTooltip as f } from "./62f393ec.js";
import "react";
import "react-dom";
import "./ffcffc16.js";
import "./26dac75c.js";
const y = [u, {
  label: t("switchComp.open"),
  value: "true",
  description: t("switchComp.openDesc")
}, {
  label: t("switchComp.close"),
  value: "false",
  description: t("switchComp.closeDesc")
}];
c.div`
  display: flex;
  align-items: center;
`;
const E = c.div`
  background: transparent !important;
  padding: 0 8px;
`, V = {
  value: d("value"),
  switchState: s,
  onEvent: p(y),
  disabled: s,
  style: C(m),
  viewRef: h
}, r = (e) => e.switchState, I = function() {
  return new g(V, (e, n) => {
    const o = e.changeValue ?? r(e);
    return /* @__PURE__ */ a(() => /* @__PURE__ */ a(i, {
      checked: o,
      disabled: e.disabled || !0,
      ref: e.viewRef,
      onChange: (l) => {
        e.value.onChange(l), e.onEvent("change"), e.onEvent(l ? "true" : "false");
      }
    }), {});
  }, (e) => e.switchState.value, r).setEditViewFn((e) => /* @__PURE__ */ a(E, {
    onBlur: () => {
      e.onChangeEnd();
    },
    children: /* @__PURE__ */ a(i, {
      autoFocus: !0,
      defaultChecked: e.value,
      disabled: !1,
      onChange: (n, o) => {
        e.onChange(n);
      }
    })
  })).setPropertyViewFn((e) => /* @__PURE__ */ v(w, {
    children: [e.switchState.propertyView({
      label: t("table.columnValue"),
      tooltip: f
    }), e.onEvent.propertyView(), b(e)]
  })).build();
}();
export {
  I as SwitchComp
};
