import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { BaseEdge, EdgeLabelRenderer, getStraightPath } from "@xyflow/react";
import { WorkflowTransitionLabel } from "./WorkflowTransitionLabel.js";
import { EDGE_COLORS } from "../lib/status-colors.js";
function WorkflowTransitionEdge({
  id,
  sourceX,
  sourceY,
  targetX,
  targetY,
  sourcePosition,
  targetPosition,
  data,
  markerEnd
}) {
  const state = data?.state || "pending";
  const label = data?.label || "";
  const colors = EDGE_COLORS[state];
  const [edgePath, labelX, labelY] = getStraightPath({
    sourceX,
    sourceY,
    targetX,
    targetY
  });
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      BaseEdge,
      {
        id,
        path: edgePath,
        markerEnd,
        style: {
          stroke: colors.stroke,
          strokeWidth: 2,
          strokeDasharray: colors.dashed ? "5,5" : void 0
        }
      }
    ),
    label && /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx(
      "div",
      {
        style: {
          position: "absolute",
          transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
          pointerEvents: "all"
        },
        className: "nodrag nopan",
        children: /* @__PURE__ */ jsx(WorkflowTransitionLabel, { label, state })
      }
    ) })
  ] });
}
export {
  WorkflowTransitionEdge
};
//# sourceMappingURL=WorkflowTransitionEdge.js.map
