"use client"; import { useI18n } from "@/i18n"; import { getNodeOutputMediaType, SINGLE_INPUT_HANDLE_ID } from "@/utils/nodeHandles"; import type { EaseCurveNodeData, VideoStitchNodeData, WorkflowEdge, WorkflowNode } from "@/types"; interface ComposerProcessBodyProps { node: WorkflowNode | null | undefined; nodes: WorkflowNode[]; edges: WorkflowEdge[]; videoStitchData: VideoStitchNodeData | null; easeCurveData: EaseCurveNodeData | null; } function getNodeDisplayTitle(node: WorkflowNode | undefined): string { if (!node) return "Unknown"; const data = node.data as { customTitle?: unknown; inputPrompt?: unknown }; if (typeof data.customTitle === "string" && data.customTitle.trim()) return data.customTitle.trim(); if (typeof data.inputPrompt === "string" && data.inputPrompt.trim()) return data.inputPrompt.trim().slice(0, 32); return node.type; } function nodeHasVideoOutput(node: WorkflowNode | undefined): boolean { if (!node) return false; const data = node.data as { outputVideo?: unknown; video?: unknown }; return Boolean(data.outputVideo || data.video); } function buildBezierPreviewPath(handles: [number, number, number, number]): string { const [x1, y1, x2, y2] = handles; return `M 8 92 C ${8 + x1 * 84} ${92 - y1 * 84}, ${8 + x2 * 84} ${92 - y2 * 84}, 92 8`; } function formatBezierHandles(handles: [number, number, number, number]): string { return handles.map((value) => value.toFixed(2)).join(", "); } export function ComposerProcessBody({ node, nodes, edges, videoStitchData, easeCurveData, }: ComposerProcessBodyProps) { const { t } = useI18n(); if (node?.type === "videoStitch") { const stitchEdges = edges.filter((edge) => { if (edge.target !== node.id || edge.targetHandle !== SINGLE_INPUT_HANDLE_ID) return false; const sourceNode = nodes.find((candidate) => candidate.id === edge.source); return sourceNode ? getNodeOutputMediaType(sourceNode) === "video" : false; }); return (