"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const ui = require("@contember/ui");
const react = require("react");
const HoveringToolbarContents = require("./HoveringToolbarContents.cjs");
const useToolbarsState = require("../editorSelection/useToolbarsState.cjs");
const HoveringToolbars = react.memo(({
  blockButtons,
  inlineButtons,
  shouldDisplayInlineToolbar: shouldDisplayInlineToolbarProp,
  showLabels,
  toolbarScheme,
  ...props
}) => {
  const { inlineToolbarRef, blockToolbarActive, inlineToolbarActive } = useToolbarsState.useToolbarState();
  const shouldDisplayInlineToolbar = inlineToolbarActive && (shouldDisplayInlineToolbarProp === void 0 || shouldDisplayInlineToolbarProp());
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogProvider, { children: [
    /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: inlineButtons && /* @__PURE__ */ jsxRuntime.jsx(ui.HoveringToolbar, { scheme: toolbarScheme, isActive: shouldDisplayInlineToolbar, ref: inlineToolbarRef, scope: "contextual", children: /* @__PURE__ */ jsxRuntime.jsx(HoveringToolbarContents.HoveringToolbarContents, { buttons: inlineButtons, showLabels }) }) }),
    blockButtons && /* @__PURE__ */ jsxRuntime.jsxs(ui.HoveringToolbar, { scheme: toolbarScheme, isActive: blockToolbarActive, children: [
      Array.isArray(blockButtons) && /* @__PURE__ */ jsxRuntime.jsx(HoveringToolbarContents.HoveringToolbarContents, { buttons: blockButtons, showLabels }),
      Array.isArray(blockButtons) || blockButtons
    ] })
  ] });
});
exports.HoveringToolbars = HoveringToolbars;
//# sourceMappingURL=HoveringToolbars.cjs.map
