import { DialogProvider, Portal, HoveringToolbar } from "@contember/ui";
import { memo } from "react";
import { HoveringToolbarContents } from "./HoveringToolbarContents.js";
import { jsxDEV } from "react/jsx-dev-runtime";
import { useToolbarState } from "../editorSelection/useToolbarsState.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/richText/toolbars/HoveringToolbars.tsx";
const HoveringToolbars = memo((props) => {
  const {
    inlineToolbarRef,
    blockToolbarActive,
    inlineToolbarActive
  } = useToolbarState();
  const shouldDisplayInlineToolbar = inlineToolbarActive && (props.shouldDisplayInlineToolbar === void 0 || props.shouldDisplayInlineToolbar());
  return /* @__PURE__ */ jsxDEV(DialogProvider, {
    children: [/* @__PURE__ */ jsxDEV(Portal, {
      children: props.inlineButtons && /* @__PURE__ */ jsxDEV(HoveringToolbar, {
        scheme: props.toolbarScheme,
        isActive: shouldDisplayInlineToolbar,
        ref: inlineToolbarRef,
        scope: "contextual",
        children: /* @__PURE__ */ jsxDEV(HoveringToolbarContents, {
          buttons: props.inlineButtons
        }, void 0, false, {
          fileName: _jsxFileName,
          lineNumber: 24,
          columnNumber: 7
        }, void 0)
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 23,
        columnNumber: 6
      }, void 0)
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 21,
      columnNumber: 4
    }, void 0), props.blockButtons && /* @__PURE__ */ jsxDEV(HoveringToolbar, {
      scheme: props.toolbarScheme,
      isActive: blockToolbarActive,
      children: [Array.isArray(props.blockButtons) && /* @__PURE__ */ jsxDEV(HoveringToolbarContents, {
        buttons: props.blockButtons
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 30,
        columnNumber: 44
      }, void 0), Array.isArray(props.blockButtons) || props.blockButtons]
    }, void 0, true, {
      fileName: _jsxFileName,
      lineNumber: 29,
      columnNumber: 5
    }, void 0)]
  }, void 0, true, {
    fileName: _jsxFileName,
    lineNumber: 20,
    columnNumber: 3
  }, void 0);
});
export {
  HoveringToolbars
};
//# sourceMappingURL=HoveringToolbars.js.map
