import {
  RenderMessage
} from "./chunk-WRQST6DJ.mjs";

// src/components/chat/messages/LegacyRenderMessage.tsx
import { aguiToGQL } from "@copilotkit/runtime-client-gql";
import { jsx } from "react/jsx-runtime";
var LegacyRenderMessage = ({
  message,
  inProgress,
  index,
  isCurrentMessage,
  actionResult,
  AssistantMessage,
  UserMessage,
  ImageRenderer,
  onRegenerate,
  onCopy,
  onThumbsUp,
  onThumbsDown,
  markdownTagRenderers,
  legacyProps
}) => {
  var _a;
  const {
    RenderTextMessage,
    RenderActionExecutionMessage,
    RenderAgentStateMessage,
    RenderResultMessage,
    RenderImageMessage
  } = legacyProps;
  const deprecatedMessage = (_a = aguiToGQL(message)[0]) != null ? _a : void 0;
  if (deprecatedMessage.isTextMessage() && RenderTextMessage) {
    return /* @__PURE__ */ jsx(
      RenderTextMessage,
      {
        message,
        inProgress,
        index,
        isCurrentMessage,
        AssistantMessage,
        UserMessage,
        onRegenerate,
        onCopy,
        onThumbsUp,
        onThumbsDown,
        markdownTagRenderers
      }
    );
  }
  if (deprecatedMessage.isActionExecutionMessage() && RenderActionExecutionMessage) {
    return /* @__PURE__ */ jsx(
      RenderActionExecutionMessage,
      {
        message,
        inProgress,
        index,
        isCurrentMessage,
        actionResult,
        AssistantMessage,
        UserMessage
      }
    );
  }
  if (deprecatedMessage.isAgentStateMessage() && RenderAgentStateMessage) {
    return /* @__PURE__ */ jsx(
      RenderAgentStateMessage,
      {
        message,
        inProgress,
        index,
        isCurrentMessage,
        AssistantMessage,
        UserMessage
      }
    );
  }
  if (deprecatedMessage.isResultMessage() && RenderResultMessage) {
    return /* @__PURE__ */ jsx(
      RenderResultMessage,
      {
        message,
        inProgress,
        index,
        isCurrentMessage,
        AssistantMessage,
        UserMessage
      }
    );
  }
  if (deprecatedMessage.isImageMessage() && RenderImageMessage) {
    return /* @__PURE__ */ jsx(
      RenderImageMessage,
      {
        message,
        inProgress,
        index,
        isCurrentMessage,
        AssistantMessage,
        UserMessage
      }
    );
  }
  return /* @__PURE__ */ jsx(
    RenderMessage,
    {
      message,
      inProgress,
      index,
      isCurrentMessage,
      AssistantMessage,
      UserMessage,
      ImageRenderer,
      onRegenerate,
      onCopy,
      onThumbsUp,
      onThumbsDown,
      markdownTagRenderers
    }
  );
};

export {
  LegacyRenderMessage
};
//# sourceMappingURL=chunk-SP2PFXCH.mjs.map