'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const jsxRuntime = require('react/jsx-runtime');
const index = require('../../../../../node_modules/.pnpm/@tiptap_react@3.15.3_@floating-ui_dom@1.7.4_@tiptap_core@3.15.3_@tiptap_pm@3.15.3__@tip_d7a2a9a319317617a8908309649a6dda/node_modules/@tiptap/react/dist/index.cjs');
const separator = require('../separator.cjs');
const utils = require('../../lib/utils.cjs');
const one = require('./components/section/one.cjs');
const two = require('./components/section/two.cjs');
const three = require('./components/section/three.cjs');
const four = require('./components/section/four.cjs');
const five = require('./components/section/five.cjs');
const linkBubbleMenu = require('./components/bubble-menu/link-bubble-menu.cjs');
const useMinimalTiptap = require('./hooks/use-minimal-tiptap.cjs');
const measuredContainer = require('./components/measured-container.cjs');
const useTiptapEditor = require('./hooks/use-tiptap-editor.cjs');

const Toolbar = ({ editor }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border flex h-12 shrink-0 overflow-x-auto border-b p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-max items-center gap-px", children: [
  /* @__PURE__ */ jsxRuntime.jsx(one.SectionOne, { editor, activeLevels: [1, 2, 3, 4, 5, 6] }),
  /* @__PURE__ */ jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-2" }),
  /* @__PURE__ */ jsxRuntime.jsx(
    two.SectionTwo,
    {
      editor,
      activeActions: [
        "bold",
        "italic",
        "underline",
        "strikethrough",
        "code",
        "clearFormatting"
      ],
      mainActionCount: 3
    }
  ),
  /* @__PURE__ */ jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-2" }),
  /* @__PURE__ */ jsxRuntime.jsx(three.SectionThree, { editor }),
  /* @__PURE__ */ jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-2" }),
  /* @__PURE__ */ jsxRuntime.jsx(
    four.SectionFour,
    {
      editor,
      activeActions: ["orderedList", "bulletList"],
      mainActionCount: 0
    }
  ),
  /* @__PURE__ */ jsxRuntime.jsx(separator.Separator, { orientation: "vertical", className: "mx-2" }),
  /* @__PURE__ */ jsxRuntime.jsx(
    five.SectionFive,
    {
      editor,
      activeActions: ["codeBlock", "blockquote", "horizontalRule"],
      mainActionCount: 0
    }
  )
] }) });
const MinimalTiptapEditor = ({
  value,
  onChange,
  className,
  editorContentClassName,
  ...props
}) => {
  const editor = useMinimalTiptap.useMinimalTiptapEditor({
    value,
    onUpdate: onChange,
    ...props
  });
  if (!editor) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntime.jsx(index.EditorContext.Provider, { value: { editor }, children: /* @__PURE__ */ jsxRuntime.jsx(
    MainMinimalTiptapEditor,
    {
      editor,
      className,
      editorContentClassName
    }
  ) });
};
MinimalTiptapEditor.displayName = "MinimalTiptapEditor";
const MainMinimalTiptapEditor = ({
  editor: providedEditor,
  className,
  editorContentClassName
}) => {
  const { editor } = useTiptapEditor.useTiptapEditor(providedEditor);
  if (!editor) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntime.jsxs(
    measuredContainer.MeasuredContainer,
    {
      as: "div",
      name: "editor",
      className: utils.cn(
        "border-input min-data-[orientation=vertical]:h-72 flex h-auto w-full flex-col rounded-md border shadow-xs",
        "focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
        className
      ),
      children: [
        /* @__PURE__ */ jsxRuntime.jsx(Toolbar, { editor }),
        /* @__PURE__ */ jsxRuntime.jsx(
          index.EditorContent,
          {
            editor,
            className: utils.cn("minimal-tiptap-editor", editorContentClassName)
          }
        ),
        /* @__PURE__ */ jsxRuntime.jsx(linkBubbleMenu.LinkBubbleMenu, { editor })
      ]
    }
  );
};

exports.MainMinimalTiptapEditor = MainMinimalTiptapEditor;
exports.MinimalTiptapEditor = MinimalTiptapEditor;
exports.default = MinimalTiptapEditor;
