furu 0.0.4__py3-none-any.whl → 0.0.5__py3-none-any.whl
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.
- furu/config.py +27 -40
- furu/core/furu.py +194 -126
- furu/core/list.py +3 -2
- furu/dashboard/frontend/dist/assets/{index-DS3FsqcY.js → index-BjyrY-Zz.js} +1 -1
- furu/dashboard/frontend/dist/index.html +1 -1
- furu/execution/local.py +9 -7
- furu/execution/plan.py +117 -25
- furu/execution/slurm_dag.py +16 -14
- furu/execution/slurm_pool.py +5 -5
- furu/execution/slurm_spec.py +2 -2
- furu/migration.py +1 -2
- furu/runtime/env.py +1 -1
- furu/runtime/logging.py +30 -4
- furu/storage/metadata.py +25 -29
- furu/storage/migration.py +0 -1
- furu/storage/state.py +86 -92
- {furu-0.0.4.dist-info → furu-0.0.5.dist-info}/METADATA +18 -6
- {furu-0.0.4.dist-info → furu-0.0.5.dist-info}/RECORD +20 -20
- {furu-0.0.4.dist-info → furu-0.0.5.dist-info}/WHEEL +1 -1
- {furu-0.0.4.dist-info → furu-0.0.5.dist-info}/entry_points.txt +0 -0
|
@@ -64,4 +64,4 @@ Error generating stack: `+o.message+`
|
|
|
64
64
|
`,`
|
|
65
65
|
+`).split(`
|
|
66
66
|
`)),d=u.reduce((c,f)=>c.concat(...f),[]);return[u,d]}return[[],[]]},[e]);return R.useEffect(()=>{const l=(t==null?void 0:t.target)??iy,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var w,g;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!u)&&e1(m))return!1;const x=ly(m.code,a);if(o.current.add(m[x]),ay(i,o.current,!1)){const v=((g=(w=m.composedPath)==null?void 0:w.call(m))==null?void 0:g[0])||m.target,y=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!y)&&m.preventDefault(),r(!0)}},c=m=>{const p=ly(m.code,a);ay(i,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(m[p]),m.key==="Meta"&&o.current.clear(),s.current=!1},f=()=>{o.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",c),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",c),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function ay(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function ly(e,t){return t.includes(e)?"code":"key"}const hI=()=>{const e=Ce();return R.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,o],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:o,maxZoom:i,panZoom:a}=e.getState(),l=np(t,r,s,o,i,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:o,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),u={x:t.x-a,y:t.y-l},d=n.snapGrid??s,c=n.snapToGrid??o;return ba(u,r,c,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:o}=r.getBoundingClientRect(),i=yu(t,n);return{x:i.x+s,y:i.y+o}}}),[])};function _1(e,t){const n=[],r=new Map,s=[];for(const o of e)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const i=r.get(o.id);i?i.push(o):r.set(o.id,[o])}for(const o of t){const i=r.get(o.id);if(!i){n.push(o);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...o};for(const l of i)pI(l,a);n.push(a)}return s.length&&s.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function pI(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function b1(e,t){return _1(e,t)}function E1(e,t){return _1(e,t)}function Or(e,t){return{id:e,type:"select",selected:t}}function Hs(e,t=new Set,n=!1){const r=[];for(const[s,o]of e){const i=t.has(s);!(o.selected===void 0&&!i)&&o.selected!==i&&(n&&(o.selected=i),r.push(Or(o.id,i)))}return r}function uy({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,i]of e.entries()){const a=t.get(i.id),l=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;l!==void 0&&l!==i&&n.push({id:i.id,item:i,type:"replace"}),l===void 0&&n.push({item:i,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function cy(e){return{id:e.id,type:"remove"}}const dy=e=>VT(e),mI=e=>Kw(e);function C1(e){return R.forwardRef(e)}const gI=typeof window<"u"?R.useLayoutEffect:R.useEffect;function fy(e){const[t,n]=R.useState(BigInt(0)),[r]=R.useState(()=>yI(()=>n(s=>s+BigInt(1))));return gI(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function yI(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const N1=R.createContext(null);function xI({children:e}){const t=Ce(),n=R.useCallback(a=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:d,onNodesChange:c,nodeLookup:f,fitViewQueued:m,onNodesChangeMiddlewareMap:p}=t.getState();let x=l;for(const g of a)x=typeof g=="function"?g(x):g;let w=uy({items:x,lookup:f});for(const g of p.values())w=g(w);d&&u(x),w.length>0?c==null||c(w):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:v,setNodes:y}=t.getState();g&&y(v)})},[]),r=fy(n),s=R.useCallback(a=>{const{edges:l=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:c,edgeLookup:f}=t.getState();let m=l;for(const p of a)m=typeof p=="function"?p(m):p;d?u(m):c&&c(uy({items:m,lookup:f}))},[]),o=fy(s),i=R.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return h.jsx(N1.Provider,{value:i,children:e})}function vI(){const e=R.useContext(N1);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const wI=e=>!!e.panZoom;function up(){const e=hI(),t=Ce(),n=vI(),r=fe(wI),s=R.useMemo(()=>{const o=c=>t.getState().nodeLookup.get(c),i=c=>{n.nodeQueue.push(c)},a=c=>{n.edgeQueue.push(c)},l=c=>{var g,v;const{nodeLookup:f,nodeOrigin:m}=t.getState(),p=dy(c)?c:f.get(c.id),x=p.parentId?Zw(p.position,p.measured,p.parentId,f,m):p.position,w={...p,position:x,width:((g=p.measured)==null?void 0:g.width)??p.width,height:((v=p.measured)==null?void 0:v.height)??p.height};return Po(w)},u=(c,f,m={replace:!1})=>{i(p=>p.map(x=>{if(x.id===c){const w=typeof f=="function"?f(x):f;return m.replace&&dy(w)?w:{...x,...w}}return x}))},d=(c,f,m={replace:!1})=>{a(p=>p.map(x=>{if(x.id===c){const w=typeof f=="function"?f(x):f;return m.replace&&mI(w)?w:{...x,...w}}return x}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var f;return(f=o(c))==null?void 0:f.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(f=>({...f}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:i,setEdges:a,addNodes:c=>{const f=Array.isArray(c)?c:[c];n.nodeQueue.push(m=>[...m,...f])},addEdges:c=>{const f=Array.isArray(c)?c:[c];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:c=[],edges:f=[],transform:m}=t.getState(),[p,x,w]=m;return{nodes:c.map(g=>({...g})),edges:f.map(g=>({...g})),viewport:{x:p,y:x,zoom:w}}},deleteElements:async({nodes:c=[],edges:f=[]})=>{const{nodes:m,edges:p,onNodesDelete:x,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:v,onDelete:y,onBeforeDelete:S}=t.getState(),{nodes:E,edges:_}=await GT({nodesToRemove:c,edgesToRemove:f,nodes:m,edges:p,onBeforeDelete:S}),b=_.length>0,C=E.length>0;if(b){const L=_.map(cy);w==null||w(_),v(L)}if(C){const L=E.map(cy);x==null||x(E),g(L)}return(C||b)&&(y==null||y({nodes:E,edges:_})),{deletedNodes:E,deletedEdges:_}},getIntersectingNodes:(c,f=!0,m)=>{const p=Bg(c),x=p?c:l(c),w=m!==void 0;return x?(m||t.getState().nodes).filter(g=>{const v=t.getState().nodeLookup.get(g.id);if(v&&!p&&(g.id===c.id||!v.internals.positionAbsolute))return!1;const y=Po(w?g:v),S=Zi(y,x);return f&&S>0||S>=y.width*y.height||S>=x.width*x.height}):[]},isNodeIntersecting:(c,f,m=!0)=>{const x=Bg(c)?c:l(c);if(!x)return!1;const w=Zi(x,f);return m&&w>0||w>=f.width*f.height||w>=x.width*x.height},updateNode:u,updateNodeData:(c,f,m={replace:!1})=>{u(c,p=>{const x=typeof f=="function"?f(p):f;return m.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},m)},updateEdge:d,updateEdgeData:(c,f,m={replace:!1})=>{d(c,p=>{const x=typeof f=="function"?f(p):f;return m.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},m)},getNodesBounds:c=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return WT(c,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:c,id:f,nodeId:m})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${m}-${c}${f?`-${f}`:""}`))==null?void 0:p.values())??[])},getNodeConnections:({type:c,handleId:f,nodeId:m})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${m}${c?f?`-${c}-${f}`:`-${c}`:""}`))==null?void 0:p.values())??[])},fitView:async c=>{const f=t.getState().fitViewResolver??JT();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return R.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const hy=e=>e.selected,SI=typeof window<"u"?window:void 0;function _I({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ce(),{deleteElements:r}=up(),s=ea(e,{actInsideInputWithModifier:!1}),o=ea(t,{target:SI});R.useEffect(()=>{if(s){const{edges:i,nodes:a}=n.getState();r({nodes:a.filter(hy),edges:i.filter(hy)}),n.setState({nodesSelectionActive:!1})}},[s]),R.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function bI(e){const t=Ce();R.useEffect(()=>{const n=()=>{var s,o,i,a;if(!e.current||!(((o=(s=e.current).checkVisibility)==null?void 0:o.call(s))??!0))return!1;const r=rp(e.current);(r.height===0||r.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",bn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const ec={position:"absolute",width:"100%",height:"100%",top:0,left:0},EI=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function CI({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=as.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:c,zoomActivationKeyCode:f,preventScrolling:m=!0,children:p,noWheelClassName:x,noPanClassName:w,onViewportChange:g,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:S}){const E=Ce(),_=R.useRef(null),{userSelectionActive:b,lib:C,connectionInProgress:L}=fe(EI,Ee),M=ea(f),P=R.useRef();bI(_);const j=R.useCallback(O=>{g==null||g({x:O[0],y:O[1],zoom:O[2]}),v||E.setState({transform:O})},[g,v]);return R.useEffect(()=>{if(_.current){P.current=OL({domNode:_.current,minZoom:d,maxZoom:c,translateExtent:u,viewport:l,onDraggingChange:I=>E.setState({paneDragging:I}),onPanZoomStart:(I,F)=>{const{onViewportChangeStart:N,onMoveStart:T}=E.getState();T==null||T(I,F),N==null||N(F)},onPanZoom:(I,F)=>{const{onViewportChange:N,onMove:T}=E.getState();T==null||T(I,F),N==null||N(F)},onPanZoomEnd:(I,F)=>{const{onViewportChangeEnd:N,onMoveEnd:T}=E.getState();T==null||T(I,F),N==null||N(F)}});const{x:O,y:k,zoom:D}=P.current.getViewport();return E.setState({panZoom:P.current,transform:[O,k,D],domNode:_.current.closest(".react-flow")}),()=>{var I;(I=P.current)==null||I.destroy()}}},[]),R.useEffect(()=>{var O;(O=P.current)==null||O.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:M,preventScrolling:m,noPanClassName:w,userSelectionActive:b,noWheelClassName:x,lib:C,onTransformChange:j,connectionInProgress:L,selectionOnDrag:S,paneClickDistance:y})},[e,t,n,r,s,o,i,a,M,m,w,b,x,C,j,L,S,y]),h.jsx("div",{className:"react-flow__renderer",ref:_,style:ec,children:p})}const NI=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function kI(){const{userSelectionActive:e,userSelectionRect:t}=fe(NI,Ee);return e&&t?h.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Zc=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},PI=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function RI({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Yi.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:i,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:m,children:p}){const x=Ce(),{userSelectionActive:w,elementsSelectable:g,dragging:v,connectionInProgress:y}=fe(PI,Ee),S=g&&(e||w),E=R.useRef(null),_=R.useRef(),b=R.useRef(new Set),C=R.useRef(new Set),L=R.useRef(!1),M=N=>{if(L.current||y){L.current=!1;return}l==null||l(N),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},P=N=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){N.preventDefault();return}u==null||u(N)},j=d?N=>d(N):void 0,O=N=>{L.current&&(N.stopPropagation(),L.current=!1)},k=N=>{var X,Q;const{domNode:T}=x.getState();if(_.current=T==null?void 0:T.getBoundingClientRect(),!_.current)return;const z=N.target===E.current;if(!z&&!!N.target.closest(".nokey")||!e||!(o&&z||t)||N.button!==0||!N.isPrimary)return;(Q=(X=N.target)==null?void 0:X.setPointerCapture)==null||Q.call(X,N.pointerId),L.current=!1;const{x:K,y:V}=tn(N.nativeEvent,_.current);x.setState({userSelectionRect:{width:0,height:0,startX:K,startY:V,x:K,y:V}}),z||(N.stopPropagation(),N.preventDefault())},D=N=>{const{userSelectionRect:T,transform:z,nodeLookup:B,edgeLookup:H,connectionLookup:K,triggerNodeChanges:V,triggerEdgeChanges:X,defaultEdgeOptions:Q,resetSelectedElements:Y}=x.getState();if(!_.current||!T)return;const{x:W,y:Z}=tn(N.nativeEvent,_.current),{startX:oe,startY:re}=T;if(!L.current){const ce=t?0:s;if(Math.hypot(W-oe,Z-re)<=ce)return;Y(),i==null||i(N)}L.current=!0;const J={startX:oe,startY:re,x:W<oe?W:oe,y:Z<re?Z:re,width:Math.abs(W-oe),height:Math.abs(Z-re)},te=b.current,he=C.current;b.current=new Set(tp(B,J,z,n===Yi.Partial,!0).map(ce=>ce.id)),C.current=new Set;const ye=(Q==null?void 0:Q.selectable)??!0;for(const ce of b.current){const $e=K.get(ce);if($e)for(const{edgeId:un}of $e.values()){const dt=H.get(un);dt&&(dt.selectable??ye)&&C.current.add(un)}}if(!Hg(te,b.current)){const ce=Hs(B,b.current,!0);V(ce)}if(!Hg(he,C.current)){const ce=Hs(H,C.current);X(ce)}x.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},I=N=>{var T,z;N.button===0&&((z=(T=N.target)==null?void 0:T.releasePointerCapture)==null||z.call(T,N.pointerId),!w&&N.target===E.current&&x.getState().userSelectionRect&&(M==null||M(N)),x.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(a==null||a(N),x.setState({nodesSelectionActive:b.current.size>0})))},F=r===!0||Array.isArray(r)&&r.includes(0);return h.jsxs("div",{className:Oe(["react-flow__pane",{draggable:F,dragging:v,selection:e}]),onClick:S?void 0:Zc(M,E),onContextMenu:Zc(P,E),onWheel:Zc(j,E),onPointerEnter:S?void 0:c,onPointerMove:S?D:f,onPointerUp:S?I:void 0,onPointerDownCapture:S?k:void 0,onClickCapture:S?O:void 0,onPointerLeave:m,ref:E,style:ec,children:[p,h.jsx(kI,{})]})}function Pf({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),u=a.get(e);if(!u){l==null||l("012",bn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function k1({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,nodeClickDistance:i}){const a=Ce(),[l,u]=R.useState(!1),d=R.useRef();return R.useEffect(()=>{d.current=_L({getStoreItems:()=>a.getState(),onNodeMouseDown:c=>{Pf({id:c,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),R.useEffect(()=>{var c,f;if(t)(c=d.current)==null||c.destroy();else if(e.current)return(f=d.current)==null||f.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:s,nodeClickDistance:i}),()=>{var m;(m=d.current)==null||m.destroy()}},[n,r,t,o,e,s]),l}const jI=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function P1(){const e=Ce();return R.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:o,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:u,nodeOrigin:d}=e.getState(),c=new Map,f=jI(i),m=s?o[0]:5,p=s?o[1]:5,x=n.direction.x*m*n.factor,w=n.direction.y*p*n.factor;for(const[,g]of u){if(!f(g))continue;let v={x:g.internals.positionAbsolute.x+x,y:g.internals.positionAbsolute.y+w};s&&(v=_a(v,o));const{position:y,positionAbsolute:S}=qw({nodeId:g.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:a});g.position=y,g.internals.positionAbsolute=S,c.set(g.id,g)}l(c)},[])}const cp=R.createContext(null),MI=cp.Provider;cp.Consumer;const R1=()=>R.useContext(cp),TI=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),LI=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:o,connection:i}=r,{fromHandle:a,toHandle:l,isValid:u}=i,d=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:o===No.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:d&&u}};function II({type:e="source",position:t=ee.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:i,onConnect:a,children:l,className:u,onMouseDown:d,onTouchStart:c,...f},m){var D,I;const p=i||null,x=e==="target",w=Ce(),g=R1(),{connectOnClick:v,noPanClassName:y,rfId:S}=fe(TI,Ee),{connectingFrom:E,connectingTo:_,clickConnecting:b,isPossibleEndHandle:C,connectionInProcess:L,clickConnectionInProcess:M,valid:P}=fe(LI(g,p,e),Ee);g||(I=(D=w.getState()).onError)==null||I.call(D,"010",bn.error010());const j=F=>{const{defaultEdgeOptions:N,onConnect:T,hasDefaultEdges:z}=w.getState(),B={...N,...F};if(z){const{edges:H,setEdges:K}=w.getState();K(iL(B,H))}T==null||T(B),a==null||a(B)},O=F=>{if(!g)return;const N=t1(F.nativeEvent);if(s&&(N&&F.button===0||!N)){const T=w.getState();kf.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:x,handleId:p,nodeId:g,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:T.onConnectEnd,updateConnection:T.updateConnection,onConnect:j,isValidConnection:n||T.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}N?d==null||d(F):c==null||c(F)},k=F=>{const{onClickConnectStart:N,onClickConnectEnd:T,connectionClickStartHandle:z,connectionMode:B,isValidConnection:H,lib:K,rfId:V,nodeLookup:X,connection:Q}=w.getState();if(!g||!z&&!s)return;if(!z){N==null||N(F.nativeEvent,{nodeId:g,handleId:p,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:p}});return}const Y=Jw(F.target),W=n||H,{connection:Z,isValid:oe}=kf.isValid(F.nativeEvent,{handle:{nodeId:g,id:p,type:e},connectionMode:B,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:W,flowId:V,doc:Y,lib:K,nodeLookup:X});oe&&Z&&j(Z);const re=structuredClone(Q);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,T==null||T(F,re),w.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":p,"data-nodeid":g,"data-handlepos":t,"data-id":`${S}-${g}-${p}-${e}`,className:Oe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:o,clickconnecting:b,connectingfrom:E,connectingto:_,valid:P,connectionindicator:r&&(!L||C)&&(L||M?o:s)}]),onMouseDown:O,onTouchStart:O,onClick:v?k:void 0,ref:m,...f,children:l})}const Mo=R.memo(C1(II));function AI({data:e,isConnectable:t,sourcePosition:n=ee.Bottom}){return h.jsxs(h.Fragment,{children:[e==null?void 0:e.label,h.jsx(Mo,{type:"source",position:n,isConnectable:t})]})}function OI({data:e,isConnectable:t,targetPosition:n=ee.Top,sourcePosition:r=ee.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(Mo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,h.jsx(Mo,{type:"source",position:r,isConnectable:t})]})}function FI(){return null}function DI({data:e,isConnectable:t,targetPosition:n=ee.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(Mo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const xu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},py={input:AI,default:OI,output:DI,group:FI};function zI(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const $I=e=>{const{width:t,height:n,x:r,y:s}=Sa(e.nodeLookup,{filter:o=>!!o.selected});return{width:en(t)?t:null,height:en(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function BI({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ce(),{width:s,height:o,transformString:i,userSelectionActive:a}=fe($I,Ee),l=P1(),u=R.useRef(null);if(R.useEffect(()=>{var f;n||(f=u.current)==null||f.focus({preventScroll:!0})},[n]),k1({nodeRef:u}),a||!s||!o)return null;const d=e?f=>{const m=r.getState().nodes.filter(p=>p.selected);e(f,m)}:void 0,c=f=>{Object.prototype.hasOwnProperty.call(xu,f.key)&&(f.preventDefault(),l({direction:xu[f.key],factor:f.shiftKey?4:1}))};return h.jsx("div",{className:Oe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:h.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:c,style:{width:s,height:o}})})}const my=typeof window<"u"?window:void 0,HI=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function j1({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:d,selectionMode:c,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:p,panActivationKeyCode:x,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:b,panOnDrag:C,defaultViewport:L,translateExtent:M,minZoom:P,maxZoom:j,preventScrolling:O,onSelectionContextMenu:k,noWheelClassName:D,noPanClassName:I,disableKeyboardA11y:F,onViewportChange:N,isControlledViewport:T}){const{nodesSelectionActive:z,userSelectionActive:B}=fe(HI,Ee),H=ea(u,{target:my}),K=ea(x,{target:my}),V=K||C,X=K||S,Q=d&&V!==!0,Y=H||B||Q;return _I({deleteKeyCode:l,multiSelectionKeyCode:p}),h.jsx(CI,{onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:X,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:b,panOnDrag:!H&&V,defaultViewport:L,translateExtent:M,minZoom:P,maxZoom:j,zoomActivationKeyCode:w,preventScrolling:O,noWheelClassName:D,noPanClassName:I,onViewportChange:N,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:Q,children:h.jsxs(RI,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,panOnDrag:V,isSelecting:!!Y,selectionMode:c,selectionKeyPressed:H,paneClickDistance:a,selectionOnDrag:Q,children:[e,z&&h.jsx(BI,{onSelectionContextMenu:k,noPanClassName:I,disableKeyboardA11y:F})]})})}j1.displayName="FlowRenderer";const UI=R.memo(j1),VI=e=>t=>e?tp(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function WI(e){return fe(R.useCallback(VI(e),[e]),Ee)}const KI=e=>e.updateNodeInternals;function qI(){const e=fe(KI),[t]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const o=s.target.getAttribute("data-id");r.set(o,{id:o,nodeElement:s.target,force:!0})}),e(r)}));return R.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function QI({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Ce(),o=R.useRef(null),i=R.useRef(null),a=R.useRef(e.sourcePosition),l=R.useRef(e.targetPosition),u=R.useRef(t),d=n&&!!e.internals.handleBounds;return R.useEffect(()=>{o.current&&!e.hidden&&(!d||i.current!==o.current)&&(i.current&&(r==null||r.unobserve(i.current)),r==null||r.observe(o.current),i.current=o.current)},[d,e.hidden]),R.useEffect(()=>()=>{i.current&&(r==null||r.unobserve(i.current),i.current=null)},[]),R.useEffect(()=>{if(o.current){const c=u.current!==t,f=a.current!==e.sourcePosition,m=l.current!==e.targetPosition;(c||f||m)&&(u.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function GI({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:o,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:u,nodesFocusable:d,resizeObserver:c,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:p,rfId:x,nodeTypes:w,nodeClickDistance:g,onError:v}){const{node:y,internals:S,isParent:E}=fe(W=>{const Z=W.nodeLookup.get(e),oe=W.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:oe}},Ee);let _=y.type||"default",b=(w==null?void 0:w[_])||py[_];b===void 0&&(v==null||v("003",bn.error003(_)),_="default",b=(w==null?void 0:w.default)||py.default);const C=!!(y.draggable||a&&typeof y.draggable>"u"),L=!!(y.selectable||l&&typeof y.selectable>"u"),M=!!(y.connectable||u&&typeof y.connectable>"u"),P=!!(y.focusable||d&&typeof y.focusable>"u"),j=Ce(),O=Yw(y),k=QI({node:y,nodeType:_,hasDimensions:O,resizeObserver:c}),D=k1({nodeRef:k,disabled:y.hidden||!C,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:g}),I=P1();if(y.hidden)return null;const F=Vn(y),N=zI(y),T=L||C||t||n||r||s,z=n?W=>n(W,{...S.userNode}):void 0,B=r?W=>r(W,{...S.userNode}):void 0,H=s?W=>s(W,{...S.userNode}):void 0,K=o?W=>o(W,{...S.userNode}):void 0,V=i?W=>i(W,{...S.userNode}):void 0,X=W=>{const{selectNodesOnDrag:Z,nodeDragThreshold:oe}=j.getState();L&&(!Z||!C||oe>0)&&Pf({id:e,store:j,nodeRef:k}),t&&t(W,{...S.userNode})},Q=W=>{if(!(e1(W.nativeEvent)||p)){if(Hw.includes(W.key)&&L){const Z=W.key==="Escape";Pf({id:e,store:j,unselect:Z,nodeRef:k})}else if(C&&y.selected&&Object.prototype.hasOwnProperty.call(xu,W.key)){W.preventDefault();const{ariaLabelConfig:Z}=j.getState();j.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:W.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),I({direction:xu[W.key],factor:W.shiftKey?4:1})}}},Y=()=>{var he;if(p||!((he=k.current)!=null&&he.matches(":focus-visible")))return;const{transform:W,width:Z,height:oe,autoPanOnNodeFocus:re,setCenter:J}=j.getState();if(!re)return;tp(new Map([[e,y]]),{x:0,y:0,width:Z,height:oe},W,!0).length>0||J(y.position.x+F.width/2,y.position.y+F.height/2,{zoom:W[2]})};return h.jsx("div",{className:Oe(["react-flow__node",`react-flow__node-${_}`,{[m]:C},y.className,{selected:y.selected,selectable:L,parent:E,draggable:C,dragging:D}]),ref:k,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:O?"visible":"hidden",...y.style,...N},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:z,onMouseMove:B,onMouseLeave:H,onContextMenu:K,onClick:X,onDoubleClick:V,onKeyDown:P?Q:void 0,tabIndex:P?0:void 0,onFocus:P?Y:void 0,role:y.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${v1}-${x}`,"aria-label":y.ariaLabel,...y.domAttributes,children:h.jsx(MI,{value:e,children:h.jsx(b,{id:e,data:y.data,type:_,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:y.selected??!1,selectable:L,draggable:C,deletable:y.deletable??!0,isConnectable:M,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:D,dragHandle:y.dragHandle,zIndex:S.z,parentId:y.parentId,...F})})})}var XI=R.memo(GI);const YI=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function M1(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:o}=fe(YI,Ee),i=WI(e.onlyRenderVisibleElements),a=qI();return h.jsx("div",{className:"react-flow__nodes",style:ec,children:i.map(l=>h.jsx(XI,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:o},l))})}M1.displayName="NodeRenderer";const ZI=R.memo(M1);function JI(e){return fe(R.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const o=n.nodeLookup.get(s.source),i=n.nodeLookup.get(s.target);o&&i&&rL({sourceNode:o,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Ee)}const eA=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return h.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},tA=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return h.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},gy={[ws.Arrow]:eA,[ws.ArrowClosed]:tA};function nA(e){const t=Ce();return R.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(gy,e)?gy[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",bn.error009(e)),null)},[e])}const rA=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=nA(t);return l?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:h.jsx(l,{color:n,strokeWidth:i})}):null},T1=({defaultColor:e,rfId:t})=>{const n=fe(o=>o.edges),r=fe(o=>o.defaultEdgeOptions),s=R.useMemo(()=>dL(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?h.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:h.jsx("defs",{children:s.map(o=>h.jsx(rA,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};T1.displayName="MarkerDefinitions";var sA=R.memo(T1);function L1({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...d}){const[c,f]=R.useState({x:1,y:0,width:0,height:0}),m=Oe(["react-flow__edge-textwrapper",u]),p=R.useRef(null);return R.useEffect(()=>{if(p.current){const x=p.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?h.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:m,visibility:c.width?"visible":"hidden",...d,children:[s&&h.jsx("rect",{width:c.width+2*i[0],x:-i[0],y:-i[1],height:c.height+2*i[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),h.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:p,style:r,children:n}),l]}):null}L1.displayName="EdgeText";const oA=R.memo(L1);function tc({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...d}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...d,d:e,fill:"none",className:Oe(["react-flow__edge-path",d.className])}),u?h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&en(t)&&en(n)?h.jsx(oA,{x:t,y:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function yy({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===ee.Left||e===ee.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function I1({sourceX:e,sourceY:t,sourcePosition:n=ee.Bottom,targetX:r,targetY:s,targetPosition:o=ee.Top}){const[i,a]=yy({pos:n,x1:e,y1:t,x2:r,y2:s}),[l,u]=yy({pos:o,x1:r,y1:s,x2:e,y2:t}),[d,c,f,m]=n1({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${i},${a} ${l},${u} ${r},${s}`,d,c,f,m]}function A1(e){return R.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:i,targetPosition:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:p,markerEnd:x,markerStart:w,interactionWidth:g})=>{const[v,y,S]=I1({sourceX:n,sourceY:r,sourcePosition:i,targetX:s,targetY:o,targetPosition:a}),E=e.isInternal?void 0:t;return h.jsx(tc,{id:E,path:v,labelX:y,labelY:S,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:p,markerEnd:x,markerStart:w,interactionWidth:g})})}const iA=A1({isInternal:!1}),O1=A1({isInternal:!0});iA.displayName="SimpleBezierEdge";O1.displayName="SimpleBezierEdgeInternal";function F1(e){return R.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:f,sourcePosition:m=ee.Bottom,targetPosition:p=ee.Top,markerEnd:x,markerStart:w,pathOptions:g,interactionWidth:v})=>{const[y,S,E]=Ef({sourceX:n,sourceY:r,sourcePosition:m,targetX:s,targetY:o,targetPosition:p,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),_=e.isInternal?void 0:t;return h.jsx(tc,{id:_,path:y,labelX:S,labelY:E,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:x,markerStart:w,interactionWidth:v})})}const D1=F1({isInternal:!1}),z1=F1({isInternal:!0});D1.displayName="SmoothStepEdge";z1.displayName="SmoothStepEdgeInternal";function $1(e){return R.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return h.jsx(D1,{...n,id:r,pathOptions:R.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const aA=$1({isInternal:!1}),B1=$1({isInternal:!0});aA.displayName="StepEdge";B1.displayName="StepEdgeInternal";function H1(e){return R.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:p,interactionWidth:x})=>{const[w,g,v]=o1({sourceX:n,sourceY:r,targetX:s,targetY:o}),y=e.isInternal?void 0:t;return h.jsx(tc,{id:y,path:w,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:p,interactionWidth:x})})}const lA=H1({isInternal:!1}),U1=H1({isInternal:!0});lA.displayName="StraightEdge";U1.displayName="StraightEdgeInternal";function V1(e){return R.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:i=ee.Bottom,targetPosition:a=ee.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:p,markerEnd:x,markerStart:w,pathOptions:g,interactionWidth:v})=>{const[y,S,E]=r1({sourceX:n,sourceY:r,sourcePosition:i,targetX:s,targetY:o,targetPosition:a,curvature:g==null?void 0:g.curvature}),_=e.isInternal?void 0:t;return h.jsx(tc,{id:_,path:y,labelX:S,labelY:E,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:p,markerEnd:x,markerStart:w,interactionWidth:v})})}const uA=V1({isInternal:!1}),W1=V1({isInternal:!0});uA.displayName="BezierEdge";W1.displayName="BezierEdgeInternal";const xy={default:W1,straight:U1,step:B1,smoothstep:z1,simplebezier:O1},vy={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},cA=(e,t,n)=>n===ee.Left?e-t:n===ee.Right?e+t:e,dA=(e,t,n)=>n===ee.Top?e-t:n===ee.Bottom?e+t:e,wy="react-flow__edgeupdater";function Sy({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:i,type:a}){return h.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:i,className:Oe([wy,`${wy}-${a}`]),cx:cA(t,r,e),cy:dA(n,r,e),r,stroke:"transparent",fill:"transparent"})}function fA({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:u,onReconnectStart:d,onReconnectEnd:c,setReconnecting:f,setUpdateHover:m}){const p=Ce(),x=(S,E)=>{if(S.button!==0)return;const{autoPanOnConnect:_,domNode:b,isValidConnection:C,connectionMode:L,connectionRadius:M,lib:P,onConnectStart:j,onConnectEnd:O,cancelConnection:k,nodeLookup:D,rfId:I,panBy:F,updateConnection:N}=p.getState(),T=E.type==="target",z=(K,V)=>{f(!1),c==null||c(K,n,E.type,V)},B=K=>u==null?void 0:u(n,K),H=(K,V)=>{f(!0),d==null||d(S,n,E.type),j==null||j(K,V)};kf.onPointerDown(S.nativeEvent,{autoPanOnConnect:_,connectionMode:L,connectionRadius:M,domNode:b,handleId:E.id,nodeId:E.nodeId,nodeLookup:D,isTarget:T,edgeUpdaterType:E.type,lib:P,flowId:I,cancelConnection:k,panBy:F,isValidConnection:C,onConnect:B,onConnectStart:H,onConnectEnd:O,onReconnectEnd:z,updateConnection:N,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},w=S=>x(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=S=>x(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),y=()=>m(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(Sy,{position:a,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&h.jsx(Sy,{position:l,centerX:o,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:"target"})]})}function hA({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:o,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,rfId:p,edgeTypes:x,noPanClassName:w,onError:g,disableKeyboardA11y:v}){let y=fe(J=>J.edgeLookup.get(e));const S=fe(J=>J.defaultEdgeOptions);y=S?{...S,...y}:y;let E=y.type||"default",_=(x==null?void 0:x[E])||xy[E];_===void 0&&(g==null||g("011",bn.error011(E)),E="default",_=(x==null?void 0:x.default)||xy.default);const b=!!(y.focusable||t&&typeof y.focusable>"u"),C=typeof c<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),L=!!(y.selectable||r&&typeof y.selectable>"u"),M=R.useRef(null),[P,j]=R.useState(!1),[O,k]=R.useState(!1),D=Ce(),{zIndex:I,sourceX:F,sourceY:N,targetX:T,targetY:z,sourcePosition:B,targetPosition:H}=fe(R.useCallback(J=>{const te=J.nodeLookup.get(y.source),he=J.nodeLookup.get(y.target);if(!te||!he)return{zIndex:y.zIndex,...vy};const ye=cL({id:e,sourceNode:te,targetNode:he,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:J.connectionMode,onError:g});return{zIndex:nL({selected:y.selected,zIndex:y.zIndex,sourceNode:te,targetNode:he,elevateOnSelect:J.elevateEdgesOnSelect,zIndexMode:J.zIndexMode}),...ye||vy}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),Ee),K=R.useMemo(()=>y.markerStart?`url('#${Cf(y.markerStart,p)}')`:void 0,[y.markerStart,p]),V=R.useMemo(()=>y.markerEnd?`url('#${Cf(y.markerEnd,p)}')`:void 0,[y.markerEnd,p]);if(y.hidden||F===null||N===null||T===null||z===null)return null;const X=J=>{var ce;const{addSelectedEdges:te,unselectNodesAndEdges:he,multiSelectionActive:ye}=D.getState();L&&(D.setState({nodesSelectionActive:!1}),y.selected&&ye?(he({nodes:[],edges:[y]}),(ce=M.current)==null||ce.blur()):te([e])),s&&s(J,y)},Q=o?J=>{o(J,{...y})}:void 0,Y=i?J=>{i(J,{...y})}:void 0,W=a?J=>{a(J,{...y})}:void 0,Z=l?J=>{l(J,{...y})}:void 0,oe=u?J=>{u(J,{...y})}:void 0,re=J=>{var te;if(!v&&Hw.includes(J.key)&&L){const{unselectNodesAndEdges:he,addSelectedEdges:ye}=D.getState();J.key==="Escape"?((te=M.current)==null||te.blur(),he({edges:[y]})):ye([e])}};return h.jsx("svg",{style:{zIndex:I},children:h.jsxs("g",{className:Oe(["react-flow__edge",`react-flow__edge-${E}`,y.className,w,{selected:y.selected,animated:y.animated,inactive:!L&&!s,updating:P,selectable:L}]),onClick:X,onDoubleClick:Q,onContextMenu:Y,onMouseEnter:W,onMouseMove:Z,onMouseLeave:oe,onKeyDown:b?re:void 0,tabIndex:b?0:void 0,role:y.ariaRole??(b?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":b?`${w1}-${p}`:void 0,ref:M,...y.domAttributes,children:[!O&&h.jsx(_,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:L,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:F,sourceY:N,targetX:T,targetY:z,sourcePosition:B,targetPosition:H,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:K,markerEnd:V,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),C&&h.jsx(fA,{edge:y,isReconnectable:C,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,sourceX:F,sourceY:N,targetX:T,targetY:z,sourcePosition:B,targetPosition:H,setUpdateHover:j,setReconnecting:k})]})})}var pA=R.memo(hA);const mA=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function K1({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:o,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:p,disableKeyboardA11y:x}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:v,onError:y}=fe(mA,Ee),S=JI(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(sA,{defaultColor:e,rfId:n}),S.map(E=>h.jsx(pA,{id:E,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:v,noPanClassName:s,onReconnect:o,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,onClick:d,reconnectRadius:c,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:p,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:x},E))]})}K1.displayName="EdgeRenderer";const gA=R.memo(K1),yA=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function xA({children:e}){const t=fe(yA);return h.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function vA(e){const t=up(),n=R.useRef(!1);R.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const wA=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function SA(e){const t=fe(wA),n=Ce();return R.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function _A(e){return e.connection.inProgress?{...e.connection,to:ba(e.connection.to,e.transform)}:{...e.connection}}function bA(e){return _A}function EA(e){const t=bA();return fe(t,Ee)}const CA=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function NA({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:o,height:i,isValid:a,inProgress:l}=fe(CA,Ee);return!(o&&s&&l)?null:h.jsx("svg",{style:e,width:o,height:i,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:Oe(["react-flow__connection",Ww(a)]),children:h.jsx(q1,{style:t,type:n,CustomComponent:r,isValid:a})})})}const q1=({style:e,type:t=rr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:o,fromNode:i,fromHandle:a,fromPosition:l,to:u,toNode:d,toHandle:c,toPosition:f,pointer:m}=EA();if(!s)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:o.x,fromY:o.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:f,connectionStatus:Ww(r),toNode:d,toHandle:c,pointer:m});let p="";const x={sourceX:o.x,sourceY:o.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case rr.Bezier:[p]=r1(x);break;case rr.SimpleBezier:[p]=I1(x);break;case rr.Step:[p]=Ef({...x,borderRadius:0});break;case rr.SmoothStep:[p]=Ef(x);break;default:[p]=o1(x)}return h.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};q1.displayName="ConnectionLine";const kA={};function _y(e=kA){R.useRef(e),Ce(),R.useEffect(()=>{},[e])}function PA(){Ce(),R.useRef(!1),R.useEffect(()=>{},[])}function Q1({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:f,onSelectionEnd:m,connectionLineType:p,connectionLineStyle:x,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:v,selectionOnDrag:y,selectionMode:S,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:b,deleteKeyCode:C,onlyRenderVisibleElements:L,elementsSelectable:M,defaultViewport:P,translateExtent:j,minZoom:O,maxZoom:k,preventScrolling:D,defaultMarkerColor:I,zoomOnScroll:F,zoomOnPinch:N,panOnScroll:T,panOnScrollSpeed:z,panOnScrollMode:B,zoomOnDoubleClick:H,panOnDrag:K,onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:Q,onPaneMouseLeave:Y,onPaneScroll:W,onPaneContextMenu:Z,paneClickDistance:oe,nodeClickDistance:re,onEdgeContextMenu:J,onEdgeMouseEnter:te,onEdgeMouseMove:he,onEdgeMouseLeave:ye,reconnectRadius:ce,onReconnect:$e,onReconnectStart:un,onReconnectEnd:dt,noDragClassName:At,noWheelClassName:Wn,noPanClassName:Kn,disableKeyboardA11y:de,nodeExtent:Le,rfId:Ye,viewport:Cn,onViewportChange:$o}){return _y(e),_y(t),PA(),vA(n),SA(Cn),h.jsx(UI,{onPaneClick:V,onPaneMouseEnter:X,onPaneMouseMove:Q,onPaneMouseLeave:Y,onPaneContextMenu:Z,onPaneScroll:W,paneClickDistance:oe,deleteKeyCode:C,selectionKeyCode:v,selectionOnDrag:y,selectionMode:S,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:b,elementsSelectable:M,zoomOnScroll:F,zoomOnPinch:N,zoomOnDoubleClick:H,panOnScroll:T,panOnScrollSpeed:z,panOnScrollMode:B,panOnDrag:K,defaultViewport:P,translateExtent:j,minZoom:O,maxZoom:k,onSelectionContextMenu:c,preventScrolling:D,noDragClassName:At,noWheelClassName:Wn,noPanClassName:Kn,disableKeyboardA11y:de,onViewportChange:$o,isControlledViewport:!!Cn,children:h.jsxs(xA,{children:[h.jsx(gA,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:i,onReconnect:$e,onReconnectStart:un,onReconnectEnd:dt,onlyRenderVisibleElements:L,onEdgeContextMenu:J,onEdgeMouseEnter:te,onEdgeMouseMove:he,onEdgeMouseLeave:ye,reconnectRadius:ce,defaultMarkerColor:I,noPanClassName:Kn,disableKeyboardA11y:de,rfId:Ye}),h.jsx(NA,{style:x,type:p,component:w,containerStyle:g}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(ZI,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:re,onlyRenderVisibleElements:L,noPanClassName:Kn,noDragClassName:At,disableKeyboardA11y:de,nodeExtent:Le,rfId:Ye}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}Q1.displayName="GraphView";const RA=R.memo(Q1),by=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:c,zIndexMode:f="basic"}={})=>{const m=new Map,p=new Map,x=new Map,w=new Map,g=r??t??[],v=n??e??[],y=d??[0,0],S=c??Xi;l1(x,w,g);const E=Nf(v,m,p,{nodeOrigin:y,nodeExtent:S,zIndexMode:f});let _=[0,0,1];if(i&&s&&o){const b=Sa(m,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:C,y:L,zoom:M}=np(b,s,o,l,u,(a==null?void 0:a.padding)??.1);_=[C,L,M]}return{rfId:"1",width:s??0,height:o??0,transform:_,nodes:v,nodesInitialized:E,nodeLookup:m,parentLookup:p,edges:g,edgeLookup:w,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:Xi,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:No.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Vw},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:XT,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Uw,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},jA=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:c,zIndexMode:f})=>QL((m,p)=>{async function x(){const{nodeLookup:w,panZoom:g,fitViewOptions:v,fitViewResolver:y,width:S,height:E,minZoom:_,maxZoom:b}=p();g&&(await QT({nodes:w,width:S,height:E,panZoom:g,minZoom:_,maxZoom:b},v),y==null||y.resolve(!0),m({fitViewResolver:null}))}return{...by({nodes:e,edges:t,width:s,height:o,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:w=>{const{nodeLookup:g,parentLookup:v,nodeOrigin:y,elevateNodesOnSelect:S,fitViewQueued:E,zIndexMode:_}=p(),b=Nf(w,g,v,{nodeOrigin:y,nodeExtent:c,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:_});E&&b?(x(),m({nodes:w,nodesInitialized:b,fitViewQueued:!1,fitViewOptions:void 0})):m({nodes:w,nodesInitialized:b})},setEdges:w=>{const{connectionLookup:g,edgeLookup:v}=p();l1(g,v,w),m({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:v}=p();v(w),m({hasDefaultNodes:!0})}if(g){const{setEdges:v}=p();v(g),m({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:v,parentLookup:y,domNode:S,nodeOrigin:E,nodeExtent:_,debug:b,fitViewQueued:C,zIndexMode:L}=p(),{changes:M,updatedInternals:P}=xL(w,v,y,S,E,_,L);P&&(pL(v,y,{nodeOrigin:E,nodeExtent:_,zIndexMode:L}),C?(x(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(M==null?void 0:M.length)>0&&(b&&console.log("React Flow: trigger node changes",M),g==null||g(M)))},updateNodePositions:(w,g=!1)=>{const v=[];let y=[];const{nodeLookup:S,triggerNodeChanges:E,connection:_,updateConnection:b,onNodesChangeMiddlewareMap:C}=p();for(const[L,M]of w){const P=S.get(L),j=!!(P!=null&&P.expandParent&&(P!=null&&P.parentId)&&(M!=null&&M.position)),O={id:L,type:"position",position:j?{x:Math.max(0,M.position.x),y:Math.max(0,M.position.y)}:M.position,dragging:g};if(P&&_.inProgress&&_.fromNode.id===P.id){const k=_s(P,_.fromHandle,ee.Left,!0);b({..._,from:k})}j&&P.parentId&&v.push({id:L,parentId:P.parentId,rect:{...M.internals.positionAbsolute,width:M.measured.width??0,height:M.measured.height??0}}),y.push(O)}if(v.length>0){const{parentLookup:L,nodeOrigin:M}=p(),P=lp(v,S,L,M);y.push(...P)}for(const L of C.values())y=L(y);E(y)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:v,nodes:y,hasDefaultNodes:S,debug:E}=p();if(w!=null&&w.length){if(S){const _=b1(w,y);v(_)}E&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:v,edges:y,hasDefaultEdges:S,debug:E}=p();if(w!=null&&w.length){if(S){const _=E1(w,y);v(_)}E&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:E}=p();if(g){const _=w.map(b=>Or(b,!0));S(_);return}S(Hs(y,new Set([...w]),!0)),E(Hs(v))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:E}=p();if(g){const _=w.map(b=>Or(b,!0));E(_);return}E(Hs(v,new Set([...w]))),S(Hs(y,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:v,nodes:y,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:_}=p(),b=w||y,C=g||v,L=b.map(P=>{const j=S.get(P.id);return j&&(j.selected=!1),Or(P.id,!1)}),M=C.map(P=>Or(P.id,!1));E(L),_(M)},setMinZoom:w=>{const{panZoom:g,maxZoom:v}=p();g==null||g.setScaleExtent([w,v]),m({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:v}=p();g==null||g.setScaleExtent([v,w]),m({maxZoom:w})},setTranslateExtent:w=>{var g;(g=p().panZoom)==null||g.setTranslateExtent(w),m({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:v,triggerEdgeChanges:y,elementsSelectable:S}=p();if(!S)return;const E=g.reduce((b,C)=>C.selected?[...b,Or(C.id,!1)]:b,[]),_=w.reduce((b,C)=>C.selected?[...b,Or(C.id,!1)]:b,[]);v(E),y(_)},setNodeExtent:w=>{const{nodes:g,nodeLookup:v,parentLookup:y,nodeOrigin:S,elevateNodesOnSelect:E,nodeExtent:_,zIndexMode:b}=p();w[0][0]===_[0][0]&&w[0][1]===_[0][1]&&w[1][0]===_[1][0]&&w[1][1]===_[1][1]||(Nf(g,v,y,{nodeOrigin:S,nodeExtent:w,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:b}),m({nodeExtent:w}))},panBy:w=>{const{transform:g,width:v,height:y,panZoom:S,translateExtent:E}=p();return vL({delta:w,panZoom:S,transform:g,translateExtent:E,width:v,height:y})},setCenter:async(w,g,v)=>{const{width:y,height:S,maxZoom:E,panZoom:_}=p();if(!_)return Promise.resolve(!1);const b=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await _.setViewport({x:y/2-w*b,y:S/2-g*b,zoom:b},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...Vw}})},updateConnection:w=>{m({connection:w})},reset:()=>m({...by()})}},Object.is);function MA({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:o,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:u,nodeOrigin:d,nodeExtent:c,zIndexMode:f,children:m}){const[p]=R.useState(()=>jA({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:u,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:c,zIndexMode:f}));return h.jsx(GL,{value:p,children:h.jsx(xI,{children:m})})}function TA({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m}){return R.useContext(Ju)?h.jsx(h.Fragment,{children:e}):h.jsx(MA,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:o,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m,children:e})}const LA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function IA({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:c,onMoveEnd:f,onConnect:m,onConnectStart:p,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:b,onNodeDrag:C,onNodeDragStop:L,onNodesDelete:M,onEdgesDelete:P,onDelete:j,onSelectionChange:O,onSelectionDragStart:k,onSelectionDrag:D,onSelectionDragStop:I,onSelectionContextMenu:F,onSelectionStart:N,onSelectionEnd:T,onBeforeDelete:z,connectionMode:B,connectionLineType:H=rr.Bezier,connectionLineStyle:K,connectionLineComponent:V,connectionLineContainerStyle:X,deleteKeyCode:Q="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:W=!1,selectionMode:Z=Yi.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:re=Ji()?"Meta":"Control",zoomActivationKeyCode:J=Ji()?"Meta":"Control",snapToGrid:te,snapGrid:he,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:ce,nodesDraggable:$e,autoPanOnNodeFocus:un,nodesConnectable:dt,nodesFocusable:At,nodeOrigin:Wn=S1,edgesFocusable:Kn,edgesReconnectable:de,elementsSelectable:Le=!0,defaultViewport:Ye=lI,minZoom:Cn=.5,maxZoom:$o=2,translateExtent:dp=Xi,preventScrolling:J1=!0,nodeExtent:nc,defaultMarkerColor:eS="#b1b1b7",zoomOnScroll:tS=!0,zoomOnPinch:nS=!0,panOnScroll:rS=!1,panOnScrollSpeed:sS=.5,panOnScrollMode:oS=as.Free,zoomOnDoubleClick:iS=!0,panOnDrag:aS=!0,onPaneClick:lS,onPaneMouseEnter:uS,onPaneMouseMove:cS,onPaneMouseLeave:dS,onPaneScroll:fS,onPaneContextMenu:hS,paneClickDistance:pS=1,nodeClickDistance:mS=0,children:gS,onReconnect:yS,onReconnectStart:xS,onReconnectEnd:vS,onEdgeContextMenu:wS,onEdgeDoubleClick:SS,onEdgeMouseEnter:_S,onEdgeMouseMove:bS,onEdgeMouseLeave:ES,reconnectRadius:CS=10,onNodesChange:NS,onEdgesChange:kS,noDragClassName:PS="nodrag",noWheelClassName:RS="nowheel",noPanClassName:fp="nopan",fitView:hp,fitViewOptions:pp,connectOnClick:jS,attributionPosition:MS,proOptions:TS,defaultEdgeOptions:LS,elevateNodesOnSelect:IS=!0,elevateEdgesOnSelect:AS=!1,disableKeyboardA11y:mp=!1,autoPanOnConnect:OS,autoPanOnNodeDrag:FS,autoPanSpeed:DS,connectionRadius:zS,isValidConnection:$S,onError:BS,style:HS,id:gp,nodeDragThreshold:US,connectionDragThreshold:VS,viewport:WS,onViewportChange:KS,width:qS,height:QS,colorMode:GS="light",debug:XS,onScroll:Ca,ariaLabelConfig:YS,zIndexMode:yp="basic",...ZS},JS){const rc=gp||"1",e_=fI(GS),t_=R.useCallback(xp=>{xp.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ca==null||Ca(xp)},[Ca]);return h.jsx("div",{"data-testid":"rf__wrapper",...ZS,onScroll:t_,style:{...HS,...LA},ref:JS,className:Oe(["react-flow",s,e_]),id:gp,role:"application",children:h.jsxs(TA,{nodes:e,edges:t,width:qS,height:QS,fitView:hp,fitViewOptions:pp,minZoom:Cn,maxZoom:$o,nodeOrigin:Wn,nodeExtent:nc,zIndexMode:yp,children:[h.jsx(RA,{onInit:u,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:o,edgeTypes:i,connectionLineType:H,connectionLineStyle:K,connectionLineComponent:V,connectionLineContainerStyle:X,selectionKeyCode:Y,selectionOnDrag:W,selectionMode:Z,deleteKeyCode:Q,multiSelectionKeyCode:re,panActivationKeyCode:oe,zoomActivationKeyCode:J,onlyRenderVisibleElements:ye,defaultViewport:Ye,translateExtent:dp,minZoom:Cn,maxZoom:$o,preventScrolling:J1,zoomOnScroll:tS,zoomOnPinch:nS,zoomOnDoubleClick:iS,panOnScroll:rS,panOnScrollSpeed:sS,panOnScrollMode:oS,panOnDrag:aS,onPaneClick:lS,onPaneMouseEnter:uS,onPaneMouseMove:cS,onPaneMouseLeave:dS,onPaneScroll:fS,onPaneContextMenu:hS,paneClickDistance:pS,nodeClickDistance:mS,onSelectionContextMenu:F,onSelectionStart:N,onSelectionEnd:T,onReconnect:yS,onReconnectStart:xS,onReconnectEnd:vS,onEdgeContextMenu:wS,onEdgeDoubleClick:SS,onEdgeMouseEnter:_S,onEdgeMouseMove:bS,onEdgeMouseLeave:ES,reconnectRadius:CS,defaultMarkerColor:eS,noDragClassName:PS,noWheelClassName:RS,noPanClassName:fp,rfId:rc,disableKeyboardA11y:mp,nodeExtent:nc,viewport:WS,onViewportChange:KS}),h.jsx(dI,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:p,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:$e,autoPanOnNodeFocus:un,nodesConnectable:dt,nodesFocusable:At,edgesFocusable:Kn,edgesReconnectable:de,elementsSelectable:Le,elevateNodesOnSelect:IS,elevateEdgesOnSelect:AS,minZoom:Cn,maxZoom:$o,nodeExtent:nc,onNodesChange:NS,onEdgesChange:kS,snapToGrid:te,snapGrid:he,connectionMode:B,translateExtent:dp,connectOnClick:jS,defaultEdgeOptions:LS,fitView:hp,fitViewOptions:pp,onNodesDelete:M,onEdgesDelete:P,onDelete:j,onNodeDragStart:b,onNodeDrag:C,onNodeDragStop:L,onSelectionDrag:D,onSelectionDragStart:k,onSelectionDragStop:I,onMove:d,onMoveStart:c,onMoveEnd:f,noPanClassName:fp,nodeOrigin:Wn,rfId:rc,autoPanOnConnect:OS,autoPanOnNodeDrag:FS,autoPanSpeed:DS,onError:BS,connectionRadius:zS,isValidConnection:$S,selectNodesOnDrag:ce,nodeDragThreshold:US,connectionDragThreshold:VS,onBeforeDelete:z,debug:XS,ariaLabelConfig:YS,zIndexMode:yp}),h.jsx(aI,{onSelectionChange:O}),gS,h.jsx(nI,{proOptions:TS,position:MS}),h.jsx(tI,{rfId:rc,disableKeyboardA11y:mp})]})})}var AA=C1(IA);function OA(e){const[t,n]=R.useState(e),r=R.useCallback(s=>n(o=>b1(s,o)),[]);return[t,n,r]}function FA(e){const[t,n]=R.useState(e),r=R.useCallback(s=>n(o=>E1(s,o)),[]);return[t,n,r]}function DA({dimensions:e,lineWidth:t,variant:n,className:r}){return h.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Oe(["react-flow__background-pattern",n,r])})}function zA({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:Oe(["react-flow__background-pattern","dots",t])})}var kr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(kr||(kr={}));const $A={[kr.Dots]:1,[kr.Lines]:1,[kr.Cross]:6},BA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function G1({id:e,variant:t=kr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=0,color:i,bgColor:a,style:l,className:u,patternClassName:d}){const c=R.useRef(null),{transform:f,patternId:m}=fe(BA,Ee),p=r||$A[t],x=t===kr.Dots,w=t===kr.Cross,g=Array.isArray(n)?n:[n,n],v=[g[0]*f[2]||1,g[1]*f[2]||1],y=p*f[2],S=Array.isArray(o)?o:[o,o],E=w?[y,y]:v,_=[S[0]*f[2]||1+E[0]/2,S[1]*f[2]||1+E[1]/2],b=`${m}${e||""}`;return h.jsxs("svg",{className:Oe(["react-flow__background",u]),style:{...l,...ec,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:c,"data-testid":"rf__background",children:[h.jsx("pattern",{id:b,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:x?h.jsx(zA,{radius:y/2,className:d}):h.jsx(DA,{dimensions:E,lineWidth:s,variant:t,className:d})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${b})`})]})}G1.displayName="Background";const HA=R.memo(G1);function UA(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:h.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function VA(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:h.jsx("path",{d:"M0 0h32v4.2H0z"})})}function WA(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:h.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function KA(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function qA(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sl({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:Oe(["react-flow__controls-button",t]),...n,children:e})}const QA=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function X1({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:u,children:d,position:c="bottom-left",orientation:f="vertical","aria-label":m}){const p=Ce(),{isInteractive:x,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:v}=fe(QA,Ee),{zoomIn:y,zoomOut:S,fitView:E}=up(),_=()=>{y(),o==null||o()},b=()=>{S(),i==null||i()},C=()=>{E(s),a==null||a()},L=()=>{p.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},M=f==="horizontal"?"horizontal":"vertical";return h.jsxs(Ea,{className:Oe(["react-flow__controls",M,u]),position:c,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(sl,{onClick:_,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:g,children:h.jsx(UA,{})}),h.jsx(sl,{onClick:b,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:w,children:h.jsx(VA,{})})]}),n&&h.jsx(sl,{className:"react-flow__controls-fitview",onClick:C,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:h.jsx(WA,{})}),r&&h.jsx(sl,{className:"react-flow__controls-interactive",onClick:L,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:x?h.jsx(qA,{}):h.jsx(KA,{})}),d]})}X1.displayName="Controls";const GA=R.memo(X1);function XA({id:e,x:t,y:n,width:r,height:s,style:o,color:i,strokeColor:a,strokeWidth:l,className:u,borderRadius:d,shapeRendering:c,selected:f,onClick:m}){const{background:p,backgroundColor:x}=o||{},w=i||p||x;return h.jsx("rect",{className:Oe(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:w,stroke:a,strokeWidth:l},shapeRendering:c,onClick:m?g=>m(g,e):void 0})}const YA=R.memo(XA),ZA=e=>e.nodes.map(t=>t.id),Jc=e=>e instanceof Function?e:()=>e;function JA({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:o=YA,onClick:i}){const a=fe(ZA,Ee),l=Jc(t),u=Jc(e),d=Jc(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:a.map(f=>h.jsx(t3,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:o,onClick:i,shapeRendering:c},f))})}function e3({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:u,x:d,y:c,width:f,height:m}=fe(p=>{const{internals:x}=p.nodeLookup.get(e),w=x.userNode,{x:g,y:v}=x.positionAbsolute,{width:y,height:S}=Vn(w);return{node:w,x:g,y:v,width:y,height:S}},Ee);return!u||u.hidden||!Yw(u)?null:h.jsx(a,{x:d,y:c,width:f,height:m,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:o,shapeRendering:i,onClick:l,id:u.id})}const t3=R.memo(e3);var n3=R.memo(JA);const r3=200,s3=150,o3=e=>!e.hidden,i3=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Xw(Sa(e.nodeLookup,{filter:o3}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},a3="react-flow__minimap-desc";function Y1({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:u,maskStrokeColor:d,maskStrokeWidth:c,position:f="bottom-right",onClick:m,onNodeClick:p,pannable:x=!1,zoomable:w=!1,ariaLabel:g,inversePan:v,zoomStep:y=1,offsetScale:S=5}){const E=Ce(),_=R.useRef(null),{boundingRect:b,viewBB:C,rfId:L,panZoom:M,translateExtent:P,flowWidth:j,flowHeight:O,ariaLabelConfig:k}=fe(i3,Ee),D=(e==null?void 0:e.width)??r3,I=(e==null?void 0:e.height)??s3,F=b.width/D,N=b.height/I,T=Math.max(F,N),z=T*D,B=T*I,H=S*T,K=b.x-(z-b.width)/2-H,V=b.y-(B-b.height)/2-H,X=z+H*2,Q=B+H*2,Y=`${a3}-${L}`,W=R.useRef(0),Z=R.useRef();W.current=T,R.useEffect(()=>{if(_.current&&M)return Z.current=PL({domNode:_.current,panZoom:M,getTransform:()=>E.getState().transform,getViewScale:()=>W.current}),()=>{var te;(te=Z.current)==null||te.destroy()}},[M]),R.useEffect(()=>{var te;(te=Z.current)==null||te.update({translateExtent:P,width:j,height:O,inversePan:v,pannable:x,zoomStep:y,zoomable:w})},[x,w,v,y,P,j,O]);const oe=m?te=>{var ce;const[he,ye]=((ce=Z.current)==null?void 0:ce.pointer(te))||[0,0];m(te,{x:he,y:ye})}:void 0,re=p?R.useCallback((te,he)=>{const ye=E.getState().nodeLookup.get(he).internals.userNode;p(te,ye)},[]):void 0,J=g??k["minimap.ariaLabel"];return h.jsx(Ea,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*T:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:Oe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:D,height:I,viewBox:`${K} ${V} ${X} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:_,onClick:oe,children:[J&&h.jsx("title",{id:Y,children:J}),h.jsx(n3,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:i,nodeComponent:a}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-H},${V-H}h${X+H*2}v${Q+H*2}h${-X-H*2}z
|
|
67
|
-
M${C.x},${C.y}h${C.width}v${C.height}h${-C.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Y1.displayName="MiniMap";const l3=R.memo(Y1),u3=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,c3={[jo.Line]:"right",[jo.Handle]:"bottom-right"};function d3({nodeId:e,position:t,variant:n=jo.Handle,className:r,style:s=void 0,children:o,color:i,minWidth:a=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:m=!0,shouldResize:p,onResizeStart:x,onResize:w,onResizeEnd:g}){const v=R1(),y=typeof e=="string"?e:v,S=Ce(),E=R.useRef(null),_=n===jo.Handle,b=fe(R.useCallback(u3(_&&m),[_,m]),Ee),C=R.useRef(null),L=t??c3[n];R.useEffect(()=>{if(!(!E.current||!y))return C.current||(C.current=HL({domNode:E.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:P,transform:j,snapGrid:O,snapToGrid:k,nodeOrigin:D,domNode:I}=S.getState();return{nodeLookup:P,transform:j,snapGrid:O,snapToGrid:k,nodeOrigin:D,paneDomNode:I}},onChange:(P,j)=>{const{triggerNodeChanges:O,nodeLookup:k,parentLookup:D,nodeOrigin:I}=S.getState(),F=[],N={x:P.x,y:P.y},T=k.get(y);if(T&&T.expandParent&&T.parentId){const z=T.origin??I,B=P.width??T.measured.width??0,H=P.height??T.measured.height??0,K={id:T.id,parentId:T.parentId,rect:{width:B,height:H,...Zw({x:P.x??T.position.x,y:P.y??T.position.y},{width:B,height:H},T.parentId,k,z)}},V=lp([K],k,D,I);F.push(...V),N.x=P.x?Math.max(z[0]*B,P.x):void 0,N.y=P.y?Math.max(z[1]*H,P.y):void 0}if(N.x!==void 0&&N.y!==void 0){const z={id:y,type:"position",position:{...N}};F.push(z)}if(P.width!==void 0&&P.height!==void 0){const B={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};F.push(B)}for(const z of j){const B={...z,type:"position"};F.push(B)}O(F)},onEnd:({width:P,height:j})=>{const O={id:y,type:"dimensions",resizing:!1,dimensions:{width:P,height:j}};S.getState().triggerNodeChanges([O])}})),C.current.update({controlPosition:L,boundaries:{minWidth:a,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:c,resizeDirection:f,onResizeStart:x,onResize:w,onResizeEnd:g,shouldResize:p}),()=>{var P;(P=C.current)==null||P.destroy()}},[L,a,l,u,d,c,x,w,g,p]);const M=L.split("-");return h.jsx("div",{className:Oe(["react-flow__resize-control","nodrag",...M,n,r]),ref:E,style:{...s,scale:b,...i&&{[_?"backgroundColor":"borderColor"]:i}},children:o})}R.memo(d3);function f3({data:e,selected:t}){const n=e,r=n.failed_count>0,s=n.running_count>0,o=n.success_count===n.total_count&&n.total_count>0;let i="border-border";return t?i="border-primary ring-2 ring-primary/20":r?i="border-red-500":s?i="border-blue-500":o&&(i="border-green-500"),h.jsxs("div",{className:`bg-card rounded-lg border-2 ${i} shadow-md min-w-[180px] transition-all`,children:[h.jsx(Mo,{type:"target",position:ee.Top,className:"!bg-muted-foreground !w-3 !h-3"}),h.jsxs("div",{className:"px-4 py-3",children:[h.jsx("div",{className:"font-semibold text-sm mb-2",children:n.class_name}),h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[h.jsxs(mt,{variant:"muted",className:"text-xs px-1.5 py-0.5",children:[n.total_count," total"]}),n.success_count>0&&h.jsx(mt,{variant:"success",className:"text-xs px-1.5 py-0.5",children:n.success_count}),n.running_count>0&&h.jsx(mt,{variant:"info",className:"text-xs px-1.5 py-0.5",children:n.running_count}),n.failed_count>0&&h.jsx(mt,{variant:"destructive",className:"text-xs px-1.5 py-0.5",children:n.failed_count})]}),h.jsxs("div",{className:"space-y-1",children:[n.experiments.slice(0,3).map(a=>h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:a.namespace,furu_hash:a.furu_hash},className:"block text-xs text-muted-foreground hover:text-primary truncate",title:a.furu_hash,children:[a.furu_hash.slice(0,8),"..."]},a.furu_hash)),n.experiments.length>3&&h.jsxs("div",{className:"text-xs text-muted-foreground",children:["+",n.experiments.length-3," more"]})]})]}),h.jsx(Mo,{type:"source",position:ee.Bottom,className:"!bg-muted-foreground !w-3 !h-3"})]})}const h3={classNode:f3};function p3(e,t){var p;const n=new Map,r=new Map,s=new Map;for(const x of e)n.set(x.id,0),r.set(x.id,[]),s.set(x.id,x);for(const x of t)s.has(x.source)&&s.has(x.target)&&(n.set(x.target,(n.get(x.target)??0)+1),(p=r.get(x.source))==null||p.push(x.target));const o=[],i=new Set,a=new Set(e.map(x=>x.id));for(;a.size>0;){const x=[];for(const w of a)(n.get(w)??0)===0&&x.push(w);if(x.length===0){const w=a.values().next().value;w&&x.push(w)}o.push(x);for(const w of x){a.delete(w),i.add(w);for(const g of r.get(w)??[])i.has(g)||n.set(g,(n.get(g)??1)-1)}}const l=200,u=180,d=40,c=new Map;for(let x=0;x<o.length;x++){const w=o[x],v=-(w.length*l+(w.length-1)*d)/2;for(let y=0;y<w.length;y++){const S=w[y];c.set(S,{x:v+y*(l+d),y:x*u})}}const f=e.map(x=>{const w=c.get(x.id)??{x:0,y:0};return{id:x.id,type:"classNode",position:w,data:x}}),m=t.filter(x=>s.has(x.source)&&s.has(x.target)).map(x=>({id:`${x.source}-${x.target}`,source:x.source,target:x.target,label:x.field_name,labelStyle:{fontSize:10,fill:"hsl(var(--muted-foreground))"},labelBgStyle:{fill:"hsl(var(--background))"},labelBgPadding:[4,2],style:{stroke:"hsl(var(--border))",strokeWidth:2},markerEnd:{type:ws.ArrowClosed,color:"hsl(var(--border))"},animated:!1}));return{nodes:f,edges:m}}function m3({nodes:e,edges:t}){const[n,r]=R.useState(null),{nodes:s,edges:o}=R.useMemo(()=>p3(e,t),[e,t]),[i,,a]=OA(s),[l,u,d]=FA(o),c=R.useCallback((m,p)=>{const x=p.data;r(x);const w=new Set([p.id]);for(const g of t)g.target===p.id&&w.add(g.source),g.source===p.id&&w.add(g.target);u(g=>g.map(v=>{const y=v.source===p.id||v.target===p.id;return{...v,animated:y,style:{...v.style,stroke:y?"hsl(var(--primary))":"hsl(var(--border))",strokeWidth:y?3:2},markerEnd:{type:ws.ArrowClosed,color:y?"hsl(var(--primary))":"hsl(var(--border))"}}}))},[t,u]),f=R.useCallback(()=>{r(null),u(m=>m.map(p=>({...p,animated:!1,style:{...p.style,stroke:"hsl(var(--border))",strokeWidth:2},markerEnd:{type:ws.ArrowClosed,color:"hsl(var(--border))"}})))},[u]);return h.jsx("div",{className:"h-[600px] border rounded-lg bg-background relative",children:h.jsxs(AA,{nodes:i,edges:l,onNodesChange:a,onEdgesChange:d,onNodeClick:c,onPaneClick:f,nodeTypes:h3,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},children:[h.jsx(HA,{}),h.jsx(GA,{}),h.jsx(l3,{nodeStrokeColor:"hsl(var(--border))",nodeColor:"hsl(var(--card))",nodeBorderRadius:4}),n&&h.jsx(Ea,{position:"top-right",className:"m-4",children:h.jsxs(be,{className:"w-80",children:[h.jsxs(nt,{className:"pb-2",children:[h.jsx(lt,{className:"text-base",children:n.class_name}),h.jsx("code",{className:"text-xs text-muted-foreground break-all",children:n.full_class_name})]}),h.jsxs(ke,{className:"space-y-3",children:[h.jsxs("div",{className:"flex gap-2 flex-wrap",children:[h.jsxs(mt,{variant:"muted",children:[n.total_count," experiments"]}),n.success_count>0&&h.jsxs(mt,{variant:"success",children:[n.success_count," success"]}),n.running_count>0&&h.jsxs(mt,{variant:"info",children:[n.running_count," running"]}),n.failed_count>0&&h.jsxs(mt,{variant:"destructive",children:[n.failed_count," failed"]})]}),h.jsx("div",{className:"max-h-40 overflow-y-auto space-y-1",children:n.experiments.map(m=>h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:m.namespace,furu_hash:m.furu_hash},className:"flex items-center justify-between p-2 rounded hover:bg-muted text-sm",children:[h.jsxs("code",{className:"text-xs",children:[m.furu_hash.slice(0,12),"..."]}),h.jsx(mt,{variant:m.result_status==="success"?"success":m.result_status==="failed"?"destructive":m.attempt_status==="running"?"info":"muted",className:"text-xs",children:m.attempt_status??m.result_status})]},m.furu_hash))})]})]})})]})})}const g3={default:"border-border",success:"border-emerald-500/40",failed:"border-red-500/40",running:"border-blue-500/40"},y3={default:"text-foreground",success:"text-emerald-300",failed:"text-red-300",running:"text-blue-300"};function Vr({title:e,value:t,loading:n,variant:r="default",icon:s,testId:o}){return h.jsxs(be,{className:ze("p-5",g3[r]),"data-testid":o,children:[h.jsx(nt,{className:"p-0 pb-4",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:e}),s?h.jsx(mt,{variant:"secondary",className:"text-base px-2 py-1",children:s}):null]})}),h.jsx(ke,{className:"p-0",children:h.jsx("div",{className:ze("text-3xl font-bold font-mono",y3[r]),"data-testid":o?`${o}-value`:void 0,children:n?"...":t.toLocaleString()})})]})}const x3=_o("/dag")({component:v3});function v3(){const{data:e,isLoading:t,error:n}=ZR();return h.jsxs("div",{className:"max-w-7xl mx-auto",children:[h.jsxs("div",{className:"mb-8",children:[h.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Experiment DAG"}),h.jsx("p",{className:"text-muted-foreground",children:"Visualize the dependency graph of your experiments. Nodes represent experiment classes, edges show dependencies."})]}),e&&h.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[h.jsx(Vr,{title:"Classes",value:e.total_nodes,loading:t,icon:"N"}),h.jsx(Vr,{title:"Dependencies",value:e.total_edges,loading:t,icon:"E"}),h.jsx(Vr,{title:"Experiments",value:e.total_experiments,loading:t,icon:"#"})]}),t?h.jsx(be,{children:h.jsx(ke,{className:"p-8 text-center text-muted-foreground",children:"Loading experiment graph..."})}):n?h.jsx(be,{children:h.jsx(ke,{className:"p-8 text-center text-destructive",children:"Error loading DAG. Is the API running?"})}):(e==null?void 0:e.nodes.length)===0?h.jsx(dw,{title:"No experiments found",description:"Create some experiments to see the dependency graph.",icon:"G"}):e?h.jsxs(be,{children:[h.jsxs(nt,{children:[h.jsx(lt,{children:"Dependency Graph"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Click on a node to see details and highlight connected edges. Scroll to zoom, drag to pan."})]}),h.jsx(ke,{className:"p-0",children:h.jsx(m3,{nodes:e.nodes,edges:e.edges})})]}):null,e&&e.nodes.length>0&&h.jsxs(be,{className:"mt-6",children:[h.jsx(nt,{className:"pb-2",children:h.jsx(lt,{className:"text-sm",children:"Legend"})}),h.jsx(ke,{children:h.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-green-500 rounded"}),h.jsx("span",{children:"All successful"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 rounded"}),h.jsx("span",{children:"Running experiments"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-red-500 rounded"}),h.jsx("span",{children:"Has failures"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-border rounded"}),h.jsx("span",{children:"Default"})]})]})})]})]})}const w3=_o("/")({component:S3});function S3(){const{data:e,isLoading:t}=LR(),{data:n,isLoading:r}=QR(),{data:s,isLoading:o}=cw({limit:5});return h.jsxs("div",{className:"max-w-6xl mx-auto",children:[h.jsxs("div",{className:"mb-8",children:[h.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Dashboard"}),h.jsx("p",{className:"text-muted-foreground",children:"Monitor your Furu experiments in real-time"})]}),h.jsx(be,{className:"mb-8",children:h.jsxs(ke,{className:"flex items-center justify-between p-4",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("span",{className:"text-muted-foreground",children:"API Status:"}),t?h.jsx(mt,{variant:"muted",children:"Checking..."}):(e==null?void 0:e.status)==="healthy"?h.jsxs(mt,{variant:"success",className:"gap-2",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-300 animate-pulse"}),"Healthy"]}):h.jsx(mt,{variant:"destructive",children:"Disconnected"})]}),h.jsxs("span",{className:"text-muted-foreground text-sm font-mono",children:["v",(e==null?void 0:e.version)||"..."]})]})}),h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[h.jsx(Vr,{title:"Total Experiments",value:(n==null?void 0:n.total)??0,loading:r,icon:"📊",testId:"stats-total"}),h.jsx(Vr,{title:"Running",value:(n==null?void 0:n.running_count)??0,loading:r,variant:"running",icon:"🔄",testId:"stats-running"}),h.jsx(Vr,{title:"Successful",value:(n==null?void 0:n.success_count)??0,loading:r,variant:"success",icon:"✓",testId:"stats-success"}),h.jsx(Vr,{title:"Failed",value:(n==null?void 0:n.failed_count)??0,loading:r,variant:"failed",icon:"✗",testId:"stats-failed"})]}),n&&n.by_result_status&&n.by_result_status.length>0&&h.jsxs(be,{className:"mb-8",children:[h.jsx(nt,{className:"pb-3",children:h.jsx(lt,{children:"Result Status Distribution"})}),h.jsx(ke,{children:h.jsx("div",{className:"flex flex-wrap gap-3",children:n.by_result_status.map(i=>h.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2",children:[h.jsx(sn,{status:i.status,type:"result"}),h.jsx("span",{className:"font-mono text-sm",children:i.count})]},i.status))})})]}),h.jsxs(be,{className:"overflow-hidden",children:[h.jsxs(nt,{className:"flex-row items-center justify-between space-y-0 border-b",children:[h.jsx(lt,{children:"Recent Experiments"}),h.jsx(wn,{asChild:!0,variant:"ghost",size:"sm",children:h.jsx(Ue,{to:"/experiments",children:"View all →"})})]}),o?h.jsx("div",{className:"p-6 text-muted-foreground",children:"Loading..."}):(s==null?void 0:s.experiments.length)===0?h.jsx("div",{className:"p-6 text-muted-foreground",children:"No experiments yet"}):h.jsxs(Vh,{children:[h.jsx(Wh,{children:h.jsxs(Wi,{children:[h.jsx(Ke,{className:"pl-6",children:"Class"}),h.jsx(Ke,{children:"Namespace"}),h.jsx(Ke,{children:"Result"}),h.jsx(Ke,{children:"Migration"}),h.jsx(Ke,{children:"Attempt"}),h.jsx(Ke,{children:"Updated"})]})}),h.jsx(Kh,{children:s==null?void 0:s.experiments.map(i=>h.jsxs(Wi,{children:[h.jsx(qe,{className:"pl-6",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:i.namespace,furu_hash:i.furu_hash},className:"font-medium hover:text-primary",children:i.class_name})}),h.jsx(qe,{className:"font-mono text-sm text-muted-foreground",children:i.namespace}),h.jsx(qe,{children:h.jsx(sn,{status:i.result_status,type:"result"})}),h.jsx(qe,{children:i.migration_kind?h.jsx("span",{className:"text-xs rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-amber-300",children:i.migration_kind}):h.jsx("span",{className:"text-muted-foreground",children:"—"})}),h.jsx(qe,{children:i.attempt_status?h.jsx(sn,{status:i.attempt_status,type:"attempt"}):h.jsx("span",{className:"text-muted-foreground",children:"—"})}),h.jsx(qe,{className:"text-sm text-muted-foreground",children:i.updated_at?new Date(i.updated_at).toLocaleString():"—"})]},`${i.namespace}-${i.furu_hash}`))})]})]})]})}function _3({metadata:e}){const t=a=>{const l=e[a];return typeof l=="string"?l:null},n=t("git_commit"),r=t("git_branch"),s=t("hostname"),o=t("user"),i=t("furu_python_def");return h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Metadata"})}),h.jsxs(ke,{children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[n?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Git Commit"}),h.jsx("code",{className:"font-mono text-xs",children:n})]}):null,r?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Git Branch"}),h.jsx("span",{children:r})]}):null,s?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Hostname"}),h.jsx("span",{children:s})]}):null,o?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"User"}),h.jsx("span",{children:o})]}):null]}),i?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"mb-2 block text-sm text-muted-foreground",children:"Python Definition"}),h.jsx("pre",{className:"rounded-lg bg-muted p-4 text-sm overflow-x-auto",children:h.jsx("code",{className:"text-emerald-300",children:i})})]}):null]})]})}function ta({value:e,depth:t=0}){if(e===null)return h.jsx("span",{className:"text-muted-foreground italic",children:"null"});if(typeof e=="boolean")return h.jsx("span",{className:e?"text-green-400":"text-red-400",children:String(e)});if(typeof e=="number")return h.jsx("span",{className:"text-blue-400",children:e});if(typeof e=="string")return h.jsxs("span",{className:"text-amber-300",children:['"',e,'"']});if(Array.isArray(e))return e.length===0?h.jsx("span",{className:"text-muted-foreground",children:"[]"}):h.jsxs("div",{className:"ml-4",children:[h.jsx("span",{className:"text-muted-foreground",children:"["}),e.map((n,r)=>h.jsxs("div",{className:"ml-4",children:[h.jsx(ta,{value:n,depth:t+1}),r<e.length-1&&h.jsx("span",{className:"text-muted-foreground",children:","})]},r)),h.jsx("span",{className:"text-muted-foreground",children:"]"})]});if(typeof e=="object"){const n=Object.entries(e);return n.length===0?h.jsx("span",{className:"text-muted-foreground",children:"{}"}):h.jsx("div",{className:t>0?"ml-4":"",children:n.map(([r,s],o)=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-purple-400 mr-1",children:[r,":"]}),h.jsx(ta,{value:s,depth:t+1}),o<n.length-1&&h.jsx("span",{className:"text-muted-foreground",children:","})]},r))})}return h.jsx("span",{children:String(e)})}function Ey({title:e,children:t,defaultOpen:n=!1}){const[r,s]=R.useState(n);return h.jsxs("div",{className:"border rounded-lg mb-2",children:[h.jsxs("button",{onClick:()=>s(!r),className:"w-full px-4 py-2 text-left flex items-center justify-between hover:bg-muted/50 rounded-lg",children:[h.jsx("span",{className:"font-medium text-sm",children:e}),h.jsx("span",{className:"text-muted-foreground",children:r?"−":"+"})]}),r&&h.jsx("div",{className:"px-4 pb-4 pt-2",children:t})]})}function b3({furuObj:e,parents:t}){const n=[],r=[];for(const[a,l]of Object.entries(e))a!=="__class__"&&(l&&typeof l=="object"&&!Array.isArray(l)&&"__class__"in l?r.push([a,l]):n.push([a,l]));const s=new Map((t==null?void 0:t.map(a=>[a.field_name,a]))??[]),o=n.length>0,i=r.length>0;return!o&&!i?h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Configuration"})}),h.jsx(ke,{children:h.jsx("p",{className:"text-muted-foreground text-sm",children:"No configuration parameters"})})]}):h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Configuration"})}),h.jsxs(ke,{children:[o&&h.jsx(Ey,{title:"Parameters",defaultOpen:!0,children:h.jsx("div",{className:"font-mono text-sm space-y-1",children:n.map(([a,l])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-purple-400 mr-2 min-w-fit",children:[a,":"]}),h.jsx(ta,{value:l})]},a))})}),i&&h.jsx(Ey,{title:"Dependencies (Embedded Config)",children:h.jsx("div",{className:"space-y-3",children:r.map(([a,l])=>{const u=s.get(a),d=(u==null?void 0:u.namespace)&&(u==null?void 0:u.furu_hash);return h.jsxs("div",{className:"border-l-2 border-muted pl-3",children:[h.jsxs("div",{className:"text-sm mb-1 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("span",{className:"text-purple-400 font-medium",children:a}),h.jsx("span",{className:"text-muted-foreground mx-1",children:":"}),d?h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:u.namespace,furu_hash:u.furu_hash},className:"text-cyan-400 hover:underline",children:l.__class__}):h.jsx("span",{className:"text-cyan-400",children:l.__class__})]}),(u==null?void 0:u.result_status)&&h.jsx(sn,{status:u.result_status,type:"result"})]}),h.jsx("div",{className:"font-mono text-xs space-y-0.5 text-muted-foreground",children:Object.entries(l).filter(([c])=>c!=="__class__").map(([c,f])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"mr-1",children:[c,":"]}),h.jsx(ta,{value:f,depth:1})]},c))})]},a)})})})]})]})}function E3({parents:e}){return e.length===0?null:h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Parent Experiments"})}),h.jsx(ke,{children:h.jsx("div",{className:"space-y-3",children:e.map((t,n)=>h.jsxs("div",{className:"border rounded-lg p-3",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-purple-400 font-medium text-sm",children:t.field_name}),h.jsx("span",{className:"text-muted-foreground",children:":"}),h.jsx("span",{className:"text-cyan-400 text-sm",children:t.class_name})]}),t.result_status&&h.jsx(sn,{status:t.result_status,type:"result"})]}),t.namespace&&t.furu_hash?h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:t.namespace,furu_hash:t.furu_hash},className:"text-sm text-primary hover:underline flex items-center gap-1",children:[h.jsx("span",{children:"View experiment"}),h.jsxs("span",{className:"text-muted-foreground font-mono text-xs",children:["(",t.furu_hash.slice(0,8),"...)"]})]}):h.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Experiment not found in storage"}),t.config&&Object.keys(t.config).length>0&&h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Show config"}),h.jsx("div",{className:"mt-1 font-mono text-xs pl-2 border-l border-muted",children:Object.entries(t.config).map(([r,s])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-muted-foreground mr-1",children:[r,":"]}),h.jsx(ta,{value:s,depth:1})]},r))})]})]},`${t.field_name}-${n}`))})})]})}function C3({children:e}){return e.length===0?null:h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsxs(lt,{children:["Child Experiments (",e.length,")"]})}),h.jsx(ke,{children:h.jsx("div",{className:"space-y-2",children:e.map((t,n)=>h.jsxs("div",{className:"border rounded-lg p-3 flex items-center justify-between",children:[h.jsx("div",{className:"flex items-center gap-3",children:h.jsxs("div",{children:[h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:t.namespace,furu_hash:t.furu_hash},className:"text-primary hover:underline font-medium",children:t.class_name}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["via"," ",h.jsx("span",{className:"text-purple-400",children:t.field_name})]})]})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("code",{className:"text-xs text-muted-foreground font-mono",children:[t.furu_hash.slice(0,8),"..."]}),h.jsx(sn,{status:t.result_status,type:"result"})]})]},`${t.namespace}-${t.furu_hash}-${n}`))})})]})}const Z1=_o("/experiments_/$namespace/$furu_hash")({component:N3});function N3(){var f,m,p;const{namespace:e,furu_hash:t}=Z1.useParams(),[n,r]=R.useState("resolved"),{data:s,isLoading:o,error:i}=VR(e,t,{view:n}),{data:a}=$R(e,t,{view:n}),l=!!(s!=null&&s.migration_kind),u=R.useMemo(()=>s!=null&&s.original_namespace&&(s!=null&&s.original_hash)?{namespace:s.original_namespace,furu_hash:s.original_hash}:s!=null&&s.from_namespace&&(s!=null&&s.from_hash)?{namespace:s.from_namespace,furu_hash:s.from_hash}:null,[s==null?void 0:s.original_namespace,s==null?void 0:s.original_hash,s==null?void 0:s.from_namespace,s==null?void 0:s.from_hash]),d=R.useMemo(()=>!(s!=null&&s.alias_namespaces)||!(s!=null&&s.alias_hashes)?[]:s.alias_namespaces.map((x,w)=>{var g;return{namespace:x,furu_hash:((g=s.alias_hashes)==null?void 0:g[w])??""}}),[s==null?void 0:s.alias_namespaces,s==null?void 0:s.alias_hashes]);if(o)return h.jsx("div",{className:"max-w-5xl mx-auto",children:h.jsx("div",{className:"text-muted-foreground",children:"Loading experiment..."})});if(i||!s)return h.jsx("div",{className:"max-w-5xl mx-auto",children:h.jsx(be,{className:"border-destructive/40",children:h.jsxs(ke,{className:"p-6 text-center",children:[h.jsx("h2",{className:"mb-2 text-xl font-bold text-destructive",children:"Experiment Not Found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The experiment you're looking for doesn't exist or has been removed."}),h.jsx(wn,{asChild:!0,variant:"ghost",children:h.jsx(Ue,{to:"/experiments",children:"Back to experiments"})})]})})});const c=s.metadata&&typeof s.metadata=="object"&&"furu_obj"in s.metadata?s.metadata.furu_obj:null;return h.jsxs("div",{className:"max-w-5xl mx-auto",children:[h.jsxs("div",{className:"mb-6 text-sm",children:[h.jsx(Ue,{to:"/experiments",className:"text-muted-foreground hover:text-primary",children:"Experiments"}),h.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),h.jsx("span",{className:"text-foreground",children:s.class_name})]}),h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{className:"pb-4",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsx(lt,{className:"text-2xl",children:s.class_name}),h.jsx("p",{className:"text-sm font-mono text-muted-foreground",children:s.namespace})]}),h.jsxs("div",{className:"flex flex-col items-end gap-2",children:[h.jsxs("div",{className:"flex gap-2",children:[h.jsx(sn,{status:s.result_status,type:"result"}),s.attempt_status?h.jsx(sn,{status:s.attempt_status,type:"attempt"}):null]}),l?h.jsx("span",{className:"rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-xs text-amber-300",children:s.migration_kind}):null]})]})}),h.jsxs(ke,{className:"space-y-4",children:[l&&h.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[h.jsxs("div",{className:"rounded-full border border-muted px-3 py-1 text-muted-foreground",children:["View: ",n]}),h.jsxs("div",{className:"flex rounded-full border border-muted overflow-hidden",children:[h.jsx("button",{className:`px-3 py-1 text-xs ${n==="resolved"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,onClick:()=>r("resolved"),children:"Aliased"}),h.jsx("button",{className:`px-3 py-1 text-xs ${n==="original"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,onClick:()=>r("original"),disabled:!u,children:"Original"})]}),u?h.jsx(wn,{asChild:!0,size:"sm",variant:"ghost",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:u,children:"View original"})}):null,s.original_result_status?h.jsxs("span",{className:"text-muted-foreground",children:["Original status: ",s.original_result_status]}):null]}),d.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[h.jsxs("div",{className:"rounded-full border border-muted px-3 py-1 text-muted-foreground",children:["Aliases: ",d.length]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(x=>h.jsx(wn,{asChild:!0,size:"sm",variant:"ghost",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:x,"aria-label":"View alias",children:"View alias"})},x.furu_hash))})]}),h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Hash"}),h.jsx("code",{className:"font-mono",children:s.furu_hash})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Attempt #"}),h.jsx("span",{children:s.attempt_number??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Started"}),h.jsx("span",{children:s.started_at?new Date(s.started_at).toLocaleString():"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Updated"}),h.jsx("span",{children:s.updated_at?new Date(s.updated_at).toLocaleString():"—"})]})]})]})]}),c&&h.jsx(b3,{furuObj:c,parents:a==null?void 0:a.parents}),(a==null?void 0:a.parents)&&a.parents.length>0&&h.jsx(E3,{parents:a.parents}),(a==null?void 0:a.children)&&a.children.length>0&&h.jsx(C3,{children:a.children}),s.attempt&&h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Current Attempt"})}),h.jsxs(ke,{children:[h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"ID"}),h.jsx("code",{className:"font-mono text-xs",children:s.attempt.id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Backend"}),h.jsx("span",{children:s.attempt.backend})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Status"}),h.jsx(sn,{status:s.attempt.status,type:"attempt"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Host"}),h.jsx("span",{children:((f=s.attempt.owner)==null?void 0:f.host)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"PID"}),h.jsx("span",{className:"font-mono",children:((m=s.attempt.owner)==null?void 0:m.pid)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"User"}),h.jsx("span",{children:((p=s.attempt.owner)==null?void 0:p.user)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Started At"}),h.jsx("span",{children:new Date(s.attempt.started_at).toLocaleString()})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Last Heartbeat"}),h.jsx("span",{children:new Date(s.attempt.heartbeat_at).toLocaleString()})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Lease Expires"}),h.jsx("span",{children:new Date(s.attempt.lease_expires_at).toLocaleString()})]})]}),s.attempt.reason?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"block text-sm text-muted-foreground",children:"Reason"}),h.jsx("span",{className:"text-amber-300",children:s.attempt.reason})]}):null,s.attempt.error?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"block text-sm text-muted-foreground",children:"Error"}),h.jsxs("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3",children:[h.jsxs("div",{className:"font-mono text-sm text-destructive",children:[s.attempt.error.type,": ",s.attempt.error.message]}),s.attempt.error.traceback?h.jsxs("details",{className:"mt-3",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"View traceback"}),h.jsx("pre",{className:"mt-2 max-h-96 overflow-auto rounded bg-muted p-3 text-xs",children:h.jsx("code",{className:"text-muted-foreground",children:s.attempt.error.traceback})})]}):null]})]}):null]})]}),s.metadata&&h.jsx(_3,{metadata:s.metadata}),h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Directory"})}),h.jsx(ke,{children:h.jsx("code",{className:"break-all font-mono text-sm text-muted-foreground",children:s.directory})})]}),h.jsxs("details",{className:"rounded-lg border bg-card",children:[h.jsx("summary",{className:"cursor-pointer px-6 py-4 text-muted-foreground hover:text-foreground",children:"View Raw State JSON"}),h.jsx("div",{className:"px-6 pb-6",children:h.jsx("pre",{className:"max-h-96 overflow-x-auto rounded-lg bg-muted p-4 text-sm",children:h.jsx("code",{className:"text-muted-foreground",children:JSON.stringify(s.state,null,2)})})})]})]})}const k3=ij.update({id:"/experiments",path:"/experiments",getParentRoute:()=>ya}),P3=x3.update({id:"/dag",path:"/dag",getParentRoute:()=>ya}),R3=w3.update({id:"/",path:"/",getParentRoute:()=>ya}),j3=Z1.update({id:"/experiments_/$namespace/$furu_hash",path:"/experiments/$namespace/$furu_hash",getParentRoute:()=>ya}),M3={IndexRoute:R3,DagRoute:P3,ExperimentsRoute:k3,ExperimentsNamespaceFuru_hashRoute:j3},T3=ya._addFileChildren(M3)._addFileTypes(),L3=new ZE({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3,retry:(e,t)=>{var n;if(t instanceof DP&&((n=t.response)!=null&&n.status)){const r=t.response.status;if(r>=400&&r<500)return!1}return e<3}}}}),I3=ok({routeTree:T3});Gx(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(eC,{client:L3,children:h.jsx(lk,{router:I3})})}));
|
|
67
|
+
M${C.x},${C.y}h${C.width}v${C.height}h${-C.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Y1.displayName="MiniMap";const l3=R.memo(Y1),u3=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,c3={[jo.Line]:"right",[jo.Handle]:"bottom-right"};function d3({nodeId:e,position:t,variant:n=jo.Handle,className:r,style:s=void 0,children:o,color:i,minWidth:a=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:m=!0,shouldResize:p,onResizeStart:x,onResize:w,onResizeEnd:g}){const v=R1(),y=typeof e=="string"?e:v,S=Ce(),E=R.useRef(null),_=n===jo.Handle,b=fe(R.useCallback(u3(_&&m),[_,m]),Ee),C=R.useRef(null),L=t??c3[n];R.useEffect(()=>{if(!(!E.current||!y))return C.current||(C.current=HL({domNode:E.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:P,transform:j,snapGrid:O,snapToGrid:k,nodeOrigin:D,domNode:I}=S.getState();return{nodeLookup:P,transform:j,snapGrid:O,snapToGrid:k,nodeOrigin:D,paneDomNode:I}},onChange:(P,j)=>{const{triggerNodeChanges:O,nodeLookup:k,parentLookup:D,nodeOrigin:I}=S.getState(),F=[],N={x:P.x,y:P.y},T=k.get(y);if(T&&T.expandParent&&T.parentId){const z=T.origin??I,B=P.width??T.measured.width??0,H=P.height??T.measured.height??0,K={id:T.id,parentId:T.parentId,rect:{width:B,height:H,...Zw({x:P.x??T.position.x,y:P.y??T.position.y},{width:B,height:H},T.parentId,k,z)}},V=lp([K],k,D,I);F.push(...V),N.x=P.x?Math.max(z[0]*B,P.x):void 0,N.y=P.y?Math.max(z[1]*H,P.y):void 0}if(N.x!==void 0&&N.y!==void 0){const z={id:y,type:"position",position:{...N}};F.push(z)}if(P.width!==void 0&&P.height!==void 0){const B={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};F.push(B)}for(const z of j){const B={...z,type:"position"};F.push(B)}O(F)},onEnd:({width:P,height:j})=>{const O={id:y,type:"dimensions",resizing:!1,dimensions:{width:P,height:j}};S.getState().triggerNodeChanges([O])}})),C.current.update({controlPosition:L,boundaries:{minWidth:a,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:c,resizeDirection:f,onResizeStart:x,onResize:w,onResizeEnd:g,shouldResize:p}),()=>{var P;(P=C.current)==null||P.destroy()}},[L,a,l,u,d,c,x,w,g,p]);const M=L.split("-");return h.jsx("div",{className:Oe(["react-flow__resize-control","nodrag",...M,n,r]),ref:E,style:{...s,scale:b,...i&&{[_?"backgroundColor":"borderColor"]:i}},children:o})}R.memo(d3);function f3({data:e,selected:t}){const n=e,r=n.failed_count>0,s=n.running_count>0,o=n.success_count===n.total_count&&n.total_count>0;let i="border-border";return t?i="border-primary ring-2 ring-primary/20":r?i="border-red-500":s?i="border-blue-500":o&&(i="border-green-500"),h.jsxs("div",{className:`bg-card rounded-lg border-2 ${i} shadow-md min-w-[180px] transition-all`,children:[h.jsx(Mo,{type:"target",position:ee.Top,className:"!bg-muted-foreground !w-3 !h-3"}),h.jsxs("div",{className:"px-4 py-3",children:[h.jsx("div",{className:"font-semibold text-sm mb-2",children:n.class_name}),h.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[h.jsxs(mt,{variant:"muted",className:"text-xs px-1.5 py-0.5",children:[n.total_count," total"]}),n.success_count>0&&h.jsx(mt,{variant:"success",className:"text-xs px-1.5 py-0.5",children:n.success_count}),n.running_count>0&&h.jsx(mt,{variant:"info",className:"text-xs px-1.5 py-0.5",children:n.running_count}),n.failed_count>0&&h.jsx(mt,{variant:"destructive",className:"text-xs px-1.5 py-0.5",children:n.failed_count})]}),h.jsxs("div",{className:"space-y-1",children:[n.experiments.slice(0,3).map(a=>h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:a.namespace,furu_hash:a.furu_hash},className:"block text-xs text-muted-foreground hover:text-primary truncate",title:a.furu_hash,children:[a.furu_hash.slice(0,8),"..."]},a.furu_hash)),n.experiments.length>3&&h.jsxs("div",{className:"text-xs text-muted-foreground",children:["+",n.experiments.length-3," more"]})]})]}),h.jsx(Mo,{type:"source",position:ee.Bottom,className:"!bg-muted-foreground !w-3 !h-3"})]})}const h3={classNode:f3};function p3(e,t){var p;const n=new Map,r=new Map,s=new Map;for(const x of e)n.set(x.id,0),r.set(x.id,[]),s.set(x.id,x);for(const x of t)s.has(x.source)&&s.has(x.target)&&(n.set(x.target,(n.get(x.target)??0)+1),(p=r.get(x.source))==null||p.push(x.target));const o=[],i=new Set,a=new Set(e.map(x=>x.id));for(;a.size>0;){const x=[];for(const w of a)(n.get(w)??0)===0&&x.push(w);if(x.length===0){const w=a.values().next().value;w&&x.push(w)}o.push(x);for(const w of x){a.delete(w),i.add(w);for(const g of r.get(w)??[])i.has(g)||n.set(g,(n.get(g)??1)-1)}}const l=200,u=180,d=40,c=new Map;for(let x=0;x<o.length;x++){const w=o[x],v=-(w.length*l+(w.length-1)*d)/2;for(let y=0;y<w.length;y++){const S=w[y];c.set(S,{x:v+y*(l+d),y:x*u})}}const f=e.map(x=>{const w=c.get(x.id)??{x:0,y:0};return{id:x.id,type:"classNode",position:w,data:x}}),m=t.filter(x=>s.has(x.source)&&s.has(x.target)).map(x=>({id:`${x.source}-${x.target}`,source:x.source,target:x.target,label:x.field_name,labelStyle:{fontSize:10,fill:"hsl(var(--muted-foreground))"},labelBgStyle:{fill:"hsl(var(--background))"},labelBgPadding:[4,2],style:{stroke:"hsl(var(--border))",strokeWidth:2},markerEnd:{type:ws.ArrowClosed,color:"hsl(var(--border))"},animated:!1}));return{nodes:f,edges:m}}function m3({nodes:e,edges:t}){const[n,r]=R.useState(null),{nodes:s,edges:o}=R.useMemo(()=>p3(e,t),[e,t]),[i,,a]=OA(s),[l,u,d]=FA(o),c=R.useCallback((m,p)=>{const x=p.data;r(x);const w=new Set([p.id]);for(const g of t)g.target===p.id&&w.add(g.source),g.source===p.id&&w.add(g.target);u(g=>g.map(v=>{const y=v.source===p.id||v.target===p.id;return{...v,animated:y,style:{...v.style,stroke:y?"hsl(var(--primary))":"hsl(var(--border))",strokeWidth:y?3:2},markerEnd:{type:ws.ArrowClosed,color:y?"hsl(var(--primary))":"hsl(var(--border))"}}}))},[t,u]),f=R.useCallback(()=>{r(null),u(m=>m.map(p=>({...p,animated:!1,style:{...p.style,stroke:"hsl(var(--border))",strokeWidth:2},markerEnd:{type:ws.ArrowClosed,color:"hsl(var(--border))"}})))},[u]);return h.jsx("div",{className:"h-[600px] border rounded-lg bg-background relative",children:h.jsxs(AA,{nodes:i,edges:l,onNodesChange:a,onEdgesChange:d,onNodeClick:c,onPaneClick:f,nodeTypes:h3,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},children:[h.jsx(HA,{}),h.jsx(GA,{}),h.jsx(l3,{nodeStrokeColor:"hsl(var(--border))",nodeColor:"hsl(var(--card))",nodeBorderRadius:4}),n&&h.jsx(Ea,{position:"top-right",className:"m-4",children:h.jsxs(be,{className:"w-80",children:[h.jsxs(nt,{className:"pb-2",children:[h.jsx(lt,{className:"text-base",children:n.class_name}),h.jsx("code",{className:"text-xs text-muted-foreground break-all",children:n.full_class_name})]}),h.jsxs(ke,{className:"space-y-3",children:[h.jsxs("div",{className:"flex gap-2 flex-wrap",children:[h.jsxs(mt,{variant:"muted",children:[n.total_count," experiments"]}),n.success_count>0&&h.jsxs(mt,{variant:"success",children:[n.success_count," success"]}),n.running_count>0&&h.jsxs(mt,{variant:"info",children:[n.running_count," running"]}),n.failed_count>0&&h.jsxs(mt,{variant:"destructive",children:[n.failed_count," failed"]})]}),h.jsx("div",{className:"max-h-40 overflow-y-auto space-y-1",children:n.experiments.map(m=>h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:m.namespace,furu_hash:m.furu_hash},className:"flex items-center justify-between p-2 rounded hover:bg-muted text-sm",children:[h.jsxs("code",{className:"text-xs",children:[m.furu_hash.slice(0,12),"..."]}),h.jsx(mt,{variant:m.result_status==="success"?"success":m.result_status==="failed"?"destructive":m.attempt_status==="running"?"info":"muted",className:"text-xs",children:m.attempt_status??m.result_status})]},m.furu_hash))})]})]})})]})})}const g3={default:"border-border",success:"border-emerald-500/40",failed:"border-red-500/40",running:"border-blue-500/40"},y3={default:"text-foreground",success:"text-emerald-300",failed:"text-red-300",running:"text-blue-300"};function Vr({title:e,value:t,loading:n,variant:r="default",icon:s,testId:o}){return h.jsxs(be,{className:ze("p-5",g3[r]),"data-testid":o,children:[h.jsx(nt,{className:"p-0 pb-4",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:e}),s?h.jsx(mt,{variant:"secondary",className:"text-base px-2 py-1",children:s}):null]})}),h.jsx(ke,{className:"p-0",children:h.jsx("div",{className:ze("text-3xl font-bold font-mono",y3[r]),"data-testid":o?`${o}-value`:void 0,children:n?"...":t.toLocaleString()})})]})}const x3=_o("/dag")({component:v3});function v3(){const{data:e,isLoading:t,error:n}=ZR();return h.jsxs("div",{className:"max-w-7xl mx-auto",children:[h.jsxs("div",{className:"mb-8",children:[h.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Experiment DAG"}),h.jsx("p",{className:"text-muted-foreground",children:"Visualize the dependency graph of your experiments. Nodes represent experiment classes, edges show dependencies."})]}),e&&h.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[h.jsx(Vr,{title:"Classes",value:e.total_nodes,loading:t,icon:"N"}),h.jsx(Vr,{title:"Dependencies",value:e.total_edges,loading:t,icon:"E"}),h.jsx(Vr,{title:"Experiments",value:e.total_experiments,loading:t,icon:"#"})]}),t?h.jsx(be,{children:h.jsx(ke,{className:"p-8 text-center text-muted-foreground",children:"Loading experiment graph..."})}):n?h.jsx(be,{children:h.jsx(ke,{className:"p-8 text-center text-destructive",children:"Error loading DAG. Is the API running?"})}):(e==null?void 0:e.nodes.length)===0?h.jsx(dw,{title:"No experiments found",description:"Create some experiments to see the dependency graph.",icon:"G"}):e?h.jsxs(be,{children:[h.jsxs(nt,{children:[h.jsx(lt,{children:"Dependency Graph"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Click on a node to see details and highlight connected edges. Scroll to zoom, drag to pan."})]}),h.jsx(ke,{className:"p-0",children:h.jsx(m3,{nodes:e.nodes,edges:e.edges})})]}):null,e&&e.nodes.length>0&&h.jsxs(be,{className:"mt-6",children:[h.jsx(nt,{className:"pb-2",children:h.jsx(lt,{className:"text-sm",children:"Legend"})}),h.jsx(ke,{children:h.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-green-500 rounded"}),h.jsx("span",{children:"All successful"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 rounded"}),h.jsx("span",{children:"Running experiments"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-red-500 rounded"}),h.jsx("span",{children:"Has failures"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-4 h-4 border-2 border-border rounded"}),h.jsx("span",{children:"Default"})]})]})})]})]})}const w3=_o("/")({component:S3});function S3(){const{data:e,isLoading:t}=LR(),{data:n,isLoading:r}=QR(),{data:s,isLoading:o}=cw({limit:5});return h.jsxs("div",{className:"max-w-6xl mx-auto",children:[h.jsxs("div",{className:"mb-8",children:[h.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Dashboard"}),h.jsx("p",{className:"text-muted-foreground",children:"Monitor your Furu experiments in real-time"})]}),h.jsx(be,{className:"mb-8",children:h.jsxs(ke,{className:"flex items-center justify-between p-4",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("span",{className:"text-muted-foreground",children:"API Status:"}),t?h.jsx(mt,{variant:"muted",children:"Checking..."}):(e==null?void 0:e.status)==="healthy"?h.jsxs(mt,{variant:"success",className:"gap-2",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-300 animate-pulse"}),"Healthy"]}):h.jsx(mt,{variant:"destructive",children:"Disconnected"})]}),h.jsxs("span",{className:"text-muted-foreground text-sm font-mono",children:["v",(e==null?void 0:e.version)||"..."]})]})}),h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[h.jsx(Vr,{title:"Total Experiments",value:(n==null?void 0:n.total)??0,loading:r,icon:"📊",testId:"stats-total"}),h.jsx(Vr,{title:"Running",value:(n==null?void 0:n.running_count)??0,loading:r,variant:"running",icon:"🔄",testId:"stats-running"}),h.jsx(Vr,{title:"Successful",value:(n==null?void 0:n.success_count)??0,loading:r,variant:"success",icon:"✓",testId:"stats-success"}),h.jsx(Vr,{title:"Failed",value:(n==null?void 0:n.failed_count)??0,loading:r,variant:"failed",icon:"✗",testId:"stats-failed"})]}),n&&n.by_result_status&&n.by_result_status.length>0&&h.jsxs(be,{className:"mb-8",children:[h.jsx(nt,{className:"pb-3",children:h.jsx(lt,{children:"Result Status Distribution"})}),h.jsx(ke,{children:h.jsx("div",{className:"flex flex-wrap gap-3",children:n.by_result_status.map(i=>h.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2",children:[h.jsx(sn,{status:i.status,type:"result"}),h.jsx("span",{className:"font-mono text-sm",children:i.count})]},i.status))})})]}),h.jsxs(be,{className:"overflow-hidden",children:[h.jsxs(nt,{className:"flex-row items-center justify-between space-y-0 border-b",children:[h.jsx(lt,{children:"Recent Experiments"}),h.jsx(wn,{asChild:!0,variant:"ghost",size:"sm",children:h.jsx(Ue,{to:"/experiments",children:"View all →"})})]}),o?h.jsx("div",{className:"p-6 text-muted-foreground",children:"Loading..."}):(s==null?void 0:s.experiments.length)===0?h.jsx("div",{className:"p-6 text-muted-foreground",children:"No experiments yet"}):h.jsxs(Vh,{children:[h.jsx(Wh,{children:h.jsxs(Wi,{children:[h.jsx(Ke,{className:"pl-6",children:"Class"}),h.jsx(Ke,{children:"Namespace"}),h.jsx(Ke,{children:"Result"}),h.jsx(Ke,{children:"Migration"}),h.jsx(Ke,{children:"Attempt"}),h.jsx(Ke,{children:"Updated"})]})}),h.jsx(Kh,{children:s==null?void 0:s.experiments.map(i=>h.jsxs(Wi,{children:[h.jsx(qe,{className:"pl-6",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:i.namespace,furu_hash:i.furu_hash},className:"font-medium hover:text-primary",children:i.class_name})}),h.jsx(qe,{className:"font-mono text-sm text-muted-foreground",children:i.namespace}),h.jsx(qe,{children:h.jsx(sn,{status:i.result_status,type:"result"})}),h.jsx(qe,{children:i.migration_kind?h.jsx("span",{className:"text-xs rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-amber-300",children:i.migration_kind}):h.jsx("span",{className:"text-muted-foreground",children:"—"})}),h.jsx(qe,{children:i.attempt_status?h.jsx(sn,{status:i.attempt_status,type:"attempt"}):h.jsx("span",{className:"text-muted-foreground",children:"—"})}),h.jsx(qe,{className:"text-sm text-muted-foreground",children:i.updated_at?new Date(i.updated_at).toLocaleString():"—"})]},`${i.namespace}-${i.furu_hash}`))})]})]})]})}function _3({metadata:e}){const t=a=>{const l=e[a];return typeof l=="string"?l:null},n=t("git_commit"),r=t("git_branch"),s=t("hostname"),o=t("user"),i=t("furu_python_def");return h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Metadata"})}),h.jsxs(ke,{children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[n?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Git Commit"}),h.jsx("code",{className:"font-mono text-xs",children:n})]}):null,r?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Git Branch"}),h.jsx("span",{children:r})]}):null,s?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Hostname"}),h.jsx("span",{children:s})]}):null,o?h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"User"}),h.jsx("span",{children:o})]}):null]}),i?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"mb-2 block text-sm text-muted-foreground",children:"Python Definition"}),h.jsx("pre",{className:"rounded-lg bg-muted p-4 text-sm overflow-x-auto",children:h.jsx("code",{className:"text-emerald-300",children:i})})]}):null]})]})}function ta({value:e,depth:t=0}){if(e===null)return h.jsx("span",{className:"text-muted-foreground italic",children:"null"});if(typeof e=="boolean")return h.jsx("span",{className:e?"text-green-400":"text-red-400",children:String(e)});if(typeof e=="number")return h.jsx("span",{className:"text-blue-400",children:e});if(typeof e=="string")return h.jsxs("span",{className:"text-amber-300",children:['"',e,'"']});if(Array.isArray(e))return e.length===0?h.jsx("span",{className:"text-muted-foreground",children:"[]"}):h.jsxs("div",{className:"ml-4",children:[h.jsx("span",{className:"text-muted-foreground",children:"["}),e.map((n,r)=>h.jsxs("div",{className:"ml-4",children:[h.jsx(ta,{value:n,depth:t+1}),r<e.length-1&&h.jsx("span",{className:"text-muted-foreground",children:","})]},r)),h.jsx("span",{className:"text-muted-foreground",children:"]"})]});if(typeof e=="object"){const n=Object.entries(e);return n.length===0?h.jsx("span",{className:"text-muted-foreground",children:"{}"}):h.jsx("div",{className:t>0?"ml-4":"",children:n.map(([r,s],o)=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-purple-400 mr-1",children:[r,":"]}),h.jsx(ta,{value:s,depth:t+1}),o<n.length-1&&h.jsx("span",{className:"text-muted-foreground",children:","})]},r))})}return h.jsx("span",{children:String(e)})}function Ey({title:e,children:t,defaultOpen:n=!1}){const[r,s]=R.useState(n);return h.jsxs("div",{className:"border rounded-lg mb-2",children:[h.jsxs("button",{onClick:()=>s(!r),className:"w-full px-4 py-2 text-left flex items-center justify-between hover:bg-muted/50 rounded-lg",children:[h.jsx("span",{className:"font-medium text-sm",children:e}),h.jsx("span",{className:"text-muted-foreground",children:r?"−":"+"})]}),r&&h.jsx("div",{className:"px-4 pb-4 pt-2",children:t})]})}function b3({furuObj:e,parents:t}){const n=[],r=[];for(const[a,l]of Object.entries(e))a!=="__class__"&&(l&&typeof l=="object"&&!Array.isArray(l)&&"__class__"in l?r.push([a,l]):n.push([a,l]));const s=new Map((t==null?void 0:t.map(a=>[a.field_name,a]))??[]),o=n.length>0,i=r.length>0;return!o&&!i?h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Configuration"})}),h.jsx(ke,{children:h.jsx("p",{className:"text-muted-foreground text-sm",children:"No configuration parameters"})})]}):h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Configuration"})}),h.jsxs(ke,{children:[o&&h.jsx(Ey,{title:"Parameters",defaultOpen:!0,children:h.jsx("div",{className:"font-mono text-sm space-y-1",children:n.map(([a,l])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-purple-400 mr-2 min-w-fit",children:[a,":"]}),h.jsx(ta,{value:l})]},a))})}),i&&h.jsx(Ey,{title:"Dependencies (Embedded Config)",children:h.jsx("div",{className:"space-y-3",children:r.map(([a,l])=>{const u=s.get(a),d=(u==null?void 0:u.namespace)&&(u==null?void 0:u.furu_hash);return h.jsxs("div",{className:"border-l-2 border-muted pl-3",children:[h.jsxs("div",{className:"text-sm mb-1 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsx("span",{className:"text-purple-400 font-medium",children:a}),h.jsx("span",{className:"text-muted-foreground mx-1",children:":"}),d?h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:u.namespace,furu_hash:u.furu_hash},className:"text-cyan-400 hover:underline",children:l.__class__}):h.jsx("span",{className:"text-cyan-400",children:l.__class__})]}),(u==null?void 0:u.result_status)&&h.jsx(sn,{status:u.result_status,type:"result"})]}),h.jsx("div",{className:"font-mono text-xs space-y-0.5 text-muted-foreground",children:Object.entries(l).filter(([c])=>c!=="__class__").map(([c,f])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"mr-1",children:[c,":"]}),h.jsx(ta,{value:f,depth:1})]},c))})]},a)})})})]})]})}function E3({parents:e}){return e.length===0?null:h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Parent Experiments"})}),h.jsx(ke,{children:h.jsx("div",{className:"space-y-3",children:e.map((t,n)=>h.jsxs("div",{className:"border rounded-lg p-3",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-purple-400 font-medium text-sm",children:t.field_name}),h.jsx("span",{className:"text-muted-foreground",children:":"}),h.jsx("span",{className:"text-cyan-400 text-sm",children:t.class_name})]}),t.result_status&&h.jsx(sn,{status:t.result_status,type:"result"})]}),t.namespace&&t.furu_hash?h.jsxs(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:t.namespace,furu_hash:t.furu_hash},className:"text-sm text-primary hover:underline flex items-center gap-1",children:[h.jsx("span",{children:"View experiment"}),h.jsxs("span",{className:"text-muted-foreground font-mono text-xs",children:["(",t.furu_hash.slice(0,8),"...)"]})]}):h.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Experiment not found in storage"}),t.config&&Object.keys(t.config).length>0&&h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"Show config"}),h.jsx("div",{className:"mt-1 font-mono text-xs pl-2 border-l border-muted",children:Object.entries(t.config).map(([r,s])=>h.jsxs("div",{className:"flex",children:[h.jsxs("span",{className:"text-muted-foreground mr-1",children:[r,":"]}),h.jsx(ta,{value:s,depth:1})]},r))})]})]},`${t.field_name}-${n}`))})})]})}function C3({children:e}){return e.length===0?null:h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsxs(lt,{children:["Child Experiments (",e.length,")"]})}),h.jsx(ke,{children:h.jsx("div",{className:"space-y-2",children:e.map((t,n)=>h.jsxs("div",{className:"border rounded-lg p-3 flex items-center justify-between",children:[h.jsx("div",{className:"flex items-center gap-3",children:h.jsxs("div",{children:[h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:{namespace:t.namespace,furu_hash:t.furu_hash},className:"text-primary hover:underline font-medium",children:t.class_name}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["via"," ",h.jsx("span",{className:"text-purple-400",children:t.field_name})]})]})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("code",{className:"text-xs text-muted-foreground font-mono",children:[t.furu_hash.slice(0,8),"..."]}),h.jsx(sn,{status:t.result_status,type:"result"})]})]},`${t.namespace}-${t.furu_hash}-${n}`))})})]})}const Z1=_o("/experiments_/$namespace/$furu_hash")({component:N3});function N3(){var f,m,p;const{namespace:e,furu_hash:t}=Z1.useParams(),[n,r]=R.useState("resolved"),{data:s,isLoading:o,error:i}=VR(e,t,{view:n}),{data:a}=$R(e,t,{view:n}),l=!!(s!=null&&s.migration_kind),u=R.useMemo(()=>s!=null&&s.original_namespace&&(s!=null&&s.original_hash)?{namespace:s.original_namespace,furu_hash:s.original_hash}:s!=null&&s.from_namespace&&(s!=null&&s.from_hash)?{namespace:s.from_namespace,furu_hash:s.from_hash}:null,[s==null?void 0:s.original_namespace,s==null?void 0:s.original_hash,s==null?void 0:s.from_namespace,s==null?void 0:s.from_hash]),d=R.useMemo(()=>!(s!=null&&s.alias_namespaces)||!(s!=null&&s.alias_hashes)?[]:s.alias_namespaces.map((x,w)=>{var g;return{namespace:x,furu_hash:((g=s.alias_hashes)==null?void 0:g[w])??""}}),[s==null?void 0:s.alias_namespaces,s==null?void 0:s.alias_hashes]);if(o)return h.jsx("div",{className:"max-w-5xl mx-auto",children:h.jsx("div",{className:"text-muted-foreground",children:"Loading experiment..."})});if(i||!s)return h.jsx("div",{className:"max-w-5xl mx-auto",children:h.jsx(be,{className:"border-destructive/40",children:h.jsxs(ke,{className:"p-6 text-center",children:[h.jsx("h2",{className:"mb-2 text-xl font-bold text-destructive",children:"Experiment Not Found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The experiment you're looking for doesn't exist or has been removed."}),h.jsx(wn,{asChild:!0,variant:"ghost",children:h.jsx(Ue,{to:"/experiments",children:"Back to experiments"})})]})})});const c=s.metadata&&typeof s.metadata=="object"&&"furu_obj"in s.metadata?s.metadata.furu_obj:null;return h.jsxs("div",{className:"max-w-5xl mx-auto",children:[h.jsxs("div",{className:"mb-6 text-sm",children:[h.jsx(Ue,{to:"/experiments",className:"text-muted-foreground hover:text-primary",children:"Experiments"}),h.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),h.jsx("span",{className:"text-foreground",children:s.class_name})]}),h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{className:"pb-4",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsx(lt,{className:"text-2xl",children:s.class_name}),h.jsx("p",{className:"text-sm font-mono text-muted-foreground",children:s.namespace})]}),h.jsxs("div",{className:"flex flex-col items-end gap-2",children:[h.jsxs("div",{className:"flex gap-2",children:[h.jsx(sn,{status:s.result_status,type:"result"}),s.attempt_status?h.jsx(sn,{status:s.attempt_status,type:"attempt"}):null]}),l?h.jsx("span",{className:"rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-xs text-amber-300",children:s.migration_kind}):null]})]})}),h.jsxs(ke,{className:"space-y-4",children:[l&&h.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[h.jsxs("div",{className:"rounded-full border border-muted px-3 py-1 text-muted-foreground",children:["View: ",n]}),h.jsxs("div",{className:"flex rounded-full border border-muted overflow-hidden",children:[h.jsx("button",{className:`px-3 py-1 text-xs ${n==="resolved"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,onClick:()=>r("resolved"),children:"Aliased"}),h.jsx("button",{className:`px-3 py-1 text-xs ${n==="original"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,onClick:()=>r("original"),disabled:!u,children:"Original"})]}),u?h.jsx(wn,{asChild:!0,size:"sm",variant:"ghost",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:u,children:"View original"})}):null,s.original_result_status?h.jsxs("span",{className:"text-muted-foreground",children:["Original status: ",s.original_result_status]}):null]}),d.length>0&&h.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[h.jsxs("div",{className:"rounded-full border border-muted px-3 py-1 text-muted-foreground",children:["Aliases: ",d.length]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(x=>h.jsx(wn,{asChild:!0,size:"sm",variant:"ghost",children:h.jsx(Ue,{to:"/experiments/$namespace/$furu_hash",params:x,"aria-label":"View alias",children:"View alias"})},x.furu_hash))})]}),h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Hash"}),h.jsx("code",{className:"font-mono",children:s.furu_hash})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Attempt #"}),h.jsx("span",{children:s.attempt_number??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Started"}),h.jsx("span",{children:s.started_at?new Date(s.started_at).toLocaleString():"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Updated"}),h.jsx("span",{children:s.updated_at?new Date(s.updated_at).toLocaleString():"—"})]})]})]})]}),c&&h.jsx(b3,{furuObj:c,parents:a==null?void 0:a.parents}),(a==null?void 0:a.parents)&&a.parents.length>0&&h.jsx(E3,{parents:a.parents}),(a==null?void 0:a.children)&&a.children.length>0&&h.jsx(C3,{children:a.children}),s.attempt&&h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Current Attempt"})}),h.jsxs(ke,{children:[h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"ID"}),h.jsx("code",{className:"font-mono text-xs",children:s.attempt.id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Backend"}),h.jsx("span",{children:s.attempt.backend})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Status"}),h.jsx(sn,{status:s.attempt.status,type:"attempt"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Host"}),h.jsx("span",{children:((f=s.attempt.owner)==null?void 0:f.host)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"PID"}),h.jsx("span",{className:"font-mono",children:((m=s.attempt.owner)==null?void 0:m.pid)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"User"}),h.jsx("span",{children:((p=s.attempt.owner)==null?void 0:p.user)??"—"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Started At"}),h.jsx("span",{children:new Date(s.attempt.started_at).toLocaleString()})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground block",children:"Lease Expires"}),h.jsx("span",{children:new Date(s.attempt.lease_expires_at).toLocaleString()})]})]}),s.attempt.reason?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"block text-sm text-muted-foreground",children:"Reason"}),h.jsx("span",{className:"text-amber-300",children:s.attempt.reason})]}):null,s.attempt.error?h.jsxs("div",{className:"mt-4 border-t pt-4",children:[h.jsx("span",{className:"block text-sm text-muted-foreground",children:"Error"}),h.jsxs("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-3",children:[h.jsxs("div",{className:"font-mono text-sm text-destructive",children:[s.attempt.error.type,": ",s.attempt.error.message]}),s.attempt.error.traceback?h.jsxs("details",{className:"mt-3",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"View traceback"}),h.jsx("pre",{className:"mt-2 max-h-96 overflow-auto rounded bg-muted p-3 text-xs",children:h.jsx("code",{className:"text-muted-foreground",children:s.attempt.error.traceback})})]}):null]})]}):null]})]}),s.metadata&&h.jsx(_3,{metadata:s.metadata}),h.jsxs(be,{className:"mb-6",children:[h.jsx(nt,{children:h.jsx(lt,{children:"Directory"})}),h.jsx(ke,{children:h.jsx("code",{className:"break-all font-mono text-sm text-muted-foreground",children:s.directory})})]}),h.jsxs("details",{className:"rounded-lg border bg-card",children:[h.jsx("summary",{className:"cursor-pointer px-6 py-4 text-muted-foreground hover:text-foreground",children:"View Raw State JSON"}),h.jsx("div",{className:"px-6 pb-6",children:h.jsx("pre",{className:"max-h-96 overflow-x-auto rounded-lg bg-muted p-4 text-sm",children:h.jsx("code",{className:"text-muted-foreground",children:JSON.stringify(s.state,null,2)})})})]})]})}const k3=ij.update({id:"/experiments",path:"/experiments",getParentRoute:()=>ya}),P3=x3.update({id:"/dag",path:"/dag",getParentRoute:()=>ya}),R3=w3.update({id:"/",path:"/",getParentRoute:()=>ya}),j3=Z1.update({id:"/experiments_/$namespace/$furu_hash",path:"/experiments/$namespace/$furu_hash",getParentRoute:()=>ya}),M3={IndexRoute:R3,DagRoute:P3,ExperimentsRoute:k3,ExperimentsNamespaceFuru_hashRoute:j3},T3=ya._addFileChildren(M3)._addFileTypes(),L3=new ZE({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3,retry:(e,t)=>{var n;if(t instanceof DP&&((n=t.response)!=null&&n.status)){const r=t.response.status;if(r>=400&&r<500)return!1}return e<3}}}}),I3=ok({routeTree:T3});Gx(document.getElementById("root")).render(h.jsx(R.StrictMode,{children:h.jsx(eC,{client:L3,children:h.jsx(lk,{router:I3})})}));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
12
12
|
rel="stylesheet"
|
|
13
13
|
/>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BjyrY-Zz.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/index-BXAIKNNr.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
furu/execution/local.py
CHANGED
|
@@ -6,6 +6,7 @@ from concurrent.futures import FIRST_COMPLETED, Future, ThreadPoolExecutor, wait
|
|
|
6
6
|
from ..config import FURU_CONFIG
|
|
7
7
|
from ..core import Furu
|
|
8
8
|
from ..errors import FuruComputeError, FuruError
|
|
9
|
+
from ..runtime.logging import enter_holder
|
|
9
10
|
from ..storage.state import StateManager
|
|
10
11
|
from .context import EXEC_CONTEXT, ExecContext
|
|
11
12
|
from .plan import PlanNode, build_plan, ready_todo
|
|
@@ -38,11 +39,12 @@ def _run_node(node: PlanNode) -> None:
|
|
|
38
39
|
mode="executor",
|
|
39
40
|
spec_key=node.spec_key,
|
|
40
41
|
backend="local",
|
|
41
|
-
current_node_hash=node.obj.
|
|
42
|
+
current_node_hash=node.obj.furu_hash,
|
|
42
43
|
)
|
|
43
44
|
)
|
|
44
45
|
try:
|
|
45
|
-
node.obj
|
|
46
|
+
with enter_holder(node.obj):
|
|
47
|
+
node.obj.get(force=True)
|
|
46
48
|
finally:
|
|
47
49
|
EXEC_CONTEXT.reset(token)
|
|
48
50
|
|
|
@@ -97,7 +99,7 @@ def run_local(
|
|
|
97
99
|
)
|
|
98
100
|
compute_error = FuruComputeError(
|
|
99
101
|
"local executor failed for "
|
|
100
|
-
f"{node.obj.__class__.__name__}({node.obj.
|
|
102
|
+
f"{node.obj.__class__.__name__}({node.obj.furu_hash})",
|
|
101
103
|
state_path,
|
|
102
104
|
original_error=exc,
|
|
103
105
|
)
|
|
@@ -124,7 +126,7 @@ def run_local(
|
|
|
124
126
|
]
|
|
125
127
|
if failed:
|
|
126
128
|
names = ", ".join(
|
|
127
|
-
f"{node.obj.__class__.__name__}({node.obj.
|
|
129
|
+
f"{node.obj.__class__.__name__}({node.obj.furu_hash})"
|
|
128
130
|
for node in failed
|
|
129
131
|
)
|
|
130
132
|
raise RuntimeError(
|
|
@@ -146,8 +148,8 @@ def run_local(
|
|
|
146
148
|
finished_indices = [
|
|
147
149
|
index
|
|
148
150
|
for index in active_indices
|
|
149
|
-
if plan.nodes.get(roots[index].
|
|
150
|
-
and plan.nodes[roots[index].
|
|
151
|
+
if plan.nodes.get(roots[index].furu_hash) is not None
|
|
152
|
+
and plan.nodes[roots[index].furu_hash].status == "DONE"
|
|
151
153
|
]
|
|
152
154
|
for index in finished_indices:
|
|
153
155
|
active_indices.remove(index)
|
|
@@ -174,7 +176,7 @@ def run_local(
|
|
|
174
176
|
]
|
|
175
177
|
if todo_nodes:
|
|
176
178
|
sample = ", ".join(
|
|
177
|
-
f"{node.obj.__class__.__name__}({node.obj.
|
|
179
|
+
f"{node.obj.__class__.__name__}({node.obj.furu_hash})"
|
|
178
180
|
for node in todo_nodes[:3]
|
|
179
181
|
)
|
|
180
182
|
raise RuntimeError(
|