import{r as m,a6 as qo,P as E}from"./index-dP1W1_bd.js";import{z as jo,p as Qo,d as Jo}from"./zoom-CRTJnDeN.js";import{s as En,i as Oe}from"./transform-C0Urpblx.js";function re(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=re(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Sn={exports:{}},bn={},Nn={exports:{}},vn={};/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ze=m;function es(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ts=typeof Object.is=="function"?Object.is:es,ns=Ze.useState,os=Ze.useEffect,ss=Ze.useLayoutEffect,rs=Ze.useDebugValue;function is(e,t){var n=t(),o=ns({inst:{value:n,getSnapshot:t}}),s=o[0].inst,i=o[1];return ss(function(){s.value=n,s.getSnapshot=t,xt(s)&&i({inst:s})},[e,n,t]),os(function(){return xt(s)&&i({inst:s}),e(function(){xt(s)&&i({inst:s})})},[e]),rs(n),n}function xt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ts(e,n)}catch{return!0}}function cs(e,t){return t()}var as=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?cs:is;vn.useSyncExternalStore=Ze.useSyncExternalStore!==void 0?Ze.useSyncExternalStore:as;Nn.exports=vn;var ls=Nn.exports;/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ft=m,us=ls;function ds(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fs=typeof Object.is=="function"?Object.is:ds,gs=us.useSyncExternalStore,ps=ft.useRef,ms=ft.useEffect,hs=ft.useMemo,ys=ft.useDebugValue;bn.useSyncExternalStoreWithSelector=function(e,t,n,o,s){var i=ps(null);if(i.current===null){var r={hasValue:!1,value:null};i.current=r}else r=i.current;i=hs(function(){function l(f){if(!u){if(u=!0,a=f,f=o(f),s!==void 0&&r.hasValue){var y=r.value;if(s(y,f))return d=y}return d=f}if(y=d,fs(a,f))return y;var g=o(f);return s!==void 0&&s(y,g)?y:(a=f,d=g)}var u=!1,a,d,p=n===void 0?null:n;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,n,o,s]);var c=gs(e,i[0],i[1]);return ms(function(){r.hasValue=!0,r.value=c},[c]),ys(c),c};Sn.exports=bn;var xs=Sn.exports;const ws=qo(xs),Es={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,REACT_APP_API_DOMAIN:"",REACT_APP_API_HOST:"/hopsworks-api/api",REACT_APP_API_HOST_EXEC:"/hopsworks-api",REACT_APP_REMOTE_API_HOST:"/hopsworks-remote-user-api/api",SSR:!1},Gt=e=>{let t;const n=new Set,o=(a,d)=>{const p=typeof a=="function"?a(t):a;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,f))}},s=()=>t,l={setState:o,getState:s,getInitialState:()=>u,subscribe:a=>(n.add(a),()=>n.delete(a)),destroy:()=>{(Es?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(o,s,l);return l},Ss=e=>e?Gt(e):Gt,{useDebugValue:bs}=E,{useSyncExternalStoreWithSelector:Ns}=ws,vs=e=>e;function An(e,t=vs,n){const o=Ns(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return bs(o),o}const Kt=(e,t)=>{const n=Ss(e),o=(s,i=t)=>An(n,s,i);return Object.assign(o,n),o},As=(e,t)=>e?Kt(e,t):Kt;function se(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,s]of e)if(!Object.is(s,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const gt=m.createContext(null),Ms=gt.Provider,ye={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Mn=ye.error001();function j(e,t){const n=m.useContext(gt);if(n===null)throw new Error(Mn);return An(n,e,t)}const te=()=>{const e=m.useContext(gt);if(e===null)throw new Error(Mn);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Cs=e=>e.userSelectionActive?"none":"all";function Cn({position:e,children:t,className:n,style:o,...s}){const i=j(Cs),r=`${e}`.split("-");return E.createElement("div",{className:re(["react-flow__panel",n,...r]),style:{...o,pointerEvents:i},...s},t)}function _s({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:E.createElement(Cn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},E.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const $s=({x:e,y:t,label:n,labelStyle:o={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:r=[2,4],labelBgBorderRadius:c=2,children:l,className:u,...a})=>{const d=m.useRef(null),[p,f]=m.useState({x:0,y:0,width:0,height:0}),y=re(["react-flow__edge-textwrapper",u]);return m.useEffect(()=>{if(d.current){const g=d.current.getBBox();f({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),typeof n>"u"||!n?null:E.createElement("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:y,visibility:p.width?"visible":"hidden",...a},s&&E.createElement("rect",{width:p.width+2*r[0],x:-r[0],y:-r[1],height:p.height+2*r[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),E.createElement("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:d,style:o},n),l)};var Is=m.memo($s);const Pt=e=>({width:e.offsetWidth,height:e.offsetHeight}),We=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ht=(e={x:0,y:0},t)=>({x:We(e.x,t[0][0],t[1][0]),y:We(e.y,t[0][1],t[1][1])}),qt=(e,t,n)=>e<t?We(Math.abs(e-t),1,50)/50:e>n?-We(Math.abs(e-n),1,50)/50:0,_n=(e,t)=>{const n=qt(e.x,35,t.width-35)*20,o=qt(e.y,35,t.height-35)*20;return[n,o]},$n=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Ts=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Rt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Ps=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),jt=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Hs=e=>le(e.width)&&le(e.height)&&le(e.x)&&le(e.y),le=e=>!isNaN(e)&&isFinite(e),q=Symbol.for("internals"),In=["Enter"," ","Escape"],Rs=(e,t)=>{},ks=e=>"nativeEvent"in e;function At(e){var s,i;const t=ks(e)?e.nativeEvent:e,n=((i=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Tn=e=>"clientX"in e,Se=(e,t)=>{var i,r;const n=Tn(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(r=e.touches)==null?void 0:r[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},at=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ot=({id:e,path:t,labelX:n,labelY:o,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,style:a,markerEnd:d,markerStart:p,interactionWidth:f=20})=>E.createElement(E.Fragment,null,E.createElement("path",{id:e,style:a,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:p}),f&&E.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),s&&le(n)&&le(o)?E.createElement(Is,{x:n,y:o,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u}):null);ot.displayName="BaseEdge";function je(e,t,n){return n===void 0?n:o=>{const s=t().edges.find(i=>i.id===e);s&&n(o,{...s})}}function Pn({sourceX:e,sourceY:t,targetX:n,targetY:o}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,r=Math.abs(o-t)/2,c=o<t?o+r:o-r;return[i,c,s,r]}function Hn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:i,targetControlX:r,targetControlY:c}){const l=e*.125+s*.375+r*.375+n*.125,u=t*.125+i*.375+c*.375+o*.125,a=Math.abs(l-e),d=Math.abs(u-t);return[l,u,a,d]}var Te;(function(e){e.Strict="strict",e.Loose="loose"})(Te||(Te={}));var Ie;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ie||(Ie={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));var Ee;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ee||(Ee={}));var lt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(lt||(lt={}));var B;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(B||(B={}));function Qt({pos:e,x1:t,y1:n,x2:o,y2:s}){return e===B.Left||e===B.Right?[.5*(t+o),n]:[t,.5*(n+s)]}function Rn({sourceX:e,sourceY:t,sourcePosition:n=B.Bottom,targetX:o,targetY:s,targetPosition:i=B.Top}){const[r,c]=Qt({pos:n,x1:e,y1:t,x2:o,y2:s}),[l,u]=Qt({pos:i,x1:o,y1:s,x2:e,y2:t}),[a,d,p,f]=Hn({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:r,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${r},${c} ${l},${u} ${o},${s}`,a,d,p,f]}const kt=m.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:s=B.Bottom,targetPosition:i=B.Top,label:r,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:a,labelBgBorderRadius:d,style:p,markerEnd:f,markerStart:y,interactionWidth:g})=>{const[x,h,w]=Rn({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:o,targetPosition:i});return E.createElement(ot,{path:x,labelX:h,labelY:w,label:r,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:a,labelBgBorderRadius:d,style:p,markerEnd:f,markerStart:y,interactionWidth:g})});kt.displayName="SimpleBezierEdge";const Jt={[B.Left]:{x:-1,y:0},[B.Right]:{x:1,y:0},[B.Top]:{x:0,y:-1},[B.Bottom]:{x:0,y:1}},Ds=({source:e,sourcePosition:t=B.Bottom,target:n})=>t===B.Left||t===B.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},en=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function zs({source:e,sourcePosition:t=B.Bottom,target:n,targetPosition:o=B.Top,center:s,offset:i}){const r=Jt[t],c=Jt[o],l={x:e.x+r.x*i,y:e.y+r.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},a=Ds({source:l,sourcePosition:t,target:u}),d=a.x!==0?"x":"y",p=a[d];let f=[],y,g;const x={x:0,y:0},h={x:0,y:0},[w,N,A,$]=Pn({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(r[d]*c[d]===-1){y=s.x??w,g=s.y??N;const z=[{x:y,y:l.y},{x:y,y:u.y}],k=[{x:l.x,y:g},{x:u.x,y:g}];r[d]===p?f=d==="x"?z:k:f=d==="x"?k:z}else{const z=[{x:l.x,y:u.y}],k=[{x:u.x,y:l.y}];if(d==="x"?f=r.x===p?k:z:f=r.y===p?z:k,t===o){const M=Math.abs(e[d]-n[d]);if(M<=i){const S=Math.min(i-1,i-M);r[d]===p?x[d]=(l[d]>e[d]?-1:1)*S:h[d]=(u[d]>n[d]?-1:1)*S}}if(t!==o){const M=d==="x"?"y":"x",S=r[d]===c[M],C=l[M]>u[M],V=l[M]<u[M];(r[d]===1&&(!S&&C||S&&V)||r[d]!==1&&(!S&&V||S&&C))&&(f=d==="x"?z:k)}const v={x:l.x+x.x,y:l.y+x.y},I={x:u.x+h.x,y:u.y+h.y},_=Math.max(Math.abs(v.x-f[0].x),Math.abs(I.x-f[0].x)),P=Math.max(Math.abs(v.y-f[0].y),Math.abs(I.y-f[0].y));_>=P?(y=(v.x+I.x)/2,g=f[0].y):(y=f[0].x,g=(v.y+I.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...f,{x:u.x+h.x,y:u.y+h.y},n],y,g,A,$]}function Vs(e,t,n,o){const s=Math.min(en(e,t)/2,en(t,n)/2,o),{x:i,y:r}=t;if(e.x===i&&i===n.x||e.y===r&&r===n.y)return`L${i} ${r}`;if(e.y===r){const u=e.x<n.x?-1:1,a=e.y<n.y?1:-1;return`L ${i+s*u},${r}Q ${i},${r} ${i},${r+s*a}`}const c=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${r+s*l}Q ${i},${r} ${i+s*c},${r}`}function Mt({sourceX:e,sourceY:t,sourcePosition:n=B.Bottom,targetX:o,targetY:s,targetPosition:i=B.Top,borderRadius:r=5,centerX:c,centerY:l,offset:u=20}){const[a,d,p,f,y]=zs({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:s},targetPosition:i,center:{x:c,y:l},offset:u});return[a.reduce((x,h,w)=>{let N="";return w>0&&w<a.length-1?N=Vs(a[w-1],h,a[w+1],r):N=`${w===0?"M":"L"}${h.x} ${h.y}`,x+=N,x},""),d,p,f,y]}const pt=m.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,style:a,sourcePosition:d=B.Bottom,targetPosition:p=B.Top,markerEnd:f,markerStart:y,pathOptions:g,interactionWidth:x})=>{const[h,w,N]=Mt({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:o,targetPosition:p,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset});return E.createElement(ot,{path:h,labelX:w,labelY:N,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,style:a,markerEnd:f,markerStart:y,interactionWidth:x})});pt.displayName="SmoothStepEdge";const Dt=m.memo(e=>{var t;return E.createElement(pt,{...e,pathOptions:m.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Dt.displayName="StepEdge";function Bs({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[s,i,r,c]=Pn({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,s,i,r,c]}const zt=m.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,style:a,markerEnd:d,markerStart:p,interactionWidth:f})=>{const[y,g,x]=Bs({sourceX:e,sourceY:t,targetX:n,targetY:o});return E.createElement(ot,{path:y,labelX:g,labelY:x,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,style:a,markerEnd:d,markerStart:p,interactionWidth:f})});zt.displayName="StraightEdge";function st(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function tn({pos:e,x1:t,y1:n,x2:o,y2:s,c:i}){switch(e){case B.Left:return[t-st(t-o,i),n];case B.Right:return[t+st(o-t,i),n];case B.Top:return[t,n-st(n-s,i)];case B.Bottom:return[t,n+st(s-n,i)]}}function kn({sourceX:e,sourceY:t,sourcePosition:n=B.Bottom,targetX:o,targetY:s,targetPosition:i=B.Top,curvature:r=.25}){const[c,l]=tn({pos:n,x1:e,y1:t,x2:o,y2:s,c:r}),[u,a]=tn({pos:i,x1:o,y1:s,x2:e,y2:t,c:r}),[d,p,f,y]=Hn({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:a});return[`M${e},${t} C${c},${l} ${u},${a} ${o},${s}`,d,p,f,y]}const ut=m.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:s=B.Bottom,targetPosition:i=B.Top,label:r,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:a,labelBgBorderRadius:d,style:p,markerEnd:f,markerStart:y,pathOptions:g,interactionWidth:x})=>{const[h,w,N]=kn({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:o,targetPosition:i,curvature:g==null?void 0:g.curvature});return E.createElement(ot,{path:h,labelX:w,labelY:N,label:r,labelStyle:c,labelShowBg:l,labelBgStyle:u,labelBgPadding:a,labelBgBorderRadius:d,style:p,markerEnd:f,markerStart:y,interactionWidth:x})});ut.displayName="BezierEdge";const Vt=m.createContext(null),Ls=Vt.Provider;Vt.Consumer;const Fs=()=>m.useContext(Vt),Os=e=>"id"in e&&"source"in e&&"target"in e,Ys=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,Ct=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`,Us=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Zs=(e,t)=>{if(!e.source||!e.target)return t;let n;return Os(e)?n={...e}:n={...e,id:Ys(e)},Us(n,t)?t:t.concat(n)},_t=({x:e,y:t},[n,o,s],i,[r,c])=>{const l={x:(e-n)/s,y:(t-o)/s};return i?{x:r*Math.round(l.x/r),y:c*Math.round(l.y/c)}:l},Dn=({x:e,y:t},[n,o,s])=>({x:e*s+n,y:t*s+o}),Ye=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],s={x:e.position.x-n,y:e.position.y-o};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:s}},Bt=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,s)=>{const{x:i,y:r}=Ye(s,t).positionAbsolute;return Ts(o,Rt({x:i,y:r,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ps(n)},zn=(e,t,[n,o,s]=[0,0,1],i=!1,r=!1,c=[0,0])=>{const l={x:(t.x-n)/s,y:(t.y-o)/s,width:t.width/s,height:t.height/s},u=[];return e.forEach(a=>{const{width:d,height:p,selectable:f=!0,hidden:y=!1}=a;if(r&&!f||y)return!1;const{positionAbsolute:g}=Ye(a,c),x={x:g.x,y:g.y,width:d||0,height:p||0},h=vt(l,x),w=typeof d>"u"||typeof p>"u"||d===null||p===null,N=i&&h>0,A=(d||0)*(p||0);(w||N||h>=A||a.dragging)&&u.push(a)}),u},Vn=(e,t)=>{const n=e.map(o=>o.id);return t.filter(o=>n.includes(o.source)||n.includes(o.target))},Bn=(e,t,n,o,s,i=.1)=>{const r=t/(e.width*(1+i)),c=n/(e.height*(1+i)),l=Math.min(r,c),u=We(l,o,s),a=e.x+e.width/2,d=e.y+e.height/2,p=t/2-a*u,f=n/2-d*u;return{x:p,y:f,zoom:u}},$e=(e,t=0)=>e.transition().duration(t);function nn(e,t,n,o){return(t[n]||[]).reduce((s,i)=>{var r,c;return`${e.id}-${i.id}-${n}`!==o&&s.push({id:i.id||null,type:n,nodeId:e.id,x:(((r=e.positionAbsolute)==null?void 0:r.x)??0)+i.x+i.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+i.y+i.height/2}),s},[])}function Ws(e,t,n,o,s,i){const{x:r,y:c}=Se(e),u=t.elementsFromPoint(r,c).find(y=>y.classList.contains("react-flow__handle"));if(u){const y=u.getAttribute("data-nodeid");if(y){const g=Lt(void 0,u),x=u.getAttribute("data-handleid"),h=i({nodeId:y,id:x,type:g});if(h){const w=s.find(N=>N.nodeId===y&&N.type===g&&N.id===x);return{handle:{id:x,type:g,nodeId:y,x:(w==null?void 0:w.x)||n.x,y:(w==null?void 0:w.y)||n.y},validHandleResult:h}}}}let a=[],d=1/0;if(s.forEach(y=>{const g=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(g<=o){const x=i(y);g<=d&&(g<d?a=[{handle:y,validHandleResult:x}]:g===d&&a.push({handle:y,validHandleResult:x}),d=g)}}),!a.length)return{handle:null,validHandleResult:Ln()};if(a.length===1)return a[0];const p=a.some(({validHandleResult:y})=>y.isValid),f=a.some(({handle:y})=>y.type==="target");return a.find(({handle:y,validHandleResult:g})=>f?y.type==="target":p?g.isValid:!0)||a[0]}const Xs={source:null,target:null,sourceHandle:null,targetHandle:null},Ln=()=>({handleDomNode:null,isValid:!1,connection:Xs,endHandle:null});function Fn(e,t,n,o,s,i,r){const c=s==="target",l=r.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...Ln(),handleDomNode:l};if(l){const a=Lt(void 0,l),d=l.getAttribute("data-nodeid"),p=l.getAttribute("data-handleid"),f=l.classList.contains("connectable"),y=l.classList.contains("connectableend"),g={source:c?d:n,sourceHandle:c?p:o,target:c?n:d,targetHandle:c?o:p};u.connection=g,f&&y&&(t===Te.Strict?c&&a==="source"||!c&&a==="target":d!==n||p!==o)&&(u.endHandle={nodeId:d,handleId:p,type:a},u.isValid=i(g))}return u}function Gs({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((s,i)=>{if(i[q]){const{handleBounds:r}=i[q];let c=[],l=[];r&&(c=nn(i,r,"source",`${t}-${n}-${o}`),l=nn(i,r,"target",`${t}-${n}-${o}`)),s.push(...c,...l)}return s},[])}function Lt(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function wt(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Ks(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function On({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:s,getState:i,setState:r,isValidConnection:c,edgeUpdaterType:l,onReconnectEnd:u}){const a=$n(e.target),{connectionMode:d,domNode:p,autoPanOnConnect:f,connectionRadius:y,onConnectStart:g,panBy:x,getNodes:h,cancelConnection:w}=i();let N=0,A;const{x:$,y:D}=Se(e),z=a==null?void 0:a.elementFromPoint($,D),k=Lt(l,z),v=p==null?void 0:p.getBoundingClientRect();if(!v||!k)return;let I,_=Se(e,v),P=!1,M=null,S=!1,C=null;const V=Gs({nodes:h(),nodeId:n,handleId:t,handleType:k}),Y=()=>{if(!f)return;const[H,R]=_n(_,v);x({x:H,y:R}),N=requestAnimationFrame(Y)};r({connectionPosition:_,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:k,connectionStartHandle:{nodeId:n,handleId:t,type:k},connectionEndHandle:null}),g==null||g(e,{nodeId:n,handleId:t,handleType:k});function O(H){const{transform:R}=i();_=Se(H,v);const{handle:T,validHandleResult:F}=Ws(H,a,_t(_,R,!1,[1,1]),y,V,U=>Fn(U,d,n,t,s?"target":"source",c,a));if(A=T,P||(Y(),P=!0),C=F.handleDomNode,M=F.connection,S=F.isValid,r({connectionPosition:A&&S?Dn({x:A.x,y:A.y},R):_,connectionStatus:Ks(!!A,S),connectionEndHandle:F.endHandle}),!A&&!S&&!C)return wt(I);M.source!==M.target&&C&&(wt(I),I=C,C.classList.add("connecting","react-flow__handle-connecting"),C.classList.toggle("valid",S),C.classList.toggle("react-flow__handle-valid",S))}function b(H){var R,T;(A||C)&&M&&S&&(o==null||o(M)),(T=(R=i()).onConnectEnd)==null||T.call(R,H),l&&(u==null||u(H)),wt(I),w(),cancelAnimationFrame(N),P=!1,S=!1,M=null,C=null,a.removeEventListener("mousemove",O),a.removeEventListener("mouseup",b),a.removeEventListener("touchmove",O),a.removeEventListener("touchend",b)}a.addEventListener("mousemove",O),a.addEventListener("mouseup",b),a.addEventListener("touchmove",O),a.addEventListener("touchend",b)}const on=()=>!0,qs=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),js=(e,t,n)=>o=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:r}=o;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.handleId)===t&&(r==null?void 0:r.type)===n}},Yn=m.forwardRef(({type:e="source",position:t=B.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:r,onConnect:c,children:l,className:u,onMouseDown:a,onTouchStart:d,...p},f)=>{var v,I;const y=r||null,g=e==="target",x=te(),h=Fs(),{connectOnClick:w,noPanClassName:N}=j(qs,se),{connecting:A,clickConnecting:$}=j(js(h,y,e),se);h||(I=(v=x.getState()).onError)==null||I.call(v,"010",ye.error010());const D=_=>{const{defaultEdgeOptions:P,onConnect:M,hasDefaultEdges:S}=x.getState(),C={...P,..._};if(S){const{edges:V,setEdges:Y}=x.getState();Y(Zs(C,V))}M==null||M(C),c==null||c(C)},z=_=>{if(!h)return;const P=Tn(_);s&&(P&&_.button===0||!P)&&On({event:_,handleId:y,nodeId:h,onConnect:D,isTarget:g,getState:x.getState,setState:x.setState,isValidConnection:n||x.getState().isValidConnection||on}),P?a==null||a(_):d==null||d(_)},k=_=>{const{onClickConnectStart:P,onClickConnectEnd:M,connectionClickStartHandle:S,connectionMode:C,isValidConnection:V}=x.getState();if(!h||!S&&!s)return;if(!S){P==null||P(_,{nodeId:h,handleId:y,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:h,type:e,handleId:y}});return}const Y=$n(_.target),O=n||V||on,{connection:b,isValid:H}=Fn({nodeId:h,id:y,type:e},C,S.nodeId,S.handleId||null,S.type,O,Y);H&&D(b),M==null||M(_),x.setState({connectionClickStartHandle:null})};return E.createElement("div",{"data-handleid":y,"data-nodeid":h,"data-handlepos":t,"data-id":`${h}-${y}-${e}`,className:re(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,u,{source:!g,target:g,connectable:o,connectablestart:s,connectableend:i,connecting:$,connectionindicator:o&&(s&&!A||i&&A)}]),onMouseDown:z,onTouchStart:z,onClick:w?k:void 0,ref:f,...p},l)});Yn.displayName="Handle";var dt=m.memo(Yn);const Un=({data:e,isConnectable:t,targetPosition:n=B.Top,sourcePosition:o=B.Bottom})=>E.createElement(E.Fragment,null,E.createElement(dt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,E.createElement(dt,{type:"source",position:o,isConnectable:t}));Un.displayName="DefaultNode";var $t=m.memo(Un);const Zn=({data:e,isConnectable:t,sourcePosition:n=B.Bottom})=>E.createElement(E.Fragment,null,e==null?void 0:e.label,E.createElement(dt,{type:"source",position:n,isConnectable:t}));Zn.displayName="InputNode";var Wn=m.memo(Zn);const Xn=({data:e,isConnectable:t,targetPosition:n=B.Top})=>E.createElement(E.Fragment,null,E.createElement(dt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Xn.displayName="OutputNode";var Gn=m.memo(Xn);const Ft=()=>null;Ft.displayName="GroupNode";const Qs=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),rt=e=>e.id;function Js(e,t){return se(e.selectedNodes.map(rt),t.selectedNodes.map(rt))&&se(e.selectedEdges.map(rt),t.selectedEdges.map(rt))}const Kn=m.memo(({onSelectionChange:e})=>{const t=te(),{selectedNodes:n,selectedEdges:o}=j(Qs,Js);return m.useEffect(()=>{const s={nodes:n,edges:o};e==null||e(s),t.getState().onSelectionChange.forEach(i=>i(s))},[n,o,e]),null});Kn.displayName="SelectionListener";const er=e=>!!e.onSelectionChange;function tr({onSelectionChange:e}){const t=j(er);return e||t?E.createElement(Kn,{onSelectionChange:e}):null}const nr=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ze(e,t){m.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Z(e,t,n){m.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const or=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:s,onConnectStart:i,onConnectEnd:r,onClickConnectStart:c,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:a,nodesFocusable:d,edgesFocusable:p,edgesUpdatable:f,elevateNodesOnSelect:y,minZoom:g,maxZoom:x,nodeExtent:h,onNodesChange:w,onEdgesChange:N,elementsSelectable:A,connectionMode:$,snapGrid:D,snapToGrid:z,translateExtent:k,connectOnClick:v,defaultEdgeOptions:I,fitView:_,fitViewOptions:P,onNodesDelete:M,onEdgesDelete:S,onNodeDrag:C,onNodeDragStart:V,onNodeDragStop:Y,onSelectionDrag:O,onSelectionDragStart:b,onSelectionDragStop:H,noPanClassName:R,nodeOrigin:T,rfId:F,autoPanOnConnect:U,autoPanOnNodeDrag:W,onError:K,connectionRadius:Q,isValidConnection:ne,nodeDragThreshold:ee})=>{const{setNodes:X,setEdges:ue,setDefaultNodesAndEdges:ce,setMinZoom:de,setMaxZoom:ae,setTranslateExtent:J,setNodeExtent:ge,reset:G}=j(nr,se),L=te();return m.useEffect(()=>{const ie=o==null?void 0:o.map(be=>({...be,...I}));return ce(n,ie),()=>{G()}},[]),Z("defaultEdgeOptions",I,L.setState),Z("connectionMode",$,L.setState),Z("onConnect",s,L.setState),Z("onConnectStart",i,L.setState),Z("onConnectEnd",r,L.setState),Z("onClickConnectStart",c,L.setState),Z("onClickConnectEnd",l,L.setState),Z("nodesDraggable",u,L.setState),Z("nodesConnectable",a,L.setState),Z("nodesFocusable",d,L.setState),Z("edgesFocusable",p,L.setState),Z("edgesUpdatable",f,L.setState),Z("elementsSelectable",A,L.setState),Z("elevateNodesOnSelect",y,L.setState),Z("snapToGrid",z,L.setState),Z("snapGrid",D,L.setState),Z("onNodesChange",w,L.setState),Z("onEdgesChange",N,L.setState),Z("connectOnClick",v,L.setState),Z("fitViewOnInit",_,L.setState),Z("fitViewOnInitOptions",P,L.setState),Z("onNodesDelete",M,L.setState),Z("onEdgesDelete",S,L.setState),Z("onNodeDrag",C,L.setState),Z("onNodeDragStart",V,L.setState),Z("onNodeDragStop",Y,L.setState),Z("onSelectionDrag",O,L.setState),Z("onSelectionDragStart",b,L.setState),Z("onSelectionDragStop",H,L.setState),Z("noPanClassName",R,L.setState),Z("nodeOrigin",T,L.setState),Z("rfId",F,L.setState),Z("autoPanOnConnect",U,L.setState),Z("autoPanOnNodeDrag",W,L.setState),Z("onError",K,L.setState),Z("connectionRadius",Q,L.setState),Z("isValidConnection",ne,L.setState),Z("nodeDragThreshold",ee,L.setState),ze(e,X),ze(t,ue),ze(g,de),ze(x,ae),ze(k,J),ze(h,ge),null},sn={display:"none"},sr={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},qn="react-flow__node-desc",jn="react-flow__edge-desc",rr="react-flow__aria-live",ir=e=>e.ariaLiveMessage;function cr({rfId:e}){const t=j(ir);return E.createElement("div",{id:`${rr}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:sr},t)}function ar({rfId:e,disableKeyboardA11y:t}){return E.createElement(E.Fragment,null,E.createElement("div",{id:`${qn}-${e}`,style:sn},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),E.createElement("div",{id:`${jn}-${e}`,style:sn},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&E.createElement(cr,{rfId:e}))}var nt=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[r,c]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),a=u.reduce((d,p)=>d.concat(...p),[]);return[u,a]}return[[],[]]},[e]);return m.useEffect(()=>{const l=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||l;if(e!==null){const a=f=>{if(s.current=f.ctrlKey||f.metaKey||f.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&At(f))return!1;const g=cn(f.code,c);i.current.add(f[g]),rn(r,i.current,!1)&&(f.preventDefault(),o(!0))},d=f=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&At(f))return!1;const g=cn(f.code,c);rn(r,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(f[g]),f.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),o(!1)};return u==null||u.addEventListener("keydown",a),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",p),()=>{u==null||u.removeEventListener("keydown",a),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",p)}}},[e,o]),n};function rn(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(s=>t.has(s)))}function cn(e,t){return t.includes(e)?"code":"key"}function Qn(e,t,n,o){var c,l;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),r=Ye(i,o);return Qn(i,t,{x:(n.x??0)+r.x,y:(n.y??0)+r.y,z:(((c=i[q])==null?void 0:c.z)??0)>(n.z??0)?((l=i[q])==null?void 0:l.z)??0:n.z??0},o)}function Jn(e,t,n){e.forEach(o=>{var i;const s=o.parentNode||o.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||n!=null&&n[o.id]){const{x:r,y:c,z:l}=Qn(o,e,{...o.position,z:((i=o[q])==null?void 0:i.z)??0},t);o.positionAbsolute={x:r,y:c},o[q].z=l,n!=null&&n[o.id]&&(o[q].isParent=!0)}})}function Et(e,t,n,o){const s=new Map,i={},r=o?1e3:0;return e.forEach(c=>{var f;const l=(le(c.zIndex)?c.zIndex:0)+(c.selected?r:0),u=t.get(c.id),a={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},d=c.parentNode||c.parentId;d&&(i[d]=!0);const p=(u==null?void 0:u.type)&&(u==null?void 0:u.type)!==c.type;Object.defineProperty(a,q,{enumerable:!1,value:{handleBounds:p||(f=u==null?void 0:u[q])==null?void 0:f.handleBounds,z:l}}),s.set(c.id,a)}),Jn(s,n,i),s}function eo(e,t={}){const{getNodes:n,width:o,height:s,minZoom:i,maxZoom:r,d3Zoom:c,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:a,nodeOrigin:d}=e(),p=t.initial&&!u&&a;if(c&&l&&(p||!t.initial)){const y=n().filter(x=>{var w;const h=t.includeHiddenNodes?x.width&&x.height:!x.hidden;return(w=t.nodes)!=null&&w.length?h&&t.nodes.some(N=>N.id===x.id):h}),g=y.every(x=>x.width&&x.height);if(y.length>0&&g){const x=Bt(y,d),{x:h,y:w,zoom:N}=Bn(x,o,s,t.minZoom??i,t.maxZoom??r,t.padding??.1),A=Oe.translate(h,w).scale(N);return typeof t.duration=="number"&&t.duration>0?c.transform($e(l,t.duration),A):c.transform(l,A),!0}}return!1}function lr(e,t){return e.forEach(n=>{const o=t.get(n.id);o&&t.set(o.id,{...o,[q]:o[q],selected:n.selected})}),new Map(t)}function ur(e,t){return t.map(n=>{const o=e.find(s=>s.id===n.id);return o&&(n.selected=o.selected),n})}function it({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:s,edges:i,onNodesChange:r,onEdgesChange:c,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&o({nodeInternals:lr(e,s)}),r==null||r(e)),t!=null&&t.length&&(u&&o({edges:ur(t,i)}),c==null||c(t))}const Ve=()=>{},dr={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,getZoom:()=>1,setViewport:Ve,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},fr=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),gr=()=>{const e=te(),{d3Zoom:t,d3Selection:n}=j(fr,se);return m.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy($e(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy($e(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,i)=>t.scaleTo($e(n,i==null?void 0:i.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,i)=>{const[r,c,l]=e.getState().transform,u=Oe.translate(s.x??r,s.y??c).scale(s.zoom??l);t.transform($e(n,i==null?void 0:i.duration),u)},getViewport:()=>{const[s,i,r]=e.getState().transform;return{x:s,y:i,zoom:r}},fitView:s=>eo(e.getState,s),setCenter:(s,i,r)=>{const{width:c,height:l,maxZoom:u}=e.getState(),a=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:u,d=c/2-s*a,p=l/2-i*a,f=Oe.translate(d,p).scale(a);t.transform($e(n,r==null?void 0:r.duration),f)},fitBounds:(s,i)=>{const{width:r,height:c,minZoom:l,maxZoom:u}=e.getState(),{x:a,y:d,zoom:p}=Bn(s,r,c,l,u,(i==null?void 0:i.padding)??.1),f=Oe.translate(a,d).scale(p);t.transform($e(n,i==null?void 0:i.duration),f)},project:s=>{const{transform:i,snapToGrid:r,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),_t(s,i,r,c)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:r,snapGrid:c,domNode:l}=e.getState();if(!l)return s;const{x:u,y:a}=l.getBoundingClientRect(),d={x:s.x-u,y:s.y-a};return _t(d,i,r,c)},flowToScreenPosition:s=>{const{transform:i,domNode:r}=e.getState();if(!r)return s;const{x:c,y:l}=r.getBoundingClientRect(),u=Dn(s,i);return{x:u.x+c,y:u.y+l}},viewportInitialized:!0}:dr,[t,n])};function Ot(){const e=gr(),t=te(),n=m.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),o=m.useCallback(g=>t.getState().nodeInternals.get(g),[]),s=m.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(x=>({...x}))},[]),i=m.useCallback(g=>{const{edges:x=[]}=t.getState();return x.find(h=>h.id===g)},[]),r=m.useCallback(g=>{const{getNodes:x,setNodes:h,hasDefaultNodes:w,onNodesChange:N}=t.getState(),A=x(),$=typeof g=="function"?g(A):g;if(w)h($);else if(N){const D=$.length===0?A.map(z=>({type:"remove",id:z.id})):$.map(z=>({item:z,type:"reset"}));N(D)}},[]),c=m.useCallback(g=>{const{edges:x=[],setEdges:h,hasDefaultEdges:w,onEdgesChange:N}=t.getState(),A=typeof g=="function"?g(x):g;if(w)h(A);else if(N){const $=A.length===0?x.map(D=>({type:"remove",id:D.id})):A.map(D=>({item:D,type:"reset"}));N($)}},[]),l=m.useCallback(g=>{const x=Array.isArray(g)?g:[g],{getNodes:h,setNodes:w,hasDefaultNodes:N,onNodesChange:A}=t.getState();if(N){const D=[...h(),...x];w(D)}else if(A){const $=x.map(D=>({item:D,type:"add"}));A($)}},[]),u=m.useCallback(g=>{const x=Array.isArray(g)?g:[g],{edges:h=[],setEdges:w,hasDefaultEdges:N,onEdgesChange:A}=t.getState();if(N)w([...h,...x]);else if(A){const $=x.map(D=>({item:D,type:"add"}));A($)}},[]),a=m.useCallback(()=>{const{getNodes:g,edges:x=[],transform:h}=t.getState(),[w,N,A]=h;return{nodes:g().map($=>({...$})),edges:x.map($=>({...$})),viewport:{x:w,y:N,zoom:A}}},[]),d=m.useCallback(({nodes:g,edges:x})=>{const{nodeInternals:h,getNodes:w,edges:N,hasDefaultNodes:A,hasDefaultEdges:$,onNodesDelete:D,onEdgesDelete:z,onNodesChange:k,onEdgesChange:v}=t.getState(),I=(g||[]).map(C=>C.id),_=(x||[]).map(C=>C.id),P=w().reduce((C,V)=>{const Y=V.parentNode||V.parentId,O=!I.includes(V.id)&&Y&&C.find(H=>H.id===Y);return(typeof V.deletable=="boolean"?V.deletable:!0)&&(I.includes(V.id)||O)&&C.push(V),C},[]),M=N.filter(C=>typeof C.deletable=="boolean"?C.deletable:!0),S=M.filter(C=>_.includes(C.id));if(P||S){const C=Vn(P,M),V=[...S,...C],Y=V.reduce((O,b)=>(O.includes(b.id)||O.push(b.id),O),[]);if(($||A)&&($&&t.setState({edges:N.filter(O=>!Y.includes(O.id))}),A&&(P.forEach(O=>{h.delete(O.id)}),t.setState({nodeInternals:new Map(h)}))),Y.length>0&&(z==null||z(V),v&&v(Y.map(O=>({id:O,type:"remove"})))),P.length>0&&(D==null||D(P),k)){const O=P.map(b=>({id:b.id,type:"remove"}));k(O)}}},[]),p=m.useCallback(g=>{const x=Hs(g),h=x?null:t.getState().nodeInternals.get(g.id);return!x&&!h?[null,null,x]:[x?g:jt(h),h,x]},[]),f=m.useCallback((g,x=!0,h)=>{const[w,N,A]=p(g);return w?(h||t.getState().getNodes()).filter($=>{if(!A&&($.id===N.id||!$.positionAbsolute))return!1;const D=jt($),z=vt(D,w);return x&&z>0||z>=w.width*w.height}):[]},[]),y=m.useCallback((g,x,h=!0)=>{const[w]=p(g);if(!w)return!1;const N=vt(w,x);return h&&N>0||N>=w.width*w.height},[]);return m.useMemo(()=>({...e,getNodes:n,getNode:o,getEdges:s,getEdge:i,setNodes:r,setEdges:c,addNodes:l,addEdges:u,toObject:a,deleteElements:d,getIntersectingNodes:f,isNodeIntersecting:y}),[e,n,o,s,i,r,c,l,u,a,d,f,y])}const pr={actInsideInputWithModifier:!1};var mr=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=te(),{deleteElements:o}=Ot(),s=nt(e,pr),i=nt(t);m.useEffect(()=>{if(s){const{edges:r,getNodes:c}=n.getState(),l=c().filter(a=>a.selected),u=r.filter(a=>a.selected);o({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function hr(e){const t=te();m.useEffect(()=>{let n;const o=()=>{var i,r;if(!e.current)return;const s=Pt(e.current);(s.height===0||s.width===0)&&((r=(i=t.getState()).onError)==null||r.call(i,"004",ye.error004())),t.setState({width:s.width||500,height:s.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver(()=>o()),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}},[])}const Yt={position:"absolute",width:"100%",height:"100%",top:0,left:0},yr=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,ct=e=>({x:e.x,y:e.y,zoom:e.k}),Be=(e,t)=>e.target.closest(`.${t}`),an=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ln=e=>{const t=e.ctrlKey&&at()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},xr=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),wr=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:r=!1,panOnScrollSpeed:c=.5,panOnScrollMode:l=Ie.Free,zoomOnDoubleClick:u=!0,elementsSelectable:a,panOnDrag:d=!0,defaultViewport:p,translateExtent:f,minZoom:y,maxZoom:g,zoomActivationKeyCode:x,preventScrolling:h=!0,children:w,noWheelClassName:N,noPanClassName:A})=>{const $=m.useRef(),D=te(),z=m.useRef(!1),k=m.useRef(!1),v=m.useRef(null),I=m.useRef({x:0,y:0,zoom:0}),{d3Zoom:_,d3Selection:P,d3ZoomHandler:M,userSelectionActive:S}=j(xr,se),C=nt(x),V=m.useRef(0),Y=m.useRef(!1),O=m.useRef();return hr(v),m.useEffect(()=>{if(v.current){const b=v.current.getBoundingClientRect(),H=jo().scaleExtent([y,g]).translateExtent(f),R=En(v.current).call(H),T=Oe.translate(p.x,p.y).scale(We(p.zoom,y,g)),F=[[0,0],[b.width,b.height]],U=H.constrain()(T,F,f);H.transform(R,U),H.wheelDelta(ln),D.setState({d3Zoom:H,d3Selection:R,d3ZoomHandler:R.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:v.current.closest(".react-flow")})}},[]),m.useEffect(()=>{P&&_&&(r&&!C&&!S?P.on("wheel.zoom",b=>{if(Be(b,N))return!1;b.preventDefault(),b.stopImmediatePropagation();const H=P.property("__zoom").k||1;if(b.ctrlKey&&i){const ne=Qo(b),ee=ln(b),X=H*Math.pow(2,ee);_.scaleTo(P,X,ne,b);return}const R=b.deltaMode===1?20:1;let T=l===Ie.Vertical?0:b.deltaX*R,F=l===Ie.Horizontal?0:b.deltaY*R;!at()&&b.shiftKey&&l!==Ie.Vertical&&(T=b.deltaY*R,F=0),_.translateBy(P,-(T/H)*c,-(F/H)*c,{internal:!0});const U=ct(P.property("__zoom")),{onViewportChangeStart:W,onViewportChange:K,onViewportChangeEnd:Q}=D.getState();clearTimeout(O.current),Y.current||(Y.current=!0,t==null||t(b,U),W==null||W(U)),Y.current&&(e==null||e(b,U),K==null||K(U),O.current=setTimeout(()=>{n==null||n(b,U),Q==null||Q(U),Y.current=!1},150))},{passive:!1}):typeof M<"u"&&P.on("wheel.zoom",function(b,H){if(!h&&b.type==="wheel"&&!b.ctrlKey||Be(b,N))return null;b.preventDefault(),M.call(this,b,H)},{passive:!1}))},[S,r,l,P,_,M,C,i,h,N,t,e,n]),m.useEffect(()=>{_&&_.on("start",b=>{var T,F;if(!b.sourceEvent||b.sourceEvent.internal)return null;V.current=(T=b.sourceEvent)==null?void 0:T.button;const{onViewportChangeStart:H}=D.getState(),R=ct(b.transform);z.current=!0,I.current=R,((F=b.sourceEvent)==null?void 0:F.type)==="mousedown"&&D.setState({paneDragging:!0}),H==null||H(R),t==null||t(b.sourceEvent,R)})},[_,t]),m.useEffect(()=>{_&&(S&&!z.current?_.on("zoom",null):S||_.on("zoom",b=>{var R;const{onViewportChange:H}=D.getState();if(D.setState({transform:[b.transform.x,b.transform.y,b.transform.k]}),k.current=!!(o&&an(d,V.current??0)),(e||H)&&!((R=b.sourceEvent)!=null&&R.internal)){const T=ct(b.transform);H==null||H(T),e==null||e(b.sourceEvent,T)}}))},[S,_,e,d,o]),m.useEffect(()=>{_&&_.on("end",b=>{if(!b.sourceEvent||b.sourceEvent.internal)return null;const{onViewportChangeEnd:H}=D.getState();if(z.current=!1,D.setState({paneDragging:!1}),o&&an(d,V.current??0)&&!k.current&&o(b.sourceEvent),k.current=!1,(n||H)&&yr(I.current,b.transform)){const R=ct(b.transform);I.current=R,clearTimeout($.current),$.current=setTimeout(()=>{H==null||H(R),n==null||n(b.sourceEvent,R)},r?150:0)}})},[_,r,d,n,o]),m.useEffect(()=>{_&&_.filter(b=>{const H=C||s,R=i&&b.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&b.button===1&&b.type==="mousedown"&&(Be(b,"react-flow__node")||Be(b,"react-flow__edge")))return!0;if(!d&&!H&&!r&&!u&&!i||S||!u&&b.type==="dblclick"||Be(b,N)&&b.type==="wheel"||Be(b,A)&&(b.type!=="wheel"||r&&b.type==="wheel"&&!C)||!i&&b.ctrlKey&&b.type==="wheel"||!H&&!r&&!R&&b.type==="wheel"||!d&&(b.type==="mousedown"||b.type==="touchstart")||Array.isArray(d)&&!d.includes(b.button)&&b.type==="mousedown")return!1;const T=Array.isArray(d)&&d.includes(b.button)||!b.button||b.button<=1;return(!b.ctrlKey||b.type==="wheel")&&T})},[S,_,s,i,r,u,d,a,C]),E.createElement("div",{className:"react-flow__renderer",ref:v,style:Yt},w)},Er=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Sr(){const{userSelectionActive:e,userSelectionRect:t}=j(Er,se);return e&&t?E.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function un(e,t){const n=t.parentNode||t.parentId,o=e.find(s=>s.id===n);if(o){const s=t.position.x+t.width-o.width,i=t.position.y+t.height-o.height;if(s>0||i>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,s>0&&(o.style.width+=s),i>0&&(o.style.height+=i),t.position.x<0){const r=Math.abs(t.position.x);o.position.x=o.position.x-r,o.style.width+=r,t.position.x=0}if(t.position.y<0){const r=Math.abs(t.position.y);o.position.y=o.position.y-r,o.style.height+=r,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function br(e,t){if(e.some(o=>o.type==="reset"))return e.filter(o=>o.type==="reset").map(o=>o.item);const n=e.filter(o=>o.type==="add").map(o=>o.item);return t.reduce((o,s)=>{const i=e.filter(c=>c.id===s.id);if(i.length===0)return o.push(s),o;const r={...s};for(const c of i)if(c)switch(c.type){case"select":{r.selected=c.selected;break}case"position":{typeof c.position<"u"&&(r.position=c.position),typeof c.positionAbsolute<"u"&&(r.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(r.dragging=c.dragging),r.expandParent&&un(o,r);break}case"dimensions":{typeof c.dimensions<"u"&&(r.width=c.dimensions.width,r.height=c.dimensions.height),typeof c.updateStyle<"u"&&(r.style={...r.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(r.resizing=c.resizing),r.expandParent&&un(o,r);break}case"remove":return o}return o.push(r),o},n)}function to(e,t){return br(e,t)}const we=(e,t)=>({id:e,type:"select",selected:t});function Fe(e,t){return e.reduce((n,o)=>{const s=t.includes(o.id);return!o.selected&&s?(o.selected=!0,n.push(we(o.id,!0))):o.selected&&!s&&(o.selected=!1,n.push(we(o.id,!1))),n},[])}const St=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Nr=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),no=m.memo(({isSelecting:e,selectionMode:t=tt.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:r,onPaneScroll:c,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:a,children:d})=>{const p=m.useRef(null),f=te(),y=m.useRef(0),g=m.useRef(0),x=m.useRef(),{userSelectionActive:h,elementsSelectable:w,dragging:N}=j(Nr,se),A=()=>{f.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,g.current=0},$=M=>{i==null||i(M),f.getState().resetSelectedElements(),f.setState({nodesSelectionActive:!1})},D=M=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){M.preventDefault();return}r==null||r(M)},z=c?M=>c(M):void 0,k=M=>{const{resetSelectedElements:S,domNode:C}=f.getState();if(x.current=C==null?void 0:C.getBoundingClientRect(),!w||!e||M.button!==0||M.target!==p.current||!x.current)return;const{x:V,y:Y}=Se(M,x.current);S(),f.setState({userSelectionRect:{width:0,height:0,startX:V,startY:Y,x:V,y:Y}}),o==null||o(M)},v=M=>{const{userSelectionRect:S,nodeInternals:C,edges:V,transform:Y,onNodesChange:O,onEdgesChange:b,nodeOrigin:H,getNodes:R}=f.getState();if(!e||!x.current||!S)return;f.setState({userSelectionActive:!0,nodesSelectionActive:!1});const T=Se(M,x.current),F=S.startX??0,U=S.startY??0,W={...S,x:T.x<F?T.x:F,y:T.y<U?T.y:U,width:Math.abs(T.x-F),height:Math.abs(T.y-U)},K=R(),Q=zn(C,W,Y,t===tt.Partial,!0,H),ne=Vn(Q,V).map(X=>X.id),ee=Q.map(X=>X.id);if(y.current!==ee.length){y.current=ee.length;const X=Fe(K,ee);X.length&&(O==null||O(X))}if(g.current!==ne.length){g.current=ne.length;const X=Fe(V,ne);X.length&&(b==null||b(X))}f.setState({userSelectionRect:W})},I=M=>{if(M.button!==0)return;const{userSelectionRect:S}=f.getState();!h&&S&&M.target===p.current&&($==null||$(M)),f.setState({nodesSelectionActive:y.current>0}),A(),s==null||s(M)},_=M=>{h&&(f.setState({nodesSelectionActive:y.current>0}),s==null||s(M)),A()},P=w&&(e||h);return E.createElement("div",{className:re(["react-flow__pane",{dragging:N,selection:e}]),onClick:P?void 0:St($,p),onContextMenu:St(D,p),onWheel:St(z,p),onMouseEnter:P?void 0:l,onMouseDown:P?k:void 0,onMouseMove:P?v:u,onMouseUp:P?I:void 0,onMouseLeave:P?_:a,ref:p,style:Yt},d,E.createElement(Sr,null))});no.displayName="Pane";function oo(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return o?o.selected?!0:oo(o,t):!1}function dn(e,t,n){let o=e;do{if(o!=null&&o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function vr(e,t,n,o){return Array.from(e.values()).filter(s=>(s.selected||s.id===o)&&(!s.parentNode||s.parentId||!oo(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var i,r;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=s.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((r=s.positionAbsolute)==null?void 0:r.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function Ar(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function so(e,t,n,o,s=[0,0],i){const r=Ar(e,e.extent||o);let c=r;const l=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(l&&e.width&&e.height){const d=n.get(l),{x:p,y:f}=Ye(d,s).positionAbsolute;c=d&&le(p)&&le(f)&&le(d.width)&&le(d.height)?[[p+e.width*s[0],f+e.height*s[1]],[p+d.width-e.width+e.width*s[0],f+d.height-e.height+e.height*s[1]]]:c}else i==null||i("005",ye.error005()),c=r;else if(e.extent&&l&&e.extent!=="parent"){const d=n.get(l),{x:p,y:f}=Ye(d,s).positionAbsolute;c=[[e.extent[0][0]+p,e.extent[0][1]+f],[e.extent[1][0]+p,e.extent[1][1]+f]]}let u={x:0,y:0};if(l){const d=n.get(l);u=Ye(d,s).positionAbsolute}const a=c&&c!=="parent"?Ht(t,c):t;return{position:{x:a.x-u.x,y:a.y-u.y},positionAbsolute:a}}function bt({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?o.find(s=>s.id===e):o[0],o]}const fn=(e,t,n,o)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const i=Array.from(s),r=t.getBoundingClientRect(),c={x:r.width*o[0],y:r.height*o[1]};return i.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-r.left-c.x)/n,y:(u.top-r.top-c.y)/n,...Pt(l)}})};function Qe(e,t,n){return n===void 0?n:o=>{const s=t().nodeInternals.get(e);s&&n(o,{...s})}}function It({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:r,nodeInternals:c,onError:l}=t.getState(),u=c.get(e);if(!u){l==null||l("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&r)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var a;return(a=o==null?void 0:o.current)==null?void 0:a.blur()})):s([e])}function Mr(){const e=te();return m.useCallback(({sourceEvent:n})=>{const{transform:o,snapGrid:s,snapToGrid:i}=e.getState(),r=n.touches?n.touches[0].clientX:n.clientX,c=n.touches?n.touches[0].clientY:n.clientY,l={x:(r-o[0])/o[2],y:(c-o[1])/o[2]};return{xSnapped:i?s[0]*Math.round(l.x/s[0]):l.x,ySnapped:i?s[1]*Math.round(l.y/s[1]):l.y,...l}},[])}function Nt(e){return(t,n,o)=>e==null?void 0:e(t,o)}function ro({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:s,isSelectable:i,selectNodesOnDrag:r}){const c=te(),[l,u]=m.useState(!1),a=m.useRef([]),d=m.useRef({x:null,y:null}),p=m.useRef(0),f=m.useRef(null),y=m.useRef({x:0,y:0}),g=m.useRef(null),x=m.useRef(!1),h=m.useRef(!1),w=m.useRef(!1),N=Mr();return m.useEffect(()=>{if(e!=null&&e.current){const A=En(e.current),$=({x:k,y:v})=>{const{nodeInternals:I,onNodeDrag:_,onSelectionDrag:P,updateNodePositions:M,nodeExtent:S,snapGrid:C,snapToGrid:V,nodeOrigin:Y,onError:O}=c.getState();d.current={x:k,y:v};let b=!1,H={x:0,y:0,x2:0,y2:0};if(a.current.length>1&&S){const T=Bt(a.current,Y);H=Rt(T)}if(a.current=a.current.map(T=>{const F={x:k-T.distance.x,y:v-T.distance.y};V&&(F.x=C[0]*Math.round(F.x/C[0]),F.y=C[1]*Math.round(F.y/C[1]));const U=[[S[0][0],S[0][1]],[S[1][0],S[1][1]]];a.current.length>1&&S&&!T.extent&&(U[0][0]=T.positionAbsolute.x-H.x+S[0][0],U[1][0]=T.positionAbsolute.x+(T.width??0)-H.x2+S[1][0],U[0][1]=T.positionAbsolute.y-H.y+S[0][1],U[1][1]=T.positionAbsolute.y+(T.height??0)-H.y2+S[1][1]);const W=so(T,F,I,U,Y,O);return b=b||T.position.x!==W.position.x||T.position.y!==W.position.y,T.position=W.position,T.positionAbsolute=W.positionAbsolute,T}),!b)return;M(a.current,!0,!0),u(!0);const R=s?_:Nt(P);if(R&&g.current){const[T,F]=bt({nodeId:s,dragItems:a.current,nodeInternals:I});R(g.current,T,F)}},D=()=>{if(!f.current)return;const[k,v]=_n(y.current,f.current);if(k!==0||v!==0){const{transform:I,panBy:_}=c.getState();d.current.x=(d.current.x??0)-k/I[2],d.current.y=(d.current.y??0)-v/I[2],_({x:k,y:v})&&$(d.current)}p.current=requestAnimationFrame(D)},z=k=>{var Y;const{nodeInternals:v,multiSelectionActive:I,nodesDraggable:_,unselectNodesAndEdges:P,onNodeDragStart:M,onSelectionDragStart:S}=c.getState();h.current=!0;const C=s?M:Nt(S);(!r||!i)&&!I&&s&&((Y=v.get(s))!=null&&Y.selected||P()),s&&i&&r&&It({id:s,store:c,nodeRef:e});const V=N(k);if(d.current=V,a.current=vr(v,_,V,s),C&&a.current){const[O,b]=bt({nodeId:s,dragItems:a.current,nodeInternals:v});C(k.sourceEvent,O,b)}};if(t)A.on(".drag",null);else{const k=Jo().on("start",v=>{const{domNode:I,nodeDragThreshold:_}=c.getState();_===0&&z(v),w.current=!1;const P=N(v);d.current=P,f.current=(I==null?void 0:I.getBoundingClientRect())||null,y.current=Se(v.sourceEvent,f.current)}).on("drag",v=>{var M,S;const I=N(v),{autoPanOnNodeDrag:_,nodeDragThreshold:P}=c.getState();if(v.sourceEvent.type==="touchmove"&&v.sourceEvent.touches.length>1&&(w.current=!0),!w.current){if(!x.current&&h.current&&_&&(x.current=!0,D()),!h.current){const C=I.xSnapped-(((M=d==null?void 0:d.current)==null?void 0:M.x)??0),V=I.ySnapped-(((S=d==null?void 0:d.current)==null?void 0:S.y)??0);Math.sqrt(C*C+V*V)>P&&z(v)}(d.current.x!==I.xSnapped||d.current.y!==I.ySnapped)&&a.current&&h.current&&(g.current=v.sourceEvent,y.current=Se(v.sourceEvent,f.current),$(I))}}).on("end",v=>{if(!(!h.current||w.current)&&(u(!1),x.current=!1,h.current=!1,cancelAnimationFrame(p.current),a.current)){const{updateNodePositions:I,nodeInternals:_,onNodeDragStop:P,onSelectionDragStop:M}=c.getState(),S=s?P:Nt(M);if(I(a.current,!1,!1),S){const[C,V]=bt({nodeId:s,dragItems:a.current,nodeInternals:_});S(v.sourceEvent,C,V)}}}).filter(v=>{const I=v.target;return!v.button&&(!n||!dn(I,`.${n}`,e))&&(!o||dn(I,o,e))});return A.call(k),()=>{A.on(".drag",null)}}}},[e,t,n,o,i,c,s,r,N]),l}function io(){const e=te();return m.useCallback(n=>{const{nodeInternals:o,nodeExtent:s,updateNodePositions:i,getNodes:r,snapToGrid:c,snapGrid:l,onError:u,nodesDraggable:a}=e.getState(),d=r().filter(w=>w.selected&&(w.draggable||a&&typeof w.draggable>"u")),p=c?l[0]:5,f=c?l[1]:5,y=n.isShiftPressed?4:1,g=n.x*p*y,x=n.y*f*y,h=d.map(w=>{if(w.positionAbsolute){const N={x:w.positionAbsolute.x+g,y:w.positionAbsolute.y+x};c&&(N.x=l[0]*Math.round(N.x/l[0]),N.y=l[1]*Math.round(N.y/l[1]));const{positionAbsolute:A,position:$}=so(w,N,o,s,void 0,u);w.position=$,w.positionAbsolute=A}return w});i(h,!0,!1)},[])}const Ue={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Je=e=>{const t=({id:n,type:o,data:s,xPos:i,yPos:r,xPosOrigin:c,yPosOrigin:l,selected:u,onClick:a,onMouseEnter:d,onMouseMove:p,onMouseLeave:f,onContextMenu:y,onDoubleClick:g,style:x,className:h,isDraggable:w,isSelectable:N,isConnectable:A,isFocusable:$,selectNodesOnDrag:D,sourcePosition:z,targetPosition:k,hidden:v,resizeObserver:I,dragHandle:_,zIndex:P,isParent:M,noDragClassName:S,noPanClassName:C,initialized:V,disableKeyboardA11y:Y,ariaLabel:O,rfId:b,hasHandleBounds:H})=>{const R=te(),T=m.useRef(null),F=m.useRef(null),U=m.useRef(z),W=m.useRef(k),K=m.useRef(o),Q=N||w||a||d||p||f,ne=io(),ee=Qe(n,R.getState,d),X=Qe(n,R.getState,p),ue=Qe(n,R.getState,f),ce=Qe(n,R.getState,y),de=Qe(n,R.getState,g),ae=G=>{const{nodeDragThreshold:L}=R.getState();if(N&&(!D||!w||L>0)&&It({id:n,store:R,nodeRef:T}),a){const ie=R.getState().nodeInternals.get(n);ie&&a(G,{...ie})}},J=G=>{if(!At(G)&&!Y)if(In.includes(G.key)&&N){const L=G.key==="Escape";It({id:n,store:R,unselect:L,nodeRef:T})}else w&&u&&Object.prototype.hasOwnProperty.call(Ue,G.key)&&(R.setState({ariaLiveMessage:`Moved selected node ${G.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~r}`}),ne({x:Ue[G.key].x,y:Ue[G.key].y,isShiftPressed:G.shiftKey}))};m.useEffect(()=>()=>{F.current&&(I==null||I.unobserve(F.current),F.current=null)},[]),m.useEffect(()=>{if(T.current&&!v){const G=T.current;(!V||!H||F.current!==G)&&(F.current&&(I==null||I.unobserve(F.current)),I==null||I.observe(G),F.current=G)}},[v,V,H]),m.useEffect(()=>{const G=K.current!==o,L=U.current!==z,ie=W.current!==k;T.current&&(G||L||ie)&&(G&&(K.current=o),L&&(U.current=z),ie&&(W.current=k),R.getState().updateNodeDimensions([{id:n,nodeElement:T.current,forceUpdate:!0}]))},[n,o,z,k]);const ge=ro({nodeRef:T,disabled:v||!w,noDragClassName:S,handleSelector:_,nodeId:n,isSelectable:N,selectNodesOnDrag:D});return v?null:E.createElement("div",{className:re(["react-flow__node",`react-flow__node-${o}`,{[C]:w},h,{selected:u,selectable:N,parent:M,dragging:ge}]),ref:T,style:{zIndex:P,transform:`translate(${c}px,${l}px)`,pointerEvents:Q?"all":"none",visibility:V?"visible":"hidden",...x},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ee,onMouseMove:X,onMouseLeave:ue,onContextMenu:ce,onClick:ae,onDoubleClick:de,onKeyDown:$?J:void 0,tabIndex:$?0:void 0,role:$?"button":void 0,"aria-describedby":Y?void 0:`${qn}-${b}`,"aria-label":O},E.createElement(Ls,{value:n},E.createElement(e,{id:n,data:s,type:o,xPos:i,yPos:r,selected:u,isConnectable:A,sourcePosition:z,targetPosition:k,dragging:ge,dragHandle:_,zIndex:P})))};return t.displayName="NodeWrapper",m.memo(t)};const Cr=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Bt(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function _r({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=te(),{width:s,height:i,x:r,y:c,transformString:l,userSelectionActive:u}=j(Cr,se),a=io(),d=m.useRef(null);if(m.useEffect(()=>{var y;n||(y=d.current)==null||y.focus({preventScroll:!0})},[n]),ro({nodeRef:d}),u||!s||!i)return null;const p=e?y=>{const g=o.getState().getNodes().filter(x=>x.selected);e(y,g)}:void 0,f=y=>{Object.prototype.hasOwnProperty.call(Ue,y.key)&&a({x:Ue[y.key].x,y:Ue[y.key].y,isShiftPressed:y.shiftKey})};return E.createElement("div",{className:re(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l}},E.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:i,top:c,left:r}}))}var $r=m.memo(_r);const Ir=e=>e.nodesSelectionActive,co=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:r,deleteKeyCode:c,onMove:l,onMoveStart:u,onMoveEnd:a,selectionKeyCode:d,selectionOnDrag:p,selectionMode:f,onSelectionStart:y,onSelectionEnd:g,multiSelectionKeyCode:x,panActivationKeyCode:h,zoomActivationKeyCode:w,elementsSelectable:N,zoomOnScroll:A,zoomOnPinch:$,panOnScroll:D,panOnScrollSpeed:z,panOnScrollMode:k,zoomOnDoubleClick:v,panOnDrag:I,defaultViewport:_,translateExtent:P,minZoom:M,maxZoom:S,preventScrolling:C,onSelectionContextMenu:V,noWheelClassName:Y,noPanClassName:O,disableKeyboardA11y:b})=>{const H=j(Ir),R=nt(d),T=nt(h),F=T||I,U=T||D,W=R||p&&F!==!0;return mr({deleteKeyCode:c,multiSelectionKeyCode:x}),E.createElement(wr,{onMove:l,onMoveStart:u,onMoveEnd:a,onPaneContextMenu:i,elementsSelectable:N,zoomOnScroll:A,zoomOnPinch:$,panOnScroll:U,panOnScrollSpeed:z,panOnScrollMode:k,zoomOnDoubleClick:v,panOnDrag:!R&&F,defaultViewport:_,translateExtent:P,minZoom:M,maxZoom:S,zoomActivationKeyCode:w,preventScrolling:C,noWheelClassName:Y,noPanClassName:O},E.createElement(no,{onSelectionStart:y,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:r,panOnDrag:F,isSelecting:!!W,selectionMode:f},e,H&&E.createElement($r,{onSelectionContextMenu:V,noPanClassName:O,disableKeyboardA11y:b})))};co.displayName="FlowRenderer";var Tr=m.memo(co);function Pr(e){return j(m.useCallback(n=>e?zn(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function Hr(e){const t={input:Je(e.input||Wn),default:Je(e.default||$t),output:Je(e.output||Gn),group:Je(e.group||Ft)},n={},o=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=Je(e[i]||$t),s),n);return{...t,...o}}const Rr=({x:e,y:t,width:n,height:o,origin:s})=>!n||!o?{x:e,y:t}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:t}:{x:e-n*s[0],y:t-o*s[1]},kr=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ao=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,updateNodeDimensions:i,onError:r}=j(kr,se),c=Pr(e.onlyRenderVisibleElements),l=m.useRef(),u=m.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const a=new ResizeObserver(d=>{const p=d.map(f=>({id:f.target.getAttribute("data-id"),nodeElement:f.target,forceUpdate:!0}));i(p)});return l.current=a,a},[]);return m.useEffect(()=>()=>{var a;(a=l==null?void 0:l.current)==null||a.disconnect()},[]),E.createElement("div",{className:"react-flow__nodes",style:Yt},c.map(a=>{var $,D,z;let d=a.type||"default";e.nodeTypes[d]||(r==null||r("003",ye.error003(d)),d="default");const p=e.nodeTypes[d]||e.nodeTypes.default,f=!!(a.draggable||t&&typeof a.draggable>"u"),y=!!(a.selectable||s&&typeof a.selectable>"u"),g=!!(a.connectable||n&&typeof a.connectable>"u"),x=!!(a.focusable||o&&typeof a.focusable>"u"),h=e.nodeExtent?Ht(a.positionAbsolute,e.nodeExtent):a.positionAbsolute,w=(h==null?void 0:h.x)??0,N=(h==null?void 0:h.y)??0,A=Rr({x:w,y:N,width:a.width??0,height:a.height??0,origin:e.nodeOrigin});return E.createElement(p,{key:a.id,id:a.id,className:a.className,style:a.style,type:d,data:a.data,sourcePosition:a.sourcePosition||B.Bottom,targetPosition:a.targetPosition||B.Top,hidden:a.hidden,xPos:w,yPos:N,xPosOrigin:A.x,yPosOrigin:A.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!a.selected,isDraggable:f,isSelectable:y,isConnectable:g,isFocusable:x,resizeObserver:u,dragHandle:a.dragHandle,zIndex:(($=a[q])==null?void 0:$.z)??0,isParent:!!((D=a[q])!=null&&D.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!a.width&&!!a.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:a.ariaLabel,hasHandleBounds:!!((z=a[q])!=null&&z.handleBounds)})}))};ao.displayName="NodeRenderer";var Dr=m.memo(ao);const zr=(e,t,n)=>n===B.Left?e-t:n===B.Right?e+t:e,Vr=(e,t,n)=>n===B.Top?e-t:n===B.Bottom?e+t:e,gn="react-flow__edgeupdater",pn=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:s,onMouseEnter:i,onMouseOut:r,type:c})=>E.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:r,className:re([gn,`${gn}-${c}`]),cx:zr(t,o,e),cy:Vr(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),Br=()=>!0;var Le=e=>{const t=({id:n,className:o,type:s,data:i,onClick:r,onEdgeDoubleClick:c,selected:l,animated:u,label:a,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:y,labelBgBorderRadius:g,style:x,source:h,target:w,sourceX:N,sourceY:A,targetX:$,targetY:D,sourcePosition:z,targetPosition:k,elementsSelectable:v,hidden:I,sourceHandleId:_,targetHandleId:P,onContextMenu:M,onMouseEnter:S,onMouseMove:C,onMouseLeave:V,reconnectRadius:Y,onReconnect:O,onReconnectStart:b,onReconnectEnd:H,markerEnd:R,markerStart:T,rfId:F,ariaLabel:U,isFocusable:W,isReconnectable:K,pathOptions:Q,interactionWidth:ne,disableKeyboardA11y:ee})=>{const X=m.useRef(null),[ue,ce]=m.useState(!1),[de,ae]=m.useState(!1),J=te(),ge=m.useMemo(()=>`url('#${Ct(T,F)}')`,[T,F]),G=m.useMemo(()=>`url('#${Ct(R,F)}')`,[R,F]);if(I)return null;const L=oe=>{var pe;const{edges:fe,addSelectedEdges:Ae,unselectNodesAndEdges:Me,multiSelectionActive:Ce}=J.getState(),he=fe.find(Ke=>Ke.id===n);he&&(v&&(J.setState({nodesSelectionActive:!1}),he.selected&&Ce?(Me({nodes:[],edges:[he]}),(pe=X.current)==null||pe.blur()):Ae([n])),r&&r(oe,he))},ie=je(n,J.getState,c),be=je(n,J.getState,M),Xe=je(n,J.getState,S),Pe=je(n,J.getState,C),He=je(n,J.getState,V),me=(oe,fe)=>{if(oe.button!==0)return;const{edges:Ae,isValidConnection:Me}=J.getState(),Ce=fe?w:h,he=(fe?P:_)||null,pe=fe?"target":"source",Ke=Me||Br,mt=fe,qe=Ae.find(_e=>_e.id===n);ae(!0),b==null||b(oe,qe,pe);const ht=_e=>{ae(!1),H==null||H(_e,qe,pe)};On({event:oe,handleId:he,nodeId:Ce,onConnect:_e=>O==null?void 0:O(qe,_e),isTarget:mt,getState:J.getState,setState:J.setState,isValidConnection:Ke,edgeUpdaterType:pe,onReconnectEnd:ht})},Re=oe=>me(oe,!0),Ne=oe=>me(oe,!1),ve=()=>ce(!0),ke=()=>ce(!1),De=!v&&!r,Ge=oe=>{var fe;if(!ee&&In.includes(oe.key)&&v){const{unselectNodesAndEdges:Ae,addSelectedEdges:Me,edges:Ce}=J.getState();oe.key==="Escape"?((fe=X.current)==null||fe.blur(),Ae({edges:[Ce.find(pe=>pe.id===n)]})):Me([n])}};return E.createElement("g",{className:re(["react-flow__edge",`react-flow__edge-${s}`,o,{selected:l,animated:u,inactive:De,updating:ue}]),onClick:L,onDoubleClick:ie,onContextMenu:be,onMouseEnter:Xe,onMouseMove:Pe,onMouseLeave:He,onKeyDown:W?Ge:void 0,tabIndex:W?0:void 0,role:W?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${h} to ${w}`,"aria-describedby":W?`${jn}-${F}`:void 0,ref:X},!de&&E.createElement(e,{id:n,source:h,target:w,selected:l,animated:u,label:a,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:y,labelBgBorderRadius:g,data:i,style:x,sourceX:N,sourceY:A,targetX:$,targetY:D,sourcePosition:z,targetPosition:k,sourceHandleId:_,targetHandleId:P,markerStart:ge,markerEnd:G,pathOptions:Q,interactionWidth:ne}),K&&E.createElement(E.Fragment,null,(K==="source"||K===!0)&&E.createElement(pn,{position:z,centerX:N,centerY:A,radius:Y,onMouseDown:Re,onMouseEnter:ve,onMouseOut:ke,type:"source"}),(K==="target"||K===!0)&&E.createElement(pn,{position:k,centerX:$,centerY:D,radius:Y,onMouseDown:Ne,onMouseEnter:ve,onMouseOut:ke,type:"target"})))};return t.displayName="EdgeWrapper",m.memo(t)};function Lr(e){const t={default:Le(e.default||ut),straight:Le(e.bezier||zt),step:Le(e.step||Dt),smoothstep:Le(e.step||pt),simplebezier:Le(e.simplebezier||kt)},n={},o=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=Le(e[i]||ut),s),n);return{...t,...o}}function mn(e,t,n=null){const o=((n==null?void 0:n.x)||0)+t.x,s=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,r=(n==null?void 0:n.height)||t.height;switch(e){case B.Top:return{x:o+i/2,y:s};case B.Right:return{x:o+i,y:s+r/2};case B.Bottom:return{x:o+i/2,y:s+r};case B.Left:return{x:o,y:s+r/2}}}function hn(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Fr=(e,t,n,o,s,i)=>{const r=mn(n,e,t),c=mn(i,o,s);return{sourceX:r.x,sourceY:r.y,targetX:c.x,targetY:c.y}};function Or({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:s,targetHeight:i,width:r,height:c,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+o,t.y+i)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const a=Rt({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:r/l[2],height:c/l[2]}),d=Math.max(0,Math.min(a.x2,u.x2)-Math.max(a.x,u.x)),p=Math.max(0,Math.min(a.y2,u.y2)-Math.max(a.y,u.y));return Math.ceil(d*p)>0}function yn(e){var o,s,i,r,c;const t=((o=e==null?void 0:e[q])==null?void 0:o.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((r=e==null?void 0:e.positionAbsolute)==null?void 0:r.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const Yr=[{level:0,isMaxLevel:!0,edges:[]}];function Ur(e,t,n=!1){let o=-1;const s=e.reduce((r,c)=>{var a,d;const l=le(c.zIndex);let u=l?c.zIndex:0;if(n){const p=t.get(c.target),f=t.get(c.source),y=c.selected||(p==null?void 0:p.selected)||(f==null?void 0:f.selected),g=Math.max(((a=f==null?void 0:f[q])==null?void 0:a.z)||0,((d=p==null?void 0:p[q])==null?void 0:d.z)||0,1e3);u=(l?c.zIndex:0)+(y?g:0)}return r[u]?r[u].push(c):r[u]=[c],o=u>o?u:o,r},{}),i=Object.entries(s).map(([r,c])=>{const l=+r;return{edges:c,level:l,isMaxLevel:l===o}});return i.length===0?Yr:i}function Zr(e,t,n){const o=j(m.useCallback(s=>e?s.edges.filter(i=>{const r=t.get(i.source),c=t.get(i.target);return(r==null?void 0:r.width)&&(r==null?void 0:r.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&Or({sourcePos:r.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:r.width,sourceHeight:r.height,targetWidth:c.width,targetHeight:c.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return Ur(o,t,n)}const Wr=({color:e="none",strokeWidth:t=1})=>E.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Xr=({color:e="none",strokeWidth:t=1})=>E.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),xn={[lt.Arrow]:Wr,[lt.ArrowClosed]:Xr};function Gr(e){const t=te();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(xn,e)?xn[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",ye.error009(e)),null)},[e])}const Kr=({id:e,type:t,color:n,width:o=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:r,orient:c="auto-start-reverse"})=>{const l=Gr(t);return l?E.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0"},E.createElement(l,{color:n,strokeWidth:r})):null},qr=({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(r=>{if(r&&typeof r=="object"){const c=Ct(r,t);o.includes(c)||(s.push({id:c,color:r.color||e,...r}),o.push(c))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},lo=({defaultColor:e,rfId:t})=>{const n=j(m.useCallback(qr({defaultColor:e,rfId:t}),[e,t]),(o,s)=>!(o.length!==s.length||o.some((i,r)=>i.id!==s[r].id)));return E.createElement("defs",null,n.map(o=>E.createElement(Kr,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};lo.displayName="MarkerDefinitions";var jr=m.memo(lo);const Qr=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),uo=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:r,onEdgeMouseEnter:c,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:a,onEdgeDoubleClick:d,onReconnect:p,onReconnectStart:f,onReconnectEnd:y,reconnectRadius:g,children:x,disableKeyboardA11y:h})=>{const{edgesFocusable:w,edgesUpdatable:N,elementsSelectable:A,width:$,height:D,connectionMode:z,nodeInternals:k,onError:v}=j(Qr,se),I=Zr(t,k,n);return $?E.createElement(E.Fragment,null,I.map(({level:_,edges:P,isMaxLevel:M})=>E.createElement("svg",{key:_,style:{zIndex:_},width:$,height:D,className:"react-flow__edges react-flow__container"},M&&E.createElement(jr,{defaultColor:e,rfId:o}),E.createElement("g",null,P.map(S=>{const[C,V,Y]=yn(k.get(S.source)),[O,b,H]=yn(k.get(S.target));if(!Y||!H)return null;let R=S.type||"default";s[R]||(v==null||v("011",ye.error011(R)),R="default");const T=s[R]||s.default,F=z===Te.Strict?b.target:(b.target??[]).concat(b.source??[]),U=hn(V.source,S.sourceHandle),W=hn(F,S.targetHandle),K=(U==null?void 0:U.position)||B.Bottom,Q=(W==null?void 0:W.position)||B.Top,ne=!!(S.focusable||w&&typeof S.focusable>"u"),ee=S.reconnectable||S.updatable,X=typeof p<"u"&&(ee||N&&typeof ee>"u");if(!U||!W)return v==null||v("008",ye.error008(U,S)),null;const{sourceX:ue,sourceY:ce,targetX:de,targetY:ae}=Fr(C,U,K,O,W,Q);return E.createElement(T,{key:S.id,id:S.id,className:re([S.className,i]),type:R,data:S.data,selected:!!S.selected,animated:!!S.animated,hidden:!!S.hidden,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,style:S.style,source:S.source,target:S.target,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerEnd:S.markerEnd,markerStart:S.markerStart,sourceX:ue,sourceY:ce,targetX:de,targetY:ae,sourcePosition:K,targetPosition:Q,elementsSelectable:A,onContextMenu:r,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:a,onEdgeDoubleClick:d,onReconnect:p,onReconnectStart:f,onReconnectEnd:y,reconnectRadius:g,rfId:o,ariaLabel:S.ariaLabel,isFocusable:ne,isReconnectable:X,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth,disableKeyboardA11y:h})})))),x):null};uo.displayName="EdgeRenderer";var Jr=m.memo(uo);const ei=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ti({children:e}){const t=j(ei);return E.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function ni(e){const t=Ot(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const oi={[B.Left]:B.Right,[B.Right]:B.Left,[B.Top]:B.Bottom,[B.Bottom]:B.Top},fo=({nodeId:e,handleType:t,style:n,type:o=Ee.Bezier,CustomComponent:s,connectionStatus:i})=>{var D,z,k;const{fromNode:r,handleId:c,toX:l,toY:u,connectionMode:a}=j(m.useCallback(v=>({fromNode:v.nodeInternals.get(e),handleId:v.connectionHandleId,toX:(v.connectionPosition.x-v.transform[0])/v.transform[2],toY:(v.connectionPosition.y-v.transform[1])/v.transform[2],connectionMode:v.connectionMode}),[e]),se),d=(D=r==null?void 0:r[q])==null?void 0:D.handleBounds;let p=d==null?void 0:d[t];if(a===Te.Loose&&(p=p||(d==null?void 0:d[t==="source"?"target":"source"])),!r||!p)return null;const f=c?p.find(v=>v.id===c):p[0],y=f?f.x+f.width/2:(r.width??0)/2,g=f?f.y+f.height/2:r.height??0,x=(((z=r.positionAbsolute)==null?void 0:z.x)??0)+y,h=(((k=r.positionAbsolute)==null?void 0:k.y)??0)+g,w=f==null?void 0:f.position,N=w?oi[w]:null;if(!w||!N)return null;if(s)return E.createElement(s,{connectionLineType:o,connectionLineStyle:n,fromNode:r,fromHandle:f,fromX:x,fromY:h,toX:l,toY:u,fromPosition:w,toPosition:N,connectionStatus:i});let A="";const $={sourceX:x,sourceY:h,sourcePosition:w,targetX:l,targetY:u,targetPosition:N};return o===Ee.Bezier?[A]=kn($):o===Ee.Step?[A]=Mt({...$,borderRadius:0}):o===Ee.SmoothStep?[A]=Mt($):o===Ee.SimpleBezier?[A]=Rn($):A=`M${x},${h} ${l},${u}`,E.createElement("path",{d:A,fill:"none",className:"react-flow__connection-path",style:n})};fo.displayName="ConnectionLine";const si=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function ri({containerStyle:e,style:t,type:n,component:o}){const{nodeId:s,handleType:i,nodesConnectable:r,width:c,height:l,connectionStatus:u}=j(si,se);return!(s&&i&&c&&r)?null:E.createElement("svg",{style:e,width:c,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},E.createElement("g",{className:re(["react-flow__connection",u])},E.createElement(fo,{nodeId:s,handleType:i,style:t,type:n,CustomComponent:o,connectionStatus:u})))}function wn(e,t){return m.useRef(null),te(),m.useMemo(()=>t(e),[e])}const go=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:s,onInit:i,onNodeClick:r,onEdgeClick:c,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:a,onNodeMouseMove:d,onNodeMouseLeave:p,onNodeContextMenu:f,onSelectionContextMenu:y,onSelectionStart:g,onSelectionEnd:x,connectionLineType:h,connectionLineStyle:w,connectionLineComponent:N,connectionLineContainerStyle:A,selectionKeyCode:$,selectionOnDrag:D,selectionMode:z,multiSelectionKeyCode:k,panActivationKeyCode:v,zoomActivationKeyCode:I,deleteKeyCode:_,onlyRenderVisibleElements:P,elementsSelectable:M,selectNodesOnDrag:S,defaultViewport:C,translateExtent:V,minZoom:Y,maxZoom:O,preventScrolling:b,defaultMarkerColor:H,zoomOnScroll:R,zoomOnPinch:T,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:W,zoomOnDoubleClick:K,panOnDrag:Q,onPaneClick:ne,onPaneMouseEnter:ee,onPaneMouseMove:X,onPaneMouseLeave:ue,onPaneScroll:ce,onPaneContextMenu:de,onEdgeContextMenu:ae,onEdgeMouseEnter:J,onEdgeMouseMove:ge,onEdgeMouseLeave:G,onReconnect:L,onReconnectStart:ie,onReconnectEnd:be,reconnectRadius:Xe,noDragClassName:Pe,noWheelClassName:He,noPanClassName:me,elevateEdgesOnSelect:Re,disableKeyboardA11y:Ne,nodeOrigin:ve,nodeExtent:ke,rfId:De})=>{const Ge=wn(e,Hr),oe=wn(t,Lr);return ni(i),E.createElement(Tr,{onPaneClick:ne,onPaneMouseEnter:ee,onPaneMouseMove:X,onPaneMouseLeave:ue,onPaneContextMenu:de,onPaneScroll:ce,deleteKeyCode:_,selectionKeyCode:$,selectionOnDrag:D,selectionMode:z,onSelectionStart:g,onSelectionEnd:x,multiSelectionKeyCode:k,panActivationKeyCode:v,zoomActivationKeyCode:I,elementsSelectable:M,onMove:n,onMoveStart:o,onMoveEnd:s,zoomOnScroll:R,zoomOnPinch:T,zoomOnDoubleClick:K,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:W,panOnDrag:Q,defaultViewport:C,translateExtent:V,minZoom:Y,maxZoom:O,onSelectionContextMenu:y,preventScrolling:b,noDragClassName:Pe,noWheelClassName:He,noPanClassName:me,disableKeyboardA11y:Ne},E.createElement(ti,null,E.createElement(Jr,{edgeTypes:oe,onEdgeClick:c,onEdgeDoubleClick:u,onlyRenderVisibleElements:P,onEdgeContextMenu:ae,onEdgeMouseEnter:J,onEdgeMouseMove:ge,onEdgeMouseLeave:G,onReconnect:L,onReconnectStart:ie,onReconnectEnd:be,reconnectRadius:Xe,defaultMarkerColor:H,noPanClassName:me,elevateEdgesOnSelect:!!Re,disableKeyboardA11y:Ne,rfId:De},E.createElement(ri,{style:w,type:h,component:N,containerStyle:A})),E.createElement("div",{className:"react-flow__edgelabel-renderer"}),E.createElement(Dr,{nodeTypes:Ge,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:a,onNodeMouseMove:d,onNodeMouseLeave:p,onNodeContextMenu:f,selectNodesOnDrag:S,onlyRenderVisibleElements:P,noPanClassName:me,noDragClassName:Pe,disableKeyboardA11y:Ne,nodeOrigin:ve,nodeExtent:ke,rfId:De})))};go.displayName="GraphView";var ii=m.memo(go);const Tt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xe={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Tt,nodeExtent:Tt,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Te.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Rs,isValidConnection:void 0},ci=()=>As((e,t)=>({...xe,setNodes:n=>{const{nodeInternals:o,nodeOrigin:s,elevateNodesOnSelect:i}=t();e({nodeInternals:Et(n,o,s,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map(s=>({...o,...s}))})},setDefaultNodesAndEdges:(n,o)=>{const s=typeof n<"u",i=typeof o<"u",r=s?Et(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:r,edges:i?o:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:r,fitViewOnInitOptions:c,domNode:l,nodeOrigin:u}=t(),a=l==null?void 0:l.querySelector(".react-flow__viewport");if(!a)return;const d=window.getComputedStyle(a),{m22:p}=new window.DOMMatrixReadOnly(d.transform),f=n.reduce((g,x)=>{const h=s.get(x.id);if(h!=null&&h.hidden)s.set(h.id,{...h,[q]:{...h[q],handleBounds:void 0}});else if(h){const w=Pt(x.nodeElement);!!(w.width&&w.height&&(h.width!==w.width||h.height!==w.height||x.forceUpdate))&&(s.set(h.id,{...h,[q]:{...h[q],handleBounds:{source:fn(".source",x.nodeElement,p,u),target:fn(".target",x.nodeElement,p,u)}},...w}),g.push({id:h.id,type:"dimensions",dimensions:w}))}return g},[]);Jn(s,u);const y=r||i&&!r&&eo(t,{initial:!0,...c});e({nodeInternals:new Map(s),fitViewOnInitDone:y}),(f==null?void 0:f.length)>0&&(o==null||o(f))},updateNodePositions:(n,o=!0,s=!1)=>{const{triggerNodeChanges:i}=t(),r=n.map(c=>{const l={id:c.id,type:"position",dragging:s};return o&&(l.positionAbsolute=c.positionAbsolute,l.position=c.position),l});i(r)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:r,getNodes:c,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(i){const u=to(n,c()),a=Et(u,s,r,l);e({nodeInternals:a})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:s,getNodes:i}=t();let r,c=null;o?r=n.map(l=>we(l,!0)):(r=Fe(i(),n),c=Fe(s,[])),it({changedNodes:r,changedEdges:c,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:s,getNodes:i}=t();let r,c=null;o?r=n.map(l=>we(l,!0)):(r=Fe(s,n),c=Fe(i(),[])),it({changedNodes:c,changedEdges:r,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:s,getNodes:i}=t(),r=n||i(),c=o||s,l=r.map(a=>(a.selected=!1,we(a.id,!1))),u=c.map(a=>we(a.id,!1));it({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:s}=t();o==null||o.scaleExtent([n,s]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:s}=t();o==null||o.scaleExtent([s,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;(o=t().d3Zoom)==null||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t(),i=o().filter(c=>c.selected).map(c=>we(c.id,!1)),r=n.filter(c=>c.selected).map(c=>we(c.id,!1));it({changedNodes:i,changedEdges:r,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach(s=>{s.positionAbsolute=Ht(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:s,height:i,d3Zoom:r,d3Selection:c,translateExtent:l}=t();if(!r||!c||!n.x&&!n.y)return!1;const u=Oe.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),a=[[0,0],[s,i]],d=r==null?void 0:r.constrain()(u,a,l);return r.transform(c,d),o[0]!==d.x||o[1]!==d.y||o[2]!==d.k},cancelConnection:()=>e({connectionNodeId:xe.connectionNodeId,connectionHandleId:xe.connectionHandleId,connectionHandleType:xe.connectionHandleType,connectionStatus:xe.connectionStatus,connectionStartHandle:xe.connectionStartHandle,connectionEndHandle:xe.connectionEndHandle}),reset:()=>e({...xe})}),Object.is),po=({children:e})=>{const t=m.useRef(null);return t.current||(t.current=ci()),E.createElement(Ms,{value:t.current},e)};po.displayName="ReactFlowProvider";const mo=({children:e})=>m.useContext(gt)?E.createElement(E.Fragment,null,e):E.createElement(po,null,e);mo.displayName="ReactFlowWrapper";const ai={input:Wn,default:$t,output:Gn,group:Ft},li={default:ut,straight:zt,step:Dt,smoothstep:pt,simplebezier:kt},ui=[0,0],di=[15,15],fi={x:0,y:0,zoom:1},gi={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pi=m.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:s,nodeTypes:i=ai,edgeTypes:r=li,onNodeClick:c,onEdgeClick:l,onInit:u,onMove:a,onMoveStart:d,onMoveEnd:p,onConnect:f,onConnectStart:y,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:h,onNodeMouseEnter:w,onNodeMouseMove:N,onNodeMouseLeave:A,onNodeContextMenu:$,onNodeDoubleClick:D,onNodeDragStart:z,onNodeDrag:k,onNodeDragStop:v,onNodesDelete:I,onEdgesDelete:_,onSelectionChange:P,onSelectionDragStart:M,onSelectionDrag:S,onSelectionDragStop:C,onSelectionContextMenu:V,onSelectionStart:Y,onSelectionEnd:O,connectionMode:b=Te.Strict,connectionLineType:H=Ee.Bezier,connectionLineStyle:R,connectionLineComponent:T,connectionLineContainerStyle:F,deleteKeyCode:U="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:K=!1,selectionMode:Q=tt.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ee=at()?"Meta":"Control",zoomActivationKeyCode:X=at()?"Meta":"Control",snapToGrid:ue=!1,snapGrid:ce=di,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:ae=!0,nodesDraggable:J,nodesConnectable:ge,nodesFocusable:G,nodeOrigin:L=ui,edgesFocusable:ie,edgesUpdatable:be,elementsSelectable:Xe,defaultViewport:Pe=fi,minZoom:He=.5,maxZoom:me=2,translateExtent:Re=Tt,preventScrolling:Ne=!0,nodeExtent:ve,defaultMarkerColor:ke="#b1b1b7",zoomOnScroll:De=!0,zoomOnPinch:Ge=!0,panOnScroll:oe=!1,panOnScrollSpeed:fe=.5,panOnScrollMode:Ae=Ie.Free,zoomOnDoubleClick:Me=!0,panOnDrag:Ce=!0,onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:Ke,onPaneMouseLeave:mt,onPaneScroll:qe,onPaneContextMenu:ht,children:Ut,onEdgeContextMenu:_e,onEdgeDoubleClick:yo,onEdgeMouseEnter:xo,onEdgeMouseMove:wo,onEdgeMouseLeave:Eo,onEdgeUpdate:So,onEdgeUpdateStart:bo,onEdgeUpdateEnd:No,onReconnect:vo,onReconnectStart:Ao,onReconnectEnd:Mo,reconnectRadius:Co=10,edgeUpdaterRadius:_o=10,onNodesChange:$o,onEdgesChange:Io,noDragClassName:To="nodrag",noWheelClassName:Po="nowheel",noPanClassName:Zt="nopan",fitView:Ho=!1,fitViewOptions:Ro,connectOnClick:ko=!0,attributionPosition:Do,proOptions:zo,defaultEdgeOptions:Vo,elevateNodesOnSelect:Bo=!0,elevateEdgesOnSelect:Lo=!1,disableKeyboardA11y:Wt=!1,autoPanOnConnect:Fo=!0,autoPanOnNodeDrag:Oo=!0,connectionRadius:Yo=20,isValidConnection:Uo,onError:Zo,style:Wo,id:Xt,nodeDragThreshold:Xo,...Go},Ko)=>{const yt=Xt||"1";return E.createElement("div",{...Go,style:{...Wo,...gi},ref:Ko,className:re(["react-flow",s]),"data-testid":"rf__wrapper",id:Xt},E.createElement(mo,null,E.createElement(ii,{onInit:u,onMove:a,onMoveStart:d,onMoveEnd:p,onNodeClick:c,onEdgeClick:l,onNodeMouseEnter:w,onNodeMouseMove:N,onNodeMouseLeave:A,onNodeContextMenu:$,onNodeDoubleClick:D,nodeTypes:i,edgeTypes:r,connectionLineType:H,connectionLineStyle:R,connectionLineComponent:T,connectionLineContainerStyle:F,selectionKeyCode:W,selectionOnDrag:K,selectionMode:Q,deleteKeyCode:U,multiSelectionKeyCode:ee,panActivationKeyCode:ne,zoomActivationKeyCode:X,onlyRenderVisibleElements:de,selectNodesOnDrag:ae,defaultViewport:Pe,translateExtent:Re,minZoom:He,maxZoom:me,preventScrolling:Ne,zoomOnScroll:De,zoomOnPinch:Ge,zoomOnDoubleClick:Me,panOnScroll:oe,panOnScrollSpeed:fe,panOnScrollMode:Ae,panOnDrag:Ce,onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:Ke,onPaneMouseLeave:mt,onPaneScroll:qe,onPaneContextMenu:ht,onSelectionContextMenu:V,onSelectionStart:Y,onSelectionEnd:O,onEdgeContextMenu:_e,onEdgeDoubleClick:yo,onEdgeMouseEnter:xo,onEdgeMouseMove:wo,onEdgeMouseLeave:Eo,onReconnect:vo??So,onReconnectStart:Ao??bo,onReconnectEnd:Mo??No,reconnectRadius:Co??_o,defaultMarkerColor:ke,noDragClassName:To,noWheelClassName:Po,noPanClassName:Zt,elevateEdgesOnSelect:Lo,rfId:yt,disableKeyboardA11y:Wt,nodeOrigin:L,nodeExtent:ve}),E.createElement(or,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:f,onConnectStart:y,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:h,nodesDraggable:J,nodesConnectable:ge,nodesFocusable:G,edgesFocusable:ie,edgesUpdatable:be,elementsSelectable:Xe,elevateNodesOnSelect:Bo,minZoom:He,maxZoom:me,nodeExtent:ve,onNodesChange:$o,onEdgesChange:Io,snapToGrid:ue,snapGrid:ce,connectionMode:b,translateExtent:Re,connectOnClick:ko,defaultEdgeOptions:Vo,fitView:Ho,fitViewOptions:Ro,onNodesDelete:I,onEdgesDelete:_,onNodeDragStart:z,onNodeDrag:k,onNodeDragStop:v,onSelectionDrag:S,onSelectionDragStart:M,onSelectionDragStop:C,noPanClassName:Zt,nodeOrigin:L,rfId:yt,autoPanOnConnect:Fo,autoPanOnNodeDrag:Oo,onError:Zo,connectionRadius:Yo,isValidConnection:Uo,nodeDragThreshold:Xo}),E.createElement(tr,{onSelectionChange:P}),Ut,E.createElement(_s,{proOptions:zo,position:Do}),E.createElement(ar,{rfId:yt,disableKeyboardA11y:Wt})))});pi.displayName="ReactFlow";function mi(e){return t=>{const[n,o]=m.useState(t),s=m.useCallback(i=>o(r=>e(i,r)),[]);return[n,o,s]}}const Ai=mi(to);function hi(){return E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},E.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function yi(){return E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},E.createElement("path",{d:"M0 0h32v4.2H0z"}))}function xi(){return E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},E.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function wi(){return E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},E.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function Ei(){return E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},E.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const et=({children:e,className:t,...n})=>E.createElement("button",{type:"button",className:re(["react-flow__controls-button",t]),...n},e);et.displayName="ControlButton";const Si=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ho=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:r,onFitView:c,onInteractiveChange:l,className:u,children:a,position:d="bottom-left"})=>{const p=te(),[f,y]=m.useState(!1),{isInteractive:g,minZoomReached:x,maxZoomReached:h}=j(Si,se),{zoomIn:w,zoomOut:N,fitView:A}=Ot();if(m.useEffect(()=>{y(!0)},[]),!f)return null;const $=()=>{w(),i==null||i()},D=()=>{N(),r==null||r()},z=()=>{A(s),c==null||c()},k=()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)};return E.createElement(Cn,{className:re(["react-flow__controls",u]),position:d,style:e,"data-testid":"rf__controls"},t&&E.createElement(E.Fragment,null,E.createElement(et,{onClick:$,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:h},E.createElement(hi,null)),E.createElement(et,{onClick:D,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},E.createElement(yi,null))),n&&E.createElement(et,{className:"react-flow__controls-fitview",onClick:z,title:"fit view","aria-label":"fit view"},E.createElement(xi,null)),o&&E.createElement(et,{className:"react-flow__controls-interactive",onClick:k,title:"toggle interactivity","aria-label":"toggle interactivity"},g?E.createElement(Ei,null):E.createElement(wi,null)),a)};ho.displayName="Controls";var Mi=m.memo(ho);export{Mi as C,dt as H,lt as M,B as P,po as R,pi as a,Ai as b,re as c,se as s,j as u};
