import { jsx as r } from "react/jsx-runtime";
import { useFloatingToolbarState as s, useFloatingToolbar as g } from "@udecode/plate-floating";
import { useComposedRef as c, PortalBody as d } from "@udecode/react-utils";
import { forwardRef as b } from "react";
import { zIndexLayers as T } from "../../helpers/zIndexLayers.es.js";
import { merge as u } from "../../../../utilities/merge.es.js";
import { ToolbarWrapper as w } from "./ToolbarWrapper.es.js";
const x = b(({ state: o, children: t, className: e, ...l }, n) => {
  const a = s({
    ...o,
    floatingOptions: {
      placement: "top",
      ...o == null ? void 0 : o.floatingOptions
    }
  }), { ref: i, props: f, hidden: m } = g(a), p = c(n, i);
  return m ? null : /* @__PURE__ */ r(d, { children: /* @__PURE__ */ r(
    w,
    {
      ref: p,
      style: {
        ...f.style,
        zIndex: T.floatingToolbar
      },
      className: u([e, "tw-relative tw-flex tw-select-none tw-items-center tw-gap-1"]),
      ...l,
      children: t
    }
  ) });
});
x.displayName = "FloatingToolbar";
export {
  x as FloatingToolbar
};
//# sourceMappingURL=FloatingToolbar.es.js.map
