import { jsx as e } from "react/jsx-runtime";
import { useEditorState as c, useEventPlateId as p } from "@udecode/plate-core";
import { someNode as f } from "@udecode/slate";
import { IconStylingWrapper as C } from "../helper.es.js";
import { ToolbarButton as k } from "../../components/Toolbar/ToolbarButton.es.js";
import { getTooltip as B } from "../../helpers/getTooltip.es.js";
import b from "../../../../foundation/Icon/Generated/IconTextColumnBreak16.es.js";
import { toggleColumnBreak as d } from "./onKeyDownColumnBreak.es.js";
import { getColumnBreakCount as g } from "./utils/getColumnBreakCount.es.js";
const N = ({ id: r, ...n }) => {
  var i, s;
  const o = c(p(r)), m = !!(o != null && o.selection) && f(o, { match: (t) => !!t.breakAfterColumn }), a = (s = (i = o == null ? void 0 : o.pluginsByKey.breakAfterColumn) == null ? void 0 : i.options) == null ? void 0 : s.columns, l = Number(a) || 1, u = A(o, l, m);
  return /* @__PURE__ */ e(
    k,
    {
      disabled: !u,
      pressed: !m,
      tooltip: B(
        u ? `Column Break
Shift+Ctrl+Return` : "Already at maximum numbers of columns"
      ),
      onPointerDown: (t) => t.preventDefault(),
      onClick: (t) => {
        d(o, l, t);
      },
      ...n,
      children: /* @__PURE__ */ e(C, { icon: /* @__PURE__ */ e(b, {}) })
    }
  );
}, A = (r, n, o) => g(r) + 1 < n || o;
export {
  N as ColumnBreakToolbarButton,
  A as isColumnBreakEnabled
};
//# sourceMappingURL=ColumnBreakToolbarButton.es.js.map
