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