@notmrabhi/flowforge 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("reactflow"),E=require("@mui/material"),de=require("react-icons/gr"),V=require("react"),ce=require("./messages-O9Tw_XXR.js"),g=require("react-icons/md"),M=require("react-icons/fa"),ae=require("react-icons/fi"),C=require("./canvasTokens-gKNYrPl4.js"),Z=V.createContext({onEditNode:()=>{},onDeleteNode:()=>{},onAddStep:()=>{},onClickAddTrigger:()=>{},messages:ce.defaultFlowForgeMessages,nodeRegistry:null,nodeBody:"full"}),w=()=>V.useContext(Z),Y=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"Start"})]}),J=()=>e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx("div",{style:{padding:"8px 28px",borderRadius:999,background:"#f5f5f5",border:"1.5px solid #bdbdbd",fontSize:13,fontWeight:500,color:"#424242",userSelect:"none"},children:"End"})]}),Q=()=>{const{onClickAddTrigger:t,messages:n}=w();return e.jsxs("div",{style:{width:350,display:"flex",justifyContent:"center"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0,left:"50%"}}),e.jsx(E.Tooltip,{title:n.addTriggerTooltip,placement:"top",arrow:!0,children:e.jsxs("div",{onClick:t,role:"button",tabIndex:0,onKeyDown:f=>{f.key==="Enter"&&t()},style:{padding:"10px 24px",borderRadius:8,border:"1.5px dashed #d0d0d0",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx(de.GrTrigger,{size:16}),e.jsx("span",{className:"ff-text-black",style:{fontSize:13},"data-testid":"add-trigger-btn-text",children:n.addTriggerButton})]})}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0,left:"50%"}})]})},pe=({id:t})=>{const{onAddStep:n}=w();return e.jsxs("div",{onClick:()=>n(t),role:"button",tabIndex:0,onKeyDown:f=>{f.key==="Enter"&&n(t)},style:{width:28,height:28,borderRadius:"50%",border:"1.5px solid #9e9e9e",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:18,color:"#757575",lineHeight:1,userSelect:"none"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),"+",e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})};function xe(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}function he(t){const n=typeof t=="string"?t:t.value??"";return n==="SIGNUP_FLOW"?"User Self-Registration":n==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":n==="SHEDULAR"?"Scheduler":typeof t!="string"&&t.label?t.label:n.replace(/[_-]+/g," ").replace(/\b\w/g,f=>f.toUpperCase())}const X=({data:t})=>{const{onClickAddTrigger:n}=w(),{type:f,eventType:a,sources:r,label:i,source:x,previewWorkflow:s,executionStatus:o,infoText:c="This node decides the flow trigger type and configuration."}=t??{},u=m=>{m==null||m.stopPropagation(),n()},h=Array.isArray(r)&&r.length>0,j=!!(i||x),p=f==="scheduler"?"Scheduler Trigger":f==="event"||h||j?"Event Trigger Source":"Select Trigger",d=f==="scheduler"?e.jsx("span",{children:"Scheduler to be configured"}):f==="event"||h?e.jsxs("div",{children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("span",{style:{fontWeight:600},children:xe(a)}),e.jsx("span",{className:"ff-ms-2 ff-text-muted",style:{fontSize:12},children:"via"})]}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-2",style:{gap:4},children:h?r.map((m,k)=>e.jsx(E.Chip,{label:he(m),variant:"outlined",size:"small",className:"ff-text-dark"},k)):e.jsx("span",{className:"ff-text-muted",style:{fontSize:12},children:"No source selected"})})]}):j?e.jsxs("div",{className:"ff-d-flex ff-flex-wrap ff-align-items-center",style:{gap:6},children:[i&&e.jsx("span",{style:{fontWeight:600},children:i}),x&&e.jsx(E.Chip,{label:x,variant:"outlined",size:"small"})]}):e.jsx("span",{role:"button",tabIndex:0,onClick:u,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&u(m)},style:{cursor:"pointer",color:"#1e88e5"},children:"Click to select a trigger to start your workflow"}),N=o?e.jsxs(e.Fragment,{children:[o.status==="success"&&e.jsx(M.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),o.status==="failed"&&e.jsx(M.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}})]}):e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[!s&&e.jsx("div",{role:"button",tabIndex:0,onClick:u,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&u(m)},className:"ff-me-2",style:{cursor:"pointer",color:"#212121"},"aria-label":"Edit trigger",children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx(E.Tooltip,{title:e.jsx("div",{children:c}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(g.MdInfoOutline,{color:"gray",size:16})})})]});return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 6px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(g.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:p})]}),e.jsx("div",{className:"ff-d-flex ff-align-items-center",children:N})]}),e.jsx("div",{style:{background:"#f5f5f5",fontSize:12,color:"#212121",padding:"10px 6px",margin:"0 12px 12px",borderRadius:6},children:d})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})};function ge(t){return t?t==="END_USER_CREATION"?"New User Registration":t==="END_USER_UPDATION"?"On User Update":t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}function ue(t){const n=typeof t=="string"?t:t.value??"";return n==="SIGNUP_FLOW"?"User Self-Registration":n==="ADMIN_CREATION_FLOW"?"Create User via Admin Portal":n==="SHEDULAR"||n==="SCHEDULER"?"Scheduler":typeof t!="string"&&t.label?t.label:n.replace(/[_-]+/g," ").replace(/\b\w/g,f=>f.toUpperCase())}const ye=({data:t})=>{const{header:n="Event",title:f,eventType:a,sources:r,executionStatus:i,infoText:x="This event is raised by the system. It cannot be configured."}=t??{},s=f??ge(a)??"—";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #a5d6a7",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center",style:{padding:"10px 12px"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(76,175,80,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(g.MdInput,{size:16,color:"#388e3c"})}),e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#212121"},children:n})]}),e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[(i==null?void 0:i.status)==="success"&&e.jsx(M.FaCheckCircle,{size:16,color:"#1DBF60",style:{marginRight:8}}),(i==null?void 0:i.status)==="failed"&&e.jsx(M.FaTimesCircle,{size:16,color:"#f44336",style:{marginRight:8}}),!i&&e.jsx(E.Tooltip,{title:e.jsx("div",{children:x}),placement:"right",arrow:!0,children:e.jsx("span",{children:e.jsx(g.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{style:{background:"#f5f5f5",fontSize:13,color:"#212121",padding:"10px 12px",margin:"0 12px 12px",borderRadius:6},children:[e.jsx("div",{style:{fontWeight:600},children:s}),Array.isArray(r)&&r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ff-text-muted",style:{fontSize:12,marginTop:4},children:"via"}),e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-mt-1",style:{gap:4},children:r.map((o,c)=>e.jsx(E.Chip,{label:ue(o),variant:"outlined",size:"small",className:"ff-text-dark"},c))})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0},id:"1"})]})},ee=({rail:t,cardWidth:n})=>{const f=n/2;n/2+t.indent;const a="var(--ff-edge-color, #b0bec5)";return e.jsxs("svg",{width:n+t.indent+200,height:t.height,style:{position:"absolute",left:0,top:"100%",pointerEvents:"none",overflow:"visible"},children:[e.jsx("line",{x1:f,y1:0,x2:f,y2:t.height,stroke:a,strokeWidth:1.5}),t.branches.map((r,i)=>{const x=r.y;return e.jsxs("g",{transform:`translate(0, ${x})`,children:[e.jsx("rect",{x:f-5,y:-5,width:10,height:10,fill:"#fff",stroke:a,strokeWidth:1.5,transform:`rotate(45, ${f}, 0)`}),e.jsx("text",{x:f+14,y:4,fontSize:12,fontWeight:500,fill:"var(--ff-text, #212121)",style:{fontFamily:"sans-serif"},children:r.label})]},i)})]})},te=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a}=w(),{conditions:r=[],infoText:i="Filter conditions applied to workflow data",_branchRail:x}=n;return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:"rgba(255,160,0,0.1)"},children:e.jsx(ae.FiFilter,{className:"ff-text-warning",size:16})}),e.jsx("span",{className:"ff-ms-2 ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Filter"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:s=>{s.stopPropagation(),f(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:s=>{s.stopPropagation(),a(t)},onKeyDown:s=>{s.key==="Enter"&&(s.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:i,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(g.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsx("div",{className:"ff-p-2 ff-mx-2 ff-mb-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:r.length===0?e.jsx("span",{className:"ff-text-muted",children:"No conditions configured"}):r.map((s,o)=>e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-mb-1",children:[e.jsx("p",{className:"ff-m-0 ff-fw-bold ff-me-1 ff-text-truncate",style:{maxWidth:100},title:s.field,children:s.field}),e.jsx("span",{className:"ff-text-muted",children:s.operator}),e.jsx("p",{className:"ff-text-dark ff-text-truncate ff-mx-1 ff-m-0",title:s.value,children:s.value}),o<r.length-1&&e.jsx("p",{className:"ff-bg-primary ff-text-white ff-fw-bold ff-ms-1 ff-px-1 ff-rounded-1 ff-m-0",children:s.logicalOperator})]},o))})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},se=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a,nodeRegistry:r,nodeBody:i="full"}=w(),{title:x="Task",descriptorType:s,groupBlocks:o,groups:c,roles:u,groupId:h,roleId:j,infoText:p=""}=n,d=s?r==null?void 0:r.forType(s):void 0,N=d==null?void 0:d.icon,m=y=>y==null?"":typeof y=="string"?y:typeof y=="object"&&"label"in y?String(y.label):String(y),k=y=>Array.isArray(y)?y.map(m).filter(Boolean):y!=null&&y!==""?[m(y)]:[],b=(o==null?void 0:o.flatMap(y=>y.groups??[]))??[...k(c),...k(u),...k(h),...k(j)],P=b.length>0;return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[N&&e.jsx("div",{style:{display:"flex",alignItems:"center"},children:N}),e.jsx("span",{className:"ff-text-dark",style:{fontSize:14,fontWeight:500},children:x})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),f(t)},onKeyDown:y=>{y.key==="Enter"&&(y.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),a(t)},onKeyDown:y=>{y.key==="Enter"&&(y.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})}),p&&e.jsx(E.Tooltip,{title:p,placement:"right",arrow:!0,children:e.jsx("div",{className:"ff-ms-2",children:e.jsx(g.MdInfoOutline,{color:"gray",size:16})})})]})]}),i!=="title-only"&&e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:d!=null&&d.renderNode?d.renderNode(n):P?e.jsx("div",{className:"ff-d-flex ff-flex-wrap ff-gap-1",children:b.map((y,T)=>e.jsx("span",{className:"ff-badge ff-bg-dark ff-text-white ff-py-1 ff-px-2 ff-rounded",style:{fontSize:11},title:y,children:y},T))}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},W=5,ne=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a}=w(),{approvalData:r,isPreview:i=!1,_branchRail:x}=n,s=(r==null?void 0:r.policy)??{},o=s.stages??[],c=o.length,u=o.slice(0,W),h=c-W,j=s.name??s.policyName??"Untitled Policy";return e.jsxs("div",{style:{width:350,position:"relative"},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #ffe082",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-mb-2 ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:"rgba(251,192,45,0.2)"},children:e.jsx(g.MdCheckCircle,{style:{color:"#FBC02D"},size:16})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Approval Policy"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[!i&&e.jsx("div",{role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:p=>{p.stopPropagation(),f(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16,className:"ff-text-secondary"})}),!i&&e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,style:{cursor:"pointer"},onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{p.key==="Enter"&&(p.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})}),e.jsx(E.Tooltip,{title:"This approval policy determines who must approve a request before the workflow continues.",arrow:!0,placement:"right",children:e.jsx("span",{className:"ff-ms-2 ff-d-inline-flex",children:e.jsx(g.MdInfoOutline,{color:"gray",size:16})})})]})]}),e.jsxs("div",{className:"ff-p-2 ff-rounded ff-mx-2 ff-mb-2",style:{background:"#FCFCFC"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-start ff-align-items-center ff-mb-2",children:[e.jsx("h6",{className:"ff-text-dark ff-mb-0 ff-text-truncate ff-flex-grow-1 ff-me-2",style:{fontSize:13,fontWeight:700},title:j,children:j}),e.jsxs("span",{className:"ff-badge ff-rounded-pill ff-px-2 ff-py-1 ff-flex-shrink-0",style:{background:"#FFF9C4",color:"#616161",fontSize:11,fontWeight:600},children:[c," Stage",c!==1?"s":""]})]}),o.length>0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[u.map((p,d)=>{var T,I,S;const N=((T=p.stageName)==null?void 0:T.trim())||`Stage ${d+1}`,m=Array.isArray(p.userIds)?p.userIds.length:0,k=((I=p.groupName)==null?void 0:I.trim())??"",b=((S=p.roleName)==null?void 0:S.trim())??"",P=m>0||k||b;let y="Not configured";return k?y=`Group: ${k}`:b?y=`Role: ${b}`:m>0&&(y=`${m} approver${m!==1?"s":""}`),e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-rounded-circle ff-d-flex ff-align-items-center ff-justify-content-center ff-flex-shrink-0",style:{width:28,height:28,background:"#FFF9C4",color:"#5D4037",fontSize:12,fontWeight:700},children:d+1}),e.jsxs("div",{className:"ff-flex-grow-1 ff-rounded ff-p-2 ff-d-flex ff-justify-content-between ff-align-items-center ff-border",style:{background:"#FFFDE7",borderColor:"#FEE79A"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"#212121"},children:N}),e.jsxs("span",{className:`ff-d-flex ff-align-items-center ff-gap-1 ${P?"ff-text-dark":"ff-text-muted"}`,style:{fontSize:12},children:[e.jsx(g.MdPeople,{size:16,className:"ff-flex-shrink-0",style:{color:P?"#5D4037":"#9E9E9E"}}),y]})]})]},d)}),h>0&&e.jsxs("div",{className:"ff-text-center ff-fw-bold ff-py-2 ff-border ff-rounded",style:{fontSize:11,color:"#1976d2",borderColor:"#FEE79A",background:"#FFFDE7",borderStyle:"dashed",cursor:i?"default":"pointer"},role:i?void 0:"button",tabIndex:i?void 0:0,onClick:p=>{i||(p.stopPropagation(),f(t))},onKeyDown:p=>{i||p.key!=="Enter"||(p.stopPropagation(),f(t))},children:["+ ",h," More Stage",h>1?"s":""]})]}):e.jsx("div",{className:"ff-text-center ff-py-3 ff-rounded ff-border",style:{fontSize:12,color:"#9e9e9e",background:"#FFFDE7",borderColor:"#FEE79A",borderStyle:"dashed"},children:"No stages configured"})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}}),x&&e.jsx(ee,{rail:x,cardWidth:350})]})},oe=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a}=w(),{duration:r,unit:i}=n,x=r!=null&&i,s=x?`Wait ${r} ${i}`:"Not configured";return e.jsxs("div",{style:{width:350},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:"rgba(33,150,243,0.1)"},children:e.jsx(g.MdSchedule,{size:16,color:"#1976d2"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"Delay"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),f(t)},onKeyDown:o=>{o.key==="Enter"&&(o.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),a(t)},onKeyDown:o=>{o.key==="Enter"&&(o.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:e.jsx("span",{className:x?"ff-text-dark ff-fw-medium":"ff-text-muted",children:s})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},F={email:{label:"Email",bg:"#e3f2fd",color:"#1565c0",iconType:g.MdEmail},slack:{label:"Slack",bg:"#e8f5e9",color:"#2e7d32",iconType:g.MdNotifications},teams:{label:"MS Teams",bg:"#ede7f6",color:"#4527a0",iconType:g.MdNotifications},sms:{label:"SMS",bg:"#fce4ec",color:"#880e4f",iconType:g.MdSms},"in-app":{label:"In-App",bg:"#fff3e0",color:"#e65100",iconType:g.MdNotifications},webhook:{label:"Webhook",bg:"#f3e5f5",color:"#6a1b9a",iconType:g.MdWebhook}},me={label:"Notification",bg:"rgba(156,39,176,0.1)",color:"#7b1fa2",iconType:g.MdNotifications};function je(t){var n;switch(t.channel){case"email":return((n=t.emailTo)==null?void 0:n.join(", "))??t.recipient??null;case"slack":return t.slackChannel??null;case"teams":return t.teamsMessage?"Message configured":null;case"sms":return t.smsTo??null;case"in-app":return t.inAppRecipient??null;case"webhook":return t.webhookUrl??null;default:return t.recipient??null}}function be(t){switch(t.channel){case"email":return t.emailSubject??t.subject??null;case"slack":{const n=t.slackMessage;return n?n.length>60?`${n.slice(0,60)}…`:n:null}case"in-app":return t.inAppTitle??null;default:return t.subject??null}}const ie=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a}=w(),r=n,i=r.channel&&F[r.channel]?F[r.channel]:me,x=je(r),s=be(r),o=!!(r.channel&&x),c=i.iconType;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-center ff-rounded",style:{width:25,height:25,background:i.bg},children:e.jsx(c,{size:16,color:i.color})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r.channel?`${i.label} Notification`:"Notification"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),f(t)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),a(t)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:o?e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:i.bg,color:i.color,fontWeight:600,flexShrink:0},children:i.label}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{maxWidth:220},children:x})]}),s&&e.jsx("span",{className:"ff-text-muted ff-text-truncate",style:{maxWidth:280},children:s})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},R={"api-key":"API Key",hmac:"HMAC"},le=({data:t})=>{const{onClickAddTrigger:n}=w(),{label:f="Webhook Trigger",endpointUrl:a,authMethod:r,source:i}=t,x=o=>{o.stopPropagation(),n()},s=o=>{o.stopPropagation(),a&&navigator.clipboard.writeText(a).catch(()=>{})};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #90caf9",borderRadius:8,background:"#fff",overflow:"hidden"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-2",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"rgba(33,150,243,0.1)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(g.MdWebhook,{size:16,color:"#1565c0"})}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"#212121"},children:"Webhook Trigger"})]}),e.jsx("div",{role:"button",tabIndex:0,onClick:x,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&x(o)},className:"ff-d-flex ff-align-items-center",style:{paddingRight:4,cursor:"pointer"},children:e.jsx(g.MdOutlineModeEdit,{size:16,color:"#555"})})]}),e.jsxs("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#e3f2fd",border:"1px solid #90caf9"},children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-flex-wrap ff-gap-2 ff-mb-1",children:[e.jsx("span",{style:{fontSize:12,color:"#1565c0",fontWeight:600},children:f}),i&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:11,background:"#fff",border:"1px solid #90caf9",color:"#1565c0"},children:i}),r&&r!=="none"&&R[r]&&e.jsx("span",{className:"ff-px-2 ff-py-1 ff-rounded",style:{fontSize:10,background:"#1565c0",color:"#fff",fontWeight:600},children:R[r]})]}),a&&e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-1",style:{marginTop:4},children:[e.jsx("span",{style:{fontSize:10,color:"#1565c0",fontFamily:"monospace",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),e.jsx(E.Tooltip,{title:"Copy URL",placement:"top",arrow:!0,children:e.jsx("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&s(o)},style:{cursor:"pointer",flexShrink:0},children:e.jsx(g.MdContentCopy,{size:12,color:"#1565c0"})})})]})]})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},re=({id:t,data:n})=>{var j;const{onEditNode:f,onDeleteNode:a,nodeRegistry:r}=w(),{method:i,url:x,descriptorType:s}=n,o=s?(j=r==null?void 0:r.forType(s))==null?void 0:j.icon:e.jsx(g.MdHttp,{size:16,color:"#546e7a"}),c=!!(i&&x),u=(i==null?void 0:i.toUpperCase())??"",h=C.HTTP_METHOD_STYLE[u]??null;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b0bec5",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,display:"flex",alignItems:"center",justifyContent:"center"},children:o}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:"REST API Call"})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),f(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:p=>{p.stopPropagation(),a(t)},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:c?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[h&&e.jsx("span",{style:{fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:4,background:h.bg,color:h.color,flexShrink:0},children:u}),e.jsx("span",{className:"ff-text-dark ff-text-truncate",style:{fontFamily:"monospace",fontSize:11},title:x,children:x})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},Ne={eq:"=",neq:"≠",gt:">",gte:"≥",lt:"<",lte:"≤",contains:"contains",startsWith:"starts with",endsWith:"ends with",isEmpty:"is empty",isNotEmpty:"is not empty"},ke=({id:t,data:n})=>{const{onEditNode:f,onDeleteNode:a}=w(),{title:r="Condition Branch",branchConfigs:i=[],defaultBranch:x}=n,s=i.length>0;return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #b39ddb",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(103,58,183,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(g.MdCallSplit,{size:16,color:"#512da8"})}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:r})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),f(t)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:o=>{o.stopPropagation(),a(t)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:"#fafafa",fontSize:12},children:s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[i.map((o,c)=>{var p,d;const u=C.BRANCH_PALETTE[c%C.BRANCH_PALETTE.length],h=(p=o.conditions)==null?void 0:p[0],j=(((d=o.conditions)==null?void 0:d.length)??0)-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:u.bg,color:u.color,flexShrink:0},children:o.label||o.key}),h?e.jsxs("span",{style:{fontSize:11,color:"#616161",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[h.field," ",Ne[h.operator]??h.operator,h.value?` ${h.value}`:"",j>0?` +${j} more`:""]}):e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"No conditions yet"})]},o.key)}),x&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:2},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:10,background:"#f5f5f5",color:"#757575",flexShrink:0},children:"Default"}),e.jsx("span",{style:{fontSize:11,color:"#9e9e9e"},children:"fallback path"})]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — click edit to add branches"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},ve=({id:t,data:n})=>{var p;const{onEditNode:f,onDeleteNode:a,nodeRegistry:r}=w(),{title:i="Sub-Workflow",workflowId:x,workflowLabel:s,descriptorType:o,onPreview:c}=n,u=o?(p=r==null?void 0:r.forType(o))==null?void 0:p.icon:e.jsx(g.MdAccountTree,{size:16,color:"#00695c"}),h=!!x,j=d=>{d.stopPropagation(),x&&c&&c(x)};return e.jsxs("div",{style:{width:C.NODE_WIDTH},children:[e.jsx(l.Handle,{type:"target",position:l.Position.Top,style:{opacity:0}}),e.jsxs("div",{style:{border:"1.5px solid #80cbc4",borderRadius:8,background:"#fff"},children:[e.jsxs("div",{className:"ff-d-flex ff-justify-content-between ff-align-items-center ff-mx-2 ff-mt-2 ff-mb-1",children:[e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-gap-2",children:[e.jsx("div",{style:{width:25,height:25,borderRadius:6,background:"rgba(0,137,123,0.1)",display:"flex",alignItems:"center",justifyContent:"center"},children:u}),e.jsx("span",{className:"ff-fw-medium ff-text-dark",style:{fontSize:14},children:i})]}),e.jsxs("div",{className:"node-actions ff-d-flex ff-align-items-center",children:[e.jsx("div",{role:"button",tabIndex:0,onClick:d=>{d.stopPropagation(),f(t)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.stopPropagation(),f(t))},children:e.jsx(g.MdOutlineModeEdit,{size:16})}),e.jsx("div",{className:"ff-ms-2",role:"button",tabIndex:0,onClick:d=>{d.stopPropagation(),a(t)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.stopPropagation(),a(t))},children:e.jsx(g.MdDeleteOutline,{color:"red",size:16})})]})]}),e.jsx("div",{className:"ff-mx-2 ff-mb-2 ff-p-2 ff-rounded",style:{background:h?"#e0f2f1":"#fafafa",fontSize:12,border:h?"1px solid #b2dfdb":"none"},children:h?e.jsxs("div",{className:"ff-d-flex ff-align-items-center ff-justify-content-between",children:[e.jsxs("div",{className:"ff-d-flex ff-flex-column ff-gap-1",children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#00695c"},children:s||x}),e.jsxs("span",{style:{fontSize:10,color:"#80cbc4",fontFamily:"monospace"},children:["ID: ",x]})]}),c&&e.jsxs("div",{role:"button",tabIndex:0,onClick:j,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&j(d)},style:{cursor:"pointer",display:"flex",alignItems:"center",gap:3,fontSize:11,color:"#00897b"},children:[e.jsx(g.MdOpenInNew,{size:13}),"Preview"]})]}):e.jsx("span",{className:"ff-text-muted",children:"Not configured — select a workflow"})})]}),e.jsx(l.Handle,{type:"source",position:l.Position.Bottom,style:{opacity:0}})]})},we={startNode:Y,endNode:J,addTriggerNode:Q,addStepNode:pe,triggerNode:X,eventNode:ye,filterNode:te,actionNode:se,approvalNode:ne,delayNode:oe,notificationNode:ie,webhookTriggerNode:le,restApiNode:re,conditionBranchNode:ke,subWorkflowNode:ve},Se=11.5,H=2,D=6,$=40,O=20,B=4,Ee=({id:t,sourceX:n,sourceY:f,targetX:a,targetY:r,sourcePosition:i,targetPosition:x,source:s,target:o,data:c})=>{const[u,h,j]=l.getStraightPath({sourceX:n,sourceY:f,targetX:a,targetY:r}),p=c==null?void 0:c.label,d=p==="Pass",N=d||p==="Fail",m=n+(a-n)/3,k=f+(r-f)/3,b=n+2*(a-n)/3,P=f+2*(r-f)/3,y=c==null?void 0:c.onAddStepClick,T=z=>{if(z.stopPropagation(),typeof y!="function")return;const fe={edgeId:t,nodeId:s,sourceNodeId:s,targetNodeId:o,position:"between",referenceNodeId:s,referenceNodeType:c==null?void 0:c.referenceNodeType,stepVisibility:c==null?void 0:c.stepVisibility};y(s,fe)},I=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),T(z))},S=()=>e.jsxs(e.Fragment,{children:[e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Se,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-D,x2:0,y2:D,strokeWidth:H,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-D,y1:0,x2:D,y2:0,strokeWidth:H,strokeLinecap:"round",className:"plus-line"})]}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]}),v=y?{onClick:T,onKeyDown:I,role:"button",tabIndex:0,style:{cursor:"pointer",pointerEvents:"all"}}:{style:{cursor:"default",pointerEvents:"all"}};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:u}),N?e.jsxs(e.Fragment,{children:[e.jsxs("g",{transform:`translate(${m}, ${k})`,children:[e.jsx("rect",{x:-$/2,y:-O/2,width:$,height:O,rx:B,ry:B,fill:d?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:d?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:p})]}),e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${b}, ${P})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]}):e.jsx("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${h}, ${j})`,"data-testid":"plus-node-icon",...v,children:e.jsx(S,{})})]})},Te=11.5,_=2,A=6,Pe=({id:t,sourceX:n,sourceY:f,targetX:a,targetY:r,source:i,target:x,data:s})=>{const[o,c,u]=l.getStraightPath({sourceX:n,sourceY:f,targetX:a,targetY:r}),h=s==null?void 0:s.onAddStepClick,j=d=>{d.stopPropagation(),typeof h=="function"&&h(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.stepVisibility,filterId:s==null?void 0:s.filterId,branch:s==null?void 0:s.branch})},p=d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),j(d))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${u})`,style:{cursor:h?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:h?j:void 0,onKeyDown:h?p:void 0,role:h?"button":void 0,tabIndex:h?0:void 0,"data-testid":"plus-node-icon",children:[e.jsx("circle",{r:Te,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-A,x2:0,y2:A,strokeWidth:_,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-A,y1:0,x2:A,y2:0,strokeWidth:_,strokeLinecap:"round",className:"plus-line"}),e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(18, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},Ce=({id:t,sourceX:n,sourceY:f,targetX:a,targetY:r})=>{const[i]=l.getStraightPath({sourceX:n,sourceY:f,targetX:a,targetY:r});return e.jsx(l.BaseEdge,{id:t,path:i,style:{stroke:"#b0bec5"}})},Ie=11.5,K=2,L=6,ze=-24,U=40,q=20,G=4,De=({id:t,sourceX:n,sourceY:f,targetX:a,targetY:r,source:i,target:x,data:s})=>{const[o,c,u]=l.getStraightPath({sourceX:n,sourceY:f,targetX:a,targetY:r}),h=s==null?void 0:s.label,j=h==="Pass",p=j||h==="Fail",d=s==null?void 0:s.onAddStepClick,N=(s==null?void 0:s.showPlus)!==!1&&!!d,m=b=>{b.stopPropagation(),typeof d=="function"&&d(i,{edgeId:t,nodeId:i,sourceNodeId:i,targetNodeId:x,position:"between",referenceNodeId:i,referenceNodeType:s==null?void 0:s.referenceNodeType,stepVisibility:s==null?void 0:s.stepVisibility})},k=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),m(b))};return e.jsxs("g",{className:"edge-with-plus-wrapper",children:[e.jsx(l.BaseEdge,{id:t,path:o,style:{stroke:"#b0bec5"}}),e.jsxs("g",{className:"nodrag nopan edge-plus-svg",transform:`translate(${c}, ${u})`,style:{cursor:d?"pointer":"default",pointerEvents:"all",outline:"none"},onClick:d?m:void 0,onKeyDown:d?k:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,children:[p&&e.jsxs("g",{transform:`translate(0, ${N?ze:0})`,children:[e.jsx("rect",{x:-U/2,y:-q/2,width:U,height:q,rx:G,ry:G,fill:j?"#ADE6C5":"#FDBFBF"}),e.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fill:j?"#1DBF60":"#C50000",style:{fontSize:12,fontWeight:500},children:h})]}),N&&e.jsxs("g",{className:"plus-icon-container",children:[e.jsx("circle",{r:Ie,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-L,x2:0,y2:L,strokeWidth:K,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-L,y1:0,x2:L,y2:0,strokeWidth:K,strokeLinecap:"round",className:"plus-line"})]}),N&&e.jsxs("g",{className:"edge-plus-tooltip",transform:"translate(22, 0)",children:[e.jsx("rect",{x:0,y:-10,width:65,height:20,rx:4,className:"tooltip-bg"}),e.jsx("path",{d:"M0 -4 L-4 0 L0 4 Z",className:"tooltip-bg"}),e.jsx("text",{x:32,y:0,textAnchor:"middle",dominantBaseline:"central",fill:"white",style:{fontSize:10,fontWeight:600,pointerEvents:"none"},children:"Add Step"})]})]})]})},Ae=({id:t,source:n,target:f,sourceX:a,sourceY:r,targetX:i,targetY:x,style:s={},markerEnd:o,data:c})=>{const u=(c==null?void 0:c.verticalRouting)??!1,h=30,j=u?(()=>{const v=x-h;return`M ${a},${v} L ${i},${v} L ${i},${x}`})():(()=>{const v=r+30;return`M ${a},${r} L ${a},${v} L ${i},${v} L ${i},${x}`})(),p=s.stroke||"#d1d5db",d=c==null?void 0:c.label,N=(c==null?void 0:c.isFirst)??!1,m=c==null?void 0:c.onAddStepClick,k=u?x-h:r+30,b=a+(i-a)*(u?.25:.35),P=a+(i-a)*(u?.65:.7),y=k,T=v=>{v.stopPropagation(),m&&m(n,{edgeId:t,nodeId:n,sourceNodeId:n,targetNodeId:f,position:"between",referenceNodeId:n,filterId:c==null?void 0:c.filterId,branch:c==null?void 0:c.branch})},I=11.5,S=6;return e.jsxs("g",{children:[e.jsx("path",{id:t,d:j,fill:"none",stroke:p,strokeWidth:1.5,markerEnd:o}),d&&!u&&e.jsx("g",{transform:`translate(${b}, ${y})`,children:(()=>{const v=Math.max(44,d.length*7+20);return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:-v/2,y:-11,width:v,height:22,rx:11,fill:N?"#e8f5e9":"#ffebee",stroke:N?"#81c784":"#e57373",strokeWidth:1}),e.jsx("text",{x:0,y:4,textAnchor:"middle",fontSize:10,fontWeight:600,fill:N?"#2e7d32":"#c62828",style:{fontFamily:"sans-serif",pointerEvents:"none"},children:d})]})})()}),m&&e.jsxs("g",{transform:`translate(${P}, ${y})`,onClick:T,style:{cursor:"pointer",pointerEvents:"all"},className:"nodrag nopan edge-plus-svg",children:[e.jsx("circle",{r:I,className:"edge-plus-circle"}),e.jsx("line",{x1:0,y1:-S,x2:0,y2:S,strokeWidth:2,strokeLinecap:"round",className:"plus-line"}),e.jsx("line",{x1:-S,y1:0,x2:S,y2:0,strokeWidth:2,strokeLinecap:"round",className:"plus-line"})]})]})};exports.ActionNode=se;exports.AddTriggerNode=Q;exports.ApprovalNode=ne;exports.DelayNode=oe;exports.EdgeWithPlusLabel=Ee;exports.EndNode=J;exports.FilterNode=te;exports.GatewayBranchEdge=Ae;exports.LabelPlusEdge=De;exports.NotificationNode=ie;exports.PlainEdge=Ce;exports.PlusEdge=Pe;exports.RestApiNode=re;exports.StartNode=Y;exports.TriggerNode=X;exports.WebhookTriggerNode=le;exports.WorkflowCanvasContext=Z;exports.builtInNodeTypes=we;