@exaudeus/workrail 3.34.2 → 3.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console-ui/assets/{index-DSRkHTz1.js → index-D7jQyCSD.js} +2 -2
- package/dist/console-ui/index.html +1 -1
- package/dist/daemon/workflow-runner.d.ts +1 -0
- package/dist/daemon/workflow-runner.js +148 -10
- package/dist/manifest.json +8 -8
- package/docs/design/daemon-complete-step-tool-candidates.md +160 -0
- package/docs/design/daemon-complete-step-tool-design-review.md +82 -0
- package/docs/design/daemon-complete-step-tool-implementation-plan.md +166 -0
- package/docs/ideas/backlog.md +395 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ Error generating stack: `+e.message+`
|
|
|
12
12
|
`,`
|
|
13
13
|
+`).split(`
|
|
14
14
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,V.useEffect)(()=>{let n=t?.target??qh,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)&&Ep(e))return!1;let n=Xh(e.code,s);if(a.current.add(e[n]),Yh(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=Xh(e.code,s);Yh(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 Yh(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Xh(e,t){return t.includes(e)?`code`:`key`}var Zh=()=>{let e=bh();return(0,V.useMemo)(()=>({zoomIn:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!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),Promise.resolve(!0)):Promise.resolve(!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=pp(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!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 cp(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=lp(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Qh(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)$h(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 $h(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);break}}function eg(e,t){return Qh(e,t)}function tg(e,t){return Qh(e,t)}function ng(e,t){return{id:e,type:`select`,selected:t}}function rg(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(ng(a.id,e)))}return r}function ig({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 ag(e){return{id:e.id,type:`remove`}}var og=e=>Ff(e),sg=e=>Pf(e);function cg(e){return(0,V.forwardRef)(e)}function lg(e){let[t,n]=(0,V.useState)(BigInt(0)),[r]=(0,V.useState)(()=>ug(()=>n(e=>e+BigInt(1))));return Rh(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function ug(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var dg=(0,V.createContext)(null);function fg({children:e}){let t=bh(),n=lg((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=ig({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=lg((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(ig({items:s,lookup:o}))},[])),i=(0,V.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,H.jsx)(dg.Provider,{value:i,children:e})}function pg(){let e=(0,V.useContext)(dg);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var mg=e=>!!e.panZoom;function hg(){let e=Zh(),t=bh(),n=pg(),r=X(mg),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=og(e)?e:n.get(e.id),a=i.parentId?vp(i.position,i.measured,i.parentId,n,r):i.position;return ep({...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&&og(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&&sg(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 Gf({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(ag);o?.(f),c(e)}if(m){let e=d.map(ag);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=ip(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=ep(s?r:a),l=rp(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=ip(e)?e:a(e);if(!r)return!1;let i=rp(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 Rf(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??bp();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 gg=e=>e.selected,_g=typeof window<`u`?window:void 0;function vg({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=bh(),{deleteElements:r}=hg(),i=Jh(e,{actInsideInputWithModifier:!1}),a=Jh(t,{target:_g});(0,V.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(gg),edges:e.filter(gg)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,V.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function yg(e){let t=bh();(0,V.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Cp(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Sf.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 bg={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},xg=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Sg({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Df.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=bh(),S=(0,V.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=X(xg,gh),E=Jh(f),D=(0,V.useRef)();yg(S);let O=(0,V.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,V.useEffect)(()=>{if(S.current){D.current=Jm({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,V.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,H.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:bg,children:m})}var Cg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function wg(){let{userSelectionActive:e,userSelectionRect:t}=X(Cg,gh);return e&&t?(0,H.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Tg=(e,t)=>n=>{n.target===t.current&&e?.(n)},Eg=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Dg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Of.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:s,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){let h=bh(),{userSelectionActive:g,elementsSelectable:_,dragging:v,connectionInProgress:y}=X(Eg,gh),b=_&&(e||g),x=(0,V.useRef)(null),S=(0,V.useRef)(),C=(0,V.useRef)(new Set),w=(0,V.useRef)(new Set),T=(0,V.useRef)(!1),E=e=>{if(T.current||y){T.current=!1;return}c?.(e),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},D=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}l?.(e)},O=u?e=>u(e):void 0;return(0,H.jsxs)(`div`,{className:Vo([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:v,selection:e}]),onClick:b?void 0:Tg(E,x),onContextMenu:Tg(D,x),onWheel:Tg(O,x),onPointerEnter:b?void 0:d,onPointerMove:b?e=>{let{userSelectionRect:r,transform:a,nodeLookup:s,edgeLookup:c,connectionLookup:l,triggerNodeChanges:u,triggerEdgeChanges:d,defaultEdgeOptions:f,resetSelectedElements:p}=h.getState();if(!S.current||!r)return;let{x:m,y:g}=Op(e.nativeEvent,S.current),{startX:_,startY:v}=r;if(!T.current){let n=t?0:i;if(Math.hypot(m-_,g-v)<=n)return;p(),o?.(e)}T.current=!0;let y={startX:_,startY:v,x:m<_?m:_,y:g<v?g:v,width:Math.abs(m-_),height:Math.abs(g-v)},b=C.current,x=w.current;C.current=new Set(Bf(s,y,a,n===Of.Partial,!0).map(e=>e.id)),w.current=new Set;let E=f?.selectable??!0;for(let e of C.current){let t=l.get(e);if(t)for(let{edgeId:e}of t.values()){let t=c.get(e);t&&(t.selectable??E)&&w.current.add(e)}}yp(b,C.current)||u(rg(s,C.current,!0)),yp(x,w.current)||d(rg(c,w.current)),h.setState({userSelectionRect:y,userSelectionActive:!0,nodesSelectionActive:!1})}:f,onPointerUp:b?e=>{e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!g&&e.target===x.current&&h.getState().userSelectionRect&&E?.(e),h.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(s?.(e),h.setState({nodesSelectionActive:C.current.size>0})))}:void 0,onPointerDownCapture:b?n=>{let{domNode:r}=h.getState();if(S.current=r?.getBoundingClientRect(),!S.current)return;let i=n.target===x.current;if(!i&&n.target.closest(`.nokey`)||!e||!(a&&i||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),T.current=!1;let{x:o,y:s}=Op(n.nativeEvent,S.current);h.setState({userSelectionRect:{width:0,height:0,startX:o,startY:s,x:o,y:s}}),i||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:b?e=>{T.current&&=(e.stopPropagation(),!1)}:void 0,onPointerLeave:p,ref:x,style:bg,children:[m,(0,H.jsx)(wg,{})]})}function Og({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`,Sf.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function kg({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=bh(),[c,l]=(0,V.useState)(!1),u=(0,V.useRef)();return(0,V.useEffect)(()=>{u.current=Cm({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Og({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,V.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Ag=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function jg(){let e=bh();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=Ag(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=sp(t,i));let{position:a,positionAbsolute:s}=Wf({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 Mg=(0,V.createContext)(null),Ng=Mg.Provider;Mg.Consumer;var Pg=()=>(0,V.useContext)(Mg),Fg=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ig=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,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===Ef.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Lg({type:e=`source`,position:t=Y.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=bh(),_=Pg(),{connectOnClick:v,noPanClassName:y,rfId:b}=X(Fg,gh),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=X(Ig(_,m,e),gh);_||g.getState().onError?.(`010`,Sf.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(zp(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Dp(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Nm.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:O,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,H.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Vo([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,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=wp(t.target),h=n||c,{connection:v,isValid:y}=Nm.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&&O(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 Rg=(0,V.memo)(cg(Lg));function zg({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return(0,H.jsxs)(H.Fragment,{children:[e?.label,(0,H.jsx)(Rg,{type:`source`,position:n,isConnectable:t})]})}function Bg({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:r=Y.Bottom}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Rg,{type:`target`,position:n,isConnectable:t}),e?.label,(0,H.jsx)(Rg,{type:`source`,position:r,isConnectable:t})]})}function Vg(){return null}function Hg({data:e,isConnectable:t,targetPosition:n=Y.Top}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Rg,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Ug={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Wg={input:zg,default:Bg,output:Hg,group:Vg};function Gg(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 Kg=e=>{let{width:t,height:n,x:r,y:i}=zf(e.nodeLookup,{filter:e=>!!e.selected});return{width:ap(t)?t:null,height:ap(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 qg({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=bh(),{width:i,height:a,transformString:o,userSelectionActive:s}=X(Kg,gh),c=jg(),l=(0,V.useRef)(null);(0,V.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(kg({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,H.jsx)(`div`,{className:Vo([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,H.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(Ug,e.key)&&(e.preventDefault(),c({direction:Ug[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Jg=typeof window<`u`?window:void 0,Yg=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Xg({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:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,preventScrolling:k,onSelectionContextMenu:A,noWheelClassName:j,noPanClassName:M,disableKeyboardA11y:N,onViewportChange:P,isControlledViewport:ee}){let{nodesSelectionActive:F,userSelectionActive:I}=X(Yg,gh),L=Jh(l,{target:Jg}),te=Jh(h,{target:Jg}),ne=te||w,R=te||b,z=u&&ne!==!0,B=L||I||z;return vg({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,H.jsx)(Sg,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!L&&ne,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,zoomActivationKeyCode:g,preventScrolling:k,noWheelClassName:j,noPanClassName:M,onViewportChange:P,isControlledViewport:ee,paneClickDistance:s,selectionOnDrag:z,children:(0,H.jsxs)(Dg,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ne,isSelecting:!!B,selectionMode:d,selectionKeyPressed:L,paneClickDistance:s,selectionOnDrag:z,children:[e,F&&(0,H.jsx)(qg,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}Xg.displayName=`FlowRenderer`;var Zg=(0,V.memo)(Xg),Qg=e=>t=>e?Bf(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 $g(e){return X((0,V.useCallback)(Qg(e),[e]),gh)}var e_=e=>e.updateNodeInternals;function t_(){let e=X(e_),[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 n_({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=bh(),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 r_({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:x}=X(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},gh),S=y.type||`default`,C=g?.[S]||Wg[S];C===void 0&&(v?.(`003`,Sf.error003(S)),S=`default`,C=g?.default||Wg.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=bh(),k=_p(y),A=n_({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=kg({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=jg();if(y.hidden)return null;let N=gp(y),P=Gg(y),ee=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,R=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Og({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},z=t=>{if(!(Ep(t.nativeEvent)||m)){if(wf.includes(t.key)&&T)Og({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Ug,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Ug[t.key],factor:t.shiftKey?4:1})}}},B=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Bf(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,H.jsx)(`div`,{className:Vo([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:R,onDoubleClick:ne,onKeyDown:D?z:void 0,tabIndex:D?0:void 0,onFocus:D?B:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Ch}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,H.jsx)(Ng,{value:e,children:(0,H.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var i_=(0,V.memo)(r_),a_=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function o_(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=X(a_,gh),o=$g(e.onlyRenderVisibleElements),s=t_();return(0,H.jsx)(`div`,{className:`react-flow__nodes`,style:bg,children:o.map(o=>(0,H.jsx)(i_,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}o_.displayName=`NodeRenderer`;var s_=(0,V.memo)(o_);function c_(e){return X((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&&Ip({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),gh)}var l_=({color:e=`none`,strokeWidth:t=1})=>(0,H.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),u_=({color:e=`none`,strokeWidth:t=1})=>(0,H.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),d_={[jf.Arrow]:l_,[jf.ArrowClosed]:u_};function f_(e){let t=bh();return(0,V.useMemo)(()=>Object.prototype.hasOwnProperty.call(d_,e)?d_[e]:(t.getState().onError?.(`009`,Sf.error009(e)),null),[e])}var p_=({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=f_(t);return c?(0,H.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,H.jsx)(c,{color:n,strokeWidth:o})}):null},m_=({defaultColor:e,rfId:t})=>{let n=X(e=>e.edges),r=X(e=>e.defaultEdgeOptions),i=(0,V.useMemo)(()=>$p(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,H.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,H.jsx)(`defs`,{children:i.map(e=>(0,H.jsx)(p_,{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};m_.displayName=`MarkerDefinitions`;var h_=(0,V.memo)(m_);function g_({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=Vo([`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,H.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,H.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,H.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}g_.displayName=`EdgeText`;var __=(0,V.memo)(g_);function v_({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{...u,d:e,fill:`none`,className:Vo([`react-flow__edge-path`,u.className])}),l?(0,H.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ap(t)&&ap(n)?(0,H.jsx)(__,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function y_({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Y.Left||e===Y.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function b_({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:i,targetPosition:a=Y.Top}){let[o,s]=y_({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=y_({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Ap({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 x_(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]=b_({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,H.jsx)(v_,{id:e.isInternal?void 0:t,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 S_=x_({isInternal:!1}),C_=x_({isInternal:!0});S_.displayName=`SimpleBezierEdge`,C_.displayName=`SimpleBezierEdgeInternal`;function w_(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=Y.Bottom,targetPosition:m=Y.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Kp({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,H.jsx)(v_,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var T_=w_({isInternal:!1}),E_=w_({isInternal:!0});T_.displayName=`SmoothStepEdge`,E_.displayName=`SmoothStepEdgeInternal`;function D_(e){return(0,V.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,H.jsx)(T_,{...n,id:r,pathOptions:(0,V.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var O_=D_({isInternal:!1}),k_=D_({isInternal:!0});O_.displayName=`StepEdge`,k_.displayName=`StepEdgeInternal`;function A_(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]=Bp({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,H.jsx)(v_,{id:e.isInternal?void 0:t,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 j_=A_({isInternal:!1}),M_=A_({isInternal:!0});j_.displayName=`StraightEdge`,M_.displayName=`StraightEdgeInternal`;function N_(e){return(0,V.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Y.Bottom,targetPosition:s=Y.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,x]=Np({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,H.jsx)(v_,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var P_=N_({isInternal:!1}),F_=N_({isInternal:!0});P_.displayName=`BezierEdge`,F_.displayName=`BezierEdgeInternal`;var I_={default:F_,straight:M_,step:k_,smoothstep:E_,simplebezier:C_},L_={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},R_=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,z_=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,B_=`react-flow__edgeupdater`;function V_({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,H.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Vo([B_,`${B_}-${s}`]),cx:R_(t,r,e),cy:z_(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function H_({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=bh(),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`;Nm.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,H.jsxs)(H.Fragment,{children:[(e===!0||e===`source`)&&(0,H.jsx)(V_,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,H.jsx)(V_,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function U_({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:v}){let y=X(t=>t.edgeLookup.get(e)),b=X(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||I_[x];S===void 0&&(_?.(`011`,Sf.error011(x)),x=`default`,S=h?.default||I_.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,V.useRef)(null),[D,O]=(0,V.useState)(!1),[k,A]=(0,V.useState)(!1),j=bh(),{zIndex:M,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L}=X((0,V.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...L_};let i=Jp({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:Fp({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||L_}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),gh),te=(0,V.useMemo)(()=>y.markerStart?`url('#${Qp(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,V.useMemo)(()=>y.markerEnd?`url('#${Qp(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||F===null)return null;let R=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},z=a?e=>{a(e,{...y})}:void 0,B=o?e=>{o(e,{...y})}:void 0,re=s?e=>{s(e,{...y})}:void 0,ie=c?e=>{c(e,{...y})}:void 0,ae=l?e=>{l(e,{...y})}:void 0;return(0,H.jsx)(`svg`,{style:{zIndex:M},children:(0,H.jsxs)(`g`,{className:Vo([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:R,onDoubleClick:z,onContextMenu:B,onMouseEnter:re,onMouseMove:ie,onMouseLeave:ae,onKeyDown:C?t=>{if(!v&&wf.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${wh}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,H.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,H.jsx)(H_,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var W_=(0,V.memo)(U_),G_=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function K_({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}=X(G_,gh),b=c_(t);return(0,H.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,H.jsx)(h_,{defaultColor:e,rfId:n}),b.map(e=>(0,H.jsx)(W_,{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))]})}K_.displayName=`EdgeRenderer`;var q_=(0,V.memo)(K_),J_=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Y_({children:e}){return(0,H.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:X(J_)},children:e})}function X_(e){let t=hg(),n=(0,V.useRef)(!1);(0,V.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Z_=e=>e.panZoom?.syncViewport;function Q_(e){let t=X(Z_),n=bh();return(0,V.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function $_(e){return e.connection.inProgress?{...e.connection,to:cp(e.connection.to,e.transform)}:{...e.connection}}function ev(e){return e?t=>e($_(t)):$_}function tv(e){return X(ev(e),gh)}var nv=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function rv({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=X(nv,gh);return a&&i&&c?(0,H.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,H.jsx)(`g`,{className:Vo([`react-flow__connection`,Nf(s)]),children:(0,H.jsx)(iv,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var iv=({style:e,type:t=Af.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}=tv();if(!i)return;if(n)return(0,H.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:Nf(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 Af.Bezier:[m]=Np(h);break;case Af.SimpleBezier:[m]=b_(h);break;case Af.Step:[m]=Kp({...h,borderRadius:0});break;case Af.SmoothStep:[m]=Kp(h);break;default:[m]=Bp(h)}return(0,H.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};iv.displayName=`ConnectionLine`;var av={};function ov(e=av){(0,V.useRef)(e),bh(),(0,V.useEffect)(()=>{},[e])}function sv(){bh(),(0,V.useRef)(!1),(0,V.useEffect)(()=>{},[])}function cv({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:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,onPaneClick:ne,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:B,onPaneScroll:re,onPaneContextMenu:ie,paneClickDistance:ae,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,viewport:xe,onViewportChange:Se}){return ov(e),ov(t),sv(),X_(n),Q_(xe),(0,H.jsx)(Zg,{onPaneClick:ne,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:B,onPaneContextMenu:ie,onPaneScroll:re,paneClickDistance:ae,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,onViewportChange:Se,isControlledViewport:!!xe,children:(0,H.jsxs)(Y_,{children:[(0,H.jsx)(q_,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,defaultMarkerColor:M,noPanClassName:_e,disableKeyboardA11y:ve,rfId:be}),(0,H.jsx)(rv,{style:h,type:m,component:g,containerStyle:_}),(0,H.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,H.jsx)(s_,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be}),(0,H.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}cv.displayName=`GraphView`;var lv=(0,V.memo)(cv),uv=({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??Cf;_m(h,g,_);let{nodesInitialized:x}=cm(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=pp(zf(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:Cf,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ef.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:{...kf},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:op,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Tf,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},dv=({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})=>hh((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 Uf({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...uv({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,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=cm(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();_m(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}=mm(e,n,r,i,a,o,l);d&&(am(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=Xp(e,o.fromHandle,Y.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=pm(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(eg(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(tg(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=>ng(e,!0)));return}i(rg(r,new Set([...e]),!0)),a(rg(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>ng(e,!0)));return}a(rg(n,new Set([...e]))),i(rg(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(ng(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(ng(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,ng(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,ng(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]||(cm(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 hm({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 Promise.resolve(!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}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...kf}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...uv()})}},Object.is);function fv({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)(()=>dv({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,H.jsx)(vh,{value:m,children:(0,H.jsx)(fg,{children:p})})}function pv({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)(_h)?(0,H.jsx)(H.Fragment,{children:e}):(0,H.jsx)(fv,{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 mv={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function hv({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:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:F,connectionMode:I,connectionLineType:L=Af.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:R,deleteKeyCode:z=`Backspace`,selectionKeyCode:B=`Shift`,selectionOnDrag:re=!1,selectionMode:ie=Of.Full,panActivationKeyCode:ae=`Space`,multiSelectionKeyCode:oe=mp()?`Meta`:`Control`,zoomActivationKeyCode:se=mp()?`Meta`:`Control`,snapToGrid:ce,snapGrid:le,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:de,nodesDraggable:fe,autoPanOnNodeFocus:pe,nodesConnectable:me,nodesFocusable:he,nodeOrigin:ge=zh,edgesFocusable:_e,edgesReconnectable:ve,elementsSelectable:ye=!0,defaultViewport:be=Bh,minZoom:xe=.5,maxZoom:Se=2,translateExtent:Ce=Cf,preventScrolling:we=!0,nodeExtent:Te,defaultMarkerColor:Ee=`#b1b1b7`,zoomOnScroll:De=!0,zoomOnPinch:Oe=!0,panOnScroll:ke=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:je=Df.Free,zoomOnDoubleClick:Me=!0,panOnDrag:Ne=!0,onPaneClick:Pe,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:He,onReconnect:Ue,onReconnectStart:We,onReconnectEnd:Ge,onEdgeContextMenu:Ke,onEdgeDoubleClick:qe,onEdgeMouseEnter:Je,onEdgeMouseMove:Ye,onEdgeMouseLeave:Xe,reconnectRadius:Ze=10,onNodesChange:Qe,onEdgesChange:$e,noDragClassName:et=`nodrag`,noWheelClassName:tt=`nowheel`,noPanClassName:nt=`nopan`,fitView:rt,fitViewOptions:it,connectOnClick:at,attributionPosition:ot,proOptions:st,defaultEdgeOptions:ct,elevateNodesOnSelect:lt=!0,elevateEdgesOnSelect:ut=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:mt,connectionRadius:ht,isValidConnection:gt,onError:_t,style:vt,id:yt,nodeDragThreshold:bt,connectionDragThreshold:xt,viewport:St,onViewportChange:Ct,width:wt,height:Tt,colorMode:Et=`light`,debug:Dt,onScroll:Ot,ariaLabelConfig:kt,zIndexMode:At=`basic`,...jt},Mt){let Nt=yt||`1`,Pt=Kh(Et),Ft=(0,V.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ot?.(e)},[Ot]);return(0,H.jsx)(`div`,{"data-testid":`rf__wrapper`,...jt,onScroll:Ft,style:{...vt,...mv},ref:Mt,className:Vo([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,H.jsxs)(pv,{nodes:e,edges:t,width:wt,height:Tt,fitView:rt,fitViewOptions:it,minZoom:xe,maxZoom:Se,nodeOrigin:ge,nodeExtent:Te,zIndexMode:At,children:[(0,H.jsx)(Wh,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:fe,autoPanOnNodeFocus:pe,nodesConnectable:me,nodesFocusable:he,edgesFocusable:_e,edgesReconnectable:ve,elementsSelectable:ye,elevateNodesOnSelect:lt,elevateEdgesOnSelect:ut,minZoom:xe,maxZoom:Se,nodeExtent:Te,onNodesChange:Qe,onEdgesChange:$e,snapToGrid:ce,snapGrid:le,connectionMode:I,translateExtent:Ce,connectOnClick:at,defaultEdgeOptions:ct,fitView:rt,fitViewOptions:it,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:nt,nodeOrigin:ge,rfId:Nt,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:mt,onError:_t,connectionRadius:ht,isValidConnection:gt,selectNodesOnDrag:de,nodeDragThreshold:bt,connectionDragThreshold:xt,onBeforeDelete:F,debug:Dt,ariaLabelConfig:kt,zIndexMode:At}),(0,H.jsx)(lv,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:R,selectionKeyCode:B,selectionOnDrag:re,selectionMode:ie,deleteKeyCode:z,multiSelectionKeyCode:oe,panActivationKeyCode:ae,zoomActivationKeyCode:se,onlyRenderVisibleElements:ue,defaultViewport:be,translateExtent:Ce,minZoom:xe,maxZoom:Se,preventScrolling:we,zoomOnScroll:De,zoomOnPinch:Oe,zoomOnDoubleClick:Me,panOnScroll:ke,panOnScrollSpeed:Ae,panOnScrollMode:je,panOnDrag:Ne,onPaneClick:Pe,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:Ue,onReconnectStart:We,onReconnectEnd:Ge,onEdgeContextMenu:Ke,onEdgeDoubleClick:qe,onEdgeMouseEnter:Je,onEdgeMouseMove:Ye,onEdgeMouseLeave:Xe,reconnectRadius:Ze,defaultMarkerColor:Ee,noDragClassName:et,noWheelClassName:tt,noPanClassName:nt,rfId:Nt,disableKeyboardA11y:dt,nodeExtent:Te,viewport:St,onViewportChange:Ct}),(0,H.jsx)(Lh,{onSelectionChange:k}),He,(0,H.jsx)(jh,{proOptions:st,position:ot}),(0,H.jsx)(kh,{rfId:Nt,disableKeyboardA11y:dt})]})})}var gv=cg(hv);Sf.error014();function _v({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,H.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Vo([`react-flow__background-pattern`,n,r])})}function vv({radius:e,className:t}){return(0,H.jsx)(`circle`,{cx:e,cy:e,r:e,className:Vo([`react-flow__background-pattern`,`dots`,t])})}var yv;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(yv||={});var bv={[yv.Dots]:1,[yv.Lines]:1,[yv.Cross]:6},xv=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Sv({id:e,variant:t=yv.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}=X(xv,gh),m=r||bv[t],h=t===yv.Dots,g=t===yv.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,H.jsxs)(`svg`,{className:Vo([`react-flow__background`,l]),style:{...c,...bg,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,H.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,H.jsx)(vv,{radius:y/2,className:u}):(0,H.jsx)(_v,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,H.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Sv.displayName=`Background`,(0,V.memo)(Sv);function Cv(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,H.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function wv(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,H.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Tv(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,H.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function Ev(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,H.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function Dv(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,H.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function Ov({children:e,className:t,...n}){return(0,H.jsx)(`button`,{type:`button`,className:Vo([`react-flow__controls-button`,t]),...n,children:e})}var kv=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Av({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=bh(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=X(kv,gh),{zoomIn:y,zoomOut:b,fitView:x}=hg();return(0,H.jsxs)(Ah,{className:Vo([`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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ov,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,H.jsx)(Cv,{})}),(0,H.jsx)(Ov,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,H.jsx)(wv,{})})]}),n&&(0,H.jsx)(Ov,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,H.jsx)(Tv,{})}),r&&(0,H.jsx)(Ov,{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,H.jsx)(Dv,{}):(0,H.jsx)(Ev,{})}),u]})}Av.displayName=`Controls`,(0,V.memo)(Av);function jv({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,H.jsx)(`rect`,{className:Vo([`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 Mv=(0,V.memo)(jv),Nv=e=>e.nodes.map(e=>e.id),Pv=e=>e instanceof Function?e:()=>e;function Fv({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Mv,onClick:o}){let s=X(Nv,gh),c=Pv(t),l=Pv(e),u=Pv(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,H.jsx)(H.Fragment,{children:s.map(e=>(0,H.jsx)(Lv,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Iv({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}=X(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}=gp(r);return{node:r,x:i,y:a,width:o,height:s}},gh);return!l||l.hidden||!_p(l)?null:(0,H.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 Lv=(0,V.memo)(Iv),Rv=(0,V.memo)(Fv),zv=200,Bv=150,Vv=e=>!e.hidden,Hv=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]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?np(zf(e.nodeLookup,{filter:Vv}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Uv=`react-flow__minimap-desc`;function Wv({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:v,zoomStep:y=1,offsetScale:b=5}){let x=bh(),S=(0,V.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=X(Hv,gh),j=e?.width??zv,M=e?.height??Bv,N=C.width/j,P=C.height/M,ee=Math.max(N,P),F=ee*j,I=ee*M,L=b*ee,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,R=F+L*2,z=I+L*2,B=`${Uv}-${T}`,re=(0,V.useRef)(0),ie=(0,V.useRef)();re.current=ee,(0,V.useEffect)(()=>{if(S.current&&E)return ie.current=Pm({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>re.current}),()=>{ie.current?.destroy()}},[E]),(0,V.useEffect)(()=>{ie.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ae=p?e=>{let[t,n]=ie.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,oe=m?(0,V.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,se=_??A[`minimap.ariaLabel`];return(0,H.jsx)(Ah,{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*ee: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:Vo([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,H.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${R} ${z}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":B,ref:S,onClick:ae,children:[se&&(0,H.jsx)(`title`,{id:B,children:se}),(0,H.jsx)(Rv,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,H.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${R+L*2}v${z+L*2}h${-R-L*2}z
|
|
15
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Wv.displayName=`MiniMap`,(0,V.memo)(Wv);var Gv=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Kv={[Ym.Line]:`right`,[Ym.Handle]:`bottom-right`};function qv({nodeId:e,position:t,variant:n=Ym.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 v=Pg(),y=typeof e==`string`?e:v,b=bh(),x=(0,V.useRef)(null),S=n===Ym.Handle,C=X((0,V.useCallback)(Gv(S&&p),[S,p]),gh),w=(0,V.useRef)(null),T=t??Kv[n];return(0,V.useEffect)(()=>{if(!(!x.current||!y))return w.current||=sh({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.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}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);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=pm([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...vp({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:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,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:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,H.jsx)(`div`,{className:Vo([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,V.memo)(qv);function Jv(e){if(e.nodes.length===0)return{nodes:[],edges:[],graphWidth:112,graphHeight:112,currentNodeId:null,startNodeId:null,latestBranchNodeId:null,summary:{currentNodeLabel:`No active node`,lineageNodeCount:0,sideNodeCount:0,alternateBranchCount:0,blockedAttemptCount:0}};let t=new Map(e.nodes.map(e=>[e.nodeId,e])),n=new Map;for(let t of e.nodes){if(!t.parentNodeId)continue;let e=n.get(t.parentNodeId)??[];e.push(t),n.set(t.parentNodeId,e)}for(let e of n.values())e.sort((e,t)=>e.createdAtEventIndex-t.createdAtEventIndex);let r=Yv(e),i=r?Xv(r,t):new Set,a=Zv(e.nodes,t),o=new Map,s=new Map,c=new Map,l=new Set,u=new Set,d=0,f=0,p=()=>{d+=1;let e=Math.ceil(d/2);return d%2==1?-e:e},m=(e,t,r,i)=>{if(o.has(e))return;o.set(e,t),s.set(e,r),c.set(e,i);let a=n.get(e)??[];if(a.length===0)return;let[l,...u]=a;l&&m(l.nodeId,t,r,i);let d=1;for(let e of u){let n=t<0?t-d:t+d;m(e.nodeId,n,r,i),d+=1}},h=[...i].sort((e,t)=>(a.get(e)??0)-(a.get(t)??0));for(let e of h){o.set(e,0),s.set(e,`active`),c.set(e,null);let t=n.get(e)??[];for(let e of t){if(i.has(e.nodeId))continue;f+=1;let t=e.nodeKind===`blocked_attempt`?`blocked`:`alternate`;t===`blocked`?u.add(e.nodeId):l.add(e.nodeId),m(e.nodeId,p(),t,f)}}let g=e.nodes.filter(e=>!e.parentNodeId||!t.has(e.parentNodeId)).sort((e,t)=>e.createdAtEventIndex-t.createdAtEventIndex);for(let e of g)if(!o.has(e.nodeId)){if(!i.has(e.nodeId)){f+=1;let t=e.nodeKind===`blocked_attempt`?`blocked`:`alternate`;t===`blocked`?u.add(e.nodeId):l.add(e.nodeId),m(e.nodeId,p(),t,f);continue}o.set(e.nodeId,0),s.set(e.nodeId,`active`),c.set(e.nodeId,null)}for(let t of e.nodes)if(!o.has(t.nodeId)){f+=1;let e=t.nodeKind===`blocked_attempt`?`blocked`:`alternate`;e===`blocked`?u.add(t.nodeId):l.add(t.nodeId),m(t.nodeId,p(),e,f)}let _=Math.min(...o.values()),v=Math.max(...o.values()),y=$v(e.nodes,a,t,i),b=e.nodes.map(e=>{let t=i.has(e.nodeId),n=y.get(e.nodeId)??0;return{node:e,depth:n,lane:o.get(e.nodeId)??0,x:656+n*268,y:56+((o.get(e.nodeId)??0)-_)*112,isActiveLineage:t,isCurrent:e.nodeId===r,branchKind:s.get(e.nodeId)??`alternate`,branchIndex:c.get(e.nodeId)??null}}),x=b.reduce((e,t)=>Math.max(e,t.depth),0),S=r?t.get(r)??null:null,C=[...l,...u].map(e=>t.get(e)).filter(e=>!!e).sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0]??null,w={currentNodeLabel:S?.stepLabel??(S?Qv(S.nodeId):`No active node`),lineageNodeCount:i.size,sideNodeCount:e.nodes.length-i.size,alternateBranchCount:l.size,blockedAttemptCount:e.nodes.filter(e=>e.nodeKind===`blocked_attempt`).length},T=new Set(b.map(e=>e.node.nodeId));return{nodes:b,edges:e.edges.filter(e=>T.has(e.fromNodeId)&&T.has(e.toNodeId)),graphWidth:1312+x*268+220,graphHeight:112+(v-_)*112+124,currentNodeId:r,startNodeId:h[0]??g[0]?.nodeId??null,latestBranchNodeId:C?.nodeId??null,summary:w}}function Yv(e){if(e.preferredTipNodeId)return e.preferredTipNodeId;let t=e.nodes.find(e=>e.isPreferredTip);if(t)return t.nodeId;let n=e.nodes.filter(e=>e.isTip).sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0];return n?n.nodeId:[...e.nodes].sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0]?.nodeId??null}function Xv(e,t){let n=new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=t.get(r)?.parentNodeId??null;r=e&&t.has(e)?e:null}return n}function Zv(e,t){let n=new Map,r=new Set,i=e=>{let a=n.get(e);if(a!==void 0)return a;if(r.has(e))return n.set(e,0),0;r.add(e);let o=t.get(e)?.parentNodeId??null;if(!o||!t.has(o))return n.set(e,0),r.delete(e),0;let s=i(o)+1;return n.set(e,s),r.delete(e),s};for(let t of e)i(t.nodeId);return n}function Qv(e){return e.slice(-8)}function $v(e,t,n,r){let i=new Map;for(let e of r)i.set(e,t.get(e)??0);let a=new Set,o=e=>{let r=i.get(e);if(r!==void 0)return r;if(a.has(e)){let n=t.get(e)??0;return i.set(e,n),n}a.add(e);let s=n.get(e)?.parentNodeId??null;if(!s||!n.has(s)){let n=t.get(e)??0;return i.set(e,n),a.delete(e),n}let c=o(s)+1;return i.set(e,c),a.delete(e),c};for(let t of e)i.has(t.nodeId)||o(t.nodeId);return i}function ey(e,t){if(e.length===0)return{nodes:[],requiredWidth:0,requiredHeight:0};let n=t.nodes.filter(e=>e.isActiveLineage);if(n.length===0)return{nodes:[],requiredWidth:0,requiredHeight:0};let r=656+(n.reduce((e,t)=>Math.max(e,t.depth),0)+1)*268;return{nodes:e.map((e,t)=>({stepId:e.stepId,stepLabel:e.stepLabel,x:r,y:56+t*112})),requiredWidth:r+220+600,requiredHeight:56+e.length*112+124}}function ty(e){return/\btrue\b|\bpass/i.test(e.summary)}function ny(e){return e.refs.find(e=>e.kind===`loop_id`)?.value??null}function ry(e){let t=[...e.filter(e=>e.kind!==`context_fact`)].sort((e,t)=>e.recordedAtEventIndex-t.recordedAtEventIndex),n=[],r=new Map,i=[];for(let e of t)if(e.kind===`entered_loop`){let t=ny(e);t?(r.set(t,{enteredItem:e,innerItems:[]}),i.push(t)):n.push({kind:`standalone`,item:e})}else if(e.kind===`exited_loop`){let t=ny(e),a=t?r.get(t):void 0;if(a&&t){r.delete(t);let o=i.lastIndexOf(t);o!==-1&&i.splice(o,1);let s=Math.max(1,a.innerItems.filter(e=>e.kind===`selected_next_step`).length);n.push({kind:`loop_group`,loopId:t,enteredItem:a.enteredItem,innerItems:a.innerItems,exitedItem:e,iterationCount:s})}else n.push({kind:`standalone`,item:e})}else{let t=i.at(-1),a=t?r.get(t):void 0;a?a.innerItems.push(e):n.push({kind:`standalone`,item:e})}for(let[,e]of r){n.push({kind:`standalone`,item:e.enteredItem});for(let t of e.innerItems)n.push({kind:`standalone`,item:t})}return n}function iy(e){switch(e.kind){case`evaluated_condition`:return`condition`;case`detected_non_tip_advance`:return`fork`;case`divergence`:return`divergence`;case`selected_next_step`:return`advance`;default:return null}}function ay(e,t){let n=null,r=-1;for(let i of t){let t=iy(i);t!==null&&(i.recordedAtEventIndex>e.createdAtEventIndex||i.recordedAtEventIndex>r&&(r=i.recordedAtEventIndex,n={kind:t,summary:i.summary}))}return n}function oy(e){let t=[];for(let n of e){if(n.kind!==`loop_group`)continue;let e=n.enteredItem.refs.filter(e=>e.kind===`node_id`).map(e=>e.value),r=n.exitedItem.refs.filter(e=>e.kind===`node_id`).map(e=>e.value),i=n.innerItems.flatMap(e=>e.refs.filter(e=>e.kind===`node_id`).map(e=>e.value)),a=[...new Set([...e,...r,...i])];t.push({loopId:n.loopId,iterationCount:n.iterationCount,nodeIds:a})}return t}function sy(e,t){let n=e.items.filter(e=>e.refs.some(e=>e.kind===`node_id`&&e.value===t));return{whySelected:n.filter(e=>e.kind===`selected_next_step`),conditions:n.filter(e=>e.kind===`evaluated_condition`),loops:n.filter(e=>e.kind===`entered_loop`||e.kind===`exited_loop`),divergences:n.filter(e=>e.kind===`divergence`),forks:n.filter(e=>e.kind===`detected_non_tip_advance`)}}function cy({run:e,selectedNodeId:t=null,onNodeClick:n}){let r=(0,V.useRef)(null),i=(0,V.useRef)(null),a=(0,V.useRef)(!1),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]);let d=(0,V.useMemo)(()=>Jv(e),[e]),f=(0,V.useMemo)(()=>new Map(d.nodes.map(e=>[e.node.nodeId,e])),[d.nodes]),p=e.status===`in_progress`,m=(0,V.useCallback)((e,t=`smooth`)=>{if(!e)return;let n=i.current,a=f.get(e);if(!n||!a)return;r.current?.scrollIntoView({behavior:t,block:`nearest`});let o=a.isActiveLineage?220:172,s=a.isActiveLineage?124:104;n.scrollTo({left:Math.max(0,a.x-n.clientWidth/2+o/2),top:Math.max(0,a.y-n.clientHeight/2+s/2),behavior:t})},[f]);(0,V.useEffect)(()=>{a.current||d.currentNodeId&&(a.current=!0,m(d.currentNodeId,`auto`))},[]);let h=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.executionTraceSummary,n=new Map;for(let r of e.nodes){if(r.nodeKind!==`blocked_attempt`)continue;let e=sy(t,r.nodeId),i=[...e.divergences,...e.forks,...e.conditions,...e.whySelected];n.set(r.nodeId,i)}return n},[e.executionTraceSummary,e.nodes]),{nodes:g,edges:_}=(0,V.useMemo)(()=>{let e=d.currentNodeId?d.edges.find(e=>e.toNodeId===d.currentNodeId)?.fromNodeId??null:null;return{nodes:d.nodes.map(e=>{let{node:n,isActiveLineage:r,isCurrent:i}=e,a=n.nodeId===t,o=r?220:172,s=gy(n,r,i,a),c=my(n,r),l=Sy(n,e.branchKind,e.branchIndex),u=h?.get(n.nodeId),f=n.nodeKind===`blocked_attempt`&&u!==void 0&&u.length>0,m=r?124:104,g=f?m+80:m;return{id:n.nodeId,position:{x:e.x,y:e.y},data:{label:(0,H.jsx)(ly,{node:n,isActiveLineage:r,isCurrent:i,isSelected:a,isLiveRun:p,branchKind:e.branchKind,branchIndex:e.branchIndex,displayLabel:l,stepNumber:r?e.depth+1:null,totalSteps:r?d.summary.lineageNodeCount:null,causeItems:u})},style:{width:o,height:g,padding:0,borderRadius:0,border:`1px solid ${s}`,background:c,color:`var(--text-primary)`,boxShadow:a?`0 0 0 1px rgba(244, 179, 65, 0.7), 0 0 18px rgba(244, 179, 65, 0.16)`:i?`0 0 0 1px rgba(0, 240, 255, 0.65), 0 0 24px rgba(0, 240, 255, 0.18)`:r?`0 0 16px rgba(0, 240, 255, 0.1)`:`none`,opacity:r?1:.72,cursor:`pointer`,display:`flex`,alignItems:`stretch`,justifyContent:`stretch`}}}),edges:d.edges.map((t,n)=>{let r=f.get(t.fromNodeId),i=f.get(t.toNodeId),a=!!(r?.isActiveLineage&&i?.isActiveLineage),o=p&&!!d.currentNodeId&&t.toNodeId===d.currentNodeId&&t.fromNodeId===e;return{id:`lineage-edge-${n}`,source:t.fromNodeId,target:t.toNodeId,type:`smoothstep`,animated:o,className:o?`workrail-current-lineage-edge`:void 0,style:{stroke:o?`var(--accent-strong)`:a?t.edgeKind===`checkpoint`?`var(--success)`:`var(--accent-strong)`:`rgba(123, 141, 167, 0.45)`,strokeWidth:o?2.6:a?2.2:1.5,opacity:a?1:.72}}})}},[h,p,d.currentNodeId,d.edges,d.nodes,f,t]),v=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.executionTraceSummary.items;return d.edges.map(e=>{let n=f.get(e.fromNodeId),r=f.get(e.toNodeId);if(!n||!r||!n.isActiveLineage||!r.isActiveLineage)return null;let i=ay(e,t);if(!i)return null;let a=(n.x+220/2+r.x+220/2)/2,o=(n.y+124/2+r.y+124/2)/2;return{edgeKey:`${e.fromNodeId}->${e.toNodeId}`,x:a,y:o,cause:i}}).filter(e=>e!==null)},[d.edges,f,e.executionTraceSummary]),y=(0,V.useMemo)(()=>e.executionTraceSummary?oy(ry(e.executionTraceSummary.items)).filter(e=>e.iterationCount>1).map(e=>{let t=e.nodeIds.map(e=>f.get(e)).filter(e=>e!==void 0);if(t.length===0)return null;let n=t.map(e=>e.y),r=Math.min(...n),i=t.reduce((e,t)=>e.y>t.y?e:t),a=Math.max(...n)+(i.isActiveLineage?124:104);return{key:e.loopId,iterationCount:e.iterationCount,topY:r,bottomY:a,gutterX:564}}).filter(e=>e!==null):null,[d.nodes,f,e.executionTraceSummary]),b=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.skippedSteps??[];return t.length===0?null:ey(t,d)},[d,e.executionTraceSummary,e.skippedSteps]),x=(0,V.useCallback)((e,t)=>{n?.(t.id)},[n]),S=(0,V.useCallback)((e,t)=>{let n=f.get(t.id)?.node.stepLabel??null;if(!n||n.length<=35)return;let r=i.current?.getBoundingClientRect();if(!r)return;let a=e.clientX-r.left+12,o=e.clientY-r.top+16,c=Math.min(a,(i.current?.clientWidth??9999)-272);u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{s(n),l({x:c,y:o})},300)},[f]),C=(0,V.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),s(null),l(null)},[]),w=(0,V.useCallback)((e,t)=>{let n=i.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-n.left+12,a=e.clientY-n.top+16,o=Math.min(r,(i.current?.clientWidth??9999)-272);u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{s(t),l({x:o,y:a})},300)},[]),T=(0,V.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),s(null),l(null)},[]);return(0,H.jsxs)(`div`,{ref:r,className:`h-full flex flex-col bg-[var(--bg-primary)]`,children:[(0,H.jsxs)(`div`,{className:`border-b border-[var(--border)] px-4 py-3 console-blueprint-grid`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(dy,{label:`Current`,value:d.summary.currentNodeLabel,emphasis:!0}),(0,H.jsx)(dy,{label:`Status`,value:xy(e.status)}),(0,H.jsx)(dy,{label:`Active lineage`,value:`${d.summary.lineageNodeCount} nodes`}),(0,H.jsx)(dy,{label:`Alternate branches`,value:`${d.summary.alternateBranchCount}`}),(0,H.jsx)(dy,{label:`Historical nodes`,value:`${d.summary.sideNodeCount}`}),(0,H.jsx)(dy,{label:`Blocked attempts`,value:`${d.summary.blockedAttemptCount}`}),(0,H.jsx)(dy,{label:`Critical gaps`,value:e.hasUnresolvedCriticalGaps?`Present`:`None`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(fy,{onClick:()=>m(d.startNodeId),children:`Start`}),(0,H.jsx)(fy,{onClick:()=>m(d.currentNodeId),children:`Current`}),(0,H.jsx)(fy,{onClick:()=>m(d.latestBranchNodeId),children:`Latest branch`})]})]}),(0,H.jsx)(uy,{model:d,selectedNodeId:t,onNavigateToNode:m}),e.executionTraceSummary!==null&&e.executionTraceSummary.contextFacts.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-3`,children:e.executionTraceSummary.contextFacts.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123, 141, 167, 0.08)`,border:`1px solid rgba(123, 141, 167, 0.20)`},children:[(0,H.jsx)(`span`,{style:{color:`var(--text-secondary)`},children:Bo(e.key)}),(0,H.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`//`}),(0,H.jsx)(`span`,{style:{color:`var(--text-primary)`},children:e.value})]},e.key))})]}),(0,H.jsxs)(`div`,{ref:i,className:`relative flex-1 overflow-auto lineage-scroll-surface`,children:[(0,H.jsxs)(`div`,{style:{width:Math.max(d.graphWidth,b?.requiredWidth??0,960),height:Math.max(d.graphHeight+(h&&h.size>0?40:0),360)},children:[(0,H.jsx)(gv,{nodes:g,edges:_,fitView:!1,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,colorMode:`dark`,onNodeClick:x,onNodeMouseEnter:S,onNodeMouseLeave:C,style:{background:`transparent`}}),v&&v.map(e=>(0,H.jsx)(Ey,{x:e.x,y:e.y,cause:e.cause,onMouseEnter:w,onMouseLeave:T},e.edgeKey)),y&&y.map(e=>(0,H.jsx)(wy,{topY:e.topY,bottomY:e.bottomY,gutterX:e.gutterX,iterationCount:e.iterationCount},e.key)),b&&b.nodes.map(e=>(0,H.jsx)(Dy,{x:e.x,y:e.y,stepLabel:e.stepLabel??e.stepId,onMouseEnter:w,onMouseLeave:T},e.stepId))]}),o&&c&&(0,H.jsx)(`div`,{style:{position:`absolute`,left:c.x,top:c.y,pointerEvents:`none`,zIndex:50,maxWidth:260,background:`rgba(10, 12, 20, 0.96)`,border:`1px solid rgba(123, 141, 167, 0.35)`,padding:`6px 10px`,fontSize:12,lineHeight:1.5,color:`var(--text-primary)`,wordWrap:`break-word`,boxShadow:`0 4px 16px rgba(0,0,0,0.4)`},children:o})]})]})}function ly({node:e,isActiveLineage:t,isCurrent:n,isSelected:r,isLiveRun:i,branchKind:a,branchIndex:o,displayLabel:s,stepNumber:c,totalSteps:l,causeItems:u}){let d=vy(e),f=e.nodeKind===`blocked_attempt`&&u!==void 0&&u.length>0,[p,m]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`relative flex h-full w-full flex-col text-left overflow-hidden ${n&&i?`workrail-current-lineage-node`:``} ${r?`workrail-selected-lineage-node`:``}`,children:[d&&(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,bottom:0,width:3,background:d,pointerEvents:`none`}}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsx)(zo,{color:hy(a,t),children:by(e.nodeKind,a,o)}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[r&&(0,H.jsx)(zo,{color:`var(--warning)`,children:`Selected`}),n&&(0,H.jsx)(zo,{color:i?`var(--accent-strong)`:`var(--text-secondary)`,children:`Current`})]})]}),(0,H.jsx)(`div`,{className:t?`text-sm font-medium leading-snug`:`text-[13px] leading-snug`,style:{color:`var(--text-primary)`,display:`-webkit-box`,WebkitLineClamp:t?4:3,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:s})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t border-[rgba(255,255,255,0.06)] bg-[rgba(0,0,0,0.18)] px-3 py-2`,children:[(0,H.jsx)(zo,{color:`var(--text-secondary)`,className:`min-w-0 truncate text-[11px]`,children:c!==null&&l!==null?`${c} / ${l}`:`evt ${e.createdAtEventIndex}`}),e.isTip?(0,H.jsx)(zo,{className:`shrink-0`,color:e.isPreferredTip?`var(--warning)`:`var(--text-muted)`,children:e.isPreferredTip?`Preferred tip`:`Tip`}):(0,H.jsx)(zo,{className:`shrink-0`,color:`transparent`,children:`spacer`})]}),f&&(0,H.jsxs)(`div`,{style:{borderTop:`1px solid rgba(239, 68, 68, 0.25)`,background:`rgba(80, 24, 31, 0.80)`,overflow:`hidden`,transition:`height 120ms ease`,height:p?72:32,flexShrink:0},children:[(0,H.jsx)(`div`,{className:`flex items-center px-3`,style:{height:32},children:(0,H.jsx)(`button`,{type:`button`,"aria-expanded":p,onClick:e=>{e.stopPropagation(),m(e=>!e)},className:`font-mono text-[9px] uppercase tracking-[0.22em] px-2 py-0.5 transition-colors`,style:{color:p?`var(--text-muted)`:`var(--accent)`,border:`1px solid ${p?`rgba(123,141,167,0.25)`:`rgba(244,196,48,0.40)`}`,background:p?`rgba(123,141,167,0.06)`:`rgba(244,196,48,0.08)`},children:p?`[ CLOSE ]`:`[ CAUSE ]`})}),p&&u&&u[0]&&(0,H.jsx)(`div`,{className:`px-3 pb-2 font-mono text-[9px] leading-relaxed`,style:{color:`var(--text-secondary)`},children:u[0].summary})]})]})}function uy({model:e,selectedNodeId:t,onNavigateToNode:n}){let r=e.nodes.filter(e=>e.isActiveLineage),i=e.nodes.filter(e=>!e.isActiveLineage).slice(-8);return(0,H.jsx)(`div`,{className:`mt-3 border border-[var(--border)] bg-[rgba(10,10,10,0.38)] px-3 py-2 corner-brackets`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(zo,{children:`Lineage rail`}),r.map(e=>(0,H.jsx)(py,{label:e.node.stepLabel??Qv(e.node.nodeId),isCurrent:e.isCurrent,isSelected:e.node.nodeId===t,tone:`active`,onClick:()=>n(e.node.nodeId)},e.node.nodeId)),i.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`mx-1 h-px w-6 bg-[var(--border)]`}),i.map(e=>(0,H.jsx)(py,{label:Sy(e.node,e.branchKind,e.branchIndex),isCurrent:!1,isSelected:e.node.nodeId===t,tone:e.branchKind===`blocked`?`blocked`:`side`,onClick:()=>n(e.node.nodeId)},e.node.nodeId))]})]})})}function dy({label:e,value:t,emphasis:n=!1}){return(0,H.jsxs)(`div`,{className:`min-w-[120px] border px-3 py-2`,style:{borderColor:n?`rgba(0, 240, 255, 0.42)`:`var(--border)`,background:n?`rgba(0, 240, 255, 0.08)`:`rgba(15, 19, 31, 0.78)`},children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-[var(--text-primary)]`,children:t})]})}function fy({children:e,onClick:t}){return(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 font-mono text-[11px] uppercase tracking-[0.30em] text-[var(--text-secondary)] transition-colors hover:border-[var(--accent-strong)] hover:text-[var(--text-primary)]`,children:e})}function py({label:e,isCurrent:t,isSelected:n,tone:r,onClick:i}){return(0,H.jsx)(`button`,{type:`button`,title:e,onClick:i,className:`border px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em] text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]`,style:{background:n?`rgba(244, 179, 65, 0.16)`:r===`active`?t?`rgba(0, 240, 255, 0.2)`:`rgba(0, 240, 255, 0.08)`:r===`blocked`?`rgba(239, 68, 68, 0.12)`:`rgba(125, 136, 156, 0.12)`,borderColor:n?`rgba(244, 179, 65, 0.48)`:r===`active`?t?`rgba(0, 240, 255, 0.6)`:`rgba(0, 240, 255, 0.32)`:r===`blocked`?`rgba(239, 68, 68, 0.34)`:`rgba(125, 136, 156, 0.3)`},children:Cy(e)})}function my(e,t){return e.nodeKind===`blocked_attempt`?t?`rgba(80, 24, 31, 0.92)`:`rgba(52, 24, 30, 0.82)`:e.nodeKind===`checkpoint`?t?`rgba(18, 61, 51, 0.92)`:`rgba(18, 43, 38, 0.82)`:t?`rgba(27, 31, 44, 0.96)`:`rgba(24, 28, 39, 0.82)`}function hy(e,t){return e===`blocked`?`var(--error)`:e===`alternate`?t?`var(--accent-strong)`:`rgba(186, 197, 219, 0.72)`:t?`var(--accent-strong)`:`var(--text-muted)`}function gy(e,t,n,r){return r?`var(--warning)`:n?`var(--accent-strong)`:e.nodeKind===`blocked_attempt`?t?`var(--error)`:`rgba(239, 68, 68, 0.5)`:e.nodeKind===`checkpoint`?t?`var(--success)`:`rgba(34, 197, 94, 0.45)`:t?`rgba(0, 240, 255, 0.55)`:`rgba(123, 141, 167, 0.45)`}var _y=[{test:e=>e.hasFailedValidations,color:`var(--error)`},{test:e=>e.hasGaps,color:`var(--warning)`},{test:e=>e.hasRecap||e.hasArtifacts,color:`var(--accent)`}];function vy(e){return _y.find(t=>t.test(e))?.color??null}function yy(e){switch(e){case`blocked_attempt`:return`Blocked`;case`checkpoint`:return`Checkpoint`;case`step`:return`Step`}}function by(e,t,n){return t===`blocked`?n?`Blocked branch ${n}`:`Blocked branch`:t===`alternate`?n?`Alt branch ${n}`:`Alt branch`:yy(e)}function xy(e){switch(e){case`complete`:return`Complete`;case`complete_with_gaps`:return`Complete with gaps`;case`blocked`:return`Blocked`;case`in_progress`:return`In progress`}}function Sy(e,t,n){return e.stepLabel?e.stepLabel:t===`blocked`?n?`Blocked attempt ${n}`:`Blocked attempt`:t===`alternate`?n?`Alternate path ${n}`:`Alternate path`:Qv(e.nodeId)}function Cy(e){return e.length>18?`${e.slice(0,18)}…`:e}function wy({topY:e,bottomY:t,gutterX:n,iterationCount:r}){let i=t-e;return i<=0?null:(0,H.jsxs)(`div`,{style:{position:`absolute`,left:n,top:e,width:32,height:i,pointerEvents:`none`,zIndex:1},children:[(0,H.jsx)(`div`,{style:{position:`absolute`,left:14,top:0,bottom:0,width:3,background:`var(--accent)`,opacity:.7}}),(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,top:-2,whiteSpace:`nowrap`},children:(0,H.jsx)(zo,{color:`var(--accent)`,style:{fontSize:9},children:`[ LOOP ]`})}),(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,bottom:-2,whiteSpace:`nowrap`},children:(0,H.jsx)(zo,{color:`var(--accent)`,style:{fontSize:9},children:`[ // ${r}x ]`})})]})}var Ty={condition:{char:`C`,color:`#f4c430`},fork:{char:`F`,color:`var(--warning)`},divergence:{char:`D`,color:`var(--error)`},advance:{char:`>`,color:`rgba(0,175,192,0.60)`}};function Ey({x:e,y:t,cause:n,onMouseEnter:r,onMouseLeave:i}){let a=Ty[n.kind];return(0,H.jsx)(`div`,{style:{position:`absolute`,left:e-5,top:t-5,width:10,height:10,transform:`rotate(45deg)`,background:a.color,zIndex:1,pointerEvents:`auto`,cursor:`default`,display:`flex`,alignItems:`center`,justifyContent:`center`},onMouseEnter:e=>r(e,n.summary),onMouseLeave:i,children:(0,H.jsx)(`span`,{style:{display:`block`,transform:`rotate(-45deg)`,fontSize:7,lineHeight:1,fontFamily:`monospace`,fontWeight:700,color:`rgba(0,0,0,0.75)`,userSelect:`none`,pointerEvents:`none`},children:a.char})})}function Dy({x:e,y:t,stepLabel:n,onMouseEnter:r,onMouseLeave:i}){return(0,H.jsxs)(`div`,{style:{position:`absolute`,left:e,top:t,width:220,height:124,opacity:.25,pointerEvents:`auto`,cursor:`default`,border:`1px dashed rgba(123, 141, 167, 0.55)`,background:`rgba(24, 28, 39, 0.60)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,zIndex:0},onMouseEnter:e=>r(e,n),onMouseLeave:i,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 pt-3`,children:[(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.70)`,children:`Skipped`}),(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.55)`,className:`text-[9px]`,children:`[ SKIPPED ]`})]}),(0,H.jsx)(`div`,{className:`grow px-3 pt-2 text-sm leading-snug`,style:{color:`rgba(186, 197, 219, 0.65)`,display:`-webkit-box`,WebkitLineClamp:4,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:n}),(0,H.jsx)(`div`,{className:`flex items-center border-t px-3 py-2`,style:{borderColor:`rgba(255,255,255,0.04)`,background:`rgba(0,0,0,0.12)`},children:(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.45)`,className:`text-[11px]`,children:`not executed`})})]})}function Oy({label:e,color:t,bgColor:n}){return(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.20em]`,style:{color:t,backgroundColor:n,border:`1px solid ${t}40`},children:e})}function ky(e){switch(e.kind){case`selected_next_step`:return{label:`STEP`,color:`var(--accent)`,bgColor:`rgba(244, 196, 48, 0.12)`};case`evaluated_condition`:return ty(e)?{label:`CONDITION`,color:`var(--success)`,bgColor:`rgba(34, 197, 94, 0.12)`}:{label:`CONDITION`,color:`var(--text-muted)`,bgColor:`rgba(123, 141, 167, 0.10)`};case`detected_non_tip_advance`:return{label:`FORK`,color:`var(--warning)`,bgColor:`rgba(251, 146, 60, 0.12)`};case`divergence`:return{label:`DIVERGE`,color:`var(--error)`,bgColor:`rgba(239, 68, 68, 0.12)`};case`entered_loop`:case`exited_loop`:return{label:`LOOP`,color:`var(--accent)`,bgColor:`rgba(0, 240, 255, 0.10)`};case`context_fact`:return{label:`FACT`,color:`var(--text-muted)`,bgColor:`rgba(123, 141, 167, 0.10)`};default:return{label:`INFO`,color:`var(--text-secondary)`,bgColor:`rgba(123, 141, 167, 0.08)`}}}function Ay({group:e}){let[t,n]=(0,V.useState)(e.iterationCount<=3),r=e.iterationCount;return(0,H.jsxs)(`li`,{className:`flex flex-col gap-1 py-1.5 border-b border-[var(--border)] last:border-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsxs)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.20em]`,style:{color:`var(--accent)`,backgroundColor:`rgba(0, 240, 255, 0.10)`,border:`1px solid rgba(0, 240, 255, 0.25)`},children:[`LOOP: `,r]}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-secondary)] leading-relaxed flex-1`,children:e.enteredItem.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.enteredItem.recordedAtEventIndex]})]}),(0,H.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--text-muted)] pl-[calc(theme(spacing.2)+theme(spacing.3)+4ch)]`,children:[`stopped when: `,e.exitedItem.summary]}),e.innerItems.length>0&&(0,H.jsxs)(`div`,{className:`pl-4 mt-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`font-mono text-[10px] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors`,children:t?`[ collapse ]`:`[ expand ${e.innerItems.length} inner items ]`}),t&&(0,H.jsx)(`ol`,{className:`mt-1 space-y-1`,children:e.innerItems.map(e=>{let t=ky(e);return(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-xs text-[var(--text-muted)]`,children:[(0,H.jsx)(Oy,{label:t.label,color:t.color,bgColor:t.bgColor}),(0,H.jsx)(`span`,{className:`flex-1 leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]},e.recordedAtEventIndex)})})]})]})}function jy({runStatus:e}){let t=(()=>{switch(e){case`complete`:case`complete_with_gaps`:return{text:`// ------ RUN COMPLETE ------`,color:`var(--success)`};case`blocked`:return{text:`// ------ RUN BLOCKED ------`,color:`var(--error)`};case`in_progress`:return{text:`// ------ IN PROGRESS ------`,color:`var(--accent)`}}})();return(0,H.jsx)(`div`,{className:`font-mono text-[11px] text-center py-3 mt-1`,style:{color:t.color},children:t.text})}function My({facts:e}){return e.length===0?null:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 px-4 py-2 border-b border-[var(--border)] bg-[rgba(0,240,255,0.03)]`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123, 141, 167, 0.08)`,border:`1px solid rgba(123, 141, 167, 0.20)`},children:[(0,H.jsx)(`span`,{style:{color:`var(--text-secondary)`},children:Bo(e.key)}),(0,H.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`//`}),(0,H.jsx)(`span`,{style:{color:`var(--text-primary)`},children:e.value})]},e.key))})}var Ny=80;function Py({summary:e,runStatus:t}){let n=ry(e.items),r=(0,V.useRef)(null),i=(0,V.useRef)(n.length),[a,o]=(0,V.useState)(0),[s,c]=(0,V.useState)(!0);return(0,V.useEffect)(()=>{let e=r.current;if(!e)return;let t=i.current,a=n.length-t;i.current=n.length,!(a<=0)&&(s?(e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),o(0)):o(e=>e+a))},[n.length,s]),(0,V.useEffect)(()=>{let e=r.current;if(!e)return;function t(){if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c(t<=Ny),t<=Ny&&o(0)}return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),n.length===0?(0,H.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:`// TRACE -- no routing decisions were recorded for this run`})}):(0,H.jsxs)(`div`,{className:`h-full flex flex-col bg-[var(--bg-primary)] relative`,children:[(0,H.jsx)(My,{facts:e.contextFacts}),(0,H.jsxs)(`div`,{ref:r,className:`flex-1 overflow-y-auto px-4 py-2`,children:[(0,H.jsx)(`ol`,{className:`space-y-0`,children:n.map(e=>{if(e.kind===`loop_group`)return(0,H.jsx)(Ay,{group:e},e.enteredItem.recordedAtEventIndex);let{item:t}=e,n=ky(t);return(0,H.jsxs)(`li`,{className:`flex items-start gap-3 py-1.5 border-b border-[var(--border)] last:border-0`,children:[(0,H.jsx)(Oy,{label:n.label,color:n.color,bgColor:n.bgColor}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-secondary)] leading-relaxed flex-1`,children:t.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,t.recordedAtEventIndex]})]},t.recordedAtEventIndex)})}),(0,H.jsx)(jy,{runStatus:t})]}),!s&&a>0&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{r.current?.scrollTo({top:r.current.scrollHeight,behavior:`smooth`}),o(0)},className:`absolute bottom-4 left-1/2 -translate-x-1/2 font-mono text-[10px] uppercase tracking-[0.20em] px-3 py-1.5 transition-colors`,style:{backgroundColor:`rgba(0, 240, 255, 0.15)`,border:`1px solid rgba(0, 240, 255, 0.35)`,color:`var(--accent)`},children:[`[ `,a,` NEW ]`]})]})}function Fy(e,t){return e.isLoading?{state:`loading`}:e.isError?{state:`error`,message:e.error instanceof Error?e.error.message:`Could not load performance data.`,retry:t}:e.data===null?{state:`devModeOff`}:e.data===void 0?{state:`loading`}:e.data.devMode===!1?{state:`devModeOff`}:{state:`data`,data:e.data}}var Iy=class extends Error{constructor(e,t){super(`HTTP ${e}: ${t}`),this.status=e,this.name=`HttpError`}};async function Ly(e){let t=await fetch(e);if(!t.ok)throw new Iy(t.status,t.statusText);let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Unknown error`);return n.data}function Ry(){return rt({queryKey:[`sessions`],queryFn:()=>Ly(`/api/v2/sessions`),refetchInterval:3e4,staleTime:25e3})}function zy(e){return rt({queryKey:[`session`,e],queryFn:()=>Ly(`/api/v2/sessions/${e}`),enabled:!!e,refetchInterval:5e3,refetchIntervalInBackground:!1,staleTime:3e3})}function By(e,t){return rt({queryKey:[`node`,e,t],queryFn:()=>Ly(`/api/v2/sessions/${e}/nodes/${t}`),enabled:!!t})}function Vy(){return rt({queryKey:[`worktrees`],queryFn:()=>Ly(`/api/v2/worktrees`),refetchInterval:3e4,staleTime:2e4})}function Hy(){return rt({queryKey:[`workflows`],queryFn:()=>Ly(`/api/v2/workflows`),staleTime:1/0,refetchInterval:!1})}function Uy(){let e=rt({queryKey:[`perf`,`tool-calls`],queryFn:async()=>{try{return await Ly(`/api/v2/perf/tool-calls`)}catch(e){if(e instanceof Iy&&e.status===404)return null;throw e}},refetchInterval:5e3,staleTime:3e3,refetchIntervalInBackground:!1});return Fy(e,()=>void e.refetch())}function Wy(e){return rt({queryKey:[`workflow`,e],queryFn:()=>Ly(`/api/v2/workflows/${e}`),enabled:e!==null,staleTime:1/0,refetchInterval:!1})}function Gy(){return rt({queryKey:[`triggers`],queryFn:async()=>{try{return await Ly(`/api/v2/triggers`)}catch(e){if(e instanceof Iy&&e.status===503)return{triggers:[]};throw e}},staleTime:3e4,refetchInterval:6e4})}async function Ky(e){let t=await fetch(`/api/v2/auto/dispatch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw new Iy(t.status,e.error??t.statusText)}let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Dispatch failed`);return n.data}function qy(){let e=He();(0,V.useEffect)(()=>{let t=null,n=null;function r(){t=new EventSource(`/api/v2/workspace/events`),t.onmessage=t=>{try{let n=JSON.parse(t.data);n.type===`change`?e.invalidateQueries({queryKey:[`sessions`]}):n.type===`worktrees-updated`&&e.invalidateQueries({queryKey:[`worktrees`]})}catch{}},t.onerror=()=>{t?.close(),t=null,n=setTimeout(r,5e3)}}return r(),()=>{n!==null&&clearTimeout(n),t?.close()}},[e])}function Jy(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Yy=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xy=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zy={};function Qy(e,t){return((t||Zy).jsx?Xy:Yy).test(e)}var $y=/[ \t\n\f\r]/g;function eb(e){return typeof e==`object`?e.type===`text`?tb(e.value):!1:tb(e)}function tb(e){return e.replace($y,``)===``}var nb=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};nb.prototype.normal={},nb.prototype.property={},nb.prototype.space=void 0;function rb(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new nb(n,r,t)}function ib(e){return e.toLowerCase()}var ab=class{constructor(e,t){this.attribute=t,this.property=e}};ab.prototype.attribute=``,ab.prototype.booleanish=!1,ab.prototype.boolean=!1,ab.prototype.commaOrSpaceSeparated=!1,ab.prototype.commaSeparated=!1,ab.prototype.defined=!1,ab.prototype.mustUseProperty=!1,ab.prototype.number=!1,ab.prototype.overloadedBoolean=!1,ab.prototype.property=``,ab.prototype.spaceSeparated=!1,ab.prototype.space=void 0;var ob=s({boolean:()=>Z,booleanish:()=>cb,commaOrSpaceSeparated:()=>fb,commaSeparated:()=>db,number:()=>Q,overloadedBoolean:()=>lb,spaceSeparated:()=>ub}),sb=0,Z=pb(),cb=pb(),lb=pb(),Q=pb(),ub=pb(),db=pb(),fb=pb();function pb(){return 2**++sb}var mb=Object.keys(ob),hb=class extends ab{constructor(e,t,n,r){let i=-1;if(super(e,t),gb(this,`space`,r),typeof n==`number`)for(;++i<mb.length;){let e=mb[i];gb(this,mb[i],(n&ob[e])===ob[e])}}};hb.prototype.defined=!0;function gb(e,t,n){n&&(e[t]=n)}function _b(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hb(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ib(r)]=r,n[ib(a.attribute)]=r}return new nb(t,n,e.space)}var vb=_b({properties:{ariaActiveDescendant:null,ariaAtomic:cb,ariaAutoComplete:null,ariaBusy:cb,ariaChecked:cb,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:ub,ariaCurrent:null,ariaDescribedBy:ub,ariaDetails:null,ariaDisabled:cb,ariaDropEffect:ub,ariaErrorMessage:null,ariaExpanded:cb,ariaFlowTo:ub,ariaGrabbed:cb,ariaHasPopup:null,ariaHidden:cb,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ub,ariaLevel:Q,ariaLive:null,ariaModal:cb,ariaMultiLine:cb,ariaMultiSelectable:cb,ariaOrientation:null,ariaOwns:ub,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:cb,ariaReadOnly:cb,ariaRelevant:null,ariaRequired:cb,ariaRoleDescription:ub,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:cb,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function yb(e,t){return t in e?e[t]:t}function bb(e,t){return yb(e,t.toLowerCase())}var xb=_b({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:db,acceptCharset:ub,accessKey:ub,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:ub,autoFocus:Z,autoPlay:Z,blocking:ub,capture:null,charSet:null,checked:Z,cite:null,className:ub,cols:Q,colSpan:null,content:null,contentEditable:cb,controls:Z,controlsList:ub,coords:Q|db,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:lb,draggable:cb,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:ub,height:Q,hidden:lb,high:Q,href:null,hrefLang:null,htmlFor:ub,httpEquiv:ub,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:ub,itemRef:ub,itemScope:Z,itemType:ub,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:Q,pattern:null,ping:ub,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:ub,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:ub,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:cb,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:cb,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ub,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:cb,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Z,disableRemotePlayback:Z,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:bb}),Sb=_b({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:fb,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:ub,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:db,g2:db,glyphName:db,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:fb,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ub,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fb,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fb,rev:fb,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fb,requiredFeatures:fb,requiredFonts:fb,requiredFormats:fb,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:fb,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fb,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fb,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:yb}),Cb=_b({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),wb=_b({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bb}),Tb=_b({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Eb={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Db=/[A-Z]/g,Ob=/-[a-z]/g,kb=/^data[-\w.:]+$/i;function Ab(e,t){let n=ib(t),r=t,i=ab;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&kb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ob,Mb);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ob.test(e)){let n=e.replace(Db,jb);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hb}return new i(r,t)}function jb(e){return`-`+e.toLowerCase()}function Mb(e){return e.charAt(1).toUpperCase()}var Nb=rb([vb,xb,Cb,wb,Tb],`html`),Pb=rb([vb,Sb,Cb,wb,Tb],`svg`);function Fb(e){return e.join(` `).trim()}var Ib=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
15
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Wv.displayName=`MiniMap`,(0,V.memo)(Wv);var Gv=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Kv={[Ym.Line]:`right`,[Ym.Handle]:`bottom-right`};function qv({nodeId:e,position:t,variant:n=Ym.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 v=Pg(),y=typeof e==`string`?e:v,b=bh(),x=(0,V.useRef)(null),S=n===Ym.Handle,C=X((0,V.useCallback)(Gv(S&&p),[S,p]),gh),w=(0,V.useRef)(null),T=t??Kv[n];return(0,V.useEffect)(()=>{if(!(!x.current||!y))return w.current||=sh({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.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}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);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=pm([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...vp({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:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,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:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,H.jsx)(`div`,{className:Vo([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,V.memo)(qv);function Jv(e){if(e.nodes.length===0)return{nodes:[],edges:[],graphWidth:112,graphHeight:112,currentNodeId:null,startNodeId:null,latestBranchNodeId:null,summary:{currentNodeLabel:`No active node`,lineageNodeCount:0,sideNodeCount:0,alternateBranchCount:0,blockedAttemptCount:0}};let t=new Map(e.nodes.map(e=>[e.nodeId,e])),n=new Map;for(let t of e.nodes){if(!t.parentNodeId)continue;let e=n.get(t.parentNodeId)??[];e.push(t),n.set(t.parentNodeId,e)}for(let e of n.values())e.sort((e,t)=>e.createdAtEventIndex-t.createdAtEventIndex);let r=Yv(e),i=r?Xv(r,t):new Set,a=Zv(e.nodes,t),o=new Map,s=new Map,c=new Map,l=new Set,u=new Set,d=0,f=0,p=()=>{d+=1;let e=Math.ceil(d/2);return d%2==1?-e:e},m=(e,t,r,i)=>{if(o.has(e))return;o.set(e,t),s.set(e,r),c.set(e,i);let a=n.get(e)??[];if(a.length===0)return;let[l,...u]=a;l&&m(l.nodeId,t,r,i);let d=1;for(let e of u){let n=t<0?t-d:t+d;m(e.nodeId,n,r,i),d+=1}},h=[...i].sort((e,t)=>(a.get(e)??0)-(a.get(t)??0));for(let e of h){o.set(e,0),s.set(e,`active`),c.set(e,null);let t=n.get(e)??[];for(let e of t){if(i.has(e.nodeId))continue;f+=1;let t=e.nodeKind===`blocked_attempt`?`blocked`:`alternate`;t===`blocked`?u.add(e.nodeId):l.add(e.nodeId),m(e.nodeId,p(),t,f)}}let g=e.nodes.filter(e=>!e.parentNodeId||!t.has(e.parentNodeId)).sort((e,t)=>e.createdAtEventIndex-t.createdAtEventIndex);for(let e of g)if(!o.has(e.nodeId)){if(!i.has(e.nodeId)){f+=1;let t=e.nodeKind===`blocked_attempt`?`blocked`:`alternate`;t===`blocked`?u.add(e.nodeId):l.add(e.nodeId),m(e.nodeId,p(),t,f);continue}o.set(e.nodeId,0),s.set(e.nodeId,`active`),c.set(e.nodeId,null)}for(let t of e.nodes)if(!o.has(t.nodeId)){f+=1;let e=t.nodeKind===`blocked_attempt`?`blocked`:`alternate`;e===`blocked`?u.add(t.nodeId):l.add(t.nodeId),m(t.nodeId,p(),e,f)}let _=Math.min(...o.values()),v=Math.max(...o.values()),y=$v(e.nodes,a,t,i),b=e.nodes.map(e=>{let t=i.has(e.nodeId),n=y.get(e.nodeId)??0;return{node:e,depth:n,lane:o.get(e.nodeId)??0,x:656+n*268,y:56+((o.get(e.nodeId)??0)-_)*112,isActiveLineage:t,isCurrent:e.nodeId===r,branchKind:s.get(e.nodeId)??`alternate`,branchIndex:c.get(e.nodeId)??null}}),x=b.reduce((e,t)=>Math.max(e,t.depth),0),S=r?t.get(r)??null:null,C=[...l,...u].map(e=>t.get(e)).filter(e=>!!e).sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0]??null,w={currentNodeLabel:S?.stepLabel??(S?.isPreferredTip&&(e.status===`complete`||e.status===`complete_with_gaps`)?`Complete`:null)??(S?Qv(S.nodeId):`No active node`),lineageNodeCount:i.size,sideNodeCount:e.nodes.length-i.size,alternateBranchCount:l.size,blockedAttemptCount:e.nodes.filter(e=>e.nodeKind===`blocked_attempt`).length},T=new Set(b.map(e=>e.node.nodeId));return{nodes:b,edges:e.edges.filter(e=>T.has(e.fromNodeId)&&T.has(e.toNodeId)),graphWidth:1312+x*268+220,graphHeight:112+(v-_)*112+124,currentNodeId:r,startNodeId:h[0]??g[0]?.nodeId??null,latestBranchNodeId:C?.nodeId??null,summary:w}}function Yv(e){if(e.preferredTipNodeId)return e.preferredTipNodeId;let t=e.nodes.find(e=>e.isPreferredTip);if(t)return t.nodeId;let n=e.nodes.filter(e=>e.isTip).sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0];return n?n.nodeId:[...e.nodes].sort((e,t)=>t.createdAtEventIndex-e.createdAtEventIndex)[0]?.nodeId??null}function Xv(e,t){let n=new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=t.get(r)?.parentNodeId??null;r=e&&t.has(e)?e:null}return n}function Zv(e,t){let n=new Map,r=new Set,i=e=>{let a=n.get(e);if(a!==void 0)return a;if(r.has(e))return n.set(e,0),0;r.add(e);let o=t.get(e)?.parentNodeId??null;if(!o||!t.has(o))return n.set(e,0),r.delete(e),0;let s=i(o)+1;return n.set(e,s),r.delete(e),s};for(let t of e)i(t.nodeId);return n}function Qv(e){return e.slice(-8)}function $v(e,t,n,r){let i=new Map;for(let e of r)i.set(e,t.get(e)??0);let a=new Set,o=e=>{let r=i.get(e);if(r!==void 0)return r;if(a.has(e)){let n=t.get(e)??0;return i.set(e,n),n}a.add(e);let s=n.get(e)?.parentNodeId??null;if(!s||!n.has(s)){let n=t.get(e)??0;return i.set(e,n),a.delete(e),n}let c=o(s)+1;return i.set(e,c),a.delete(e),c};for(let t of e)i.has(t.nodeId)||o(t.nodeId);return i}function ey(e,t){if(e.length===0)return{nodes:[],requiredWidth:0,requiredHeight:0};let n=t.nodes.filter(e=>e.isActiveLineage);if(n.length===0)return{nodes:[],requiredWidth:0,requiredHeight:0};let r=656+(n.reduce((e,t)=>Math.max(e,t.depth),0)+1)*268;return{nodes:e.map((e,t)=>({stepId:e.stepId,stepLabel:e.stepLabel,x:r,y:56+t*112})),requiredWidth:r+220+600,requiredHeight:56+e.length*112+124}}function ty(e){return/\btrue\b|\bpass/i.test(e.summary)}function ny(e){return e.refs.find(e=>e.kind===`loop_id`)?.value??null}function ry(e){let t=[...e.filter(e=>e.kind!==`context_fact`)].sort((e,t)=>e.recordedAtEventIndex-t.recordedAtEventIndex),n=[],r=new Map,i=[];for(let e of t)if(e.kind===`entered_loop`){let t=ny(e);t?(r.set(t,{enteredItem:e,innerItems:[]}),i.push(t)):n.push({kind:`standalone`,item:e})}else if(e.kind===`exited_loop`){let t=ny(e),a=t?r.get(t):void 0;if(a&&t){r.delete(t);let o=i.lastIndexOf(t);o!==-1&&i.splice(o,1);let s=Math.max(1,a.innerItems.filter(e=>e.kind===`selected_next_step`).length);n.push({kind:`loop_group`,loopId:t,enteredItem:a.enteredItem,innerItems:a.innerItems,exitedItem:e,iterationCount:s})}else n.push({kind:`standalone`,item:e})}else{let t=i.at(-1),a=t?r.get(t):void 0;a?a.innerItems.push(e):n.push({kind:`standalone`,item:e})}for(let[,e]of r){n.push({kind:`standalone`,item:e.enteredItem});for(let t of e.innerItems)n.push({kind:`standalone`,item:t})}return n}function iy(e){switch(e.kind){case`evaluated_condition`:return`condition`;case`detected_non_tip_advance`:return`fork`;case`divergence`:return`divergence`;case`selected_next_step`:return`advance`;default:return null}}function ay(e,t){let n=null,r=-1;for(let i of t){let t=iy(i);t!==null&&(i.recordedAtEventIndex>e.createdAtEventIndex||i.recordedAtEventIndex>r&&(r=i.recordedAtEventIndex,n={kind:t,summary:i.summary}))}return n}function oy(e){let t=[];for(let n of e){if(n.kind!==`loop_group`)continue;let e=n.enteredItem.refs.filter(e=>e.kind===`node_id`).map(e=>e.value),r=n.exitedItem.refs.filter(e=>e.kind===`node_id`).map(e=>e.value),i=n.innerItems.flatMap(e=>e.refs.filter(e=>e.kind===`node_id`).map(e=>e.value)),a=[...new Set([...e,...r,...i])];t.push({loopId:n.loopId,iterationCount:n.iterationCount,nodeIds:a})}return t}function sy(e,t){let n=e.items.filter(e=>e.refs.some(e=>e.kind===`node_id`&&e.value===t));return{whySelected:n.filter(e=>e.kind===`selected_next_step`),conditions:n.filter(e=>e.kind===`evaluated_condition`),loops:n.filter(e=>e.kind===`entered_loop`||e.kind===`exited_loop`),divergences:n.filter(e=>e.kind===`divergence`),forks:n.filter(e=>e.kind===`detected_non_tip_advance`)}}function cy({run:e,selectedNodeId:t=null,onNodeClick:n}){let r=(0,V.useRef)(null),i=(0,V.useRef)(null),a=(0,V.useRef)(!1),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]);let d=(0,V.useMemo)(()=>Jv(e),[e]),f=(0,V.useMemo)(()=>new Map(d.nodes.map(e=>[e.node.nodeId,e])),[d.nodes]),p=e.status===`in_progress`,m=(0,V.useCallback)((e,t=`smooth`)=>{if(!e)return;let n=i.current,a=f.get(e);if(!n||!a)return;r.current?.scrollIntoView({behavior:t,block:`nearest`});let o=a.isActiveLineage?220:172,s=a.isActiveLineage?124:104;n.scrollTo({left:Math.max(0,a.x-n.clientWidth/2+o/2),top:Math.max(0,a.y-n.clientHeight/2+s/2),behavior:t})},[f]);(0,V.useEffect)(()=>{a.current||d.currentNodeId&&(a.current=!0,m(d.currentNodeId,`auto`))},[]);let h=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.executionTraceSummary,n=new Map;for(let r of e.nodes){if(r.nodeKind!==`blocked_attempt`)continue;let e=sy(t,r.nodeId),i=[...e.divergences,...e.forks,...e.conditions,...e.whySelected];n.set(r.nodeId,i)}return n},[e.executionTraceSummary,e.nodes]),{nodes:g,edges:_}=(0,V.useMemo)(()=>{let n=d.currentNodeId?d.edges.find(e=>e.toNodeId===d.currentNodeId)?.fromNodeId??null:null;return{nodes:d.nodes.map(n=>{let{node:r,isActiveLineage:i,isCurrent:a}=n,o=r.nodeId===t,s=i?220:172,c=gy(r,i,a,o),l=my(r,i),u=Sy(r,n.branchKind,n.branchIndex,e.status),f=h?.get(r.nodeId),m=r.nodeKind===`blocked_attempt`&&f!==void 0&&f.length>0,g=i?124:104,_=m?g+80:g;return{id:r.nodeId,position:{x:n.x,y:n.y},data:{label:(0,H.jsx)(ly,{node:r,isActiveLineage:i,isCurrent:a,isSelected:o,isLiveRun:p,branchKind:n.branchKind,branchIndex:n.branchIndex,displayLabel:u,stepNumber:i?n.depth+1:null,totalSteps:i?d.summary.lineageNodeCount:null,causeItems:f})},style:{width:s,height:_,padding:0,borderRadius:0,border:`1px solid ${c}`,background:l,color:`var(--text-primary)`,boxShadow:o?`0 0 0 1px rgba(244, 179, 65, 0.7), 0 0 18px rgba(244, 179, 65, 0.16)`:a?`0 0 0 1px rgba(0, 240, 255, 0.65), 0 0 24px rgba(0, 240, 255, 0.18)`:i?`0 0 16px rgba(0, 240, 255, 0.1)`:`none`,opacity:i?1:.72,cursor:`pointer`,display:`flex`,alignItems:`stretch`,justifyContent:`stretch`}}}),edges:d.edges.map((e,t)=>{let r=f.get(e.fromNodeId),i=f.get(e.toNodeId),a=!!(r?.isActiveLineage&&i?.isActiveLineage),o=p&&!!d.currentNodeId&&e.toNodeId===d.currentNodeId&&e.fromNodeId===n;return{id:`lineage-edge-${t}`,source:e.fromNodeId,target:e.toNodeId,type:`smoothstep`,animated:o,className:o?`workrail-current-lineage-edge`:void 0,style:{stroke:o?`var(--accent-strong)`:a?e.edgeKind===`checkpoint`?`var(--success)`:`var(--accent-strong)`:`rgba(123, 141, 167, 0.45)`,strokeWidth:o?2.6:a?2.2:1.5,opacity:a?1:.72}}})}},[h,p,d.currentNodeId,d.edges,d.nodes,f,t]),v=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.executionTraceSummary.items;return d.edges.map(e=>{let n=f.get(e.fromNodeId),r=f.get(e.toNodeId);if(!n||!r||!n.isActiveLineage||!r.isActiveLineage)return null;let i=ay(e,t);if(!i)return null;let a=(n.x+220/2+r.x+220/2)/2,o=(n.y+124/2+r.y+124/2)/2;return{edgeKey:`${e.fromNodeId}->${e.toNodeId}`,x:a,y:o,cause:i}}).filter(e=>e!==null)},[d.edges,f,e.executionTraceSummary]),y=(0,V.useMemo)(()=>e.executionTraceSummary?oy(ry(e.executionTraceSummary.items)).filter(e=>e.iterationCount>1).map(e=>{let t=e.nodeIds.map(e=>f.get(e)).filter(e=>e!==void 0);if(t.length===0)return null;let n=t.map(e=>e.y),r=Math.min(...n),i=t.reduce((e,t)=>e.y>t.y?e:t),a=Math.max(...n)+(i.isActiveLineage?124:104);return{key:e.loopId,iterationCount:e.iterationCount,topY:r,bottomY:a,gutterX:564}}).filter(e=>e!==null):null,[d.nodes,f,e.executionTraceSummary]),b=(0,V.useMemo)(()=>{if(!e.executionTraceSummary)return null;let t=e.skippedSteps??[];return t.length===0?null:ey(t,d)},[d,e.executionTraceSummary,e.skippedSteps]),x=(0,V.useCallback)((e,t)=>{n?.(t.id)},[n]),S=(0,V.useCallback)((e,t)=>{let n=f.get(t.id)?.node.stepLabel??null;if(!n||n.length<=35)return;let r=i.current?.getBoundingClientRect();if(!r)return;let a=e.clientX-r.left+12,o=e.clientY-r.top+16,c=Math.min(a,(i.current?.clientWidth??9999)-272);u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{s(n),l({x:c,y:o})},300)},[f]),C=(0,V.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),s(null),l(null)},[]),w=(0,V.useCallback)((e,t)=>{let n=i.current?.getBoundingClientRect();if(!n)return;let r=e.clientX-n.left+12,a=e.clientY-n.top+16,o=Math.min(r,(i.current?.clientWidth??9999)-272);u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{s(t),l({x:o,y:a})},300)},[]),T=(0,V.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),s(null),l(null)},[]);return(0,H.jsxs)(`div`,{ref:r,className:`h-full flex flex-col bg-[var(--bg-primary)]`,children:[(0,H.jsxs)(`div`,{className:`border-b border-[var(--border)] px-4 py-3 console-blueprint-grid`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(dy,{label:`Current`,value:d.summary.currentNodeLabel,emphasis:!0}),(0,H.jsx)(dy,{label:`Status`,value:xy(e.status)}),(0,H.jsx)(dy,{label:`Active lineage`,value:`${d.summary.lineageNodeCount} nodes`}),(0,H.jsx)(dy,{label:`Alternate branches`,value:`${d.summary.alternateBranchCount}`}),(0,H.jsx)(dy,{label:`Historical nodes`,value:`${d.summary.sideNodeCount}`}),(0,H.jsx)(dy,{label:`Blocked attempts`,value:`${d.summary.blockedAttemptCount}`}),(0,H.jsx)(dy,{label:`Critical gaps`,value:e.hasUnresolvedCriticalGaps?`Present`:`None`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(fy,{onClick:()=>m(d.startNodeId),children:`Start`}),(0,H.jsx)(fy,{onClick:()=>m(d.currentNodeId),children:`Current`}),(0,H.jsx)(fy,{onClick:()=>m(d.latestBranchNodeId),children:`Latest branch`})]})]}),(0,H.jsx)(uy,{model:d,selectedNodeId:t,runStatus:e.status,onNavigateToNode:m}),e.executionTraceSummary!==null&&e.executionTraceSummary.contextFacts.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-3`,children:e.executionTraceSummary.contextFacts.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123, 141, 167, 0.08)`,border:`1px solid rgba(123, 141, 167, 0.20)`},children:[(0,H.jsx)(`span`,{style:{color:`var(--text-secondary)`},children:Bo(e.key)}),(0,H.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`//`}),(0,H.jsx)(`span`,{style:{color:`var(--text-primary)`},children:e.value})]},e.key))})]}),(0,H.jsxs)(`div`,{ref:i,className:`relative flex-1 overflow-auto lineage-scroll-surface`,children:[(0,H.jsxs)(`div`,{style:{width:Math.max(d.graphWidth,b?.requiredWidth??0,960),height:Math.max(d.graphHeight+(h&&h.size>0?40:0),360)},children:[(0,H.jsx)(gv,{nodes:g,edges:_,fitView:!1,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,colorMode:`dark`,onNodeClick:x,onNodeMouseEnter:S,onNodeMouseLeave:C,style:{background:`transparent`}}),v&&v.map(e=>(0,H.jsx)(Ey,{x:e.x,y:e.y,cause:e.cause,onMouseEnter:w,onMouseLeave:T},e.edgeKey)),y&&y.map(e=>(0,H.jsx)(wy,{topY:e.topY,bottomY:e.bottomY,gutterX:e.gutterX,iterationCount:e.iterationCount},e.key)),b&&b.nodes.map(e=>(0,H.jsx)(Dy,{x:e.x,y:e.y,stepLabel:e.stepLabel??e.stepId,onMouseEnter:w,onMouseLeave:T},e.stepId))]}),o&&c&&(0,H.jsx)(`div`,{style:{position:`absolute`,left:c.x,top:c.y,pointerEvents:`none`,zIndex:50,maxWidth:260,background:`rgba(10, 12, 20, 0.96)`,border:`1px solid rgba(123, 141, 167, 0.35)`,padding:`6px 10px`,fontSize:12,lineHeight:1.5,color:`var(--text-primary)`,wordWrap:`break-word`,boxShadow:`0 4px 16px rgba(0,0,0,0.4)`},children:o})]})]})}function ly({node:e,isActiveLineage:t,isCurrent:n,isSelected:r,isLiveRun:i,branchKind:a,branchIndex:o,displayLabel:s,stepNumber:c,totalSteps:l,causeItems:u}){let d=vy(e),f=e.nodeKind===`blocked_attempt`&&u!==void 0&&u.length>0,[p,m]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`relative flex h-full w-full flex-col text-left overflow-hidden ${n&&i?`workrail-current-lineage-node`:``} ${r?`workrail-selected-lineage-node`:``}`,children:[d&&(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,bottom:0,width:3,background:d,pointerEvents:`none`}}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsx)(zo,{color:hy(a,t),children:by(e.nodeKind,a,o)}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[r&&(0,H.jsx)(zo,{color:`var(--warning)`,children:`Selected`}),n&&(0,H.jsx)(zo,{color:i?`var(--accent-strong)`:`var(--text-secondary)`,children:`Current`})]})]}),(0,H.jsx)(`div`,{className:t?`text-sm font-medium leading-snug`:`text-[13px] leading-snug`,style:{color:`var(--text-primary)`,display:`-webkit-box`,WebkitLineClamp:t?4:3,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:s})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-t border-[rgba(255,255,255,0.06)] bg-[rgba(0,0,0,0.18)] px-3 py-2`,children:[(0,H.jsx)(zo,{color:`var(--text-secondary)`,className:`min-w-0 truncate text-[11px]`,children:c!==null&&l!==null?`${c} / ${l}`:`evt ${e.createdAtEventIndex}`}),e.isTip?(0,H.jsx)(zo,{className:`shrink-0`,color:e.isPreferredTip?`var(--warning)`:`var(--text-muted)`,children:e.isPreferredTip?`Preferred tip`:`Tip`}):(0,H.jsx)(zo,{className:`shrink-0`,color:`transparent`,children:`spacer`})]}),f&&(0,H.jsxs)(`div`,{style:{borderTop:`1px solid rgba(239, 68, 68, 0.25)`,background:`rgba(80, 24, 31, 0.80)`,overflow:`hidden`,transition:`height 120ms ease`,height:p?72:32,flexShrink:0},children:[(0,H.jsx)(`div`,{className:`flex items-center px-3`,style:{height:32},children:(0,H.jsx)(`button`,{type:`button`,"aria-expanded":p,onClick:e=>{e.stopPropagation(),m(e=>!e)},className:`font-mono text-[9px] uppercase tracking-[0.22em] px-2 py-0.5 transition-colors`,style:{color:p?`var(--text-muted)`:`var(--accent)`,border:`1px solid ${p?`rgba(123,141,167,0.25)`:`rgba(244,196,48,0.40)`}`,background:p?`rgba(123,141,167,0.06)`:`rgba(244,196,48,0.08)`},children:p?`[ CLOSE ]`:`[ CAUSE ]`})}),p&&u&&u[0]&&(0,H.jsx)(`div`,{className:`px-3 pb-2 font-mono text-[9px] leading-relaxed`,style:{color:`var(--text-secondary)`},children:u[0].summary})]})]})}function uy({model:e,selectedNodeId:t,runStatus:n,onNavigateToNode:r}){let i=e.nodes.filter(e=>e.isActiveLineage),a=e.nodes.filter(e=>!e.isActiveLineage).slice(-8);return(0,H.jsx)(`div`,{className:`mt-3 border border-[var(--border)] bg-[rgba(10,10,10,0.38)] px-3 py-2 corner-brackets`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(zo,{children:`Lineage rail`}),i.map(e=>(0,H.jsx)(py,{label:e.node.stepLabel??Qv(e.node.nodeId),isCurrent:e.isCurrent,isSelected:e.node.nodeId===t,tone:`active`,onClick:()=>r(e.node.nodeId)},e.node.nodeId)),a.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`mx-1 h-px w-6 bg-[var(--border)]`}),a.map(e=>(0,H.jsx)(py,{label:Sy(e.node,e.branchKind,e.branchIndex,n),isCurrent:!1,isSelected:e.node.nodeId===t,tone:e.branchKind===`blocked`?`blocked`:`side`,onClick:()=>r(e.node.nodeId)},e.node.nodeId))]})]})})}function dy({label:e,value:t,emphasis:n=!1}){return(0,H.jsxs)(`div`,{className:`min-w-[120px] border px-3 py-2`,style:{borderColor:n?`rgba(0, 240, 255, 0.42)`:`var(--border)`,background:n?`rgba(0, 240, 255, 0.08)`:`rgba(15, 19, 31, 0.78)`},children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-[var(--text-primary)]`,children:t})]})}function fy({children:e,onClick:t}){return(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2 font-mono text-[11px] uppercase tracking-[0.30em] text-[var(--text-secondary)] transition-colors hover:border-[var(--accent-strong)] hover:text-[var(--text-primary)]`,children:e})}function py({label:e,isCurrent:t,isSelected:n,tone:r,onClick:i}){return(0,H.jsx)(`button`,{type:`button`,title:e,onClick:i,className:`border px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em] text-[var(--text-secondary)] transition-colors hover:text-[var(--text-primary)]`,style:{background:n?`rgba(244, 179, 65, 0.16)`:r===`active`?t?`rgba(0, 240, 255, 0.2)`:`rgba(0, 240, 255, 0.08)`:r===`blocked`?`rgba(239, 68, 68, 0.12)`:`rgba(125, 136, 156, 0.12)`,borderColor:n?`rgba(244, 179, 65, 0.48)`:r===`active`?t?`rgba(0, 240, 255, 0.6)`:`rgba(0, 240, 255, 0.32)`:r===`blocked`?`rgba(239, 68, 68, 0.34)`:`rgba(125, 136, 156, 0.3)`},children:Cy(e)})}function my(e,t){return e.nodeKind===`blocked_attempt`?t?`rgba(80, 24, 31, 0.92)`:`rgba(52, 24, 30, 0.82)`:e.nodeKind===`checkpoint`?t?`rgba(18, 61, 51, 0.92)`:`rgba(18, 43, 38, 0.82)`:t?`rgba(27, 31, 44, 0.96)`:`rgba(24, 28, 39, 0.82)`}function hy(e,t){return e===`blocked`?`var(--error)`:e===`alternate`?t?`var(--accent-strong)`:`rgba(186, 197, 219, 0.72)`:t?`var(--accent-strong)`:`var(--text-muted)`}function gy(e,t,n,r){return r?`var(--warning)`:n?`var(--accent-strong)`:e.nodeKind===`blocked_attempt`?t?`var(--error)`:`rgba(239, 68, 68, 0.5)`:e.nodeKind===`checkpoint`?t?`var(--success)`:`rgba(34, 197, 94, 0.45)`:t?`rgba(0, 240, 255, 0.55)`:`rgba(123, 141, 167, 0.45)`}var _y=[{test:e=>e.hasFailedValidations,color:`var(--error)`},{test:e=>e.hasGaps,color:`var(--warning)`},{test:e=>e.hasRecap||e.hasArtifacts,color:`var(--accent)`}];function vy(e){return _y.find(t=>t.test(e))?.color??null}function yy(e){switch(e){case`blocked_attempt`:return`Blocked`;case`checkpoint`:return`Checkpoint`;case`step`:return`Step`}}function by(e,t,n){return t===`blocked`?n?`Blocked branch ${n}`:`Blocked branch`:t===`alternate`?n?`Alt branch ${n}`:`Alt branch`:yy(e)}function xy(e){switch(e){case`complete`:return`Complete`;case`complete_with_gaps`:return`Complete with gaps`;case`blocked`:return`Blocked`;case`in_progress`:return`In progress`}}function Sy(e,t,n,r){return e.stepLabel?e.stepLabel:t===`blocked`?n?`Blocked attempt ${n}`:`Blocked attempt`:t===`alternate`?n?`Alternate path ${n}`:`Alternate path`:e.isPreferredTip&&(r===`complete`||r===`complete_with_gaps`)?`Complete`:Qv(e.nodeId)}function Cy(e){return e.length>18?`${e.slice(0,18)}…`:e}function wy({topY:e,bottomY:t,gutterX:n,iterationCount:r}){let i=t-e;return i<=0?null:(0,H.jsxs)(`div`,{style:{position:`absolute`,left:n,top:e,width:32,height:i,pointerEvents:`none`,zIndex:1},children:[(0,H.jsx)(`div`,{style:{position:`absolute`,left:14,top:0,bottom:0,width:3,background:`var(--accent)`,opacity:.7}}),(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,top:-2,whiteSpace:`nowrap`},children:(0,H.jsx)(zo,{color:`var(--accent)`,style:{fontSize:9},children:`[ LOOP ]`})}),(0,H.jsx)(`div`,{style:{position:`absolute`,left:0,bottom:-2,whiteSpace:`nowrap`},children:(0,H.jsx)(zo,{color:`var(--accent)`,style:{fontSize:9},children:`[ // ${r}x ]`})})]})}var Ty={condition:{char:`C`,color:`#f4c430`},fork:{char:`F`,color:`var(--warning)`},divergence:{char:`D`,color:`var(--error)`},advance:{char:`>`,color:`rgba(0,175,192,0.60)`}};function Ey({x:e,y:t,cause:n,onMouseEnter:r,onMouseLeave:i}){let a=Ty[n.kind];return(0,H.jsx)(`div`,{style:{position:`absolute`,left:e-5,top:t-5,width:10,height:10,transform:`rotate(45deg)`,background:a.color,zIndex:1,pointerEvents:`auto`,cursor:`default`,display:`flex`,alignItems:`center`,justifyContent:`center`},onMouseEnter:e=>r(e,n.summary),onMouseLeave:i,children:(0,H.jsx)(`span`,{style:{display:`block`,transform:`rotate(-45deg)`,fontSize:7,lineHeight:1,fontFamily:`monospace`,fontWeight:700,color:`rgba(0,0,0,0.75)`,userSelect:`none`,pointerEvents:`none`},children:a.char})})}function Dy({x:e,y:t,stepLabel:n,onMouseEnter:r,onMouseLeave:i}){return(0,H.jsxs)(`div`,{style:{position:`absolute`,left:e,top:t,width:220,height:124,opacity:.25,pointerEvents:`auto`,cursor:`default`,border:`1px dashed rgba(123, 141, 167, 0.55)`,background:`rgba(24, 28, 39, 0.60)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,zIndex:0},onMouseEnter:e=>r(e,n),onMouseLeave:i,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 pt-3`,children:[(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.70)`,children:`Skipped`}),(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.55)`,className:`text-[9px]`,children:`[ SKIPPED ]`})]}),(0,H.jsx)(`div`,{className:`grow px-3 pt-2 text-sm leading-snug`,style:{color:`rgba(186, 197, 219, 0.65)`,display:`-webkit-box`,WebkitLineClamp:4,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:n}),(0,H.jsx)(`div`,{className:`flex items-center border-t px-3 py-2`,style:{borderColor:`rgba(255,255,255,0.04)`,background:`rgba(0,0,0,0.12)`},children:(0,H.jsx)(zo,{color:`rgba(123, 141, 167, 0.45)`,className:`text-[11px]`,children:`not executed`})})]})}function Oy({label:e,color:t,bgColor:n}){return(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.20em]`,style:{color:t,backgroundColor:n,border:`1px solid ${t}40`},children:e})}function ky(e){switch(e.kind){case`selected_next_step`:return{label:`STEP`,color:`var(--accent)`,bgColor:`rgba(244, 196, 48, 0.12)`};case`evaluated_condition`:return ty(e)?{label:`CONDITION`,color:`var(--success)`,bgColor:`rgba(34, 197, 94, 0.12)`}:{label:`CONDITION`,color:`var(--text-muted)`,bgColor:`rgba(123, 141, 167, 0.10)`};case`detected_non_tip_advance`:return{label:`FORK`,color:`var(--warning)`,bgColor:`rgba(251, 146, 60, 0.12)`};case`divergence`:return{label:`DIVERGE`,color:`var(--error)`,bgColor:`rgba(239, 68, 68, 0.12)`};case`entered_loop`:case`exited_loop`:return{label:`LOOP`,color:`var(--accent)`,bgColor:`rgba(0, 240, 255, 0.10)`};case`context_fact`:return{label:`FACT`,color:`var(--text-muted)`,bgColor:`rgba(123, 141, 167, 0.10)`};default:return{label:`INFO`,color:`var(--text-secondary)`,bgColor:`rgba(123, 141, 167, 0.08)`}}}function Ay({group:e}){let[t,n]=(0,V.useState)(e.iterationCount<=3),r=e.iterationCount;return(0,H.jsxs)(`li`,{className:`flex flex-col gap-1 py-1.5 border-b border-[var(--border)] last:border-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsxs)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.20em]`,style:{color:`var(--accent)`,backgroundColor:`rgba(0, 240, 255, 0.10)`,border:`1px solid rgba(0, 240, 255, 0.25)`},children:[`LOOP: `,r]}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-secondary)] leading-relaxed flex-1`,children:e.enteredItem.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.enteredItem.recordedAtEventIndex]})]}),(0,H.jsxs)(`div`,{className:`text-[10px] font-mono text-[var(--text-muted)] pl-[calc(theme(spacing.2)+theme(spacing.3)+4ch)]`,children:[`stopped when: `,e.exitedItem.summary]}),e.innerItems.length>0&&(0,H.jsxs)(`div`,{className:`pl-4 mt-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`font-mono text-[10px] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors`,children:t?`[ collapse ]`:`[ expand ${e.innerItems.length} inner items ]`}),t&&(0,H.jsx)(`ol`,{className:`mt-1 space-y-1`,children:e.innerItems.map(e=>{let t=ky(e);return(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-xs text-[var(--text-muted)]`,children:[(0,H.jsx)(Oy,{label:t.label,color:t.color,bgColor:t.bgColor}),(0,H.jsx)(`span`,{className:`flex-1 leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]},e.recordedAtEventIndex)})})]})]})}function jy({runStatus:e}){let t=(()=>{switch(e){case`complete`:case`complete_with_gaps`:return{text:`// ------ RUN COMPLETE ------`,color:`var(--success)`};case`blocked`:return{text:`// ------ RUN BLOCKED ------`,color:`var(--error)`};case`in_progress`:return{text:`// ------ IN PROGRESS ------`,color:`var(--accent)`}}})();return(0,H.jsx)(`div`,{className:`font-mono text-[11px] text-center py-3 mt-1`,style:{color:t.color},children:t.text})}function My({facts:e}){return e.length===0?null:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 px-4 py-2 border-b border-[var(--border)] bg-[rgba(0,240,255,0.03)]`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123, 141, 167, 0.08)`,border:`1px solid rgba(123, 141, 167, 0.20)`},children:[(0,H.jsx)(`span`,{style:{color:`var(--text-secondary)`},children:Bo(e.key)}),(0,H.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`//`}),(0,H.jsx)(`span`,{style:{color:`var(--text-primary)`},children:e.value})]},e.key))})}var Ny=80;function Py({summary:e,runStatus:t}){let n=ry(e.items),r=(0,V.useRef)(null),i=(0,V.useRef)(n.length),[a,o]=(0,V.useState)(0),[s,c]=(0,V.useState)(!0);return(0,V.useEffect)(()=>{let e=r.current;if(!e)return;let t=i.current,a=n.length-t;i.current=n.length,!(a<=0)&&(s?(e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),o(0)):o(e=>e+a))},[n.length,s]),(0,V.useEffect)(()=>{let e=r.current;if(!e)return;function t(){if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c(t<=Ny),t<=Ny&&o(0)}return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),n.length===0?(0,H.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:`// TRACE -- no routing decisions were recorded for this run`})}):(0,H.jsxs)(`div`,{className:`h-full flex flex-col bg-[var(--bg-primary)] relative`,children:[(0,H.jsx)(My,{facts:e.contextFacts}),(0,H.jsxs)(`div`,{ref:r,className:`flex-1 overflow-y-auto px-4 py-2`,children:[(0,H.jsx)(`ol`,{className:`space-y-0`,children:n.map(e=>{if(e.kind===`loop_group`)return(0,H.jsx)(Ay,{group:e},e.enteredItem.recordedAtEventIndex);let{item:t}=e,n=ky(t);return(0,H.jsxs)(`li`,{className:`flex items-start gap-3 py-1.5 border-b border-[var(--border)] last:border-0`,children:[(0,H.jsx)(Oy,{label:n.label,color:n.color,bgColor:n.bgColor}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-secondary)] leading-relaxed flex-1`,children:t.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,t.recordedAtEventIndex]})]},t.recordedAtEventIndex)})}),(0,H.jsx)(jy,{runStatus:t})]}),!s&&a>0&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{r.current?.scrollTo({top:r.current.scrollHeight,behavior:`smooth`}),o(0)},className:`absolute bottom-4 left-1/2 -translate-x-1/2 font-mono text-[10px] uppercase tracking-[0.20em] px-3 py-1.5 transition-colors`,style:{backgroundColor:`rgba(0, 240, 255, 0.15)`,border:`1px solid rgba(0, 240, 255, 0.35)`,color:`var(--accent)`},children:[`[ `,a,` NEW ]`]})]})}function Fy(e,t){return e.isLoading?{state:`loading`}:e.isError?{state:`error`,message:e.error instanceof Error?e.error.message:`Could not load performance data.`,retry:t}:e.data===null?{state:`devModeOff`}:e.data===void 0?{state:`loading`}:e.data.devMode===!1?{state:`devModeOff`}:{state:`data`,data:e.data}}var Iy=class extends Error{constructor(e,t){super(`HTTP ${e}: ${t}`),this.status=e,this.name=`HttpError`}};async function Ly(e){let t=await fetch(e);if(!t.ok)throw new Iy(t.status,t.statusText);let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Unknown error`);return n.data}function Ry(){return rt({queryKey:[`sessions`],queryFn:()=>Ly(`/api/v2/sessions`),refetchInterval:3e4,staleTime:25e3})}function zy(e){return rt({queryKey:[`session`,e],queryFn:()=>Ly(`/api/v2/sessions/${e}`),enabled:!!e,refetchInterval:5e3,refetchIntervalInBackground:!1,staleTime:3e3})}function By(e,t){return rt({queryKey:[`node`,e,t],queryFn:()=>Ly(`/api/v2/sessions/${e}/nodes/${t}`),enabled:!!t})}function Vy(){return rt({queryKey:[`worktrees`],queryFn:()=>Ly(`/api/v2/worktrees`),refetchInterval:3e4,staleTime:2e4})}function Hy(){return rt({queryKey:[`workflows`],queryFn:()=>Ly(`/api/v2/workflows`),staleTime:1/0,refetchInterval:!1})}function Uy(){let e=rt({queryKey:[`perf`,`tool-calls`],queryFn:async()=>{try{return await Ly(`/api/v2/perf/tool-calls`)}catch(e){if(e instanceof Iy&&e.status===404)return null;throw e}},refetchInterval:5e3,staleTime:3e3,refetchIntervalInBackground:!1});return Fy(e,()=>void e.refetch())}function Wy(e){return rt({queryKey:[`workflow`,e],queryFn:()=>Ly(`/api/v2/workflows/${e}`),enabled:e!==null,staleTime:1/0,refetchInterval:!1})}function Gy(){return rt({queryKey:[`triggers`],queryFn:async()=>{try{return await Ly(`/api/v2/triggers`)}catch(e){if(e instanceof Iy&&e.status===503)return{triggers:[]};throw e}},staleTime:3e4,refetchInterval:6e4})}async function Ky(e){let t=await fetch(`/api/v2/auto/dispatch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw new Iy(t.status,e.error??t.statusText)}let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Dispatch failed`);return n.data}function qy(){let e=He();(0,V.useEffect)(()=>{let t=null,n=null;function r(){t=new EventSource(`/api/v2/workspace/events`),t.onmessage=t=>{try{let n=JSON.parse(t.data);n.type===`change`?e.invalidateQueries({queryKey:[`sessions`]}):n.type===`worktrees-updated`&&e.invalidateQueries({queryKey:[`worktrees`]})}catch{}},t.onerror=()=>{t?.close(),t=null,n=setTimeout(r,5e3)}}return r(),()=>{n!==null&&clearTimeout(n),t?.close()}},[e])}function Jy(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Yy=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xy=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zy={};function Qy(e,t){return((t||Zy).jsx?Xy:Yy).test(e)}var $y=/[ \t\n\f\r]/g;function eb(e){return typeof e==`object`?e.type===`text`?tb(e.value):!1:tb(e)}function tb(e){return e.replace($y,``)===``}var nb=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};nb.prototype.normal={},nb.prototype.property={},nb.prototype.space=void 0;function rb(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new nb(n,r,t)}function ib(e){return e.toLowerCase()}var ab=class{constructor(e,t){this.attribute=t,this.property=e}};ab.prototype.attribute=``,ab.prototype.booleanish=!1,ab.prototype.boolean=!1,ab.prototype.commaOrSpaceSeparated=!1,ab.prototype.commaSeparated=!1,ab.prototype.defined=!1,ab.prototype.mustUseProperty=!1,ab.prototype.number=!1,ab.prototype.overloadedBoolean=!1,ab.prototype.property=``,ab.prototype.spaceSeparated=!1,ab.prototype.space=void 0;var ob=s({boolean:()=>Z,booleanish:()=>cb,commaOrSpaceSeparated:()=>fb,commaSeparated:()=>db,number:()=>Q,overloadedBoolean:()=>lb,spaceSeparated:()=>ub}),sb=0,Z=pb(),cb=pb(),lb=pb(),Q=pb(),ub=pb(),db=pb(),fb=pb();function pb(){return 2**++sb}var mb=Object.keys(ob),hb=class extends ab{constructor(e,t,n,r){let i=-1;if(super(e,t),gb(this,`space`,r),typeof n==`number`)for(;++i<mb.length;){let e=mb[i];gb(this,mb[i],(n&ob[e])===ob[e])}}};hb.prototype.defined=!0;function gb(e,t,n){n&&(e[t]=n)}function _b(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hb(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ib(r)]=r,n[ib(a.attribute)]=r}return new nb(t,n,e.space)}var vb=_b({properties:{ariaActiveDescendant:null,ariaAtomic:cb,ariaAutoComplete:null,ariaBusy:cb,ariaChecked:cb,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:ub,ariaCurrent:null,ariaDescribedBy:ub,ariaDetails:null,ariaDisabled:cb,ariaDropEffect:ub,ariaErrorMessage:null,ariaExpanded:cb,ariaFlowTo:ub,ariaGrabbed:cb,ariaHasPopup:null,ariaHidden:cb,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ub,ariaLevel:Q,ariaLive:null,ariaModal:cb,ariaMultiLine:cb,ariaMultiSelectable:cb,ariaOrientation:null,ariaOwns:ub,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:cb,ariaReadOnly:cb,ariaRelevant:null,ariaRequired:cb,ariaRoleDescription:ub,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:cb,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function yb(e,t){return t in e?e[t]:t}function bb(e,t){return yb(e,t.toLowerCase())}var xb=_b({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:db,acceptCharset:ub,accessKey:ub,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:ub,autoFocus:Z,autoPlay:Z,blocking:ub,capture:null,charSet:null,checked:Z,cite:null,className:ub,cols:Q,colSpan:null,content:null,contentEditable:cb,controls:Z,controlsList:ub,coords:Q|db,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:lb,draggable:cb,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:ub,height:Q,hidden:lb,high:Q,href:null,hrefLang:null,htmlFor:ub,httpEquiv:ub,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:ub,itemRef:ub,itemScope:Z,itemType:ub,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Z,optimum:Q,pattern:null,ping:ub,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:ub,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:ub,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:cb,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:cb,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ub,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:cb,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Z,disableRemotePlayback:Z,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:bb}),Sb=_b({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:fb,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:ub,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:db,g2:db,glyphName:db,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:fb,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ub,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fb,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fb,rev:fb,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fb,requiredFeatures:fb,requiredFonts:fb,requiredFormats:fb,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:fb,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fb,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fb,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:yb}),Cb=_b({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),wb=_b({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bb}),Tb=_b({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Eb={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Db=/[A-Z]/g,Ob=/-[a-z]/g,kb=/^data[-\w.:]+$/i;function Ab(e,t){let n=ib(t),r=t,i=ab;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&kb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ob,Mb);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ob.test(e)){let n=e.replace(Db,jb);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hb}return new i(r,t)}function jb(e){return`-`+e.toLowerCase()}function Mb(e){return e.charAt(1).toUpperCase()}var Nb=rb([vb,xb,Cb,wb,Tb],`html`),Pb=rb([vb,Sb,Cb,wb,Tb],`svg`);function Fb(e){return e.join(` `).trim()}var Ib=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
16
16
|
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Lb=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Ib());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Rb=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),zb=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Lb()),r=Rb();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Bb=Hb(`end`),Vb=Hb(`start`);function Hb(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ub(e){let t=Vb(e),n=Bb(e);if(t&&n)return{start:t,end:n}}function Wb(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Kb(e.position):`start`in e||`end`in e?Kb(e):`line`in e||`column`in e?Gb(e):``}function Gb(e){return qb(e&&e.line)+`:`+qb(e&&e.column)}function Kb(e){return Gb(e&&e.start)+`-`+Gb(e&&e.end)}function qb(e){return e&&typeof e==`number`?e:1}var Jb=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Wb(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Jb.prototype.file=``,Jb.prototype.name=``,Jb.prototype.reason=``,Jb.prototype.message=``,Jb.prototype.stack=``,Jb.prototype.column=void 0,Jb.prototype.line=void 0,Jb.prototype.ancestors=void 0,Jb.prototype.cause=void 0,Jb.prototype.fatal=void 0,Jb.prototype.place=void 0,Jb.prototype.ruleId=void 0,Jb.prototype.source=void 0;var Yb=l(zb(),1),Xb={}.hasOwnProperty,Zb=new Map,Qb=/[A-Z]/g,$b=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ex=new Set([`td`,`th`]),tx=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function nx(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=px(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=fx(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Pb:Nb,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=rx(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function rx(e,t,n){if(t.type===`element`)return ix(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ax(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return sx(e,t,n);if(t.type===`mdxjsEsm`)return ox(e,t);if(t.type===`root`)return cx(e,t,n);if(t.type===`text`)return lx(e,t)}function ix(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Pb,e.schema=i),e.ancestors.push(t);let a=yx(e,t.tagName,!1),o=mx(e,t),s=gx(e,t);return $b.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!eb(e):!0})),ux(e,o,a,t),dx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ax(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}bx(e,t.position)}function ox(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bx(e,t.position)}function sx(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Pb,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:yx(e,t.name,!0),o=hx(e,t),s=gx(e,t);return ux(e,o,a,t),dx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function cx(e,t,n){let r={};return dx(r,gx(e,t)),e.create(t,e.Fragment,r,n)}function lx(e,t){return t.value}function ux(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dx(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function fx(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function px(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Vb(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function mx(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Xb.call(t.properties,i)){let a=_x(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ex.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function hx(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else bx(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else bx(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function gx(e,t){let n=[],r=-1,i=e.passKeys?new Map:Zb;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=rx(e,a,o);s!==void 0&&n.push(s)}return n}function _x(e,t,n){let r=Ab(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Jy(n):Fb(n)),r.property===`style`){let t=typeof n==`object`?n:vx(e,String(n));return e.stylePropertyNameCase===`css`&&(t=xx(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Eb[r.property]||r.property:r.attribute,n]}}function vx(e,t){try{return(0,Yb.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Jb("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=tx+`#cannot-parse-style-attribute`,r}}function yx(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Qy(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Qy(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Xb.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);bx(e)}function bx(e,t){let n=new Jb("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=tx+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function xx(e){let t={},n;for(n in e)Xb.call(e,n)&&(t[Sx(n)]=e[n]);return t}function Sx(e){let t=e.replace(Qb,Cx);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Cx(e){return`-`+e.toLowerCase()}var wx={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Tx={};function Ex(e,t){let n=t||Tx;return Dx(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Dx(e,t,n){if(kx(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Ox(e.children,t,n)}return Array.isArray(e)?Ox(e,t,n):``}function Ox(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Dx(e[i],t,n);return r.join(``)}function kx(e){return!!(e&&typeof e==`object`)}var Ax=document.createElement(`i`);function jx(e){let t=`&`+e+`;`;Ax.innerHTML=t;let n=Ax.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Mx(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Nx(e,t){return e.length>0?(Mx(e,e.length,0,t),e):t}var Px={}.hasOwnProperty;function Fx(e){let t={},n=-1;for(;++n<e.length;)Ix(t,e[n]);return t}function Ix(e,t){let n;for(n in t){let r=(Px.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Px.call(r,a)||(r[a]=[]);let e=i[a];Lx(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Lx(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Mx(e,0,0,r)}function Rx(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function zx(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Bx=Zx(/[A-Za-z]/),Vx=Zx(/[\dA-Za-z]/),Hx=Zx(/[#-'*+\--9=?A-Z^-~]/);function Ux(e){return e!==null&&(e<32||e===127)}var Wx=Zx(/\d/),Gx=Zx(/[\dA-Fa-f]/),Kx=Zx(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function qx(e){return e!==null&&(e<0||e===32)}function Jx(e){return e===-2||e===-1||e===32}var Yx=Zx(/\p{P}|\p{S}/u),Xx=Zx(/\s/);function Zx(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Qx(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Vx(e.charCodeAt(n+1))&&Vx(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $x(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Jx(r)?(e.enter(n),s(r)):t(r)}function s(r){return Jx(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var eS={tokenize:tS};function tS(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$x(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var nS={tokenize:iS},rS={tokenize:aS};function iS(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Mx(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rS,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(rS,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return $(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Mx(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function aS(e,t,n){return $x(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function oS(e){if(e===null||qx(e)||Xx(e))return 1;if(Yx(e))return 2}function sS(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var cS={name:`attention`,resolveAll:lS,tokenize:uS};function lS(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};dS(d,-c),dS(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Nx(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Nx(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Nx(l,sS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Nx(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Nx(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Mx(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function uS(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=oS(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=oS(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function dS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var fS={name:`autolink`,tokenize:pS};function pS(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Bx(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Vx(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Vx(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ux(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Hx(t)?(e.consume(t),l):n(t)}function u(e){return Vx(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Vx(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var mS={partial:!0,tokenize:hS};function hS(e,t,n){return r;function r(t){return Jx(t)?$x(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var gS={continuation:{tokenize:vS},exit:yS,name:`blockQuote`,tokenize:_S};function _S(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Jx(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function vS(e,t,n){let r=this;return i;function i(t){return Jx(t)?$x(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(gS,t,n)(r)}}function yS(e){e.exit(`blockQuote`)}var bS={name:`characterEscape`,tokenize:xS};function xS(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Kx(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var SS={name:`characterReference`,tokenize:CS};function CS(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Vx,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Gx,u):(e.enter(`characterReferenceValue`),a=7,o=Wx,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Vx&&!jx(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var wS={partial:!0,tokenize:DS},TS={concrete:!0,name:`codeFenced`,tokenize:ES};function ES(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Jx(t)?$x(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(wS,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Jx(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$x(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Jx(t)?$x(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(wS,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Jx(t)?$x(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Jx(t)?$x(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function DS(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var OS={name:`codeIndented`,tokenize:AS},kS={partial:!0,tokenize:jS};function AS(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$x(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):$(t)?e.attempt(kS,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||$(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function jS(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$x(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):$(e)?i(e):n(e)}}var MS={name:`codeText`,previous:PS,resolve:NS,tokenize:FS};function NS(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function PS(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function FS(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||$(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var IS=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&LS(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),LS(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),LS(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);LS(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);LS(this.left,t.reverse())}}};function LS(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function RS(e){let t={},n=-1,r,i,a,o,s,c,l,u=new IS(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,zS(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Mx(e,0,1/0,u.slice(0)),!l}function zS(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var BS={resolve:HS,tokenize:US},VS={partial:!0,tokenize:WS};function HS(e){return RS(e),e}function US(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):$(t)?e.check(VS,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function WS(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$x(e,a,`linePrefix`)}function a(i){if(i===null||$(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function GS(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ux(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||$(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||qx(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ux(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function KS(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):$(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Jx(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function qS(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$x(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function JS(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Jx(i)?$x(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var YS={name:`definition`,tokenize:ZS},XS={partial:!0,tokenize:QS};function ZS(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return KS.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=zx(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return qx(t)?JS(e,l)(t):l(t)}function l(t){return GS(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(XS,d,d)(t)}function d(t){return Jx(t)?$x(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function QS(e,t,n){return r;function r(t){return qx(t)?JS(e,i)(t):n(t)}function i(t){return qS(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Jx(t)?$x(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var $S={name:`hardBreakEscape`,tokenize:eC};function eC(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var tC={name:`headingAtx`,resolve:nC,tokenize:rC};function nC(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Mx(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function rC(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||qx(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):Jx(n)?$x(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||qx(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var iC=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),aC=[`pre`,`script`,`style`,`textarea`],oC={concrete:!0,name:`htmlFlow`,resolveTo:lC,tokenize:uC},sC={partial:!0,tokenize:fC},cC={partial:!0,tokenize:dC};function lC(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function uC(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):Bx(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Bx(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Bx(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||qx(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&aC.includes(l)?(i=1,r.interrupt?t(s):O(s)):iC.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Vx(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Jx(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Bx(t)?(e.consume(t),b):Jx(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Vx(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Jx(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Jx(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||qx(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Jx(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):Jx(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),ee):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(sC,L,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(cC,A,L)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),F):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return aC.includes(n)?(e.consume(t),I):O(t)}return Bx(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),F):O(t)}function I(t){return t===null||$(t)?(e.exit(`htmlFlowData`),L(t)):(e.consume(t),I)}function L(n){return e.exit(`htmlFlow`),t(n)}}function dC(e,t,n){let r=this;return i;function i(t){return $(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function fC(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(mS,t,n)}}var pC={name:`htmlText`,tokenize:mC};function mC(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Bx(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Bx(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):$(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):$(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):$(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Bx(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Vx(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,N(t)):Jx(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Vx(t)?(e.consume(t),w):t===47||t===62||qx(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Bx(t)?(e.consume(t),E):$(t)?(o=T,N(t)):Jx(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Vx(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,N(t)):Jx(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):$(t)?(o=O,N(t)):Jx(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):$(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||qx(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||qx(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Jx(t)?$x(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var hC={name:`labelEnd`,resolveAll:yC,resolveTo:bC,tokenize:xC},gC={tokenize:SC},_C={tokenize:CC},vC={tokenize:wC};function yC(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Mx(e,0,e.length,n),e}function bC(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Nx(s,e.slice(a+1,a+r+3)),s=Nx(s,[[`enter`,u,t]]),s=Nx(s,sS(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Nx(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Nx(s,e.slice(o+1)),s=Nx(s,[[`exit`,c,t]]),Mx(e,a,e.length,s),e}function xC(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(zx(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(gC,u,o?u:d)(t):t===91?e.attempt(_C,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(vC,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function SC(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return qx(t)?JS(e,a)(t):a(t)}function a(t){return t===41?u(t):GS(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return qx(t)?JS(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?qS(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return qx(t)?JS(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function CC(e,t,n){let r=this;return i;function i(t){return KS.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(zx(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function wC(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var TC={name:`labelStartImage`,resolveAll:hC.resolveAll,tokenize:EC};function EC(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var DC={name:`labelStartLink`,resolveAll:hC.resolveAll,tokenize:OC};function OC(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var kC={name:`lineEnding`,tokenize:AC};function AC(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$x(e,t,`linePrefix`)}}var jC={name:`thematicBreak`,tokenize:MC};function MC(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Jx(t)?$x(e,s,`whitespace`)(t):s(t))}}var NC={continuation:{tokenize:LC},exit:zC,name:`list`,tokenize:IC},PC={partial:!0,tokenize:BC},FC={partial:!0,tokenize:RC};function IC(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Wx(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(jC,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Wx(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(mS,r.interrupt?n:u,e.attempt(PC,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Jx(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function LC(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mS,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$x(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Jx(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(FC,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$x(e,e.attempt(NC,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function RC(e,t,n){let r=this;return $x(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function zC(e){e.exit(this.containerState.type)}function BC(e,t,n){let r=this;return $x(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Jx(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var VC={name:`setextUnderline`,resolveTo:HC,tokenize:UC};function HC(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function UC(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Jx(t)?$x(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var WC={tokenize:GC};function GC(e){let t=this,n=e.attempt(mS,r,e.attempt(this.parser.constructs.flowInitial,i,$x(e,e.attempt(this.parser.constructs.flow,i,e.attempt(BS,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var KC={resolveAll:XC()},qC=YC(`string`),JC=YC(`text`);function YC(e){return{resolveAll:XC(e===`text`?ZC:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function XC(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function ZC(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var QC=s({attentionMarkers:()=>ow,contentInitial:()=>ew,disable:()=>sw,document:()=>$C,flow:()=>nw,flowInitial:()=>tw,insideSpan:()=>aw,string:()=>rw,text:()=>iw}),$C={42:NC,43:NC,45:NC,48:NC,49:NC,50:NC,51:NC,52:NC,53:NC,54:NC,55:NC,56:NC,57:NC,62:gS},ew={91:YS},tw={[-2]:OS,[-1]:OS,32:OS},nw={35:tC,42:jC,45:[VC,jC],60:oC,61:VC,95:jC,96:TS,126:TS},rw={38:SS,92:bS},iw={[-5]:kC,[-4]:kC,[-3]:kC,33:TC,38:SS,42:cS,60:[fS,pC],91:DC,92:[$S,bS],93:hC,95:cS,96:MS},aw={null:[cS,KC]},ow={null:[42,95]},sw={null:[]};function cw(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Nx(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=sS(a,l.events,l),l.events):[]}function f(e,t){return uw(p(e),t)}function p(e){return lw(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){$(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Mx(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function lw(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function uw(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
17
17
|
`;break;case-3:o=`\r
|
|
18
18
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function dw(e){let t={constructs:Fx([QC,...(e||{}).extensions||[]]),content:n(eS),defined:[],document:n(nS),flow:n(WC),lazy:{},string:n(qC),text:n(JC)};return t;function n(e){return n;function n(n){return cw(t,e,n)}}}function fw(e){for(;!RS(e););return e}var pw=/[\0\t\n\r]/g;function mw(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(pw.lastIndex=u,c=pw.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var hw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function gw(e){return e.replace(hw,_w)}function _w(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Rx(n.slice(t?2:1),t?16:10)}return jx(n)||e}var vw={}.hasOwnProperty;function yw(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),bw(n)(fw(dw(n).document().write(mw()(e,t,!0))))}function bw(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(me),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ue),blockQuote:a(ae),characterEscape:T,characterReference:T,codeFenced:a(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(oe,o),codeText:a(se,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(le),hardBreakEscape:a(de),hardBreakTrailing:a(de),htmlFlow:a(fe,o),htmlFlowData:T,htmlText:a(fe,o),htmlTextData:T,image:a(pe),label:o,link:a(me),listItem:a(ge),listItemValue:f,listOrdered:a(he,d),listUnordered:a(he),paragraph:a(_e),reference:te,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ue),strong:a(ve),thematicBreak:a(be)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ie,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:z,characterReference:B,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:ee,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ne,resourceDestinationString:F,resourceTitleString:I,resource:L,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Sw(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];vw.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||ww).call(a,void 0,e[0])}for(r.position={start:xw(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:xw(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:xw(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ww).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Wb({start:e.start,end:e.end})+`): it’s not open`);n.position.end=xw(e.end)}function u(){return Ex(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=zx(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ye(),n.position={start:xw(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=xw(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=xw(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=gw(t),n.identifier=zx(t).toLowerCase()}function ee(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function L(){this.data.inReference=void 0}function te(){this.data.referenceType=`collapsed`}function ne(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=zx(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function R(e){this.data.characterReferenceType=e.type}function z(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Rx(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=jx(t);let i=this.stack[this.stack.length-1];i.value+=r}function B(e){let t=this.stack.pop();t.position.end=xw(e.end)}function re(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ie(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ae(){return{type:`blockquote`,children:[]}}function oe(){return{type:`code`,lang:null,meta:null,value:``}}function se(){return{type:`inlineCode`,value:``}}function ce(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function le(){return{type:`emphasis`,children:[]}}function ue(){return{type:`heading`,depth:0,children:[]}}function de(){return{type:`break`}}function fe(){return{type:`html`,value:``}}function pe(){return{type:`image`,title:null,url:``,alt:null}}function me(){return{type:`link`,title:null,url:``,children:[]}}function he(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ge(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function _e(){return{type:`paragraph`,children:[]}}function ve(){return{type:`strong`,children:[]}}function ye(){return{type:`text`,value:``}}function be(){return{type:`thematicBreak`}}}function xw(e){return{line:e.line,column:e.column,offset:e.offset}}function Sw(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Sw(e,r):Cw(e,r)}}function Cw(e,t){let n;for(n in t)if(vw.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function ww(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Wb({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wb({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Wb({start:t.start,end:t.end})+`) is still open`)}function Tw(e){let t=this;t.parser=n;function n(n){return yw(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Ew(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Dw(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -25,4 +25,4 @@ Error generating stack: `+e.message+`
|
|
|
25
25
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
26
26
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
27
27
|
`}),n}function LT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function RT(e,t){let n=MT(e,t),r=n.one(e,void 0),i=_T(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
28
|
-
`},i)),a}function zT(e,t){return e&&`run`in e?async function(n,r){let i=RT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return RT(n,{file:r,...e||t})}}function BT(e){if(e)throw e}var VT=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function HT(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UT(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?WT(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function WT(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var GT={basename:KT,dirname:qT,extname:JT,join:YT,sep:`/`};function KT(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);QT(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function qT(e){if(QT(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function JT(e){QT(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function YT(...e){let t=-1,n;for(;++t<e.length;)QT(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:XT(n)}function XT(e){QT(e);let t=e.codePointAt(0)===47,n=ZT(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function ZT(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function QT(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var $T={cwd:eE};function eE(){return`/`}function tE(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function nE(e){if(typeof e==`string`)e=new URL(e);else if(!tE(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return rE(e)}function rE(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var iE=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],aE=class{constructor(e){let t;t=e?tE(e)?{path:e}:typeof e==`string`||lE(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:$T.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<iE.length;){let e=iE[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)iE.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?GT.basename(this.path):void 0}set basename(e){sE(e,`basename`),oE(e,`basename`),this.path=GT.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?GT.dirname(this.path):void 0}set dirname(e){cE(this.basename,`dirname`),this.path=GT.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?GT.extname(this.path):void 0}set extname(e){if(oE(e,`extname`),cE(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=GT.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){tE(e)&&(e=nE(e)),sE(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?GT.basename(this.path,this.extname):void 0}set stem(e){sE(e,`stem`),oE(e,`stem`),this.path=GT.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Jb(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function oE(e,t){if(e&&e.includes(GT.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+GT.sep+"`")}function sE(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function cE(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function lE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var uE=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),dE=l(VT(),1),fE={}.hasOwnProperty,pE=new class e extends uE{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=UT()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,dE.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(gE(`data`,this.frozen),this.namespace[e]=t,this):fE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(gE(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=yE(e),n=this.parser||this.Parser;return mE(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),mE(`process`,this.parser||this.Parser),hE(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=yE(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);xE(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),mE(`processSync`,this.parser||this.Parser),hE(`processSync`,this.compiler||this.Compiler),this.process(e,r),vE(`processSync`,`process`,t),n;function r(e,r){t=!0,BT(e),n=r}}run(e,t,n){_E(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=yE(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),vE(`runSync`,`run`,n),r;function i(e,t){BT(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=yE(t),r=this.compiler||this.Compiler;return hE(`stringify`,r),_E(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(gE(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,dE.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];HT(o)&&HT(r)&&(r=(0,dE.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function mE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function hE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function gE(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _E(e){if(!HT(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vE(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function yE(e){return bE(e)?e:new aE(e)}function bE(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function xE(e){return typeof e==`string`||SE(e)}function SE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var CE=[],wE={allowDangerousHtml:!0},TE=/^(https?|ircs?|mailto|xmpp)$/i,EE=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function DE(e){let t=OE(e),n=kE(e);return AE(t.runSync(t.parse(n),n),e)}function OE(e){let t=e.rehypePlugins||CE,n=e.remarkPlugins||CE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wE}:wE;return pE().use(Tw).use(n).use(zT,r).use(t)}function kE(e){let t=e.children||``,n=new aE;return typeof t==`string`?n.value=t:``+t,n}function AE(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||jE;for(let e of EE)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return kT(e,l),nx(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in wx)if(Object.hasOwn(wx,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=wx[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function jE(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||TE.test(e.slice(0,t))?e:``}function ME({children:e,className:t}){return(0,H.jsx)(`div`,{className:`markdown-view ${t??``}`,children:(0,H.jsx)(DE,{children:e})})}function NE({sessionId:e,nodeId:t,runStatus:n=`complete`,currentNodeId:r=null,executionTraceSummary:i=null}){let{data:a,isLoading:o,error:s}=By(e,t);return t?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(PE,{stepLabel:a?.stepLabel??null,nodeId:t}),(0,H.jsxs)(`div`,{className:`p-4 space-y-4`,children:[o&&(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)] text-sm`,children:`Loading...`}),s&&(0,H.jsx)(`div`,{className:`text-[var(--error)] text-sm bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3`,children:s.message}),a&&(0,H.jsx)(zE,{detail:a,runStatus:n,currentNodeId:r,executionTraceSummary:i})]})]}):(0,H.jsx)(`div`,{className:`px-5 py-8 text-sm text-[var(--text-secondary)]`,children:`Select a node in the lineage to inspect its recap, validations, gaps, and artifacts.`})}function PE({stepLabel:e,nodeId:t}){return(0,H.jsxs)(`div`,{className:`px-5 py-4 border-b border-[var(--border)] console-blueprint-grid`,children:[(0,H.jsx)(`div`,{className:`text-base font-semibold text-[var(--text-primary)] leading-tight`,children:e??`Untitled node`}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-[var(--text-muted)] truncate`,children:t})]})}function FE({item:e}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1`,children:[(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]})}function IE({nodeId:e,nodeKind:t,executionTraceSummary:n}){let{whySelected:r,conditions:i,loops:a,divergences:o,forks:s}=sy(n,e);return n.items.some(t=>t.kind!==`context_fact`&&t.refs.some(t=>t.kind===`node_id`&&t.value===e))?(0,H.jsx)(eD,{title:`Routing context`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(r.length>0||t===`blocked_attempt`)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:(0,H.jsx)(Oy,{label:`WHY SELECTED`,color:`var(--accent)`,bgColor:`rgba(244,196,48,0.10)`})}),r.length>0?(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:r.map((e,t)=>(0,H.jsx)(FE,{item:e},t))}):t===`blocked_attempt`?(0,H.jsx)(`div`,{className:`pl-2 border-l border-[var(--border)]`,children:(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-muted)]`,children:`This step was attempted but not selected as the preferred path.`})}):null]}),i.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`CONDITIONS EVALUATED`,color:`var(--text-secondary)`,bgColor:`rgba(168,159,140,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:[...i.filter(e=>!ty(e)),...i.filter(e=>ty(e))].map((e,t)=>{let n=ty(e);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(Oy,{label:n?`PASS`:`SKIP`,color:n?`var(--success)`:`var(--warning)`,bgColor:n?`rgba(34,197,94,0.10)`:`rgba(251,191,36,0.10)`}),(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary})]},t)})})]}),a.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`LOOP`,color:`var(--accent-strong)`,bgColor:`rgba(0,240,255,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:a.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]}),o.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`DIVERGENCE`,color:`var(--error)`,bgColor:`rgba(255,107,107,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:o.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]}),s.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`FORK`,color:`var(--warning)`,bgColor:`rgba(251,191,36,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:s.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]})]})}):(0,H.jsx)(eD,{title:`Routing context`,children:t===`blocked_attempt`&&r.length===0?(0,H.jsxs)(`div`,{className:`flex items-start gap-2 py-1`,children:[(0,H.jsx)(Oy,{label:`WHY SELECTED`,color:`var(--text-muted)`,bgColor:`rgba(123,141,167,0.08)`}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:`This step was attempted but not selected as the preferred path.`})]}):(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:`// no routing trace for this node`})})}function LE({items:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsx)(eD,{title:`Run routing`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.20em] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors`,children:[(0,H.jsx)(Oy,{label:`RUN ROUTING`,color:`var(--text-muted)`,bgColor:`rgba(123,141,167,0.08)`}),(0,H.jsxs)(`span`,{className:`text-[var(--text-muted)]`,children:[`// `,e.length,` ambient items`]}),(0,H.jsx)(`span`,{children:t?`[-]`:`[+]`})]}),t&&(0,H.jsx)(`div`,{className:`mt-2 space-y-1 pl-2 border-l border-[var(--border)]`,children:e.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123,141,167,0.08)`,border:`1px solid rgba(123,141,167,0.20)`},children:e.kind.replace(/_/g,` `).toUpperCase()}),(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]},t))})]})})}var RE=[{id:`routing`,column:`primary`,render:({detail:e,executionTraceSummary:t})=>t===null?null:(0,H.jsx)(IE,{nodeId:e.nodeId,nodeKind:e.nodeKind,executionTraceSummary:t},`routing`)},{id:`run_routing`,column:`primary`,render:({executionTraceSummary:e})=>{if(e===null)return null;let t=e.items.filter(e=>!e.refs.some(e=>e.kind===`node_id`));return t.length===0?null:(0,H.jsx)(LE,{items:t},`run_routing`)}},{id:`recap`,column:`primary`,render:({detail:e,runStatus:t,currentNodeId:n})=>e.recapMarkdown?(0,H.jsx)(GE,{markdown:e.recapMarkdown},`recap`):t===`in_progress`&&e.nodeId===n&&!e.recapMarkdown?(0,H.jsx)(BE,{detail:e},`recap-in-progress`):null},{id:`validations`,column:`primary`,render:({detail:e})=>e.validations.length>0?(0,H.jsx)(qE,{validations:e.validations},`validations`):null},{id:`gaps`,column:`primary`,render:({detail:e})=>e.gaps.length>0?(0,H.jsx)(YE,{gaps:e.gaps},`gaps`):null},{id:`advance-outcome`,column:`primary`,render:({detail:e})=>e.advanceOutcome?(0,H.jsx)(KE,{outcome:e.advanceOutcome},`advance-outcome`):null},{id:`artifacts`,column:`primary`,render:({detail:e})=>e.artifacts.length>0?(0,H.jsx)($E,{artifacts:e.artifacts},`artifacts`):null},{id:`node-meta`,column:`primary`,render:({detail:e})=>(0,H.jsx)(WE,{detail:e},`node-meta`)}];function zE(e){return(0,H.jsx)(`div`,{className:`space-y-4`,children:RE.map(t=>t.render(e))})}function BE({detail:e}){return(0,H.jsx)(eD,{title:`Recap`,children:(0,H.jsxs)(`div`,{className:`space-y-4 text-sm text-[var(--text-secondary)]`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(VE,{children:`In progress`}),(0,H.jsxs)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:[`event #`,e.createdAtEventIndex]})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]`,children:[(0,H.jsx)(HE,{label:`Current focus`,value:e.stepLabel??`Current workflow step`,supportingText:`This step is still running, so the recap will appear once execution finishes.`}),(0,H.jsx)(HE,{label:`Current state`,value:`Waiting for step completion`,supportingText:`The node has been created and selected as the current workflow position.`,mono:!0})]}),(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`px-4 py-3 border-b border-[var(--border)]`,children:(0,H.jsx)(zo,{children:`What lands here next`})}),(0,H.jsxs)(`div`,{className:`p-4 grid gap-3 md:grid-cols-3`,children:[(0,H.jsx)(UE,{title:`Recap`,description:`A step summary is written when this node completes.`}),(0,H.jsx)(UE,{title:`Validations`,description:`Validation results appear if this step records contract checks.`}),(0,H.jsx)(UE,{title:`Artifacts`,description:`Generated outputs show up here after the step produces them.`})]})]})]})})}function VE({children:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium text-xs`,style:{backgroundColor:`rgba(0, 219, 233, 0.12)`,color:`var(--accent-strong)`},children:e})}function HE({label:e,value:t,supportingText:n,mono:r=!1}){return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 space-y-2`,children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:r?`font-mono text-sm text-[var(--text-primary)]`:`text-[var(--text-primary)]`,children:t}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:n})]})}function UE({title:e,description:t}){return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] bg-[rgba(255,255,255,0.02)] px-3 py-3 space-y-2`,children:[(0,H.jsx)(zo,{color:`var(--text-secondary)`,children:e}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:t})]})}function WE({detail:e}){return(0,H.jsx)(eD,{title:`Node details`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(tD,{label:`Kind`,value:(0,H.jsx)(rD,{kind:e.nodeKind})}),(0,H.jsx)(tD,{label:`Event index`,value:String(e.createdAtEventIndex),mono:!0}),(0,H.jsx)(tD,{label:`Parent`,value:e.parentNodeId??`Root`,mono:!0}),(0,H.jsx)(tD,{label:`Tip state`,value:e.isTip?e.isPreferredTip?`Preferred tip`:`Tip`:`Historical`})]})})}function GE({markdown:e}){return(0,H.jsx)(eD,{title:`Recap`,children:(0,H.jsx)(ME,{children:e})})}function KE({outcome:e}){let t=e.kind===`advanced`;return(0,H.jsx)(eD,{title:`Advance outcome`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:t?`var(--success)20`:`var(--blocked)20`,color:t?`var(--success)`:`var(--blocked)`},children:t?`Advanced`:`Blocked`}),(0,H.jsxs)(`span`,{className:`text-[var(--text-muted)]`,children:[`attempt `,e.attemptId.slice(-8),` at event #`,e.recordedAtEventIndex]})]})})}function qE({validations:e}){return(0,H.jsx)(eD,{title:`Validations (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsx)(JE,{validation:e},e.validationId))})})}function JE({validation:e}){let t=e.outcome===`pass`;return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 text-xs space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:t?`var(--success)20`:`var(--error)20`,color:t?`var(--success)`:`var(--error)`},children:t?`Pass`:`Fail`}),(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] font-mono`,children:e.contractRef})]}),e.issues.length>0&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] mb-1`,children:`Issues`}),(0,H.jsx)(`ul`,{className:`list-disc list-inside text-[var(--error)] space-y-0.5`,children:e.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]}),e.suggestions.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] mb-1`,children:`Suggestions`}),(0,H.jsx)(`ul`,{className:`list-disc list-inside text-[var(--text-secondary)] space-y-0.5`,children:e.suggestions.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]})]})}function YE({gaps:e}){return(0,H.jsx)(eD,{title:`Gaps (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 text-xs bg-[var(--bg-primary)] border border-[var(--border)] px-3 py-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:e.isResolved?`var(--success)20`:e.severity===`critical`?`var(--error)20`:`var(--warning)20`,color:e.isResolved?`var(--success)`:e.severity===`critical`?`var(--error)`:`var(--warning)`},children:e.isResolved?`Resolved`:e.severity===`critical`?`Critical`:`Non-critical`}),(0,H.jsx)(`span`,{className:`text-[var(--text-secondary)] leading-relaxed`,children:e.summary})]},e.gapId))})})}var XE=1e5,ZE=[{prefix:`text/`,render:e=>(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e==`string`?e:String(e)})},{prefix:`application/json`,render:e=>(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e==`string`?e:JSON.stringify(e,null,2)})}];function QE(e){if(e.byteLength>XE)return(0,H.jsxs)(`div`,{className:`text-[var(--text-muted)] italic`,children:[`Content too large to display (`,iD(e.byteLength),` -- limit `,iD(XE),`)`]});let t=ZE.find(t=>e.contentType.startsWith(t.prefix));return t?t.render(e.content):(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e.content==`string`?e.content:JSON.stringify(e.content,null,2)})}function $E({artifacts:e}){return(0,H.jsx)(eD,{title:`Artifacts (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 text-xs space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[var(--text-muted)]`,children:[(0,H.jsx)(`span`,{children:e.contentType}),(0,H.jsx)(`span`,{children:`//`}),(0,H.jsx)(`span`,{children:iD(e.byteLength)})]}),QE(e)]},e.sha256))})})}function eD({title:e,children:t}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-2`,children:(0,H.jsx)(zo,{children:e})}),t]})}function tD({label:e,value:t,mono:n=!1}){return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3`,children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:n?`mt-2 font-mono text-sm text-[var(--text-secondary)] truncate`:`mt-2 text-sm text-[var(--text-primary)]`,children:t})]})}var nD={step:{label:`Step`,color:`var(--accent)`},checkpoint:{label:`Checkpoint`,color:`var(--success)`},blocked_attempt:{label:`Blocked`,color:`var(--error)`}};function rD({kind:e}){let t=nD[e];return(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:`${t.color}20`,color:t.color},children:t.label})}function iD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function aD(e){return e.length>16?`\u2026${e.slice(-16)}`:e}function oD({data:e}){let t=e.runs[0]??null,n=t?.workflowName??t?.workflowId??`--`,r=t?.workflowHash?.slice(0,12)??`--`;return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-card)] border border-[var(--border)] px-5 py-4 corner-brackets`,style:{backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`},children:[e.sessionTitle&&(0,H.jsx)(`h2`,{className:`text-base font-medium text-[var(--text-primary)] mb-3`,children:e.sessionTitle}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-8 gap-y-2`,children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Session`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:aD(e.sessionId)}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Workflow`}),(0,H.jsx)(`dd`,{className:`text-sm text-[var(--text-primary)] self-center`,children:n}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Hash`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:r}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Status`}),(0,H.jsxs)(`dd`,{className:`self-center flex items-center gap-2`,children:[(0,H.jsx)(no,{health:e.health}),e.health===`healthy`&&(0,H.jsx)(`span`,{className:`text-sm text-[var(--text-primary)]`,children:`Healthy`})]}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Runs`}),(0,H.jsxs)(`dd`,{className:`text-sm text-[var(--text-primary)] self-center`,children:[e.runs.length,` run`,e.runs.length===1?``:`s`]})]})]})}function sD({runs:e}){let t=e.some(e=>e.preferredTipNodeId!==null),n=e.some(e=>e.executionTraceSummary!==null);return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] px-4 py-3 text-xs text-[var(--text-muted)] space-y-1`,children:[(0,H.jsx)(`p`,{children:t?`Nodes with a gold border are the current execution tips — click any node to inspect its execution detail.`:`Click any node in the DAG to inspect its execution detail.`}),n&&(0,H.jsxs)(`p`,{children:[`This run has execution trace data. Click`,` `,(0,H.jsx)(`span`,{className:`font-mono uppercase tracking-[0.16em]`,children:`[ TRACE ]`}),` `,`to see why certain steps ran, were skipped, or repeated.`]})]})}function cD({viewModel:e}){let{state:t,onSelectNode:n,onCloseNode:r}=e;if(t.kind===`loading`)return(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)]`,children:`Loading session...`});if(t.kind===`error`)return(0,H.jsxs)(`div`,{className:`text-[var(--error)] bg-[var(--bg-card)] rounded-lg p-4`,children:[`Failed to load session: `,t.message]});let{sessionId:i,data:a,selectedNode:o,selectedRun:s}=t;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(oD,{data:a}),a.runs.length===0?(0,H.jsx)(`div`,{className:`text-center py-16 text-[var(--text-secondary)]`,children:`No runs in this session`}):(0,H.jsxs)(H.Fragment,{children:[o===null&&(0,H.jsx)(sD,{runs:a.runs}),(0,H.jsx)(`div`,{className:`space-y-6`,children:a.runs.map(e=>(0,H.jsx)(lD,{run:e,selectedNodeId:o?.runId===e.runId?o.nodeId:null,onNodeClick:n},e.runId))})]})]}),(0,H.jsxs)(oo,{cut:18,borderColor:`rgba(244, 196, 48, 0.35)`,background:`rgba(27, 31, 44, 0.78)`,dropShadow:`drop-shadow(0 16px 48px rgba(0,0,0,0.9)) drop-shadow(0 2px 12px rgba(244,196,48,0.15))`,backdropFilter:`blur(16px)`,className:`fixed top-3 right-3 bottom-3 w-[560px] max-w-[calc(92vw-12px)] transition-transform duration-200 ease-out`,style:{zIndex:40,transform:o?`translateX(0)`:`translateX(calc(100% + 12px))`},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0 console-blueprint-grid`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)]`,children:`Node detail`}),(0,H.jsx)(`button`,{onClick:r,className:`text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors text-xl leading-none px-1`,"aria-label":`Close`,children:`×`})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,H.jsx)(NE,{sessionId:i,nodeId:o?.nodeId??null,runStatus:s?.status??`complete`,currentNodeId:s?.preferredTipNodeId??null,executionTraceSummary:s?.executionTraceSummary??null})})]})]})}function lD({run:e,selectedNodeId:t,onNodeClick:n}){let r=e.executionTraceSummary!==null,[i,a]=(0,V.useState)(`dag`);return(0,H.jsxs)(oo,{cut:10,background:`rgba(27, 31, 44, 0.72)`,backdropFilter:`blur(8px)`,className:`relative`,style:{height:r?`542px`:`506px`},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-[var(--text-primary)]`,children:e.workflowName??e.workflowId??`Run`}),(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:e.runId}),(0,H.jsxs)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:[e.nodes.length,` nodes · `,e.tipNodeIds.length,` tip`,e.tipNodeIds.length===1?``:`s`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.hasUnresolvedCriticalGaps&&(0,H.jsx)(`span`,{className:`text-xs text-[var(--warning)]`,children:`Critical gaps`}),(0,H.jsx)(to,{status:e.status})]})]}),r&&(0,H.jsxs)(`div`,{role:`tablist`,"aria-label":`Run view mode`,className:`flex items-center border-b border-[var(--border)] shrink-0 h-9 px-2 gap-0.5`,onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),a(`trace`)),e.key===`ArrowLeft`&&(e.preventDefault(),a(`dag`))},children:[(0,H.jsxs)(`button`,{type:`button`,id:`tab-dag`,role:`tab`,tabIndex:i===`dag`?0:-1,"aria-selected":i===`dag`,onClick:()=>a(`dag`),className:[`tab-btn px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.25em] transition-colors duration-150`,i===`dag`?`tab-btn--active text-[var(--accent)]`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`].join(` `),style:i===`dag`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`DAG`]}),(0,H.jsxs)(`button`,{type:`button`,id:`tab-trace`,role:`tab`,tabIndex:i===`trace`?0:-1,"aria-selected":i===`trace`,onClick:()=>a(`trace`),className:[`tab-btn px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.25em] transition-colors duration-150`,i===`trace`?`tab-btn--active text-[var(--accent)]`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`].join(` `),style:i===`trace`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`TRACE`]})]}),(0,H.jsx)(`div`,{role:`tabpanel`,"aria-labelledby":i===`dag`?`tab-dag`:`tab-trace`,className:`flex-1`,children:i===`trace`&&e.executionTraceSummary!==null?(0,H.jsx)(Py,{summary:e.executionTraceSummary,runStatus:e.status}):(0,H.jsx)(cy,{run:e,selectedNodeId:t,onNodeClick:t=>n(e.runId,t)})})]})}function uD(){let[e,t]=(0,V.useState)(0),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)(38),[o,s]=(0,V.useState)(62),[c,l]=(0,V.useState)(3),[u,d]=(0,V.useState)(2),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(!1),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)(null),y=(0,V.useRef)(null),b=(e,n,i,o,c,u)=>{g.current=!0,h(!0),t(e=>e+1),r(Math.floor(Math.random()*4)),a(5+Math.floor(Math.random()*80)),s(5+Math.floor(Math.random()*80)),l(2+Math.floor(Math.random()*40)),d(2+Math.floor(Math.random()*25)),p(i===`horizontal`?n===`next`?`modal-content--exit-h-next`:`modal-content--exit-h-prev`:n===`next`?`modal-content--exit-v-next`:`modal-content--exit-v-prev`),c.current&&(c.current.scrollTop=0);let f=u[e].id;setTimeout(()=>{o(f),p(i===`horizontal`?n===`next`?`modal-content--enter-h-next`:`modal-content--enter-h-prev`:n===`next`?`modal-content--enter-v-next`:`modal-content--enter-v-prev`),h(!1)},80),setTimeout(()=>{if(p(``),g.current=!1,_.current!==null){let e=_.current;_.current=null;let t=e>u.findIndex(e=>e.id===v.current)?`next`:`prev`;y.current?.(e,t,`horizontal`,o,c,u)}},240)};return y.current=b,{state:{isAnimating:g.current,contentAnimClass:f,borderFlashing:m,scanline:e>0?{key:e,crtOffset:n,glitchY:i,glitchY2:o,glitchW:c,glitchW2:u}:null},startTransition:b,navigate:(e,t,n,r,i,a)=>{if(t.length<=1)return;let o=t.findIndex(t=>t.id===e);if(o===-1)return;let s=n===`next`?(o+1)%t.length:(o-1+t.length)%t.length;if(g.current){_.current=s;return}b(s,n,r,i,a,t)},selectedWorkflowIdRef:v}}var dD=[{id:`coding`,label:`Coding`},{id:`review_audit`,label:`Review & Audit`},{id:`investigation`,label:`Investigation`},{id:`design`,label:`Design`},{id:`documentation`,label:`Documentation`},{id:`tickets`,label:`Tickets`},{id:`learning`,label:`Learning`},{id:`authoring`,label:`Workflow Authoring`}],fD=Object.fromEntries(dD.map(e=>[e.id,e.label]));function pD({label:e,count:t,countLabel:n=`workflow`,showRule:r=!0,separator:i=`//`}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.30em] text-[var(--text-secondary)] shrink-0`,children:[e,t==null?``:` ${i} ${t} ${n}${t===1?``:`s`}`]}),r&&(0,H.jsx)(`div`,{className:`flex-1 h-px bg-[var(--border)]`})]})}function mD({segments:e,className:t=``}){return(0,H.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-0 ${t}`,children:e.map((t,n)=>{let r=n===e.length-1,i=!!t.onClick;return(0,H.jsxs)(`span`,{className:`flex items-center`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] tracking-[0.25em] text-[var(--text-muted)] mx-1`,children:`//`}),i?(0,H.jsx)(`button`,{type:`button`,onClick:t.onClick,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors cursor-pointer`,children:t.label.toUpperCase()}):(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] ${r?`text-[var(--text-secondary)]`:`text-[var(--text-muted)]`}`,"aria-current":r?`page`:void 0,children:t.label.toUpperCase()})]},n)})})}function hD({viewModel:e}){let{state:t}=e;if(t.kind===`not_found`)return(0,H.jsx)(`div`,{className:`space-y-5 max-w-3xl`,children:(0,H.jsx)(xD,{message:``,is404:!0,onRetry:()=>void 0,onBack:t.onBack})});if(t.kind===`error`)return(0,H.jsx)(`div`,{className:`space-y-5 max-w-3xl`,children:(0,H.jsx)(xD,{message:t.message,is404:!1,onRetry:t.onRetry,onBack:t.onBack})});if(t.kind===`loading`){let{cached:e,activeTagLabel:n,onBack:r}=t;return(0,H.jsxs)(`div`,{className:`space-y-5 max-w-3xl`,children:[(0,H.jsx)(mD,{segments:n?[{label:`Workflows`,onClick:r},{label:n}]:[{label:`Workflows`,onClick:r}]}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(gD,{name:e.name,description:e.description,tags:e.tags,source:e.source,stepCount:void 0}),(0,H.jsx)(`div`,{className:`space-y-4`,children:(0,H.jsx)(yD,{})})]}):(0,H.jsx)(bD,{})]})}let{workflow:n,name:r,description:i,tags:a,source:o,activeTagLabel:s,onPrev:c,onNext:l,onBack:u}=t;return(0,H.jsxs)(`div`,{className:`space-y-5 max-w-3xl`,children:[(0,H.jsx)(mD,{segments:s?[{label:`Workflows`,onClick:u},{label:s}]:[{label:`Workflows`,onClick:u}]}),(0,H.jsx)(gD,{name:r,description:i,tags:a,source:o,stepCount:n.stepCount}),(c??l)&&(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[c&&(0,H.jsxs)(`button`,{type:`button`,onClick:c,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`<`,` PREV`]}),l&&(0,H.jsxs)(`button`,{type:`button`,onClick:l,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`NEXT `,`>`]})]}),(0,H.jsx)(_D,{detail:n,name:r}),(0,H.jsx)(mD,{segments:[{label:`Workflows`,onClick:u}]})]})}function gD({name:e,description:t,tags:n,source:r,stepCount:i}){return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] px-5 py-5 console-blueprint-grid`,children:[(0,H.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.35em] text-[var(--text-muted)] mb-2`,children:`// Workflow`}),(0,H.jsx)(`h2`,{className:`font-mono text-xl font-bold uppercase tracking-[0.08em] leading-tight mb-3`,style:{color:`var(--accent)`,textShadow:`0 0 24px rgba(244,196,48,0.45), 0 0 48px rgba(244,196,48,0.15)`},children:e}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i!=null&&i>0&&(0,H.jsxs)(`span`,{className:`font-mono text-[10px] px-1.5 py-0.5 border border-[var(--border)] text-[var(--text-secondary)]`,children:[i,` step`,i===1?``:`s`]}),n.filter(e=>e!==`routines`).map(e=>(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-[10px] px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-muted)]`,children:e},e)),r&&(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`font-mono text-[10px] px-1.5 py-0.5 border border-[var(--border)] text-[var(--text-muted)]`,children:[`src: `,r.displayName]})]}),t&&(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-secondary)] leading-relaxed mt-3`,children:t})]})}function _D({detail:e,name:t}){let n=e.about!==void 0&&e.about.length>0,r=e.examples!==void 0&&e.examples.length>0,i=e.preconditions!==void 0&&e.preconditions.length>0;return n||r||i?(0,H.jsxs)(`div`,{className:`space-y-6`,children:[n&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`About`}),(0,H.jsx)(ME,{children:e.about})]}),r&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Try it with:`}),(0,H.jsx)(`ul`,{className:`space-y-2`,children:e.examples.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-3 bg-[var(--bg-card)] border border-[var(--border)] rounded-none px-4 py-3`,children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`w-0.5 shrink-0 self-stretch rounded-full`,style:{backgroundColor:`var(--accent)`}}),(0,H.jsxs)(`span`,{className:`text-sm text-[var(--text-secondary)] leading-relaxed`,children:[`"`,e,`"`]})]},e))})]}),i&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Before you start:`}),(0,H.jsx)(`ul`,{className:`space-y-1.5`,children:e.preconditions.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-sm text-[var(--text-secondary)]`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-[var(--text-muted)] mt-0.5`,children:`•`}),(0,H.jsx)(`span`,{children:e})]},e))})]}),(0,H.jsx)(vD,{name:t})]}):(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] italic`,children:`No additional documentation available.`})}function vD({name:e}){let[t,n]=(0,V.useState)(!1),r=`Use the ${e} to [your goal]`;return(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Start with this prompt`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border border-[var(--border)] px-4 py-3`,children:[(0,H.jsxs)(`span`,{className:`flex-1 text-sm text-[var(--text-secondary)] font-mono truncate`,children:[`"`,r,`"`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},className:`shrink-0 text-xs font-mono text-[var(--accent)] hover:text-[var(--text-primary)] transition-colors`,children:t?`Copied!`:`Copy`})]})]})}function yD(){return(0,H.jsxs)(`div`,{className:`space-y-3 motion-safe:animate-pulse`,children:[(0,H.jsx)(`div`,{className:`h-3 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-full rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-5/6 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-4/6 rounded bg-[var(--bg-tertiary)]`})]})}function bD(){return(0,H.jsxs)(`div`,{className:`space-y-6 motion-safe:animate-pulse`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`h-6 w-1/2 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-5 w-24 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`h-4 w-full rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(yD,{})]})}function xD({message:e,is404:t,onRetry:n,onBack:r}){return(0,H.jsxs)(`div`,{className:`space-y-4 bg-[var(--bg-card)] border border-[var(--border)] p-4`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:t?`Workflow not found.`:e}),(0,H.jsxs)(`div`,{className:`flex gap-3`,children:[!t&&(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`}),(0,H.jsxs)(`button`,{type:`button`,onClick:r,"aria-label":`Back to workflows list`,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`<`,` WORKFLOWS`]})]})]})}function SD(e){if(e.size<2)return 1;let t=new Set;for(let n of e.values())t.add(Math.round(n.getBoundingClientRect().top));if(t.size<2){let t=Math.round(e.get(0)?.getBoundingClientRect().top??0),n=0;for(let r of e.values())Math.round(r.getBoundingClientRect().top)===t&&n++;return Math.max(1,n)}let n=Math.round(e.get(0)?.getBoundingClientRect().top??0),r=0;for(let t of e.values())Math.round(t.getBoundingClientRect().top)===n&&r++;return Math.max(1,r)}function CD(e,t,n,r){if(n===0)return 0;let i=(e??(t>0?-1:n))+t;return r?(i%n+n)%n:Math.max(0,Math.min(n-1,i))}function wD(e,t,n,r,i){if(n===0)return 0;let a=e??0,o=a%r,s=Math.floor(a/r),c=Math.ceil(n/r),l=s+t;l=i?(l%c+c)%c:Math.max(0,Math.min(c-1,l));let u=l*r+o;return Math.min(u,n-1)}function TD({count:e,cols:t=`auto`,onActivate:n,loop:r=!0}){let[i,a]=(0,V.useState)(null),o=(0,V.useRef)(new Map),s=(0,V.useCallback)(e=>{a(e),e!==null&&o.current.get(e)?.focus()},[]),c=(0,V.useCallback)(()=>t===`auto`?SD(o.current):Math.max(1,t),[t]);return{focusedIndex:i,setFocusedIndex:s,getItemProps:(0,V.useCallback)(t=>({tabIndex:i===null?t===0?0:-1:i===t?0:-1,onFocus:()=>{a(t)},onKeyDown:i=>{let a=c(),o=null;switch(i.key){case`ArrowRight`:case`d`:case`D`:o=CD(t,1,e,r);break;case`ArrowLeft`:case`a`:case`A`:o=CD(t,-1,e,r);break;case`ArrowDown`:case`s`:case`S`:o=wD(t,1,e,a,r);break;case`ArrowUp`:case`w`:case`W`:o=wD(t,-1,e,a,r);break;case`Home`:o=0;break;case`End`:o=e-1;break;case`Enter`:case` `:i.preventDefault(),n?.(t);return;default:return}o!==null&&(i.preventDefault(),s(o))},ref:e=>{e?o.current.set(t,e):o.current.delete(t)}}),[i,e,r,c,n,s]),containerProps:{role:`grid`}}}function ED(e){let t=Wy(e),n=()=>{t.refetch()};return t.isLoading?{kind:`loading`}:t.error?t.error instanceof Iy&&t.error.status===404?{kind:`not_found`}:{kind:`error`,message:t.error instanceof Error?t.error.message:`Could not load workflow details.`,refetch:n}:t.data?{kind:`ready`,detail:t.data,refetch:n}:{kind:`loading`}}function DD(){let e=Hy();return{workflows:e.data?.workflows.filter(e=>!e.tags.includes(`routines`)),isLoading:e.isLoading,error:e.error instanceof Error?e.error:null,refetch:e.refetch}}function OD(e,t){if(!e)return{prevWorkflow:null,nextWorkflow:null};let n=t.findIndex(t=>t.id===e);return n===-1?{prevWorkflow:null,nextWorkflow:null}:{prevWorkflow:n>0?t[n-1]??null:null,nextWorkflow:n<t.length-1?t[n+1]??null:null}}function kD({workflowId:e,activeTag:t,onBack:n,onNavigateToWorkflow:r}){let i=ED(e),a=DD().workflows,o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(r);c.current=r;let l=a??[],{prevWorkflow:u,nextWorkflow:d}=(0,V.useMemo)(()=>OD(e,l),[e,l]),f=u?()=>c.current(u.id):null,p=d?()=>c.current(d.id):null;o.current=f,s.current=p;let m=i.kind===`ready`;return(0,V.useEffect)(()=>{if(!m)return;function e(e){e.metaKey||e.ctrlKey||e.altKey||(e.key===`ArrowLeft`?(e.preventDefault(),o.current?.()):e.key===`ArrowRight`&&(e.preventDefault(),s.current?.()))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[m]),{state:(0,V.useMemo)(()=>{let r=a?.find(t=>t.id===e)??void 0,o=t?fD[t]??t:null;if(i.kind===`not_found`)return{kind:`not_found`,onBack:n};if(i.kind===`error`)return{kind:`error`,message:i.message,onBack:n,onRetry:i.refetch};if(i.kind===`ready`){let t=i.detail;return{kind:`ready`,workflow:t,name:t.name??r?.name??e??``,description:t.description??r?.description??null,tags:t.tags??r?.tags??[],source:t.source??r?.source??null,activeTagLabel:o,adjacentWorkflows:l,onPrev:f,onNext:p,onBack:n}}return{kind:`loading`,cached:r??null,activeTagLabel:o,onBack:n}},[i,a,e,t,l,f,p,n])}}function AD(e){let t=new Set(dD.map(e=>e.id)),n=new Map,r=[];for(let i of e){let e=i.tags.find(e=>e!==`routines`&&t.has(e));if(e){let t=n.get(e)??[];t.push(i),n.set(e,t)}else r.push(i)}let i=dD.filter(e=>n.has(e.id)).map(e=>({tagId:e.id,label:e.label,workflows:n.get(e.id)}));return r.length>0&&i.push({tagId:null,label:`Other`,workflows:r}),i}function jD({viewModel:e}){let{state:t,dispatch:n,triggerRef:r,onCardSelect:i}=e,a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=uD(),c=t.kind===`ready`?t.selectedWorkflowId:null;if((0,V.useEffect)(()=>{if(c){let e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)}},[c]),t.kind===`loading`)return(0,H.jsx)(FD,{});if(t.kind===`error`)return(0,H.jsx)(ID,{message:t.message,onRetry:t.onRetry});let{selectedTag:l,selectedSource:u,hintVisible:d,filteredWorkflows:f,flatWorkflows:p,availableSources:m,sourceFilteredWorkflows:h,tagFilteredWorkflows:g}=t,_=new Set(dD.map(e=>e.id)),v=new Set(h.flatMap(e=>e.tags)),y=new Map(dD.map(e=>[e.id,h.filter(t=>t.tags.includes(e.id)).length])),b=h.filter(e=>!e.tags.some(e=>e!==`routines`&&_.has(e))).length,x=h.length,S=g.length;return(0,H.jsx)(MD,{selectedWorkflowId:c,selectedTag:l,selectedSource:u,hintVisible:d,filteredWorkflows:f,flatWorkflows:p,availableSources:m,tagsWithWorkflows:v,countByTag:y,otherCount:b,allTagCount:x,allSourceCount:S,countBySource:new Map(m.map(e=>[e.displayName,g.filter(t=>t.source.displayName===e.displayName).length])),currentIndex:p.findIndex(e=>e.id===c),dispatch:n,onCardSelect:i,triggerRef:r,modalPanelRef:a,scrollRef:o,modalTransition:s})}function MD({selectedWorkflowId:e,selectedTag:t,selectedSource:n,hintVisible:r,filteredWorkflows:i,flatWorkflows:a,availableSources:o,tagsWithWorkflows:s,countByTag:c,otherCount:l,allTagCount:u,allSourceCount:d,countBySource:f,currentIndex:p,dispatch:m,onCardSelect:h,modalPanelRef:g,scrollRef:_,modalTransition:v}){let y=kD({workflowId:e,activeTag:t,onBack:()=>m({type:`modal_closed`}),onNavigateToWorkflow:e=>m({type:`workflow_selected`,id:e})}),b=(0,V.useCallback)((t,n)=>{v.navigate(e,a,t,n,e=>{m({type:`workflow_selected`,id:e}),v.selectedWorkflowIdRef.current=e},_)},[a,e,v,m,_]);(0,V.useEffect)(()=>{if(!e)return;let t=[`ArrowLeft`,`ArrowRight`,`a`,`A`,`d`,`D`],n=[`ArrowUp`,`ArrowDown`,`w`,`W`,`s`,`S`],r=e=>{if(n.includes(e.key)){e.preventDefault(),e.stopPropagation();return}t.includes(e.key)&&(e.preventDefault(),e.stopPropagation(),b([`ArrowLeft`,`a`,`A`].includes(e.key)?`prev`:`next`,`horizontal`))};return document.addEventListener(`keydown`,r,{capture:!0}),()=>{document.removeEventListener(`keydown`,r,{capture:!0})}},[e,b]);let{getItemProps:x,containerProps:S}=TD({count:a.length,cols:`auto`,onActivate:(0,V.useCallback)(e=>{let t=a[e];if(!t)return;let n=document.activeElement;n instanceof HTMLButtonElement&&h(t.id,n)},[a,h])});return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`font-mono text-2xl font-bold uppercase tracking-[0.12em] leading-none`,style:{color:`var(--accent)`,textShadow:`0 0 28px rgba(244,196,48,0.35)`},children:`Workflows`}),(0,H.jsxs)(`p`,{className:`font-mono text-[10px] tracking-[0.25em] text-[var(--text-muted)] mt-1.5`,children:[`// `,i.length,` available`]})]}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Filter workflows by category`,className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(ND,{label:`All`,count:u,isActive:t===null,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:null})}),dD.filter(e=>s.has(e.id)).map(e=>(0,H.jsx)(ND,{label:e.label,count:c.get(e.id)??0,isActive:t===e.id,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:t===e.id?null:e.id})},e.id)),l>0&&(0,H.jsx)(ND,{label:`Other`,count:l,isActive:t===`__other__`,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:t===`__other__`?null:`__other__`})})]}),o.length>1&&(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Filter workflows by source`,className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(ND,{label:`All Sources`,count:d,isActive:n===null,disabled:!1,onClick:()=>m({type:`source_changed`,source:null})}),o.map(e=>(0,H.jsx)(ND,{label:e.displayName,count:f.get(e.displayName)??0,isActive:n===e.displayName,disabled:!1,onClick:()=>m({type:`source_changed`,source:n===e.displayName?null:e.displayName})},e.id))]}),i.length===0?(0,H.jsxs)(`div`,{className:`py-8 text-center space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`No workflows in this category.`}),t!==null&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>m({type:`tag_changed`,tag:null}),className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Clear filter`})]}):t===null?(0,H.jsx)(`div`,{className:`space-y-6`,children:(()=>{let t=0;return AD(i).map(n=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(pD,{label:n.label,count:n.workflows.length,showRule:!0}),(0,H.jsx)(`div`,{...S,className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:n.workflows.map(n=>(0,H.jsx)(PD,{workflow:n,onSelect:e=>h(n.id,e),navProps:x(t++),isActive:n.id===e},n.id))})]},n.tagId??`__other__`))})()}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(pD,{label:t===`__other__`?`Other`:fD[t]??t,count:i.length,showRule:!0}),(0,H.jsx)(`div`,{...S,className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:i.map((t,n)=>(0,H.jsx)(PD,{workflow:t,onSelect:e=>h(t.id,e),navProps:x(n),isActive:t.id===e},t.id))})]}),(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end justify-center p-4 pointer-events-none`,"aria-hidden":!e,children:[e&&(0,H.jsx)(`div`,{className:`absolute inset-0 pointer-events-auto`,style:{background:`rgba(0,0,0,0.22)`,backdropFilter:`blur(2px)`},onClick:()=>m({type:`modal_closed`})}),(0,H.jsx)(`div`,{ref:g,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":`Workflow detail${e?`: ${a.find(t=>t.id===e)?.name??``}`:``}`,className:`relative w-full max-w-3xl ${e?`pointer-events-auto`:`pointer-events-none`}${v.state.borderFlashing?` modal-border-flashing`:``}`,style:{height:`85vh`,transform:e?`translateY(0) scale(1)`:`translateY(24px) scale(0.97)`,opacity:+!!e,transition:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`opacity 150ms ease-out`:`transform 250ms ease-out, opacity 250ms ease-out`,backdropFilter:`blur(2px)`,WebkitBackdropFilter:`blur(2px)`},children:(0,H.jsxs)(oo,{cut:20,borderColor:`rgba(244, 196, 48, 0.45)`,background:`rgba(15, 19, 31, 0.50)`,dropShadow:`drop-shadow(0 4px 24px rgba(244,196,48,0.15))`,className:`h-full flex flex-col`,children:[v.state.scanline!==null&&(0,H.jsx)(`div`,{className:`modal-scanline`,"aria-hidden":`true`,style:{"--crt-offset":`${v.state.scanline.crtOffset}px`,"--glitch-y":`${v.state.scanline.glitchY}%`,"--glitch-y2":`${v.state.scanline.glitchY2}%`,"--glitch-w":`${v.state.scanline.glitchW}px`,"--glitch-w2":`${v.state.scanline.glitchW2}px`,clipPath:ao(20)}},v.state.scanline.key),(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-[var(--border)] shrink-0 console-blueprint-grid`,style:{background:`rgba(15, 19, 31, 0.55)`},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-secondary)]`,children:`Workflow`}),p>=0&&(0,H.jsxs)(`span`,{className:`font-mono text-[10px] tracking-[0.20em] text-[var(--text-secondary)]`,children:[`[ `,p+1,` / `,a.length,` ]`]}),(0,H.jsx)(`span`,{className:`font-mono text-[9px] tracking-[0.15em] text-[var(--text-secondary)] transition-opacity duration-600`,style:{opacity:r?.5:0},"aria-hidden":`true`,children:`[ A / D ] NAV`})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>m({type:`modal_closed`}),className:`text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors text-xl leading-none`,"aria-label":`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{ref:_,className:`flex-1 overflow-auto overscroll-contain px-6 py-5 ${v.state.contentAnimClass}`,style:{"--text-muted":`var(--text-secondary)`},children:[(0,H.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:a.find(t=>t.id===e)?.name??``}),e&&(0,H.jsx)(hD,{viewModel:y})]})]})})]})]})}function ND({label:e,count:t,isActive:n,disabled:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,onClick:i,disabled:r,"aria-pressed":n,className:[`px-3 py-2 min-w-[44px] min-h-[44px] rounded-none text-xs font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-2`,`disabled:opacity-50 disabled:cursor-not-allowed`,n?`border border-[var(--accent)] text-[var(--accent)] bg-transparent`:`text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-card)]`].join(` `),children:[e,` · `,t,n&&(0,H.jsx)(`span`,{className:`sr-only`,children:`(selected)`})]})}function PD({workflow:e,onSelect:t,navProps:n,isActive:r}){let i=e.tags.filter(e=>e!==`routines`).map(e=>fD[e]??e);return(0,H.jsx)(so,{variant:`grid`,onClick:e=>t(e.currentTarget),"aria-label":[e.name,e.description,i.length>0?`Tag: ${i.join(`, `)}`:null,`Source: ${e.source.displayName}`].filter(Boolean).join(`. `),style:r?{borderColor:`var(--accent)`,boxShadow:`0 0 0 1px rgba(244,196,48,0.4), 0 0 16px rgba(244,196,48,0.12)`}:void 0,...n,children:(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 p-4 gap-2 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-[var(--text-primary)] group-hover:text-[var(--accent)] transition-colors leading-snug line-clamp-2`,children:e.name}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--text-secondary)] line-clamp-3 leading-relaxed flex-1`,children:e.description}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mt-auto pt-2 border-t border-[var(--border)]`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.slice(0,1).map(e=>(0,H.jsx)(`span`,{className:`font-mono text-[9px] px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-muted)]`,children:e},e))}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.stepCount!=null&&e.stepCount>0&&(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)]`,children:[e.stepCount,`s`]}),(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)] max-w-[80px] truncate`,children:[`src: `,e.source.displayName]})]})]})]})})}function FD(){return(0,H.jsx)(`div`,{className:`space-y-6 motion-safe:animate-pulse`,children:[0,1].map(e=>(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-3 w-24 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`flex-1 h-px bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:[0,1,2,3,4,5].map(e=>(0,H.jsxs)(`div`,{className:`min-h-[160px] bg-[var(--bg-card)] border border-[var(--border)] flex flex-col`,children:[(0,H.jsx)(`div`,{className:`h-[3px] bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`p-4 flex flex-col gap-2 flex-1`,children:[(0,H.jsx)(`div`,{className:`h-4 w-3/4 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-full bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-5/6 bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`mt-auto pt-2 border-t border-[var(--border)] flex justify-between`,children:[(0,H.jsx)(`div`,{className:`h-3 w-12 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-16 bg-[var(--bg-tertiary)]`})]})]})]},e))})]},e))})}function ID({message:e,onRetry:t}){return(0,H.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:e}),(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`})]})}var LD=[{value:`recent`,label:`Recent first`,compareFn:(e,t)=>t.startedAtMs-e.startedAtMs},{value:`slowest`,label:`Slowest first`,compareFn:(e,t)=>t.durationMs-e.durationMs}],RD={success:{color:`var(--success)`,label:`OK`,isError:!1},error:{color:`var(--error)`,label:`Error`,isError:!0},unknown_tool:{color:`var(--warning)`,label:`Unknown`,isError:!0}};function zD(e,t){let n=LD.find(e=>e.value===t);return[...e].sort(n.compareFn)}function BD(e){return e.reduce((e,t)=>Math.max(e,t.durationMs),0)}function VD(e){return e.filter(e=>RD[e.outcome].isError).length}function HD(e){return e.length===0?null:Math.round(e.reduce((e,t)=>e+t.durationMs,0)/e.length)}function UD(e){return e.length===0?null:e.reduce((e,t)=>Math.max(e,t.startedAtMs),0)}function WD(e,t){return t>0?Math.round(e/t*120):0}function GD(e){return`${e} recorded`}var KD=[{key:`tool`,label:`Tool`,minWidth:`180px`},{key:`duration`,label:`Duration`,width:`220px`},{key:`started`,label:`Started`,width:`100px`},{key:`outcome`,label:`Outcome`}];function qD({viewModel:e}){let{state:t}=e;if(t.kind===`loading`)return(0,H.jsx)(ZD,{});if(t.kind===`devModeOff`)return(0,H.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] text-center`,children:`nothing to see here`})});if(t.kind===`error`)return(0,H.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:t.message}),(0,H.jsx)(`button`,{type:`button`,onClick:t.retry,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`})]});let{sorted:n,maxDuration:r,errorCount:i,avgMs:a,lastCallMs:o,countLabel:s,sortOrder:c,onSortChange:l}=t;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-[var(--text-secondary)]`,children:[s,` | `,(0,H.jsxs)(`span`,{style:{color:i>0?`var(--error)`:`var(--text-muted)`},children:[i,` errors`]}),` | `,`avg `,a===null?`--`:`${a}ms`,` | `,`last call `,o===null?`no calls yet`:co(o)]}),(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":`Sort order`,className:`flex items-center gap-1`,children:LD.map(e=>(0,H.jsx)(XD,{label:e.label,isActive:c===e.value,onClick:()=>l(e.value)},e.value))}),(0,H.jsxs)(`table`,{className:`w-full text-sm border-collapse`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{className:`text-xs text-[var(--text-muted)] border-b border-[var(--border)]`,children:KD.map(e=>(0,H.jsx)(`th`,{scope:`col`,className:`text-left py-2 pr-4 font-medium`,style:{width:e.width,minWidth:e.minWidth},children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:n.length===0?(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:KD.length,className:`py-8 text-center text-sm text-[var(--text-muted)]`,children:`No tool calls recorded yet. Run a workflow to see timing data.`})}):n.map((e,t)=>(0,H.jsx)(JD,{obs:e,maxDuration:r},`${e.startedAtMs}-${e.toolName}-${t}`))})]})]})}function JD({obs:e,maxDuration:t}){let n=RD[e.outcome].isError,r=WD(e.durationMs,t);return(0,H.jsxs)(`tr`,{className:`border-b border-[var(--border)] hover:bg-[var(--bg-card)] transition-colors`,style:{borderLeft:n?`2px solid var(--error)`:`2px solid transparent`},children:[(0,H.jsx)(`td`,{className:`py-2 pr-4 font-mono text-[var(--text-primary)] overflow-hidden text-ellipsis`,title:e.toolName,style:{minWidth:`180px`,maxWidth:`240px`},children:(0,H.jsx)(`span`,{className:`block truncate`,children:e.toolName})}),(0,H.jsxs)(`td`,{className:`py-2 pr-4`,style:{width:`220px`},children:[(0,H.jsxs)(`span`,{className:`font-mono text-[var(--text-primary)]`,children:[e.durationMs,`ms`]}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`h-1 rounded mt-1`,style:{backgroundColor:`var(--accent)`,width:`${r}px`,maxWidth:`120px`}})]}),(0,H.jsx)(`td`,{className:`py-2 pr-4 text-[var(--text-secondary)]`,style:{width:`100px`},children:co(e.startedAtMs)}),(0,H.jsx)(`td`,{className:`py-2`,children:(0,H.jsx)(YD,{outcome:e.outcome})})]})}function YD({outcome:e}){let t=RD[e];return(0,H.jsx)(`span`,{className:`inline-block px-2 py-0.5 rounded text-xs font-medium`,style:{color:t.color,backgroundColor:`color-mix(in srgb, ${t.color} 12%, transparent)`},children:t.label})}function XD({label:e,isActive:t,onClick:n}){return(0,H.jsx)(`button`,{type:`button`,role:`radio`,onClick:n,"aria-checked":t,className:[`px-3 py-2 rounded text-xs font-medium min-w-[44px] transition-colors`,t?`text-[var(--text-primary)]`:`text-[var(--text-muted)] hover:text-[var(--text-secondary)]`].join(` `),children:e})}function ZD(){return(0,H.jsxs)(`div`,{className:`space-y-3 animate-pulse`,"aria-busy":`true`,"aria-label":`Loading performance data`,children:[(0,H.jsx)(`div`,{className:`h-4 w-64 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsx)(`div`,{className:`h-8 w-24 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-8 w-24 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsxs)(`div`,{className:`flex gap-4 border-b border-[var(--border)] pb-2`,children:[(0,H.jsx)(`div`,{className:`h-3 w-20 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-14 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-14 rounded bg-[var(--bg-tertiary)]`})]}),Array.from({length:8}).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex gap-4 py-2`,children:[(0,H.jsx)(`div`,{className:`h-4 rounded bg-[var(--bg-tertiary)]`,style:{minWidth:`180px`,width:`180px`}}),(0,H.jsxs)(`div`,{className:`space-y-1`,style:{width:`220px`},children:[(0,H.jsx)(`div`,{className:`h-4 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-1 w-20 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`h-4 w-16 rounded bg-[var(--bg-tertiary)]`,style:{width:`100px`}}),(0,H.jsx)(`div`,{className:`h-5 w-12 rounded bg-[var(--bg-tertiary)]`})]},t))]})}var QD=`workrail:auto:mru-workflow`;function $D(){try{return localStorage.getItem(QD)}catch{return null}}function eO(e){try{localStorage.setItem(QD,e)}catch{}}function tO(){let e=Hy(),t=Gy(),n=e.data?.workflows??[],r=t.data?.triggers??[],[i,a]=(0,V.useState)(()=>$D()??``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!0),v=(0,V.useRef)(null);(0,V.useEffect)(()=>{!i&&n.length>0&&a(n[0]?.id??``)},[i,n]);let y=e=>{a(e),eO(e)},b=async()=>{if(!(!i||!c.trim()||!o.trim())){d(!0),p(null),h(!1);try{await Ky({workflowId:i,goal:c.trim(),workspacePath:o.trim()}),h(!0),l(``),setTimeout(()=>v.current?.focus(),100)}catch(e){p(e instanceof Error?e.message:`Dispatch failed`)}finally{d(!1)}}},x=!!i&&!!c.trim()&&!!o.trim()&&!u;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(zo,{color:`var(--accent)`,children:`Dispatch`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Workflow`}),e.isLoading?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs`,children:`Loading workflows...`}):n.length===0?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs`,children:`No workflows available`}):(0,H.jsx)(`select`,{value:i,onChange:e=>y(e.target.value),className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-[var(--text-primary)] focus:outline-none focus:border-[var(--accent)] cursor-pointer`,children:n.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Workspace path`}),(0,H.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`/path/to/repo`,className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm font-mono text-[var(--text-primary)] placeholder-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Goal`}),(0,H.jsx)(`textarea`,{ref:v,value:c,onChange:e=>l(e.target.value),placeholder:`// describe the task...`,rows:4,className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm font-mono text-[var(--text-primary)] placeholder-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)] resize-y`,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&x&&(e.preventDefault(),b())}})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`button`,{onClick:()=>void b(),disabled:!x,className:`self-start disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,H.jsx)($a,{label:u?`RUNNING...`:`RUN`,color:x?`var(--accent)`:void 0,pulse:u})}),m&&(0,H.jsx)(`div`,{className:`text-[var(--success)] font-mono text-[10px] uppercase tracking-[0.20em]`,children:`Dispatched -- check Queue pane`}),f&&(0,H.jsx)(`div`,{className:`text-[var(--error)] text-xs font-mono`,children:f})]}),(0,H.jsxs)(`div`,{className:`border-t border-[var(--border)] pt-4`,children:[(0,H.jsxs)(`button`,{onClick:()=>_(!g),className:`flex items-center gap-2 mb-2 cursor-pointer group`,children:[(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] text-xs transition-transform duration-150`,style:{transform:g?`rotate(-90deg)`:`rotate(0deg)`},children:`▼`}),(0,H.jsx)($a,{label:`TRIGGERS`,color:`var(--text-secondary)`}),r.length>0&&(0,H.jsxs)(`span`,{className:`text-xs text-[var(--text-muted)]`,children:[`(`,r.length,`)`]})]}),!g&&(0,H.jsx)(`div`,{className:`space-y-2`,children:t.isLoading?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs pl-4`,children:`Loading triggers...`}):r.length===0?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs pl-4`,children:`No triggers configured. Set WORKRAIL_TRIGGERS_ENABLED=true and create triggers.yml.`}):r.map(e=>(0,H.jsxs)(`div`,{className:`pl-4 border-l-2 border-[var(--border)] text-xs space-y-0.5`,children:[(0,H.jsx)(`div`,{className:`font-mono text-[var(--text-primary)] text-[11px]`,children:e.id}),(0,H.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:e.workflowId}),(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] truncate`,children:e.goal})]},e.id))})]})]})}function nO(e){let t=0,n=0,r=0;for(let i of e)i.status===`in_progress`?t++:i.status===`blocked`?n++:(i.status===`complete`||i.status===`complete_with_gaps`)&&r++;return{running:t,blocked:n,completed:r}}function rO(){let{data:e,isLoading:t,isError:n}=Ry(),r=(e?.sessions??[]).filter(e=>e.isAutonomous),{running:i,blocked:a,completed:o}=nO(r);return t?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)] text-sm`,children:`Loading sessions...`})}):n?(0,H.jsx)(`div`,{className:`text-[var(--error)] bg-[var(--bg-card)] rounded-lg p-4 text-sm`,children:`Failed to load sessions`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(zo,{color:`var(--accent)`,children:`Queue`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(iO,{count:i,label:`RUNNING`,color:`var(--accent)`,pulse:!0}),(0,H.jsx)(iO,{count:a,label:`BLOCKED`,color:`var(--blocked)`}),(0,H.jsx)(iO,{count:o,label:`COMPLETED`,color:`var(--success)`})]}),r.length===0?(0,H.jsxs)(`div`,{className:`text-center py-16`,children:[(0,H.jsx)(`p`,{className:`text-[var(--text-secondary)] text-sm`,children:`No autonomous sessions yet`}),(0,H.jsx)(`p`,{className:`text-[var(--text-muted)] text-xs mt-1`,children:`Dispatch a workflow from the left pane to start.`})]}):(0,H.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,H.jsx)(aO,{session:e},e.sessionId))})]})}function iO({count:e,label:t,color:n,pulse:r}){return(0,H.jsx)($a,{label:`${e} ${t}`,color:e>0?n:`var(--text-muted)`,pulse:r&&e>0})}function aO({session:e}){let[t,n]=(0,V.useState)(!1),r=xi(),i=e.sessionTitle??e.workflowName??e.workflowId??`Unnamed session`,a=co(e.lastModifiedMs);return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-card)] border border-[var(--border)] rounded-lg overflow-hidden`,children:[(0,H.jsxs)(`button`,{onClick:()=>n(!t),className:`w-full px-4 py-3 flex items-center gap-3 text-left cursor-pointer hover:bg-[var(--bg-secondary)] transition-colors group`,children:[(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] text-xs transition-transform duration-150 shrink-0`,style:{transform:t?`rotate(90deg)`:`rotate(0deg)`},children:`▶`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-[var(--text-primary)] truncate group-hover:text-[var(--accent)] transition-colors`,children:i}),(0,H.jsx)(`div`,{className:`font-mono text-[10px] text-[var(--text-muted)] opacity-60 truncate`,children:e.sessionId})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,H.jsx)(`span`,{className:`text-[10px] text-[var(--text-muted)] tabular-nums`,children:a}),e.isLive&&(0,H.jsx)($a,{label:`LIVE`,pulse:!0,color:`var(--accent)`,"aria-label":`Actively running`}),(0,H.jsx)(to,{status:e.status})]})]}),t&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 border-t border-[var(--border)] pt-3 space-y-3`,children:[e.recapSnippet?(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-secondary)] font-mono whitespace-pre-wrap leading-relaxed`,children:e.recapSnippet}):(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)]`,children:`No recap available yet.`}),(0,H.jsx)(`button`,{onClick:()=>void r({to:`/session/$sessionId`,params:{sessionId:e.sessionId}}),className:`cursor-pointer`,children:(0,H.jsx)($a,{label:`OPEN IN DAG`,color:`var(--accent)`})})]})]})}function oO(){return(0,H.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6`,children:[(0,H.jsx)(`div`,{className:`w-full md:w-2/5 shrink-0`,children:(0,H.jsx)(tO,{})}),(0,H.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,H.jsx)(rO,{})})]})}function sO(){let e=Ry(),t=Vy();qy();let n=e.data?.sessions;return{sessions:n,worktreeRepos:t.data?.repos??[],isLoading:e.isLoading,error:e.error instanceof Error?e.error:null,refetch:e.refetch,worktreesFetching:t.isFetching,liveCount:n?.filter(e=>e.status===`in_progress`).length??0,blockedCount:n?.filter(e=>e.status===`blocked`).length??0}}var cO={scope:`active`,focusedIndex:-1,archive:null};function lO(e){throw Error(`Unhandled WorkspaceEvent type: ${String(e.type)}`)}function uO(e,t){switch(t.type){case`scope_changed`:return{...e,scope:t.scope,focusedIndex:-1};case`focus_moved`:return{...e,focusedIndex:t.index};case`archive_opened`:return{...e,archive:{repoName:t.repoName}};case`archive_closed`:return{...e,archive:null};default:return lO(t)}}var dO=720*60*60*1e3,fO={in_progress:0,dormant:0,blocked:1,complete_with_gaps:2,complete:3};function pO(e){if(e.length!==0)return[...e].sort((e,t)=>{let n=fO[e.status]-fO[t.status];return n===0?t.lastModifiedMs-e.lastModifiedMs:n})[0]}function mO(e,t,n){let r=e.primarySession?.status;if(r===`in_progress`||r===`blocked`)return`visible`;let i=(e.worktree?.changedCount??0)>0,a=(e.worktree?.aheadCount??0)>0;return i||a?`visible`:r===`dormant`?t===`all`?`visible`:`hidden`:n-e.activityMs<dO||t===`all`?`visible`:`hidden`}function hO(e){switch(e.primarySession?.status){case`in_progress`:return 0;case`blocked`:return 1;case`dormant`:return 2;default:return(e.worktree?.changedCount??0)>0||(e.worktree?.aheadCount??0)>0?3:4}}function gO(e,t,n){return[...e].filter(e=>mO(e,t,n)===`visible`).sort((e,t)=>{let n=hO(e)-hO(t);return n===0?t.activityMs-e.activityMs:n})}function _O(e,t){let n=new Map;for(let e of t)for(let t of e.worktrees)t.branch!==null&&n.set(`${t.branch}\0${e.repoRoot}`,{wt:t,repoName:e.repoName,repoRoot:e.repoRoot});let r=new Map;for(let[e,t]of n){let[n]=e.split(`\0`),i=r.get(n)??[];i.push(t),r.set(n,i)}let i=new Map;for(let t of e){if(t.gitBranch===null)continue;let e=r.get(t.gitBranch)??[];if(e.length===0){if(!t.repoRoot)continue;let e=`${t.gitBranch}\0${t.repoRoot}`,r=i.get(e);if(r?r.push(t):i.set(e,[t]),!n.has(e)){let r=t.repoRoot.split(`/`).at(-1)??t.repoRoot;n.set(e,{wt:void 0,repoName:r,repoRoot:t.repoRoot})}continue}for(let n of e){let e=`${t.gitBranch}\0${n.repoRoot}`,r=i.get(e);r?r.push(t):i.set(e,[t])}}let a=[],o=new Set;for(let[e,t]of i){let[r,i]=e.split(`\0`),s=n.get(e),c=pO(t),l=Math.max(c?.lastModifiedMs??0,s?.wt?.headTimestampMs??0),u=s?.repoName??i.split(`/`).at(-1)??i;a.push({branch:r,repoRoot:i,repoName:u,worktree:s?.wt,primarySession:c,allSessions:t,activityMs:l}),o.add(e)}for(let[e,{wt:t,repoName:r,repoRoot:i}]of n){if(o.has(e))continue;let[n]=e.split(`\0`);a.push({branch:n,repoRoot:i,repoName:r,worktree:t,primarySession:void 0,allSessions:[],activityMs:t?.headTimestampMs??0})}return a}function vO(e,t,n,r){let i=_O(e,t),a=new Map;for(let e of i)a.has(e.repoRoot)||a.set(e.repoRoot,e.repoName);let o=new Map;for(let e of i){let t=o.get(e.repoRoot)??[];t.push(e),o.set(e.repoRoot,t)}let s=[...o.entries()].map(([e,t])=>({repoRoot:e,repoName:t[0].repoName,sortedItems:gO(t,n,r)})).filter(e=>e.sortedItems.length>0).sort((e,t)=>{let n=+!e.sortedItems.some(e=>e.primarySession?.status===`in_progress`||e.primarySession?.status===`blocked`),r=+!t.sortedItems.some(e=>e.primarySession?.status===`in_progress`||e.primarySession?.status===`blocked`);return n===r?e.repoName.localeCompare(t.repoName):n-r}),c=s.flatMap(e=>e.sortedItems),l=n===`active`?i.filter(e=>e.primarySession?.status===`dormant`&&(e.worktree?.changedCount??0)===0&&(e.worktree?.aheadCount??0)===0).length:0;return{repoGroups:s,orderedItems:c,archiveRepos:[...a.entries()].map(([e,t])=>[e,t]),dormantHiddenCount:l}}function yO({items:e,focusedIndex:t,scope:n,archive:r,dispatch:i,onSelectSession:a,onRefetch:o,disabled:s}){let c=(0,V.useRef)(e);c.current=e;let l=(0,V.useRef)(t);l.current=t;let u=(0,V.useRef)(n);u.current=n;let d=(0,V.useRef)(r);d.current=r;let f=(0,V.useRef)(s);f.current=s;let p=(0,V.useRef)(i);p.current=i;let m=(0,V.useRef)(a);m.current=a;let h=(0,V.useRef)(o);h.current=o,(0,V.useEffect)(()=>{function e(e){if(f.current||e.metaKey||e.ctrlKey||e.altKey)return;let t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return;let n=c.current,r=l.current;switch(e.key){case`j`:case`ArrowDown`:e.preventDefault(),p.current({type:`focus_moved`,index:Math.min(r+1,n.length-1)});break;case`k`:case`ArrowUp`:e.preventDefault(),p.current({type:`focus_moved`,index:Math.max(r-1,0)});break;case`Enter`:case` `:if(e.preventDefault(),r>=0&&r<n.length){let e=n[r]?.primarySession?.sessionId;e&&m.current(e)}break;case`Escape`:d.current!==null&&p.current({type:`archive_closed`});break;case`/`:e.preventDefault(),p.current({type:`archive_opened`,repoName:void 0});break;case`r`:e.preventDefault(),h.current();break;case`a`:e.preventDefault(),p.current({type:`scope_changed`,scope:u.current===`active`?`all`:`active`});break}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[])}function bO(e=!1){let t=xi(),n=sO(),[r,i]=(0,V.useReducer)(uO,cO),a=(0,V.useRef)(0),o=(0,V.useCallback)(e=>{a.current=window.scrollY,t({to:`/session/$sessionId`,params:{sessionId:e}})},[t]),s=i,c=(0,V.useMemo)(()=>n.sessions?vO(n.sessions,n.worktreeRepos,r.scope,Date.now()):null,[n.sessions,n.worktreeRepos,r.scope]);yO({items:c?.orderedItems??[],focusedIndex:r.focusedIndex,scope:r.scope,archive:r.archive,dispatch:s,onSelectSession:o,onRefetch:n.refetch,disabled:e});let{isLoading:l,error:u,worktreesFetching:d,sessions:f,liveCount:p,blockedCount:m}=n;return{state:(0,V.useMemo)(()=>l?{kind:`loading`}:u?{kind:`error`,message:u.message}:c?{kind:`ready`,scope:r.scope,focusedIndex:r.focusedIndex,archive:r.archive,repoGroups:c.repoGroups,orderedItems:c.orderedItems,archiveRepos:c.archiveRepos,dormantHiddenCount:c.dormantHiddenCount,worktreesFetching:d,hasAnySessions:(f?.length??0)>0,liveCount:p,blockedCount:m}:{kind:`loading`},[l,u,d,f,c,r,p,m]),dispatch:s,scrollYRef:a,onSelectSession:o}}function xO(){let e=Ry();return{sessions:e.data?.sessions,isLoading:e.isLoading,error:e.error instanceof Error?e.error:null}}function SO(e=``){return{rawSearch:e,sort:`recent`,groupBy:`none`,statusFilter:`all`,page:0}}function CO(e){throw Error(`Unhandled SessionListEvent type: ${String(e.type)}`)}function wO(e,t){switch(t.type){case`search_changed`:return{...e,rawSearch:t.value,page:0};case`sort_changed`:return{...e,sort:t.sort,page:0};case`group_changed`:return{...e,groupBy:t.groupBy,page:0};case`status_changed`:return{...e,statusFilter:t.statusFilter,page:0};case`page_changed`:return{...e,page:t.page};default:return CO(t)}}var TO={in_progress:0,blocked:1,dormant:2,complete_with_gaps:3,complete:4},EO=[{value:`recent`,label:`Recent`,compareFn:(e,t)=>t.lastModifiedMs-e.lastModifiedMs},{value:`status`,label:`Status`,compareFn:(e,t)=>TO[e.status]-TO[t.status]||t.lastModifiedMs-e.lastModifiedMs},{value:`workflow`,label:`Workflow`,compareFn:(e,t)=>(e.workflowName??e.workflowId??``).localeCompare(t.workflowName??t.workflowId??``)||t.lastModifiedMs-e.lastModifiedMs},{value:`nodes`,label:`Node count`,compareFn:(e,t)=>t.nodeCount-e.nodeCount||t.lastModifiedMs-e.lastModifiedMs}],DO=[{value:`none`,label:`No grouping`,keyFn:null},{value:`workflow`,label:`Workflow`,keyFn:e=>e.workflowName??e.workflowId??`Unknown workflow`},{value:`status`,label:`Status`,keyFn:e=>e.status,groupCompareFn:(e,t)=>(TO[e]??99)-(TO[t]??99)},{value:`branch`,label:`Branch`,keyFn:e=>e.gitBranch??`No branch`}],OO=[{value:`all`,label:`All`},{value:`in_progress`,label:`In Progress`},{value:`dormant`,label:`Dormant`},{value:`complete`,label:`Complete`},{value:`complete_with_gaps`,label:`Gaps`},{value:`blocked`,label:`Blocked`}];function kO(e,t,n){let r=e;if(n!==`all`&&(r=r.filter(e=>e.status===n)),t.trim()){let e=t.toLowerCase();r=r.filter(t=>(t.sessionTitle??``).toLowerCase().includes(e)||(t.workflowName??``).toLowerCase().includes(e)||(t.workflowId??``).toLowerCase().includes(e)||t.sessionId.toLowerCase().includes(e)||(t.gitBranch??``).toLowerCase().includes(e))}return r}function AO(e,t){let n=EO.find(e=>e.value===t)??EO[0];return[...e].sort(n.compareFn)}function jO(e,t){let n=DO.find(e=>e.value===t)??DO[0];if(!n.keyFn)return[{label:``,sessions:e}];let r=new Map;for(let t of e){let e=n.keyFn(t),i=r.get(e)??[];i.push(t),r.set(e,i)}let i=n.groupCompareFn??((e,t)=>e.localeCompare(t));return Array.from(r.entries()).sort(([e],[t])=>i(e,t)).map(([e,t])=>({label:e,sessions:t}))}function MO(e){let t={all:e.length};for(let n of e)t[n.status]=(t[n.status]??0)+1;return t}function NO(e,t){let[n,r]=(0,V.useState)(e),i=(0,V.useRef)(null);return(0,V.useEffect)(()=>(i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>r(e),t),()=>{i.current!==null&&clearTimeout(i.current)}),[e,t]),n}function PO({onSelectSession:e,initialSearch:t=``}){let n=xO(),[r,i]=(0,V.useReducer)(wO,void 0,()=>SO(t)),a=NO(r.rawSearch,200),o=(0,V.useRef)([]),s=(0,V.useCallback)(t=>{let n=o.current[t];n&&e(n.sessionId)},[e]),{sessions:c,isLoading:l,error:u}=n,d=(0,V.useMemo)(()=>c?MO(c):{},[c]),f=(0,V.useMemo)(()=>{if(!c)return null;let e=kO(c,a,r.statusFilter);return{groups:jO(AO(e,r.sort),r.groupBy),total:c.length,filtered:e.length}},[c,a,r.statusFilter,r.sort,r.groupBy]),p=r.groupBy!==`none`,m=f?Math.ceil(f.filtered/25):0,h=r.page*25,g=h+25,_=(0,V.useMemo)(()=>!f||p?[]:f.groups[0]?.sessions.slice(h,g)??[],[f,p,h,g]);o.current=_;let{getItemProps:v,containerProps:y}=TD({count:_.length,cols:1,onActivate:s});return{state:(0,V.useMemo)(()=>l?{kind:`loading`}:u?{kind:`error`,message:u.message}:f?{kind:`ready`,rawSearch:r.rawSearch,sort:r.sort,groupBy:r.groupBy,statusFilter:r.statusFilter,page:r.page,totalPages:m,isGrouped:p,processed:f,statusCounts:d,flatPageSessions:_,getSessionNavProps:v,sessionContainerProps:y,sortAxes:EO,groupAxes:DO,statusFilterOptions:OO}:{kind:`loading`},[l,u,f,r,m,p,d,_,v,y]),dispatch:i,onSelectSession:e}}var FO={selectedWorkflowId:null,selectedTag:null,selectedSource:null,hintVisible:!1};function IO(e){throw Error(`Unhandled WorkflowsEvent type: ${String(e.type)}`)}function LO(e,t){switch(t.type){case`workflow_selected`:return{...e,selectedWorkflowId:t.id,hintVisible:t.id!==null};case`tag_changed`:return{...e,selectedTag:t.tag,selectedWorkflowId:null,hintVisible:!1};case`source_changed`:return{...e,selectedSource:t.source,selectedWorkflowId:null,hintVisible:!1};case`modal_closed`:return{...e,selectedWorkflowId:null,hintVisible:!1};case`hint_dismissed`:return{...e,hintVisible:!1};default:return IO(t)}}function RO(e){let t=new Set;for(let n of e)for(let e of n.tags)e!==`routines`&&t.add(e);let n=dD.map(e=>e.id).filter(e=>t.has(e)),r=[...t].filter(e=>!dD.some(t=>t.id===e)).sort();return[...n,...r]}function zO(e){let t=new Map;for(let n of e)t.has(n.source.kind)||t.set(n.source.kind,{id:n.source.kind,displayName:n.source.displayName});return[...t.values()]}function BO(e,t,n){let r=new Set(dD.map(e=>e.id)),i=e;return t!==null&&(i=t===`__other__`?i.filter(e=>!e.tags.some(e=>e!==`routines`&&r.has(e))):i.filter(e=>e.tags.includes(t))),n!==null&&(i=i.filter(e=>e.source.displayName===n)),i}function VO(e,t){if(t!==null)return e;let n=new Set(dD.map(e=>e.id)),r=new Map,i=[];for(let t of e){let e=t.tags.find(e=>e!==`routines`&&n.has(e));if(e){let n=r.get(e)??[];n.push(t),r.set(e,n)}else i.push(t)}let a=[];for(let{id:e}of dD){let t=r.get(e);t&&a.push(...t)}return a.push(...i),a}function HO({initialTag:e,onSelectTag:t}){let n=DD(),[r,i]=(0,V.useReducer)(LO,{...FO,selectedTag:e});(0,V.useEffect)(()=>{e!==r.selectedTag&&i({type:`tag_changed`,tag:e})},[e]);let a=(0,V.useRef)(null),o=(0,V.useCallback)((e,t)=>{a.current=t,t.blur(),i({type:`workflow_selected`,id:e})},[]);(0,V.useEffect)(()=>{if(!r.selectedWorkflowId&&a.current){let e=a.current;a.current=null,e.focus()}},[r.selectedWorkflowId]),(0,V.useEffect)(()=>{if(!r.selectedWorkflowId)return;let e=window.scrollY;return document.body.style.overflow=`hidden`,document.body.style.position=`fixed`,document.body.style.top=`-${e}px`,document.body.style.width=`100%`,()=>{document.body.style.overflow=``,document.body.style.position=``,document.body.style.top=``,document.body.style.width=``,window.scrollTo(0,e)}},[r.selectedWorkflowId]),(0,V.useEffect)(()=>{if(!r.selectedWorkflowId)return;let e=e=>{e.key===`Escape`&&i({type:`modal_closed`})};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r.selectedWorkflowId]);let{isLoading:s,error:c,workflows:l}=n,u=(0,V.useMemo)(()=>{if(s)return{kind:`loading`};if(c)return{kind:`error`,message:c.message,onRetry:n.refetch};if(!l)return{kind:`loading`};let e=RO(l),t=zO(l),i=BO(l,r.selectedTag,r.selectedSource),a=VO(i,r.selectedTag),o=BO(l,null,r.selectedSource),u=BO(l,r.selectedTag,null);return{kind:`ready`,selectedWorkflowId:r.selectedWorkflowId,selectedTag:r.selectedTag,selectedSource:r.selectedSource,hintVisible:r.hintVisible,availableTags:e,availableSources:t,filteredWorkflows:i,flatWorkflows:a,sourceFilteredWorkflows:o,tagFilteredWorkflows:u}},[s,c,l,r,n.refetch]),d=u.kind===`ready`?u.flatWorkflows.length:0;return(0,V.useEffect)(()=>{if(!r.selectedWorkflowId||d<=1)return;let e=setTimeout(()=>i({type:`hint_dismissed`}),3e3);return()=>clearTimeout(e)},[r.selectedWorkflowId,d]),{state:u,dispatch:(0,V.useCallback)(e=>{e.type===`tag_changed`&&t(e.tag),i(e)},[t]),triggerRef:a,onCardSelect:o}}function UO(){let e=Uy();switch(e.state){case`loading`:return{kind:`loading`};case`devModeOff`:return{kind:`devModeOff`};case`error`:return{kind:`error`,message:e.message,retry:e.retry};case`data`:return{kind:`ready`,observations:e.data.observations}}}function WO(){let e=UO(),[t,n]=(0,V.useState)(`recent`);return{state:(0,V.useMemo)(()=>{if(e.kind===`loading`)return{kind:`loading`};if(e.kind===`devModeOff`)return{kind:`devModeOff`};if(e.kind===`error`)return{kind:`error`,message:e.message,retry:e.retry};let{observations:r}=e,i=zD(r,t);return{kind:`ready`,sorted:i,maxDuration:BD(i),errorCount:VD(r),avgMs:HD(r),lastCallMs:UD(r),countLabel:GD(r.length),sortOrder:t,onSortChange:n}},[e,t])}}function GO(e){let t=zy(e);return{data:t.data,isLoading:t.isLoading,error:t.error instanceof Error?t.error:null}}function KO(e){let t=GO(e),[n,r]=(0,V.useState)(null),i=(0,V.useCallback)((e,t)=>{r(n=>n?.runId===e&&n?.nodeId===t?null:{runId:e,nodeId:t})},[]),a=(0,V.useCallback)(()=>{r(null)},[]),{isLoading:o,error:s,data:c}=t,l=(0,V.useMemo)(()=>!c||!n?null:c.runs.find(e=>e.runId===n.runId)??null,[c,n]);return{state:(0,V.useMemo)(()=>o?{kind:`loading`}:s?{kind:`error`,message:s.message}:c?{kind:`ready`,sessionId:e,data:c,selectedNode:n,selectedRun:l}:{kind:`loading`},[o,s,c,e,n,l]),onSelectNode:i,onCloseNode:a}}var qO=[{id:`workspace`,path:`/`},{id:`workflows`,path:`/workflows`},{id:`auto`,path:`/auto`},{id:`perf`,path:`/perf`}];function JO(){let e=xi(),t=Qi(),{location:n}=ia(),r=t({to:`/session/$sessionId`}),i=t({to:`/workflows`}),a=t({to:`/workflows/$workflowId`}),o=t({to:`/perf`}),s=t({to:`/auto`}),c=i!==!1||a!==!1?`workflows`:o===!1?s===!1?`workspace`:`auto`:`perf`,l=r!==!1,u=a!==!1,d=l?r.sessionId:null,f=u?a.workflowId:null,p=new URLSearchParams(n.search).get(`tag`),m=bO(l),h=PO({onSelectSession:m.onSelectSession}),g=m.state.kind===`ready`?m.state.liveCount:0,_=m.state.kind===`ready`?m.state.blockedCount:0,v=(0,V.useCallback)(()=>{e({to:`/`})},[e]),y=(0,V.useCallback)(t=>{e({to:`/workflows`,search:{tag:t??void 0}})},[e]),b=(0,V.useCallback)(()=>{e({to:`/workflows`,search:{tag:p??void 0}})},[e,p]),x=(0,V.useCallback)(t=>{e({to:`/workflows/$workflowId`,params:{workflowId:t},search:{tag:p??void 0}})},[e,p]),S=HO({initialTag:p,onSelectTag:y}),C=kD({workflowId:f,activeTag:p,onBack:b,onNavigateToWorkflow:x}),w=KO(d??``),T=WO(),[E,D]=(0,V.useState)(null),O=(0,V.useCallback)((e,t)=>{t(),D(e),setTimeout(()=>D(null),200)},[]),k=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=k.current;if(!t)return;function n(t){if(t.key===`ArrowLeft`||t.key===`ArrowRight`){t.preventDefault();let n=qO.findIndex(e=>e.id===c),r=qO[t.key===`ArrowRight`?(n+1)%qO.length:(n-1+qO.length)%qO.length];e({to:r.path,...r.path===`/workflows`?{search:{tag:void 0}}:{}})}}return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[c,e]),(0,H.jsxs)(`div`,{className:`min-h-screen`,style:{"--app-header-height":`56px`},children:[(0,H.jsxs)(`header`,{style:{background:`rgba(23, 27, 40, 0.92)`,backdropFilter:`blur(24px)`,WebkitBackdropFilter:`blur(24px)`,borderBottom:`1px solid rgba(244, 196, 48, 0.25)`,boxShadow:`0 4px 24px rgba(0,0,0,0.4)`},className:`fixed top-0 w-full z-50 flex items-center h-14 px-4 gap-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,H.jsx)(oo,{cut:8,borderColor:`rgba(244, 196, 48, 0.5)`,background:`rgba(27, 31, 44, 0.8)`,className:`relative w-10 h-10`,children:(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`span`,{className:`font-mono text-[11px] font-bold text-[var(--accent)] tracking-widest`,children:`WR`})})}),(0,H.jsxs)(`div`,{className:`hidden sm:flex flex-col leading-none`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[11px] font-bold text-[var(--text-primary)] tracking-[0.25em] uppercase`,children:`WR_CONSOLE`}),(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)] tracking-[0.15em]`,children:[`// V`,`3.34.1`]})]})]}),l&&d?(0,H.jsx)(`nav`,{className:`flex items-center flex-1 justify-center`,children:(0,H.jsx)(mD,{segments:[{label:`Workspace`,onClick:v},{label:d?.slice(-12)??``}]})}):(0,H.jsxs)(`div`,{role:`tablist`,"aria-label":`Console sections`,ref:k,className:`flex items-center gap-1 flex-1 justify-center`,children:[(0,H.jsxs)(`button`,{role:`tab`,id:`tab-workspace`,"aria-selected":c===`workspace`,"aria-controls":`panel-workspace`,tabIndex:c===`workspace`?0:-1,onClick:()=>O(`workspace`,()=>void e({to:`/`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`workspace`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`workspace`?`tab-activating`:``].join(` `),style:c===`workspace`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Workspace`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-workflows`,"aria-selected":c===`workflows`,"aria-controls":`panel-workflows`,tabIndex:c===`workflows`?0:-1,onClick:()=>O(`workflows`,()=>void e({to:`/workflows`,search:{tag:void 0}})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`workflows`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`workflows`?`tab-activating`:``].join(` `),style:c===`workflows`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Workflows`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-auto`,"aria-selected":c===`auto`,"aria-controls":`panel-auto`,tabIndex:c===`auto`?0:-1,onClick:()=>O(`auto`,()=>void e({to:`/auto`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`auto`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`auto`?`tab-activating`:``].join(` `),style:c===`auto`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Auto`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-perf`,"aria-selected":c===`perf`,"aria-controls":`panel-perf`,tabIndex:c===`perf`?0:-1,onClick:()=>O(`perf`,()=>void e({to:`/perf`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`perf`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`perf`?`tab-activating`:``].join(` `),style:c===`perf`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Performance`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[g>0&&(0,H.jsx)($a,{label:`${Math.min(g,9)}${g>9?`+`:``} LIVE`,color:`var(--accent-strong)`,pulse:!0,role:`status`,"aria-label":`${g} live session${g===1?``:`s`}`}),_>0&&(0,H.jsx)($a,{label:`${Math.min(_,9)}${_>9?`+`:``} BLOCKED`,color:`var(--blocked)`,role:`status`,"aria-label":`${_} blocked session${_===1?``:`s`}`})]})]}),(0,H.jsxs)(`main`,{className:`p-6`,style:{paddingTop:`calc(56px + 1.5rem)`},children:[(0,H.jsxs)(`div`,{id:`panel-workspace`,role:`tabpanel`,"aria-labelledby":`tab-workspace`,hidden:c===`workflows`||c===`perf`||c===`auto`,children:[(0,H.jsx)(bo,{viewModel:m,sessionListViewModel:h,hidden:l}),l&&d&&(0,H.jsx)(cD,{viewModel:w})]}),c===`workflows`&&(0,H.jsx)(`div`,{id:`panel-workflows`,role:`tabpanel`,"aria-labelledby":`tab-workflows`,children:u&&f?(0,H.jsx)(hD,{viewModel:C}):(0,H.jsx)(jD,{viewModel:S})}),c===`auto`&&(0,H.jsx)(`div`,{id:`panel-auto`,role:`tabpanel`,"aria-labelledby":`tab-auto`,children:(0,H.jsx)(oO,{})}),c===`perf`&&(0,H.jsx)(`div`,{id:`panel-perf`,role:`tabpanel`,"aria-labelledby":`tab-perf`,children:(0,H.jsx)(qD,{viewModel:T})})]})]})}var YO=zi({component:JO}),XO=Li({getParentRoute:()=>YO,path:`/`,component:()=>null}),ZO=Li({getParentRoute:()=>YO,path:`/session/$sessionId`,component:()=>null}),QO=Li({getParentRoute:()=>YO,path:`/workflows`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),$O=Li({getParentRoute:()=>YO,path:`/workflows/$workflowId`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),ek=Li({getParentRoute:()=>YO,path:`/perf`,component:()=>null}),tk=Li({getParentRoute:()=>YO,path:`/auto`,component:()=>null}),nk=ea({routeTree:YO.addChildren([XO,ZO,QO,$O,ek,tk]),history:hr()}),rk=new Re({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3}}});(0,aa.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(Ue,{client:rk,children:(0,H.jsx)(ra,{router:nk})})}));
|
|
28
|
+
`},i)),a}function zT(e,t){return e&&`run`in e?async function(n,r){let i=RT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return RT(n,{file:r,...e||t})}}function BT(e){if(e)throw e}var VT=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function HT(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UT(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?WT(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function WT(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var GT={basename:KT,dirname:qT,extname:JT,join:YT,sep:`/`};function KT(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);QT(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function qT(e){if(QT(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function JT(e){QT(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function YT(...e){let t=-1,n;for(;++t<e.length;)QT(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:XT(n)}function XT(e){QT(e);let t=e.codePointAt(0)===47,n=ZT(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function ZT(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function QT(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var $T={cwd:eE};function eE(){return`/`}function tE(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function nE(e){if(typeof e==`string`)e=new URL(e);else if(!tE(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return rE(e)}function rE(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var iE=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],aE=class{constructor(e){let t;t=e?tE(e)?{path:e}:typeof e==`string`||lE(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:$T.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<iE.length;){let e=iE[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)iE.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?GT.basename(this.path):void 0}set basename(e){sE(e,`basename`),oE(e,`basename`),this.path=GT.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?GT.dirname(this.path):void 0}set dirname(e){cE(this.basename,`dirname`),this.path=GT.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?GT.extname(this.path):void 0}set extname(e){if(oE(e,`extname`),cE(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=GT.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){tE(e)&&(e=nE(e)),sE(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?GT.basename(this.path,this.extname):void 0}set stem(e){sE(e,`stem`),oE(e,`stem`),this.path=GT.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Jb(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function oE(e,t){if(e&&e.includes(GT.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+GT.sep+"`")}function sE(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function cE(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function lE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var uE=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),dE=l(VT(),1),fE={}.hasOwnProperty,pE=new class e extends uE{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=UT()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,dE.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(gE(`data`,this.frozen),this.namespace[e]=t,this):fE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(gE(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=yE(e),n=this.parser||this.Parser;return mE(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),mE(`process`,this.parser||this.Parser),hE(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=yE(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);xE(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),mE(`processSync`,this.parser||this.Parser),hE(`processSync`,this.compiler||this.Compiler),this.process(e,r),vE(`processSync`,`process`,t),n;function r(e,r){t=!0,BT(e),n=r}}run(e,t,n){_E(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=yE(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),vE(`runSync`,`run`,n),r;function i(e,t){BT(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=yE(t),r=this.compiler||this.Compiler;return hE(`stringify`,r),_E(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(gE(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,dE.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];HT(o)&&HT(r)&&(r=(0,dE.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function mE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function hE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function gE(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _E(e){if(!HT(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vE(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function yE(e){return bE(e)?e:new aE(e)}function bE(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function xE(e){return typeof e==`string`||SE(e)}function SE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var CE=[],wE={allowDangerousHtml:!0},TE=/^(https?|ircs?|mailto|xmpp)$/i,EE=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function DE(e){let t=OE(e),n=kE(e);return AE(t.runSync(t.parse(n),n),e)}function OE(e){let t=e.rehypePlugins||CE,n=e.remarkPlugins||CE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wE}:wE;return pE().use(Tw).use(n).use(zT,r).use(t)}function kE(e){let t=e.children||``,n=new aE;return typeof t==`string`?n.value=t:``+t,n}function AE(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||jE;for(let e of EE)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return kT(e,l),nx(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in wx)if(Object.hasOwn(wx,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=wx[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function jE(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||TE.test(e.slice(0,t))?e:``}function ME({children:e,className:t}){return(0,H.jsx)(`div`,{className:`markdown-view ${t??``}`,children:(0,H.jsx)(DE,{children:e})})}function NE({sessionId:e,nodeId:t,runStatus:n=`complete`,currentNodeId:r=null,executionTraceSummary:i=null}){let{data:a,isLoading:o,error:s}=By(e,t);return t?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(PE,{stepLabel:a?.stepLabel??null,nodeId:t}),(0,H.jsxs)(`div`,{className:`p-4 space-y-4`,children:[o&&(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)] text-sm`,children:`Loading...`}),s&&(0,H.jsx)(`div`,{className:`text-[var(--error)] text-sm bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3`,children:s.message}),a&&(0,H.jsx)(zE,{detail:a,runStatus:n,currentNodeId:r,executionTraceSummary:i})]})]}):(0,H.jsx)(`div`,{className:`px-5 py-8 text-sm text-[var(--text-secondary)]`,children:`Select a node in the lineage to inspect its recap, validations, gaps, and artifacts.`})}function PE({stepLabel:e,nodeId:t}){return(0,H.jsxs)(`div`,{className:`px-5 py-4 border-b border-[var(--border)] console-blueprint-grid`,children:[(0,H.jsx)(`div`,{className:`text-base font-semibold text-[var(--text-primary)] leading-tight`,children:e??`Untitled node`}),(0,H.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-[var(--text-muted)] truncate`,children:t})]})}function FE({item:e}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-1`,children:[(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]})}function IE({nodeId:e,nodeKind:t,executionTraceSummary:n}){let{whySelected:r,conditions:i,loops:a,divergences:o,forks:s}=sy(n,e);return n.items.some(t=>t.kind!==`context_fact`&&t.refs.some(t=>t.kind===`node_id`&&t.value===e))?(0,H.jsx)(eD,{title:`Routing context`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(r.length>0||t===`blocked_attempt`)&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:(0,H.jsx)(Oy,{label:`WHY SELECTED`,color:`var(--accent)`,bgColor:`rgba(244,196,48,0.10)`})}),r.length>0?(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:r.map((e,t)=>(0,H.jsx)(FE,{item:e},t))}):t===`blocked_attempt`?(0,H.jsx)(`div`,{className:`pl-2 border-l border-[var(--border)]`,children:(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-muted)]`,children:`This step was attempted but not selected as the preferred path.`})}):null]}),i.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`CONDITIONS EVALUATED`,color:`var(--text-secondary)`,bgColor:`rgba(168,159,140,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:[...i.filter(e=>!ty(e)),...i.filter(e=>ty(e))].map((e,t)=>{let n=ty(e);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(Oy,{label:n?`PASS`:`SKIP`,color:n?`var(--success)`:`var(--warning)`,bgColor:n?`rgba(34,197,94,0.10)`:`rgba(251,191,36,0.10)`}),(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary})]},t)})})]}),a.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`LOOP`,color:`var(--accent-strong)`,bgColor:`rgba(0,240,255,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:a.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]}),o.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`DIVERGENCE`,color:`var(--error)`,bgColor:`rgba(255,107,107,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:o.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]}),s.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(Oy,{label:`FORK`,color:`var(--warning)`,bgColor:`rgba(251,191,36,0.10)`})}),(0,H.jsx)(`div`,{className:`space-y-1 pl-2 border-l border-[var(--border)]`,children:s.map((e,t)=>(0,H.jsx)(FE,{item:e},t))})]})]})}):(0,H.jsx)(eD,{title:`Routing context`,children:t===`blocked_attempt`&&r.length===0?(0,H.jsxs)(`div`,{className:`flex items-start gap-2 py-1`,children:[(0,H.jsx)(Oy,{label:`WHY SELECTED`,color:`var(--text-muted)`,bgColor:`rgba(123,141,167,0.08)`}),(0,H.jsx)(`span`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:`This step was attempted but not selected as the preferred path.`})]}):(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:`// no routing trace for this node`})})}function LE({items:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsx)(eD,{title:`Run routing`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.20em] text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors`,children:[(0,H.jsx)(Oy,{label:`RUN ROUTING`,color:`var(--text-muted)`,bgColor:`rgba(123,141,167,0.08)`}),(0,H.jsxs)(`span`,{className:`text-[var(--text-muted)]`,children:[`// `,e.length,` ambient items`]}),(0,H.jsx)(`span`,{children:t?`[-]`:`[+]`})]}),t&&(0,H.jsx)(`div`,{className:`mt-2 space-y-1 pl-2 border-l border-[var(--border)]`,children:e.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.16em]`,style:{color:`var(--text-muted)`,backgroundColor:`rgba(123,141,167,0.08)`,border:`1px solid rgba(123,141,167,0.20)`},children:e.kind.replace(/_/g,` `).toUpperCase()}),(0,H.jsx)(`span`,{className:`flex-1 text-[var(--text-secondary)] leading-relaxed`,children:e.summary}),(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)] shrink-0`,children:[`#`,e.recordedAtEventIndex]})]},t))})]})})}var RE=[{id:`routing`,column:`primary`,render:({detail:e,executionTraceSummary:t})=>t===null?null:(0,H.jsx)(IE,{nodeId:e.nodeId,nodeKind:e.nodeKind,executionTraceSummary:t},`routing`)},{id:`run_routing`,column:`primary`,render:({executionTraceSummary:e})=>{if(e===null)return null;let t=e.items.filter(e=>!e.refs.some(e=>e.kind===`node_id`));return t.length===0?null:(0,H.jsx)(LE,{items:t},`run_routing`)}},{id:`recap`,column:`primary`,render:({detail:e,runStatus:t,currentNodeId:n})=>e.recapMarkdown?(0,H.jsx)(GE,{markdown:e.recapMarkdown},`recap`):t===`in_progress`&&e.nodeId===n&&!e.recapMarkdown?(0,H.jsx)(BE,{detail:e},`recap-in-progress`):null},{id:`validations`,column:`primary`,render:({detail:e})=>e.validations.length>0?(0,H.jsx)(qE,{validations:e.validations},`validations`):null},{id:`gaps`,column:`primary`,render:({detail:e})=>e.gaps.length>0?(0,H.jsx)(YE,{gaps:e.gaps},`gaps`):null},{id:`advance-outcome`,column:`primary`,render:({detail:e})=>e.advanceOutcome?(0,H.jsx)(KE,{outcome:e.advanceOutcome},`advance-outcome`):null},{id:`artifacts`,column:`primary`,render:({detail:e})=>e.artifacts.length>0?(0,H.jsx)($E,{artifacts:e.artifacts},`artifacts`):null},{id:`node-meta`,column:`primary`,render:({detail:e})=>(0,H.jsx)(WE,{detail:e},`node-meta`)}];function zE(e){return(0,H.jsx)(`div`,{className:`space-y-4`,children:RE.map(t=>t.render(e))})}function BE({detail:e}){return(0,H.jsx)(eD,{title:`Recap`,children:(0,H.jsxs)(`div`,{className:`space-y-4 text-sm text-[var(--text-secondary)]`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(VE,{children:`In progress`}),(0,H.jsxs)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:[`event #`,e.createdAtEventIndex]})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]`,children:[(0,H.jsx)(HE,{label:`Current focus`,value:e.stepLabel??`Current workflow step`,supportingText:`This step is still running, so the recap will appear once execution finishes.`}),(0,H.jsx)(HE,{label:`Current state`,value:`Waiting for step completion`,supportingText:`The node has been created and selected as the current workflow position.`,mono:!0})]}),(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`px-4 py-3 border-b border-[var(--border)]`,children:(0,H.jsx)(zo,{children:`What lands here next`})}),(0,H.jsxs)(`div`,{className:`p-4 grid gap-3 md:grid-cols-3`,children:[(0,H.jsx)(UE,{title:`Recap`,description:`A step summary is written when this node completes.`}),(0,H.jsx)(UE,{title:`Validations`,description:`Validation results appear if this step records contract checks.`}),(0,H.jsx)(UE,{title:`Artifacts`,description:`Generated outputs show up here after the step produces them.`})]})]})]})})}function VE({children:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium text-xs`,style:{backgroundColor:`rgba(0, 219, 233, 0.12)`,color:`var(--accent-strong)`},children:e})}function HE({label:e,value:t,supportingText:n,mono:r=!1}){return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 space-y-2`,children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:r?`font-mono text-sm text-[var(--text-primary)]`:`text-[var(--text-primary)]`,children:t}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:n})]})}function UE({title:e,description:t}){return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] bg-[rgba(255,255,255,0.02)] px-3 py-3 space-y-2`,children:[(0,H.jsx)(zo,{color:`var(--text-secondary)`,children:e}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:t})]})}function WE({detail:e}){return(0,H.jsx)(eD,{title:`Node details`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(tD,{label:`Kind`,value:(0,H.jsx)(rD,{kind:e.nodeKind})}),(0,H.jsx)(tD,{label:`Event index`,value:String(e.createdAtEventIndex),mono:!0}),(0,H.jsx)(tD,{label:`Parent`,value:e.parentNodeId??`Root`,mono:!0}),(0,H.jsx)(tD,{label:`Tip state`,value:e.isTip?e.isPreferredTip?`Preferred tip`:`Tip`:`Historical`})]})})}function GE({markdown:e}){return(0,H.jsx)(eD,{title:`Recap`,children:(0,H.jsx)(ME,{children:e})})}function KE({outcome:e}){let t=e.kind===`advanced`;return(0,H.jsx)(eD,{title:`Advance outcome`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:t?`var(--success)20`:`var(--blocked)20`,color:t?`var(--success)`:`var(--blocked)`},children:t?`Advanced`:`Blocked`}),(0,H.jsxs)(`span`,{className:`text-[var(--text-muted)]`,children:[`attempt `,e.attemptId.slice(-8),` at event #`,e.recordedAtEventIndex]})]})})}function qE({validations:e}){return(0,H.jsx)(eD,{title:`Validations (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsx)(JE,{validation:e},e.validationId))})})}function JE({validation:e}){let t=e.outcome===`pass`;return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 text-xs space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:t?`var(--success)20`:`var(--error)20`,color:t?`var(--success)`:`var(--error)`},children:t?`Pass`:`Fail`}),(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] font-mono`,children:e.contractRef})]}),e.issues.length>0&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] mb-1`,children:`Issues`}),(0,H.jsx)(`ul`,{className:`list-disc list-inside text-[var(--error)] space-y-0.5`,children:e.issues.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]}),e.suggestions.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] mb-1`,children:`Suggestions`}),(0,H.jsx)(`ul`,{className:`list-disc list-inside text-[var(--text-secondary)] space-y-0.5`,children:e.suggestions.map((e,t)=>(0,H.jsx)(`li`,{children:e},t))})]})]})}function YE({gaps:e}){return(0,H.jsx)(eD,{title:`Gaps (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`flex items-start gap-3 text-xs bg-[var(--bg-primary)] border border-[var(--border)] px-3 py-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:e.isResolved?`var(--success)20`:e.severity===`critical`?`var(--error)20`:`var(--warning)20`,color:e.isResolved?`var(--success)`:e.severity===`critical`?`var(--error)`:`var(--warning)`},children:e.isResolved?`Resolved`:e.severity===`critical`?`Critical`:`Non-critical`}),(0,H.jsx)(`span`,{className:`text-[var(--text-secondary)] leading-relaxed`,children:e.summary})]},e.gapId))})})}var XE=1e5,ZE=[{prefix:`text/`,render:e=>(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e==`string`?e:String(e)})},{prefix:`application/json`,render:e=>(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e==`string`?e:JSON.stringify(e,null,2)})}];function QE(e){if(e.byteLength>XE)return(0,H.jsxs)(`div`,{className:`text-[var(--text-muted)] italic`,children:[`Content too large to display (`,iD(e.byteLength),` -- limit `,iD(XE),`)`]});let t=ZE.find(t=>e.contentType.startsWith(t.prefix));return t?t.render(e.content):(0,H.jsx)(`pre`,{className:`text-[var(--text-secondary)] whitespace-pre-wrap break-words font-mono max-h-40 overflow-y-auto`,children:typeof e.content==`string`?e.content:JSON.stringify(e.content,null,2)})}function $E({artifacts:e}){return(0,H.jsx)(eD,{title:`Artifacts (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3 text-xs space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[var(--text-muted)]`,children:[(0,H.jsx)(`span`,{children:e.contentType}),(0,H.jsx)(`span`,{children:`//`}),(0,H.jsx)(`span`,{children:iD(e.byteLength)})]}),QE(e)]},e.sha256))})})}function eD({title:e,children:t}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-2`,children:(0,H.jsx)(zo,{children:e})}),t]})}function tD({label:e,value:t,mono:n=!1}){return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-primary)] border border-[var(--border)] px-4 py-3`,children:[(0,H.jsx)(zo,{children:e}),(0,H.jsx)(`div`,{className:n?`mt-2 font-mono text-sm text-[var(--text-secondary)] truncate`:`mt-2 text-sm text-[var(--text-primary)]`,children:t})]})}var nD={step:{label:`Step`,color:`var(--accent)`},checkpoint:{label:`Checkpoint`,color:`var(--success)`},blocked_attempt:{label:`Blocked`,color:`var(--error)`}};function rD({kind:e}){let t=nD[e];return(0,H.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 font-medium`,style:{backgroundColor:`${t.color}20`,color:t.color},children:t.label})}function iD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function aD(e){return e.length>16?`\u2026${e.slice(-16)}`:e}function oD({data:e}){let t=e.runs[0]??null,n=t?.workflowName??t?.workflowId??`--`,r=t?.workflowHash?.slice(0,12)??`--`;return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-card)] border border-[var(--border)] px-5 py-4 corner-brackets`,style:{backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`},children:[e.sessionTitle&&(0,H.jsx)(`h2`,{className:`text-base font-medium text-[var(--text-primary)] mb-3`,children:e.sessionTitle}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-8 gap-y-2`,children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Session`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:aD(e.sessionId)}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Workflow`}),(0,H.jsx)(`dd`,{className:`text-sm text-[var(--text-primary)] self-center`,children:n}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Hash`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:r}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Status`}),(0,H.jsxs)(`dd`,{className:`self-center flex items-center gap-2`,children:[(0,H.jsx)(no,{health:e.health}),e.health===`healthy`&&(0,H.jsx)(`span`,{className:`text-sm text-[var(--text-primary)]`,children:`Healthy`})]}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)] self-center`,children:`Runs`}),(0,H.jsxs)(`dd`,{className:`text-sm text-[var(--text-primary)] self-center`,children:[e.runs.length,` run`,e.runs.length===1?``:`s`]})]})]})}function sD({runs:e}){let t=e.some(e=>e.preferredTipNodeId!==null),n=e.some(e=>e.executionTraceSummary!==null);return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] px-4 py-3 text-xs text-[var(--text-muted)] space-y-1`,children:[(0,H.jsx)(`p`,{children:t?`Nodes with a gold border are the current execution tips — click any node to inspect its execution detail.`:`Click any node in the DAG to inspect its execution detail.`}),n&&(0,H.jsxs)(`p`,{children:[`This run has execution trace data. Click`,` `,(0,H.jsx)(`span`,{className:`font-mono uppercase tracking-[0.16em]`,children:`[ TRACE ]`}),` `,`to see why certain steps ran, were skipped, or repeated.`]})]})}function cD({viewModel:e}){let{state:t,onSelectNode:n,onCloseNode:r}=e;if(t.kind===`loading`)return(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)]`,children:`Loading session...`});if(t.kind===`error`)return(0,H.jsxs)(`div`,{className:`text-[var(--error)] bg-[var(--bg-card)] rounded-lg p-4`,children:[`Failed to load session: `,t.message]});let{sessionId:i,data:a,selectedNode:o,selectedRun:s}=t;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(oD,{data:a}),a.runs.length===0?(0,H.jsx)(`div`,{className:`text-center py-16 text-[var(--text-secondary)]`,children:`No runs in this session`}):(0,H.jsxs)(H.Fragment,{children:[o===null&&(0,H.jsx)(sD,{runs:a.runs}),(0,H.jsx)(`div`,{className:`space-y-6`,children:a.runs.map(e=>(0,H.jsx)(lD,{run:e,selectedNodeId:o?.runId===e.runId?o.nodeId:null,onNodeClick:n},e.runId))})]})]}),(0,H.jsxs)(oo,{cut:18,borderColor:`rgba(244, 196, 48, 0.35)`,background:`rgba(27, 31, 44, 0.78)`,dropShadow:`drop-shadow(0 16px 48px rgba(0,0,0,0.9)) drop-shadow(0 2px 12px rgba(244,196,48,0.15))`,backdropFilter:`blur(16px)`,className:`fixed top-3 right-3 bottom-3 w-[560px] max-w-[calc(92vw-12px)] transition-transform duration-200 ease-out`,style:{zIndex:40,transform:o?`translateX(0)`:`translateX(calc(100% + 12px))`},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0 console-blueprint-grid`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)]`,children:`Node detail`}),(0,H.jsx)(`button`,{onClick:r,className:`text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors text-xl leading-none px-1`,"aria-label":`Close`,children:`×`})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,H.jsx)(NE,{sessionId:i,nodeId:o?.nodeId??null,runStatus:s?.status??`complete`,currentNodeId:s?.preferredTipNodeId??null,executionTraceSummary:s?.executionTraceSummary??null})})]})]})}function lD({run:e,selectedNodeId:t,onNodeClick:n}){let r=e.executionTraceSummary!==null,[i,a]=(0,V.useState)(`dag`);return(0,H.jsxs)(oo,{cut:10,background:`rgba(27, 31, 44, 0.72)`,backdropFilter:`blur(8px)`,className:`relative`,style:{height:r?`542px`:`506px`},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-[var(--text-primary)]`,children:e.workflowName??e.workflowId??`Run`}),(0,H.jsx)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:e.runId}),(0,H.jsxs)(`span`,{className:`font-mono text-xs text-[var(--text-muted)]`,children:[e.nodes.length,` nodes · `,e.tipNodeIds.length,` tip`,e.tipNodeIds.length===1?``:`s`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.hasUnresolvedCriticalGaps&&(0,H.jsx)(`span`,{className:`text-xs text-[var(--warning)]`,children:`Critical gaps`}),(0,H.jsx)(to,{status:e.status})]})]}),r&&(0,H.jsxs)(`div`,{role:`tablist`,"aria-label":`Run view mode`,className:`flex items-center border-b border-[var(--border)] shrink-0 h-9 px-2 gap-0.5`,onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),a(`trace`)),e.key===`ArrowLeft`&&(e.preventDefault(),a(`dag`))},children:[(0,H.jsxs)(`button`,{type:`button`,id:`tab-dag`,role:`tab`,tabIndex:i===`dag`?0:-1,"aria-selected":i===`dag`,onClick:()=>a(`dag`),className:[`tab-btn px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.25em] transition-colors duration-150`,i===`dag`?`tab-btn--active text-[var(--accent)]`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`].join(` `),style:i===`dag`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`DAG`]}),(0,H.jsxs)(`button`,{type:`button`,id:`tab-trace`,role:`tab`,tabIndex:i===`trace`?0:-1,"aria-selected":i===`trace`,onClick:()=>a(`trace`),className:[`tab-btn px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.25em] transition-colors duration-150`,i===`trace`?`tab-btn--active text-[var(--accent)]`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`].join(` `),style:i===`trace`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`TRACE`]})]}),(0,H.jsx)(`div`,{role:`tabpanel`,"aria-labelledby":i===`dag`?`tab-dag`:`tab-trace`,className:`flex-1`,children:i===`trace`&&e.executionTraceSummary!==null?(0,H.jsx)(Py,{summary:e.executionTraceSummary,runStatus:e.status}):(0,H.jsx)(cy,{run:e,selectedNodeId:t,onNodeClick:t=>n(e.runId,t)})})]})}function uD(){let[e,t]=(0,V.useState)(0),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)(38),[o,s]=(0,V.useState)(62),[c,l]=(0,V.useState)(3),[u,d]=(0,V.useState)(2),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(!1),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)(null),y=(0,V.useRef)(null),b=(e,n,i,o,c,u)=>{g.current=!0,h(!0),t(e=>e+1),r(Math.floor(Math.random()*4)),a(5+Math.floor(Math.random()*80)),s(5+Math.floor(Math.random()*80)),l(2+Math.floor(Math.random()*40)),d(2+Math.floor(Math.random()*25)),p(i===`horizontal`?n===`next`?`modal-content--exit-h-next`:`modal-content--exit-h-prev`:n===`next`?`modal-content--exit-v-next`:`modal-content--exit-v-prev`),c.current&&(c.current.scrollTop=0);let f=u[e].id;setTimeout(()=>{o(f),p(i===`horizontal`?n===`next`?`modal-content--enter-h-next`:`modal-content--enter-h-prev`:n===`next`?`modal-content--enter-v-next`:`modal-content--enter-v-prev`),h(!1)},80),setTimeout(()=>{if(p(``),g.current=!1,_.current!==null){let e=_.current;_.current=null;let t=e>u.findIndex(e=>e.id===v.current)?`next`:`prev`;y.current?.(e,t,`horizontal`,o,c,u)}},240)};return y.current=b,{state:{isAnimating:g.current,contentAnimClass:f,borderFlashing:m,scanline:e>0?{key:e,crtOffset:n,glitchY:i,glitchY2:o,glitchW:c,glitchW2:u}:null},startTransition:b,navigate:(e,t,n,r,i,a)=>{if(t.length<=1)return;let o=t.findIndex(t=>t.id===e);if(o===-1)return;let s=n===`next`?(o+1)%t.length:(o-1+t.length)%t.length;if(g.current){_.current=s;return}b(s,n,r,i,a,t)},selectedWorkflowIdRef:v}}var dD=[{id:`coding`,label:`Coding`},{id:`review_audit`,label:`Review & Audit`},{id:`investigation`,label:`Investigation`},{id:`design`,label:`Design`},{id:`documentation`,label:`Documentation`},{id:`tickets`,label:`Tickets`},{id:`learning`,label:`Learning`},{id:`authoring`,label:`Workflow Authoring`}],fD=Object.fromEntries(dD.map(e=>[e.id,e.label]));function pD({label:e,count:t,countLabel:n=`workflow`,showRule:r=!0,separator:i=`//`}){return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.30em] text-[var(--text-secondary)] shrink-0`,children:[e,t==null?``:` ${i} ${t} ${n}${t===1?``:`s`}`]}),r&&(0,H.jsx)(`div`,{className:`flex-1 h-px bg-[var(--border)]`})]})}function mD({segments:e,className:t=``}){return(0,H.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-0 ${t}`,children:e.map((t,n)=>{let r=n===e.length-1,i=!!t.onClick;return(0,H.jsxs)(`span`,{className:`flex items-center`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] tracking-[0.25em] text-[var(--text-muted)] mx-1`,children:`//`}),i?(0,H.jsx)(`button`,{type:`button`,onClick:t.onClick,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors cursor-pointer`,children:t.label.toUpperCase()}):(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] ${r?`text-[var(--text-secondary)]`:`text-[var(--text-muted)]`}`,"aria-current":r?`page`:void 0,children:t.label.toUpperCase()})]},n)})})}function hD({viewModel:e}){let{state:t}=e;if(t.kind===`not_found`)return(0,H.jsx)(`div`,{className:`space-y-5 max-w-3xl`,children:(0,H.jsx)(xD,{message:``,is404:!0,onRetry:()=>void 0,onBack:t.onBack})});if(t.kind===`error`)return(0,H.jsx)(`div`,{className:`space-y-5 max-w-3xl`,children:(0,H.jsx)(xD,{message:t.message,is404:!1,onRetry:t.onRetry,onBack:t.onBack})});if(t.kind===`loading`){let{cached:e,activeTagLabel:n,onBack:r}=t;return(0,H.jsxs)(`div`,{className:`space-y-5 max-w-3xl`,children:[(0,H.jsx)(mD,{segments:n?[{label:`Workflows`,onClick:r},{label:n}]:[{label:`Workflows`,onClick:r}]}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(gD,{name:e.name,description:e.description,tags:e.tags,source:e.source,stepCount:void 0}),(0,H.jsx)(`div`,{className:`space-y-4`,children:(0,H.jsx)(yD,{})})]}):(0,H.jsx)(bD,{})]})}let{workflow:n,name:r,description:i,tags:a,source:o,activeTagLabel:s,onPrev:c,onNext:l,onBack:u}=t;return(0,H.jsxs)(`div`,{className:`space-y-5 max-w-3xl`,children:[(0,H.jsx)(mD,{segments:s?[{label:`Workflows`,onClick:u},{label:s}]:[{label:`Workflows`,onClick:u}]}),(0,H.jsx)(gD,{name:r,description:i,tags:a,source:o,stepCount:n.stepCount}),(c??l)&&(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[c&&(0,H.jsxs)(`button`,{type:`button`,onClick:c,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`<`,` PREV`]}),l&&(0,H.jsxs)(`button`,{type:`button`,onClick:l,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`NEXT `,`>`]})]}),(0,H.jsx)(_D,{detail:n,name:r}),(0,H.jsx)(mD,{segments:[{label:`Workflows`,onClick:u}]})]})}function gD({name:e,description:t,tags:n,source:r,stepCount:i}){return(0,H.jsxs)(`div`,{className:`border border-[var(--border)] px-5 py-5 console-blueprint-grid`,children:[(0,H.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.35em] text-[var(--text-muted)] mb-2`,children:`// Workflow`}),(0,H.jsx)(`h2`,{className:`font-mono text-xl font-bold uppercase tracking-[0.08em] leading-tight mb-3`,style:{color:`var(--accent)`,textShadow:`0 0 24px rgba(244,196,48,0.45), 0 0 48px rgba(244,196,48,0.15)`},children:e}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i!=null&&i>0&&(0,H.jsxs)(`span`,{className:`font-mono text-[10px] px-1.5 py-0.5 border border-[var(--border)] text-[var(--text-secondary)]`,children:[i,` step`,i===1?``:`s`]}),n.filter(e=>e!==`routines`).map(e=>(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-[10px] px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-muted)]`,children:e},e)),r&&(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`font-mono text-[10px] px-1.5 py-0.5 border border-[var(--border)] text-[var(--text-muted)]`,children:[`src: `,r.displayName]})]}),t&&(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-secondary)] leading-relaxed mt-3`,children:t})]})}function _D({detail:e,name:t}){let n=e.about!==void 0&&e.about.length>0,r=e.examples!==void 0&&e.examples.length>0,i=e.preconditions!==void 0&&e.preconditions.length>0;return n||r||i?(0,H.jsxs)(`div`,{className:`space-y-6`,children:[n&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`About`}),(0,H.jsx)(ME,{children:e.about})]}),r&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Try it with:`}),(0,H.jsx)(`ul`,{className:`space-y-2`,children:e.examples.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-3 bg-[var(--bg-card)] border border-[var(--border)] rounded-none px-4 py-3`,children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`w-0.5 shrink-0 self-stretch rounded-full`,style:{backgroundColor:`var(--accent)`}}),(0,H.jsxs)(`span`,{className:`text-sm text-[var(--text-secondary)] leading-relaxed`,children:[`"`,e,`"`]})]},e))})]}),i&&(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Before you start:`}),(0,H.jsx)(`ul`,{className:`space-y-1.5`,children:e.preconditions.map(e=>(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-sm text-[var(--text-secondary)]`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-[var(--text-muted)] mt-0.5`,children:`•`}),(0,H.jsx)(`span`,{children:e})]},e))})]}),(0,H.jsx)(vD,{name:t})]}):(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] italic`,children:`No additional documentation available.`})}function vD({name:e}){let[t,n]=(0,V.useState)(!1),r=`Use the ${e} to [your goal]`;return(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider mb-3`,children:`Start with this prompt`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border border-[var(--border)] px-4 py-3`,children:[(0,H.jsxs)(`span`,{className:`flex-1 text-sm text-[var(--text-secondary)] font-mono truncate`,children:[`"`,r,`"`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},className:`shrink-0 text-xs font-mono text-[var(--accent)] hover:text-[var(--text-primary)] transition-colors`,children:t?`Copied!`:`Copy`})]})]})}function yD(){return(0,H.jsxs)(`div`,{className:`space-y-3 motion-safe:animate-pulse`,children:[(0,H.jsx)(`div`,{className:`h-3 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-full rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-5/6 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-4 w-4/6 rounded bg-[var(--bg-tertiary)]`})]})}function bD(){return(0,H.jsxs)(`div`,{className:`space-y-6 motion-safe:animate-pulse`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`div`,{className:`h-6 w-1/2 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-5 w-24 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`h-4 w-full rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(yD,{})]})}function xD({message:e,is404:t,onRetry:n,onBack:r}){return(0,H.jsxs)(`div`,{className:`space-y-4 bg-[var(--bg-card)] border border-[var(--border)] p-4`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:t?`Workflow not found.`:e}),(0,H.jsxs)(`div`,{className:`flex gap-3`,children:[!t&&(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`}),(0,H.jsxs)(`button`,{type:`button`,onClick:r,"aria-label":`Back to workflows list`,className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors`,children:[`<`,` WORKFLOWS`]})]})]})}function SD(e){if(e.size<2)return 1;let t=new Set;for(let n of e.values())t.add(Math.round(n.getBoundingClientRect().top));if(t.size<2){let t=Math.round(e.get(0)?.getBoundingClientRect().top??0),n=0;for(let r of e.values())Math.round(r.getBoundingClientRect().top)===t&&n++;return Math.max(1,n)}let n=Math.round(e.get(0)?.getBoundingClientRect().top??0),r=0;for(let t of e.values())Math.round(t.getBoundingClientRect().top)===n&&r++;return Math.max(1,r)}function CD(e,t,n,r){if(n===0)return 0;let i=(e??(t>0?-1:n))+t;return r?(i%n+n)%n:Math.max(0,Math.min(n-1,i))}function wD(e,t,n,r,i){if(n===0)return 0;let a=e??0,o=a%r,s=Math.floor(a/r),c=Math.ceil(n/r),l=s+t;l=i?(l%c+c)%c:Math.max(0,Math.min(c-1,l));let u=l*r+o;return Math.min(u,n-1)}function TD({count:e,cols:t=`auto`,onActivate:n,loop:r=!0}){let[i,a]=(0,V.useState)(null),o=(0,V.useRef)(new Map),s=(0,V.useCallback)(e=>{a(e),e!==null&&o.current.get(e)?.focus()},[]),c=(0,V.useCallback)(()=>t===`auto`?SD(o.current):Math.max(1,t),[t]);return{focusedIndex:i,setFocusedIndex:s,getItemProps:(0,V.useCallback)(t=>({tabIndex:i===null?t===0?0:-1:i===t?0:-1,onFocus:()=>{a(t)},onKeyDown:i=>{let a=c(),o=null;switch(i.key){case`ArrowRight`:case`d`:case`D`:o=CD(t,1,e,r);break;case`ArrowLeft`:case`a`:case`A`:o=CD(t,-1,e,r);break;case`ArrowDown`:case`s`:case`S`:o=wD(t,1,e,a,r);break;case`ArrowUp`:case`w`:case`W`:o=wD(t,-1,e,a,r);break;case`Home`:o=0;break;case`End`:o=e-1;break;case`Enter`:case` `:i.preventDefault(),n?.(t);return;default:return}o!==null&&(i.preventDefault(),s(o))},ref:e=>{e?o.current.set(t,e):o.current.delete(t)}}),[i,e,r,c,n,s]),containerProps:{role:`grid`}}}function ED(e){let t=Wy(e),n=()=>{t.refetch()};return t.isLoading?{kind:`loading`}:t.error?t.error instanceof Iy&&t.error.status===404?{kind:`not_found`}:{kind:`error`,message:t.error instanceof Error?t.error.message:`Could not load workflow details.`,refetch:n}:t.data?{kind:`ready`,detail:t.data,refetch:n}:{kind:`loading`}}function DD(){let e=Hy();return{workflows:e.data?.workflows.filter(e=>!e.tags.includes(`routines`)),isLoading:e.isLoading,error:e.error instanceof Error?e.error:null,refetch:e.refetch}}function OD(e,t){if(!e)return{prevWorkflow:null,nextWorkflow:null};let n=t.findIndex(t=>t.id===e);return n===-1?{prevWorkflow:null,nextWorkflow:null}:{prevWorkflow:n>0?t[n-1]??null:null,nextWorkflow:n<t.length-1?t[n+1]??null:null}}function kD({workflowId:e,activeTag:t,onBack:n,onNavigateToWorkflow:r}){let i=ED(e),a=DD().workflows,o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(r);c.current=r;let l=a??[],{prevWorkflow:u,nextWorkflow:d}=(0,V.useMemo)(()=>OD(e,l),[e,l]),f=u?()=>c.current(u.id):null,p=d?()=>c.current(d.id):null;o.current=f,s.current=p;let m=i.kind===`ready`;return(0,V.useEffect)(()=>{if(!m)return;function e(e){e.metaKey||e.ctrlKey||e.altKey||(e.key===`ArrowLeft`?(e.preventDefault(),o.current?.()):e.key===`ArrowRight`&&(e.preventDefault(),s.current?.()))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[m]),{state:(0,V.useMemo)(()=>{let r=a?.find(t=>t.id===e)??void 0,o=t?fD[t]??t:null;if(i.kind===`not_found`)return{kind:`not_found`,onBack:n};if(i.kind===`error`)return{kind:`error`,message:i.message,onBack:n,onRetry:i.refetch};if(i.kind===`ready`){let t=i.detail;return{kind:`ready`,workflow:t,name:t.name??r?.name??e??``,description:t.description??r?.description??null,tags:t.tags??r?.tags??[],source:t.source??r?.source??null,activeTagLabel:o,adjacentWorkflows:l,onPrev:f,onNext:p,onBack:n}}return{kind:`loading`,cached:r??null,activeTagLabel:o,onBack:n}},[i,a,e,t,l,f,p,n])}}function AD(e){let t=new Set(dD.map(e=>e.id)),n=new Map,r=[];for(let i of e){let e=i.tags.find(e=>e!==`routines`&&t.has(e));if(e){let t=n.get(e)??[];t.push(i),n.set(e,t)}else r.push(i)}let i=dD.filter(e=>n.has(e.id)).map(e=>({tagId:e.id,label:e.label,workflows:n.get(e.id)}));return r.length>0&&i.push({tagId:null,label:`Other`,workflows:r}),i}function jD({viewModel:e}){let{state:t,dispatch:n,triggerRef:r,onCardSelect:i}=e,a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=uD(),c=t.kind===`ready`?t.selectedWorkflowId:null;if((0,V.useEffect)(()=>{if(c){let e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)}},[c]),t.kind===`loading`)return(0,H.jsx)(FD,{});if(t.kind===`error`)return(0,H.jsx)(ID,{message:t.message,onRetry:t.onRetry});let{selectedTag:l,selectedSource:u,hintVisible:d,filteredWorkflows:f,flatWorkflows:p,availableSources:m,sourceFilteredWorkflows:h,tagFilteredWorkflows:g}=t,_=new Set(dD.map(e=>e.id)),v=new Set(h.flatMap(e=>e.tags)),y=new Map(dD.map(e=>[e.id,h.filter(t=>t.tags.includes(e.id)).length])),b=h.filter(e=>!e.tags.some(e=>e!==`routines`&&_.has(e))).length,x=h.length,S=g.length;return(0,H.jsx)(MD,{selectedWorkflowId:c,selectedTag:l,selectedSource:u,hintVisible:d,filteredWorkflows:f,flatWorkflows:p,availableSources:m,tagsWithWorkflows:v,countByTag:y,otherCount:b,allTagCount:x,allSourceCount:S,countBySource:new Map(m.map(e=>[e.displayName,g.filter(t=>t.source.displayName===e.displayName).length])),currentIndex:p.findIndex(e=>e.id===c),dispatch:n,onCardSelect:i,triggerRef:r,modalPanelRef:a,scrollRef:o,modalTransition:s})}function MD({selectedWorkflowId:e,selectedTag:t,selectedSource:n,hintVisible:r,filteredWorkflows:i,flatWorkflows:a,availableSources:o,tagsWithWorkflows:s,countByTag:c,otherCount:l,allTagCount:u,allSourceCount:d,countBySource:f,currentIndex:p,dispatch:m,onCardSelect:h,modalPanelRef:g,scrollRef:_,modalTransition:v}){let y=kD({workflowId:e,activeTag:t,onBack:()=>m({type:`modal_closed`}),onNavigateToWorkflow:e=>m({type:`workflow_selected`,id:e})}),b=(0,V.useCallback)((t,n)=>{v.navigate(e,a,t,n,e=>{m({type:`workflow_selected`,id:e}),v.selectedWorkflowIdRef.current=e},_)},[a,e,v,m,_]);(0,V.useEffect)(()=>{if(!e)return;let t=[`ArrowLeft`,`ArrowRight`,`a`,`A`,`d`,`D`],n=[`ArrowUp`,`ArrowDown`,`w`,`W`,`s`,`S`],r=e=>{if(n.includes(e.key)){e.preventDefault(),e.stopPropagation();return}t.includes(e.key)&&(e.preventDefault(),e.stopPropagation(),b([`ArrowLeft`,`a`,`A`].includes(e.key)?`prev`:`next`,`horizontal`))};return document.addEventListener(`keydown`,r,{capture:!0}),()=>{document.removeEventListener(`keydown`,r,{capture:!0})}},[e,b]);let{getItemProps:x,containerProps:S}=TD({count:a.length,cols:`auto`,onActivate:(0,V.useCallback)(e=>{let t=a[e];if(!t)return;let n=document.activeElement;n instanceof HTMLButtonElement&&h(t.id,n)},[a,h])});return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`font-mono text-2xl font-bold uppercase tracking-[0.12em] leading-none`,style:{color:`var(--accent)`,textShadow:`0 0 28px rgba(244,196,48,0.35)`},children:`Workflows`}),(0,H.jsxs)(`p`,{className:`font-mono text-[10px] tracking-[0.25em] text-[var(--text-muted)] mt-1.5`,children:[`// `,i.length,` available`]})]}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Filter workflows by category`,className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(ND,{label:`All`,count:u,isActive:t===null,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:null})}),dD.filter(e=>s.has(e.id)).map(e=>(0,H.jsx)(ND,{label:e.label,count:c.get(e.id)??0,isActive:t===e.id,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:t===e.id?null:e.id})},e.id)),l>0&&(0,H.jsx)(ND,{label:`Other`,count:l,isActive:t===`__other__`,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:t===`__other__`?null:`__other__`})})]}),o.length>1&&(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Filter workflows by source`,className:`flex flex-wrap gap-1.5`,children:[(0,H.jsx)(ND,{label:`All Sources`,count:d,isActive:n===null,disabled:!1,onClick:()=>m({type:`source_changed`,source:null})}),o.map(e=>(0,H.jsx)(ND,{label:e.displayName,count:f.get(e.displayName)??0,isActive:n===e.displayName,disabled:!1,onClick:()=>m({type:`source_changed`,source:n===e.displayName?null:e.displayName})},e.id))]}),i.length===0?(0,H.jsxs)(`div`,{className:`py-8 text-center space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)]`,children:`No workflows in this category.`}),t!==null&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>m({type:`tag_changed`,tag:null}),className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Clear filter`})]}):t===null?(0,H.jsx)(`div`,{className:`space-y-6`,children:(()=>{let t=0;return AD(i).map(n=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(pD,{label:n.label,count:n.workflows.length,showRule:!0}),(0,H.jsx)(`div`,{...S,className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:n.workflows.map(n=>(0,H.jsx)(PD,{workflow:n,onSelect:e=>h(n.id,e),navProps:x(t++),isActive:n.id===e},n.id))})]},n.tagId??`__other__`))})()}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(pD,{label:t===`__other__`?`Other`:fD[t]??t,count:i.length,showRule:!0}),(0,H.jsx)(`div`,{...S,className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:i.map((t,n)=>(0,H.jsx)(PD,{workflow:t,onSelect:e=>h(t.id,e),navProps:x(n),isActive:t.id===e},t.id))})]}),(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-end justify-center p-4 pointer-events-none`,"aria-hidden":!e,children:[e&&(0,H.jsx)(`div`,{className:`absolute inset-0 pointer-events-auto`,style:{background:`rgba(0,0,0,0.22)`,backdropFilter:`blur(2px)`},onClick:()=>m({type:`modal_closed`})}),(0,H.jsx)(`div`,{ref:g,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":`Workflow detail${e?`: ${a.find(t=>t.id===e)?.name??``}`:``}`,className:`relative w-full max-w-3xl ${e?`pointer-events-auto`:`pointer-events-none`}${v.state.borderFlashing?` modal-border-flashing`:``}`,style:{height:`85vh`,transform:e?`translateY(0) scale(1)`:`translateY(24px) scale(0.97)`,opacity:+!!e,transition:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`opacity 150ms ease-out`:`transform 250ms ease-out, opacity 250ms ease-out`,backdropFilter:`blur(2px)`,WebkitBackdropFilter:`blur(2px)`},children:(0,H.jsxs)(oo,{cut:20,borderColor:`rgba(244, 196, 48, 0.45)`,background:`rgba(15, 19, 31, 0.50)`,dropShadow:`drop-shadow(0 4px 24px rgba(244,196,48,0.15))`,className:`h-full flex flex-col`,children:[v.state.scanline!==null&&(0,H.jsx)(`div`,{className:`modal-scanline`,"aria-hidden":`true`,style:{"--crt-offset":`${v.state.scanline.crtOffset}px`,"--glitch-y":`${v.state.scanline.glitchY}%`,"--glitch-y2":`${v.state.scanline.glitchY2}%`,"--glitch-w":`${v.state.scanline.glitchW}px`,"--glitch-w2":`${v.state.scanline.glitchW2}px`,clipPath:ao(20)}},v.state.scanline.key),(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-[var(--border)] shrink-0 console-blueprint-grid`,style:{background:`rgba(15, 19, 31, 0.55)`},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-secondary)]`,children:`Workflow`}),p>=0&&(0,H.jsxs)(`span`,{className:`font-mono text-[10px] tracking-[0.20em] text-[var(--text-secondary)]`,children:[`[ `,p+1,` / `,a.length,` ]`]}),(0,H.jsx)(`span`,{className:`font-mono text-[9px] tracking-[0.15em] text-[var(--text-secondary)] transition-opacity duration-600`,style:{opacity:r?.5:0},"aria-hidden":`true`,children:`[ A / D ] NAV`})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>m({type:`modal_closed`}),className:`text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors text-xl leading-none`,"aria-label":`Close`,children:`×`})]}),(0,H.jsxs)(`div`,{ref:_,className:`flex-1 overflow-auto overscroll-contain px-6 py-5 ${v.state.contentAnimClass}`,style:{"--text-muted":`var(--text-secondary)`},children:[(0,H.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:a.find(t=>t.id===e)?.name??``}),e&&(0,H.jsx)(hD,{viewModel:y})]})]})})]})]})}function ND({label:e,count:t,isActive:n,disabled:r,onClick:i}){return(0,H.jsxs)(`button`,{type:`button`,onClick:i,disabled:r,"aria-pressed":n,className:[`px-3 py-2 min-w-[44px] min-h-[44px] rounded-none text-xs font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-2`,`disabled:opacity-50 disabled:cursor-not-allowed`,n?`border border-[var(--accent)] text-[var(--accent)] bg-transparent`:`text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-card)]`].join(` `),children:[e,` · `,t,n&&(0,H.jsx)(`span`,{className:`sr-only`,children:`(selected)`})]})}function PD({workflow:e,onSelect:t,navProps:n,isActive:r}){let i=e.tags.filter(e=>e!==`routines`).map(e=>fD[e]??e);return(0,H.jsx)(so,{variant:`grid`,onClick:e=>t(e.currentTarget),"aria-label":[e.name,e.description,i.length>0?`Tag: ${i.join(`, `)}`:null,`Source: ${e.source.displayName}`].filter(Boolean).join(`. `),style:r?{borderColor:`var(--accent)`,boxShadow:`0 0 0 1px rgba(244,196,48,0.4), 0 0 16px rgba(244,196,48,0.12)`}:void 0,...n,children:(0,H.jsxs)(`div`,{className:`flex flex-col flex-1 p-4 gap-2 min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-[var(--text-primary)] group-hover:text-[var(--accent)] transition-colors leading-snug line-clamp-2`,children:e.name}),(0,H.jsx)(`p`,{className:`text-xs text-[var(--text-secondary)] line-clamp-3 leading-relaxed flex-1`,children:e.description}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mt-auto pt-2 border-t border-[var(--border)]`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.slice(0,1).map(e=>(0,H.jsx)(`span`,{className:`font-mono text-[9px] px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-muted)]`,children:e},e))}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.stepCount!=null&&e.stepCount>0&&(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)]`,children:[e.stepCount,`s`]}),(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)] max-w-[80px] truncate`,children:[`src: `,e.source.displayName]})]})]})]})})}function FD(){return(0,H.jsx)(`div`,{className:`space-y-6 motion-safe:animate-pulse`,children:[0,1].map(e=>(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-3 w-24 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`flex-1 h-px bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:[0,1,2,3,4,5].map(e=>(0,H.jsxs)(`div`,{className:`min-h-[160px] bg-[var(--bg-card)] border border-[var(--border)] flex flex-col`,children:[(0,H.jsx)(`div`,{className:`h-[3px] bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`p-4 flex flex-col gap-2 flex-1`,children:[(0,H.jsx)(`div`,{className:`h-4 w-3/4 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-full bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-5/6 bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`mt-auto pt-2 border-t border-[var(--border)] flex justify-between`,children:[(0,H.jsx)(`div`,{className:`h-3 w-12 bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-16 bg-[var(--bg-tertiary)]`})]})]})]},e))})]},e))})}function ID({message:e,onRetry:t}){return(0,H.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:e}),(0,H.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`})]})}var LD=[{value:`recent`,label:`Recent first`,compareFn:(e,t)=>t.startedAtMs-e.startedAtMs},{value:`slowest`,label:`Slowest first`,compareFn:(e,t)=>t.durationMs-e.durationMs}],RD={success:{color:`var(--success)`,label:`OK`,isError:!1},error:{color:`var(--error)`,label:`Error`,isError:!0},unknown_tool:{color:`var(--warning)`,label:`Unknown`,isError:!0}};function zD(e,t){let n=LD.find(e=>e.value===t);return[...e].sort(n.compareFn)}function BD(e){return e.reduce((e,t)=>Math.max(e,t.durationMs),0)}function VD(e){return e.filter(e=>RD[e.outcome].isError).length}function HD(e){return e.length===0?null:Math.round(e.reduce((e,t)=>e+t.durationMs,0)/e.length)}function UD(e){return e.length===0?null:e.reduce((e,t)=>Math.max(e,t.startedAtMs),0)}function WD(e,t){return t>0?Math.round(e/t*120):0}function GD(e){return`${e} recorded`}var KD=[{key:`tool`,label:`Tool`,minWidth:`180px`},{key:`duration`,label:`Duration`,width:`220px`},{key:`started`,label:`Started`,width:`100px`},{key:`outcome`,label:`Outcome`}];function qD({viewModel:e}){let{state:t}=e;if(t.kind===`loading`)return(0,H.jsx)(ZD,{});if(t.kind===`devModeOff`)return(0,H.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] text-center`,children:`nothing to see here`})});if(t.kind===`error`)return(0,H.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-[var(--error)]`,children:t.message}),(0,H.jsx)(`button`,{type:`button`,onClick:t.retry,className:`text-sm text-[var(--accent)] hover:text-[var(--accent-hover)] transition-colors`,children:`Try again`})]});let{sorted:n,maxDuration:r,errorCount:i,avgMs:a,lastCallMs:o,countLabel:s,sortOrder:c,onSortChange:l}=t;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-[var(--text-secondary)]`,children:[s,` | `,(0,H.jsxs)(`span`,{style:{color:i>0?`var(--error)`:`var(--text-muted)`},children:[i,` errors`]}),` | `,`avg `,a===null?`--`:`${a}ms`,` | `,`last call `,o===null?`no calls yet`:co(o)]}),(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":`Sort order`,className:`flex items-center gap-1`,children:LD.map(e=>(0,H.jsx)(XD,{label:e.label,isActive:c===e.value,onClick:()=>l(e.value)},e.value))}),(0,H.jsxs)(`table`,{className:`w-full text-sm border-collapse`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{className:`text-xs text-[var(--text-muted)] border-b border-[var(--border)]`,children:KD.map(e=>(0,H.jsx)(`th`,{scope:`col`,className:`text-left py-2 pr-4 font-medium`,style:{width:e.width,minWidth:e.minWidth},children:e.label},e.key))})}),(0,H.jsx)(`tbody`,{children:n.length===0?(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:KD.length,className:`py-8 text-center text-sm text-[var(--text-muted)]`,children:`No tool calls recorded yet. Run a workflow to see timing data.`})}):n.map((e,t)=>(0,H.jsx)(JD,{obs:e,maxDuration:r},`${e.startedAtMs}-${e.toolName}-${t}`))})]})]})}function JD({obs:e,maxDuration:t}){let n=RD[e.outcome].isError,r=WD(e.durationMs,t);return(0,H.jsxs)(`tr`,{className:`border-b border-[var(--border)] hover:bg-[var(--bg-card)] transition-colors`,style:{borderLeft:n?`2px solid var(--error)`:`2px solid transparent`},children:[(0,H.jsx)(`td`,{className:`py-2 pr-4 font-mono text-[var(--text-primary)] overflow-hidden text-ellipsis`,title:e.toolName,style:{minWidth:`180px`,maxWidth:`240px`},children:(0,H.jsx)(`span`,{className:`block truncate`,children:e.toolName})}),(0,H.jsxs)(`td`,{className:`py-2 pr-4`,style:{width:`220px`},children:[(0,H.jsxs)(`span`,{className:`font-mono text-[var(--text-primary)]`,children:[e.durationMs,`ms`]}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`h-1 rounded mt-1`,style:{backgroundColor:`var(--accent)`,width:`${r}px`,maxWidth:`120px`}})]}),(0,H.jsx)(`td`,{className:`py-2 pr-4 text-[var(--text-secondary)]`,style:{width:`100px`},children:co(e.startedAtMs)}),(0,H.jsx)(`td`,{className:`py-2`,children:(0,H.jsx)(YD,{outcome:e.outcome})})]})}function YD({outcome:e}){let t=RD[e];return(0,H.jsx)(`span`,{className:`inline-block px-2 py-0.5 rounded text-xs font-medium`,style:{color:t.color,backgroundColor:`color-mix(in srgb, ${t.color} 12%, transparent)`},children:t.label})}function XD({label:e,isActive:t,onClick:n}){return(0,H.jsx)(`button`,{type:`button`,role:`radio`,onClick:n,"aria-checked":t,className:[`px-3 py-2 rounded text-xs font-medium min-w-[44px] transition-colors`,t?`text-[var(--text-primary)]`:`text-[var(--text-muted)] hover:text-[var(--text-secondary)]`].join(` `),children:e})}function ZD(){return(0,H.jsxs)(`div`,{className:`space-y-3 animate-pulse`,"aria-busy":`true`,"aria-label":`Loading performance data`,children:[(0,H.jsx)(`div`,{className:`h-4 w-64 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsx)(`div`,{className:`h-8 w-24 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-8 w-24 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsxs)(`div`,{className:`flex gap-4 border-b border-[var(--border)] pb-2`,children:[(0,H.jsx)(`div`,{className:`h-3 w-20 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-14 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-3 w-14 rounded bg-[var(--bg-tertiary)]`})]}),Array.from({length:8}).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex gap-4 py-2`,children:[(0,H.jsx)(`div`,{className:`h-4 rounded bg-[var(--bg-tertiary)]`,style:{minWidth:`180px`,width:`180px`}}),(0,H.jsxs)(`div`,{className:`space-y-1`,style:{width:`220px`},children:[(0,H.jsx)(`div`,{className:`h-4 w-16 rounded bg-[var(--bg-tertiary)]`}),(0,H.jsx)(`div`,{className:`h-1 w-20 rounded bg-[var(--bg-tertiary)]`})]}),(0,H.jsx)(`div`,{className:`h-4 w-16 rounded bg-[var(--bg-tertiary)]`,style:{width:`100px`}}),(0,H.jsx)(`div`,{className:`h-5 w-12 rounded bg-[var(--bg-tertiary)]`})]},t))]})}var QD=`workrail:auto:mru-workflow`;function $D(){try{return localStorage.getItem(QD)}catch{return null}}function eO(e){try{localStorage.setItem(QD,e)}catch{}}function tO(){let e=Hy(),t=Gy(),n=e.data?.workflows??[],r=t.data?.triggers??[],[i,a]=(0,V.useState)(()=>$D()??``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!0),v=(0,V.useRef)(null);(0,V.useEffect)(()=>{!i&&n.length>0&&a(n[0]?.id??``)},[i,n]);let y=e=>{a(e),eO(e)},b=async()=>{if(!(!i||!c.trim()||!o.trim())){d(!0),p(null),h(!1);try{await Ky({workflowId:i,goal:c.trim(),workspacePath:o.trim()}),h(!0),l(``),setTimeout(()=>v.current?.focus(),100)}catch(e){p(e instanceof Error?e.message:`Dispatch failed`)}finally{d(!1)}}},x=!!i&&!!c.trim()&&!!o.trim()&&!u;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(zo,{color:`var(--accent)`,children:`Dispatch`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Workflow`}),e.isLoading?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs`,children:`Loading workflows...`}):n.length===0?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs`,children:`No workflows available`}):(0,H.jsx)(`select`,{value:i,onChange:e=>y(e.target.value),className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-[var(--text-primary)] focus:outline-none focus:border-[var(--accent)] cursor-pointer`,children:n.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name??e.id},e.id))})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Workspace path`}),(0,H.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`/path/to/repo`,className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm font-mono text-[var(--text-primary)] placeholder-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(zo,{children:`Goal`}),(0,H.jsx)(`textarea`,{ref:v,value:c,onChange:e=>l(e.target.value),placeholder:`// describe the task...`,rows:4,className:`w-full bg-[var(--bg-secondary)] border border-[var(--border)] rounded-md px-3 py-2 text-sm font-mono text-[var(--text-primary)] placeholder-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)] resize-y`,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&x&&(e.preventDefault(),b())}})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`button`,{onClick:()=>void b(),disabled:!x,className:`self-start disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,H.jsx)($a,{label:u?`RUNNING...`:`RUN`,color:x?`var(--accent)`:void 0,pulse:u})}),m&&(0,H.jsx)(`div`,{className:`text-[var(--success)] font-mono text-[10px] uppercase tracking-[0.20em]`,children:`Dispatched -- check Queue pane`}),f&&(0,H.jsx)(`div`,{className:`text-[var(--error)] text-xs font-mono`,children:f})]}),(0,H.jsxs)(`div`,{className:`border-t border-[var(--border)] pt-4`,children:[(0,H.jsxs)(`button`,{onClick:()=>_(!g),className:`flex items-center gap-2 mb-2 cursor-pointer group`,children:[(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] text-xs transition-transform duration-150`,style:{transform:g?`rotate(-90deg)`:`rotate(0deg)`},children:`▼`}),(0,H.jsx)($a,{label:`TRIGGERS`,color:`var(--text-secondary)`}),r.length>0&&(0,H.jsxs)(`span`,{className:`text-xs text-[var(--text-muted)]`,children:[`(`,r.length,`)`]})]}),!g&&(0,H.jsx)(`div`,{className:`space-y-2`,children:t.isLoading?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs pl-4`,children:`Loading triggers...`}):r.length===0?(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] text-xs pl-4`,children:`No triggers configured. Set WORKRAIL_TRIGGERS_ENABLED=true and create triggers.yml.`}):r.map(e=>(0,H.jsxs)(`div`,{className:`pl-4 border-l-2 border-[var(--border)] text-xs space-y-0.5`,children:[(0,H.jsx)(`div`,{className:`font-mono text-[var(--text-primary)] text-[11px]`,children:e.id}),(0,H.jsx)(`div`,{className:`text-[var(--text-muted)]`,children:e.workflowId}),(0,H.jsx)(`div`,{className:`text-[var(--text-muted)] truncate`,children:e.goal})]},e.id))})]})]})}function nO(e){let t=0,n=0,r=0;for(let i of e)i.status===`in_progress`?t++:i.status===`blocked`?n++:(i.status===`complete`||i.status===`complete_with_gaps`)&&r++;return{running:t,blocked:n,completed:r}}function rO(){let{data:e,isLoading:t,isError:n}=Ry(),r=(e?.sessions??[]).filter(e=>e.isAutonomous),{running:i,blocked:a,completed:o}=nO(r);return t?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,H.jsx)(`div`,{className:`text-[var(--text-secondary)] text-sm`,children:`Loading sessions...`})}):n?(0,H.jsx)(`div`,{className:`text-[var(--error)] bg-[var(--bg-card)] rounded-lg p-4 text-sm`,children:`Failed to load sessions`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(zo,{color:`var(--accent)`,children:`Queue`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(iO,{count:i,label:`RUNNING`,color:`var(--accent)`,pulse:!0}),(0,H.jsx)(iO,{count:a,label:`BLOCKED`,color:`var(--blocked)`}),(0,H.jsx)(iO,{count:o,label:`COMPLETED`,color:`var(--success)`})]}),r.length===0?(0,H.jsxs)(`div`,{className:`text-center py-16`,children:[(0,H.jsx)(`p`,{className:`text-[var(--text-secondary)] text-sm`,children:`No autonomous sessions yet`}),(0,H.jsx)(`p`,{className:`text-[var(--text-muted)] text-xs mt-1`,children:`Dispatch a workflow from the left pane to start.`})]}):(0,H.jsx)(`div`,{className:`space-y-2`,children:r.map(e=>(0,H.jsx)(aO,{session:e},e.sessionId))})]})}function iO({count:e,label:t,color:n,pulse:r}){return(0,H.jsx)($a,{label:`${e} ${t}`,color:e>0?n:`var(--text-muted)`,pulse:r&&e>0})}function aO({session:e}){let[t,n]=(0,V.useState)(!1),r=xi(),i=e.sessionTitle??e.workflowName??e.workflowId??`Unnamed session`,a=co(e.lastModifiedMs);return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-card)] border border-[var(--border)] rounded-lg overflow-hidden`,children:[(0,H.jsxs)(`button`,{onClick:()=>n(!t),className:`w-full px-4 py-3 flex items-center gap-3 text-left cursor-pointer hover:bg-[var(--bg-secondary)] transition-colors group`,children:[(0,H.jsx)(`span`,{className:`text-[var(--text-muted)] text-xs transition-transform duration-150 shrink-0`,style:{transform:t?`rotate(90deg)`:`rotate(0deg)`},children:`▶`}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-sm font-medium text-[var(--text-primary)] truncate group-hover:text-[var(--accent)] transition-colors`,children:i}),(0,H.jsx)(`div`,{className:`font-mono text-[10px] text-[var(--text-muted)] opacity-60 truncate`,children:e.sessionId})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,H.jsx)(`span`,{className:`text-[10px] text-[var(--text-muted)] tabular-nums`,children:a}),e.isLive&&(0,H.jsx)($a,{label:`LIVE`,pulse:!0,color:`var(--accent)`,"aria-label":`Actively running`}),(0,H.jsx)(to,{status:e.status})]})]}),t&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 border-t border-[var(--border)] pt-3 space-y-3`,children:[e.recapSnippet?(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-secondary)] font-mono whitespace-pre-wrap leading-relaxed`,children:e.recapSnippet}):(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)]`,children:`No recap available yet.`}),(0,H.jsx)(`button`,{onClick:()=>void r({to:`/session/$sessionId`,params:{sessionId:e.sessionId}}),className:`cursor-pointer`,children:(0,H.jsx)($a,{label:`OPEN IN DAG`,color:`var(--accent)`})})]})]})}function oO(){return(0,H.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-6`,children:[(0,H.jsx)(`div`,{className:`w-full md:w-2/5 shrink-0`,children:(0,H.jsx)(tO,{})}),(0,H.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,H.jsx)(rO,{})})]})}function sO(){let e=Ry(),t=Vy();qy();let n=e.data?.sessions;return{sessions:n,worktreeRepos:t.data?.repos??[],isLoading:e.isLoading,error:e.error instanceof Error?e.error:null,refetch:e.refetch,worktreesFetching:t.isFetching,liveCount:n?.filter(e=>e.status===`in_progress`).length??0,blockedCount:n?.filter(e=>e.status===`blocked`).length??0}}var cO={scope:`active`,focusedIndex:-1,archive:null};function lO(e){throw Error(`Unhandled WorkspaceEvent type: ${String(e.type)}`)}function uO(e,t){switch(t.type){case`scope_changed`:return{...e,scope:t.scope,focusedIndex:-1};case`focus_moved`:return{...e,focusedIndex:t.index};case`archive_opened`:return{...e,archive:{repoName:t.repoName}};case`archive_closed`:return{...e,archive:null};default:return lO(t)}}var dO=720*60*60*1e3,fO={in_progress:0,dormant:0,blocked:1,complete_with_gaps:2,complete:3};function pO(e){if(e.length!==0)return[...e].sort((e,t)=>{let n=fO[e.status]-fO[t.status];return n===0?t.lastModifiedMs-e.lastModifiedMs:n})[0]}function mO(e,t,n){let r=e.primarySession?.status;if(r===`in_progress`||r===`blocked`)return`visible`;let i=(e.worktree?.changedCount??0)>0,a=(e.worktree?.aheadCount??0)>0;return i||a?`visible`:r===`dormant`?t===`all`?`visible`:`hidden`:n-e.activityMs<dO||t===`all`?`visible`:`hidden`}function hO(e){switch(e.primarySession?.status){case`in_progress`:return 0;case`blocked`:return 1;case`dormant`:return 2;default:return(e.worktree?.changedCount??0)>0||(e.worktree?.aheadCount??0)>0?3:4}}function gO(e,t,n){return[...e].filter(e=>mO(e,t,n)===`visible`).sort((e,t)=>{let n=hO(e)-hO(t);return n===0?t.activityMs-e.activityMs:n})}function _O(e,t){let n=new Map;for(let e of t)for(let t of e.worktrees)t.branch!==null&&n.set(`${t.branch}\0${e.repoRoot}`,{wt:t,repoName:e.repoName,repoRoot:e.repoRoot});let r=new Map;for(let[e,t]of n){let[n]=e.split(`\0`),i=r.get(n)??[];i.push(t),r.set(n,i)}let i=new Map;for(let t of e){if(t.gitBranch===null)continue;let e=r.get(t.gitBranch)??[];if(e.length===0){if(!t.repoRoot)continue;let e=`${t.gitBranch}\0${t.repoRoot}`,r=i.get(e);if(r?r.push(t):i.set(e,[t]),!n.has(e)){let r=t.repoRoot.split(`/`).at(-1)??t.repoRoot;n.set(e,{wt:void 0,repoName:r,repoRoot:t.repoRoot})}continue}let a=e;if(t.repoRoot!==null){let n=e.filter(e=>e.repoRoot===t.repoRoot);n.length>0&&(a=n)}for(let e of a){let n=`${t.gitBranch}\0${e.repoRoot}`,r=i.get(n);r?r.push(t):i.set(n,[t])}}let a=[],o=new Set;for(let[e,t]of i){let[r,i]=e.split(`\0`),s=n.get(e),c=pO(t),l=Math.max(c?.lastModifiedMs??0,s?.wt?.headTimestampMs??0),u=s?.repoName??i.split(`/`).at(-1)??i;a.push({branch:r,repoRoot:i,repoName:u,worktree:s?.wt,primarySession:c,allSessions:t,activityMs:l}),o.add(e)}for(let[e,{wt:t,repoName:r,repoRoot:i}]of n){if(o.has(e))continue;let[n]=e.split(`\0`);a.push({branch:n,repoRoot:i,repoName:r,worktree:t,primarySession:void 0,allSessions:[],activityMs:t?.headTimestampMs??0})}return a}function vO(e,t,n,r){let i=_O(e,t),a=new Map;for(let e of i)a.has(e.repoRoot)||a.set(e.repoRoot,e.repoName);let o=new Map;for(let e of i){let t=o.get(e.repoRoot)??[];t.push(e),o.set(e.repoRoot,t)}let s=[...o.entries()].map(([e,t])=>({repoRoot:e,repoName:t[0].repoName,sortedItems:gO(t,n,r)})).filter(e=>e.sortedItems.length>0).sort((e,t)=>{let n=+!e.sortedItems.some(e=>e.primarySession?.status===`in_progress`||e.primarySession?.status===`blocked`),r=+!t.sortedItems.some(e=>e.primarySession?.status===`in_progress`||e.primarySession?.status===`blocked`);return n===r?e.repoName.localeCompare(t.repoName):n-r}),c=s.flatMap(e=>e.sortedItems),l=n===`active`?i.filter(e=>e.primarySession?.status===`dormant`&&(e.worktree?.changedCount??0)===0&&(e.worktree?.aheadCount??0)===0).length:0;return{repoGroups:s,orderedItems:c,archiveRepos:[...a.entries()].map(([e,t])=>[e,t]),dormantHiddenCount:l}}function yO({items:e,focusedIndex:t,scope:n,archive:r,dispatch:i,onSelectSession:a,onRefetch:o,disabled:s}){let c=(0,V.useRef)(e);c.current=e;let l=(0,V.useRef)(t);l.current=t;let u=(0,V.useRef)(n);u.current=n;let d=(0,V.useRef)(r);d.current=r;let f=(0,V.useRef)(s);f.current=s;let p=(0,V.useRef)(i);p.current=i;let m=(0,V.useRef)(a);m.current=a;let h=(0,V.useRef)(o);h.current=o,(0,V.useEffect)(()=>{function e(e){if(f.current||e.metaKey||e.ctrlKey||e.altKey)return;let t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return;let n=c.current,r=l.current;switch(e.key){case`j`:case`ArrowDown`:e.preventDefault(),p.current({type:`focus_moved`,index:Math.min(r+1,n.length-1)});break;case`k`:case`ArrowUp`:e.preventDefault(),p.current({type:`focus_moved`,index:Math.max(r-1,0)});break;case`Enter`:case` `:if(e.preventDefault(),r>=0&&r<n.length){let e=n[r]?.primarySession?.sessionId;e&&m.current(e)}break;case`Escape`:d.current!==null&&p.current({type:`archive_closed`});break;case`/`:e.preventDefault(),p.current({type:`archive_opened`,repoName:void 0});break;case`r`:e.preventDefault(),h.current();break;case`a`:e.preventDefault(),p.current({type:`scope_changed`,scope:u.current===`active`?`all`:`active`});break}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[])}function bO(e=!1){let t=xi(),n=sO(),[r,i]=(0,V.useReducer)(uO,cO),a=(0,V.useRef)(0),o=(0,V.useCallback)(e=>{a.current=window.scrollY,t({to:`/session/$sessionId`,params:{sessionId:e}})},[t]),s=i,c=(0,V.useMemo)(()=>n.sessions?vO(n.sessions,n.worktreeRepos,r.scope,Date.now()):null,[n.sessions,n.worktreeRepos,r.scope]);yO({items:c?.orderedItems??[],focusedIndex:r.focusedIndex,scope:r.scope,archive:r.archive,dispatch:s,onSelectSession:o,onRefetch:n.refetch,disabled:e});let{isLoading:l,error:u,worktreesFetching:d,sessions:f,liveCount:p,blockedCount:m}=n;return{state:(0,V.useMemo)(()=>l?{kind:`loading`}:u?{kind:`error`,message:u.message}:c?{kind:`ready`,scope:r.scope,focusedIndex:r.focusedIndex,archive:r.archive,repoGroups:c.repoGroups,orderedItems:c.orderedItems,archiveRepos:c.archiveRepos,dormantHiddenCount:c.dormantHiddenCount,worktreesFetching:d,hasAnySessions:(f?.length??0)>0,liveCount:p,blockedCount:m}:{kind:`loading`},[l,u,d,f,c,r,p,m]),dispatch:s,scrollYRef:a,onSelectSession:o}}function xO(){let e=Ry();return{sessions:e.data?.sessions,isLoading:e.isLoading,error:e.error instanceof Error?e.error:null}}function SO(e=``){return{rawSearch:e,sort:`recent`,groupBy:`none`,statusFilter:`all`,page:0}}function CO(e){throw Error(`Unhandled SessionListEvent type: ${String(e.type)}`)}function wO(e,t){switch(t.type){case`search_changed`:return{...e,rawSearch:t.value,page:0};case`sort_changed`:return{...e,sort:t.sort,page:0};case`group_changed`:return{...e,groupBy:t.groupBy,page:0};case`status_changed`:return{...e,statusFilter:t.statusFilter,page:0};case`page_changed`:return{...e,page:t.page};default:return CO(t)}}var TO={in_progress:0,blocked:1,dormant:2,complete_with_gaps:3,complete:4},EO=[{value:`recent`,label:`Recent`,compareFn:(e,t)=>t.lastModifiedMs-e.lastModifiedMs},{value:`status`,label:`Status`,compareFn:(e,t)=>TO[e.status]-TO[t.status]||t.lastModifiedMs-e.lastModifiedMs},{value:`workflow`,label:`Workflow`,compareFn:(e,t)=>(e.workflowName??e.workflowId??``).localeCompare(t.workflowName??t.workflowId??``)||t.lastModifiedMs-e.lastModifiedMs},{value:`nodes`,label:`Node count`,compareFn:(e,t)=>t.nodeCount-e.nodeCount||t.lastModifiedMs-e.lastModifiedMs}],DO=[{value:`none`,label:`No grouping`,keyFn:null},{value:`workflow`,label:`Workflow`,keyFn:e=>e.workflowName??e.workflowId??`Unknown workflow`},{value:`status`,label:`Status`,keyFn:e=>e.status,groupCompareFn:(e,t)=>(TO[e]??99)-(TO[t]??99)},{value:`branch`,label:`Branch`,keyFn:e=>e.gitBranch??`No branch`}],OO=[{value:`all`,label:`All`},{value:`in_progress`,label:`In Progress`},{value:`dormant`,label:`Dormant`},{value:`complete`,label:`Complete`},{value:`complete_with_gaps`,label:`Gaps`},{value:`blocked`,label:`Blocked`}];function kO(e,t,n){let r=e;if(n!==`all`&&(r=r.filter(e=>e.status===n)),t.trim()){let e=t.toLowerCase();r=r.filter(t=>(t.sessionTitle??``).toLowerCase().includes(e)||(t.workflowName??``).toLowerCase().includes(e)||(t.workflowId??``).toLowerCase().includes(e)||t.sessionId.toLowerCase().includes(e)||(t.gitBranch??``).toLowerCase().includes(e))}return r}function AO(e,t){let n=EO.find(e=>e.value===t)??EO[0];return[...e].sort(n.compareFn)}function jO(e,t){let n=DO.find(e=>e.value===t)??DO[0];if(!n.keyFn)return[{label:``,sessions:e}];let r=new Map;for(let t of e){let e=n.keyFn(t),i=r.get(e)??[];i.push(t),r.set(e,i)}let i=n.groupCompareFn??((e,t)=>e.localeCompare(t));return Array.from(r.entries()).sort(([e],[t])=>i(e,t)).map(([e,t])=>({label:e,sessions:t}))}function MO(e){let t={all:e.length};for(let n of e)t[n.status]=(t[n.status]??0)+1;return t}function NO(e,t){let[n,r]=(0,V.useState)(e),i=(0,V.useRef)(null);return(0,V.useEffect)(()=>(i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>r(e),t),()=>{i.current!==null&&clearTimeout(i.current)}),[e,t]),n}function PO({onSelectSession:e,initialSearch:t=``}){let n=xO(),[r,i]=(0,V.useReducer)(wO,void 0,()=>SO(t)),a=NO(r.rawSearch,200),o=(0,V.useRef)([]),s=(0,V.useCallback)(t=>{let n=o.current[t];n&&e(n.sessionId)},[e]),{sessions:c,isLoading:l,error:u}=n,d=(0,V.useMemo)(()=>c?MO(c):{},[c]),f=(0,V.useMemo)(()=>{if(!c)return null;let e=kO(c,a,r.statusFilter);return{groups:jO(AO(e,r.sort),r.groupBy),total:c.length,filtered:e.length}},[c,a,r.statusFilter,r.sort,r.groupBy]),p=r.groupBy!==`none`,m=f?Math.ceil(f.filtered/25):0,h=r.page*25,g=h+25,_=(0,V.useMemo)(()=>!f||p?[]:f.groups[0]?.sessions.slice(h,g)??[],[f,p,h,g]);o.current=_;let{getItemProps:v,containerProps:y}=TD({count:_.length,cols:1,onActivate:s});return{state:(0,V.useMemo)(()=>l?{kind:`loading`}:u?{kind:`error`,message:u.message}:f?{kind:`ready`,rawSearch:r.rawSearch,sort:r.sort,groupBy:r.groupBy,statusFilter:r.statusFilter,page:r.page,totalPages:m,isGrouped:p,processed:f,statusCounts:d,flatPageSessions:_,getSessionNavProps:v,sessionContainerProps:y,sortAxes:EO,groupAxes:DO,statusFilterOptions:OO}:{kind:`loading`},[l,u,f,r,m,p,d,_,v,y]),dispatch:i,onSelectSession:e}}var FO={selectedWorkflowId:null,selectedTag:null,selectedSource:null,hintVisible:!1};function IO(e){throw Error(`Unhandled WorkflowsEvent type: ${String(e.type)}`)}function LO(e,t){switch(t.type){case`workflow_selected`:return{...e,selectedWorkflowId:t.id,hintVisible:t.id!==null};case`tag_changed`:return{...e,selectedTag:t.tag,selectedWorkflowId:null,hintVisible:!1};case`source_changed`:return{...e,selectedSource:t.source,selectedWorkflowId:null,hintVisible:!1};case`modal_closed`:return{...e,selectedWorkflowId:null,hintVisible:!1};case`hint_dismissed`:return{...e,hintVisible:!1};default:return IO(t)}}function RO(e){let t=new Set;for(let n of e)for(let e of n.tags)e!==`routines`&&t.add(e);let n=dD.map(e=>e.id).filter(e=>t.has(e)),r=[...t].filter(e=>!dD.some(t=>t.id===e)).sort();return[...n,...r]}function zO(e){let t=new Map;for(let n of e)t.has(n.source.kind)||t.set(n.source.kind,{id:n.source.kind,displayName:n.source.displayName});return[...t.values()]}function BO(e,t,n){let r=new Set(dD.map(e=>e.id)),i=e;return t!==null&&(i=t===`__other__`?i.filter(e=>!e.tags.some(e=>e!==`routines`&&r.has(e))):i.filter(e=>e.tags.includes(t))),n!==null&&(i=i.filter(e=>e.source.displayName===n)),i}function VO(e,t){if(t!==null)return e;let n=new Set(dD.map(e=>e.id)),r=new Map,i=[];for(let t of e){let e=t.tags.find(e=>e!==`routines`&&n.has(e));if(e){let n=r.get(e)??[];n.push(t),r.set(e,n)}else i.push(t)}let a=[];for(let{id:e}of dD){let t=r.get(e);t&&a.push(...t)}return a.push(...i),a}function HO({initialTag:e,onSelectTag:t}){let n=DD(),[r,i]=(0,V.useReducer)(LO,{...FO,selectedTag:e});(0,V.useEffect)(()=>{e!==r.selectedTag&&i({type:`tag_changed`,tag:e})},[e]);let a=(0,V.useRef)(null),o=(0,V.useCallback)((e,t)=>{a.current=t,t.blur(),i({type:`workflow_selected`,id:e})},[]);(0,V.useEffect)(()=>{if(!r.selectedWorkflowId&&a.current){let e=a.current;a.current=null,e.focus()}},[r.selectedWorkflowId]),(0,V.useEffect)(()=>{if(!r.selectedWorkflowId)return;let e=window.scrollY;return document.body.style.overflow=`hidden`,document.body.style.position=`fixed`,document.body.style.top=`-${e}px`,document.body.style.width=`100%`,()=>{document.body.style.overflow=``,document.body.style.position=``,document.body.style.top=``,document.body.style.width=``,window.scrollTo(0,e)}},[r.selectedWorkflowId]),(0,V.useEffect)(()=>{if(!r.selectedWorkflowId)return;let e=e=>{e.key===`Escape`&&i({type:`modal_closed`})};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r.selectedWorkflowId]);let{isLoading:s,error:c,workflows:l}=n,u=(0,V.useMemo)(()=>{if(s)return{kind:`loading`};if(c)return{kind:`error`,message:c.message,onRetry:n.refetch};if(!l)return{kind:`loading`};let e=RO(l),t=zO(l),i=BO(l,r.selectedTag,r.selectedSource),a=VO(i,r.selectedTag),o=BO(l,null,r.selectedSource),u=BO(l,r.selectedTag,null);return{kind:`ready`,selectedWorkflowId:r.selectedWorkflowId,selectedTag:r.selectedTag,selectedSource:r.selectedSource,hintVisible:r.hintVisible,availableTags:e,availableSources:t,filteredWorkflows:i,flatWorkflows:a,sourceFilteredWorkflows:o,tagFilteredWorkflows:u}},[s,c,l,r,n.refetch]),d=u.kind===`ready`?u.flatWorkflows.length:0;return(0,V.useEffect)(()=>{if(!r.selectedWorkflowId||d<=1)return;let e=setTimeout(()=>i({type:`hint_dismissed`}),3e3);return()=>clearTimeout(e)},[r.selectedWorkflowId,d]),{state:u,dispatch:(0,V.useCallback)(e=>{e.type===`tag_changed`&&t(e.tag),i(e)},[t]),triggerRef:a,onCardSelect:o}}function UO(){let e=Uy();switch(e.state){case`loading`:return{kind:`loading`};case`devModeOff`:return{kind:`devModeOff`};case`error`:return{kind:`error`,message:e.message,retry:e.retry};case`data`:return{kind:`ready`,observations:e.data.observations}}}function WO(){let e=UO(),[t,n]=(0,V.useState)(`recent`);return{state:(0,V.useMemo)(()=>{if(e.kind===`loading`)return{kind:`loading`};if(e.kind===`devModeOff`)return{kind:`devModeOff`};if(e.kind===`error`)return{kind:`error`,message:e.message,retry:e.retry};let{observations:r}=e,i=zD(r,t);return{kind:`ready`,sorted:i,maxDuration:BD(i),errorCount:VD(r),avgMs:HD(r),lastCallMs:UD(r),countLabel:GD(r.length),sortOrder:t,onSortChange:n}},[e,t])}}function GO(e){let t=zy(e);return{data:t.data,isLoading:t.isLoading,error:t.error instanceof Error?t.error:null}}function KO(e){let t=GO(e),[n,r]=(0,V.useState)(null),i=(0,V.useCallback)((e,t)=>{r(n=>n?.runId===e&&n?.nodeId===t?null:{runId:e,nodeId:t})},[]),a=(0,V.useCallback)(()=>{r(null)},[]),{isLoading:o,error:s,data:c}=t,l=(0,V.useMemo)(()=>!c||!n?null:c.runs.find(e=>e.runId===n.runId)??null,[c,n]);return{state:(0,V.useMemo)(()=>o?{kind:`loading`}:s?{kind:`error`,message:s.message}:c?{kind:`ready`,sessionId:e,data:c,selectedNode:n,selectedRun:l}:{kind:`loading`},[o,s,c,e,n,l]),onSelectNode:i,onCloseNode:a}}var qO=[{id:`workspace`,path:`/`},{id:`workflows`,path:`/workflows`},{id:`auto`,path:`/auto`},{id:`perf`,path:`/perf`}];function JO(){let e=xi(),t=Qi(),{location:n}=ia(),r=t({to:`/session/$sessionId`}),i=t({to:`/workflows`}),a=t({to:`/workflows/$workflowId`}),o=t({to:`/perf`}),s=t({to:`/auto`}),c=i!==!1||a!==!1?`workflows`:o===!1?s===!1?`workspace`:`auto`:`perf`,l=r!==!1,u=a!==!1,d=l?r.sessionId:null,f=u?a.workflowId:null,p=new URLSearchParams(n.search).get(`tag`),m=bO(l),h=PO({onSelectSession:m.onSelectSession}),g=m.state.kind===`ready`?m.state.liveCount:0,_=m.state.kind===`ready`?m.state.blockedCount:0,v=(0,V.useCallback)(()=>{e({to:`/`})},[e]),y=(0,V.useCallback)(t=>{e({to:`/workflows`,search:{tag:t??void 0}})},[e]),b=(0,V.useCallback)(()=>{e({to:`/workflows`,search:{tag:p??void 0}})},[e,p]),x=(0,V.useCallback)(t=>{e({to:`/workflows/$workflowId`,params:{workflowId:t},search:{tag:p??void 0}})},[e,p]),S=HO({initialTag:p,onSelectTag:y}),C=kD({workflowId:f,activeTag:p,onBack:b,onNavigateToWorkflow:x}),w=KO(d??``),T=WO(),[E,D]=(0,V.useState)(null),O=(0,V.useCallback)((e,t)=>{t(),D(e),setTimeout(()=>D(null),200)},[]),k=(0,V.useRef)(null);return(0,V.useEffect)(()=>{let t=k.current;if(!t)return;function n(t){if(t.key===`ArrowLeft`||t.key===`ArrowRight`){t.preventDefault();let n=qO.findIndex(e=>e.id===c),r=qO[t.key===`ArrowRight`?(n+1)%qO.length:(n-1+qO.length)%qO.length];e({to:r.path,...r.path===`/workflows`?{search:{tag:void 0}}:{}})}}return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[c,e]),(0,H.jsxs)(`div`,{className:`min-h-screen`,style:{"--app-header-height":`56px`},children:[(0,H.jsxs)(`header`,{style:{background:`rgba(23, 27, 40, 0.92)`,backdropFilter:`blur(24px)`,WebkitBackdropFilter:`blur(24px)`,borderBottom:`1px solid rgba(244, 196, 48, 0.25)`,boxShadow:`0 4px 24px rgba(0,0,0,0.4)`},className:`fixed top-0 w-full z-50 flex items-center h-14 px-4 gap-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,H.jsx)(oo,{cut:8,borderColor:`rgba(244, 196, 48, 0.5)`,background:`rgba(27, 31, 44, 0.8)`,className:`relative w-10 h-10`,children:(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`span`,{className:`font-mono text-[11px] font-bold text-[var(--accent)] tracking-widest`,children:`WR`})})}),(0,H.jsxs)(`div`,{className:`hidden sm:flex flex-col leading-none`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[11px] font-bold text-[var(--text-primary)] tracking-[0.25em] uppercase`,children:`WR_CONSOLE`}),(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-[var(--text-muted)] tracking-[0.15em]`,children:[`// V`,`3.35.0`]})]})]}),l&&d?(0,H.jsx)(`nav`,{className:`flex items-center flex-1 justify-center`,children:(0,H.jsx)(mD,{segments:[{label:`Workspace`,onClick:v},{label:d?.slice(-12)??``}]})}):(0,H.jsxs)(`div`,{role:`tablist`,"aria-label":`Console sections`,ref:k,className:`flex items-center gap-1 flex-1 justify-center`,children:[(0,H.jsxs)(`button`,{role:`tab`,id:`tab-workspace`,"aria-selected":c===`workspace`,"aria-controls":`panel-workspace`,tabIndex:c===`workspace`?0:-1,onClick:()=>O(`workspace`,()=>void e({to:`/`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`workspace`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`workspace`?`tab-activating`:``].join(` `),style:c===`workspace`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Workspace`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-workflows`,"aria-selected":c===`workflows`,"aria-controls":`panel-workflows`,tabIndex:c===`workflows`?0:-1,onClick:()=>O(`workflows`,()=>void e({to:`/workflows`,search:{tag:void 0}})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`workflows`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`workflows`?`tab-activating`:``].join(` `),style:c===`workflows`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Workflows`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-auto`,"aria-selected":c===`auto`,"aria-controls":`panel-auto`,tabIndex:c===`auto`?0:-1,onClick:()=>O(`auto`,()=>void e({to:`/auto`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`auto`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`auto`?`tab-activating`:``].join(` `),style:c===`auto`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Auto`]}),(0,H.jsxs)(`button`,{role:`tab`,id:`tab-perf`,"aria-selected":c===`perf`,"aria-controls":`panel-perf`,tabIndex:c===`perf`?0:-1,onClick:()=>O(`perf`,()=>void e({to:`/perf`})),className:[`tab-btn px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.30em] transition-colors duration-150`,`focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:outline-none`,c===`perf`?`tab-btn--active text-[var(--accent)] text-glow-amber`:`text-[var(--text-secondary)] hover:text-[var(--text-primary)]`,E===`perf`?`tab-activating`:``].join(` `),style:c===`perf`?{backgroundColor:`rgba(244, 196, 48, 0.06)`}:void 0,children:[(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--tr`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--bl`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`tab-corner tab-corner--br`,"aria-hidden":`true`}),`Performance`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[g>0&&(0,H.jsx)($a,{label:`${Math.min(g,9)}${g>9?`+`:``} LIVE`,color:`var(--accent-strong)`,pulse:!0,role:`status`,"aria-label":`${g} live session${g===1?``:`s`}`}),_>0&&(0,H.jsx)($a,{label:`${Math.min(_,9)}${_>9?`+`:``} BLOCKED`,color:`var(--blocked)`,role:`status`,"aria-label":`${_} blocked session${_===1?``:`s`}`})]})]}),(0,H.jsxs)(`main`,{className:`p-6`,style:{paddingTop:`calc(56px + 1.5rem)`},children:[(0,H.jsxs)(`div`,{id:`panel-workspace`,role:`tabpanel`,"aria-labelledby":`tab-workspace`,hidden:c===`workflows`||c===`perf`||c===`auto`,children:[(0,H.jsx)(bo,{viewModel:m,sessionListViewModel:h,hidden:l}),l&&d&&(0,H.jsx)(cD,{viewModel:w})]}),c===`workflows`&&(0,H.jsx)(`div`,{id:`panel-workflows`,role:`tabpanel`,"aria-labelledby":`tab-workflows`,children:u&&f?(0,H.jsx)(hD,{viewModel:C}):(0,H.jsx)(jD,{viewModel:S})}),c===`auto`&&(0,H.jsx)(`div`,{id:`panel-auto`,role:`tabpanel`,"aria-labelledby":`tab-auto`,children:(0,H.jsx)(oO,{})}),c===`perf`&&(0,H.jsx)(`div`,{id:`panel-perf`,role:`tabpanel`,"aria-labelledby":`tab-perf`,children:(0,H.jsx)(qD,{viewModel:T})})]})]})}var YO=zi({component:JO}),XO=Li({getParentRoute:()=>YO,path:`/`,component:()=>null}),ZO=Li({getParentRoute:()=>YO,path:`/session/$sessionId`,component:()=>null}),QO=Li({getParentRoute:()=>YO,path:`/workflows`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),$O=Li({getParentRoute:()=>YO,path:`/workflows/$workflowId`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),ek=Li({getParentRoute:()=>YO,path:`/perf`,component:()=>null}),tk=Li({getParentRoute:()=>YO,path:`/auto`,component:()=>null}),nk=ea({routeTree:YO.addChildren([XO,ZO,QO,$O,ek,tk]),history:hr()}),rk=new Re({defaultOptions:{queries:{refetchInterval:5e3,staleTime:2e3}}});(0,aa.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(Ue,{client:rk,children:(0,H.jsx)(ra,{router:nk})})}));
|