"use client";

import dynamic from "next/dynamic";

type MindmapInstanceLike = {
  setData?: (data: unknown) => void;
  command?: { clearHistory?: () => void };
};

type MindmapAiAgentPanelProps = {
  documentId: string;
  mindmapId: string;
  mindmap: MindmapInstanceLike | null | undefined;
  activeNodes: unknown[];
  onClose?: () => void;
};

const MindmapAiAgentPanelRuntime = dynamic<MindmapAiAgentPanelProps>(
  () => import("./MindmapAiAgentPanel.runtime").then((mod) => mod.MindmapAiAgentPanelRuntime),
  {
    ssr: false,
    loading: () => null,
  },
);

// 轻量 host：侧栏切到 AI 时再拉起导图 AI runtime。
export function MindmapAiAgentPanel(props: MindmapAiAgentPanelProps) {
  return <MindmapAiAgentPanelRuntime {...props} />;
}
