import { jsxs as w, jsx as c } from "react/jsx-runtime";
import { setNodes as f } from "@udecode/slate";
import { findNodePath as x } from "@udecode/slate-react";
import { merge as i } from "../../../../utilities/merge.es.js";
import { MarkupElement as u } from "../MarkupElement.es.js";
import { justifyClassNames as C } from "../helper.es.js";
import { ELEMENT_CHECK_ITEM as E } from "./id.es.js";
import { useRichTextEditorContext as k } from "../../context/RichTextEditorContext.es.js";
const N = (e, t) => e[t.children[0].textStyle], S = "tw-flex tw-flex-row tw-pb-2 tw-gap-1.5 tw-items-center", b = "focus:tw-outline-none tw-w-auto tw-min-w-[10px]", g = (e) => {
  const { attributes: t, children: s, nodeProps: l, element: o, editor: n, style: m } = e, r = o.checked, a = o.align ?? "left", { styles: d } = k();
  return /* @__PURE__ */ w("div", { ...t, style: m, className: i([S, C[a]]), children: [
    /* @__PURE__ */ c("div", { contentEditable: !1, className: "tw-flex tw-items-center tw-justify-center tw-select-none", children: /* @__PURE__ */ c(
      "input",
      {
        "data-test-id": "checkbox-input",
        className: "tw-w-4 tw-h-4 tw-m-0",
        type: "checkbox",
        checked: !!r,
        onChange: (h) => {
          const p = x(n, o);
          f(n, { checked: h.target.checked }, { at: p });
        },
        ...l
      }
    ) }),
    /* @__PURE__ */ c(
      "span",
      {
        style: N(d, o),
        className: i([b, r && "!tw-line-through"]),
        children: s
      }
    )
  ] });
};
class P extends u {
  constructor(t = E, s = g) {
    super(t, s);
  }
}
export {
  S as CHECKBOX_DIV_CLASSES,
  b as CHECKBOX_SPAN_CLASSES,
  P as CheckboxListElement,
  g as CheckboxListElementNode
};
//# sourceMappingURL=CheckboxListElement.es.js.map
