@kaddo/cli 3.84.0 → 3.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -544,6 +544,7 @@ create --from roadmap → owners → guard → explain`.
|
|
|
544
544
|
| v3.43 | Capability-grounded roadmap: each `RM-xxx` candidate is graded on related domain / capability / source signals; `roadmap_quality` surfaced in `explain`/`context`/`understand`; `create --from roadmap` preserves `source_roadmap_candidate` + related metadata into the Work Item; roadmap-agent emits grounded fields (never materializes Work Items); MCP `kaddo://roadmap-quality` |
|
|
545
545
|
| v3.44 | Roadmap counting alignment + materialization quality: `explain`/`context` separate **Roadmap initiatives** from **Work Item candidates** (`## Roadmap Status`); two-level `roadmapQuality` (initiatives + work_item_candidates); `create --from roadmap` normalizes metadata — fills `domains` from `related_domain`, splits comma-joined `related_capabilities` into a real list, carries `source_roadmap_initiative`/`source_work_item_candidate`/`source_signals`/`decision_candidates`, improved Source + Context-From-Roadmap body + ADR warning; MCP `kaddo://work-item-candidates` |
|
|
546
546
|
| v3.45 | State-aware next step: `resolveNextStep` decides from the real delivery state (draft/ready/in-progress, ownership, ADRs, adapters) instead of always suggesting `create --from roadmap` — draft → work-item-agent, ready → adapter/implementation-agent, in-progress → guard; parallel **secondary** recommendations (ownership, ADRs, remaining candidates); `deliveryState` + recommendation in `explain`/`context`; MCP `kaddo://next-step` |
|
|
547
|
+
| v3.86 | Official Kaddo Agent Plugin: portable Agent Plugins 1.0 packaging, Kiro Power integration, canonical Skill synchronization, MCP boundary documentation and automated drift validation |
|
|
547
548
|
|
|
548
549
|
**Optional modules (installed with `kaddo add`):**
|
|
549
550
|
|
|
@@ -41,4 +41,4 @@ Error generating stack: `+e.message+`
|
|
|
41
41
|
`,`
|
|
42
42
|
+`).split(`
|
|
43
43
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,v.useEffect)(()=>{let n=t?.target??oj,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&zO(e))return!1;let n=lj(e.code,s);if(a.current.add(e[n]),cj(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=lj(e.code,s);cj(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function cj(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function lj(e,t){return t.includes(e)?`code`:`key`}var uj=()=>{let e=NA();return(0,v.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=TO(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return bO(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=xO(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function dj(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)fj(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function fj(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function pj(e,t){return dj(e,t)}function mj(e,t){return dj(e,t)}function hj(e,t){return{id:e,type:`select`,selected:t}}function gj(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(hj(a.id,e)))}return r}function _j({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function vj(e){return{id:e.id,type:`remove`}}var yj=vO(`React Flow`,`https://reactflow.dev/`);function bj(e,t,n={}){return QO(e,t,{...n,onError:n.onError??yj})}var xj=e=>KD(e),Sj=e=>GD(e);function Cj(e){return(0,v.forwardRef)(e)}var wj=typeof window<`u`?v.useLayoutEffect:v.useEffect;function Tj(e){let[t,n]=(0,v.useState)(BigInt(0)),[r]=(0,v.useState)(()=>Ej(()=>n(e=>e+BigInt(1))));return wj(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Ej(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Dj=(0,v.createContext)(null);function Oj({children:e}){let t=NA(),n=Tj((0,v.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=_j({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Tj((0,v.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(_j({items:s,lookup:o}))},[])),i=(0,v.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,x.jsx)(Dj.Provider,{value:i,children:e})}function kj(){let e=(0,v.useContext)(Dj);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Aj=e=>!!e.panZoom;function jj(){let e=uj(),t=NA(),n=kj(),r=MA(Aj),i=(0,v.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=xj(e)?e:n.get(e.id),a=i.parentId?AO(i.position,i.measured,i.parentId,n,r):i.position;return dO({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&xj(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Sj(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await nO({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(vj);o?.(f),c(e)}if(m){let e=d.map(vj);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=gO(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=dO(s?r:a),l=hO(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=gO(e)?e:a(e);if(!r)return!1;let i=hO(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return YD(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??MO();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,v.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Mj=e=>e.selected,Nj=typeof window<`u`?window:void 0;function Pj({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=NA(),{deleteElements:r}=jj(),i=sj(e,{actInsideInputWithModifier:!1}),a=sj(t,{target:Nj});(0,v.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Mj),edges:e.filter(Mj)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,v.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Fj(e){let t=NA();(0,v.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=IO(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,PD.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Ij={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Lj=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Rj({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=zD.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:y,isControlledViewport:b,paneClickDistance:S,selectionOnDrag:C}){let w=NA(),T=(0,v.useRef)(null),{userSelectionActive:E,lib:D,connectionInProgress:O}=MA(Lj,OA),k=sj(p),A=(0,v.useRef)();Fj(T);let j=(0,v.useCallback)(e=>{y?.({x:e[0],y:e[1],zoom:e[2]}),b||w.setState({transform:e})},[y,b]);return(0,v.useEffect)(()=>{if(T.current){A.current=sA({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>w.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=w.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=w.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=w.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=A.current.getViewport();return w.setState({panZoom:A.current,transform:[e,t,n],domNode:T.current.closest(`.react-flow`)}),()=>{A.current?.destroy()}}},[]),(0,v.useEffect)(()=>{A.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:k,preventScrolling:m,noPanClassName:_,userSelectionActive:E,noWheelClassName:g,lib:D,onTransformChange:j,connectionInProgress:O,selectionOnDrag:C,paneClickDistance:S})},[e,t,n,r,i,a,o,s,c,k,m,_,E,g,D,j,O,C,S]),(0,x.jsx)(`div`,{className:`react-flow__renderer`,ref:T,style:Ij,children:h})}var zj=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Bj(){let{userSelectionActive:e,userSelectionRect:t}=MA(zj,OA);return e&&t?(0,x.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}var Vj=(e,t)=>n=>{n.target===t.current&&e?.(n)},Hj=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Uj({isSelecting:e,selectionKeyPressed:t,selectionMode:n=BD.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,v.useRef)(0),_=NA(),{userSelectionActive:y,elementsSelectable:b,dragging:S,panBy:C,autoPanSpeed:w}=MA(Hj,OA),T=b&&(e||y),E=(0,v.useRef)(null),D=(0,v.useRef)(),O=(0,v.useRef)(new Set),k=(0,v.useRef)(new Set),A=(0,v.useRef)(!1),j=(0,v.useRef)(!1),M=(0,v.useRef)({x:0,y:0}),N=(0,v.useRef)(!1),P=e=>{if(j.current||A.current||_.getState().connection.inProgress){j.current=!1,A.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},F=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},ee=d?e=>d(e):void 0,I=e=>{j.current&&=(e.stopPropagation(),!1)},te=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(D.current=i?.getBoundingClientRect(),!D.current)return;let s=n.target===E.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),j.current=!1;let{x:c,y:l}=VO(n.nativeEvent,D.current),u=bO({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function ne(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=xO(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=O.current,g=k.current;O.current=new Set(ZD(a,m,i,n===BD.Partial,!0).map(e=>e.id)),k.current=new Set;let v=u?.selectable??!0;for(let e of O.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&k.current.add(e)}}jO(h,O.current)||c(gj(a,O.current,!0)),jO(g,k.current)||l(gj(o,k.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!D.current)return;let[e,t]=sO(M.current,D.current,w);C({x:e,y:t}).then(e=>{if(!j.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=M.current;ne(t,n),g.current=requestAnimationFrame(L)})}let re=()=>{cancelAnimationFrame(g.current),g.current=0,N.current=!1};(0,v.useEffect)(()=>()=>re(),[]);let ie=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!D.current||!n)return;let{x:o,y:c}=VO(e.nativeEvent,D.current);M.current={x:o,y:c};let l=xO({x:n.startX,y:n.startY},r);if(!j.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}j.current=!0,N.current||=(L(),!0),ne(o,c)},ae=e=>{if(!T){e.target===E.current&&_.getState().connection.inProgress&&(A.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!y&&e.target===E.current&&_.getState().userSelectionRect&&P?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(c?.(e),_.setState({nodesSelectionActive:O.current.size>0})),re())},oe=e=>{e.target?.releasePointerCapture?.(e.pointerId),re()},se=r===!0||Array.isArray(r)&&r.includes(0);return(0,x.jsxs)(`div`,{className:Zx([`react-flow__pane`,{draggable:se,dragging:S,selection:e}]),onClick:T?void 0:Vj(P,E),onContextMenu:Vj(F,E),onWheel:Vj(ee,E),onPointerEnter:T?void 0:f,onPointerMove:T?ie:p,onPointerUp:ae,onPointerCancel:T?oe:void 0,onPointerDownCapture:T?te:void 0,onClickCapture:T?I:void 0,onPointerLeave:m,ref:E,style:Ij,children:[h,(0,x.jsx)(Bj,{})]})}function Wj({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,PD.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Gj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=NA(),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)();return(0,v.useEffect)(()=>{if(!t)return u.current=Ik({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Wj({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,v.useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var Kj=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function qj(){let e=NA();return(0,v.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Kj(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=yO(t,i));let{position:a,positionAbsolute:s}=tO({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Jj=(0,v.createContext)(null),Yj=Jj.Provider;Jj.Consumer;var Xj=()=>(0,v.useContext)(Jj),Zj=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Qj=(0,v.createContext)(null);function $j({children:e}){let t=MA(Zj,OA);return(0,x.jsx)(Qj.Provider,{value:t,children:e})}function eM(){let e=(0,v.useContext)(Qj);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var tM={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},nM=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return tM;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===RD.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function rM({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=NA(),_=Xj(),{connectOnClick:v,noPanClassName:y,rfId:b}=eM(),{connectingFrom:S,connectingTo:C,clickConnecting:w,isPossibleEndHandle:T,connectionInProcess:E,clickConnectionInProcess:D,valid:O}=MA(nM(_,m,e),OA);_||g.getState().onError?.(`010`,PD.error010());let k=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(bj(i,e,{onError:n}))}n?.(i),s?.(i)},A=e=>{if(!_)return;let t=BO(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Kk.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:k,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,x.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Zx([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:w,connectingfrom:S,connectingto:C,valid:O,connectionindicator:r&&(!E||T)&&(E||D?a:i)}]),onMouseDown:A,onTouchStart:A,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=LO(t.target),h=n||c,{connection:v,isValid:y}=Kk.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&k(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var iM=(0,v.memo)(Cj(rM));function aM({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,x.jsxs)(x.Fragment,{children:[e?.label,(0,x.jsx)(iM,{type:`source`,position:n,isConnectable:t})]})}function oM({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(iM,{type:`target`,position:n,isConnectable:t}),e?.label,(0,x.jsx)(iM,{type:`source`,position:r,isConnectable:t})]})}function sM(){return null}function cM({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(iM,{type:`target`,position:n,isConnectable:t}),e?.label]})}var lM={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},uM={input:aM,default:oM,output:cM,group:sM};function dM(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var fM=e=>{let{width:t,height:n,x:r,y:i}=XD(e.nodeLookup,{filter:e=>!!e.selected});return{width:_O(t)?t:null,height:_O(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function pM({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=NA(),{width:i,height:a,transformString:o,userSelectionActive:s}=MA(fM,OA),c=qj(),l=(0,v.useRef)(null);(0,v.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Gj({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,x.jsx)(`div`,{className:Zx([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,x.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(lM,e.key)&&(e.preventDefault(),c({direction:lM[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var mM=typeof window<`u`?window:void 0,hM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function gM({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:T,autoPanOnSelection:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F,onViewportChange:ee,isControlledViewport:I}){let{nodesSelectionActive:te,userSelectionActive:ne}=MA(hM,OA),L=sj(l,{target:mM}),re=sj(h,{target:mM}),ie=re||T,ae=re||b,oe=u&&ie!==!0,se=L||ne||oe;return Pj({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,x.jsx)(Rj,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ae,panActivationKeyPressed:re,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:w,panOnDrag:!L&&ie,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:g,preventScrolling:j,noWheelClassName:N,noPanClassName:P,onViewportChange:ee,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:oe,children:(0,x.jsxs)(Uj,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,autoPanOnSelection:E,isSelecting:!!se,selectionMode:d,selectionKeyPressed:L,paneClickDistance:s,selectionOnDrag:oe,children:[e,te&&(0,x.jsx)(pM,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})]})})}gM.displayName=`FlowRenderer`;var _M=(0,v.memo)(gM),vM=e=>t=>e?ZD(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function yM(e){return MA((0,v.useCallback)(vM(e),[e]),OA)}var bM=e=>e.updateNodeInternals;function xM(){let e=MA(bM),[t]=(0,v.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,v.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function SM({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=NA(),a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(e.sourcePosition),c=(0,v.useRef)(e.targetPosition),l=(0,v.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,v.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,v.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,v.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function CM({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:S}=MA(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},OA),C=y.type||`default`,w=g?.[C]||uM[C];w===void 0&&(v?.(`003`,PD.error003(C)),C=`default`,w=g?.default||uM.default);let T=!!(y.draggable||s&&y.draggable===void 0),E=!!(y.selectable||c&&y.selectable===void 0),D=!!(y.connectable||l&&y.connectable===void 0),O=!!(y.focusable||u&&y.focusable===void 0),k=NA(),A=kO(y),j=SM({node:y,nodeType:C,hasDimensions:A,resizeObserver:d}),M=Gj({nodeRef:j,disabled:y.hidden||!T,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:E,nodeClickDistance:_}),N=qj();if(y.hidden)return null;let P=OO(y),F=dM(y),ee=E||T||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,te=r?e=>r(e,{...b.userNode}):void 0,ne=i?e=>i(e,{...b.userNode}):void 0,L=a?e=>a(e,{...b.userNode}):void 0,re=o?e=>o(e,{...b.userNode}):void 0,ie=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=k.getState();E&&(!r||!T||i>0)&&Wj({id:e,store:k,nodeRef:j}),t&&t(n,{...b.userNode})},ae=t=>{if(!(zO(t.nativeEvent)||m)){if(ID.includes(t.key)&&E){let n=t.key===`Escape`;Wj({id:e,store:k,unselect:n,nodeRef:j})}else if(T&&y.selected&&Object.prototype.hasOwnProperty.call(lM,t.key)){t.preventDefault();let{ariaLabelConfig:e}=k.getState();k.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),N({direction:lM[t.key],factor:t.shiftKey?4:1})}}},oe=()=>{if(m||!j.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=k.getState();i&&(ZD(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+P.width/2,y.position.y+P.height/2,{zoom:t[2]}))};return(0,x.jsx)(`div`,{className:Zx([`react-flow__node`,`react-flow__node-${C}`,{[p]:T},y.className,{selected:y.selected,selectable:E,parent:S,draggable:T,dragging:M}]),ref:j,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:A?`visible`:`hidden`,...y.style,...F},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:te,onMouseLeave:ne,onContextMenu:L,onClick:ie,onDoubleClick:re,onKeyDown:O?ae:void 0,tabIndex:O?0:void 0,onFocus:O?oe:void 0,role:y.ariaRole??(O?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${IA}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,x.jsx)(Yj,{value:e,children:(0,x.jsx)(w,{id:e,data:y.data,type:C,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:E,draggable:T,deletable:y.deletable??!0,isConnectable:D,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:M,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...P})})})}var wM=(0,v.memo)(CM),TM=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function EM(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=MA(TM,OA),a=yM(e.onlyRenderVisibleElements),o=xM();return(0,x.jsx)(`div`,{className:`react-flow__nodes`,style:Ij,children:a.map(a=>(0,x.jsx)(wM,{id:a,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:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}EM.displayName=`NodeRenderer`;var DM=(0,v.memo)(EM);function OM(e){return MA((0,v.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&YO({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),OA)}var kM=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,x.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},AM=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,x.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},jM={[UD.Arrow]:kM,[UD.ArrowClosed]:AM};function MM(e){let t=NA();return(0,v.useMemo)(()=>Object.prototype.hasOwnProperty.call(jM,e)?jM[e]:(t.getState().onError?.(`009`,PD.error009(e)),null),[e])}var NM=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=MM(t);return c?(0,x.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,x.jsx)(c,{color:n,strokeWidth:o})}):null},PM=({defaultColor:e,rfId:t})=>{let n=MA(e=>e.edges),r=MA(e=>e.defaultEdgeOptions),i=(0,v.useMemo)(()=>fk(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,x.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,x.jsx)(`defs`,{children:i.map(e=>(0,x.jsx)(NM,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};PM.displayName=`MarkerDefinitions`;var FM=(0,v.memo)(PM);function IM({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,v.useState)({x:1,y:0,width:0,height:0}),p=Zx([`react-flow__edge-textwrapper`,l]),m=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,x.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,x.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,x.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}IM.displayName=`EdgeText`;var LM=(0,v.memo)(IM);function RM({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`path`,{...u,d:e,fill:`none`,className:Zx([`react-flow__edge-path`,u.className])}),l?(0,x.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&_O(t)&&_O(n)?(0,x.jsx)(LM,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function zM({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function BM({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=zM({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=zM({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=UO({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function VM(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=BM({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),S=e.isInternal?void 0:t;return(0,x.jsx)(RM,{id:S,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var HM=VM({isInternal:!1}),UM=VM({isInternal:!0});HM.displayName=`SimpleBezierEdge`,UM.displayName=`SimpleBezierEdgeInternal`;function WM(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,S]=ak({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),C=e.isInternal?void 0:t;return(0,x.jsx)(RM,{id:C,path:y,labelX:b,labelY:S,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var GM=WM({isInternal:!1}),KM=WM({isInternal:!0});GM.displayName=`SmoothStepEdge`,KM.displayName=`SmoothStepEdgeInternal`;function qM(e){return(0,v.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,x.jsx)(GM,{...n,id:r,pathOptions:(0,v.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var JM=qM({isInternal:!1}),YM=qM({isInternal:!0});JM.displayName=`StepEdge`,YM.displayName=`StepEdgeInternal`;function XM(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=$O({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,x.jsx)(RM,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var ZM=XM({isInternal:!1}),QM=XM({isInternal:!0});ZM.displayName=`StraightEdge`,QM.displayName=`StraightEdgeInternal`;function $M(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,S]=KO({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),C=e.isInternal?void 0:t;return(0,x.jsx)(RM,{id:C,path:y,labelX:b,labelY:S,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var eN=$M({isInternal:!1}),tN=$M({isInternal:!0});eN.displayName=`BezierEdge`,tN.displayName=`BezierEdgeInternal`;var nN={default:tN,straight:QM,step:YM,smoothstep:KM,simplebezier:UM},rN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},iN=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,aN=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,oN=`react-flow__edgeupdater`;function sN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,x.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Zx([oN,`${oN}-${s}`]),cx:iN(t,r,e),cy:aN(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function cN({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=NA(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Kk.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,x.jsxs)(x.Fragment,{children:[(e===!0||e===`source`)&&(0,x.jsx)(sN,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,x.jsx)(sN,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function lN({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:y}){let b=MA(t=>t.edgeLookup.get(e)),S=MA(e=>e.defaultEdgeOptions);b=S?{...S,...b}:b;let C=b.type||`default`,w=h?.[C]||nN[C];w===void 0&&(_?.(`011`,PD.error011(C)),C=`default`,w=h?.default||nN.default);let T=!!(b.focusable||t&&b.focusable===void 0),E=d!==void 0&&(b.reconnectable||n&&b.reconnectable===void 0),D=!!(b.selectable||r&&b.selectable===void 0),O=(0,v.useRef)(null),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!1),N=NA(),{zIndex:P=b.zIndex,sourceX:F,sourceY:ee,targetX:I,targetY:te,sourcePosition:ne,targetPosition:L}=MA((0,v.useCallback)(t=>{let n=t.nodeLookup.get(b.source),r=t.nodeLookup.get(b.target);if(!n||!r)return rN;let i=sk({id:e,sourceNode:n,targetNode:r,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=JO({selected:b.selected,zIndex:b.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||rN,zIndex:a}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex,_]),OA),re=(0,v.useMemo)(()=>b.markerStart?`url('#${dk(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ie=(0,v.useMemo)(()=>b.markerEnd?`url('#${dk(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||F===null||ee===null||I===null||te===null)return null;let ae=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=N.getState();D&&(N.setState({nodesSelectionActive:!1}),b.selected&&a?(r({nodes:[],edges:[b]}),O.current?.blur()):n([e])),i&&i(t,b)},oe=a?e=>{a(e,{...b})}:void 0,se=o?e=>{o(e,{...b})}:void 0,ce=s?e=>{s(e,{...b})}:void 0,le=c?e=>{c(e,{...b})}:void 0,ue=l?e=>{l(e,{...b})}:void 0;return(0,x.jsx)(`svg`,{style:{zIndex:P},children:(0,x.jsxs)(`g`,{className:Zx([`react-flow__edge`,`react-flow__edge-${C}`,b.className,g,{selected:b.selected,animated:b.animated,inactive:!D&&!i,updating:k,selectable:D}]),onClick:ae,onDoubleClick:oe,onContextMenu:se,onMouseEnter:ce,onMouseMove:le,onMouseLeave:ue,onKeyDown:T?t=>{if(!y&&ID.includes(t.key)&&D){let{unselectNodesAndEdges:n,addSelectedEdges:r}=N.getState();t.key===`Escape`?(O.current?.blur(),n({edges:[b]})):r([e])}}:void 0,tabIndex:T?0:void 0,role:b.ariaRole??(T?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":T?`${LA}-${m}`:void 0,ref:O,...b.domAttributes,children:[!j&&(0,x.jsx)(w,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:D,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:F,sourceY:ee,targetX:I,targetY:te,sourcePosition:ne,targetPosition:L,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:re,markerEnd:ie,pathOptions:`pathOptions`in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),E&&(0,x.jsx)(cN,{edge:b,isReconnectable:E,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:F,sourceY:ee,targetX:I,targetY:te,sourcePosition:ne,targetPosition:L,setUpdateHover:A,setReconnecting:M})]})})}var uN=(0,v.memo)(lN),dN=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function fN({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=MA(dN,OA),b=OM(t);return(0,x.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,x.jsx)(FM,{defaultColor:e,rfId:n}),b.map(e=>(0,x.jsx)(uN,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}fN.displayName=`EdgeRenderer`;var pN=(0,v.memo)(fN),mN=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function hN({children:e}){let t=NA(),n=(0,v.useRef)(null),[r]=(0,v.useState)(()=>t.getState().transform);return wj(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=mN(r)))};return r(),t.subscribe(r)},[t]),(0,x.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:mN(r)},children:e})}function gN(e){let t=jj(),n=(0,v.useRef)(!1);(0,v.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var _N=e=>e.panZoom?.syncViewport;function vN(e){let t=MA(_N),n=NA();return(0,v.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function yN(e){return e.connection.inProgress?{...e.connection,to:bO(e.connection.to,e.transform)}:{...e.connection}}function bN(e){return e?t=>e(yN(t)):yN}function xN(e){return MA(bN(e),OA)}var SN=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function CN({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=MA(SN,OA);return a&&i&&c?(0,x.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,x.jsx)(`g`,{className:Zx([`react-flow__connection`,PO(s)]),children:(0,x.jsx)(wN,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var wN=({style:e,type:t=HD.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=xN();if(!i)return;if(n)return(0,x.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:PO(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case HD.Bezier:[m]=KO(h);break;case HD.SimpleBezier:[m]=BM(h);break;case HD.Step:[m]=ak({...h,borderRadius:0});break;case HD.SmoothStep:[m]=ak(h);break;default:[m]=$O(h)}return(0,x.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};wN.displayName=`ConnectionLine`;var TN={};function EN(e=TN){(0,v.useRef)(e),NA(),(0,v.useEffect)(()=>{},[e])}function DN(){NA(),(0,v.useRef)(!1),(0,v.useEffect)(()=>{},[])}function ON({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,deleteKeyCode:T,onlyRenderVisibleElements:E,elementsSelectable:D,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:F,panOnScroll:ee,panOnScrollSpeed:I,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:L,autoPanOnSelection:re,onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneScroll:ce,onPaneContextMenu:le,paneClickDistance:ue,nodeClickDistance:de,onEdgeContextMenu:fe,onEdgeMouseEnter:R,onEdgeMouseMove:z,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:we,onViewportChange:Te,nodesDraggable:Ee}){return EN(e),EN(t),DN(),gN(n),vN(we),(0,x.jsx)(_M,{onPaneClick:ie,onPaneMouseEnter:ae,onPaneMouseMove:oe,onPaneMouseLeave:se,onPaneContextMenu:le,onPaneScroll:ce,paneClickDistance:ue,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:w,elementsSelectable:D,zoomOnScroll:P,zoomOnPinch:F,zoomOnDoubleClick:ne,panOnScroll:ee,panOnScrollSpeed:I,panOnScrollMode:te,panOnDrag:L,autoPanOnSelection:re,defaultViewport:O,translateExtent:k,minZoom:A,maxZoom:j,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:Te,isControlledViewport:!!we,children:(0,x.jsxs)(hN,{children:[(0,x.jsx)(pN,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:E,onEdgeContextMenu:fe,onEdgeMouseEnter:R,onEdgeMouseMove:z,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:N,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,x.jsx)(CN,{style:h,type:m,component:g,containerStyle:_}),(0,x.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,x.jsx)(DM,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:de,onlyRenderVisibleElements:E,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Ee}),(0,x.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}ON.displayName=`GraphView`;var kN=(0,v.memo)(ON),AN=vO(`React Flow`,`https://reactflow.dev/`),jN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??FD;Ak(h,g,_);let{nodesInitialized:x}=xk(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=TO(XD(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:FD,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:RD.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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...VD},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:AN,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:LD,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},MN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>DA((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await eO({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...jN({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=xk(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();Ak(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=Dk(e,n,r,i,a,o,l);d&&(vk(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=lk(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Ek(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(pj(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(mj(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>hj(e,!0)));return}i(gj(r,new Set([...e]),!0)),a(gj(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>hj(e,!0)));return}a(gj(n,new Set([...e]))),i(gj(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(hj(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(hj(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,hj(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,hj(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(xk(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Ok({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...VD}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...jN()})}},Object.is);function NN({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,v.useState)(()=>MN({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,x.jsx)(AA,{value:m,children:(0,x.jsx)(Oj,{children:(0,x.jsx)($j,{children:p})})})}function PN({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,v.useContext)(kA)?(0,x.jsx)(x.Fragment,{children:e}):(0,x.jsx)(NN,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var FN={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function IN({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:w,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onSelectionChange:j,onSelectionDragStart:M,onSelectionDrag:N,onSelectionDragStop:P,onSelectionContextMenu:F,onSelectionStart:ee,onSelectionEnd:I,onBeforeDelete:te,connectionMode:ne,connectionLineType:L=HD.Bezier,connectionLineStyle:re,connectionLineComponent:ie,connectionLineContainerStyle:ae,deleteKeyCode:oe=`Backspace`,selectionKeyCode:se=`Shift`,selectionOnDrag:ce=!1,selectionMode:le=BD.Full,panActivationKeyCode:ue=`Space`,multiSelectionKeyCode:de=EO()?`Meta`:`Control`,zoomActivationKeyCode:fe=EO()?`Meta`:`Control`,snapToGrid:R,snapGrid:z,onlyRenderVisibleElements:pe=!1,selectNodesOnDrag:me,nodesDraggable:he,autoPanOnNodeFocus:ge,nodesConnectable:_e,nodesFocusable:ve,nodeOrigin:ye=QA,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Se=!0,defaultViewport:Ce=$A,minZoom:we=.5,maxZoom:Te=2,translateExtent:Ee=FD,preventScrolling:De=!0,nodeExtent:Oe,defaultMarkerColor:ke=`#b1b1b7`,zoomOnScroll:Ae=!0,zoomOnPinch:je=!0,panOnScroll:Me=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:Pe=zD.Free,zoomOnDoubleClick:Fe=!0,panOnDrag:Ie=!0,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue=1,nodeClickDistance:We=0,children:Ge,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:Xe,onEdgeMouseEnter:Ze,onEdgeMouseMove:Qe,onEdgeMouseLeave:$e,reconnectRadius:et=10,onNodesChange:tt,onEdgesChange:nt,noDragClassName:rt=`nodrag`,noWheelClassName:it=`nowheel`,noPanClassName:at=`nopan`,fitView:ot,fitViewOptions:st,connectOnClick:ct,attributionPosition:lt,proOptions:ut,defaultEdgeOptions:dt,elevateNodesOnSelect:ft=!0,elevateEdgesOnSelect:pt=!1,disableKeyboardA11y:mt=!1,autoPanOnConnect:ht,autoPanOnNodeDrag:gt,autoPanOnSelection:_t=!0,autoPanSpeed:vt,connectionRadius:yt,isValidConnection:bt,onError:xt,style:St,id:Ct,nodeDragThreshold:wt,connectionDragThreshold:Tt,viewport:Et,onViewportChange:Dt,width:Ot,height:kt,colorMode:At=`light`,debug:jt,onScroll:Mt,ariaLabelConfig:Nt,zIndexMode:Pt=`basic`,...Ft},It){let Lt=Ct||`1`,Rt=aj(At),zt=(0,v.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Mt?.(e)},[Mt]);return(0,x.jsx)(`div`,{"data-testid":`rf__wrapper`,...Ft,onScroll:zt,style:{...St,...FN},ref:It,className:Zx([`react-flow`,i,Rt]),id:Ct,role:`application`,children:(0,x.jsxs)(PN,{nodes:e,edges:t,width:Ot,height:kt,fitView:ot,fitViewOptions:st,minZoom:we,maxZoom:Te,nodeOrigin:ye,nodeExtent:Oe,zIndexMode:Pt,children:[(0,x.jsx)(rj,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:he,autoPanOnNodeFocus:ge,nodesConnectable:_e,nodesFocusable:ve,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Se,elevateNodesOnSelect:ft,elevateEdgesOnSelect:pt,minZoom:we,maxZoom:Te,nodeExtent:Oe,onNodesChange:tt,onEdgesChange:nt,snapToGrid:R,snapGrid:z,connectionMode:ne,translateExtent:Ee,connectOnClick:ct,defaultEdgeOptions:dt,fitView:ot,fitViewOptions:st,onNodesDelete:O,onEdgesDelete:k,onDelete:A,onNodeDragStart:T,onNodeDrag:E,onNodeDragStop:D,onSelectionDrag:N,onSelectionDragStart:M,onSelectionDragStop:P,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:at,nodeOrigin:ye,rfId:Lt,autoPanOnConnect:ht,autoPanOnNodeDrag:gt,autoPanSpeed:vt,onError:xt,connectionRadius:yt,isValidConnection:bt,selectNodesOnDrag:me,nodeDragThreshold:wt,connectionDragThreshold:Tt,onBeforeDelete:te,debug:jt,ariaLabelConfig:Nt,zIndexMode:Pt}),(0,x.jsx)(kN,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:w,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:re,connectionLineComponent:ie,connectionLineContainerStyle:ae,selectionKeyCode:se,selectionOnDrag:ce,selectionMode:le,deleteKeyCode:oe,multiSelectionKeyCode:de,panActivationKeyCode:ue,zoomActivationKeyCode:fe,onlyRenderVisibleElements:pe,defaultViewport:Ce,translateExtent:Ee,minZoom:we,maxZoom:Te,preventScrolling:De,zoomOnScroll:Ae,zoomOnPinch:je,zoomOnDoubleClick:Fe,panOnScroll:Me,panOnScrollSpeed:Ne,panOnScrollMode:Pe,panOnDrag:Ie,autoPanOnSelection:_t,onPaneClick:Le,onPaneMouseEnter:Re,onPaneMouseMove:ze,onPaneMouseLeave:Be,onPaneScroll:Ve,onPaneContextMenu:He,paneClickDistance:Ue,nodeClickDistance:We,onSelectionContextMenu:F,onSelectionStart:ee,onSelectionEnd:I,onReconnect:Ke,onReconnectStart:qe,onReconnectEnd:Je,onEdgeContextMenu:Ye,onEdgeDoubleClick:Xe,onEdgeMouseEnter:Ze,onEdgeMouseMove:Qe,onEdgeMouseLeave:$e,reconnectRadius:et,defaultMarkerColor:ke,noDragClassName:rt,noWheelClassName:it,noPanClassName:at,rfId:Lt,disableKeyboardA11y:mt,nodeExtent:Oe,viewport:Et,onViewportChange:Dt,nodesDraggable:he}),(0,x.jsx)(ZA,{onSelectionChange:j}),Ge,(0,x.jsx)(GA,{proOptions:ut,position:lt}),(0,x.jsx)(HA,{rfId:Lt,disableKeyboardA11y:mt})]})})}var LN=Cj(IN);PD.error014();function RN({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,x.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Zx([`react-flow__background-pattern`,n,r])})}function zN({radius:e,className:t}){return(0,x.jsx)(`circle`,{cx:e,cy:e,r:e,className:Zx([`react-flow__background-pattern`,`dots`,t])})}var BN;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(BN||={});var VN={[BN.Dots]:1,[BN.Lines]:1,[BN.Cross]:6},HN=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function UN({id:e,variant:t=BN.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,v.useRef)(null),{transform:f,patternId:p}=MA(HN,OA),m=r||VN[t],h=t===BN.Dots,g=t===BN.Cross,_=Array.isArray(n)?n:[n,n],y=[_[0]*f[2]||1,_[1]*f[2]||1],b=m*f[2],S=Array.isArray(a)?a:[a,a],C=g?[b,b]:y,w=[S[0]*f[2]+C[0]/2,S[1]*f[2]+C[1]/2],T=`${p}${e||``}`;return(0,x.jsxs)(`svg`,{className:Zx([`react-flow__background`,l]),style:{...c,...Ij,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,x.jsx)(`pattern`,{id:T,x:f[0]%y[0],y:f[1]%y[1],width:y[0],height:y[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${w[0]},-${w[1]})`,children:h?(0,x.jsx)(zN,{radius:b/2,className:u}):(0,x.jsx)(RN,{dimensions:C,lineWidth:i,variant:t,className:u})}),(0,x.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${T})`})]})}UN.displayName=`Background`;var WN=(0,v.memo)(UN);function GN(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,x.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function KN(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,x.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function qN(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,x.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 JN(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,x.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 YN(){return(0,x.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,x.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 XN({children:e,className:t,...n}){return(0,x.jsx)(`button`,{type:`button`,className:Zx([`react-flow__controls-button`,t]),...n,children:e})}var ZN=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function QN({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=NA(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=MA(ZN,OA),{zoomIn:y,zoomOut:b,fitView:S}=jj();return(0,x.jsxs)(UA,{className:Zx([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(XN,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,x.jsx)(GN,{})}),(0,x.jsx)(XN,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,x.jsx)(KN,{})})]}),n&&(0,x.jsx)(XN,{className:`react-flow__controls-fitview`,onClick:()=>{S(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,x.jsx)(qN,{})}),r&&(0,x.jsx)(XN,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,x.jsx)(YN,{}):(0,x.jsx)(JN,{})}),u]})}QN.displayName=`Controls`;var $N=(0,v.memo)(QN);function eP({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,x.jsx)(`rect`,{className:Zx([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var tP=(0,v.memo)(eP),nP=e=>e.nodes.map(e=>e.id),rP=e=>e instanceof Function?e:()=>e;function iP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=tP,onClick:o}){let s=MA(nP,OA),c=rP(t),l=rP(e),u=rP(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,x.jsx)(x.Fragment,{children:s.map(e=>(0,x.jsx)(oP,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function aP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=MA(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=OO(r);return{node:r,x:i,y:a,width:o,height:s}},OA);return!l||l.hidden||!kO(l)?null:(0,x.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var oP=(0,v.memo)(aP),sP=(0,v.memo)(iP),cP=200,lP=150,uP=e=>!e.hidden,dP=e=>{let 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]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?pO(XD(e.nodeLookup,{filter:uP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},fP=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,pP=(e,t)=>fP(e.viewBB,t.viewBB)&&fP(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,mP=`react-flow__minimap-desc`;function hP({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:y,zoomStep:b=1,offsetScale:S=5}){let C=NA(),w=(0,v.useRef)(null),{boundingRect:T,panZoom:E,viewBB:D,rfId:O,translateExtent:k,flowWidth:A,flowHeight:j,ariaLabelConfig:M}=MA(dP,pP),N=e?.width??cP,P=e?.height??lP,F=T.width/N,ee=T.height/P,I=Math.max(F,ee),te=I*N,ne=I*P,L=S*I,re=T.x-(te-T.width)/2-L,ie=T.y-(ne-T.height)/2-L,ae=te+L*2,oe=ne+L*2,se=`${mP}-${O}`,ce=(0,v.useRef)(0),le=(0,v.useRef)();ce.current=I,(0,v.useEffect)(()=>{let e=C.getState().panZoom;if(w.current&&e)return le.current=qk({domNode:w.current,panZoom:e,getTransform:()=>C.getState().transform,getViewScale:()=>ce.current}),()=>{le.current?.destroy()}},[E]),(0,v.useEffect)(()=>{le.current?.update({translateExtent:k,width:A,height:j,inversePan:y,pannable:h,zoomStep:b,zoomable:g})},[h,g,y,b,k,A,j]);let ue=p?e=>{let[t,n]=le.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,de=(0,v.useCallback)((e,t)=>{let n=C.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),fe=m?de:void 0,R=_??M[`minimap.ariaLabel`];return(0,x.jsx)(UA,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*I: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 o==`number`?o:void 0},className:Zx([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,x.jsxs)(`svg`,{width:N,height:P,viewBox:`${re} ${ie} ${ae} ${oe}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":se,ref:w,onClick:ue,children:[R&&(0,x.jsx)(`title`,{id:se,children:R}),(0,x.jsx)(sP,{onClick:fe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,x.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${re-L},${ie-L}h${ae+L*2}v${oe+L*2}h${-ae-L*2}z
|
|
44
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}hP.displayName=`MiniMap`,(0,v.memo)(hP);var gP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,_P={[cA.Line]:`right`,[cA.Handle]:`bottom-right`};function vP({nodeId:e,position:t,variant:n=cA.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let y=Xj(),b=typeof e==`string`?e:y,S=NA(),C=(0,v.useRef)(null),w=n===cA.Handle,T=MA((0,v.useCallback)(gP(w&&p),[w,p]),OA),E=(0,v.useRef)(null),D=t??_P[n];(0,v.useEffect)(()=>{if(C.current&&b)return E.current||=yA({domNode:C.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=S.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Ek([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...AO({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}}),E.current.update({controlPosition:D,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{E.current?.destroy()}},[D,s,c,l,u,d,h,g,_,m]);let O=D.split(`-`);return(0,x.jsx)(`div`,{className:Zx([`react-flow__resize-control`,`nodrag`,...O,n,r]),ref:C,style:{...i,scale:T,...o&&{[w?`backgroundColor`:`borderColor`]:o}},children:a})}(0,v.memo)(vP);var yP={affected:{tone:`var(--danger)`,label:`Affected`},reviewed:{tone:`var(--foreground-muted)`,label:`Reviewed · not affected`},unknown:{tone:`var(--warning)`,label:`Unknown`}};function bP({data:e}){let{node:t,selected:n,impact:r,dimmed:i}=e,a=ax(t.type),o=tx[t.dimension],s=r?yP[r]:null;return(0,x.jsxs)(`div`,{style:{width:190,minHeight:58,boxSizing:`border-box`,background:`var(--surface)`,border:`1px ${o.border} ${n?`var(--primary)`:s?s.tone:`var(--border)`}`,borderLeft:`4px solid ${a.tone}`,borderRadius:`var(--radius)`,boxShadow:n?`0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent)`:s?`0 0 0 2px color-mix(in srgb, ${s.tone} 45%, transparent)`:`none`,opacity:i?.4:1,padding:`8px 10px`,overflow:`hidden`},children:[(0,x.jsx)(iM,{type:`target`,position:$.Top,style:{background:`var(--border-strong)`,width:6,height:6}}),(0,x.jsx)(`div`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:a.label}),(0,x.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground)`,lineHeight:1.25,wordBreak:`break-word`},children:t.label}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,marginTop:3,flexWrap:`wrap`},children:[t.moduleId&&(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--foreground-muted)`},children:t.moduleId}),t.status&&(0,x.jsxs)(`span`,{style:{fontSize:10,color:`var(--foreground-muted)`},children:[`· `,t.status]})]}),s&&(0,x.jsx)(`div`,{style:{marginTop:4,fontSize:10,fontWeight:700,color:s.tone},children:s.label}),(0,x.jsx)(iM,{type:`source`,position:$.Bottom,style:{background:`var(--border-strong)`,width:6,height:6}})]})}function xP({data:e}){return(0,x.jsx)(`div`,{style:{width:`100%`,height:`100%`,boxSizing:`border-box`,border:`1px dashed ${e.available?`var(--border-strong)`:`var(--danger)`}`,borderRadius:`var(--radius)`,background:`color-mix(in srgb, var(--surface-muted) 50%, transparent)`},children:(0,x.jsxs)(`div`,{style:{position:`absolute`,top:4,left:8,display:`flex`,gap:8,alignItems:`center`},children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,color:`var(--foreground-muted)`},children:e.label}),!e.available&&(0,x.jsx)(`span`,{style:{fontSize:10,color:`var(--danger)`},children:`Unavailable`})]})})}function SP({label:e,children:t}){return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsx)(`div`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`,marginBottom:3},children:e}),(0,x.jsx)(`div`,{style:{fontSize:14,color:`var(--foreground)`},children:t})]})}function CP({children:e,onClick:t}){return(0,x.jsx)(`button`,{onClick:t,style:{display:`block`,background:`none`,border:`none`,padding:`2px 0`,cursor:`pointer`,color:`var(--primary)`,fontFamily:`inherit`,fontSize:14,textAlign:`left`},children:e})}function wP({projection:e,selectedNodeId:t,selectedEdgeId:n,onClose:r,onSelectNode:i}){let a=mi(),o=new Map(e.nodes.map(e=>[e.id,e])),s=t?o.get(t)??null:null,c=n?e.relationships.find(e=>e.id===n)??null:null;return(0,x.jsxs)(`aside`,{style:{width:320,flexShrink:0,borderLeft:`1px solid var(--border)`,background:`var(--surface)`,padding:20,overflowY:`auto`},children:[(0,x.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,x.jsx)(`button`,{onClick:r,"aria-label":`Close details`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:18,lineHeight:1},children:`×`})}),s&&(0,x.jsx)(TP,{node:s,projection:e,nodeById:o,onSelectNode:i,router:a}),!s&&c&&(0,x.jsx)(EP,{edge:c,nodeById:o}),!s&&!c&&(0,x.jsx)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`},children:`Select a node or relationship to see details.`})]})}function TP({node:e,projection:t,nodeById:n,onSelectNode:r,router:i}){let a=ax(e.type),o=[];for(let r of t.relationships)if(r.source===e.id){let e=n.get(r.target);e&&o.push({id:e.id,label:e.label,rel:`${r.label} →`,dimension:e.dimension})}else if(r.target===e.id){let e=n.get(r.source);e&&o.push({id:e.id,label:e.label,rel:`${r.label} from`,dimension:e.dimension})}let s=e=>o.filter(t=>t.dimension===e),c=s(`system`),l=s(`knowledge`),u=s(`delivery`),d=s(`implementation`);return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:17,fontWeight:700,margin:`0 0 12px`,wordBreak:`break-word`},children:e.label}),(0,x.jsx)(SP,{label:`Type`,children:a.label}),e.moduleId&&(0,x.jsx)(SP,{label:`Module / repository`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:e.moduleId})}),e.status&&(0,x.jsx)(SP,{label:`Status`,children:Ua(e.status)}),e.purpose&&(0,x.jsx)(SP,{label:`Purpose`,children:e.purpose}),c.length>0&&(0,x.jsx)(SP,{label:`Relationships`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:c.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),l.length>0&&(0,x.jsx)(SP,{label:`Knowledge context`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:l.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),u.length>0&&(0,x.jsx)(SP,{label:`Delivery history`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:u.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),d.length>0&&(0,x.jsx)(SP,{label:`Implementation`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:d.map((e,t)=>(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`},children:e.label},t))})}),(e.knowledgeRef||e.knowledgeRefs&&e.knowledgeRefs.length>0)&&(0,x.jsx)(SP,{label:`Knowledge`,children:(0,x.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[e.knowledgeRef&&(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/knowledge/$layer/$artifactId`,params:{layer:e.knowledgeRef.layer,artifactId:e.knowledgeRef.id}}),children:[Ua(e.knowledgeRef.layer),` / `,e.knowledgeRef.id,` →`]}),(e.knowledgeRefs??[]).map(e=>(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/knowledge/$layer/$artifactId`,params:{layer:e.layer,artifactId:e.id}}),children:[Ua(e.layer),` / `,e.id,` →`]},e.id))]})}),e.provenance&&(0,x.jsxs)(SP,{label:`Provenance`,children:[Ua(e.provenance),e.evidence&&e.evidence.length>0&&(0,x.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,color:`var(--foreground-muted)`,marginTop:4},children:e.evidence.map((e,t)=>(0,x.jsx)(`div`,{children:e},t))})]}),e.workItemRef&&(0,x.jsx)(SP,{label:`Related Work Item`,children:(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/work-items/$workItemId`,params:{workItemId:e.workItemRef}}),children:[e.workItemRef,` →`]})}),e.path&&(0,x.jsx)(SP,{label:`Path`,children:(0,x.jsx)(Ug,{path:e.path})})]})}function EP({edge:e,nodeById:t}){let n=t.get(e.source),r=t.get(e.target);return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:15,fontWeight:700,margin:`0 0 12px`},children:`Relationship`}),(0,x.jsx)(SP,{label:`From`,children:n?.label??e.source}),(0,x.jsx)(SP,{label:`To`,children:r?.label??e.target}),(0,x.jsx)(SP,{label:`Type`,children:e.label}),n?.moduleId&&(0,x.jsx)(SP,{label:`Source module`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:n.moduleId})}),r?.moduleId&&(0,x.jsx)(SP,{label:`Target module`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:r.moduleId})})]})}function DP({metadata:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=e.topologyStatus,f=d===`available`?(0,x.jsx)(vo,{variant:`success`,children:`Available`}):d===`partial`?(0,x.jsx)(vo,{variant:`warning`,children:`Partial`}):(0,x.jsx)(vo,{variant:`muted`,children:`Unavailable`}),p=async()=>{if(t)return t;u(!0),c(null);try{let e=await V.getTopologyHandoff();return n(e),e}catch(e){return c(e instanceof fo?e.message:`The handoff could not be generated.`),null}finally{u(!1)}},m=async()=>{let e=await p();if(e)try{await navigator.clipboard?.writeText(e.text),o(!0),setTimeout(()=>o(!1),2e3)}catch{i(!0)}},h=async()=>{r?i(!1):await p()&&i(!0)},g=d===`available`?`${e.semanticEntityCount} semantic components · ${e.technicalRelationshipCount} technical relationships.`:d===`partial`?`${e.semanticEntityCount} semantic components known — Kaddo knows useful topology, but the map is not assumed to be exhaustive.`:`Kaddo currently knows Knowledge and Delivery relationships, but does not yet have enough semantic system metadata to describe how the software is structured.`,_={padding:`5px 12px`,borderRadius:`var(--radius)`,fontSize:12,fontWeight:600,fontFamily:`inherit`,cursor:`pointer`};return(0,x.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid var(--border)`,background:d===`available`?`transparent`:`color-mix(in srgb, var(--warning) 8%, transparent)`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:11,fontWeight:700,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:`System topology`}),f,(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:g}),d!==`available`&&(0,x.jsxs)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8,alignItems:`center`},children:[(0,x.jsxs)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:[`Recommended: `,(0,x.jsx)(`span`,{className:`font-mono`,children:`architecture-agent`}),` · `,(0,x.jsx)(`span`,{className:`font-mono`,children:`graph-metadata-review`})]}),(0,x.jsx)(`button`,{onClick:m,disabled:l,style:{..._,border:`1px solid var(--primary)`,background:`var(--primary)`,color:`var(--primary-foreground)`,opacity:l?.6:1},children:l&&!t?`Preparing…`:a?`✓ Copied`:`Copy topology enrichment handoff`}),(0,x.jsx)(`button`,{onClick:h,disabled:l,style:{..._,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--foreground)`},children:r?`Hide handoff`:`View handoff`})]})]}),s&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,margin:`8px 0 0`},children:s}),r&&t&&(0,x.jsx)(`pre`,{style:{marginTop:10,background:`var(--surface-muted)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12,fontSize:11,lineHeight:1.5,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`var(--font-mono)`,color:`var(--foreground)`,maxHeight:240,overflowY:`auto`},children:t.text})]})}var OP={affected:{tone:`var(--danger)`,label:`Affected`},"reviewed-not-affected":{tone:`var(--foreground-muted)`,label:`Reviewed — not affected`},unknown:{tone:`var(--warning)`,label:`Unknown`}},kP=e=>OP[e]??{tone:`var(--foreground-muted)`,label:e};function AP(e,t,n,r){return(0,x.jsxs)(`button`,{onClick:t,title:`Focus in the graph`,style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`2px 8px`,borderRadius:`var(--radius)`,border:`1px solid ${e}`,background:`color-mix(in srgb, ${e} 12%, transparent)`,color:`var(--foreground)`,cursor:`pointer`,fontFamily:`inherit`,fontSize:12},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:e}}),n]},r)}function jP({workItemId:e,wi:t,topologyStatus:n,onClear:r,onSelectNode:i}){let a=t?.affectedSystemEntities??[],o=t?.reviewedSystemEntities??[],s=o.filter(e=>e.status!==`unknown`),c=o.filter(e=>e.status===`unknown`),l=fx(a,o),u=px(a,o),d=l.length>0,f=e=>e[0]&&i(e[0].nodeId),p=(e,t,n,r)=>(0,x.jsxs)(`button`,{onClick:()=>f(r),disabled:t===0,style:{display:`inline-flex`,gap:6,alignItems:`center`,padding:`3px 9px`,borderRadius:`var(--radius)`,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:t===0?`default`:`pointer`,opacity:t===0?.5:1,fontSize:12,fontFamily:`inherit`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:n}}),e,` `,(0,x.jsx)(`strong`,{children:t})]});return(0,x.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid var(--border)`,background:`var(--surface)`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,x.jsxs)(`span`,{style:{fontSize:13,fontWeight:700},children:[`Impact view · `,(0,x.jsx)(`span`,{className:`font-mono`,children:e})]}),(0,x.jsx)(`button`,{onClick:r,style:{padding:`5px 10px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground-muted)`,cursor:`pointer`,fontSize:12,fontFamily:`inherit`},children:`✕ Clear impact`})]}),t&&d&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[p(`Affected`,u.affected,`var(--danger)`,a),p(`Reviewed`,u.reviewedNotAffected,`var(--foreground-muted)`,s),p(`Unknown`,u.unknown,`var(--warning)`,c)]}),(0,x.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:l.map(e=>AP(kP(e.status).tone,()=>i(e.nodeId),e.label,`${e.status}:${e.nodeId}`))})]}),t&&!d&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`This Work Item has not been assessed against the system Graph. A missing assessment does not mean there is no impact.`}),t&&d&&(0,x.jsx)(`div`,{style:{display:`flex`,gap:14,flexWrap:`wrap`,fontSize:11,color:`var(--foreground-muted)`},children:[`affected`,`reviewed-not-affected`,`unknown`].map(e=>(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:5,alignItems:`center`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:kP(e).tone}}),kP(e).label]},e))}),n===`partial`&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--warning)`,margin:0},children:`⚠ Graph coverage is partial. The highlighted entities represent reviewed scope based on the currently known topology and repository evidence — entities without a highlight may still be impacted.`}),n===`unavailable`&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`No semantic topology is available, so impact cannot be projected onto the graph.`})]})}var MP={system:bP,systemGroup:xP};function NP(){return(0,x.jsxs)(`div`,{style:{padding:24},children:[(0,x.jsx)(`div`,{style:{height:`calc(100vh - 120px)`,background:`var(--surface-muted)`,borderRadius:`var(--radius)`,animation:`pulse 1.5s ease-in-out infinite`}}),(0,x.jsx)(`style`,{children:`@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}`})]})}var PP={padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`};function FP({projection:e}){let t=mi(),n=C(),r=qi({from:`/system`}),i=jj(),a=r.workItem??null,{data:o}=it({queryKey:[`work-item`,a],queryFn:()=>V.getWorkItem(a),enabled:a!=null,retry:!1}),s=(0,v.useMemo)(()=>{if(!a||!o)return;let e=new Map;for(let t of o.affectedSystemEntities)e.set(t.nodeId,`affected`);for(let t of o.reviewedSystemEntities)e.has(t.nodeId)||e.set(t.nodeId,t.status===`unknown`?`unknown`:`reviewed`);return e},[a,o]),[c,l]=(0,v.useState)(r.node??null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(`all`),[g,_]=(0,v.useState)(`all`),[y,b]=(0,v.useState)({system:!0,knowledge:!0,delivery:!0,implementation:!1,unknown:!0}),S=(0,v.useMemo)(()=>[...new Set(e.nodes.map(e=>e.type))].sort(),[e]),w=(0,v.useMemo)(()=>{let t=e.nodes.filter(e=>y[e.dimension]&&(m===`all`||e.moduleId===m)&&(g===`all`||e.type===g)),n=new Set(t.map(e=>e.id));return{...e,nodes:t,relationships:e.relationships.filter(e=>n.has(e.source)&&n.has(e.target))}},[e,m,g,y]),T=e=>b(t=>({...t,[e]:!t[e]})),E=(e,t)=>(0,x.jsxs)(`label`,{style:{display:`inline-flex`,gap:5,alignItems:`center`,fontSize:12,cursor:`pointer`,color:`var(--foreground-muted)`},children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:y[e],onChange:()=>T(e),"aria-label":`Toggle ${t}`}),t]}),D=(0,v.useMemo)(()=>sx(w),[w]),O=(0,v.useMemo)(()=>lx(w,D,c,s),[w,D,c,s]),k=(0,v.useMemo)(()=>ux(w,c),[w,c]),A=e=>{let t=D.positions.get(e);t&&i.setCenter(t.x+95,t.y+29,{zoom:1.2,duration:400})};(0,v.useEffect)(()=>{if(r.node&&D.positions.has(r.node)){l(r.node);let e=setTimeout(()=>A(r.node),100);return()=>clearTimeout(e)}},[]),(0,v.useEffect)(()=>{if(!s||s.size===0)return;let e=[...s.keys()].filter(e=>D.positions.has(e));if(e.length===0)return;let t=setTimeout(()=>i.fitView({nodes:e.map(e=>({id:e})),duration:500,padding:.3,maxZoom:1.4}),120);return()=>clearTimeout(t)},[s,D]);let j=e=>{l(e),d(null),t.navigate({to:`/system`,search:{node:e,workItem:a??void 0},replace:!0}),A(e)},M=f.trim()?dx(w.nodes,f).slice(0,8):[];return(0,x.jsxs)(`div`,{style:{display:`flex`,height:`calc(100vh - 56px)`},children:[(0,x.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,display:`flex`,flexDirection:`column`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:10,padding:`12px 16px`,borderBottom:`1px solid var(--border)`,alignItems:`center`,flexWrap:`wrap`,position:`relative`,zIndex:5,background:`var(--background)`},children:[(0,x.jsxs)(`div`,{style:{position:`relative`,flex:`1 1 220px`,minWidth:180},children:[(0,x.jsx)(`input`,{type:`search`,placeholder:`Search system…`,value:f,onChange:e=>p(e.target.value),"aria-label":`Search system`,style:{...PP,width:`100%`,boxSizing:`border-box`}}),M.length>0&&(0,x.jsx)(`ul`,{style:{position:`absolute`,top:`100%`,left:0,right:0,marginTop:4,listStyle:`none`,padding:4,background:`var(--surface)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,zIndex:10,maxHeight:260,overflowY:`auto`},children:M.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{onClick:()=>{j(e.id),p(``)},style:{display:`block`,width:`100%`,textAlign:`left`,padding:`6px 8px`,background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground)`,fontFamily:`inherit`,fontSize:13},children:[e.label,` `,(0,x.jsxs)(`span`,{style:{color:`var(--foreground-muted)`,fontSize:11},children:[`· `,ax(e.type).label,e.moduleId?` · ${e.moduleId}`:``]})]})},e.id))})]}),e.groups.length>0&&(0,x.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),"aria-label":`Filter by module`,style:PP,children:[(0,x.jsx)(`option`,{value:`all`,children:`All modules`}),e.groups.map(e=>(0,x.jsx)(`option`,{value:e.id,children:e.label},e.id))]}),(0,x.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),"aria-label":`Filter by type`,style:PP,children:[(0,x.jsx)(`option`,{value:`all`,children:`All types`}),S.map(e=>(0,x.jsx)(`option`,{value:e,children:ax(e).label},e))]}),(0,x.jsxs)(`div`,{style:{display:`inline-flex`,gap:12,alignItems:`center`,paddingLeft:4},children:[(0,x.jsx)(`span`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:`Show`}),E(`knowledge`,`Knowledge`),E(`delivery`,`Delivery`),E(`implementation`,`Implementation`)]}),(0,x.jsxs)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[w.nodes.length,` nodes · `,w.relationships.length,` relationships · coverage `,e.metadata.coverage]}),(0,x.jsx)(`button`,{onClick:()=>n.invalidateQueries({queryKey:[`system-map`]}),style:{...PP,cursor:`pointer`,color:`var(--foreground-muted)`},children:`↻ Refresh`})]}),(0,x.jsx)(DP,{metadata:e.metadata}),a&&(0,x.jsx)(jP,{workItemId:a,wi:o??null,topologyStatus:e.metadata.topologyStatus,onClear:()=>t.navigate({to:`/system`,search:{},replace:!0}),onSelectNode:j}),w.nodes.length===0?(0,x.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--foreground-muted)`,fontSize:14},children:`No nodes match these filters.`}):(0,x.jsx)(`div`,{style:{flex:1},children:(0,x.jsxs)(LN,{nodes:O,edges:k,nodeTypes:MP,onNodeClick:(e,t)=>{t.type===`system`&&j(t.id)},onEdgeClick:(e,t)=>{d(t.id),l(null)},onPaneClick:()=>{l(null),d(null)},fitView:!0,minZoom:.2,proOptions:{hideAttribution:!0},children:[(0,x.jsx)(WN,{color:`var(--border)`,gap:20}),(0,x.jsx)($N,{showInteractive:!1})]})})]}),(c||u)&&(0,x.jsx)(wP,{projection:e,selectedNodeId:c,selectedEdgeId:u,onClose:()=>{l(null),d(null)},onSelectNode:j})]})}function IP(){let e=C(),{data:t,isLoading:n,error:r}=it({queryKey:[`system-map`],queryFn:V.getSystemMap,refetchOnWindowFocus:!1});return n?(0,x.jsx)(NP,{}):r?(0,x.jsx)(`div`,{style:{padding:24},children:(0,x.jsxs)(`div`,{style:{background:`color-mix(in srgb, var(--danger) 10%, transparent)`,border:`1px solid var(--danger)`,borderRadius:`var(--radius)`,padding:16},children:[(0,x.jsx)(`strong`,{children:`System map could not be loaded`}),(0,x.jsx)(`p`,{style:{margin:`4px 0 8px`,fontSize:14,color:`var(--foreground-muted)`},children:`The project remains available, but Kaddo could not build the current System Map.`}),(0,x.jsx)(`button`,{onClick:()=>e.invalidateQueries({queryKey:[`system-map`]}),style:{...PP,cursor:`pointer`},children:`Retry`})]})}):!t||!t.metadata.available?(0,x.jsxs)(`div`,{style:{padding:`48px 32px`,textAlign:`center`,color:`var(--foreground-muted)`,maxWidth:640,margin:`0 auto`},children:[(0,x.jsx)(`div`,{style:{fontSize:32,marginBottom:12},children:`🗺️`}),(0,x.jsx)(`h2`,{style:{fontSize:18,fontWeight:600,color:`var(--foreground)`,margin:`0 0 8px`},children:`System map not available yet`}),(0,x.jsx)(`p`,{style:{fontSize:14},children:`Kaddo does not have enough system metadata to build a System Map for this project yet.`}),(0,x.jsx)(`p`,{style:{fontSize:13,marginTop:8},children:`Review the project Knowledge and graph metadata to enrich the map.`})]}):(0,x.jsx)(NN,{children:(0,x.jsx)(FP,{projection:t})})}var LP={available:`var(--success)`,configured:`var(--foreground-muted)`,unauthorized:`var(--danger)`,unavailable:`var(--warning)`,"invalid-config":`var(--danger)`,disabled:`var(--foreground-muted)`};function RP({status:e}){return(0,x.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:12,color:`var(--foreground)`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:LP[e]??`var(--foreground-muted)`}}),e]})}function zP({on:e,label:t}){return(0,x.jsxs)(`span`,{style:{fontSize:12,color:e?`var(--foreground)`:`var(--foreground-muted)`},children:[e?`✓`:`✗`,` `,t]})}var BP={padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:`pointer`,fontSize:13,fontFamily:`inherit`},VP={...BP,background:`var(--primary)`,color:`var(--primary-foreground, #fff)`,fontWeight:600},HP={...BP,color:`var(--danger)`,borderColor:`var(--danger)`},UP={padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`,width:`100%`,boxSizing:`border-box`},WP={fontSize:13,fontWeight:600,color:`var(--foreground)`,marginBottom:4,display:`block`},GP={border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:16,background:`var(--surface)`};function KP({name:e,schema:t,value:n,onChange:r}){return t.type===`select`&&t.options?(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:WP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsxs)(`select`,{value:String(n??t.defaultValue??``),onChange:e=>r(e.target.value),style:UP,children:[(0,x.jsx)(`option`,{value:``,children:`Choose…`}),t.options.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}):t.type===`boolean`?(0,x.jsxs)(`div`,{style:{marginBottom:12,display:`flex`,alignItems:`center`,gap:8},children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:!!(n??t.defaultValue),onChange:e=>r(e.target.checked),id:`field-${e}`}),(0,x.jsx)(`label`,{htmlFor:`field-${e}`,style:{fontSize:13,fontWeight:600},children:t.label}),t.description&&(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:t.description})]}):(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:WP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`input`,{type:t.type===`number`?`number`:`text`,value:String(n??``),placeholder:t.placeholder,onChange:e=>r(t.type===`number`?Number(e.target.value):e.target.value),style:UP})]})}function qP({schema:e,configured:t,onSave:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);return r?(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:WP,children:[e.label,e.required&&` *`]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,x.jsx)(`input`,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:`Enter value…`,style:{...UP,flex:1}}),(0,x.jsx)(`button`,{disabled:!a.trim(),onClick:()=>{n(a),i(!1),o(``)},style:VP,children:`Save`}),(0,x.jsx)(`button`,{onClick:()=>i(!1),style:BP,children:`Cancel`})]})]}):(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:WP,children:[e.label,e.required&&` *`]}),e.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:e.description}),(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,x.jsx)(`span`,{style:{fontSize:13,color:t?`var(--success)`:`var(--warning)`},children:t?`Configured`:`Not configured`}),(0,x.jsx)(`button`,{onClick:()=>{i(!0),o(``)},style:BP,children:t?`Replace`:`Set`})]})]})}function JP({onCreated:e,onCancel:t}){let n=C(),{data:r}=it({queryKey:[`integration-types`],queryFn:()=>V.getIntegrationTypes()}),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)({}),[u,d]=(0,v.useState)({}),f=at({mutationFn:()=>V.createIntegration({id:o.trim(),adapter:i.id,config:c}),onSuccess:async t=>{for(let[e,n]of Object.entries(u))n.trim()&&await V.setIntegrationSecret(t.id,e,n);n.invalidateQueries({queryKey:[`integrations`]}),e()}});if(!i)return(0,x.jsxs)(`div`,{style:{...GP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,x.jsx)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:`Add Integration`}),(0,x.jsx)(`button`,{onClick:t,style:{...BP,border:`none`,background:`none`,color:`var(--foreground-muted)`},children:`✕`})]}),(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`,margin:`0 0 12px`},children:`Choose a provider from the Integration Registry:`}),!r&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading…`}),(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:r?.map(e=>(0,x.jsxs)(`button`,{onClick:()=>{a(e),s(``)},style:{...GP,cursor:`pointer`,textAlign:`left`},children:[(0,x.jsx)(`div`,{style:{fontWeight:600,fontSize:14},children:e.displayName}),e.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginTop:2},children:e.description}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:6},children:[(0,x.jsx)(zP,{on:e.capabilities.workItems.read,label:`Read`}),(0,x.jsx)(zP,{on:e.capabilities.workItems.list,label:`List`}),(0,x.jsx)(zP,{on:e.capabilities.workItems.import,label:`Import`})]})]},e.id))})]});let p=i.configSchema,m=i.secretSchema,h=o.trim()&&/^[a-z0-9][a-z0-9._-]*$/i.test(o.trim());return(0,x.jsxs)(`div`,{style:{...GP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,x.jsxs)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:[i.displayName,` Integration`]}),(0,x.jsx)(`button`,{onClick:()=>a(null),style:{...BP,border:`none`,background:`none`,color:`var(--foreground-muted)`},children:`✕`})]}),(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsx)(`label`,{style:WP,children:`Integration ID *`}),(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:`A unique identifier (alphanumeric, dashes, dots).`}),(0,x.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`e.g. company-jira`,style:UP})]}),Object.keys(p).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Configuration`}),Object.entries(p).map(([e,t])=>(0,x.jsx)(KP,{name:e,schema:t,value:c[e],onChange:t=>l({...c,[e]:t})},e))]}),Object.keys(m).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Credentials`}),Object.entries(m).map(([e,t])=>(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:WP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`input`,{type:`password`,value:u[e]??``,onChange:t=>d({...u,[e]:t.target.value}),placeholder:`Enter value…`,style:UP})]},e))]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:16},children:[(0,x.jsx)(`button`,{disabled:!h||f.isPending,onClick:()=>f.mutate(),style:VP,children:f.isPending?`Creating…`:`Save Integration`}),(0,x.jsx)(`button`,{onClick:t,style:BP,children:`Cancel`})]}),f.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:8},children:f.error.message})]})}function YP({integration:e,onDone:t}){let n=C(),r=e.metadata?.configSchema??{},i=e.metadata?.secretSchema??{},{data:a}=it({queryKey:[`integration-detail`,e.id],queryFn:()=>V.getIntegrationDetail(e.id)}),{data:o,refetch:s}=it({queryKey:[`integration-secrets`,e.id],queryFn:()=>V.getIntegrationSecretStatus(e.id)}),[c,l]=(0,v.useState)(()=>({...a??e})),[u,d]=(0,v.useState)(!1),f=a?.config;(0,v.useState)(()=>{f&&!u&&l(f)});let p=at({mutationFn:()=>V.updateIntegration(e.id,{config:c}),onSuccess:()=>{n.invalidateQueries({queryKey:[`integrations`]}),n.invalidateQueries({queryKey:[`integration-detail`,e.id]}),d(!1)}}),m=at({mutationFn:({name:t,value:n})=>V.setIntegrationSecret(e.id,t,n),onSuccess:()=>{s(),n.invalidateQueries({queryKey:[`integrations`]})}});return(0,x.jsxs)(`div`,{style:{...GP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,x.jsxs)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:[`Configure: `,e.displayName]}),(0,x.jsx)(`button`,{onClick:t,style:{...BP,border:`none`,background:`none`,color:`var(--foreground-muted)`},children:`✕`})]}),Object.keys(r).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`0 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Configuration`}),Object.entries(r).map(([e,t])=>(0,x.jsx)(KP,{name:e,schema:t,value:c[e],onChange:t=>{l({...c,[e]:t}),d(!0)}},e)),(0,x.jsx)(`button`,{disabled:!u||p.isPending,onClick:()=>p.mutate(),style:VP,children:p.isPending?`Saving…`:`Save Configuration`}),p.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:4},children:p.error.message})]}),Object.keys(i).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Credentials`}),Object.entries(i).map(([e,t])=>(0,x.jsx)(qP,{name:e,schema:t,configured:o?.[e]??!1,onSave:t=>m.mutate({name:e,value:t})},e)),m.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:4},children:m.error.message})]})]})}function XP({integrationId:e,item:t,onClose:n}){let r=mi(),i=C(),[a,o]=(0,v.useState)(``),{data:s}=it({queryKey:[`capture-def`],queryFn:()=>V.getCaptureDefinition()}),{data:c,isLoading:l}=it({queryKey:[`import-preview`,e,t.externalId],queryFn:()=>V.getImportPreview(e,t.externalId),retry:!1}),u=at({mutationFn:()=>V.importExternalWorkItem(e,t.externalId,a),onSuccess:n=>{i.invalidateQueries({queryKey:[`import-preview`,e,t.externalId]}),r.navigate({to:`/work-items/$workItemId`,params:{workItemId:n.workItemId}})}});return(0,x.jsxs)(`div`,{style:{...GP,marginTop:10},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,x.jsx)(`h3`,{style:{fontSize:13,fontWeight:700,textTransform:`uppercase`,letterSpacing:.4,color:`var(--foreground-muted)`,margin:0},children:`Import work item`}),(0,x.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:13},children:`✕`})]}),l&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading preview…`}),c?.duplicate?(0,x.jsxs)(`div`,{style:{marginTop:8},children:[(0,x.jsxs)(`p`,{style:{fontSize:14},children:[`Already imported as `,(0,x.jsx)(`strong`,{className:`font-mono`,children:c.duplicate.workItemId}),` — "`,c.duplicate.title,`".`]}),(0,x.jsx)(`button`,{onClick:()=>r.navigate({to:`/work-items/$workItemId`,params:{workItemId:c.duplicate.workItemId}}),style:BP,children:`View Work Item`})]}):c?(0,x.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:10},children:[(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Source:`}),` `,c.preview.source.provider,` · `,c.preview.source.externalId]}),(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Captured intent:`}),` `,c.preview.capturedIntent]}),(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Will create:`}),` a Draft Work Item (needs refinement)`]}),c.preview.externalType&&(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[`External type "`,c.preview.externalType,`" — choose the Kaddo type explicitly (never inferred):`]}),(0,x.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),"aria-label":`Kaddo Work Item type`,style:{...UP,alignSelf:`flex-start`,width:`auto`},children:[(0,x.jsx)(`option`,{value:``,children:`Choose Kaddo Work Item type…`}),(s?.types??[]).map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`No project files have been modified yet.`}),(0,x.jsx)(`div`,{children:(0,x.jsx)(`button`,{disabled:!a||u.isPending,onClick:()=>u.mutate(),style:a?VP:BP,children:u.isPending?`Importing…`:`Import as Draft`})}),u.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`},children:u.error.message})]}):null]})}function ZP({integration:e,onEdit:t}){let n=C(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),l=e.status!==`disabled`&&e.status!==`invalid-config`&&e.capabilities?.workItems.list,u=it({queryKey:[`integration-status`,e.id],queryFn:()=>V.getIntegrationStatus(e.id),enabled:l,retry:!1}),d=it({queryKey:[`external-items`,e.id],queryFn:()=>V.getExternalWorkItems(e.id),enabled:r&&!!l,retry:!1}),f=at({mutationFn:()=>e.enabled?V.disableIntegration(e.id):V.enableIntegration(e.id),onSuccess:()=>n.invalidateQueries({queryKey:[`integrations`]})}),p=at({mutationFn:()=>V.deleteIntegration(e.id),onSuccess:()=>n.invalidateQueries({queryKey:[`integrations`]})}),m=at({mutationFn:()=>V.getIntegrationStatus(e.id),onSuccess:()=>{n.invalidateQueries({queryKey:[`integration-status`,e.id]}),n.invalidateQueries({queryKey:[`integrations`]})}});return(0,x.jsxs)(`div`,{style:{...GP,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:12,flexWrap:`wrap`},children:[(0,x.jsxs)(`div`,{style:{flex:1},children:[(0,x.jsxs)(`div`,{style:{fontSize:15,fontWeight:700},children:[e.displayName,` `,(0,x.jsxs)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`,fontWeight:400},children:[`· `,e.id]})]}),(0,x.jsxs)(`div`,{style:{marginTop:4,display:`flex`,gap:12,alignItems:`center`,flexWrap:`wrap`},children:[(0,x.jsx)(RP,{status:u.data?.status??e.status}),e.capabilities&&(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:10},children:[(0,x.jsx)(zP,{on:e.capabilities.workItems.read,label:`Read`}),(0,x.jsx)(zP,{on:e.capabilities.workItems.list,label:`List`}),(0,x.jsx)(zP,{on:e.capabilities.workItems.import,label:`Import`})]})]})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:[(0,x.jsx)(`button`,{onClick:t,style:BP,children:`Configure`}),(0,x.jsx)(`button`,{onClick:()=>m.mutate(),disabled:m.isPending,style:BP,children:m.isPending?`Verifying…`:`Verify`}),(0,x.jsx)(`button`,{onClick:()=>f.mutate(),disabled:f.isPending,style:BP,children:f.isPending?`…`:e.enabled?`Disable`:`Enable`}),l&&(0,x.jsx)(`button`,{onClick:()=>i(e=>!e),style:BP,children:r?`Hide items`:`Browse`}),s?(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:4,alignItems:`center`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--danger)`},children:`Delete?`}),(0,x.jsx)(`button`,{onClick:()=>p.mutate(),style:HP,children:`Yes`}),(0,x.jsx)(`button`,{onClick:()=>c(!1),style:BP,children:`No`})]}):(0,x.jsx)(`button`,{onClick:()=>c(!0),style:HP,children:`Delete`})]})]}),m.data&&(0,x.jsxs)(`div`,{style:{marginTop:8,fontSize:13,padding:`6px 10px`,borderRadius:`var(--radius)`,background:m.data.status===`available`?`var(--success-bg, rgba(0,180,0,0.08))`:`var(--danger-bg, rgba(200,0,0,0.08))`},children:[`Connection: `,(0,x.jsx)(`strong`,{children:m.data.status}),m.data.message?` — ${m.data.message}`:``]}),e.findings.map((e,t)=>(0,x.jsxs)(`p`,{style:{fontSize:12,color:e.level===`blocking`?`var(--danger)`:`var(--warning)`,margin:`6px 0 0`},children:[`[`,e.level,`] `,e.message]},t)),p.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,margin:`6px 0 0`},children:p.error.message}),r&&l&&(0,x.jsxs)(`div`,{style:{marginTop:12},children:[d.isLoading&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading…`}),d.isError&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--danger)`},children:d.error.message}),(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:d.data?.items.map(t=>(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`},children:t.externalId}),` `,(0,x.jsx)(`span`,{style:{fontSize:14},children:t.title}),t.status&&(0,x.jsxs)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[` · `,t.status]})]}),e.capabilities?.workItems.import&&(0,x.jsx)(`button`,{onClick:()=>o(t),style:BP,children:`Import`})]},t.externalId))}),a&&(0,x.jsx)(XP,{integrationId:e.id,item:a,onClose:()=>o(null)})]})]})}function QP(){let e=C(),{data:t,isLoading:n,error:r}=it({queryKey:[`integrations`],queryFn:()=>V.getIntegrations(),retry:!1}),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),c=t?.find(e=>e.id===o);return(0,x.jsxs)(`div`,{style:{padding:`24px 32px`,maxWidth:900,margin:`0 auto`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,marginBottom:20},children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:22,fontWeight:700,margin:`0 0 4px`},children:`Integrations`}),(0,x.jsxs)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`,margin:0},children:[`Connect Kaddo to external work systems. Configuration lives in `,(0,x.jsx)(`span`,{className:`font-mono`,children:`.kaddo/integrations.yml`}),` — Admin and CLI share the same source of truth.`]})]}),!i&&(0,x.jsx)(`button`,{onClick:()=>{a(!0),s(null)},style:VP,children:`+ Add Integration`})]}),i&&(0,x.jsx)(JP,{onCreated:()=>{a(!1),e.invalidateQueries({queryKey:[`integrations`]})},onCancel:()=>a(!1)}),o&&c&&(0,x.jsx)(YP,{integration:c,onDone:()=>s(null)}),n&&(0,x.jsx)(`p`,{style:{color:`var(--foreground-muted)`},children:`Loading…`}),r&&(0,x.jsx)(`p`,{style:{color:`var(--danger)`},children:r.message}),t&&t.length===0&&!i&&(0,x.jsxs)(`div`,{style:{padding:32,textAlign:`center`,color:`var(--foreground-muted)`,border:`1px dashed var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsx)(`div`,{style:{fontSize:28,marginBottom:8},children:`🔌`}),(0,x.jsxs)(`p`,{style:{fontSize:14,margin:0},children:[`No integrations are configured. Click `,(0,x.jsx)(`strong`,{children:`+ Add Integration`}),` to get started.`]})]}),t?.map(e=>(0,x.jsx)(ZP,{integration:e,onEdit:()=>{s(e.id),a(!1)}},e.id))]})}var $P={padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:`pointer`,fontSize:13,fontFamily:`inherit`},eF={...$P,background:`var(--primary)`,color:`var(--primary-foreground, #fff)`,fontWeight:600},tF={padding:`6px 10px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`},nF={border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:16,background:`var(--surface)`},rF={display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 8px`,borderRadius:12,fontSize:11,fontWeight:500,background:`var(--surface-muted)`,color:`var(--foreground-muted)`};function iF({type:e}){if(!e)return null;let t={Feature:`var(--primary)`,Bug:`var(--danger)`,Task:`var(--foreground-muted)`,Epic:`var(--warning)`};return(0,x.jsx)(`span`,{style:{...rF,borderLeft:`3px solid ${t[e]??`var(--foreground-muted)`}`},children:e})}function aF({status:e}){if(!e)return null;let t={Open:`var(--primary)`,"To Do":`var(--foreground-muted)`,"In Progress":`var(--warning)`,Done:`var(--success)`};return(0,x.jsxs)(`span`,{style:{...rF},children:[(0,x.jsx)(`span`,{style:{width:6,height:6,borderRadius:6,background:t[e]??`var(--foreground-muted)`}}),e]})}function oF({filters:e,onChange:t,onRefresh:n,loading:r}){let[i,a]=(0,v.useState)(e.search??``);return(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`,marginBottom:16},children:[(0,x.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t({...e,search:i.trim()||void 0})},placeholder:`Search items…`,style:{...tF,width:260}}),(0,x.jsx)(`button`,{onClick:()=>t({...e,search:i.trim()||void 0}),style:$P,children:`Search`}),(0,x.jsx)(`button`,{onClick:n,disabled:r,style:$P,children:r?`Refreshing…`:`Refresh`}),(e.statuses?.length||e.types?.length||e.labels?.length||e.search)&&(0,x.jsx)(`button`,{onClick:()=>{a(``),t({})},style:{...$P,color:`var(--foreground-muted)`,fontSize:12},children:`Clear filters`})]})}function sF({integrationId:e,item:t,onClose:n}){let r=mi(),i=C(),[a,o]=(0,v.useState)(``),{data:s}=it({queryKey:[`capture-def`],queryFn:()=>V.getCaptureDefinition()}),{data:c,isLoading:l}=it({queryKey:[`import-preview`,e,t.externalId],queryFn:()=>V.getImportPreview(e,t.externalId),retry:!1}),u=at({mutationFn:()=>V.importExternalWorkItem(e,t.externalId,a),onSuccess:e=>{i.invalidateQueries({queryKey:[`discover`]}),r.navigate({to:`/work-items/$workItemId`,params:{workItemId:e.workItemId}})}});return(0,x.jsxs)(`div`,{style:{...nF,marginTop:10,marginLeft:16,borderLeft:`3px solid var(--primary)`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,x.jsxs)(`h4`,{style:{fontSize:13,fontWeight:700,margin:0},children:[`Import: `,t.title]}),(0,x.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:13},children:`✕`})]}),l&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading preview…`}),c?.duplicate?(0,x.jsxs)(`div`,{style:{marginTop:8},children:[(0,x.jsxs)(`p`,{style:{fontSize:13},children:[`Already imported as `,(0,x.jsx)(`strong`,{className:`font-mono`,children:c.duplicate.workItemId}),`.`]}),(0,x.jsx)(`button`,{onClick:()=>r.navigate({to:`/work-items/$workItemId`,params:{workItemId:c.duplicate.workItemId}}),style:$P,children:`View Work Item`})]}):c?(0,x.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:8},children:[(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[`Source: `,c.preview.source.provider,` · `,c.preview.source.externalId]}),(0,x.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),style:{...tF,width:`auto`,alignSelf:`flex-start`},children:[(0,x.jsx)(`option`,{value:``,children:`Choose Kaddo Work Item type…`}),(s?.types??[]).map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,x.jsx)(`p`,{style:{fontSize:11,color:`var(--foreground-muted)`,margin:0},children:`No project files have been modified yet.`}),(0,x.jsx)(`div`,{children:(0,x.jsx)(`button`,{disabled:!a||u.isPending,onClick:()=>u.mutate(),style:a?eF:$P,children:u.isPending?`Importing…`:`Import as Draft`})}),u.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`},children:u.error.message})]}):null]})}function cF({item:e,integrationId:t,integrationName:n,icon:r}){let[i,a]=(0,v.useState)(!1);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,padding:`10px 14px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`},children:[(0,x.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4},children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,color:`var(--foreground-muted)`,flexShrink:0},children:e.externalId}),(0,x.jsx)(`span`,{style:{fontSize:14,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,flexWrap:`wrap`},children:[(0,x.jsx)(iF,{type:e.type}),(0,x.jsx)(aF,{status:e.status}),e.labels?.map(e=>(0,x.jsx)(`span`,{style:{...rF,fontSize:10},children:e},e)),(0,x.jsxs)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:[r?`${r} `:``,n]}),e.assignees?.length?(0,x.jsx)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:e.assignees.map(e=>e.name).join(`, `)}):null]})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:[e.url&&(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,style:{...$P,textDecoration:`none`,fontSize:12},children:`Open`}),(0,x.jsx)(`button`,{onClick:()=>a(!i),style:$P,children:i?`Cancel`:`Import`})]})]}),i&&(0,x.jsx)(sF,{integrationId:t,item:e,onClose:()=>a(!1)})]})}function lF({result:e}){return e.error?(0,x.jsxs)(`div`,{style:{...nF,borderLeft:`3px solid var(--danger)`,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{fontWeight:600,fontSize:14},children:[e.displayName,` `,(0,x.jsx)(`span`,{style:{fontWeight:400,fontSize:12,color:`var(--danger)`},children:`Error`})]}),(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--danger)`,margin:`4px 0 0`},children:e.error})]}):(0,x.jsxs)(`div`,{style:{marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,x.jsx)(`span`,{style:{fontSize:14,fontWeight:600},children:e.displayName}),(0,x.jsxs)(`span`,{style:{...rF},children:[e.items.length,` item`,e.items.length===1?``:`s`,e.hasMore?`+`:``]})]}),(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.items.map(t=>(0,x.jsx)(cF,{item:t,integrationId:e.integrationId,integrationName:e.displayName,icon:e.icon},`${e.integrationId}-${t.externalId}`))})]})}function uF(){let[e,t]=(0,v.useState)({}),{data:n,isLoading:r,error:i,refetch:a}=it({queryKey:[`discover`,e],queryFn:()=>V.discoverExternalWorkItems({filters:e,pageSize:50}),retry:!1}),o=(0,v.useMemo)(()=>n?n.results.flatMap(e=>e.items.map(t=>({...t,_integrationId:e.integrationId,_integrationName:e.displayName,_icon:e.icon}))):[],[n]),s=(0,v.useMemo)(()=>[...new Set(o.map(e=>e.type).filter(Boolean))].sort(),[o]),c=(0,v.useMemo)(()=>[...new Set(o.map(e=>e.status).filter(Boolean))].sort(),[o]);return(0,x.jsxs)(`div`,{style:{padding:`24px 32px`,maxWidth:1e3,margin:`0 auto`},children:[(0,x.jsxs)(`div`,{style:{marginBottom:20},children:[(0,x.jsx)(`h2`,{style:{fontSize:22,fontWeight:700,margin:`0 0 4px`},children:`External Work Items`}),(0,x.jsx)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`,margin:0},children:`Discover items from all enabled integrations. Read-only — import creates a Draft Work Item through human confirmation.`})]}),(0,x.jsx)(oF,{filters:e,onChange:t,onRefresh:()=>a(),loading:r}),s.length>0&&(0,x.jsxs)(`div`,{style:{display:`flex`,gap:4,marginBottom:8,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`,lineHeight:`24px`},children:`Types:`}),s.map(n=>(0,x.jsx)(`button`,{onClick:()=>{let r=e.types??[];t({...e,types:r.includes(n)?r.filter(e=>e!==n):[...r,n]})},style:{...rF,cursor:`pointer`,border:`1px solid var(--border)`,background:e.types?.includes(n)?`var(--primary)`:`var(--surface)`,color:e.types?.includes(n)?`var(--primary-foreground, #fff)`:`var(--foreground-muted)`},children:n},n))]}),c.length>0&&(0,x.jsxs)(`div`,{style:{display:`flex`,gap:4,marginBottom:12,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`,lineHeight:`24px`},children:`Statuses:`}),c.map(n=>(0,x.jsx)(`button`,{onClick:()=>{let r=e.statuses??[];t({...e,statuses:r.includes(n)?r.filter(e=>e!==n):[...r,n]})},style:{...rF,cursor:`pointer`,border:`1px solid var(--border)`,background:e.statuses?.includes(n)?`var(--primary)`:`var(--surface)`,color:e.statuses?.includes(n)?`var(--primary-foreground, #fff)`:`var(--foreground-muted)`},children:n},n))]}),r&&(0,x.jsx)(`p`,{style:{color:`var(--foreground-muted)`},children:`Discovering work items across integrations…`}),i&&(0,x.jsx)(`p`,{style:{color:`var(--danger)`},children:i.message}),n&&n.totalItems===0&&n.results.every(e=>!e.error)&&(0,x.jsxs)(`div`,{style:{padding:32,textAlign:`center`,color:`var(--foreground-muted)`,border:`1px dashed var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsx)(`div`,{style:{fontSize:28,marginBottom:8},children:`🔍`}),(0,x.jsx)(`p`,{style:{fontSize:14,margin:0},children:`No external work items found. Check that integrations are configured and enabled.`})]}),n&&(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:12},children:[n.totalItems,` item`,n.totalItems===1?``:`s`,` from `,n.results.length,` integration`,n.results.length===1?``:`s`]}),n?.results.map(e=>(0,x.jsx)(lF,{result:e},e.integrationId))]})}var dF=new Ge({defaultOptions:{queries:{staleTime:3e4,retry:1}}}),fF=ga({component:go}),pF=ma({getParentRoute:()=>fF,path:`/`,component:()=>(0,x.jsx)(Yi,{to:`/overview`})}),mF=ma({getParentRoute:()=>fF,path:`/overview`,component:Io}),hF=ma({getParentRoute:()=>fF,path:`/knowledge`,component:Ro}),gF=ma({getParentRoute:()=>fF,path:`/knowledge/$layer`,component:Ho}),_F=ma({getParentRoute:()=>fF,path:`/knowledge/$layer/$artifactId`,component:Gg}),vF=ma({getParentRoute:()=>fF,path:`/work-items`,component:n_}),yF=ma({getParentRoute:()=>fF,path:`/work-items/new`,component:Ax}),bF=ma({getParentRoute:()=>fF,path:`/work-items/$workItemId`,component:Sx}),xF=ma({getParentRoute:()=>fF,path:`/work-items/$workItemId/edit`,component:Xx}),SF=ma({getParentRoute:()=>fF,path:`/system`,component:IP,validateSearch:e=>({node:typeof e.node==`string`?e.node:void 0,workItem:typeof e.workItem==`string`?e.workItem:void 0})}),CF=ma({getParentRoute:()=>fF,path:`/integrations`,component:QP}),wF=ma({getParentRoute:()=>fF,path:`/external-items`,component:uF}),TF=Na({routeTree:fF.addChildren([pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF])});function EF(){return(0,x.jsx)(w,{client:dF,children:(0,x.jsx)(Ia,{router:TF})})}V.initSession().catch(()=>{}),(0,y.createRoot)(document.getElementById(`root`)).render((0,x.jsx)(v.StrictMode,{children:(0,x.jsx)(EF,{})}));
|
|
44
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}hP.displayName=`MiniMap`,(0,v.memo)(hP);var gP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,_P={[cA.Line]:`right`,[cA.Handle]:`bottom-right`};function vP({nodeId:e,position:t,variant:n=cA.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let y=Xj(),b=typeof e==`string`?e:y,S=NA(),C=(0,v.useRef)(null),w=n===cA.Handle,T=MA((0,v.useCallback)(gP(w&&p),[w,p]),OA),E=(0,v.useRef)(null),D=t??_P[n];(0,v.useEffect)(()=>{if(C.current&&b)return E.current||=yA({domNode:C.current,nodeId:b,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=S.getState(),o=[],s={x:e.x,y:e.y},c=r.get(b);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Ek([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...AO({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:b,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:b,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:b,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}}),E.current.update({controlPosition:D,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{E.current?.destroy()}},[D,s,c,l,u,d,h,g,_,m]);let O=D.split(`-`);return(0,x.jsx)(`div`,{className:Zx([`react-flow__resize-control`,`nodrag`,...O,n,r]),ref:C,style:{...i,scale:T,...o&&{[w?`backgroundColor`:`borderColor`]:o}},children:a})}(0,v.memo)(vP);var yP={affected:{tone:`var(--danger)`,label:`Affected`},reviewed:{tone:`var(--foreground-muted)`,label:`Reviewed · not affected`},unknown:{tone:`var(--warning)`,label:`Unknown`}};function bP({data:e}){let{node:t,selected:n,impact:r,dimmed:i}=e,a=ax(t.type),o=tx[t.dimension],s=r?yP[r]:null;return(0,x.jsxs)(`div`,{style:{width:190,minHeight:58,boxSizing:`border-box`,background:`var(--surface)`,border:`1px ${o.border} ${n?`var(--primary)`:s?s.tone:`var(--border)`}`,borderLeft:`4px solid ${a.tone}`,borderRadius:`var(--radius)`,boxShadow:n?`0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent)`:s?`0 0 0 2px color-mix(in srgb, ${s.tone} 45%, transparent)`:`none`,opacity:i?.4:1,padding:`8px 10px`,overflow:`hidden`},children:[(0,x.jsx)(iM,{type:`target`,position:$.Top,style:{background:`var(--border-strong)`,width:6,height:6}}),(0,x.jsx)(`div`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:a.label}),(0,x.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground)`,lineHeight:1.25,wordBreak:`break-word`},children:t.label}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,marginTop:3,flexWrap:`wrap`},children:[t.moduleId&&(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:10,color:`var(--foreground-muted)`},children:t.moduleId}),t.status&&(0,x.jsxs)(`span`,{style:{fontSize:10,color:`var(--foreground-muted)`},children:[`· `,t.status]})]}),s&&(0,x.jsx)(`div`,{style:{marginTop:4,fontSize:10,fontWeight:700,color:s.tone},children:s.label}),(0,x.jsx)(iM,{type:`source`,position:$.Bottom,style:{background:`var(--border-strong)`,width:6,height:6}})]})}function xP({data:e}){return(0,x.jsx)(`div`,{style:{width:`100%`,height:`100%`,boxSizing:`border-box`,border:`1px dashed ${e.available?`var(--border-strong)`:`var(--danger)`}`,borderRadius:`var(--radius)`,background:`color-mix(in srgb, var(--surface-muted) 50%, transparent)`},children:(0,x.jsxs)(`div`,{style:{position:`absolute`,top:4,left:8,display:`flex`,gap:8,alignItems:`center`},children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,fontWeight:700,color:`var(--foreground-muted)`},children:e.label}),!e.available&&(0,x.jsx)(`span`,{style:{fontSize:10,color:`var(--danger)`},children:`Unavailable`})]})})}function SP({label:e,children:t}){return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsx)(`div`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`,marginBottom:3},children:e}),(0,x.jsx)(`div`,{style:{fontSize:14,color:`var(--foreground)`},children:t})]})}function CP({children:e,onClick:t}){return(0,x.jsx)(`button`,{onClick:t,style:{display:`block`,background:`none`,border:`none`,padding:`2px 0`,cursor:`pointer`,color:`var(--primary)`,fontFamily:`inherit`,fontSize:14,textAlign:`left`},children:e})}function wP({projection:e,selectedNodeId:t,selectedEdgeId:n,onClose:r,onSelectNode:i}){let a=mi(),o=new Map(e.nodes.map(e=>[e.id,e])),s=t?o.get(t)??null:null,c=n?e.relationships.find(e=>e.id===n)??null:null;return(0,x.jsxs)(`aside`,{style:{width:320,flexShrink:0,borderLeft:`1px solid var(--border)`,background:`var(--surface)`,padding:20,overflowY:`auto`},children:[(0,x.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,x.jsx)(`button`,{onClick:r,"aria-label":`Close details`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:18,lineHeight:1},children:`×`})}),s&&(0,x.jsx)(TP,{node:s,projection:e,nodeById:o,onSelectNode:i,router:a}),!s&&c&&(0,x.jsx)(EP,{edge:c,nodeById:o}),!s&&!c&&(0,x.jsx)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`},children:`Select a node or relationship to see details.`})]})}function TP({node:e,projection:t,nodeById:n,onSelectNode:r,router:i}){let a=ax(e.type),o=[];for(let r of t.relationships)if(r.source===e.id){let e=n.get(r.target);e&&o.push({id:e.id,label:e.label,rel:`${r.label} →`,dimension:e.dimension})}else if(r.target===e.id){let e=n.get(r.source);e&&o.push({id:e.id,label:e.label,rel:`${r.label} from`,dimension:e.dimension})}let s=e=>o.filter(t=>t.dimension===e),c=s(`system`),l=s(`knowledge`),u=s(`delivery`),d=s(`implementation`);return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:17,fontWeight:700,margin:`0 0 12px`,wordBreak:`break-word`},children:e.label}),(0,x.jsx)(SP,{label:`Type`,children:a.label}),e.moduleId&&(0,x.jsx)(SP,{label:`Module / repository`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:e.moduleId})}),e.status&&(0,x.jsx)(SP,{label:`Status`,children:Ua(e.status)}),e.purpose&&(0,x.jsx)(SP,{label:`Purpose`,children:e.purpose}),c.length>0&&(0,x.jsx)(SP,{label:`Relationships`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:c.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),l.length>0&&(0,x.jsx)(SP,{label:`Knowledge context`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:l.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),u.length>0&&(0,x.jsx)(SP,{label:`Delivery history`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:u.map((e,t)=>(0,x.jsxs)(CP,{onClick:()=>r(e.id),children:[e.rel,` `,e.label]},t))})}),d.length>0&&(0,x.jsx)(SP,{label:`Implementation`,children:(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:d.map((e,t)=>(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`},children:e.label},t))})}),(e.knowledgeRef||e.knowledgeRefs&&e.knowledgeRefs.length>0)&&(0,x.jsx)(SP,{label:`Knowledge`,children:(0,x.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[e.knowledgeRef&&(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/knowledge/$layer/$artifactId`,params:{layer:e.knowledgeRef.layer,artifactId:e.knowledgeRef.id}}),children:[Ua(e.knowledgeRef.layer),` / `,e.knowledgeRef.id,` →`]}),(e.knowledgeRefs??[]).map(e=>(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/knowledge/$layer/$artifactId`,params:{layer:e.layer,artifactId:e.id}}),children:[Ua(e.layer),` / `,e.id,` →`]},e.id))]})}),e.provenance&&(0,x.jsxs)(SP,{label:`Provenance`,children:[Ua(e.provenance),e.evidence&&e.evidence.length>0&&(0,x.jsx)(`div`,{className:`font-mono`,style:{fontSize:11,color:`var(--foreground-muted)`,marginTop:4},children:e.evidence.map((e,t)=>(0,x.jsx)(`div`,{children:e},t))})]}),e.workItemRef&&(0,x.jsx)(SP,{label:`Related Work Item`,children:(0,x.jsxs)(CP,{onClick:()=>i.navigate({to:`/work-items/$workItemId`,params:{workItemId:e.workItemRef}}),children:[e.workItemRef,` →`]})}),e.path&&(0,x.jsx)(SP,{label:`Path`,children:(0,x.jsx)(Ug,{path:e.path})})]})}function EP({edge:e,nodeById:t}){let n=t.get(e.source),r=t.get(e.target);return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:15,fontWeight:700,margin:`0 0 12px`},children:`Relationship`}),(0,x.jsx)(SP,{label:`From`,children:n?.label??e.source}),(0,x.jsx)(SP,{label:`To`,children:r?.label??e.target}),(0,x.jsx)(SP,{label:`Type`,children:e.label}),n?.moduleId&&(0,x.jsx)(SP,{label:`Source module`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:n.moduleId})}),r?.moduleId&&(0,x.jsx)(SP,{label:`Target module`,children:(0,x.jsx)(`span`,{className:`font-mono`,children:r.moduleId})})]})}function DP({metadata:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),d=e.topologyStatus,f=d===`available`?(0,x.jsx)(vo,{variant:`success`,children:`Available`}):d===`partial`?(0,x.jsx)(vo,{variant:`warning`,children:`Partial`}):(0,x.jsx)(vo,{variant:`muted`,children:`Unavailable`}),p=async()=>{if(t)return t;u(!0),c(null);try{let e=await V.getTopologyHandoff();return n(e),e}catch(e){return c(e instanceof fo?e.message:`The handoff could not be generated.`),null}finally{u(!1)}},m=async()=>{let e=await p();if(e)try{await navigator.clipboard?.writeText(e.text),o(!0),setTimeout(()=>o(!1),2e3)}catch{i(!0)}},h=async()=>{r?i(!1):await p()&&i(!0)},g=d===`available`?`${e.semanticEntityCount} semantic components · ${e.technicalRelationshipCount} technical relationships.`:d===`partial`?`${e.semanticEntityCount} semantic components known — Kaddo knows useful topology, but the map is not assumed to be exhaustive.`:`Kaddo currently knows Knowledge and Delivery relationships, but does not yet have enough semantic system metadata to describe how the software is structured.`,_={padding:`5px 12px`,borderRadius:`var(--radius)`,fontSize:12,fontWeight:600,fontFamily:`inherit`,cursor:`pointer`};return(0,x.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid var(--border)`,background:d===`available`?`transparent`:`color-mix(in srgb, var(--warning) 8%, transparent)`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:11,fontWeight:700,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:`System topology`}),f,(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:g}),d!==`available`&&(0,x.jsxs)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8,alignItems:`center`},children:[(0,x.jsxs)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:[`Recommended: `,(0,x.jsx)(`span`,{className:`font-mono`,children:`architecture-agent`}),` · `,(0,x.jsx)(`span`,{className:`font-mono`,children:`graph-metadata-review`})]}),(0,x.jsx)(`button`,{onClick:m,disabled:l,style:{..._,border:`1px solid var(--primary)`,background:`var(--primary)`,color:`var(--primary-foreground)`,opacity:l?.6:1},children:l&&!t?`Preparing…`:a?`✓ Copied`:`Copy topology enrichment handoff`}),(0,x.jsx)(`button`,{onClick:h,disabled:l,style:{..._,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--foreground)`},children:r?`Hide handoff`:`View handoff`})]})]}),s&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,margin:`8px 0 0`},children:s}),r&&t&&(0,x.jsx)(`pre`,{style:{marginTop:10,background:`var(--surface-muted)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12,fontSize:11,lineHeight:1.5,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`var(--font-mono)`,color:`var(--foreground)`,maxHeight:240,overflowY:`auto`},children:t.text})]})}var OP={affected:{tone:`var(--danger)`,label:`Affected`},"reviewed-not-affected":{tone:`var(--foreground-muted)`,label:`Reviewed — not affected`},unknown:{tone:`var(--warning)`,label:`Unknown`}},kP=e=>OP[e]??{tone:`var(--foreground-muted)`,label:e};function AP(e,t,n,r){return(0,x.jsxs)(`button`,{onClick:t,title:`Focus in the graph`,style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`2px 8px`,borderRadius:`var(--radius)`,border:`1px solid ${e}`,background:`color-mix(in srgb, ${e} 12%, transparent)`,color:`var(--foreground)`,cursor:`pointer`,fontFamily:`inherit`,fontSize:12},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:e}}),n]},r)}function jP({workItemId:e,wi:t,topologyStatus:n,onClear:r,onSelectNode:i}){let a=t?.affectedSystemEntities??[],o=t?.reviewedSystemEntities??[],s=o.filter(e=>e.status!==`unknown`),c=o.filter(e=>e.status===`unknown`),l=fx(a,o),u=px(a,o),d=l.length>0,f=e=>e[0]&&i(e[0].nodeId),p=(e,t,n,r)=>(0,x.jsxs)(`button`,{onClick:()=>f(r),disabled:t===0,style:{display:`inline-flex`,gap:6,alignItems:`center`,padding:`3px 9px`,borderRadius:`var(--radius)`,border:`1px solid var(--border)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:t===0?`default`:`pointer`,opacity:t===0?.5:1,fontSize:12,fontFamily:`inherit`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:n}}),e,` `,(0,x.jsx)(`strong`,{children:t})]});return(0,x.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid var(--border)`,background:`var(--surface)`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,x.jsxs)(`span`,{style:{fontSize:13,fontWeight:700},children:[`Impact view · `,(0,x.jsx)(`span`,{className:`font-mono`,children:e})]}),(0,x.jsx)(`button`,{onClick:r,style:{padding:`5px 10px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground-muted)`,cursor:`pointer`,fontSize:12,fontFamily:`inherit`},children:`✕ Clear impact`})]}),t&&d&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[p(`Affected`,u.affected,`var(--danger)`,a),p(`Reviewed`,u.reviewedNotAffected,`var(--foreground-muted)`,s),p(`Unknown`,u.unknown,`var(--warning)`,c)]}),(0,x.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:l.map(e=>AP(kP(e.status).tone,()=>i(e.nodeId),e.label,`${e.status}:${e.nodeId}`))})]}),t&&!d&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`This Work Item has not been assessed against the system Graph. A missing assessment does not mean there is no impact.`}),t&&d&&(0,x.jsx)(`div`,{style:{display:`flex`,gap:14,flexWrap:`wrap`,fontSize:11,color:`var(--foreground-muted)`},children:[`affected`,`reviewed-not-affected`,`unknown`].map(e=>(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:5,alignItems:`center`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:kP(e).tone}}),kP(e).label]},e))}),n===`partial`&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--warning)`,margin:0},children:`⚠ Graph coverage is partial. The highlighted entities represent reviewed scope based on the currently known topology and repository evidence — entities without a highlight may still be impacted.`}),n===`unavailable`&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`No semantic topology is available, so impact cannot be projected onto the graph.`})]})}var MP={system:bP,systemGroup:xP};function NP(){return(0,x.jsxs)(`div`,{style:{padding:24},children:[(0,x.jsx)(`div`,{style:{height:`calc(100vh - 120px)`,background:`var(--surface-muted)`,borderRadius:`var(--radius)`,animation:`pulse 1.5s ease-in-out infinite`}}),(0,x.jsx)(`style`,{children:`@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}`})]})}var PP={padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`};function FP({projection:e}){let t=mi(),n=C(),r=qi({from:`/system`}),i=jj(),a=r.workItem??null,{data:o}=it({queryKey:[`work-item`,a],queryFn:()=>V.getWorkItem(a),enabled:a!=null,retry:!1}),s=(0,v.useMemo)(()=>{if(!a||!o)return;let e=new Map;for(let t of o.affectedSystemEntities)e.set(t.nodeId,`affected`);for(let t of o.reviewedSystemEntities)e.has(t.nodeId)||e.set(t.nodeId,t.status===`unknown`?`unknown`:`reviewed`);return e},[a,o]),[c,l]=(0,v.useState)(r.node??null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(`all`),[g,_]=(0,v.useState)(`all`),[y,b]=(0,v.useState)({system:!0,knowledge:!0,delivery:!0,implementation:!1,unknown:!0}),S=(0,v.useMemo)(()=>[...new Set(e.nodes.map(e=>e.type))].sort(),[e]),w=(0,v.useMemo)(()=>{let t=e.nodes.filter(e=>y[e.dimension]&&(m===`all`||e.moduleId===m)&&(g===`all`||e.type===g)),n=new Set(t.map(e=>e.id));return{...e,nodes:t,relationships:e.relationships.filter(e=>n.has(e.source)&&n.has(e.target))}},[e,m,g,y]),T=e=>b(t=>({...t,[e]:!t[e]})),E=(e,t)=>(0,x.jsxs)(`label`,{style:{display:`inline-flex`,gap:5,alignItems:`center`,fontSize:12,cursor:`pointer`,color:`var(--foreground-muted)`},children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:y[e],onChange:()=>T(e),"aria-label":`Toggle ${t}`}),t]}),D=(0,v.useMemo)(()=>sx(w),[w]),O=(0,v.useMemo)(()=>lx(w,D,c,s),[w,D,c,s]),k=(0,v.useMemo)(()=>ux(w,c),[w,c]),A=e=>{let t=D.positions.get(e);t&&i.setCenter(t.x+95,t.y+29,{zoom:1.2,duration:400})};(0,v.useEffect)(()=>{if(r.node&&D.positions.has(r.node)){l(r.node);let e=setTimeout(()=>A(r.node),100);return()=>clearTimeout(e)}},[]),(0,v.useEffect)(()=>{if(!s||s.size===0)return;let e=[...s.keys()].filter(e=>D.positions.has(e));if(e.length===0)return;let t=setTimeout(()=>i.fitView({nodes:e.map(e=>({id:e})),duration:500,padding:.3,maxZoom:1.4}),120);return()=>clearTimeout(t)},[s,D]);let j=e=>{l(e),d(null),t.navigate({to:`/system`,search:{node:e,workItem:a??void 0},replace:!0}),A(e)},M=f.trim()?dx(w.nodes,f).slice(0,8):[];return(0,x.jsxs)(`div`,{style:{display:`flex`,height:`calc(100vh - 56px)`},children:[(0,x.jsxs)(`div`,{style:{flex:1,minWidth:0,position:`relative`,display:`flex`,flexDirection:`column`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:10,padding:`12px 16px`,borderBottom:`1px solid var(--border)`,alignItems:`center`,flexWrap:`wrap`,position:`relative`,zIndex:5,background:`var(--background)`},children:[(0,x.jsxs)(`div`,{style:{position:`relative`,flex:`1 1 220px`,minWidth:180},children:[(0,x.jsx)(`input`,{type:`search`,placeholder:`Search system…`,value:f,onChange:e=>p(e.target.value),"aria-label":`Search system`,style:{...PP,width:`100%`,boxSizing:`border-box`}}),M.length>0&&(0,x.jsx)(`ul`,{style:{position:`absolute`,top:`100%`,left:0,right:0,marginTop:4,listStyle:`none`,padding:4,background:`var(--surface)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,zIndex:10,maxHeight:260,overflowY:`auto`},children:M.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{onClick:()=>{j(e.id),p(``)},style:{display:`block`,width:`100%`,textAlign:`left`,padding:`6px 8px`,background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground)`,fontFamily:`inherit`,fontSize:13},children:[e.label,` `,(0,x.jsxs)(`span`,{style:{color:`var(--foreground-muted)`,fontSize:11},children:[`· `,ax(e.type).label,e.moduleId?` · ${e.moduleId}`:``]})]})},e.id))})]}),e.groups.length>0&&(0,x.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),"aria-label":`Filter by module`,style:PP,children:[(0,x.jsx)(`option`,{value:`all`,children:`All modules`}),e.groups.map(e=>(0,x.jsx)(`option`,{value:e.id,children:e.label},e.id))]}),(0,x.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),"aria-label":`Filter by type`,style:PP,children:[(0,x.jsx)(`option`,{value:`all`,children:`All types`}),S.map(e=>(0,x.jsx)(`option`,{value:e,children:ax(e).label},e))]}),(0,x.jsxs)(`div`,{style:{display:`inline-flex`,gap:12,alignItems:`center`,paddingLeft:4},children:[(0,x.jsx)(`span`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,color:`var(--foreground-muted)`},children:`Show`}),E(`knowledge`,`Knowledge`),E(`delivery`,`Delivery`),E(`implementation`,`Implementation`)]}),(0,x.jsxs)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[w.nodes.length,` nodes · `,w.relationships.length,` relationships · coverage `,e.metadata.coverage]}),(0,x.jsx)(`button`,{onClick:()=>n.invalidateQueries({queryKey:[`system-map`]}),style:{...PP,cursor:`pointer`,color:`var(--foreground-muted)`},children:`↻ Refresh`})]}),(0,x.jsx)(DP,{metadata:e.metadata}),a&&(0,x.jsx)(jP,{workItemId:a,wi:o??null,topologyStatus:e.metadata.topologyStatus,onClear:()=>t.navigate({to:`/system`,search:{},replace:!0}),onSelectNode:j}),w.nodes.length===0?(0,x.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--foreground-muted)`,fontSize:14},children:`No nodes match these filters.`}):(0,x.jsx)(`div`,{style:{flex:1},children:(0,x.jsxs)(LN,{nodes:O,edges:k,nodeTypes:MP,onNodeClick:(e,t)=>{t.type===`system`&&j(t.id)},onEdgeClick:(e,t)=>{d(t.id),l(null)},onPaneClick:()=>{l(null),d(null)},fitView:!0,minZoom:.2,proOptions:{hideAttribution:!0},children:[(0,x.jsx)(WN,{color:`var(--border)`,gap:20}),(0,x.jsx)($N,{showInteractive:!1})]})})]}),(c||u)&&(0,x.jsx)(wP,{projection:e,selectedNodeId:c,selectedEdgeId:u,onClose:()=>{l(null),d(null)},onSelectNode:j})]})}function IP(){let e=C(),{data:t,isLoading:n,error:r}=it({queryKey:[`system-map`],queryFn:V.getSystemMap,refetchOnWindowFocus:!1});return n?(0,x.jsx)(NP,{}):r?(0,x.jsx)(`div`,{style:{padding:24},children:(0,x.jsxs)(`div`,{style:{background:`color-mix(in srgb, var(--danger) 10%, transparent)`,border:`1px solid var(--danger)`,borderRadius:`var(--radius)`,padding:16},children:[(0,x.jsx)(`strong`,{children:`System map could not be loaded`}),(0,x.jsx)(`p`,{style:{margin:`4px 0 8px`,fontSize:14,color:`var(--foreground-muted)`},children:`The project remains available, but Kaddo could not build the current System Map.`}),(0,x.jsx)(`button`,{onClick:()=>e.invalidateQueries({queryKey:[`system-map`]}),style:{...PP,cursor:`pointer`},children:`Retry`})]})}):!t||!t.metadata.available?(0,x.jsxs)(`div`,{style:{padding:`48px 32px`,textAlign:`center`,color:`var(--foreground-muted)`,maxWidth:640,margin:`0 auto`},children:[(0,x.jsx)(`div`,{style:{fontSize:32,marginBottom:12},children:`🗺️`}),(0,x.jsx)(`h2`,{style:{fontSize:18,fontWeight:600,color:`var(--foreground)`,margin:`0 0 8px`},children:`System map not available yet`}),(0,x.jsx)(`p`,{style:{fontSize:14},children:`Kaddo does not have enough system metadata to build a System Map for this project yet.`}),(0,x.jsx)(`p`,{style:{fontSize:13,marginTop:8},children:`Review the project Knowledge and graph metadata to enrich the map.`})]}):(0,x.jsx)(NN,{children:(0,x.jsx)(FP,{projection:t})})}var LP={mock:`🧪`,jira:`🟦`,github:`🐙`,"azure-devops":`🔷`,linear:`🟣`,gitlab:`🦊`};function RP({icon:e,size:t=32}){let n=e?LP[e]??`🔌`:`🔌`;return(0,x.jsx)(`span`,{style:{fontSize:t,lineHeight:1,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:t+8,height:t+8},children:n})}var zP={available:`var(--success)`,configured:`var(--foreground-muted)`,unauthorized:`var(--danger)`,unavailable:`var(--warning)`,"invalid-config":`var(--danger)`,disabled:`var(--foreground-muted)`};function BP({status:e}){return(0,x.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,fontSize:12,color:`var(--foreground)`},children:[(0,x.jsx)(`span`,{"aria-hidden":!0,style:{width:8,height:8,borderRadius:8,background:zP[e]??`var(--foreground-muted)`}}),e]})}function VP({on:e,label:t}){return(0,x.jsxs)(`span`,{style:{fontSize:12,color:e?`var(--foreground)`:`var(--foreground-muted)`},children:[e?`✓`:`✗`,` `,t]})}var HP={padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:`pointer`,fontSize:13,fontFamily:`inherit`},UP={...HP,background:`var(--primary)`,color:`var(--primary-foreground, #fff)`,fontWeight:600},WP={...HP,color:`var(--danger)`,borderColor:`var(--danger)`},GP={padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`,width:`100%`,boxSizing:`border-box`},KP={fontSize:13,fontWeight:600,color:`var(--foreground)`,marginBottom:4,display:`block`},qP={border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:16,background:`var(--surface)`};function JP({name:e,schema:t,value:n,onChange:r}){if(t.type===`select`&&t.options)return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsxs)(`select`,{value:String(n??t.defaultValue??``),onChange:e=>r(e.target.value),style:GP,children:[(0,x.jsx)(`option`,{value:``,children:`Choose…`}),t.options.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]});if(t.type===`multi-select`&&t.options){let e=Array.isArray(n)?n:[];return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:t.options.map(t=>{let n=e.includes(t.value);return(0,x.jsx)(`button`,{type:`button`,onClick:()=>r(n?e.filter(e=>e!==t.value):[...e,t.value]),style:{...HP,background:n?`var(--primary)`:`var(--surface)`,color:n?`var(--primary-foreground, #fff)`:`var(--foreground)`,fontWeight:n?600:400},children:t.label},t.value)})})]})}if(t.type===`boolean`)return(0,x.jsxs)(`div`,{style:{marginBottom:12,display:`flex`,alignItems:`center`,gap:8},children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:!!(n??t.defaultValue),onChange:e=>r(e.target.checked),id:`field-${e}`}),(0,x.jsx)(`label`,{htmlFor:`field-${e}`,style:{fontSize:13,fontWeight:600},children:t.label}),t.description&&(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:t.description})]});if(t.type===`password`)return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`input`,{type:`password`,value:String(n??``),placeholder:t.placeholder,onChange:e=>r(e.target.value),style:GP})]});let i=t.type===`url`?`url`:t.type===`number`?`number`:`text`;return(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`input`,{type:i,value:String(n??``),placeholder:t.placeholder,onChange:e=>r(t.type===`number`?Number(e.target.value):e.target.value),style:GP})]})}function YP({schema:e,configured:t,onSave:n}){let[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);return r?(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[e.label,e.required&&` *`]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,x.jsx)(`input`,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:`Enter value…`,style:{...GP,flex:1}}),(0,x.jsx)(`button`,{disabled:!a.trim(),onClick:()=>{n(a),i(!1),o(``)},style:UP,children:`Save`}),(0,x.jsx)(`button`,{onClick:()=>i(!1),style:HP,children:`Cancel`})]})]}):(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[e.label,e.required&&` *`]}),e.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:e.description}),(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,x.jsx)(`span`,{style:{fontSize:13,color:t?`var(--success)`:`var(--warning)`},children:t?`Configured`:`Not configured`}),(0,x.jsx)(`button`,{onClick:()=>{i(!0),o(``)},style:HP,children:t?`Replace`:`Set`})]})]})}function XP({types:e,onSelect:t,onCancel:n}){return(0,x.jsxs)(`div`,{style:{...qP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,x.jsx)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:`Add Integration`}),(0,x.jsx)(`button`,{onClick:n,style:{...HP,border:`none`,background:`none`,color:`var(--foreground-muted)`},children:`✕`})]}),(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`,margin:`0 0 16px`},children:`Choose a provider from the Integration Registry:`}),(0,x.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(200px, 1fr))`,gap:12},children:e.map(e=>(0,x.jsxs)(`button`,{onClick:()=>t(e),style:{...qP,cursor:`pointer`,textAlign:`center`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,padding:`20px 16px`,transition:`border-color 0.15s`},onMouseEnter:e=>e.currentTarget.style.borderColor=`var(--primary)`,onMouseLeave:e=>e.currentTarget.style.borderColor=`var(--border)`,children:[(0,x.jsx)(RP,{icon:e.icon,size:36}),(0,x.jsx)(`div`,{style:{fontWeight:700,fontSize:15},children:e.displayName}),e.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,lineHeight:1.4},children:e.description}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:4},children:[(0,x.jsx)(VP,{on:e.capabilities.workItems.read,label:`Read`}),(0,x.jsx)(VP,{on:e.capabilities.workItems.list,label:`List`}),(0,x.jsx)(VP,{on:e.capabilities.workItems.import,label:`Import`})]})]},e.id))})]})}function ZP({onCreated:e,onCancel:t}){let n=C(),{data:r}=it({queryKey:[`integration-types`],queryFn:()=>V.getIntegrationTypes()}),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)({}),[u,d]=(0,v.useState)({}),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),g=at({mutationFn:()=>V.createIntegration({id:o.trim(),adapter:i.id,config:c}),onSuccess:async t=>{for(let[e,n]of Object.entries(u))n.trim()&&await V.setIntegrationSecret(t.id,e,n);n.invalidateQueries({queryKey:[`integrations`]}),e()}});if(!r)return(0,x.jsx)(`div`,{style:{...qP,marginBottom:16},children:(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading providers…`})});if(!i)return(0,x.jsx)(XP,{types:r,onSelect:e=>{a(e),s(``),l({}),d({}),p(null)},onCancel:t});let _=i.configSchema,y=i.secretSchema,b=o.trim()&&/^[a-z0-9][a-z0-9._-]*$/i.test(o.trim()),S=async()=>{h(!0),p(null);try{let t=await V.createIntegration({id:o.trim(),adapter:i.id,config:c});for(let[e,n]of Object.entries(u))n.trim()&&await V.setIntegrationSecret(t.id,e,n);let r=await V.getIntegrationStatus(t.id);p({status:r.status,message:r.message}),n.invalidateQueries({queryKey:[`integrations`]}),r.status===`available`?e():await V.deleteIntegration(t.id)}catch(e){p({status:`error`,message:e.message})}finally{h(!1)}};return(0,x.jsxs)(`div`,{style:{...qP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,x.jsx)(RP,{icon:i.icon,size:24}),(0,x.jsxs)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:[i.displayName,` Integration`]})]}),(0,x.jsx)(`button`,{onClick:()=>a(null),style:{...HP,border:`none`,background:`none`,color:`var(--foreground-muted)`,fontSize:12},children:`← Back`})]}),(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsx)(`label`,{style:KP,children:`Integration ID *`}),(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:`A unique identifier (alphanumeric, dashes, dots).`}),(0,x.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`e.g. company-jira`,style:GP})]}),Object.keys(_).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Configuration`}),Object.entries(_).map(([e,t])=>(0,x.jsx)(JP,{name:e,schema:t,value:c[e],onChange:t=>l({...c,[e]:t})},e))]}),Object.keys(y).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Credentials`}),Object.entries(y).map(([e,t])=>(0,x.jsxs)(`div`,{style:{marginBottom:12},children:[(0,x.jsxs)(`label`,{style:KP,children:[t.label,t.required&&` *`]}),t.description&&(0,x.jsx)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:4},children:t.description}),(0,x.jsx)(`input`,{type:`password`,value:u[e]??``,onChange:t=>d({...u,[e]:t.target.value}),placeholder:`Enter value…`,style:GP})]},e))]}),f&&(0,x.jsxs)(`div`,{style:{marginTop:8,marginBottom:8,fontSize:13,padding:`8px 12px`,borderRadius:`var(--radius)`,background:f.status===`available`?`var(--success-bg, rgba(0,180,0,0.08))`:`var(--danger-bg, rgba(200,0,0,0.08))`},children:[`Connection: `,(0,x.jsx)(`strong`,{children:f.status}),f.message?` — ${f.message}`:``]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:16},children:[(0,x.jsx)(`button`,{disabled:!b||g.isPending,onClick:()=>g.mutate(),style:UP,children:g.isPending?`Creating…`:`Save`}),(0,x.jsx)(`button`,{disabled:!b||m,onClick:S,style:HP,children:m?`Verifying…`:`Verify & Save`}),(0,x.jsx)(`button`,{onClick:t,style:HP,children:`Cancel`})]}),g.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:8},children:g.error.message})]})}function QP({integration:e,onDone:t}){let n=C(),r=e.metadata?.configSchema??{},i=e.metadata?.secretSchema??{},a=!e.metadata,{data:o}=it({queryKey:[`integration-detail`,e.id],queryFn:()=>V.getIntegrationDetail(e.id)}),{data:s,refetch:c}=it({queryKey:[`integration-secrets`,e.id],queryFn:()=>V.getIntegrationSecretStatus(e.id)}),[l,u]=(0,v.useState)(()=>({...o??e})),[d,f]=(0,v.useState)(!1),p=o?.config;(0,v.useState)(()=>{p&&!d&&u(p)});let m=at({mutationFn:()=>V.updateIntegration(e.id,{config:l}),onSuccess:()=>{n.invalidateQueries({queryKey:[`integrations`]}),n.invalidateQueries({queryKey:[`integration-detail`,e.id]}),f(!1)}}),h=at({mutationFn:({name:t,value:n})=>V.setIntegrationSecret(e.id,t,n),onSuccess:()=>{c(),n.invalidateQueries({queryKey:[`integrations`]})}});return(0,x.jsxs)(`div`,{style:{...qP,marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,x.jsx)(RP,{icon:e.metadata?.icon,size:20}),(0,x.jsxs)(`h3`,{style:{fontSize:15,fontWeight:700,margin:0},children:[`Configure: `,e.displayName]})]}),(0,x.jsx)(`button`,{onClick:t,style:{...HP,border:`none`,background:`none`,color:`var(--foreground-muted)`},children:`✕`})]}),a&&(0,x.jsxs)(`div`,{style:{padding:`10px 14px`,borderRadius:`var(--radius)`,background:`var(--danger-bg, rgba(200,0,0,0.08))`,fontSize:13,color:`var(--danger)`,marginBottom:12},children:[`This integration's adapter (`,(0,x.jsx)(`span`,{className:`font-mono`,children:e.adapter}),`) is not currently available. Configuration is preserved but the integration cannot be used until its adapter is registered.`]}),Object.keys(r).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`0 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Configuration`}),Object.entries(r).map(([e,t])=>(0,x.jsx)(JP,{name:e,schema:t,value:l[e],onChange:t=>{u({...l,[e]:t}),f(!0)}},e)),(0,x.jsx)(`button`,{disabled:!d||m.isPending,onClick:()=>m.mutate(),style:UP,children:m.isPending?`Saving…`:`Save Configuration`}),m.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:4},children:m.error.message})]}),Object.keys(i).length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,color:`var(--foreground-muted)`,margin:`16px 0 8px`,textTransform:`uppercase`,letterSpacing:.4},children:`Credentials`}),Object.entries(i).map(([e,t])=>(0,x.jsx)(YP,{name:e,schema:t,configured:s?.[e]??!1,onSave:t=>h.mutate({name:e,value:t})},e)),h.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,marginTop:4},children:h.error.message})]})]})}function $P({integrationId:e,item:t,onClose:n}){let r=mi(),i=C(),[a,o]=(0,v.useState)(``),{data:s}=it({queryKey:[`capture-def`],queryFn:()=>V.getCaptureDefinition()}),{data:c,isLoading:l}=it({queryKey:[`import-preview`,e,t.externalId],queryFn:()=>V.getImportPreview(e,t.externalId),retry:!1}),u=at({mutationFn:()=>V.importExternalWorkItem(e,t.externalId,a),onSuccess:n=>{i.invalidateQueries({queryKey:[`import-preview`,e,t.externalId]}),r.navigate({to:`/work-items/$workItemId`,params:{workItemId:n.workItemId}})}});return(0,x.jsxs)(`div`,{style:{...qP,marginTop:10},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,x.jsx)(`h3`,{style:{fontSize:13,fontWeight:700,textTransform:`uppercase`,letterSpacing:.4,color:`var(--foreground-muted)`,margin:0},children:`Import work item`}),(0,x.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:13},children:`✕`})]}),l&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading preview…`}),c?.duplicate?(0,x.jsxs)(`div`,{style:{marginTop:8},children:[(0,x.jsxs)(`p`,{style:{fontSize:14},children:[`Already imported as `,(0,x.jsx)(`strong`,{className:`font-mono`,children:c.duplicate.workItemId}),` — "`,c.duplicate.title,`".`]}),(0,x.jsx)(`button`,{onClick:()=>r.navigate({to:`/work-items/$workItemId`,params:{workItemId:c.duplicate.workItemId}}),style:HP,children:`View Work Item`})]}):c?(0,x.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:10},children:[(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Source:`}),` `,c.preview.source.provider,` · `,c.preview.source.externalId]}),(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Captured intent:`}),` `,c.preview.capturedIntent]}),(0,x.jsxs)(`div`,{style:{fontSize:13},children:[(0,x.jsx)(`span`,{style:{color:`var(--foreground-muted)`},children:`Will create:`}),` a Draft Work Item (needs refinement)`]}),c.preview.externalType&&(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[`External type "`,c.preview.externalType,`" — choose the Kaddo type explicitly (never inferred):`]}),(0,x.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),"aria-label":`Kaddo Work Item type`,style:{...GP,alignSelf:`flex-start`,width:`auto`},children:[(0,x.jsx)(`option`,{value:``,children:`Choose Kaddo Work Item type…`}),(s?.types??[]).map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--foreground-muted)`,margin:0},children:`No project files have been modified yet.`}),(0,x.jsx)(`div`,{children:(0,x.jsx)(`button`,{disabled:!a||u.isPending,onClick:()=>u.mutate(),style:a?UP:HP,children:u.isPending?`Importing…`:`Import as Draft`})}),u.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`},children:u.error.message})]}):null]})}function eF({integration:e,onEdit:t}){let n=C(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),l=e.metadata!==null,u=l&&e.status!==`disabled`&&e.status!==`invalid-config`&&e.capabilities?.workItems.list,d=it({queryKey:[`integration-status`,e.id],queryFn:()=>V.getIntegrationStatus(e.id),enabled:!!u,retry:!1}),f=it({queryKey:[`external-items`,e.id],queryFn:()=>V.getExternalWorkItems(e.id),enabled:r&&!!u,retry:!1}),p=at({mutationFn:()=>e.enabled?V.disableIntegration(e.id):V.enableIntegration(e.id),onSuccess:()=>n.invalidateQueries({queryKey:[`integrations`]})}),m=at({mutationFn:()=>V.deleteIntegration(e.id),onSuccess:()=>n.invalidateQueries({queryKey:[`integrations`]})}),h=at({mutationFn:()=>V.getIntegrationStatus(e.id),onSuccess:()=>{n.invalidateQueries({queryKey:[`integration-status`,e.id]}),n.invalidateQueries({queryKey:[`integrations`]})}});return(0,x.jsxs)(`div`,{style:{...qP,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:12,flexWrap:`wrap`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,gap:12,flex:1},children:[(0,x.jsx)(RP,{icon:e.metadata?.icon,size:28}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{style:{fontSize:15,fontWeight:700},children:[e.displayName,` `,(0,x.jsxs)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`,fontWeight:400},children:[`· `,e.id]})]}),(0,x.jsxs)(`div`,{style:{marginTop:4,display:`flex`,gap:12,alignItems:`center`,flexWrap:`wrap`},children:[(0,x.jsx)(BP,{status:d.data?.status??e.status}),!l&&(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--danger)`},children:`Adapter unavailable`}),e.capabilities&&(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:10},children:[(0,x.jsx)(VP,{on:e.capabilities.workItems.read,label:`Read`}),(0,x.jsx)(VP,{on:e.capabilities.workItems.list,label:`List`}),(0,x.jsx)(VP,{on:e.capabilities.workItems.import,label:`Import`})]})]})]})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:[(0,x.jsx)(`button`,{onClick:t,style:HP,children:`Configure`}),l&&(0,x.jsx)(`button`,{onClick:()=>h.mutate(),disabled:h.isPending,style:HP,children:h.isPending?`Verifying…`:`Verify`}),(0,x.jsx)(`button`,{onClick:()=>p.mutate(),disabled:p.isPending,style:HP,children:p.isPending?`…`:e.enabled?`Disable`:`Enable`}),u&&(0,x.jsx)(`button`,{onClick:()=>i(e=>!e),style:HP,children:r?`Hide items`:`Browse`}),s?(0,x.jsxs)(`span`,{style:{display:`inline-flex`,gap:4,alignItems:`center`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--danger)`},children:`Delete?`}),(0,x.jsx)(`button`,{onClick:()=>m.mutate(),style:WP,children:`Yes`}),(0,x.jsx)(`button`,{onClick:()=>c(!1),style:HP,children:`No`})]}):(0,x.jsx)(`button`,{onClick:()=>c(!0),style:WP,children:`Delete`})]})]}),h.data&&(0,x.jsxs)(`div`,{style:{marginTop:8,fontSize:13,padding:`6px 10px`,borderRadius:`var(--radius)`,background:h.data.status===`available`?`var(--success-bg, rgba(0,180,0,0.08))`:`var(--danger-bg, rgba(200,0,0,0.08))`},children:[`Connection: `,(0,x.jsx)(`strong`,{children:h.data.status}),h.data.message?` — ${h.data.message}`:``]}),e.findings.map((e,t)=>(0,x.jsxs)(`p`,{style:{fontSize:12,color:e.level===`blocking`?`var(--danger)`:`var(--warning)`,margin:`6px 0 0`},children:[`[`,e.level,`] `,e.message]},t)),m.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`,margin:`6px 0 0`},children:m.error.message}),r&&u&&(0,x.jsxs)(`div`,{style:{marginTop:12},children:[f.isLoading&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading…`}),f.isError&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--danger)`},children:f.error.message}),(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:f.data?.items.map(t=>(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,padding:`8px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:12,color:`var(--foreground-muted)`},children:t.externalId}),` `,(0,x.jsx)(`span`,{style:{fontSize:14},children:t.title}),t.status&&(0,x.jsxs)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[` · `,t.status]})]}),e.capabilities?.workItems.import&&(0,x.jsx)(`button`,{onClick:()=>o(t),style:HP,children:`Import`})]},t.externalId))}),a&&(0,x.jsx)($P,{integrationId:e.id,item:a,onClose:()=>o(null)})]})]})}function tF(){let e=C(),{data:t,isLoading:n,error:r}=it({queryKey:[`integrations`],queryFn:()=>V.getIntegrations(),retry:!1}),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),c=t?.find(e=>e.id===o);return(0,x.jsxs)(`div`,{style:{padding:`24px 32px`,maxWidth:900,margin:`0 auto`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,marginBottom:20},children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{style:{fontSize:22,fontWeight:700,margin:`0 0 4px`},children:`Integrations`}),(0,x.jsxs)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`,margin:0},children:[`Connect Kaddo to external work systems. Configuration lives in `,(0,x.jsx)(`span`,{className:`font-mono`,children:`.kaddo/integrations.yml`}),` — Admin and CLI share the same source of truth.`]})]}),!i&&(0,x.jsx)(`button`,{onClick:()=>{a(!0),s(null)},style:UP,children:`+ Add Integration`})]}),i&&(0,x.jsx)(ZP,{onCreated:()=>{a(!1),e.invalidateQueries({queryKey:[`integrations`]})},onCancel:()=>a(!1)}),o&&c&&(0,x.jsx)(QP,{integration:c,onDone:()=>s(null)}),n&&(0,x.jsx)(`p`,{style:{color:`var(--foreground-muted)`},children:`Loading…`}),r&&(0,x.jsx)(`p`,{style:{color:`var(--danger)`},children:r.message}),t&&t.length===0&&!i&&(0,x.jsxs)(`div`,{style:{padding:32,textAlign:`center`,color:`var(--foreground-muted)`,border:`1px dashed var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsx)(`div`,{style:{fontSize:28,marginBottom:8},children:`🔌`}),(0,x.jsxs)(`p`,{style:{fontSize:14,margin:0},children:[`No integrations are configured. Click `,(0,x.jsx)(`strong`,{children:`+ Add Integration`}),` to get started.`]})]}),t?.map(e=>(0,x.jsx)(eF,{integration:e,onEdit:()=>{s(e.id),a(!1)}},e.id))]})}var nF={padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,cursor:`pointer`,fontSize:13,fontFamily:`inherit`},rF={...nF,background:`var(--primary)`,color:`var(--primary-foreground, #fff)`,fontWeight:600},iF={padding:`6px 10px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`,color:`var(--foreground)`,fontSize:13,fontFamily:`inherit`},aF={border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:16,background:`var(--surface)`},oF={display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 8px`,borderRadius:12,fontSize:11,fontWeight:500,background:`var(--surface-muted)`,color:`var(--foreground-muted)`};function sF({type:e}){if(!e)return null;let t={Feature:`var(--primary)`,Bug:`var(--danger)`,Task:`var(--foreground-muted)`,Epic:`var(--warning)`};return(0,x.jsx)(`span`,{style:{...oF,borderLeft:`3px solid ${t[e]??`var(--foreground-muted)`}`},children:e})}function cF({status:e}){if(!e)return null;let t={Open:`var(--primary)`,"To Do":`var(--foreground-muted)`,"In Progress":`var(--warning)`,Done:`var(--success)`};return(0,x.jsxs)(`span`,{style:{...oF},children:[(0,x.jsx)(`span`,{style:{width:6,height:6,borderRadius:6,background:t[e]??`var(--foreground-muted)`}}),e]})}function lF({filters:e,onChange:t,onRefresh:n,loading:r}){let[i,a]=(0,v.useState)(e.search??``);return(0,x.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`,marginBottom:16},children:[(0,x.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t({...e,search:i.trim()||void 0})},placeholder:`Search items…`,style:{...iF,width:260}}),(0,x.jsx)(`button`,{onClick:()=>t({...e,search:i.trim()||void 0}),style:nF,children:`Search`}),(0,x.jsx)(`button`,{onClick:n,disabled:r,style:nF,children:r?`Refreshing…`:`Refresh`}),(e.statuses?.length||e.types?.length||e.labels?.length||e.search)&&(0,x.jsx)(`button`,{onClick:()=>{a(``),t({})},style:{...nF,color:`var(--foreground-muted)`,fontSize:12},children:`Clear filters`})]})}function uF({integrationId:e,item:t,onClose:n}){let r=mi(),i=C(),[a,o]=(0,v.useState)(``),{data:s}=it({queryKey:[`capture-def`],queryFn:()=>V.getCaptureDefinition()}),{data:c,isLoading:l}=it({queryKey:[`import-preview`,e,t.externalId],queryFn:()=>V.getImportPreview(e,t.externalId),retry:!1}),u=at({mutationFn:()=>V.importExternalWorkItem(e,t.externalId,a),onSuccess:e=>{i.invalidateQueries({queryKey:[`discover`]}),r.navigate({to:`/work-items/$workItemId`,params:{workItemId:e.workItemId}})}});return(0,x.jsxs)(`div`,{style:{...aF,marginTop:10,marginLeft:16,borderLeft:`3px solid var(--primary)`},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,x.jsxs)(`h4`,{style:{fontSize:13,fontWeight:700,margin:0},children:[`Import: `,t.title]}),(0,x.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--foreground-muted)`,fontSize:13},children:`✕`})]}),l&&(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--foreground-muted)`},children:`Loading preview…`}),c?.duplicate?(0,x.jsxs)(`div`,{style:{marginTop:8},children:[(0,x.jsxs)(`p`,{style:{fontSize:13},children:[`Already imported as `,(0,x.jsx)(`strong`,{className:`font-mono`,children:c.duplicate.workItemId}),`.`]}),(0,x.jsx)(`button`,{onClick:()=>r.navigate({to:`/work-items/$workItemId`,params:{workItemId:c.duplicate.workItemId}}),style:nF,children:`View Work Item`})]}):c?(0,x.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:8},children:[(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`},children:[`Source: `,c.preview.source.provider,` · `,c.preview.source.externalId]}),(0,x.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),style:{...iF,width:`auto`,alignSelf:`flex-start`},children:[(0,x.jsx)(`option`,{value:``,children:`Choose Kaddo Work Item type…`}),(s?.types??[]).map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,x.jsx)(`p`,{style:{fontSize:11,color:`var(--foreground-muted)`,margin:0},children:`No project files have been modified yet.`}),(0,x.jsx)(`div`,{children:(0,x.jsx)(`button`,{disabled:!a||u.isPending,onClick:()=>u.mutate(),style:a?rF:nF,children:u.isPending?`Importing…`:`Import as Draft`})}),u.isError&&(0,x.jsx)(`p`,{style:{fontSize:12,color:`var(--danger)`},children:u.error.message})]}):null]})}function dF({item:e,integrationId:t,integrationName:n,icon:r}){let[i,a]=(0,v.useState)(!1);return(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,padding:`10px 14px`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,background:`var(--surface)`},children:[(0,x.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4},children:[(0,x.jsx)(`span`,{className:`font-mono`,style:{fontSize:11,color:`var(--foreground-muted)`,flexShrink:0},children:e.externalId}),(0,x.jsx)(`span`,{style:{fontSize:14,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`,flexWrap:`wrap`},children:[(0,x.jsx)(sF,{type:e.type}),(0,x.jsx)(cF,{status:e.status}),e.labels?.map(e=>(0,x.jsx)(`span`,{style:{...oF,fontSize:10},children:e},e)),(0,x.jsxs)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:[r?`${r} `:``,n]}),e.assignees?.length?(0,x.jsx)(`span`,{style:{fontSize:11,color:`var(--foreground-muted)`},children:e.assignees.map(e=>e.name).join(`, `)}):null]})]}),(0,x.jsxs)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:[e.url&&(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,style:{...nF,textDecoration:`none`,fontSize:12},children:`Open`}),(0,x.jsx)(`button`,{onClick:()=>a(!i),style:nF,children:i?`Cancel`:`Import`})]})]}),i&&(0,x.jsx)(uF,{integrationId:t,item:e,onClose:()=>a(!1)})]})}function fF({result:e}){return e.error?(0,x.jsxs)(`div`,{style:{...aF,borderLeft:`3px solid var(--danger)`,marginBottom:12},children:[(0,x.jsxs)(`div`,{style:{fontWeight:600,fontSize:14},children:[e.displayName,` `,(0,x.jsx)(`span`,{style:{fontWeight:400,fontSize:12,color:`var(--danger)`},children:`Error`})]}),(0,x.jsx)(`p`,{style:{fontSize:13,color:`var(--danger)`,margin:`4px 0 0`},children:e.error})]}):(0,x.jsxs)(`div`,{style:{marginBottom:16},children:[(0,x.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,x.jsx)(`span`,{style:{fontSize:14,fontWeight:600},children:e.displayName}),(0,x.jsxs)(`span`,{style:{...oF},children:[e.items.length,` item`,e.items.length===1?``:`s`,e.hasMore?`+`:``]})]}),(0,x.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.items.map(t=>(0,x.jsx)(dF,{item:t,integrationId:e.integrationId,integrationName:e.displayName,icon:e.icon},`${e.integrationId}-${t.externalId}`))})]})}function pF(){let[e,t]=(0,v.useState)({}),{data:n,isLoading:r,error:i,refetch:a}=it({queryKey:[`discover`,e],queryFn:()=>V.discoverExternalWorkItems({filters:e,pageSize:50}),retry:!1}),o=(0,v.useMemo)(()=>n?n.results.flatMap(e=>e.items.map(t=>({...t,_integrationId:e.integrationId,_integrationName:e.displayName,_icon:e.icon}))):[],[n]),s=(0,v.useMemo)(()=>[...new Set(o.map(e=>e.type).filter(Boolean))].sort(),[o]),c=(0,v.useMemo)(()=>[...new Set(o.map(e=>e.status).filter(Boolean))].sort(),[o]);return(0,x.jsxs)(`div`,{style:{padding:`24px 32px`,maxWidth:1e3,margin:`0 auto`},children:[(0,x.jsxs)(`div`,{style:{marginBottom:20},children:[(0,x.jsx)(`h2`,{style:{fontSize:22,fontWeight:700,margin:`0 0 4px`},children:`External Work Items`}),(0,x.jsx)(`p`,{style:{fontSize:14,color:`var(--foreground-muted)`,margin:0},children:`Discover items from all enabled integrations. Read-only — import creates a Draft Work Item through human confirmation.`})]}),(0,x.jsx)(lF,{filters:e,onChange:t,onRefresh:()=>a(),loading:r}),s.length>0&&(0,x.jsxs)(`div`,{style:{display:`flex`,gap:4,marginBottom:8,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`,lineHeight:`24px`},children:`Types:`}),s.map(n=>(0,x.jsx)(`button`,{onClick:()=>{let r=e.types??[];t({...e,types:r.includes(n)?r.filter(e=>e!==n):[...r,n]})},style:{...oF,cursor:`pointer`,border:`1px solid var(--border)`,background:e.types?.includes(n)?`var(--primary)`:`var(--surface)`,color:e.types?.includes(n)?`var(--primary-foreground, #fff)`:`var(--foreground-muted)`},children:n},n))]}),c.length>0&&(0,x.jsxs)(`div`,{style:{display:`flex`,gap:4,marginBottom:12,flexWrap:`wrap`},children:[(0,x.jsx)(`span`,{style:{fontSize:12,color:`var(--foreground-muted)`,lineHeight:`24px`},children:`Statuses:`}),c.map(n=>(0,x.jsx)(`button`,{onClick:()=>{let r=e.statuses??[];t({...e,statuses:r.includes(n)?r.filter(e=>e!==n):[...r,n]})},style:{...oF,cursor:`pointer`,border:`1px solid var(--border)`,background:e.statuses?.includes(n)?`var(--primary)`:`var(--surface)`,color:e.statuses?.includes(n)?`var(--primary-foreground, #fff)`:`var(--foreground-muted)`},children:n},n))]}),r&&(0,x.jsx)(`p`,{style:{color:`var(--foreground-muted)`},children:`Discovering work items across integrations…`}),i&&(0,x.jsx)(`p`,{style:{color:`var(--danger)`},children:i.message}),n&&n.totalItems===0&&n.results.every(e=>!e.error)&&(0,x.jsxs)(`div`,{style:{padding:32,textAlign:`center`,color:`var(--foreground-muted)`,border:`1px dashed var(--border)`,borderRadius:`var(--radius)`},children:[(0,x.jsx)(`div`,{style:{fontSize:28,marginBottom:8},children:`🔍`}),(0,x.jsx)(`p`,{style:{fontSize:14,margin:0},children:`No external work items found. Check that integrations are configured and enabled.`})]}),n&&(0,x.jsxs)(`div`,{style:{fontSize:12,color:`var(--foreground-muted)`,marginBottom:12},children:[n.totalItems,` item`,n.totalItems===1?``:`s`,` from `,n.results.length,` integration`,n.results.length===1?``:`s`]}),n?.results.map(e=>(0,x.jsx)(fF,{result:e},e.integrationId))]})}var mF=new Ge({defaultOptions:{queries:{staleTime:3e4,retry:1}}}),hF=ga({component:go}),gF=ma({getParentRoute:()=>hF,path:`/`,component:()=>(0,x.jsx)(Yi,{to:`/overview`})}),_F=ma({getParentRoute:()=>hF,path:`/overview`,component:Io}),vF=ma({getParentRoute:()=>hF,path:`/knowledge`,component:Ro}),yF=ma({getParentRoute:()=>hF,path:`/knowledge/$layer`,component:Ho}),bF=ma({getParentRoute:()=>hF,path:`/knowledge/$layer/$artifactId`,component:Gg}),xF=ma({getParentRoute:()=>hF,path:`/work-items`,component:n_}),SF=ma({getParentRoute:()=>hF,path:`/work-items/new`,component:Ax}),CF=ma({getParentRoute:()=>hF,path:`/work-items/$workItemId`,component:Sx}),wF=ma({getParentRoute:()=>hF,path:`/work-items/$workItemId/edit`,component:Xx}),TF=ma({getParentRoute:()=>hF,path:`/system`,component:IP,validateSearch:e=>({node:typeof e.node==`string`?e.node:void 0,workItem:typeof e.workItem==`string`?e.workItem:void 0})}),EF=ma({getParentRoute:()=>hF,path:`/integrations`,component:tF}),DF=ma({getParentRoute:()=>hF,path:`/external-items`,component:pF}),OF=Na({routeTree:hF.addChildren([gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF])});function kF(){return(0,x.jsx)(w,{client:mF,children:(0,x.jsx)(Ia,{router:OF})})}V.initSession().catch(()=>{}),(0,y.createRoot)(document.getElementById(`root`)).render((0,x.jsx)(v.StrictMode,{children:(0,x.jsx)(kF,{})}));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>admin</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-MJauSqlv.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DNkI-1xG.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/core.js
CHANGED
|
@@ -9615,6 +9615,50 @@ function integrationConfigFromInput(input) {
|
|
|
9615
9615
|
timeoutMs: input.timeoutMs
|
|
9616
9616
|
};
|
|
9617
9617
|
}
|
|
9618
|
+
function validateConfigAgainstSchema(config, schema) {
|
|
9619
|
+
const findings = [];
|
|
9620
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
9621
|
+
const value = config[key];
|
|
9622
|
+
const missing = value === void 0 || value === null || typeof value === "string" && !value.trim();
|
|
9623
|
+
if (field.required && missing) {
|
|
9624
|
+
findings.push({ field: key, message: `${field.label} is required.` });
|
|
9625
|
+
continue;
|
|
9626
|
+
}
|
|
9627
|
+
if (missing) continue;
|
|
9628
|
+
switch (field.type) {
|
|
9629
|
+
case "url":
|
|
9630
|
+
if (typeof value !== "string" || !/^https?:\/\/.+/.test(value)) {
|
|
9631
|
+
findings.push({ field: key, message: `${field.label} must be a valid URL.` });
|
|
9632
|
+
}
|
|
9633
|
+
break;
|
|
9634
|
+
case "number":
|
|
9635
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
9636
|
+
findings.push({ field: key, message: `${field.label} must be a number.` });
|
|
9637
|
+
}
|
|
9638
|
+
break;
|
|
9639
|
+
case "boolean":
|
|
9640
|
+
if (typeof value !== "boolean") {
|
|
9641
|
+
findings.push({ field: key, message: `${field.label} must be a boolean.` });
|
|
9642
|
+
}
|
|
9643
|
+
break;
|
|
9644
|
+
case "select":
|
|
9645
|
+
if (field.options && !field.options.some((o) => o.value === value)) {
|
|
9646
|
+
findings.push({ field: key, message: `${field.label} must be one of the available options.` });
|
|
9647
|
+
}
|
|
9648
|
+
break;
|
|
9649
|
+
case "multi-select":
|
|
9650
|
+
if (!Array.isArray(value)) {
|
|
9651
|
+
findings.push({ field: key, message: `${field.label} must be an array.` });
|
|
9652
|
+
} else if (field.options) {
|
|
9653
|
+
const valid = new Set(field.options.map((o) => o.value));
|
|
9654
|
+
const invalid = value.filter((v) => !valid.has(String(v)));
|
|
9655
|
+
if (invalid.length) findings.push({ field: key, message: `${field.label} contains invalid options.` });
|
|
9656
|
+
}
|
|
9657
|
+
break;
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
|
+
return findings;
|
|
9661
|
+
}
|
|
9618
9662
|
function mergeFilters(base, overlay) {
|
|
9619
9663
|
if (!base && !overlay) return {};
|
|
9620
9664
|
if (!base) return { ...overlay };
|
|
@@ -9922,7 +9966,7 @@ function createMockAdapter(opts = {}) {
|
|
|
9922
9966
|
},
|
|
9923
9967
|
secretSchema: {
|
|
9924
9968
|
token: {
|
|
9925
|
-
type: "
|
|
9969
|
+
type: "password",
|
|
9926
9970
|
required: false,
|
|
9927
9971
|
label: "API Token",
|
|
9928
9972
|
description: "Optional token for testing secret handling (not used by the mock adapter)."
|
|
@@ -10138,10 +10182,18 @@ function validateId(id) {
|
|
|
10138
10182
|
function createIntegration(dir, input) {
|
|
10139
10183
|
validateId(input.id);
|
|
10140
10184
|
if (!input.adapter || !input.adapter.trim()) throw new IntegrationServiceError("INTEGRATION_INVALID_INPUT", "An adapter type is required.");
|
|
10185
|
+
const adapter = registry.get(input.adapter);
|
|
10186
|
+
if (!adapter) throw new IntegrationServiceError("ADAPTER_NOT_FOUND", `Unknown integration adapter "${input.adapter}".`);
|
|
10141
10187
|
const { integrations } = loadIntegrations(dir);
|
|
10142
10188
|
if (integrations.find((i) => i.id === input.id)) {
|
|
10143
10189
|
throw new IntegrationServiceError("INTEGRATION_ALREADY_EXISTS", `An integration with id "${input.id}" already exists.`);
|
|
10144
10190
|
}
|
|
10191
|
+
if (adapter.metadata.configSchema && input.config) {
|
|
10192
|
+
const findings = validateConfigAgainstSchema(input.config, adapter.metadata.configSchema);
|
|
10193
|
+
if (findings.length) {
|
|
10194
|
+
throw new IntegrationServiceError("INTEGRATION_INVALID_INPUT", findings.map((f) => f.message).join(" "));
|
|
10195
|
+
}
|
|
10196
|
+
}
|
|
10145
10197
|
const newConfig = integrationConfigFromInput(input);
|
|
10146
10198
|
integrations.push(newConfig);
|
|
10147
10199
|
saveIntegrations(dir, integrations);
|
|
@@ -10152,8 +10204,17 @@ function updateIntegration(dir, id, input) {
|
|
|
10152
10204
|
const idx = integrations.findIndex((i) => i.id === id);
|
|
10153
10205
|
if (idx < 0) throw new IntegrationServiceError("INTEGRATION_NOT_CONFIGURED", `No integration "${id}" is configured.`);
|
|
10154
10206
|
const existing = integrations[idx];
|
|
10207
|
+
if (input.config !== void 0) {
|
|
10208
|
+
const adapter = registry.get(existing.adapter);
|
|
10209
|
+
if (adapter?.metadata.configSchema) {
|
|
10210
|
+
const findings = validateConfigAgainstSchema(input.config, adapter.metadata.configSchema);
|
|
10211
|
+
if (findings.length) {
|
|
10212
|
+
throw new IntegrationServiceError("INTEGRATION_INVALID_INPUT", findings.map((f) => f.message).join(" "));
|
|
10213
|
+
}
|
|
10214
|
+
}
|
|
10215
|
+
existing.config = input.config;
|
|
10216
|
+
}
|
|
10155
10217
|
if (input.enabled !== void 0) existing.enabled = input.enabled;
|
|
10156
|
-
if (input.config !== void 0) existing.config = input.config;
|
|
10157
10218
|
if (input.secrets !== void 0) existing.secrets = input.secrets;
|
|
10158
10219
|
if (input.timeoutMs !== void 0) existing.timeoutMs = input.timeoutMs;
|
|
10159
10220
|
integrations[idx] = existing;
|
|
@@ -10447,6 +10508,7 @@ export {
|
|
|
10447
10508
|
updateIntegration,
|
|
10448
10509
|
updateIntegrationFilters,
|
|
10449
10510
|
updateWorkItem,
|
|
10511
|
+
validateConfigAgainstSchema,
|
|
10450
10512
|
validateSystemTopology,
|
|
10451
10513
|
validateTopologyProposal,
|
|
10452
10514
|
validateWorkItem,
|
package/dist/index.js
CHANGED
|
@@ -18060,7 +18060,7 @@ function createMockAdapter(opts = {}) {
|
|
|
18060
18060
|
},
|
|
18061
18061
|
secretSchema: {
|
|
18062
18062
|
token: {
|
|
18063
|
-
type: "
|
|
18063
|
+
type: "password",
|
|
18064
18064
|
required: false,
|
|
18065
18065
|
label: "API Token",
|
|
18066
18066
|
description: "Optional token for testing secret handling (not used by the mock adapter)."
|