import { jsx } from "react/jsx-runtime";
import { lazy } from "react";
import {
  RichTextV2Definition
} from "../../../../controls/rich-text-v2";
import { useIsPreview } from "../../../react/hooks/use-is-preview";
const EditableText = lazy(() => import("./EditableTextV2"));
const ReadOnlyText = lazy(() => import("./ReadOnlyTextV2"));
const ReadOnlyTextV1 = lazy(() => import("../rich-text/ReadOnlyText"));
function renderRichTextV2(data, definition, control) {
  return RichTextV2Definition.isV1Data(data) ? /* @__PURE__ */ jsx(ReadOnlyTextV1, { text: data }) : /* @__PURE__ */ jsx(RichTextV2, { data, definition, control });
}
function RichTextV2({
  data,
  definition,
  control
}) {
  return useIsPreview() ? /* @__PURE__ */ jsx(EditableText, { text: data, definition, control }) : /* @__PURE__ */ jsx(ReadOnlyText, { text: data, definition });
}
export {
  renderRichTextV2
};
//# sourceMappingURL=rich-text-v2.js.map