import { jsx } from "react/jsx-runtime";
import { BaseEdge, getSmoothStepPath } from "../../../xyflow/react.js";
import { useMemo } from "react";
import { EDGE_STYLES } from "../../BaseCanvas/BaseCanvas.constants.js";
import { useAgentFlowStore } from "../store/agent-flow-store.js";
const StaticEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, source, target, hasError = false, hasSuccess = false, hasRunning = false, isCurrentBreakpoint = false, isSuggestion = false, suggestionType })=>{
    const { nodes } = useAgentFlowStore();
    const sourceNode = useMemo(()=>nodes.find((node)=>node.id === source), [
        nodes,
        source
    ]);
    const targetNode = useMemo(()=>nodes.find((node)=>node.id === target), [
        nodes,
        target
    ]);
    const isConnectedToSelectedResource = useMemo(()=>sourceNode?.type === 'resource' && sourceNode?.selected || targetNode?.type === 'resource' && targetNode?.selected, [
        sourceNode,
        targetNode
    ]);
    const strokeColor = useMemo(()=>{
        if (isSuggestion) {
            if ('add' === suggestionType) return 'var(--canvas-success-icon)';
            if ('update' === suggestionType) return 'var(--canvas-warning-icon)';
            if ('delete' === suggestionType) return 'var(--canvas-error-icon)';
        }
        if (hasError) return 'var(--canvas-error-icon)';
        if (isCurrentBreakpoint) return 'var(--canvas-warning-icon)';
        if (hasSuccess) return 'var(--canvas-success-icon)';
        if (hasRunning) return 'var(--canvas-primary)';
        return isConnectedToSelectedResource ? 'var(--canvas-primary)' : 'var(--canvas-border)';
    }, [
        hasError,
        isCurrentBreakpoint,
        hasSuccess,
        hasRunning,
        isConnectedToSelectedResource,
        isSuggestion,
        suggestionType
    ]);
    const strokeWidth = useMemo(()=>isConnectedToSelectedResource ? EDGE_STYLES.selectedStrokeWidth : 2, [
        isConnectedToSelectedResource
    ]);
    const [edgePath] = getSmoothStepPath({
        sourceX,
        sourceY,
        sourcePosition,
        targetX,
        targetY,
        targetPosition,
        borderRadius: 20
    });
    return /*#__PURE__*/ jsx(BaseEdge, {
        id: id,
        path: edgePath,
        type: "smoothstep",
        style: {
            stroke: strokeColor,
            strokeWidth,
            strokeDasharray: '5 5'
        }
    });
};
export { StaticEdge };
