import { BaseEdge, getSmoothStepPath, type EdgeProps } from "@xyflow/react"; const C = "#3b82f6"; const S = 10; const G = 4; export function CrowsFootEdge({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, style, }: EdgeProps) { const [edgePath] = getSmoothStepPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, borderRadius: 8, }); const sm = (data as any)?.startMarker as string; const em = (data as any)?.endMarker as string; // Use ORIGINAL layout direction stored in edge data — never re-compute. // Prevents symbols from flipping when user drags tables around. const origRight = (data as any)?.origRight as boolean | undefined; const right = origRight !== undefined ? origRight : targetX < sourceX ? false : true; const sOff = right ? 1 : -1; const tOff = right ? -1 : 1; const sDir = right ? 1 : -1; const tDir = right ? -1 : 1; const edgeColor = (style as any)?.stroke as string || C; return ( {sm && } {em && } ); } function Mark({ type, cx, cy, dir, color }: { type: string; cx: number; cy: number; dir: number; color: string }) { if (type === "one") { return ; } if (type === "many") { const sp = 6; const tx = cx + dir * S; return ( ); } return null; }