@axiom-lattice/gateway 4.8.2 → 4.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embed/{embed-page-AgentDetailSideApp-MVSXAG5S.js → embed-page-AgentDetailSideApp-S5N76UPU.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-ZEVAVRIQ.js → embed-page-AgentGovernanceWorkbench-QFMP2M73.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-CPZJIKOD.js → embed-page-MessageGraph-H3HPZKOH.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-7NQMTFJE.js → embed-page-ReactChart-ZFMANJCT.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-TSBZ4V2P.js → embed-page-SkillFlow-HY7PD43P.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-CY6NI4DD.js → embed-page-TasksSideApp-QKEXMHCT.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-7GQCMJWF.js → embed-page-TeamWorkspace-ZFVAFZXZ.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-5DJPLCLQ.js → embed-page-TopologyRuntimeView-2BS4OYEZ.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-PDVXZXEF.js → embed-page-WorkflowAutomationView-WUI7BSQP.js} +1 -1
- package/dist/embed/{embed-page-chunk-KEL6XU6R.js → embed-page-chunk-2U4LKIE3.js} +1 -1
- package/dist/embed/{embed-page-chunk-AC6X2XRH.js → embed-page-chunk-3WRJEEZS.js} +1 -1
- package/dist/embed/embed-page-chunk-4T4QMOUS.js +242 -0
- package/dist/embed/{embed-page-chunk-3SV3E6X5.js → embed-page-chunk-5WYDCL3B.js} +209 -305
- package/dist/embed/{embed-page-chunk-BKCIU75D.js → embed-page-chunk-6HM7ZERK.js} +1 -1
- package/dist/embed/{embed-page-chunk-Z7USDLHI.js → embed-page-chunk-6KCBXVIT.js} +1 -1
- package/dist/embed/{embed-page-chunk-YPNSOZYW.js → embed-page-chunk-7ZBZKXBU.js} +1 -1
- package/dist/embed/{embed-page-chunk-O4QK5LWZ.js → embed-page-chunk-FZRTVFHF.js} +83 -83
- package/dist/embed/{embed-page-chunk-UWL37DAK.js → embed-page-chunk-MSHEVUK3.js} +1 -1
- package/dist/embed/{embed-page-chunk-IV5C4DYL.js → embed-page-chunk-ONN5O5BX.js} +1 -1
- package/dist/embed/{embed-page-chunk-SFHRRNYQ.js → embed-page-chunk-VJTO6SG6.js} +1 -1
- package/dist/embed/{embed-page-chunk-ULBEL4OA.js → embed-page-chunk-XKQ6YPUW.js} +1 -1
- package/dist/embed/{embed-page-code-highlighter-Y6CQA4CN.js → embed-page-code-highlighter-NZBTSABL.js} +1 -1
- package/dist/embed/{embed-page-mermaid-CW4QCAH3.js → embed-page-mermaid-CK4ARQCM.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.js +8 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/embed/embed-page-chunk-PZCET7LJ.js +0 -245
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Xe,c as zt,d as Dt,f as tt,h as nt,k as _n,l as Cn,m as At}from"./embed-page-chunk-S4XZPBRM.js";import{a as Os}from"./embed-page-chunk-MB65DZAX.js";import{a as Hs}from"./embed-page-chunk-O4QK5LWZ.js";import{a as et}from"./embed-page-chunk-4BKXE5ON.js";import{b as Je,e as Ze}from"./embed-page-chunk-6Y3UYJ6Z.js";var mo=Je(ho=>{"use strict";var Te=et();function mi(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yi=typeof Object.is=="function"?Object.is:mi,xi=Te.useState,bi=Te.useEffect,wi=Te.useLayoutEffect,Ei=Te.useDebugValue;function Si(e,t){var n=t(),o=xi({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return wi(function(){r.value=n,r.getSnapshot=t,cn(r)&&s({inst:r})},[e,n,t]),bi(function(){return cn(r)&&s({inst:r}),e(function(){cn(r)&&s({inst:r})})},[e]),Ei(n),n}function cn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yi(e,n)}catch{return!0}}function vi(e,t){return t()}var _i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vi:Si;ho.useSyncExternalStore=Te.useSyncExternalStore!==void 0?Te.useSyncExternalStore:_i});var xo=Je((tl,yo)=>{"use strict";yo.exports=mo()});var wo=Je(bo=>{"use strict";var bt=et(),Ci=xo();function Ni(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ki=typeof Object.is=="function"?Object.is:Ni,Mi=Ci.useSyncExternalStore,Ii=bt.useRef,Pi=bt.useEffect,zi=bt.useMemo,Di=bt.useDebugValue;bo.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=Ii(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=zi(function(){function f(h){if(!l){if(l=!0,g=h,h=o(h),r!==void 0&&i.hasValue){var p=i.value;if(r(p,h))return c=p}return c=h}if(p=c,ki(g,h))return p;var y=o(h);return r!==void 0&&r(p,y)?(g=h,p):(g=h,c=y)}var l=!1,g,c,d=n===void 0?null:n;return[function(){return f(t())},d===null?void 0:function(){return f(d())}]},[t,n,o,r]);var a=Mi(e,s[0],s[1]);return Pi(function(){i.hasValue=!0,i.value=a},[a]),Di(a),a}});var So=Je((ol,Eo)=>{"use strict";Eo.exports=wo()});var ae={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,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,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.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},De=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt=["Enter"," ","Escape"],Rt={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},ye;(function(e){e.Strict="strict",e.Loose="loose"})(ye||(ye={}));var ge;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ge||(ge={}));var Se;(function(e){e.Partial="partial",e.Full="full"})(Se||(Se={}));var Bt={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},de;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(de||(de={}));var Ie;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var F;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(F||(F={}));var Nn={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top};function Vt(e){return e===null?null:e?"valid":"invalid"}var Ft=e=>"id"in e&&"source"in e&&"target"in e,Rn=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ge=(e,t=[0,0])=>{let{width:n,height:o}=ue(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Zt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((o,r)=>{let s=typeof r=="string",i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):Yt(r)?r:t.nodeLookup.get(r.id));let a=i?st(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return at(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ct(n)},Ae=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=at(n,st(r)),o=!0)}),o?ct(n):{x:0,y:0,width:0,height:0}},it=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{let a={...Oe(t,[n,o,r]),width:t.width/r,height:t.height/r},f=[];for(let l of e.values()){let{measured:g,selectable:c=!0,hidden:d=!1}=l;if(i&&!c||d)continue;let h=g.width??l.width??l.initialWidth??null,p=g.height??l.height??l.initialHeight??null,y=$e(a,_e(l)),m=(h??0)*(p??0),x=s&&y>0;(!l.internals.handleBounds||x||y>=m||l.dragging)&&f.push(l)}return f},Bn=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ls(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Vn({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);let a=Ls(e,i),f=Ae(a),l=qe(f,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Xt({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){let i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:f,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},g=i.origin??o,c=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ae.error005());else{let h=a.measured.width,p=a.measured.height;h&&p&&(c=[[f,l],[f+h,l+p]])}else a&&ze(i.extent)&&(c=[[i.extent[0][0]+f,i.extent[0][1]+l],[i.extent[1][0]+f,i.extent[1][1]+l]]);let d=ze(c)?ve(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ae.error015()),{position:{x:d.x-f+(i.measured.width??0)*g[0],y:d.y-l+(i.measured.height??0)*g[1]},positionAbsolute:d}}async function Fn({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let s=new Set(e.map(d=>d.id)),i=[];for(let d of n){if(d.deletable===!1)continue;let h=s.has(d.id),p=!h&&d.parentId&&i.find(y=>y.id===d.parentId);(h||p)&&i.push(d)}let a=new Set(t.map(d=>d.id)),f=o.filter(d=>d.deletable!==!1),g=Bn(i,f);for(let d of f)a.has(d.id)&&!g.find(p=>p.id===d.id)&&g.push(d);if(!r)return{edges:g,nodes:i};let c=await r({nodes:i,edges:g});return typeof c=="boolean"?c?{edges:g,nodes:i}:{edges:[],nodes:[]}:c}var Pe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ve=(e={x:0,y:0},t,n)=>({x:Pe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Pe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Yn(e,t,n){let{width:o,height:r}=ue(n),{x:s,y:i}=n.internals.positionAbsolute;return ve(e,[[s,i],[s+o,i+r]],t)}var kn=(e,t,n)=>e<t?Pe(Math.abs(e-t),1,t)/t:e>n?-Pe(Math.abs(e-n),1,t)/t:0,Zn=(e,t,n=15,o=40)=>{let r=kn(e.x,o,t.width-o)*n,s=kn(e.y,o,t.height-o)*n;return[r,s]},at=(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)}),Lt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),ct=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),_e=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},st=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Wt=(e,t)=>ct(at(Lt(e),Lt(t))),$e=(e,t)=>{let 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)},Kt=e=>ce(e.width)&&ce(e.height)&&ce(e.x)&&ce(e.y),ce=e=>!isNaN(e)&&isFinite(e),Gt=(e,t)=>{},He=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return s?He(a,i):a},Ke=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ke(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ts(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ke(e,n),r=ke(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ke(e.top??e.y??0,n),r=ke(e.bottom??e.y??0,n),s=ke(e.left??e.x??0,t),i=ke(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Rs(e,t,n,o,r,s){let{x:i,y:a}=Ke(e,[t,n,o]),{x:f,y:l}=Ke({x:e.x+e.width,y:e.y+e.height},[t,n,o]),g=r-f,c=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(g),bottom:Math.floor(c)}}var qe=(e,t,n,o,r,s)=>{let i=Ts(s,t,n),a=(t-i.x)/e.width,f=(n-i.y)/e.height,l=Math.min(a,f),g=Pe(l,o,r),c=e.x+e.width/2,d=e.y+e.height/2,h=t/2-c*g,p=n/2-d*g,y=Rs(e,h,p,g,t,n),m={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:g}},Le=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ze(e){return e!=null&&e!=="parent"}function ue(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function lt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qt(e,t={width:0,height:0},n,o,r){let s={...e},i=o.get(n);if(i){let a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Ut(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xn(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Wn(e){return{...Rt,...e||{}}}function We(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:s,y:i}=le(e),a=Oe({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:f,y:l}=n?He(a,t):a;return{xSnapped:f,ySnapped:l,...a}}var dt=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qt=e=>e?.getRootNode?.()||window?.document,Bs=["INPUT","SELECT","TEXTAREA"];function jt(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bs.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Jt=e=>"clientX"in e,le=(e,t)=>{let n=Jt(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Mn=(e,t,n,o,r)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{let a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...dt(i)}})};function ut({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){let f=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,g=Math.abs(f-e),c=Math.abs(l-t);return[f,l,g,c]}function ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function In({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case F.Left:return[t-ot(t-o,s),n];case F.Right:return[t+ot(o-t,s),n];case F.Top:return[t,n-ot(n-r,s)];case F.Bottom:return[t,n+ot(r-n,s)]}}function ft({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,curvature:i=.25}){let[a,f]=In({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,g]=In({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[c,d,h,p]=ut({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:f,targetControlX:l,targetControlY:g});return[`M${e},${t} C${a},${f} ${l},${g} ${o},${r}`,c,d,h,p]}function en({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Kn({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;let i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Gn({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let s=at(st(e),st(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $e(i,ct(s))>0}var Vs=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Fs=(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)),tn=(e,t,n={})=>{if(!e.source||!e.target)return Gt("006",ae.error006()),t;let o=n.getEdgeId||Vs,r;return Ft(e)?r={...e}:r={...e,id:o(e)},Fs(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gt({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,s,i,a]=en({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}var Pn={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}},Ys=({source:e,sourcePosition:t=F.Bottom,target:n})=>t===F.Left||t===F.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},zn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zs({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:r,offset:s,stepPosition:i}){let a=Pn[t],f=Pn[o],l={x:e.x+a.x*s,y:e.y+a.y*s},g={x:n.x+f.x*s,y:n.y+f.y*s},c=Ys({source:l,sourcePosition:t,target:g}),d=c.x!==0?"x":"y",h=c[d],p=[],y,m,x={x:0,y:0},b={x:0,y:0},[,,u,w]=en({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*f[d]===-1){d==="x"?(y=r.x??l.x+(g.x-l.x)*i,m=r.y??(l.y+g.y)/2):(y=r.x??(l.x+g.x)/2,m=r.y??l.y+(g.y-l.y)*i);let S=[{x:y,y:l.y},{x:y,y:g.y}],_=[{x:l.x,y:m},{x:g.x,y:m}];a[d]===h?p=d==="x"?S:_:p=d==="x"?_:S}else{let S=[{x:l.x,y:g.y}],_=[{x:g.x,y:l.y}];if(d==="x"?p=a.x===h?_:S:p=a.y===h?S:_,t===o){let M=Math.abs(e[d]-n[d]);if(M<=s){let A=Math.min(s-1,s-M);a[d]===h?x[d]=(l[d]>e[d]?-1:1)*A:b[d]=(g[d]>n[d]?-1:1)*A}}if(t!==o){let M=d==="x"?"y":"x",A=a[d]===f[M],H=l[M]>g[M],z=l[M]<g[M];(a[d]===1&&(!A&&H||A&&z)||a[d]!==1&&(!A&&z||A&&H))&&(p=d==="x"?S:_)}let I={x:l.x+x.x,y:l.y+x.y},k={x:g.x+b.x,y:g.y+b.y},R=Math.max(Math.abs(I.x-p[0].x),Math.abs(k.x-p[0].x)),C=Math.max(Math.abs(I.y-p[0].y),Math.abs(k.y-p[0].y));R>=C?(y=(I.x+k.x)/2,m=p[0].y):(y=p[0].x,m=(I.y+k.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...p,{x:g.x+b.x,y:g.y+b.y},n],y,m,u,w]}function Xs(e,t,n,o){let r=Math.min(zn(e,t)/2,zn(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){let l=e.x<n.x?-1:1,g=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*g}`}let a=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${s},${i+r*f}Q ${s},${i} ${s+r*a},${i}`}function Ue({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,borderRadius:i=5,centerX:a,centerY:f,offset:l=20,stepPosition:g=.5}){let[c,d,h,p,y]=Zs({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:f},offset:l,stepPosition:g});return[c.reduce((x,b,u)=>{let w="";return u>0&&u<c.length-1?w=Xs(c[u-1],b,c[u+1],i):w=`${u===0?"M":"L"}${b.x} ${b.y}`,x+=w,x},""),d,h,p,y]}function Dn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qn(e){let{sourceNode:t,targetNode:n}=e;if(!Dn(t)||!Dn(n))return null;let o=t.internals.handleBounds||An(t.handles),r=n.internals.handleBounds||An(n.handles),s=$n(o?.source??[],e.sourceHandle),i=$n(e.connectionMode===ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ae.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=s?.position||F.Bottom,f=i?.position||F.Top,l=xe(t,s,a),g=xe(n,i,f);return{sourceX:l.x,sourceY:l.y,targetX:g.x,targetY:g.y,sourcePosition:a,targetPosition:f}}function An(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function xe(e,t,n=F.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??ue(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case F.Top:return{x:r+i/2,y:s};case F.Right:return{x:r+i,y:s+a/2};case F.Bottom:return{x:r+i/2,y:s+a};case F.Left:return{x:r,y:s+a/2}}}function $n(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Un(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){let l=pt(f,t);s.has(l)||(i.push({id:l,color:f.color||n,...f}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}var Qn=1e3,Ws=10,nn={nodeOrigin:[0,0],nodeExtent:De,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ks={...nn,checkEquality:!0};function on(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function jn(e,t,n){let o=on(nn,n);for(let r of e.values())if(r.parentId)sn(r,e,t,o);else{let s=Ge(r,o.nodeOrigin),i=ze(r.extent)?r.extent:o.nodeExtent,a=ve(s,i,ue(r));r.internals.positionAbsolute=a}}function Gs(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function rn(e){return e==="manual"}function ht(e,t,n,o={}){let r=on(Ks,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!rn(r.zIndexMode)?Qn:0,f=e.length>0;t.clear(),n.clear();for(let l of e){let g=i.get(l.id);if(r.checkEquality&&l===g?.internals.userNode)t.set(l.id,g);else{let c=Ge(l,r.nodeOrigin),d=ze(l.extent)?l.extent:r.nodeExtent,h=ve(c,d,ue(l));g={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:Gs(l,g),z:Jn(l,a,r.zIndexMode),userNode:l}},t.set(l.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(f=!1),l.parentId&&sn(g,t,n,o,s)}return f}function qs(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function sn(e,t,n,o,r){let{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:f}=on(nn,o),l=e.parentId,g=t.get(l);if(!g){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qs(e,n),r&&!g.parentId&&g.internals.rootParentIndex===void 0&&f==="auto"&&(g.internals.rootParentIndex=++r.i,g.internals.z=g.internals.z+r.i*Ws),r&&g.internals.rootParentIndex!==void 0&&(r.i=g.internals.rootParentIndex);let c=s&&!rn(f)?Qn:0,{x:d,y:h,z:p}=Us(e,g,i,a,c,f),{positionAbsolute:y}=e.internals,m=d!==y.x||h!==y.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:y,z:p}})}function Jn(e,t,n){let o=ce(e.zIndex)?e.zIndex:0;return rn(n)?o:o+(e.selected?t:0)}function Us(e,t,n,o,r,s){let{x:i,y:a}=t.internals.positionAbsolute,f=ue(e),l=Ge(e,n),g=ze(e.extent)?ve(l,e.extent,f):l,c=ve({x:i+g.x,y:a+g.y},o,f);e.extent==="parent"&&(c=Yn(c,f,t));let d=Jn(e,r,s),h=t.internals.z??0;return{x:c.x,y:c.y,z:h>=d?h+1:d}}function mt(e,t,n,o=[0,0]){let r=[],s=new Map;for(let i of e){let a=t.get(i.parentId);if(!a)continue;let f=s.get(i.parentId)?.expandedRect??_e(a),l=Wt(f,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},f)=>{let l=a.internals.positionAbsolute,g=ue(a),c=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,h=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(g.width,Math.round(i.width)),y=Math.max(g.height,Math.round(i.height)),m=(p-g.width)*c[0],x=(y-g.height)*c[1];(d>0||h>0||m||x)&&(r.push({id:f,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+x}}),n.get(f)?.forEach(b=>{e.some(u=>u.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(g.width<i.width||g.height<i.height||d||h)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?c[0]*d-m:0),height:y+(h?c[1]*h-x:0)}})}),r}function eo(e,t,n,o,r,s,i){let a=o?.querySelector(".xyflow__viewport"),f=!1;if(!a)return{changes:[],updatedInternals:f};let l=[],g=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(g.transform),d=[];for(let h of e.values()){let p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),f=!0;continue}let y=dt(h.nodeElement),m=p.measured.width!==y.width||p.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!p.internals.handleBounds||h.force))){let b=h.nodeElement.getBoundingClientRect(),u=ze(p.extent)?p.extent:s,{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=Yn(w,y,t.get(p.parentId)):u&&(w=ve(w,u,y));let N={...p,measured:y,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:Mn("source",h.nodeElement,b,c,p.id),target:Mn("target",h.nodeElement,b,c,p.id)}}};t.set(p.id,N),p.parentId&&sn(N,t,n,{nodeOrigin:r,zIndexMode:i}),f=!0,m&&(l.push({id:p.id,type:"dimensions",dimensions:y}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:_e(N,r)}))}}if(d.length>0){let h=mt(d,t,n,r);l.push(...h)}return{changes:l,updatedInternals:f}}async function to({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function Hn(e,t,n,o,r,s){let i=r,a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;let f=o.get(i)||new Map;if(o.set(i,f.set(n,t)),s){i=`${r}-${e}-${s}`;let l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function an(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,f={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,g=`${s}-${a}--${r}-${i}`;Hn("source",f,g,e,r,i),Hn("target",f,l,e,s,a),t.set(o.id,o)}}function no(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:no(n,t):!1}function On(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Qs(e,t,n,o){let r=new Map;for(let[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!no(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){let a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function $t({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[i,a]of t){let f=n.get(i)?.internals.userNode;f&&r.push({...f,position:a.position,dragging:o})}if(!e)return[r[0],r];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function js({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let s={x:n-r.distance.x,y:o-r.distance.y},i=He(s,t);return{x:i.x-s.x,y:i.y-s.y}}function oo({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,f=!1,l={x:0,y:0},g=null,c=!1,d=null,h=!1,p=!1,y=null;function m({noDragClassName:b,handleSelector:u,domNode:w,isSelectable:N,nodeId:S,nodeClickDistance:_=0}){d=Xe(w);function I({x:M,y:A}){let{nodeLookup:H,nodeExtent:z,snapGrid:O,snapToGrid:$,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:V,onError:B,updateNodePositions:L}=t();s={x:M,y:A};let Y=!1,X=a.size>1,U=X&&z?Lt(Ae(a)):null,J=X&&$?js({dragItems:a,snapGrid:O,x:M,y:A}):null;for(let[G,T]of a){if(!H.has(G))continue;let Z={x:M-T.distance.x,y:A-T.distance.y};$&&(Z=J?{x:Math.round(Z.x+J.x),y:Math.round(Z.y+J.y)}:He(Z,O));let Q=null;if(X&&z&&!T.extent&&U){let{positionAbsolute:K}=T.internals,ee=K.x-U.x+z[0][0],oe=K.x+T.measured.width-U.x2+z[1][0],te=K.y-U.y+z[0][1],ie=K.y+T.measured.height-U.y2+z[1][1];Q=[[ee,te],[oe,ie]]}let{position:q,positionAbsolute:W}=Xt({nodeId:G,nextPosition:Z,nodeLookup:H,nodeExtent:Q||z,nodeOrigin:P,onError:B});Y=Y||T.position.x!==q.x||T.position.y!==q.y,T.position=q,T.internals.positionAbsolute=W}if(p=p||Y,!!Y&&(L(a,!0),y&&(o||D||!S&&V))){let[G,T]=$t({nodeId:S,dragItems:a,nodeLookup:H});o?.(y,a,G,T),D?.(y,G,T),S||V?.(y,T)}}async function k(){if(!g)return;let{transform:M,panBy:A,autoPanSpeed:H,autoPanOnNodeDrag:z}=t();if(!z){f=!1,cancelAnimationFrame(i);return}let[O,$]=Zn(l,g,H);(O!==0||$!==0)&&(s.x=(s.x??0)-O/M[2],s.y=(s.y??0)-$/M[2],await A({x:O,y:$})&&I(s)),i=requestAnimationFrame(k)}function R(M){let{nodeLookup:A,multiSelectionActive:H,nodesDraggable:z,transform:O,snapGrid:$,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:B,unselectNodesAndEdges:L}=t();c=!0,(!D||!N)&&!H&&S&&(A.get(S)?.selected||L()),N&&D&&S&&e?.(S);let Y=We(M.sourceEvent,{transform:O,snapGrid:$,snapToGrid:P,containerBounds:g});if(s=Y,a=Qs(A,z,Y,S),a.size>0&&(n||V||!S&&B)){let[X,U]=$t({nodeId:S,dragItems:a,nodeLookup:A});n?.(M.sourceEvent,a,X,U),V?.(M.sourceEvent,X,U),S||B?.(M.sourceEvent,U)}}let C=Dt().clickDistance(_).on("start",M=>{let{domNode:A,nodeDragThreshold:H,transform:z,snapGrid:O,snapToGrid:$}=t();g=A?.getBoundingClientRect()||null,h=!1,p=!1,y=M.sourceEvent,H===0&&R(M),s=We(M.sourceEvent,{transform:z,snapGrid:O,snapToGrid:$,containerBounds:g}),l=le(M.sourceEvent,g)}).on("drag",M=>{let{autoPanOnNodeDrag:A,transform:H,snapGrid:z,snapToGrid:O,nodeDragThreshold:$,nodeLookup:P}=t(),D=We(M.sourceEvent,{transform:H,snapGrid:z,snapToGrid:O,containerBounds:g});if(y=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!P.has(S))&&(h=!0),!h){if(!f&&A&&c&&(f=!0,k()),!c){let V=le(M.sourceEvent,g),B=V.x-l.x,L=V.y-l.y;Math.sqrt(B*B+L*L)>$&&R(M)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&a&&c&&(l=le(M.sourceEvent,g),I(D))}}).on("end",M=>{if(!(!c||h)&&(f=!1,c=!1,cancelAnimationFrame(i),a.size>0)){let{nodeLookup:A,updateNodePositions:H,onNodeDragStop:z,onSelectionDragStop:O}=t();if(p&&(H(a,!1),p=!1),r||z||!S&&O){let[$,P]=$t({nodeId:S,dragItems:a,nodeLookup:A,dragging:!1});r?.(M.sourceEvent,a,$,P),z?.(M.sourceEvent,$,P),S||O?.(M.sourceEvent,P)}}}).filter(M=>{let A=M.target;return!M.button&&(!b||!On(A,`.${b}`,w))&&(!u||On(A,u,w))});d.call(C)}function x(){d?.on(".drag",null)}return{update:m,destroy:x}}function Js(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())$e(r,_e(s))>0&&o.push(s);return o}var ei=250;function ti(e,t,n,o){let r=[],s=1/0,i=Js(e,n,t+ei);for(let a of i){let f=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of f){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:g,y:c}=xe(a,l,l.position,!0),d=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(c-e.y,2));d>t||(d<s?(r=[{...l,x:g,y:c}],s=d):d===s&&r.push({...l,x:g,y:c}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(f=>f.type===a)??r[0]}return r[0]}function ro(e,t,n,o,r,s=!1){let i=o.get(e);if(!i)return null;let a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],f=(n?a?.find(l=>l.id===n):a?.[0])??null;return f&&s?{...f,...xe(i,f,f.position,!0)}:f}function so(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ni(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var io=()=>!0;function oi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:f,lib:l,autoPanOnConnect:g,flowId:c,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:x=io,onReconnectEnd:b,updateConnection:u,getTransform:w,getFromHandle:N,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:I}){let k=Qt(e.target),R=0,C,{x:M,y:A}=le(e),H=so(s,I),z=a?.getBoundingClientRect(),O=!1;if(!z||!H)return;let $=ro(r,H,o,f,t);if(!$)return;let P=le(e,z),D=!1,V=null,B=!1,L=null;function Y(){if(!g||!z)return;let[q,W]=Zn(P,z,S);d({x:q,y:W}),R=requestAnimationFrame(Y)}let X={...$,nodeId:r,type:H,position:$.position},U=f.get(r),G={inProgress:!0,isValid:null,from:xe(U,X,F.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:P,toHandle:null,toPosition:Nn[X.position],toNode:null,pointer:P};function T(){O=!0,u(G),p?.(e,{nodeId:r,handleId:o,handleType:H})}_===0&&T();function Z(q){if(!O){let{x:ie,y:pe}=le(q),fe=ie-M,Ee=pe-A;if(!(fe*fe+Ee*Ee>_*_))return;T()}if(!N()||!X){Q(q);return}let W=w();P=le(q,z),C=ti(Oe(P,W,!1,[1,1]),n,f,X),D||(Y(),D=!0);let K=ao(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:k,lib:l,flowId:c,nodeLookup:f});L=K.handleDomNode,V=K.connection,B=ni(!!C,K.isValid);let ee=f.get(r),oe=ee?xe(ee,X,F.Left,!0):G.from,te={...G,from:oe,isValid:B,to:K.toHandle&&B?Ke({x:K.toHandle.x,y:K.toHandle.y},W):P,toHandle:K.toHandle,toPosition:B&&K.toHandle?K.toHandle.position:Nn[X.position],toNode:K.toHandle?f.get(K.toHandle.nodeId):null,pointer:P};u(te),G=te}function Q(q){if(!("touches"in q&&q.touches.length>0)){if(O){(C||L)&&V&&B&&y?.(V);let{inProgress:W,...K}=G,ee={...K,toPosition:G.toHandle?G.toPosition:null};m?.(q,ee),s&&b?.(q,ee)}h(),cancelAnimationFrame(R),D=!1,B=!1,V=null,L=null,k.removeEventListener("mousemove",Z),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",Z),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",Z),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",Z),k.addEventListener("touchend",Q)}function ao(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:f,isValidConnection:l=io,nodeLookup:g}){let c=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=le(e),y=i.elementFromPoint(h,p),m=y?.classList.contains(`${a}-flow__handle`)?y:d,x={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){let b=so(void 0,m),u=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!u||!b)return x;let _={source:c?u:o,sourceHandle:c?w:r,target:c?o:u,targetHandle:c?r:w};x.connection=_;let k=N&&S&&(n===ye.Strict?c&&b==="source"||!c&&b==="target":u!==o||w!==r);x.isValid=k&&l(_),x.toHandle=ro(u,b,w,g,n,!0)}return x}var yt={onPointerDown:oi,isValid:ao};function co({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=Xe(e);function s({translateExtent:a,width:f,height:l,zoomStep:g=1,pannable:c=!0,zoomable:d=!0,inversePan:h=!1}){let p=u=>{if(u.sourceEvent.type!=="wheel"||!t)return;let w=n(),N=u.sourceEvent.ctrlKey&&Le()?10:1,S=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*g,_=w[2]*Math.pow(2,S*N);t.scaleTo(_)},y=[0,0],m=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(y=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},x=u=>{let w=n();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!t)return;let N=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;let _=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-S[0]*_,y:w[1]-S[1]*_},k=[[0,0],[f,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},k,a)},b=At().on("start",m).on("zoom",c?x:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:zt}}var xt=e=>({x:e.x,y:e.y,zoom:e.k}),Ht=({x:e,y:t,zoom:n})=>_n.translate(e,t).scale(n),Me=(e,t)=>e.target.closest(`.${t}`),lo=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ri=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ot=(e,t=0,n=ri,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},uo=e=>{let t=e.ctrlKey&&Le()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function si({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:f,onPanZoomEnd:l}){return g=>{if(Me(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();let c=n.property("__zoom").k||1;if(g.ctrlKey&&i){let m=zt(g),x=uo(g),b=c*Math.pow(2,x);o.scaleTo(n,b,m,g);return}let d=g.deltaMode===1?20:1,h=r===ge.Vertical?0:g.deltaX*d,p=r===ge.Horizontal?0:g.deltaY*d;!Le()&&g.shiftKey&&r!==ge.Vertical&&(h=g.deltaY*d,p=0),o.translateBy(n,-(h/c)*s,-(p/c)*s,{internal:!0});let y=xt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f?.(g,y),e.panScrollTimeout=setTimeout(()=>{l?.(g,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(g,y))}}function ii({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Me(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ai({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=xt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function ci({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&lo(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,xt(s.transform))}}function li({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&lo(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=xt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function di({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:f,lib:l,connectionInProgress:g}){return c=>{let d=e||t,h=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Me(c,`${l}-flow__node`)||Me(c,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||g&&!p||Me(c,a)&&p||Me(c,f)&&(!p||r&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&c.touches?.length>1)return c.preventDefault(),!1;if(!d&&!r&&!h&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;let y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&y}}function fo({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:f}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),c=At().scaleExtent([t,n]).translateExtent(o),d=Xe(e).call(c);b({x:r.x,y:r.y,zoom:Pe(r.zoom,t,n)},[[0,0],[g.width,g.height]],o);let h=d.on("wheel.zoom"),p=d.on("dblclick.zoom");c.wheelDelta(uo);function y(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).transform(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function m({noWheelClassName:C,noPanClassName:M,onPaneContextMenu:A,userSelectionActive:H,panOnScroll:z,panOnDrag:O,panOnScrollMode:$,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:V,zoomOnScroll:B,zoomOnDoubleClick:L,zoomActivationKeyPressed:Y,lib:X,onTransformChange:U,connectionInProgress:J,paneClickDistance:G,selectionOnDrag:T}){H&&!l.isZoomingOrPanning&&x();let Z=z&&!Y&&!H;c.clickDistance(T?1/0:!ce(G)||G<0?0:G);let Q=Z?si({zoomPanValues:l,noWheelClassName:C,d3Selection:d,d3Zoom:c,panOnScrollMode:$,panOnScrollSpeed:P,zoomOnPinch:V,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):ii({noWheelClassName:C,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!H){let W=ai({zoomPanValues:l,onDraggingChange:f,onPanZoomStart:i});c.on("start",W);let K=ci({zoomPanValues:l,panOnDrag:O,onPaneContextMenu:!!A,onPanZoom:s,onTransformChange:U});c.on("zoom",K);let ee=li({zoomPanValues:l,panOnDrag:O,panOnScroll:z,onPaneContextMenu:A,onPanZoomEnd:a,onDraggingChange:f});c.on("end",ee)}let q=di({zoomActivationKeyPressed:Y,panOnDrag:O,zoomOnScroll:B,panOnScroll:z,zoomOnDoubleClick:L,zoomOnPinch:V,userSelectionActive:H,noPanClassName:M,noWheelClassName:C,lib:X,connectionInProgress:J});c.filter(q),L?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function x(){c.on("zoom",null)}async function b(C,M,A){let H=Ht(C),z=c?.constrain()(H,M,A);return z&&await y(z),new Promise(O=>O(z))}async function u(C,M){let A=Ht(C);return await y(A,M),new Promise(H=>H(A))}function w(C){if(d){let M=Ht(C),A=d.property("__zoom");(A.k!==C.zoom||A.x!==C.x||A.y!==C.y)&&c?.transform(d,M,null,{sync:!0})}}function N(){let C=d?Cn(d.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleTo(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function _(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleBy(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function I(C){c?.scaleExtent(C)}function k(C){c?.translateExtent(C)}function R(C){let M=!ce(C)||C<0?0:C;c?.clickDistance(M)}return{update:m,destroy:x,setViewport:u,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:_,setScaleExtent:I,setTranslateExtent:k,syncViewport:w,setClickDistance:R}}var be;(function(e){e.Line="line",e.Handle="handle"})(be||(be={}));function ui({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){let i=e-t,a=n-o,f=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(f[0]=f[0]*-1),a&&s&&(f[1]=f[1]*-1),f}function Ln(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function he(e,t){return Math.max(0,t-e)}function me(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function Tn(e,t){return e?!t:t}function fi(e,t,n,o,r,s,i,a){let{affectsX:f,affectsY:l}=t,{isHorizontal:g,isVertical:c}=t,d=g&&c,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:x,maxHeight:b}=o,{x:u,y:w,width:N,height:S,aspectRatio:_}=e,I=Math.floor(g?h-e.pointerX:0),k=Math.floor(c?p-e.pointerY:0),R=N+(f?-I:I),C=S+(l?-k:k),M=-s[0]*N,A=-s[1]*S,H=rt(R,y,m),z=rt(C,x,b);if(i){let P=0,D=0;f&&I<0?P=he(u+I+M,i[0][0]):!f&&I>0&&(P=me(u+R+M,i[1][0])),l&&k<0?D=he(w+k+A,i[0][1]):!l&&k>0&&(D=me(w+C+A,i[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(a){let P=0,D=0;f&&I>0?P=me(u+I,a[0][0]):!f&&I<0&&(P=he(u+R,a[1][0])),l&&k>0?D=me(w+k,a[0][1]):!l&&k<0&&(D=he(w+C,a[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(r){if(g){let P=rt(R/_,x,b)*_;if(H=Math.max(H,P),i){let D=0;!f&&!l||f&&!l&&d?D=me(w+A+R/_,i[1][1])*_:D=he(w+A+(f?I:-I)/_,i[0][1])*_,H=Math.max(H,D)}if(a){let D=0;!f&&!l||f&&!l&&d?D=he(w+R/_,a[1][1])*_:D=me(w+(f?I:-I)/_,a[0][1])*_,H=Math.max(H,D)}}if(c){let P=rt(C*_,y,m)/_;if(z=Math.max(z,P),i){let D=0;!f&&!l||l&&!f&&d?D=me(u+C*_+M,i[1][0])/_:D=he(u+(l?k:-k)*_+M,i[0][0])/_,z=Math.max(z,D)}if(a){let D=0;!f&&!l||l&&!f&&d?D=he(u+C*_,a[1][0])/_:D=me(u+(l?k:-k)*_,a[0][0])/_,z=Math.max(z,D)}}}k=k+(k<0?z:-z),I=I+(I<0?H:-H),r&&(d?R>C*_?k=(Tn(f,l)?-I:I)/_:I=(Tn(f,l)?-k:k)*_:g?(k=I/_,l=f):(I=k*_,f=l));let O=f?u+I:u,$=l?w+k:w;return{width:N+(f?-I:I),height:S+(l?-k:k),x:s[0]*I*(f?-1:1)+O,y:s[1]*k*(l?-1:1)+$}}var go={width:0,height:0,x:0,y:0},gi={...go,pointerX:0,pointerY:0,aspectRatio:1};function pi(e){return[[0,0],[e.measured.width,e.measured.height]]}function hi(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,f=n[1]*i;return[[o-a,r-f],[o+s-a,r+i-f]]}function po({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let s=Xe(e),i={controlDirection:Ln("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:g,keepAspectRatio:c,resizeDirection:d,onResizeStart:h,onResize:p,onResizeEnd:y,shouldResize:m}){let x={...go},b={...gi};i={boundaries:g,resizeDirection:d,keepAspectRatio:c,controlDirection:Ln(l)};let u,w=null,N=[],S,_,I,k=!1,R=Dt().on("start",C=>{let{nodeLookup:M,transform:A,snapGrid:H,snapToGrid:z,nodeOrigin:O,paneDomNode:$}=n();if(u=M.get(t),!u)return;w=$?.getBoundingClientRect()??null;let{xSnapped:P,ySnapped:D}=We(C.sourceEvent,{transform:A,snapGrid:H,snapToGrid:z,containerBounds:w});x={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},b={...x,pointerX:P,pointerY:D,aspectRatio:x.width/x.height},S=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(S=M.get(u.parentId),_=S&&u.extent==="parent"?pi(S):void 0),N=[],I=void 0;for(let[V,B]of M)if(B.parentId===t&&(N.push({id:V,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let L=hi(B,u,B.origin??O);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}h?.(C,{...x})}).on("drag",C=>{let{transform:M,snapGrid:A,snapToGrid:H,nodeOrigin:z}=n(),O=We(C.sourceEvent,{transform:M,snapGrid:A,snapToGrid:H,containerBounds:w}),$=[];if(!u)return;let{x:P,y:D,width:V,height:B}=x,L={},Y=u.origin??z,{width:X,height:U,x:J,y:G}=fi(b,i.controlDirection,O,i.boundaries,i.keepAspectRatio,Y,_,I),T=X!==V,Z=U!==B,Q=J!==P&&T,q=G!==D&&Z;if(!Q&&!q&&!T&&!Z)return;if((Q||q||Y[0]===1||Y[1]===1)&&(L.x=Q?J:x.x,L.y=q?G:x.y,x.x=L.x,x.y=L.y,N.length>0)){let oe=J-P,te=G-D;for(let ie of N)ie.position={x:ie.position.x-oe+Y[0]*(X-V),y:ie.position.y-te+Y[1]*(U-B)},$.push(ie)}if((T||Z)&&(L.width=T&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:x.width,L.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?U:x.height,x.width=L.width,x.height=L.height),S&&u.expandParent){let oe=Y[0]*(L.width??0);L.x&&L.x<oe&&(x.x=oe,b.x=b.x-(L.x-oe));let te=Y[1]*(L.height??0);L.y&&L.y<te&&(x.y=te,b.y=b.y-(L.y-te))}let W=ui({width:x.width,prevWidth:V,height:x.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),K={...x,direction:W};m?.(C,K)!==!1&&(k=!0,p?.(C,K),o(L,$))}).on("end",C=>{k&&(y?.(C,{...x}),r?.({...x}),k=!1)});s.call(R)}function f(){s.on(".drag",null)}return{update:a,destroy:f}}var E=Ze(Os()),v=Ze(et());function se(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=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var No=Ze(et(),1),ko=Ze(So(),1);var vo=e=>{let t,n=new Set,o=(g,c)=>{let d=typeof g=="function"?g(t):g;if(!Object.is(d,t)){let h=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},r=()=>t,f={setState:o,getState:r,getInitialState:()=>l,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(import.meta.env?import.meta.env.MODE: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()}},l=t=e(o,r,f);return f},_o=e=>e?vo(e):vo;var{useDebugValue:Ai}=No.default,{useSyncExternalStoreWithSelector:$i}=ko.default,Hi=e=>e;function ln(e,t=Hi,n){let o=$i(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ai(o),o}var Co=(e,t)=>{let n=_o(e),o=(r,s=t)=>ln(n,r,s);return Object.assign(o,n),o},Mo=(e,t)=>e?Co(e,t):Co;function ne(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(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Oi=Ze(Hs()),_t=(0,v.createContext)(null),Li=_t.Provider,jo=ae.error001();function j(e,t){let n=(0,v.useContext)(_t);if(n===null)throw new Error(jo);return ln(n,e,t)}function re(){let e=(0,v.useContext)(_t);if(e===null)throw new Error(jo);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Io={display:"none"},Ti={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Jo="react-flow__node-desc",er="react-flow__edge-desc",Ri="react-flow__aria-live",Bi=e=>e.ariaLiveMessage,Vi=e=>e.ariaLabelConfig;function Fi({rfId:e}){let t=j(Bi);return(0,E.jsx)("div",{id:`${Ri}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ti,children:t})}function Yi({rfId:e,disableKeyboardA11y:t}){let n=j(Vi);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{id:`${Jo}-${e}`,style:Io,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,E.jsx)("div",{id:`${er}-${e}`,style:Io,children:n["edge.a11yDescription.default"]}),!t&&(0,E.jsx)(Fi,{rfId:e})]})}var Ct=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{let i=`${e}`.split("-");return(0,E.jsx)("div",{className:se(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Ct.displayName="Panel";function Zi({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,E.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,E.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xi=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},wt=e=>e.id;function Wi(e,t){return ne(e.selectedNodes.map(wt),t.selectedNodes.map(wt))&&ne(e.selectedEdges.map(wt),t.selectedEdges.map(wt))}function Ki({onSelectionChange:e}){let t=re(),{selectedNodes:n,selectedEdges:o}=j(Xi,Wi);return(0,v.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}var Gi=e=>!!e.onSelectionChangeHandlers;function qi({onSelectionChange:e}){let t=j(Gi);return e||t?(0,E.jsx)(Ki,{onSelectionChange:e}):null}var tr=[0,0],Ui={x:0,y:0,zoom:1},Qi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Po=[...Qi,"rfId"],ji=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zo={translateExtent:De,nodeOrigin:tr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ji(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:f}=j(ji,ne),l=re();(0,v.useEffect)(()=>(f(e.defaultNodes,e.defaultEdges),()=>{g.current=zo,a()}),[]);let g=(0,v.useRef)(zo);return(0,v.useEffect)(()=>{for(let c of Po){let d=e[c],h=g.current[c];d!==h&&(typeof e[c]>"u"||(c==="nodes"?t(d):c==="edges"?n(d):c==="minZoom"?o(d):c==="maxZoom"?r(d):c==="translateExtent"?s(d):c==="nodeExtent"?i(d):c==="ariaLabelConfig"?l.setState({ariaLabelConfig:Wn(d)}):c==="fitView"?l.setState({fitViewQueued:d}):c==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[c]:d})))}g.current=e},Po.map(c=>e[c])),null}function Do(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ea(e){let[t,n]=(0,v.useState)(e==="system"?null:e);return(0,v.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Do(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Do()?.matches?"dark":"light"}var Ao=typeof document<"u"?document:null;function Qe(e=null,t={target:Ao,actInsideInputWithModifier:!0}){let[n,o]=(0,v.useState)(!1),r=(0,v.useRef)(!1),s=(0,v.useRef)(new Set([])),[i,a]=(0,v.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
1
|
+
import{b as Xe,c as zt,d as Dt,f as tt,h as nt,k as _n,l as Cn,m as At}from"./embed-page-chunk-S4XZPBRM.js";import{a as Os}from"./embed-page-chunk-MB65DZAX.js";import{a as Hs}from"./embed-page-chunk-FZRTVFHF.js";import{a as et}from"./embed-page-chunk-4BKXE5ON.js";import{b as Je,e as Ze}from"./embed-page-chunk-6Y3UYJ6Z.js";var mo=Je(ho=>{"use strict";var Te=et();function mi(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yi=typeof Object.is=="function"?Object.is:mi,xi=Te.useState,bi=Te.useEffect,wi=Te.useLayoutEffect,Ei=Te.useDebugValue;function Si(e,t){var n=t(),o=xi({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return wi(function(){r.value=n,r.getSnapshot=t,cn(r)&&s({inst:r})},[e,n,t]),bi(function(){return cn(r)&&s({inst:r}),e(function(){cn(r)&&s({inst:r})})},[e]),Ei(n),n}function cn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yi(e,n)}catch{return!0}}function vi(e,t){return t()}var _i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?vi:Si;ho.useSyncExternalStore=Te.useSyncExternalStore!==void 0?Te.useSyncExternalStore:_i});var xo=Je((tl,yo)=>{"use strict";yo.exports=mo()});var wo=Je(bo=>{"use strict";var bt=et(),Ci=xo();function Ni(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ki=typeof Object.is=="function"?Object.is:Ni,Mi=Ci.useSyncExternalStore,Ii=bt.useRef,Pi=bt.useEffect,zi=bt.useMemo,Di=bt.useDebugValue;bo.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=Ii(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=zi(function(){function f(h){if(!l){if(l=!0,g=h,h=o(h),r!==void 0&&i.hasValue){var p=i.value;if(r(p,h))return c=p}return c=h}if(p=c,ki(g,h))return p;var y=o(h);return r!==void 0&&r(p,y)?(g=h,p):(g=h,c=y)}var l=!1,g,c,d=n===void 0?null:n;return[function(){return f(t())},d===null?void 0:function(){return f(d())}]},[t,n,o,r]);var a=Mi(e,s[0],s[1]);return Pi(function(){i.hasValue=!0,i.value=a},[a]),Di(a),a}});var So=Je((ol,Eo)=>{"use strict";Eo.exports=wo()});var ae={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,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,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.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},De=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Tt=["Enter"," ","Escape"],Rt={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},ye;(function(e){e.Strict="strict",e.Loose="loose"})(ye||(ye={}));var ge;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ge||(ge={}));var Se;(function(e){e.Partial="partial",e.Full="full"})(Se||(Se={}));var Bt={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},de;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(de||(de={}));var Ie;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ie||(Ie={}));var F;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(F||(F={}));var Nn={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top};function Vt(e){return e===null?null:e?"valid":"invalid"}var Ft=e=>"id"in e&&"source"in e&&"target"in e,Rn=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yt=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ge=(e,t=[0,0])=>{let{width:n,height:o}=ue(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Zt=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((o,r)=>{let s=typeof r=="string",i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):Yt(r)?r:t.nodeLookup.get(r.id));let a=i?st(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return at(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ct(n)},Ae=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=at(n,st(r)),o=!0)}),o?ct(n):{x:0,y:0,width:0,height:0}},it=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{let a={...Oe(t,[n,o,r]),width:t.width/r,height:t.height/r},f=[];for(let l of e.values()){let{measured:g,selectable:c=!0,hidden:d=!1}=l;if(i&&!c||d)continue;let h=g.width??l.width??l.initialWidth??null,p=g.height??l.height??l.initialHeight??null,y=$e(a,_e(l)),m=(h??0)*(p??0),x=s&&y>0;(!l.internals.handleBounds||x||y>=m||l.dragging)&&f.push(l)}return f},Bn=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ls(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Vn({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);let a=Ls(e,i),f=Ae(a),l=qe(f,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Xt({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){let i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:f,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},g=i.origin??o,c=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",ae.error005());else{let h=a.measured.width,p=a.measured.height;h&&p&&(c=[[f,l],[f+h,l+p]])}else a&&ze(i.extent)&&(c=[[i.extent[0][0]+f,i.extent[0][1]+l],[i.extent[1][0]+f,i.extent[1][1]+l]]);let d=ze(c)?ve(t,c,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",ae.error015()),{position:{x:d.x-f+(i.measured.width??0)*g[0],y:d.y-l+(i.measured.height??0)*g[1]},positionAbsolute:d}}async function Fn({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let s=new Set(e.map(d=>d.id)),i=[];for(let d of n){if(d.deletable===!1)continue;let h=s.has(d.id),p=!h&&d.parentId&&i.find(y=>y.id===d.parentId);(h||p)&&i.push(d)}let a=new Set(t.map(d=>d.id)),f=o.filter(d=>d.deletable!==!1),g=Bn(i,f);for(let d of f)a.has(d.id)&&!g.find(p=>p.id===d.id)&&g.push(d);if(!r)return{edges:g,nodes:i};let c=await r({nodes:i,edges:g});return typeof c=="boolean"?c?{edges:g,nodes:i}:{edges:[],nodes:[]}:c}var Pe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ve=(e={x:0,y:0},t,n)=>({x:Pe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Pe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Yn(e,t,n){let{width:o,height:r}=ue(n),{x:s,y:i}=n.internals.positionAbsolute;return ve(e,[[s,i],[s+o,i+r]],t)}var kn=(e,t,n)=>e<t?Pe(Math.abs(e-t),1,t)/t:e>n?-Pe(Math.abs(e-n),1,t)/t:0,Zn=(e,t,n=15,o=40)=>{let r=kn(e.x,o,t.width-o)*n,s=kn(e.y,o,t.height-o)*n;return[r,s]},at=(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)}),Lt=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),ct=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),_e=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},st=(e,t=[0,0])=>{let{x:n,y:o}=Yt(e)?e.internals.positionAbsolute:Ge(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Wt=(e,t)=>ct(at(Lt(e),Lt(t))),$e=(e,t)=>{let 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)},Kt=e=>ce(e.width)&&ce(e.height)&&ce(e.x)&&ce(e.y),ce=e=>!isNaN(e)&&isFinite(e),Gt=(e,t)=>{},He=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Oe=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return s?He(a,i):a},Ke=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ke(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ts(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=ke(e,n),r=ke(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=ke(e.top??e.y??0,n),r=ke(e.bottom??e.y??0,n),s=ke(e.left??e.x??0,t),i=ke(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Rs(e,t,n,o,r,s){let{x:i,y:a}=Ke(e,[t,n,o]),{x:f,y:l}=Ke({x:e.x+e.width,y:e.y+e.height},[t,n,o]),g=r-f,c=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(g),bottom:Math.floor(c)}}var qe=(e,t,n,o,r,s)=>{let i=Ts(s,t,n),a=(t-i.x)/e.width,f=(n-i.y)/e.height,l=Math.min(a,f),g=Pe(l,o,r),c=e.x+e.width/2,d=e.y+e.height/2,h=t/2-c*g,p=n/2-d*g,y=Rs(e,h,p,g,t,n),m={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:g}},Le=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ze(e){return e!=null&&e!=="parent"}function ue(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function lt(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function qt(e,t={width:0,height:0},n,o,r){let s={...e},i=o.get(n);if(i){let a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Ut(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xn(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Wn(e){return{...Rt,...e||{}}}function We(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:s,y:i}=le(e),a=Oe({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:f,y:l}=n?He(a,t):a;return{xSnapped:f,ySnapped:l,...a}}var dt=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qt=e=>e?.getRootNode?.()||window?.document,Bs=["INPUT","SELECT","TEXTAREA"];function jt(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bs.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Jt=e=>"clientX"in e,le=(e,t)=>{let n=Jt(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Mn=(e,t,n,o,r)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{let a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...dt(i)}})};function ut({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){let f=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,g=Math.abs(f-e),c=Math.abs(l-t);return[f,l,g,c]}function ot(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function In({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case F.Left:return[t-ot(t-o,s),n];case F.Right:return[t+ot(o-t,s),n];case F.Top:return[t,n-ot(n-r,s)];case F.Bottom:return[t,n+ot(r-n,s)]}}function ft({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,curvature:i=.25}){let[a,f]=In({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,g]=In({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[c,d,h,p]=ut({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:f,targetControlX:l,targetControlY:g});return[`M${e},${t} C${a},${f} ${l},${g} ${o},${r}`,c,d,h,p]}function en({sourceX:e,sourceY:t,targetX:n,targetY:o}){let r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Kn({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;let i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Gn({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let s=at(st(e),st(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $e(i,ct(s))>0}var Vs=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Fs=(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)),tn=(e,t,n={})=>{if(!e.source||!e.target)return Gt("006",ae.error006()),t;let o=n.getEdgeId||Vs,r;return Ft(e)?r={...e}:r={...e,id:o(e)},Fs(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gt({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,s,i,a]=en({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}var Pn={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}},Ys=({source:e,sourcePosition:t=F.Bottom,target:n})=>t===F.Left||t===F.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},zn=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zs({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:r,offset:s,stepPosition:i}){let a=Pn[t],f=Pn[o],l={x:e.x+a.x*s,y:e.y+a.y*s},g={x:n.x+f.x*s,y:n.y+f.y*s},c=Ys({source:l,sourcePosition:t,target:g}),d=c.x!==0?"x":"y",h=c[d],p=[],y,m,x={x:0,y:0},b={x:0,y:0},[,,u,w]=en({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*f[d]===-1){d==="x"?(y=r.x??l.x+(g.x-l.x)*i,m=r.y??(l.y+g.y)/2):(y=r.x??(l.x+g.x)/2,m=r.y??l.y+(g.y-l.y)*i);let S=[{x:y,y:l.y},{x:y,y:g.y}],_=[{x:l.x,y:m},{x:g.x,y:m}];a[d]===h?p=d==="x"?S:_:p=d==="x"?_:S}else{let S=[{x:l.x,y:g.y}],_=[{x:g.x,y:l.y}];if(d==="x"?p=a.x===h?_:S:p=a.y===h?S:_,t===o){let M=Math.abs(e[d]-n[d]);if(M<=s){let A=Math.min(s-1,s-M);a[d]===h?x[d]=(l[d]>e[d]?-1:1)*A:b[d]=(g[d]>n[d]?-1:1)*A}}if(t!==o){let M=d==="x"?"y":"x",A=a[d]===f[M],H=l[M]>g[M],z=l[M]<g[M];(a[d]===1&&(!A&&H||A&&z)||a[d]!==1&&(!A&&z||A&&H))&&(p=d==="x"?S:_)}let I={x:l.x+x.x,y:l.y+x.y},k={x:g.x+b.x,y:g.y+b.y},R=Math.max(Math.abs(I.x-p[0].x),Math.abs(k.x-p[0].x)),C=Math.max(Math.abs(I.y-p[0].y),Math.abs(k.y-p[0].y));R>=C?(y=(I.x+k.x)/2,m=p[0].y):(y=p[0].x,m=(I.y+k.y)/2)}return[[e,{x:l.x+x.x,y:l.y+x.y},...p,{x:g.x+b.x,y:g.y+b.y},n],y,m,u,w]}function Xs(e,t,n,o){let r=Math.min(zn(e,t)/2,zn(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){let l=e.x<n.x?-1:1,g=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*g}`}let a=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${s},${i+r*f}Q ${s},${i} ${s+r*a},${i}`}function Ue({sourceX:e,sourceY:t,sourcePosition:n=F.Bottom,targetX:o,targetY:r,targetPosition:s=F.Top,borderRadius:i=5,centerX:a,centerY:f,offset:l=20,stepPosition:g=.5}){let[c,d,h,p,y]=Zs({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:f},offset:l,stepPosition:g});return[c.reduce((x,b,u)=>{let w="";return u>0&&u<c.length-1?w=Xs(c[u-1],b,c[u+1],i):w=`${u===0?"M":"L"}${b.x} ${b.y}`,x+=w,x},""),d,h,p,y]}function Dn(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function qn(e){let{sourceNode:t,targetNode:n}=e;if(!Dn(t)||!Dn(n))return null;let o=t.internals.handleBounds||An(t.handles),r=n.internals.handleBounds||An(n.handles),s=$n(o?.source??[],e.sourceHandle),i=$n(e.connectionMode===ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",ae.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=s?.position||F.Bottom,f=i?.position||F.Top,l=xe(t,s,a),g=xe(n,i,f);return{sourceX:l.x,sourceY:l.y,targetX:g.x,targetY:g.y,sourcePosition:a,targetPosition:f}}function An(e){if(!e)return null;let t=[],n=[];for(let o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function xe(e,t,n=F.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??ue(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case F.Top:return{x:r+i/2,y:s};case F.Right:return{x:r+i,y:s+a/2};case F.Bottom:return{x:r+i/2,y:s+a};case F.Left:return{x:r,y:s+a/2}}}function $n(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pt(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Un(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(f=>{if(f&&typeof f=="object"){let l=pt(f,t);s.has(l)||(i.push({id:l,color:f.color||n,...f}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}var Qn=1e3,Ws=10,nn={nodeOrigin:[0,0],nodeExtent:De,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ks={...nn,checkEquality:!0};function on(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function jn(e,t,n){let o=on(nn,n);for(let r of e.values())if(r.parentId)sn(r,e,t,o);else{let s=Ge(r,o.nodeOrigin),i=ze(r.extent)?r.extent:o.nodeExtent,a=ve(s,i,ue(r));r.internals.positionAbsolute=a}}function Gs(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function rn(e){return e==="manual"}function ht(e,t,n,o={}){let r=on(Ks,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!rn(r.zIndexMode)?Qn:0,f=e.length>0;t.clear(),n.clear();for(let l of e){let g=i.get(l.id);if(r.checkEquality&&l===g?.internals.userNode)t.set(l.id,g);else{let c=Ge(l,r.nodeOrigin),d=ze(l.extent)?l.extent:r.nodeExtent,h=ve(c,d,ue(l));g={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:Gs(l,g),z:Jn(l,a,r.zIndexMode),userNode:l}},t.set(l.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(f=!1),l.parentId&&sn(g,t,n,o,s)}return f}function qs(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function sn(e,t,n,o,r){let{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:f}=on(nn,o),l=e.parentId,g=t.get(l);if(!g){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}qs(e,n),r&&!g.parentId&&g.internals.rootParentIndex===void 0&&f==="auto"&&(g.internals.rootParentIndex=++r.i,g.internals.z=g.internals.z+r.i*Ws),r&&g.internals.rootParentIndex!==void 0&&(r.i=g.internals.rootParentIndex);let c=s&&!rn(f)?Qn:0,{x:d,y:h,z:p}=Us(e,g,i,a,c,f),{positionAbsolute:y}=e.internals,m=d!==y.x||h!==y.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:y,z:p}})}function Jn(e,t,n){let o=ce(e.zIndex)?e.zIndex:0;return rn(n)?o:o+(e.selected?t:0)}function Us(e,t,n,o,r,s){let{x:i,y:a}=t.internals.positionAbsolute,f=ue(e),l=Ge(e,n),g=ze(e.extent)?ve(l,e.extent,f):l,c=ve({x:i+g.x,y:a+g.y},o,f);e.extent==="parent"&&(c=Yn(c,f,t));let d=Jn(e,r,s),h=t.internals.z??0;return{x:c.x,y:c.y,z:h>=d?h+1:d}}function mt(e,t,n,o=[0,0]){let r=[],s=new Map;for(let i of e){let a=t.get(i.parentId);if(!a)continue;let f=s.get(i.parentId)?.expandedRect??_e(a),l=Wt(f,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},f)=>{let l=a.internals.positionAbsolute,g=ue(a),c=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,h=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(g.width,Math.round(i.width)),y=Math.max(g.height,Math.round(i.height)),m=(p-g.width)*c[0],x=(y-g.height)*c[1];(d>0||h>0||m||x)&&(r.push({id:f,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+x}}),n.get(f)?.forEach(b=>{e.some(u=>u.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(g.width<i.width||g.height<i.height||d||h)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?c[0]*d-m:0),height:y+(h?c[1]*h-x:0)}})}),r}function eo(e,t,n,o,r,s,i){let a=o?.querySelector(".xyflow__viewport"),f=!1;if(!a)return{changes:[],updatedInternals:f};let l=[],g=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(g.transform),d=[];for(let h of e.values()){let p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),f=!0;continue}let y=dt(h.nodeElement),m=p.measured.width!==y.width||p.measured.height!==y.height;if(!!(y.width&&y.height&&(m||!p.internals.handleBounds||h.force))){let b=h.nodeElement.getBoundingClientRect(),u=ze(p.extent)?p.extent:s,{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=Yn(w,y,t.get(p.parentId)):u&&(w=ve(w,u,y));let N={...p,measured:y,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:Mn("source",h.nodeElement,b,c,p.id),target:Mn("target",h.nodeElement,b,c,p.id)}}};t.set(p.id,N),p.parentId&&sn(N,t,n,{nodeOrigin:r,zIndexMode:i}),f=!0,m&&(l.push({id:p.id,type:"dimensions",dimensions:y}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:_e(N,r)}))}}if(d.length>0){let h=mt(d,t,n,r);l.push(...h)}return{changes:l,updatedInternals:f}}async function to({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function Hn(e,t,n,o,r,s){let i=r,a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;let f=o.get(i)||new Map;if(o.set(i,f.set(n,t)),s){i=`${r}-${e}-${s}`;let l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function an(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,f={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,g=`${s}-${a}--${r}-${i}`;Hn("source",f,g,e,r,i),Hn("target",f,l,e,s,a),t.set(o.id,o)}}function no(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:no(n,t):!1}function On(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Qs(e,t,n,o){let r=new Map;for(let[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!no(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){let a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function $t({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[i,a]of t){let f=n.get(i)?.internals.userNode;f&&r.push({...f,position:a.position,dragging:o})}if(!e)return[r[0],r];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function js({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let s={x:n-r.distance.x,y:o-r.distance.y},i=He(s,t);return{x:i.x-s.x,y:i.y-s.y}}function oo({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,f=!1,l={x:0,y:0},g=null,c=!1,d=null,h=!1,p=!1,y=null;function m({noDragClassName:b,handleSelector:u,domNode:w,isSelectable:N,nodeId:S,nodeClickDistance:_=0}){d=Xe(w);function I({x:M,y:A}){let{nodeLookup:H,nodeExtent:z,snapGrid:O,snapToGrid:$,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:V,onError:B,updateNodePositions:L}=t();s={x:M,y:A};let Y=!1,X=a.size>1,U=X&&z?Lt(Ae(a)):null,J=X&&$?js({dragItems:a,snapGrid:O,x:M,y:A}):null;for(let[G,T]of a){if(!H.has(G))continue;let Z={x:M-T.distance.x,y:A-T.distance.y};$&&(Z=J?{x:Math.round(Z.x+J.x),y:Math.round(Z.y+J.y)}:He(Z,O));let Q=null;if(X&&z&&!T.extent&&U){let{positionAbsolute:K}=T.internals,ee=K.x-U.x+z[0][0],oe=K.x+T.measured.width-U.x2+z[1][0],te=K.y-U.y+z[0][1],ie=K.y+T.measured.height-U.y2+z[1][1];Q=[[ee,te],[oe,ie]]}let{position:q,positionAbsolute:W}=Xt({nodeId:G,nextPosition:Z,nodeLookup:H,nodeExtent:Q||z,nodeOrigin:P,onError:B});Y=Y||T.position.x!==q.x||T.position.y!==q.y,T.position=q,T.internals.positionAbsolute=W}if(p=p||Y,!!Y&&(L(a,!0),y&&(o||D||!S&&V))){let[G,T]=$t({nodeId:S,dragItems:a,nodeLookup:H});o?.(y,a,G,T),D?.(y,G,T),S||V?.(y,T)}}async function k(){if(!g)return;let{transform:M,panBy:A,autoPanSpeed:H,autoPanOnNodeDrag:z}=t();if(!z){f=!1,cancelAnimationFrame(i);return}let[O,$]=Zn(l,g,H);(O!==0||$!==0)&&(s.x=(s.x??0)-O/M[2],s.y=(s.y??0)-$/M[2],await A({x:O,y:$})&&I(s)),i=requestAnimationFrame(k)}function R(M){let{nodeLookup:A,multiSelectionActive:H,nodesDraggable:z,transform:O,snapGrid:$,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:B,unselectNodesAndEdges:L}=t();c=!0,(!D||!N)&&!H&&S&&(A.get(S)?.selected||L()),N&&D&&S&&e?.(S);let Y=We(M.sourceEvent,{transform:O,snapGrid:$,snapToGrid:P,containerBounds:g});if(s=Y,a=Qs(A,z,Y,S),a.size>0&&(n||V||!S&&B)){let[X,U]=$t({nodeId:S,dragItems:a,nodeLookup:A});n?.(M.sourceEvent,a,X,U),V?.(M.sourceEvent,X,U),S||B?.(M.sourceEvent,U)}}let C=Dt().clickDistance(_).on("start",M=>{let{domNode:A,nodeDragThreshold:H,transform:z,snapGrid:O,snapToGrid:$}=t();g=A?.getBoundingClientRect()||null,h=!1,p=!1,y=M.sourceEvent,H===0&&R(M),s=We(M.sourceEvent,{transform:z,snapGrid:O,snapToGrid:$,containerBounds:g}),l=le(M.sourceEvent,g)}).on("drag",M=>{let{autoPanOnNodeDrag:A,transform:H,snapGrid:z,snapToGrid:O,nodeDragThreshold:$,nodeLookup:P}=t(),D=We(M.sourceEvent,{transform:H,snapGrid:z,snapToGrid:O,containerBounds:g});if(y=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||S&&!P.has(S))&&(h=!0),!h){if(!f&&A&&c&&(f=!0,k()),!c){let V=le(M.sourceEvent,g),B=V.x-l.x,L=V.y-l.y;Math.sqrt(B*B+L*L)>$&&R(M)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&a&&c&&(l=le(M.sourceEvent,g),I(D))}}).on("end",M=>{if(!(!c||h)&&(f=!1,c=!1,cancelAnimationFrame(i),a.size>0)){let{nodeLookup:A,updateNodePositions:H,onNodeDragStop:z,onSelectionDragStop:O}=t();if(p&&(H(a,!1),p=!1),r||z||!S&&O){let[$,P]=$t({nodeId:S,dragItems:a,nodeLookup:A,dragging:!1});r?.(M.sourceEvent,a,$,P),z?.(M.sourceEvent,$,P),S||O?.(M.sourceEvent,P)}}}).filter(M=>{let A=M.target;return!M.button&&(!b||!On(A,`.${b}`,w))&&(!u||On(A,u,w))});d.call(C)}function x(){d?.on(".drag",null)}return{update:m,destroy:x}}function Js(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())$e(r,_e(s))>0&&o.push(s);return o}var ei=250;function ti(e,t,n,o){let r=[],s=1/0,i=Js(e,n,t+ei);for(let a of i){let f=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of f){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:g,y:c}=xe(a,l,l.position,!0),d=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(c-e.y,2));d>t||(d<s?(r=[{...l,x:g,y:c}],s=d):d===s&&r.push({...l,x:g,y:c}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(f=>f.type===a)??r[0]}return r[0]}function ro(e,t,n,o,r,s=!1){let i=o.get(e);if(!i)return null;let a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],f=(n?a?.find(l=>l.id===n):a?.[0])??null;return f&&s?{...f,...xe(i,f,f.position,!0)}:f}function so(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ni(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var io=()=>!0;function oi(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:f,lib:l,autoPanOnConnect:g,flowId:c,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:y,onConnectEnd:m,isValidConnection:x=io,onReconnectEnd:b,updateConnection:u,getTransform:w,getFromHandle:N,autoPanSpeed:S,dragThreshold:_=1,handleDomNode:I}){let k=Qt(e.target),R=0,C,{x:M,y:A}=le(e),H=so(s,I),z=a?.getBoundingClientRect(),O=!1;if(!z||!H)return;let $=ro(r,H,o,f,t);if(!$)return;let P=le(e,z),D=!1,V=null,B=!1,L=null;function Y(){if(!g||!z)return;let[q,W]=Zn(P,z,S);d({x:q,y:W}),R=requestAnimationFrame(Y)}let X={...$,nodeId:r,type:H,position:$.position},U=f.get(r),G={inProgress:!0,isValid:null,from:xe(U,X,F.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:P,toHandle:null,toPosition:Nn[X.position],toNode:null,pointer:P};function T(){O=!0,u(G),p?.(e,{nodeId:r,handleId:o,handleType:H})}_===0&&T();function Z(q){if(!O){let{x:ie,y:pe}=le(q),fe=ie-M,Ee=pe-A;if(!(fe*fe+Ee*Ee>_*_))return;T()}if(!N()||!X){Q(q);return}let W=w();P=le(q,z),C=ti(Oe(P,W,!1,[1,1]),n,f,X),D||(Y(),D=!0);let K=ao(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:k,lib:l,flowId:c,nodeLookup:f});L=K.handleDomNode,V=K.connection,B=ni(!!C,K.isValid);let ee=f.get(r),oe=ee?xe(ee,X,F.Left,!0):G.from,te={...G,from:oe,isValid:B,to:K.toHandle&&B?Ke({x:K.toHandle.x,y:K.toHandle.y},W):P,toHandle:K.toHandle,toPosition:B&&K.toHandle?K.toHandle.position:Nn[X.position],toNode:K.toHandle?f.get(K.toHandle.nodeId):null,pointer:P};u(te),G=te}function Q(q){if(!("touches"in q&&q.touches.length>0)){if(O){(C||L)&&V&&B&&y?.(V);let{inProgress:W,...K}=G,ee={...K,toPosition:G.toHandle?G.toPosition:null};m?.(q,ee),s&&b?.(q,ee)}h(),cancelAnimationFrame(R),D=!1,B=!1,V=null,L=null,k.removeEventListener("mousemove",Z),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",Z),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",Z),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",Z),k.addEventListener("touchend",Q)}function ao(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:f,isValidConnection:l=io,nodeLookup:g}){let c=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${f}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=le(e),y=i.elementFromPoint(h,p),m=y?.classList.contains(`${a}-flow__handle`)?y:d,x={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){let b=so(void 0,m),u=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),N=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!u||!b)return x;let _={source:c?u:o,sourceHandle:c?w:r,target:c?o:u,targetHandle:c?r:w};x.connection=_;let k=N&&S&&(n===ye.Strict?c&&b==="source"||!c&&b==="target":u!==o||w!==r);x.isValid=k&&l(_),x.toHandle=ro(u,b,w,g,n,!0)}return x}var yt={onPointerDown:oi,isValid:ao};function co({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=Xe(e);function s({translateExtent:a,width:f,height:l,zoomStep:g=1,pannable:c=!0,zoomable:d=!0,inversePan:h=!1}){let p=u=>{if(u.sourceEvent.type!=="wheel"||!t)return;let w=n(),N=u.sourceEvent.ctrlKey&&Le()?10:1,S=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*g,_=w[2]*Math.pow(2,S*N);t.scaleTo(_)},y=[0,0],m=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(y=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},x=u=>{let w=n();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!t)return;let N=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],S=[N[0]-y[0],N[1]-y[1]];y=N;let _=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-S[0]*_,y:w[1]-S[1]*_},k=[[0,0],[f,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},k,a)},b=At().on("start",m).on("zoom",c?x:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:zt}}var xt=e=>({x:e.x,y:e.y,zoom:e.k}),Ht=({x:e,y:t,zoom:n})=>_n.translate(e,t).scale(n),Me=(e,t)=>e.target.closest(`.${t}`),lo=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ri=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ot=(e,t=0,n=ri,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},uo=e=>{let t=e.ctrlKey&&Le()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function si({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:f,onPanZoomEnd:l}){return g=>{if(Me(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();let c=n.property("__zoom").k||1;if(g.ctrlKey&&i){let m=zt(g),x=uo(g),b=c*Math.pow(2,x);o.scaleTo(n,b,m,g);return}let d=g.deltaMode===1?20:1,h=r===ge.Vertical?0:g.deltaX*d,p=r===ge.Horizontal?0:g.deltaY*d;!Le()&&g.shiftKey&&r!==ge.Vertical&&(h=g.deltaY*d,p=0),o.translateBy(n,-(h/c)*s,-(p/c)*s,{internal:!0});let y=xt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(f?.(g,y),e.panScrollTimeout=setTimeout(()=>{l?.(g,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(g,y))}}function ii({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Me(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ai({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=xt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function ci({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&lo(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,xt(s.transform))}}function li({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&lo(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=xt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function di({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:f,lib:l,connectionInProgress:g}){return c=>{let d=e||t,h=n&&c.ctrlKey,p=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Me(c,`${l}-flow__node`)||Me(c,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||g&&!p||Me(c,a)&&p||Me(c,f)&&(!p||r&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&c.type==="touchstart"&&c.touches?.length>1)return c.preventDefault(),!1;if(!d&&!r&&!h&&p||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;let y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&y}}function fo({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:f}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),c=At().scaleExtent([t,n]).translateExtent(o),d=Xe(e).call(c);b({x:r.x,y:r.y,zoom:Pe(r.zoom,t,n)},[[0,0],[g.width,g.height]],o);let h=d.on("wheel.zoom"),p=d.on("dblclick.zoom");c.wheelDelta(uo);function y(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).transform(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function m({noWheelClassName:C,noPanClassName:M,onPaneContextMenu:A,userSelectionActive:H,panOnScroll:z,panOnDrag:O,panOnScrollMode:$,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:V,zoomOnScroll:B,zoomOnDoubleClick:L,zoomActivationKeyPressed:Y,lib:X,onTransformChange:U,connectionInProgress:J,paneClickDistance:G,selectionOnDrag:T}){H&&!l.isZoomingOrPanning&&x();let Z=z&&!Y&&!H;c.clickDistance(T?1/0:!ce(G)||G<0?0:G);let Q=Z?si({zoomPanValues:l,noWheelClassName:C,d3Selection:d,d3Zoom:c,panOnScrollMode:$,panOnScrollSpeed:P,zoomOnPinch:V,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):ii({noWheelClassName:C,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!H){let W=ai({zoomPanValues:l,onDraggingChange:f,onPanZoomStart:i});c.on("start",W);let K=ci({zoomPanValues:l,panOnDrag:O,onPaneContextMenu:!!A,onPanZoom:s,onTransformChange:U});c.on("zoom",K);let ee=li({zoomPanValues:l,panOnDrag:O,panOnScroll:z,onPaneContextMenu:A,onPanZoomEnd:a,onDraggingChange:f});c.on("end",ee)}let q=di({zoomActivationKeyPressed:Y,panOnDrag:O,zoomOnScroll:B,panOnScroll:z,zoomOnDoubleClick:L,zoomOnPinch:V,userSelectionActive:H,noPanClassName:M,noWheelClassName:C,lib:X,connectionInProgress:J});c.filter(q),L?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function x(){c.on("zoom",null)}async function b(C,M,A){let H=Ht(C),z=c?.constrain()(H,M,A);return z&&await y(z),new Promise(O=>O(z))}async function u(C,M){let A=Ht(C);return await y(A,M),new Promise(H=>H(A))}function w(C){if(d){let M=Ht(C),A=d.property("__zoom");(A.k!==C.zoom||A.x!==C.x||A.y!==C.y)&&c?.transform(d,M,null,{sync:!0})}}function N(){let C=d?Cn(d.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleTo(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function _(C,M){return d?new Promise(A=>{c?.interpolate(M?.interpolate==="linear"?tt:nt).scaleBy(Ot(d,M?.duration,M?.ease,()=>A(!0)),C)}):Promise.resolve(!1)}function I(C){c?.scaleExtent(C)}function k(C){c?.translateExtent(C)}function R(C){let M=!ce(C)||C<0?0:C;c?.clickDistance(M)}return{update:m,destroy:x,setViewport:u,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:_,setScaleExtent:I,setTranslateExtent:k,syncViewport:w,setClickDistance:R}}var be;(function(e){e.Line="line",e.Handle="handle"})(be||(be={}));function ui({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){let i=e-t,a=n-o,f=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(f[0]=f[0]*-1),a&&s&&(f[1]=f[1]*-1),f}function Ln(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function he(e,t){return Math.max(0,t-e)}function me(e,t){return Math.max(0,e-t)}function rt(e,t,n){return Math.max(0,t-e,e-n)}function Tn(e,t){return e?!t:t}function fi(e,t,n,o,r,s,i,a){let{affectsX:f,affectsY:l}=t,{isHorizontal:g,isVertical:c}=t,d=g&&c,{xSnapped:h,ySnapped:p}=n,{minWidth:y,maxWidth:m,minHeight:x,maxHeight:b}=o,{x:u,y:w,width:N,height:S,aspectRatio:_}=e,I=Math.floor(g?h-e.pointerX:0),k=Math.floor(c?p-e.pointerY:0),R=N+(f?-I:I),C=S+(l?-k:k),M=-s[0]*N,A=-s[1]*S,H=rt(R,y,m),z=rt(C,x,b);if(i){let P=0,D=0;f&&I<0?P=he(u+I+M,i[0][0]):!f&&I>0&&(P=me(u+R+M,i[1][0])),l&&k<0?D=he(w+k+A,i[0][1]):!l&&k>0&&(D=me(w+C+A,i[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(a){let P=0,D=0;f&&I>0?P=me(u+I,a[0][0]):!f&&I<0&&(P=he(u+R,a[1][0])),l&&k>0?D=me(w+k,a[0][1]):!l&&k<0&&(D=he(w+C,a[1][1])),H=Math.max(H,P),z=Math.max(z,D)}if(r){if(g){let P=rt(R/_,x,b)*_;if(H=Math.max(H,P),i){let D=0;!f&&!l||f&&!l&&d?D=me(w+A+R/_,i[1][1])*_:D=he(w+A+(f?I:-I)/_,i[0][1])*_,H=Math.max(H,D)}if(a){let D=0;!f&&!l||f&&!l&&d?D=he(w+R/_,a[1][1])*_:D=me(w+(f?I:-I)/_,a[0][1])*_,H=Math.max(H,D)}}if(c){let P=rt(C*_,y,m)/_;if(z=Math.max(z,P),i){let D=0;!f&&!l||l&&!f&&d?D=me(u+C*_+M,i[1][0])/_:D=he(u+(l?k:-k)*_+M,i[0][0])/_,z=Math.max(z,D)}if(a){let D=0;!f&&!l||l&&!f&&d?D=he(u+C*_,a[1][0])/_:D=me(u+(l?k:-k)*_,a[0][0])/_,z=Math.max(z,D)}}}k=k+(k<0?z:-z),I=I+(I<0?H:-H),r&&(d?R>C*_?k=(Tn(f,l)?-I:I)/_:I=(Tn(f,l)?-k:k)*_:g?(k=I/_,l=f):(I=k*_,f=l));let O=f?u+I:u,$=l?w+k:w;return{width:N+(f?-I:I),height:S+(l?-k:k),x:s[0]*I*(f?-1:1)+O,y:s[1]*k*(l?-1:1)+$}}var go={width:0,height:0,x:0,y:0},gi={...go,pointerX:0,pointerY:0,aspectRatio:1};function pi(e){return[[0,0],[e.measured.width,e.measured.height]]}function hi(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,f=n[1]*i;return[[o-a,r-f],[o+s-a,r+i-f]]}function po({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let s=Xe(e),i={controlDirection:Ln("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:g,keepAspectRatio:c,resizeDirection:d,onResizeStart:h,onResize:p,onResizeEnd:y,shouldResize:m}){let x={...go},b={...gi};i={boundaries:g,resizeDirection:d,keepAspectRatio:c,controlDirection:Ln(l)};let u,w=null,N=[],S,_,I,k=!1,R=Dt().on("start",C=>{let{nodeLookup:M,transform:A,snapGrid:H,snapToGrid:z,nodeOrigin:O,paneDomNode:$}=n();if(u=M.get(t),!u)return;w=$?.getBoundingClientRect()??null;let{xSnapped:P,ySnapped:D}=We(C.sourceEvent,{transform:A,snapGrid:H,snapToGrid:z,containerBounds:w});x={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},b={...x,pointerX:P,pointerY:D,aspectRatio:x.width/x.height},S=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(S=M.get(u.parentId),_=S&&u.extent==="parent"?pi(S):void 0),N=[],I=void 0;for(let[V,B]of M)if(B.parentId===t&&(N.push({id:V,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){let L=hi(B,u,B.origin??O);I?I=[[Math.min(L[0][0],I[0][0]),Math.min(L[0][1],I[0][1])],[Math.max(L[1][0],I[1][0]),Math.max(L[1][1],I[1][1])]]:I=L}h?.(C,{...x})}).on("drag",C=>{let{transform:M,snapGrid:A,snapToGrid:H,nodeOrigin:z}=n(),O=We(C.sourceEvent,{transform:M,snapGrid:A,snapToGrid:H,containerBounds:w}),$=[];if(!u)return;let{x:P,y:D,width:V,height:B}=x,L={},Y=u.origin??z,{width:X,height:U,x:J,y:G}=fi(b,i.controlDirection,O,i.boundaries,i.keepAspectRatio,Y,_,I),T=X!==V,Z=U!==B,Q=J!==P&&T,q=G!==D&&Z;if(!Q&&!q&&!T&&!Z)return;if((Q||q||Y[0]===1||Y[1]===1)&&(L.x=Q?J:x.x,L.y=q?G:x.y,x.x=L.x,x.y=L.y,N.length>0)){let oe=J-P,te=G-D;for(let ie of N)ie.position={x:ie.position.x-oe+Y[0]*(X-V),y:ie.position.y-te+Y[1]*(U-B)},$.push(ie)}if((T||Z)&&(L.width=T&&(!i.resizeDirection||i.resizeDirection==="horizontal")?X:x.width,L.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?U:x.height,x.width=L.width,x.height=L.height),S&&u.expandParent){let oe=Y[0]*(L.width??0);L.x&&L.x<oe&&(x.x=oe,b.x=b.x-(L.x-oe));let te=Y[1]*(L.height??0);L.y&&L.y<te&&(x.y=te,b.y=b.y-(L.y-te))}let W=ui({width:x.width,prevWidth:V,height:x.height,prevHeight:B,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),K={...x,direction:W};m?.(C,K)!==!1&&(k=!0,p?.(C,K),o(L,$))}).on("end",C=>{k&&(y?.(C,{...x}),r?.({...x}),k=!1)});s.call(R)}function f(){s.on(".drag",null)}return{update:a,destroy:f}}var E=Ze(Os()),v=Ze(et());function se(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=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var No=Ze(et(),1),ko=Ze(So(),1);var vo=e=>{let t,n=new Set,o=(g,c)=>{let d=typeof g=="function"?g(t):g;if(!Object.is(d,t)){let h=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},r=()=>t,f={setState:o,getState:r,getInitialState:()=>l,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(import.meta.env?import.meta.env.MODE: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()}},l=t=e(o,r,f);return f},_o=e=>e?vo(e):vo;var{useDebugValue:Ai}=No.default,{useSyncExternalStoreWithSelector:$i}=ko.default,Hi=e=>e;function ln(e,t=Hi,n){let o=$i(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ai(o),o}var Co=(e,t)=>{let n=_o(e),o=(r,s=t)=>ln(n,r,s);return Object.assign(o,n),o},Mo=(e,t)=>e?Co(e,t):Co;function ne(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(let[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Oi=Ze(Hs()),_t=(0,v.createContext)(null),Li=_t.Provider,jo=ae.error001();function j(e,t){let n=(0,v.useContext)(_t);if(n===null)throw new Error(jo);return ln(n,e,t)}function re(){let e=(0,v.useContext)(_t);if(e===null)throw new Error(jo);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Io={display:"none"},Ti={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Jo="react-flow__node-desc",er="react-flow__edge-desc",Ri="react-flow__aria-live",Bi=e=>e.ariaLiveMessage,Vi=e=>e.ariaLabelConfig;function Fi({rfId:e}){let t=j(Bi);return(0,E.jsx)("div",{id:`${Ri}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ti,children:t})}function Yi({rfId:e,disableKeyboardA11y:t}){let n=j(Vi);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{id:`${Jo}-${e}`,style:Io,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,E.jsx)("div",{id:`${er}-${e}`,style:Io,children:n["edge.a11yDescription.default"]}),!t&&(0,E.jsx)(Fi,{rfId:e})]})}var Ct=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{let i=`${e}`.split("-");return(0,E.jsx)("div",{className:se(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Ct.displayName="Panel";function Zi({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,E.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:(0,E.jsx)("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var Xi=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},wt=e=>e.id;function Wi(e,t){return ne(e.selectedNodes.map(wt),t.selectedNodes.map(wt))&&ne(e.selectedEdges.map(wt),t.selectedEdges.map(wt))}function Ki({onSelectionChange:e}){let t=re(),{selectedNodes:n,selectedEdges:o}=j(Xi,Wi);return(0,v.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}var Gi=e=>!!e.onSelectionChangeHandlers;function qi({onSelectionChange:e}){let t=j(Gi);return e||t?(0,E.jsx)(Ki,{onSelectionChange:e}):null}var tr=[0,0],Ui={x:0,y:0,zoom:1},Qi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Po=[...Qi,"rfId"],ji=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zo={translateExtent:De,nodeOrigin:tr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ji(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:f}=j(ji,ne),l=re();(0,v.useEffect)(()=>(f(e.defaultNodes,e.defaultEdges),()=>{g.current=zo,a()}),[]);let g=(0,v.useRef)(zo);return(0,v.useEffect)(()=>{for(let c of Po){let d=e[c],h=g.current[c];d!==h&&(typeof e[c]>"u"||(c==="nodes"?t(d):c==="edges"?n(d):c==="minZoom"?o(d):c==="maxZoom"?r(d):c==="translateExtent"?s(d):c==="nodeExtent"?i(d):c==="ariaLabelConfig"?l.setState({ariaLabelConfig:Wn(d)}):c==="fitView"?l.setState({fitViewQueued:d}):c==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[c]:d})))}g.current=e},Po.map(c=>e[c])),null}function Do(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ea(e){let[t,n]=(0,v.useState)(e==="system"?null:e);return(0,v.useEffect)(()=>{if(e!=="system"){n(e);return}let o=Do(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Do()?.matches?"dark":"light"}var Ao=typeof document<"u"?document:null;function Qe(e=null,t={target:Ao,actInsideInputWithModifier:!0}){let[n,o]=(0,v.useState)(!1),r=(0,v.useRef)(!1),s=(0,v.useRef)(new Set([])),[i,a]=(0,v.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|