@exaudeus/workrail 3.64.0 → 3.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console-ui/assets/{index-DGM664Gr.js → index-BynU38Vu.js} +9 -9
- package/dist/console-ui/assets/{index-DGj8EsFR.css → index-DHrKiMCf.css} +1 -1
- package/dist/console-ui/index.html +2 -2
- package/dist/manifest.json +44 -36
- package/dist/mcp/handlers/v2-advance-core/outcome-success.js +65 -0
- package/dist/mcp/handlers/v2-advance-events.d.ts +11 -0
- package/dist/mcp/handlers/v2-advance-events.js +19 -0
- package/dist/mcp/output-schemas.d.ts +4 -4
- package/dist/types/workflow-definition.d.ts +1 -0
- package/dist/v2/durable-core/constants.d.ts +1 -0
- package/dist/v2/durable-core/constants.js +1 -0
- package/dist/v2/durable-core/domain/prompt-renderer.d.ts +1 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +40 -0
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +294 -0
- package/dist/v2/durable-core/schemas/session/events.d.ts +90 -0
- package/dist/v2/durable-core/schemas/session/events.js +16 -0
- package/dist/v2/projections/session-metrics.d.ts +15 -0
- package/dist/v2/projections/session-metrics.js +102 -0
- package/dist/v2/usecases/console-routes.js +59 -0
- package/dist/v2/usecases/console-service.js +18 -4
- package/dist/v2/usecases/console-types.d.ts +5 -0
- package/docs/authoring-v2.md +30 -7
- package/docs/authoring.md +28 -0
- package/package.json +1 -1
- package/spec/authoring-spec.json +37 -0
- package/spec/workflow.schema.json +5 -0
- package/workflows/adaptive-ticket-creation.json +2 -1
- package/workflows/architecture-scalability-audit.json +1 -0
- package/workflows/bug-investigation.agentic.v2.json +1 -0
- package/workflows/classify-task-workflow.json +1 -0
- package/workflows/coding-task-workflow-agentic.json +1 -0
- package/workflows/cross-platform-code-conversion.v2.json +8 -7
- package/workflows/document-creation-workflow.json +2 -1
- package/workflows/documentation-update-workflow.json +2 -1
- package/workflows/intelligent-test-case-generation.json +2 -1
- package/workflows/learner-centered-course-workflow.json +2 -1
- package/workflows/mr-review-workflow.agentic.v2.json +1 -0
- package/workflows/personal-learning-materials-creation-branched.json +1 -0
- package/workflows/presentation-creation.json +2 -1
- package/workflows/production-readiness-audit.json +1 -0
- package/workflows/relocation-workflow-us.json +1 -0
- package/workflows/routines/context-gathering.json +2 -1
- package/workflows/routines/design-review.json +1 -0
- package/workflows/routines/execution-simulation.json +2 -1
- package/workflows/routines/feature-implementation.json +4 -3
- package/workflows/routines/final-verification.json +1 -0
- package/workflows/routines/hypothesis-challenge.json +13 -3
- package/workflows/routines/ideation.json +1 -1
- package/workflows/routines/parallel-work-partitioning.json +1 -0
- package/workflows/routines/philosophy-alignment.json +2 -1
- package/workflows/routines/plan-analysis.json +2 -1
- package/workflows/routines/plan-generation.json +2 -1
- package/workflows/routines/tension-driven-design.json +1 -0
- package/workflows/scoped-documentation-workflow.json +2 -1
- package/workflows/test-artifact-loop-control.json +8 -2
- package/workflows/test-session-persistence.json +1 -0
- package/workflows/ui-ux-design-workflow.json +1 -0
- package/workflows/workflow-diagnose-environment.json +1 -0
- package/workflows/workflow-for-workflows.json +1 -0
- package/workflows/workflow-for-workflows.v2.json +28 -0
- package/workflows/wr.discovery.json +1 -0
- package/workflows/wr.shaping.json +21 -6
|
@@ -12,17 +12,17 @@ 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??Zh,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)&&Ap(e))return!1;let n=eg(e.code,s);if(a.current.add(e[n]),$h(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=eg(e.code,s);$h(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 $h(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function eg(e,t){return t.includes(e)?`code`:`key`}var tg=()=>{let e=wh();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=_p(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 fp(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=pp(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function ng(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)rg(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 rg(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 ig(e,t){return ng(e,t)}function ag(e,t){return ng(e,t)}function og(e,t){return{id:e,type:`select`,selected:t}}function sg(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(og(a.id,e)))}return r}function cg({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 lg(e){return{id:e.id,type:`remove`}}var ug=e=>zf(e),dg=e=>Rf(e);function fg(e){return(0,V.forwardRef)(e)}function pg(e){let[t,n]=(0,V.useState)(BigInt(0)),[r]=(0,V.useState)(()=>mg(()=>n(e=>e+BigInt(1))));return Hh(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function mg(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var hg=(0,V.createContext)(null);function gg({children:e}){let t=wh(),n=pg((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=cg({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=pg((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(cg({items:s,lookup:o}))},[])),i=(0,V.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,H.jsx)(hg.Provider,{value:i,children:e})}function _g(){let e=(0,V.useContext)(hg);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var vg=e=>!!e.panZoom;function yg(){let e=tg(),t=wh(),n=_g(),r=X(vg),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=ug(e)?e:n.get(e.id),a=i.parentId?Sp(i.position,i.measured,i.parentId,n,r):i.position;return ip({...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&&ug(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&&dg(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 Yf({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(lg);o?.(f),c(e)}if(m){let e=d.map(lg);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=cp(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=ip(s?r:a),l=sp(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=cp(e)?e:a(e);if(!r)return!1;let i=sp(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 Hf(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??wp();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 bg=e=>e.selected,xg=typeof window<`u`?window:void 0;function Sg({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=wh(),{deleteElements:r}=yg(),i=Qh(e,{actInsideInputWithModifier:!1}),a=Qh(t,{target:xg});(0,V.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(bg),edges:e.filter(bg)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,V.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Cg(e){let t=wh();(0,V.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Dp(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Ef.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 wg={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Tg=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Eg({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=jf.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=wh(),S=(0,V.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=X(Tg,bh),E=Qh(f),D=(0,V.useRef)();Cg(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=Qm({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:wg,children:m})}var Dg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Og(){let{userSelectionActive:e,userSelectionRect:t}=X(Dg,bh);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 kg=(e,t)=>n=>{n.target===t.current&&e?.(n)},Ag=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function jg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Mf.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=wh(),{userSelectionActive:g,elementsSelectable:_,dragging:v,connectionInProgress:y}=X(Ag,bh),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:Go([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:v,selection:e}]),onClick:b?void 0:kg(E,x),onContextMenu:kg(D,x),onWheel:kg(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}=Mp(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(Wf(s,y,a,n===Mf.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)}}Cp(b,C.current)||u(sg(s,C.current,!0)),Cp(x,w.current)||d(sg(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}=Mp(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:wg,children:[m,(0,H.jsx)(Og,{})]})}function Mg({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`,Ef.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ng({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=wh(),[c,l]=(0,V.useState)(!1),u=(0,V.useRef)();return(0,V.useEffect)(()=>{u.current=Dm({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Mg({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 Pg=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Fg(){let e=wh();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=Pg(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=dp(t,i));let{position:a,positionAbsolute:s}=Jf({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 Ig=(0,V.createContext)(null),Lg=Ig.Provider;Ig.Consumer;var Rg=()=>(0,V.useContext)(Ig),zg=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Bg=(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===Af.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Vg({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=wh(),_=Rg(),{connectOnClick:v,noPanClassName:y,rfId:b}=X(zg,bh),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=X(Bg(_,m,e),bh);_||g.getState().onError?.(`010`,Ef.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(Up(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=jp(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Lm.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:Go([`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=Op(t.target),h=n||c,{connection:v,isValid:y}=Lm.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 Hg=(0,V.memo)(fg(Vg));function Ug({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return(0,H.jsxs)(H.Fragment,{children:[e?.label,(0,H.jsx)(Hg,{type:`source`,position:n,isConnectable:t})]})}function Wg({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:r=Y.Bottom}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Hg,{type:`target`,position:n,isConnectable:t}),e?.label,(0,H.jsx)(Hg,{type:`source`,position:r,isConnectable:t})]})}function Gg(){return null}function Kg({data:e,isConnectable:t,targetPosition:n=Y.Top}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Hg,{type:`target`,position:n,isConnectable:t}),e?.label]})}var qg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Jg={input:Ug,default:Wg,output:Kg,group:Gg};function Yg(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 Xg=e=>{let{width:t,height:n,x:r,y:i}=Uf(e.nodeLookup,{filter:e=>!!e.selected});return{width:lp(t)?t:null,height:lp(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 Zg({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=wh(),{width:i,height:a,transformString:o,userSelectionActive:s}=X(Xg,bh),c=Fg(),l=(0,V.useRef)(null);(0,V.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ng({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:Go([`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(qg,e.key)&&(e.preventDefault(),c({direction:qg[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Qg=typeof window<`u`?window:void 0,$g=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function e_({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($g,bh),L=Qh(l,{target:Qg}),te=Qh(h,{target:Qg}),ne=te||w,R=te||b,z=u&&ne!==!0,B=L||I||z;return Sg({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,H.jsx)(Eg,{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)(jg,{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)(Zg,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}e_.displayName=`FlowRenderer`;var t_=(0,V.memo)(e_),n_=e=>t=>e?Wf(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 r_(e){return X((0,V.useCallback)(n_(e),[e]),bh)}var i_=e=>e.updateNodeInternals;function a_(){let e=X(i_),[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 o_({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=wh(),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 s_({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}},bh),S=y.type||`default`,C=g?.[S]||Jg[S];C===void 0&&(v?.(`003`,Ef.error003(S)),S=`default`,C=g?.default||Jg.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=wh(),k=xp(y),A=o_({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Ng({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Fg();if(y.hidden)return null;let N=bp(y),P=Yg(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)&&Mg({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},z=t=>{if(!(Ap(t.nativeEvent)||m)){if(Of.includes(t.key)&&T)Mg({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(qg,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:qg[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&&(Wf(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:Go([`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:`${Dh}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,H.jsx)(Lg,{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 c_=(0,V.memo)(s_),l_=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function u_(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=X(l_,bh),o=r_(e.onlyRenderVisibleElements),s=a_();return(0,H.jsx)(`div`,{className:`react-flow__nodes`,style:wg,children:o.map(o=>(0,H.jsx)(c_,{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))})}u_.displayName=`NodeRenderer`;var d_=(0,V.memo)(u_);function f_(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&&Bp({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),bh)}var p_=({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`}),m_=({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`}),h_={[Ff.Arrow]:p_,[Ff.ArrowClosed]:m_};function g_(e){let t=wh();return(0,V.useMemo)(()=>Object.prototype.hasOwnProperty.call(h_,e)?h_[e]:(t.getState().onError?.(`009`,Ef.error009(e)),null),[e])}var __=({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=g_(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},v_=({defaultColor:e,rfId:t})=>{let n=X(e=>e.edges),r=X(e=>e.defaultEdgeOptions),i=(0,V.useMemo)(()=>rm(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)(__,{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};v_.displayName=`MarkerDefinitions`;var y_=(0,V.memo)(v_);function b_({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=Go([`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}b_.displayName=`EdgeText`;var x_=(0,V.memo)(b_);function S_({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:Go([`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&&lp(t)&&lp(n)?(0,H.jsx)(x_,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function C_({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 w_({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:i,targetPosition:a=Y.Top}){let[o,s]=C_({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=C_({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Pp({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 T_(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]=w_({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,H.jsx)(S_,{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 E_=T_({isInternal:!1}),D_=T_({isInternal:!0});E_.displayName=`SimpleBezierEdge`,D_.displayName=`SimpleBezierEdgeInternal`;function O_(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]=Xp({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,H.jsx)(S_,{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 k_=O_({isInternal:!1}),A_=O_({isInternal:!0});k_.displayName=`SmoothStepEdge`,A_.displayName=`SmoothStepEdgeInternal`;function j_(e){return(0,V.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,H.jsx)(k_,{...n,id:r,pathOptions:(0,V.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var M_=j_({isInternal:!1}),N_=j_({isInternal:!0});M_.displayName=`StepEdge`,N_.displayName=`StepEdgeInternal`;function P_(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]=Wp({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,H.jsx)(S_,{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 F_=P_({isInternal:!1}),I_=P_({isInternal:!0});F_.displayName=`StraightEdge`,I_.displayName=`StraightEdgeInternal`;function L_(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]=Lp({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,H.jsx)(S_,{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 R_=L_({isInternal:!1}),z_=L_({isInternal:!0});R_.displayName=`BezierEdge`,z_.displayName=`BezierEdgeInternal`;var B_={default:z_,straight:I_,step:N_,smoothstep:A_,simplebezier:D_},V_={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},H_=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,U_=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,W_=`react-flow__edgeupdater`;function G_({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:Go([W_,`${W_}-${s}`]),cx:H_(t,r,e),cy:U_(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function K_({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=wh(),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`;Lm.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)(G_,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,H.jsx)(G_,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function q_({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]||B_[x];S===void 0&&(_?.(`011`,Ef.error011(x)),x=`default`,S=h?.default||B_.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=wh(),{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,...V_};let i=Qp({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:zp({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||V_}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),bh),te=(0,V.useMemo)(()=>y.markerStart?`url('#${nm(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,V.useMemo)(()=>y.markerEnd?`url('#${nm(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:Go([`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&&Of.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?`${Oh}-${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)(K_,{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 J_=(0,V.memo)(q_),Y_=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function X_({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(Y_,bh),b=f_(t);return(0,H.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,H.jsx)(y_,{defaultColor:e,rfId:n}),b.map(e=>(0,H.jsx)(J_,{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))]})}X_.displayName=`EdgeRenderer`;var Z_=(0,V.memo)(X_),Q_=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $_({children:e}){return(0,H.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:X(Q_)},children:e})}function ev(e){let t=yg(),n=(0,V.useRef)(!1);(0,V.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var tv=e=>e.panZoom?.syncViewport;function nv(e){let t=X(tv),n=wh();return(0,V.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function rv(e){return e.connection.inProgress?{...e.connection,to:fp(e.connection.to,e.transform)}:{...e.connection}}function iv(e){return e?t=>e(rv(t)):rv}function av(e){return X(iv(e),bh)}var ov=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function sv({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=X(ov,bh);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:Go([`react-flow__connection`,Lf(s)]),children:(0,H.jsx)(cv,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var cv=({style:e,type:t=Pf.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}=av();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:Lf(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 Pf.Bezier:[m]=Lp(h);break;case Pf.SimpleBezier:[m]=w_(h);break;case Pf.Step:[m]=Xp({...h,borderRadius:0});break;case Pf.SmoothStep:[m]=Xp(h);break;default:[m]=Wp(h)}return(0,H.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};cv.displayName=`ConnectionLine`;var lv={};function uv(e=lv){(0,V.useRef)(e),wh(),(0,V.useEffect)(()=>{},[e])}function dv(){wh(),(0,V.useRef)(!1),(0,V.useEffect)(()=>{},[])}function fv({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 uv(e),uv(t),dv(),ev(n),nv(xe),(0,H.jsx)(t_,{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)($_,{children:[(0,H.jsx)(Z_,{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)(sv,{style:h,type:m,component:g,containerStyle:_}),(0,H.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,H.jsx)(d_,{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`})]})})}fv.displayName=`GraphView`;var pv=(0,V.memo)(fv),mv=({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??Df;xm(h,g,_);let{nodesInitialized:x}=fm(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=_p(Uf(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:Df,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Af.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:{...Nf},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:up,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:kf,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},hv=({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})=>yh((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 qf({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...mv({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}=fm(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();xm(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}=vm(e,n,r,i,a,o,l);d&&(lm(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=em(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=_m(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(ig(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(ag(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=>og(e,!0)));return}i(sg(r,new Set([...e]),!0)),a(sg(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>og(e,!0)));return}a(sg(n,new Set([...e]))),i(sg(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(og(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(og(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,og(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,og(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]||(fm(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 ym({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:{...Nf}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...mv()})}},Object.is);function gv({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)(()=>hv({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)(Sh,{value:m,children:(0,H.jsx)(gg,{children:p})})}function _v({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)(xh)?(0,H.jsx)(H.Fragment,{children:e}):(0,H.jsx)(gv,{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 vv={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function yv({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=Pf.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:R,deleteKeyCode:z=`Backspace`,selectionKeyCode:B=`Shift`,selectionOnDrag:re=!1,selectionMode:ie=Mf.Full,panActivationKeyCode:ae=`Space`,multiSelectionKeyCode:oe=vp()?`Meta`:`Control`,zoomActivationKeyCode:se=vp()?`Meta`:`Control`,snapToGrid:ce,snapGrid:le,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:de,nodesDraggable:fe,autoPanOnNodeFocus:pe,nodesConnectable:me,nodesFocusable:he,nodeOrigin:ge=Uh,edgesFocusable:_e,edgesReconnectable:ve,elementsSelectable:ye=!0,defaultViewport:be=Wh,minZoom:xe=.5,maxZoom:Se=2,translateExtent:Ce=Df,preventScrolling:we=!0,nodeExtent:Te,defaultMarkerColor:Ee=`#b1b1b7`,zoomOnScroll:De=!0,zoomOnPinch:Oe=!0,panOnScroll:ke=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:je=jf.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=Xh(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,...vv},ref:Mt,className:Go([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,H.jsxs)(_v,{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)(Jh,{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)(pv,{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)(Vh,{onSelectionChange:k}),He,(0,H.jsx)(Fh,{proOptions:st,position:ot}),(0,H.jsx)(Nh,{rfId:Nt,disableKeyboardA11y:dt})]})})}var bv=fg(yv);Ef.error014();function xv({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:Go([`react-flow__background-pattern`,n,r])})}function Sv({radius:e,className:t}){return(0,H.jsx)(`circle`,{cx:e,cy:e,r:e,className:Go([`react-flow__background-pattern`,`dots`,t])})}var Cv;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(Cv||={});var wv={[Cv.Dots]:1,[Cv.Lines]:1,[Cv.Cross]:6},Tv=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ev({id:e,variant:t=Cv.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(Tv,bh),m=r||wv[t],h=t===Cv.Dots,g=t===Cv.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:Go([`react-flow__background`,l]),style:{...c,...wg,"--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)(Sv,{radius:y/2,className:u}):(0,H.jsx)(xv,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,H.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Ev.displayName=`Background`,(0,V.memo)(Ev);function Dv(){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 Ov(){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 kv(){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 Av(){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 jv(){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 Mv({children:e,className:t,...n}){return(0,H.jsx)(`button`,{type:`button`,className:Go([`react-flow__controls-button`,t]),...n,children:e})}var Nv=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Pv({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=wh(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=X(Nv,bh),{zoomIn:y,zoomOut:b,fitView:x}=yg();return(0,H.jsxs)(Ph,{className:Go([`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)(Mv,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,H.jsx)(Dv,{})}),(0,H.jsx)(Mv,{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)(Ov,{})})]}),n&&(0,H.jsx)(Mv,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,H.jsx)(kv,{})}),r&&(0,H.jsx)(Mv,{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)(jv,{}):(0,H.jsx)(Av,{})}),u]})}Pv.displayName=`Controls`,(0,V.memo)(Pv);function Fv({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:Go([`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 Iv=(0,V.memo)(Fv),Lv=e=>e.nodes.map(e=>e.id),Rv=e=>e instanceof Function?e:()=>e;function zv({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Iv,onClick:o}){let s=X(Lv,bh),c=Rv(t),l=Rv(e),u=Rv(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,H.jsx)(H.Fragment,{children:s.map(e=>(0,H.jsx)(Vv,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Bv({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}=bp(r);return{node:r,x:i,y:a,width:o,height:s}},bh);return!l||l.hidden||!xp(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 Vv=(0,V.memo)(Bv),Hv=(0,V.memo)(zv),Uv=200,Wv=150,Gv=e=>!e.hidden,Kv=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?op(Uf(e.nodeLookup,{filter:Gv}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},qv=`react-flow__minimap-desc`;function Jv({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=wh(),S=(0,V.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=X(Kv,bh),j=e?.width??Uv,M=e?.height??Wv,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=`${qv}-${T}`,re=(0,V.useRef)(0),ie=(0,V.useRef)();re.current=ee,(0,V.useEffect)(()=>{if(S.current&&E)return ie.current=Rm({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)(Ph,{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:Go([`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)(Hv,{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`})]})})}Jv.displayName=`MiniMap`,(0,V.memo)(Jv);var Yv=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Xv={[$m.Line]:`right`,[$m.Handle]:`bottom-right`};function Zv({nodeId:e,position:t,variant:n=$m.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=Rg(),y=typeof e==`string`?e:v,b=wh(),x=(0,V.useRef)(null),S=n===$m.Handle,C=X((0,V.useCallback)(Yv(S&&p),[S,p]),bh),w=(0,V.useRef)(null),T=t??Xv[n];return(0,V.useEffect)(()=>{if(!(!x.current||!y))return w.current||=dh({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=_m([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Sp({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:Go([`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)(Zv);function Qv(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=$v(e),i=r?ey(r,t):new Set,a=ty(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=ry(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?ny(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 $v(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 ey(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 ty(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 ny(e){return e.slice(-8)}function ry(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 iy(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 ay(e){return/\btrue\b|\bpass/i.test(e.summary)}function oy(e){return e.refs.find(e=>e.kind===`loop_id`)?.value??null}function sy(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=oy(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=oy(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 cy(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 ly(e,t){let n=null,r=-1;for(let i of t){let t=cy(i);t!==null&&(i.recordedAtEventIndex>e.createdAtEventIndex||i.recordedAtEventIndex>r&&(r=i.recordedAtEventIndex,n={kind:t,summary:i.summary}))}return n}function uy(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 dy(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 fy({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)(()=>Qv(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=dy(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=by(r,i,a,o),l=vy(r,i),u=Ey(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)(py,{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=ly(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?uy(sy(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:iy(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)(hy,{label:`Current`,value:d.summary.currentNodeLabel,emphasis:!0}),(0,H.jsx)(hy,{label:`Status`,value:Ty(e.status)}),(0,H.jsx)(hy,{label:`Active lineage`,value:`${d.summary.lineageNodeCount} nodes`}),(0,H.jsx)(hy,{label:`Alternate branches`,value:`${d.summary.alternateBranchCount}`}),(0,H.jsx)(hy,{label:`Historical nodes`,value:`${d.summary.sideNodeCount}`}),(0,H.jsx)(hy,{label:`Blocked attempts`,value:`${d.summary.blockedAttemptCount}`}),(0,H.jsx)(hy,{label:`Critical gaps`,value:e.hasUnresolvedCriticalGaps?`Present`:`None`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(gy,{onClick:()=>m(d.startNodeId),children:`Start`}),(0,H.jsx)(gy,{onClick:()=>m(d.currentNodeId),children:`Current`}),(0,H.jsx)(gy,{onClick:()=>m(d.latestBranchNodeId),children:`Latest branch`})]})]}),(0,H.jsx)(my,{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:Wo(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)(bv,{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)(Ay,{x:e.x,y:e.y,cause:e.cause,onMouseEnter:w,onMouseLeave:T},e.edgeKey)),y&&y.map(e=>(0,H.jsx)(Oy,{topY:e.topY,bottomY:e.bottomY,gutterX:e.gutterX,iterationCount:e.iterationCount},e.key)),b&&b.nodes.map(e=>(0,H.jsx)(jy,{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 py({node:e,isActiveLineage:t,isCurrent:n,isSelected:r,isLiveRun:i,branchKind:a,branchIndex:o,displayLabel:s,stepNumber:c,totalSteps:l,causeItems:u}){let d=Sy(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)(Uo,{color:yy(a,t),children:wy(e.nodeKind,a,o)}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[r&&(0,H.jsx)(Uo,{color:`var(--warning)`,children:`Selected`}),n&&(0,H.jsx)(Uo,{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)(Uo,{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)(Uo,{className:`shrink-0`,color:e.isPreferredTip?`var(--warning)`:`var(--text-muted)`,children:e.isPreferredTip?`Preferred tip`:`Tip`}):(0,H.jsx)(Uo,{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 my({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)(Uo,{children:`Lineage rail`}),i.map(e=>(0,H.jsx)(_y,{label:e.node.stepLabel??ny(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)(_y,{label:Ey(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 hy({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)(Uo,{children:e}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-[var(--text-primary)]`,children:t})]})}function gy({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 _y({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:Dy(e)})}function vy(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 yy(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 by(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 xy=[{test:e=>e.hasFailedValidations,color:`var(--error)`},{test:e=>e.hasGaps,color:`var(--warning)`},{test:e=>e.hasRecap||e.hasArtifacts,color:`var(--accent)`}];function Sy(e){return xy.find(t=>t.test(e))?.color??null}function Cy(e){switch(e){case`blocked_attempt`:return`Blocked`;case`checkpoint`:return`Checkpoint`;case`step`:return`Step`}}function wy(e,t,n){return t===`blocked`?n?`Blocked branch ${n}`:`Blocked branch`:t===`alternate`?n?`Alt branch ${n}`:`Alt branch`:Cy(e)}function Ty(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 Ey(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`:ny(e.nodeId)}function Dy(e){return e.length>18?`${e.slice(0,18)}…`:e}function Oy({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)(Uo,{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)(Uo,{color:`var(--accent)`,style:{fontSize:9},children:`[ // ${r}x ]`})})]})}var ky={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 Ay({x:e,y:t,cause:n,onMouseEnter:r,onMouseLeave:i}){let a=ky[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 jy({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)(Uo,{color:`rgba(123, 141, 167, 0.70)`,children:`Skipped`}),(0,H.jsx)(Uo,{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)(Uo,{color:`rgba(123, 141, 167, 0.45)`,className:`text-[11px]`,children:`not executed`})})]})}function My({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 Ny(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 ay(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 Py({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=Ny(e);return(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-xs text-[var(--text-muted)]`,children:[(0,H.jsx)(My,{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 Fy({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 Iy({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:Wo(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 Ly=80;function Ry({summary:e,runStatus:t}){let n=sy(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<=Ly),t<=Ly&&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)(Iy,{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)(Py,{group:e},e.enteredItem.recordedAtEventIndex);let{item:t}=e,n=Ny(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)(My,{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)(Fy,{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 zy(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 By=class extends Error{constructor(e,t){super(`HTTP ${e}: ${t}`),this.status=e,this.name=`HttpError`}};async function Vy(e){let t=await fetch(e);if(!t.ok)throw new By(t.status,t.statusText);let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Unknown error`);return n.data}function Hy(){return rt({queryKey:[`sessions`],queryFn:()=>Vy(`/api/v2/sessions`),refetchInterval:3e4,staleTime:25e3})}function Uy(e){return rt({queryKey:[`session`,e],queryFn:()=>Vy(`/api/v2/sessions/${e}`),enabled:!!e,refetchInterval:5e3,refetchIntervalInBackground:!1,staleTime:3e3})}function Wy(e,t){return rt({queryKey:[`node`,e,t],queryFn:()=>Vy(`/api/v2/sessions/${e}/nodes/${t}`),enabled:!!t})}function Gy(){return rt({queryKey:[`worktrees`],queryFn:()=>Vy(`/api/v2/worktrees`),refetchInterval:3e4,staleTime:2e4})}function Ky(){return rt({queryKey:[`workflows`],queryFn:()=>Vy(`/api/v2/workflows`),staleTime:1/0,refetchInterval:!1})}function qy(){let e=rt({queryKey:[`perf`,`tool-calls`],queryFn:async()=>{try{return await Vy(`/api/v2/perf/tool-calls`)}catch(e){if(e instanceof By&&e.status===404)return null;throw e}},refetchInterval:5e3,staleTime:3e3,refetchIntervalInBackground:!1});return zy(e,()=>void e.refetch())}function Jy(e){return rt({queryKey:[`workflow`,e],queryFn:()=>Vy(`/api/v2/workflows/${e}`),enabled:e!==null,staleTime:1/0,refetchInterval:!1})}function Yy(){return rt({queryKey:[`triggers`],queryFn:async()=>{try{return await Vy(`/api/v2/triggers`)}catch(e){if(e instanceof By&&e.status===503)return{triggers:[]};throw e}},staleTime:3e4,refetchInterval:6e4})}async function Xy(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 By(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 Zy(){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 Qy(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var $y=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tb={};function nb(e,t){return((t||tb).jsx?eb:$y).test(e)}var rb=/[ \t\n\f\r]/g;function ib(e){return typeof e==`object`?e.type===`text`?ab(e.value):!1:ab(e)}function ab(e){return e.replace(rb,``)===``}var ob=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ob.prototype.normal={},ob.prototype.property={},ob.prototype.space=void 0;function sb(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ob(n,r,t)}function cb(e){return e.toLowerCase()}var lb=class{constructor(e,t){this.attribute=t,this.property=e}};lb.prototype.attribute=``,lb.prototype.booleanish=!1,lb.prototype.boolean=!1,lb.prototype.commaOrSpaceSeparated=!1,lb.prototype.commaSeparated=!1,lb.prototype.defined=!1,lb.prototype.mustUseProperty=!1,lb.prototype.number=!1,lb.prototype.overloadedBoolean=!1,lb.prototype.property=``,lb.prototype.spaceSeparated=!1,lb.prototype.space=void 0;var ub=s({boolean:()=>Z,booleanish:()=>fb,commaOrSpaceSeparated:()=>gb,commaSeparated:()=>hb,number:()=>Q,overloadedBoolean:()=>pb,spaceSeparated:()=>mb}),db=0,Z=_b(),fb=_b(),pb=_b(),Q=_b(),mb=_b(),hb=_b(),gb=_b();function _b(){return 2**++db}var vb=Object.keys(ub),yb=class extends lb{constructor(e,t,n,r){let i=-1;if(super(e,t),bb(this,`space`,r),typeof n==`number`)for(;++i<vb.length;){let e=vb[i];bb(this,vb[i],(n&ub[e])===ub[e])}}};yb.prototype.defined=!0;function bb(e,t,n){n&&(e[t]=n)}function xb(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new yb(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[cb(r)]=r,n[cb(a.attribute)]=r}return new ob(t,n,e.space)}var Sb=xb({properties:{ariaActiveDescendant:null,ariaAtomic:fb,ariaAutoComplete:null,ariaBusy:fb,ariaChecked:fb,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:mb,ariaCurrent:null,ariaDescribedBy:mb,ariaDetails:null,ariaDisabled:fb,ariaDropEffect:mb,ariaErrorMessage:null,ariaExpanded:fb,ariaFlowTo:mb,ariaGrabbed:fb,ariaHasPopup:null,ariaHidden:fb,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mb,ariaLevel:Q,ariaLive:null,ariaModal:fb,ariaMultiLine:fb,ariaMultiSelectable:fb,ariaOrientation:null,ariaOwns:mb,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:fb,ariaReadOnly:fb,ariaRelevant:null,ariaRequired:fb,ariaRoleDescription:mb,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:fb,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 Cb(e,t){return t in e?e[t]:t}function wb(e,t){return Cb(e,t.toLowerCase())}var Tb=xb({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:hb,acceptCharset:mb,accessKey:mb,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:mb,autoFocus:Z,autoPlay:Z,blocking:mb,capture:null,charSet:null,checked:Z,cite:null,className:mb,cols:Q,colSpan:null,content:null,contentEditable:fb,controls:Z,controlsList:mb,coords:Q|hb,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:pb,draggable:fb,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:mb,height:Q,hidden:pb,high:Q,href:null,hrefLang:null,htmlFor:mb,httpEquiv:mb,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:mb,itemRef:mb,itemScope:Z,itemType:mb,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:mb,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:mb,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:mb,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:fb,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:fb,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mb,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:fb,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:wb}),Eb=xb({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:gb,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:mb,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:hb,g2:hb,glyphName:hb,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:gb,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:mb,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gb,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gb,rev:gb,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gb,requiredFeatures:gb,requiredFonts:gb,requiredFormats:gb,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:gb,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:gb,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:gb,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:Cb}),Db=xb({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()}}),Ob=xb({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:wb}),kb=xb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ab={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`},jb=/[A-Z]/g,Mb=/-[a-z]/g,Nb=/^data[-\w.:]+$/i;function Pb(e,t){let n=cb(t),r=t,i=lb;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Nb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Mb,Ib);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Mb.test(e)){let n=e.replace(jb,Fb);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=yb}return new i(r,t)}function Fb(e){return`-`+e.toLowerCase()}function Ib(e){return e.charAt(1).toUpperCase()}var Lb=sb([Sb,Tb,Db,Ob,kb],`html`),Rb=sb([Sb,Eb,Db,Ob,kb],`svg`);function zb(e){return e.join(` `).trim()}var Bb=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
|
-
`,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})),Vb=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(Bb());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}})),Hb=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))}})),Ub=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Vb()),r=Hb();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})),Wb=Kb(`end`),Gb=Kb(`start`);function Kb(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 qb(e){let t=Gb(e),n=Wb(e);if(t&&n)return{start:t,end:n}}function Jb(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Xb(e.position):`start`in e||`end`in e?Xb(e):`line`in e||`column`in e?Yb(e):``}function Yb(e){return Zb(e&&e.line)+`:`+Zb(e&&e.column)}function Xb(e){return Yb(e&&e.start)+`-`+Yb(e&&e.end)}function Zb(e){return e&&typeof e==`number`?e:1}var Qb=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=Jb(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}};Qb.prototype.file=``,Qb.prototype.name=``,Qb.prototype.reason=``,Qb.prototype.message=``,Qb.prototype.stack=``,Qb.prototype.column=void 0,Qb.prototype.line=void 0,Qb.prototype.ancestors=void 0,Qb.prototype.cause=void 0,Qb.prototype.fatal=void 0,Qb.prototype.place=void 0,Qb.prototype.ruleId=void 0,Qb.prototype.source=void 0;var $b=l(Ub(),1),ex={}.hasOwnProperty,tx=new Map,nx=/[A-Z]/g,rx=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ix=new Set([`td`,`th`]),ax=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function ox(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=_x(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=gx(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`?Rb:Lb,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=sx(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function sx(e,t,n){if(t.type===`element`)return cx(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return lx(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return dx(e,t,n);if(t.type===`mdxjsEsm`)return ux(e,t);if(t.type===`root`)return fx(e,t,n);if(t.type===`text`)return px(e,t)}function cx(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Rb,e.schema=i),e.ancestors.push(t);let a=Cx(e,t.tagName,!1),o=vx(e,t),s=bx(e,t);return rx.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ib(e):!0})),mx(e,o,a,t),hx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function lx(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)}wx(e,t.position)}function ux(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wx(e,t.position)}function dx(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Rb,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Cx(e,t.name,!0),o=yx(e,t),s=bx(e,t);return mx(e,o,a,t),hx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function fx(e,t,n){let r={};return hx(r,bx(e,t)),e.create(t,e.Fragment,r,n)}function px(e,t){return t.value}function mx(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function hx(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function gx(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 _x(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Gb(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 vx(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&ex.call(t.properties,i)){let a=xx(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ix.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 yx(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 wx(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 wx(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function bx(e,t){let n=[],r=-1,i=e.passKeys?new Map:tx;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=sx(e,a,o);s!==void 0&&n.push(s)}return n}function xx(e,t,n){let r=Pb(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Qy(n):zb(n)),r.property===`style`){let t=typeof n==`object`?n:Sx(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Tx(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Ab[r.property]||r.property:r.attribute,n]}}function Sx(e,t){try{return(0,$b.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Qb("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=ax+`#cannot-parse-style-attribute`,r}}function Cx(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=nb(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=nb(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return ex.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);wx(e)}function wx(e,t){let n=new Qb("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=ax+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Tx(e){let t={},n;for(n in e)ex.call(e,n)&&(t[Ex(n)]=e[n]);return t}function Ex(e){let t=e.replace(nx,Dx);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Dx(e){return`-`+e.toLowerCase()}var Ox={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`]},kx={};function Ax(e,t){let n=t||kx;return jx(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function jx(e,t,n){if(Nx(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 Mx(e.children,t,n)}return Array.isArray(e)?Mx(e,t,n):``}function Mx(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=jx(e[i],t,n);return r.join(``)}function Nx(e){return!!(e&&typeof e==`object`)}var Px=document.createElement(`i`);function Fx(e){let t=`&`+e+`;`;Px.innerHTML=t;let n=Px.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Ix(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 Lx(e,t){return e.length>0?(Ix(e,e.length,0,t),e):t}var Rx={}.hasOwnProperty;function zx(e){let t={},n=-1;for(;++n<e.length;)Bx(t,e[n]);return t}function Bx(e,t){let n;for(n in t){let r=(Rx.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Rx.call(r,a)||(r[a]=[]);let e=i[a];Vx(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Vx(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ix(e,0,0,r)}function Hx(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 Ux(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Wx=tS(/[A-Za-z]/),Gx=tS(/[\dA-Za-z]/),Kx=tS(/[#-'*+\--9=?A-Z^-~]/);function qx(e){return e!==null&&(e<32||e===127)}var Jx=tS(/\d/),Yx=tS(/[\dA-Fa-f]/),Xx=tS(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function Zx(e){return e!==null&&(e<0||e===32)}function Qx(e){return e===-2||e===-1||e===32}var $x=tS(/\p{P}|\p{S}/u),eS=tS(/\s/);function tS(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function nS(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Gx(e.charCodeAt(n+1))&&Gx(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 rS(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Qx(r)?(e.enter(n),s(r)):t(r)}function s(r){return Qx(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var iS={tokenize:aS};function aS(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`),rS(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 oS={tokenize:cS},sS={tokenize:lS};function cS(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 Ix(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(sS,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(sS,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++;Ix(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 lS(e,t,n){return rS(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function uS(e){if(e===null||Zx(e)||eS(e))return 1;if($x(e))return 2}function dS(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 fS={name:`attention`,resolveAll:pS,tokenize:mS};function pS(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};hS(d,-c),hS(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=Lx(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Lx(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Lx(l,dS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Lx(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=Lx(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ix(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 mS(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=uS(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=uS(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 hS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var gS={name:`autolink`,tokenize:_S};function _S(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 Wx(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Gx(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||Gx(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||qx(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Kx(t)?(e.consume(t),l):n(t)}function u(e){return Gx(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||Gx(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var vS={partial:!0,tokenize:yS};function yS(e,t,n){return r;function r(t){return Qx(t)?rS(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var bS={continuation:{tokenize:SS},exit:CS,name:`blockQuote`,tokenize:xS};function xS(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 Qx(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function SS(e,t,n){let r=this;return i;function i(t){return Qx(t)?rS(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(bS,t,n)(r)}}function CS(e){e.exit(`blockQuote`)}var wS={name:`characterEscape`,tokenize:TS};function TS(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 Xx(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var ES={name:`characterReference`,tokenize:DS};function DS(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=Gx,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=Yx,u):(e.enter(`characterReferenceValue`),a=7,o=Jx,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Gx&&!Fx(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 OS={partial:!0,tokenize:jS},kS={concrete:!0,name:`codeFenced`,tokenize:AS};function AS(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`),Qx(t)?rS(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(OS,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)):Qx(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),rS(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&&Qx(t)?rS(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(OS,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`),Qx(t)?rS(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`),Qx(t)?rS(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function jS(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 MS={name:`codeIndented`,tokenize:PS},NS={partial:!0,tokenize:FS};function PS(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),rS(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(NS,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 FS(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):rS(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 IS={name:`codeText`,previous:RS,resolve:LS,tokenize:zS};function LS(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 RS(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function zS(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 BS=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&&VS(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),VS(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),VS(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);VS(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);VS(this.left,t.reverse())}}};function VS(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 HS(e){let t={},n=-1,r,i,a,o,s,c,l,u=new BS(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,US(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 Ix(e,0,1/0,u.slice(0)),!l}function US(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 WS={resolve:KS,tokenize:qS},GS={partial:!0,tokenize:JS};function KS(e){return HS(e),e}function qS(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(GS,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 JS(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),rS(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 YS(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||qx(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||Zx(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||qx(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 XS(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||=!Qx(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ZS(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`),rS(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 QS(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Qx(i)?rS(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var $S={name:`definition`,tokenize:tC},eC={partial:!0,tokenize:nC};function tC(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return XS.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ux(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 Zx(t)?QS(e,l)(t):l(t)}function l(t){return YS(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(eC,d,d)(t)}function d(t){return Qx(t)?rS(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 nC(e,t,n){return r;function r(t){return Zx(t)?QS(e,i)(t):n(t)}function i(t){return ZS(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Qx(t)?rS(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var rC={name:`hardBreakEscape`,tokenize:iC};function iC(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 aC={name:`headingAtx`,resolve:oC,tokenize:sC};function oC(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`},Ix(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function sC(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||Zx(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)):Qx(n)?rS(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||Zx(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var cC=`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(`.`),lC=[`pre`,`script`,`style`,`textarea`],uC={concrete:!0,name:`htmlFlow`,resolveTo:pC,tokenize:mC},dC={partial:!0,tokenize:gC},fC={partial:!0,tokenize:hC};function pC(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 mC(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):Wx(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):Wx(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 Wx(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Zx(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&lC.includes(l)?(i=1,r.interrupt?t(s):O(s)):cC.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||Gx(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 Qx(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Wx(t)?(e.consume(t),b):Qx(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Gx(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Qx(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):Qx(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||Zx(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Qx(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):Qx(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(dC,L,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(fC,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 lC.includes(n)?(e.consume(t),I):O(t)}return Wx(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 hC(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 gC(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(vS,t,n)}}var _C={name:`htmlText`,tokenize:vC};function vC(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):Wx(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):Wx(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 Wx(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Gx(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,N(t)):Qx(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Gx(t)?(e.consume(t),w):t===47||t===62||Zx(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Wx(t)?(e.consume(t),E):$(t)?(o=T,N(t)):Qx(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Gx(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,N(t)):Qx(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)):Qx(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||Zx(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Zx(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 Qx(t)?rS(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 yC={name:`labelEnd`,resolveAll:CC,resolveTo:wC,tokenize:TC},bC={tokenize:EC},xC={tokenize:DC},SC={tokenize:OC};function CC(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&&Ix(e,0,e.length,n),e}function wC(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=Lx(s,e.slice(a+1,a+r+3)),s=Lx(s,[[`enter`,u,t]]),s=Lx(s,dS(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Lx(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Lx(s,e.slice(o+1)),s=Lx(s,[[`exit`,c,t]]),Ix(e,a,e.length,s),e}function TC(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(Ux(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(bC,u,o?u:d)(t):t===91?e.attempt(xC,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(SC,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function EC(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 Zx(t)?QS(e,a)(t):a(t)}function a(t){return t===41?u(t):YS(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Zx(t)?QS(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ZS(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Zx(t)?QS(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 DC(e,t,n){let r=this;return i;function i(t){return XS.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ux(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function OC(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 kC={name:`labelStartImage`,resolveAll:yC.resolveAll,tokenize:AC};function AC(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 jC={name:`labelStartLink`,resolveAll:yC.resolveAll,tokenize:MC};function MC(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 NC={name:`lineEnding`,tokenize:PC};function PC(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),rS(e,t,`linePrefix`)}}var FC={name:`thematicBreak`,tokenize:IC};function IC(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`),Qx(t)?rS(e,s,`whitespace`)(t):s(t))}}var LC={continuation:{tokenize:VC},exit:UC,name:`list`,tokenize:BC},RC={partial:!0,tokenize:WC},zC={partial:!0,tokenize:HC};function BC(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:Jx(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(FC,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 Jx(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(vS,r.interrupt?n:u,e.attempt(RC,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Qx(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 VC(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(vS,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,rS(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Qx(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(zC,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,rS(e,e.attempt(LC,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function HC(e,t,n){let r=this;return rS(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 UC(e){e.exit(this.containerState.type)}function WC(e,t,n){let r=this;return rS(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!Qx(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var GC={name:`setextUnderline`,resolveTo:KC,tokenize:qC};function KC(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 qC(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`),Qx(t)?rS(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var JC={tokenize:YC};function YC(e){let t=this,n=e.attempt(vS,r,e.attempt(this.parser.constructs.flowInitial,i,rS(e,e.attempt(this.parser.constructs.flow,i,e.attempt(WS,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 XC={resolveAll:ew()},ZC=$C(`string`),QC=$C(`text`);function $C(e){return{resolveAll:ew(e===`text`?tw: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 ew(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 tw(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 nw=s({attentionMarkers:()=>uw,contentInitial:()=>iw,disable:()=>dw,document:()=>rw,flow:()=>ow,flowInitial:()=>aw,insideSpan:()=>lw,string:()=>sw,text:()=>cw}),rw={42:LC,43:LC,45:LC,48:LC,49:LC,50:LC,51:LC,52:LC,53:LC,54:LC,55:LC,56:LC,57:LC,62:bS},iw={91:$S},aw={[-2]:MS,[-1]:MS,32:MS},ow={35:aC,42:FC,45:[GC,FC],60:uC,61:GC,95:FC,96:kS,126:kS},sw={38:ES,92:wS},cw={[-5]:NC,[-4]:NC,[-3]:NC,33:kC,38:ES,42:fS,60:[gS,_C],91:jC,92:[rC,wS],93:yC,95:fS,96:IS},lw={null:[fS,XC]},uw={null:[42,95]},dw={null:[]};function fw(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=Lx(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=dS(a,l.events,l),l.events):[]}function f(e,t){return mw(p(e),t)}function p(e){return pw(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&&Ix(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 pw(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 mw(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=`
|
|
15
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Jv.displayName=`MiniMap`,(0,V.memo)(Jv);var Yv=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Xv={[$m.Line]:`right`,[$m.Handle]:`bottom-right`};function Zv({nodeId:e,position:t,variant:n=$m.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=Rg(),y=typeof e==`string`?e:v,b=wh(),x=(0,V.useRef)(null),S=n===$m.Handle,C=X((0,V.useCallback)(Yv(S&&p),[S,p]),bh),w=(0,V.useRef)(null),T=t??Xv[n];return(0,V.useEffect)(()=>{if(!(!x.current||!y))return w.current||=dh({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=_m([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Sp({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:Go([`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)(Zv);function Qv(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=$v(e),i=r?ey(r,t):new Set,a=ty(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=ry(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?ny(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 $v(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 ey(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 ty(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 ny(e){return e.slice(-8)}function ry(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 iy(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 ay(e){return/\btrue\b|\bpass/i.test(e.summary)}function oy(e){return e.refs.find(e=>e.kind===`loop_id`)?.value??null}function sy(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=oy(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=oy(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 cy(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 ly(e,t){let n=null,r=-1;for(let i of t){let t=cy(i);t!==null&&(i.recordedAtEventIndex>e.createdAtEventIndex||i.recordedAtEventIndex>r&&(r=i.recordedAtEventIndex,n={kind:t,summary:i.summary}))}return n}function uy(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 dy(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 fy({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)(()=>Qv(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=dy(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=by(r,i,a,o),l=vy(r,i),u=Ey(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)(py,{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=ly(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?uy(sy(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:iy(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)(hy,{label:`Current`,value:d.summary.currentNodeLabel,emphasis:!0}),(0,H.jsx)(hy,{label:`Status`,value:Ty(e.status)}),(0,H.jsx)(hy,{label:`Active lineage`,value:`${d.summary.lineageNodeCount} nodes`}),(0,H.jsx)(hy,{label:`Alternate branches`,value:`${d.summary.alternateBranchCount}`}),(0,H.jsx)(hy,{label:`Historical nodes`,value:`${d.summary.sideNodeCount}`}),(0,H.jsx)(hy,{label:`Blocked attempts`,value:`${d.summary.blockedAttemptCount}`}),(0,H.jsx)(hy,{label:`Critical gaps`,value:e.hasUnresolvedCriticalGaps?`Present`:`None`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(gy,{onClick:()=>m(d.startNodeId),children:`Start`}),(0,H.jsx)(gy,{onClick:()=>m(d.currentNodeId),children:`Current`}),(0,H.jsx)(gy,{onClick:()=>m(d.latestBranchNodeId),children:`Latest branch`})]})]}),(0,H.jsx)(my,{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:Wo(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)(bv,{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)(Ay,{x:e.x,y:e.y,cause:e.cause,onMouseEnter:w,onMouseLeave:T},e.edgeKey)),y&&y.map(e=>(0,H.jsx)(Oy,{topY:e.topY,bottomY:e.bottomY,gutterX:e.gutterX,iterationCount:e.iterationCount},e.key)),b&&b.nodes.map(e=>(0,H.jsx)(jy,{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 py({node:e,isActiveLineage:t,isCurrent:n,isSelected:r,isLiveRun:i,branchKind:a,branchIndex:o,displayLabel:s,stepNumber:c,totalSteps:l,causeItems:u}){let d=Sy(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)(Uo,{color:yy(a,t),children:wy(e.nodeKind,a,o)}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[r&&(0,H.jsx)(Uo,{color:`var(--warning)`,children:`Selected`}),n&&(0,H.jsx)(Uo,{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)(Uo,{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)(Uo,{className:`shrink-0`,color:e.isPreferredTip?`var(--warning)`:`var(--text-muted)`,children:e.isPreferredTip?`Preferred tip`:`Tip`}):(0,H.jsx)(Uo,{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 my({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)(Uo,{children:`Lineage rail`}),i.map(e=>(0,H.jsx)(_y,{label:e.node.stepLabel??ny(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)(_y,{label:Ey(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 hy({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)(Uo,{children:e}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-[var(--text-primary)]`,children:t})]})}function gy({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 _y({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:Dy(e)})}function vy(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 yy(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 by(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 xy=[{test:e=>e.hasFailedValidations,color:`var(--error)`},{test:e=>e.hasGaps,color:`var(--warning)`},{test:e=>e.hasRecap||e.hasArtifacts,color:`var(--accent)`}];function Sy(e){return xy.find(t=>t.test(e))?.color??null}function Cy(e){switch(e){case`blocked_attempt`:return`Blocked`;case`checkpoint`:return`Checkpoint`;case`step`:return`Step`}}function wy(e,t,n){return t===`blocked`?n?`Blocked branch ${n}`:`Blocked branch`:t===`alternate`?n?`Alt branch ${n}`:`Alt branch`:Cy(e)}function Ty(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 Ey(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`:ny(e.nodeId)}function Dy(e){return e.length>18?`${e.slice(0,18)}…`:e}function Oy({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)(Uo,{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)(Uo,{color:`var(--accent)`,style:{fontSize:9},children:`[ // ${r}x ]`})})]})}var ky={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 Ay({x:e,y:t,cause:n,onMouseEnter:r,onMouseLeave:i}){let a=ky[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 jy({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)(Uo,{color:`rgba(123, 141, 167, 0.70)`,children:`Skipped`}),(0,H.jsx)(Uo,{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)(Uo,{color:`rgba(123, 141, 167, 0.45)`,className:`text-[11px]`,children:`not executed`})})]})}function My({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 Ny(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 ay(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 Py({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=Ny(e);return(0,H.jsxs)(`li`,{className:`flex items-start gap-2 text-xs text-[var(--text-muted)]`,children:[(0,H.jsx)(My,{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 Fy({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 Iy({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:Wo(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 Ly=80;function Ry({summary:e,runStatus:t}){let n=sy(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<=Ly),t<=Ly&&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)(Iy,{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)(Py,{group:e},e.enteredItem.recordedAtEventIndex);let{item:t}=e,n=Ny(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)(My,{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)(Fy,{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 zy(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 By=class extends Error{constructor(e,t){super(`HTTP ${e}: ${t}`),this.status=e,this.name=`HttpError`}};async function Vy(e){let t=await fetch(e);if(!t.ok)throw new By(t.status,t.statusText);let n=await t.json();if(!n.success||!n.data)throw Error(n.error??`Unknown error`);return n.data}function Hy(){return rt({queryKey:[`sessions`],queryFn:()=>Vy(`/api/v2/sessions`),refetchInterval:3e4,staleTime:25e3})}function Uy(e){return rt({queryKey:[`session`,e],queryFn:()=>Vy(`/api/v2/sessions/${e}`),enabled:!!e,refetchInterval:5e3,refetchIntervalInBackground:!1,staleTime:3e3})}function Wy(e,t){return rt({queryKey:[`node`,e,t],queryFn:()=>Vy(`/api/v2/sessions/${e}/nodes/${t}`),enabled:!!t})}function Gy(e,t){return rt({queryKey:[`diff-summary`,e],queryFn:()=>Vy(`/api/v2/sessions/${e}/diff-summary`),enabled:t,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1,retry:!1})}function Ky(){return rt({queryKey:[`worktrees`],queryFn:()=>Vy(`/api/v2/worktrees`),refetchInterval:3e4,staleTime:2e4})}function qy(){return rt({queryKey:[`workflows`],queryFn:()=>Vy(`/api/v2/workflows`),staleTime:1/0,refetchInterval:!1})}function Jy(){let e=rt({queryKey:[`perf`,`tool-calls`],queryFn:async()=>{try{return await Vy(`/api/v2/perf/tool-calls`)}catch(e){if(e instanceof By&&e.status===404)return null;throw e}},refetchInterval:5e3,staleTime:3e3,refetchIntervalInBackground:!1});return zy(e,()=>void e.refetch())}function Yy(e){return rt({queryKey:[`workflow`,e],queryFn:()=>Vy(`/api/v2/workflows/${e}`),enabled:e!==null,staleTime:1/0,refetchInterval:!1})}function Xy(){return rt({queryKey:[`triggers`],queryFn:async()=>{try{return await Vy(`/api/v2/triggers`)}catch(e){if(e instanceof By&&e.status===503)return{triggers:[]};throw e}},staleTime:3e4,refetchInterval:6e4})}async function Zy(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 By(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 $y(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var eb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nb={};function rb(e,t){return((t||nb).jsx?tb:eb).test(e)}var ib=/[ \t\n\f\r]/g;function ab(e){return typeof e==`object`?e.type===`text`?ob(e.value):!1:ob(e)}function ob(e){return e.replace(ib,``)===``}var sb=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};sb.prototype.normal={},sb.prototype.property={},sb.prototype.space=void 0;function cb(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new sb(n,r,t)}function lb(e){return e.toLowerCase()}var ub=class{constructor(e,t){this.attribute=t,this.property=e}};ub.prototype.attribute=``,ub.prototype.booleanish=!1,ub.prototype.boolean=!1,ub.prototype.commaOrSpaceSeparated=!1,ub.prototype.commaSeparated=!1,ub.prototype.defined=!1,ub.prototype.mustUseProperty=!1,ub.prototype.number=!1,ub.prototype.overloadedBoolean=!1,ub.prototype.property=``,ub.prototype.spaceSeparated=!1,ub.prototype.space=void 0;var db=s({boolean:()=>Z,booleanish:()=>pb,commaOrSpaceSeparated:()=>_b,commaSeparated:()=>gb,number:()=>Q,overloadedBoolean:()=>mb,spaceSeparated:()=>hb}),fb=0,Z=vb(),pb=vb(),mb=vb(),Q=vb(),hb=vb(),gb=vb(),_b=vb();function vb(){return 2**++fb}var yb=Object.keys(db),bb=class extends ub{constructor(e,t,n,r){let i=-1;if(super(e,t),xb(this,`space`,r),typeof n==`number`)for(;++i<yb.length;){let e=yb[i];xb(this,yb[i],(n&db[e])===db[e])}}};bb.prototype.defined=!0;function xb(e,t,n){n&&(e[t]=n)}function Sb(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new bb(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[lb(r)]=r,n[lb(a.attribute)]=r}return new sb(t,n,e.space)}var Cb=Sb({properties:{ariaActiveDescendant:null,ariaAtomic:pb,ariaAutoComplete:null,ariaBusy:pb,ariaChecked:pb,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:hb,ariaCurrent:null,ariaDescribedBy:hb,ariaDetails:null,ariaDisabled:pb,ariaDropEffect:hb,ariaErrorMessage:null,ariaExpanded:pb,ariaFlowTo:hb,ariaGrabbed:pb,ariaHasPopup:null,ariaHidden:pb,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:hb,ariaLevel:Q,ariaLive:null,ariaModal:pb,ariaMultiLine:pb,ariaMultiSelectable:pb,ariaOrientation:null,ariaOwns:hb,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:pb,ariaReadOnly:pb,ariaRelevant:null,ariaRequired:pb,ariaRoleDescription:hb,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:pb,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 wb(e,t){return t in e?e[t]:t}function Tb(e,t){return wb(e,t.toLowerCase())}var Eb=Sb({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:gb,acceptCharset:hb,accessKey:hb,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:hb,autoFocus:Z,autoPlay:Z,blocking:hb,capture:null,charSet:null,checked:Z,cite:null,className:hb,cols:Q,colSpan:null,content:null,contentEditable:pb,controls:Z,controlsList:hb,coords:Q|gb,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:mb,draggable:pb,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:hb,height:Q,hidden:mb,high:Q,href:null,hrefLang:null,htmlFor:hb,httpEquiv:hb,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:hb,itemRef:hb,itemScope:Z,itemType:hb,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:hb,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:hb,required:Z,reversed:Z,rows:Q,rowSpan:Q,sandbox:hb,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:pb,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:pb,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:hb,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:pb,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:Tb}),Db=Sb({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:_b,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:hb,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:gb,g2:gb,glyphName:gb,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:_b,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:hb,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_b,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_b,rev:_b,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_b,requiredFeatures:_b,requiredFonts:_b,requiredFormats:_b,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:_b,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:_b,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:_b,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:wb}),Ob=Sb({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()}}),kb=Sb({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Tb}),Ab=Sb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),jb={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`},Mb=/[A-Z]/g,Nb=/-[a-z]/g,Pb=/^data[-\w.:]+$/i;function Fb(e,t){let n=lb(t),r=t,i=ub;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Pb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Nb,Lb);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Nb.test(e)){let n=e.replace(Mb,Ib);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=bb}return new i(r,t)}function Ib(e){return`-`+e.toLowerCase()}function Lb(e){return e.charAt(1).toUpperCase()}var Rb=cb([Cb,Eb,Ob,kb,Ab],`html`),zb=cb([Cb,Db,Ob,kb,Ab],`svg`);function Bb(e){return e.join(` `).trim()}var Vb=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
|
+
`,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})),Hb=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(Vb());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}})),Ub=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))}})),Wb=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Hb()),r=Ub();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})),Gb=qb(`end`),Kb=qb(`start`);function qb(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 Jb(e){let t=Kb(e),n=Gb(e);if(t&&n)return{start:t,end:n}}function Yb(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Zb(e.position):`start`in e||`end`in e?Zb(e):`line`in e||`column`in e?Xb(e):``}function Xb(e){return Qb(e&&e.line)+`:`+Qb(e&&e.column)}function Zb(e){return Xb(e&&e.start)+`-`+Xb(e&&e.end)}function Qb(e){return e&&typeof e==`number`?e:1}var $b=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=Yb(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}};$b.prototype.file=``,$b.prototype.name=``,$b.prototype.reason=``,$b.prototype.message=``,$b.prototype.stack=``,$b.prototype.column=void 0,$b.prototype.line=void 0,$b.prototype.ancestors=void 0,$b.prototype.cause=void 0,$b.prototype.fatal=void 0,$b.prototype.place=void 0,$b.prototype.ruleId=void 0,$b.prototype.source=void 0;var ex=l(Wb(),1),tx={}.hasOwnProperty,nx=new Map,rx=/[A-Z]/g,ix=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),ax=new Set([`td`,`th`]),ox=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function sx(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=vx(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=_x(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`?zb:Rb,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=cx(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function cx(e,t,n){if(t.type===`element`)return lx(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ux(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return fx(e,t,n);if(t.type===`mdxjsEsm`)return dx(e,t);if(t.type===`root`)return px(e,t,n);if(t.type===`text`)return mx(e,t)}function lx(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=zb,e.schema=i),e.ancestors.push(t);let a=wx(e,t.tagName,!1),o=yx(e,t),s=xx(e,t);return ix.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!ab(e):!0})),hx(e,o,a,t),gx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ux(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)}Tx(e,t.position)}function dx(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tx(e,t.position)}function fx(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=zb,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:wx(e,t.name,!0),o=bx(e,t),s=xx(e,t);return hx(e,o,a,t),gx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function px(e,t,n){let r={};return gx(r,xx(e,t)),e.create(t,e.Fragment,r,n)}function mx(e,t){return t.value}function hx(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function gx(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function _x(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 vx(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Kb(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 yx(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&tx.call(t.properties,i)){let a=Sx(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&ax.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 bx(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 Tx(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 Tx(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function xx(e,t){let n=[],r=-1,i=e.passKeys?new Map:nx;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=cx(e,a,o);s!==void 0&&n.push(s)}return n}function Sx(e,t,n){let r=Fb(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$y(n):Bb(n)),r.property===`style`){let t=typeof n==`object`?n:Cx(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Ex(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?jb[r.property]||r.property:r.attribute,n]}}function Cx(e,t){try{return(0,ex.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new $b("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=ox+`#cannot-parse-style-attribute`,r}}function wx(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=rb(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=rb(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return tx.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Tx(e)}function Tx(e,t){let n=new $b("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=ox+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Ex(e){let t={},n;for(n in e)tx.call(e,n)&&(t[Dx(n)]=e[n]);return t}function Dx(e){let t=e.replace(rx,Ox);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Ox(e){return`-`+e.toLowerCase()}var kx={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`]},Ax={};function jx(e,t){let n=t||Ax;return Mx(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Mx(e,t,n){if(Px(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 Nx(e.children,t,n)}return Array.isArray(e)?Nx(e,t,n):``}function Nx(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Mx(e[i],t,n);return r.join(``)}function Px(e){return!!(e&&typeof e==`object`)}var Fx=document.createElement(`i`);function Ix(e){let t=`&`+e+`;`;Fx.innerHTML=t;let n=Fx.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Lx(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 Rx(e,t){return e.length>0?(Lx(e,e.length,0,t),e):t}var zx={}.hasOwnProperty;function Bx(e){let t={},n=-1;for(;++n<e.length;)Vx(t,e[n]);return t}function Vx(e,t){let n;for(n in t){let r=(zx.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){zx.call(r,a)||(r[a]=[]);let e=i[a];Hx(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Hx(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Lx(e,0,0,r)}function Ux(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 Wx(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Gx=nS(/[A-Za-z]/),Kx=nS(/[\dA-Za-z]/),qx=nS(/[#-'*+\--9=?A-Z^-~]/);function Jx(e){return e!==null&&(e<32||e===127)}var Yx=nS(/\d/),Xx=nS(/[\dA-Fa-f]/),Zx=nS(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function Qx(e){return e!==null&&(e<0||e===32)}function $x(e){return e===-2||e===-1||e===32}var eS=nS(/\p{P}|\p{S}/u),tS=nS(/\s/);function nS(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function rS(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Kx(e.charCodeAt(n+1))&&Kx(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 iS(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $x(r)?(e.enter(n),s(r)):t(r)}function s(r){return $x(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var aS={tokenize:oS};function oS(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`),iS(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 sS={tokenize:lS},cS={tokenize:uS};function lS(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 Lx(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(cS,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(cS,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++;Lx(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 uS(e,t,n){return iS(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function dS(e){if(e===null||Qx(e)||tS(e))return 1;if(eS(e))return 2}function fS(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 pS={name:`attention`,resolveAll:mS,tokenize:hS};function mS(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};gS(d,-c),gS(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=Rx(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Rx(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Rx(l,fS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Rx(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=Rx(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Lx(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 hS(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=dS(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=dS(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 gS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var _S={name:`autolink`,tokenize:vS};function vS(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 Gx(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Kx(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||Kx(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||Jx(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):qx(t)?(e.consume(t),l):n(t)}function u(e){return Kx(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||Kx(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var yS={partial:!0,tokenize:bS};function bS(e,t,n){return r;function r(t){return $x(t)?iS(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var xS={continuation:{tokenize:CS},exit:wS,name:`blockQuote`,tokenize:SS};function SS(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 $x(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function CS(e,t,n){let r=this;return i;function i(t){return $x(t)?iS(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(xS,t,n)(r)}}function wS(e){e.exit(`blockQuote`)}var TS={name:`characterEscape`,tokenize:ES};function ES(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 Zx(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var DS={name:`characterReference`,tokenize:OS};function OS(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=Kx,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=Xx,u):(e.enter(`characterReferenceValue`),a=7,o=Yx,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Kx&&!Ix(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 kS={partial:!0,tokenize:MS},AS={concrete:!0,name:`codeFenced`,tokenize:jS};function jS(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`),$x(t)?iS(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(kS,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)):$x(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),iS(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&&$x(t)?iS(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(kS,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`),$x(t)?iS(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`),$x(t)?iS(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function MS(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 NS={name:`codeIndented`,tokenize:FS},PS={partial:!0,tokenize:IS};function FS(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),iS(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(PS,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 IS(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):iS(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 LS={name:`codeText`,previous:zS,resolve:RS,tokenize:BS};function RS(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 zS(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function BS(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 VS=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&&HS(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),HS(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),HS(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);HS(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);HS(this.left,t.reverse())}}};function HS(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 US(e){let t={},n=-1,r,i,a,o,s,c,l,u=new VS(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,WS(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 Lx(e,0,1/0,u.slice(0)),!l}function WS(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 GS={resolve:qS,tokenize:JS},KS={partial:!0,tokenize:YS};function qS(e){return US(e),e}function JS(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(KS,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 YS(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),iS(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 XS(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||Jx(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||Jx(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 ZS(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||=!$x(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`),iS(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 $S(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$x(i)?iS(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var eC={name:`definition`,tokenize:nC},tC={partial:!0,tokenize:rC};function nC(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ZS.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Wx(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)?$S(e,l)(t):l(t)}function l(t){return XS(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(tC,d,d)(t)}function d(t){return $x(t)?iS(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 rC(e,t,n){return r;function r(t){return Qx(t)?$S(e,i)(t):n(t)}function i(t){return QS(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $x(t)?iS(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var iC={name:`hardBreakEscape`,tokenize:aC};function aC(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 oC={name:`headingAtx`,resolve:sC,tokenize:cC};function sC(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`},Lx(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function cC(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)):$x(n)?iS(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 lC=`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(`.`),uC=[`pre`,`script`,`style`,`textarea`],dC={concrete:!0,name:`htmlFlow`,resolveTo:mC,tokenize:hC},fC={partial:!0,tokenize:_C},pC={partial:!0,tokenize:gC};function mC(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 hC(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):Gx(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):Gx(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 Gx(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&&uC.includes(l)?(i=1,r.interrupt?t(s):O(s)):lC.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||Kx(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 $x(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Gx(t)?(e.consume(t),b):$x(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Kx(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$x(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):$x(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||$x(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):$x(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(fC,L,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(pC,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 uC.includes(n)?(e.consume(t),I):O(t)}return Gx(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 gC(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 _C(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(yS,t,n)}}var vC={name:`htmlText`,tokenize:yC};function yC(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):Gx(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):Gx(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 Gx(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Kx(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,N(t)):$x(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Kx(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||Gx(t)?(e.consume(t),E):$(t)?(o=T,N(t)):$x(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Kx(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,N(t)):$x(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)):$x(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 $x(t)?iS(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 bC={name:`labelEnd`,resolveAll:wC,resolveTo:TC,tokenize:EC},xC={tokenize:DC},SC={tokenize:OC},CC={tokenize:kC};function wC(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&&Lx(e,0,e.length,n),e}function TC(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=Rx(s,e.slice(a+1,a+r+3)),s=Rx(s,[[`enter`,u,t]]),s=Rx(s,fS(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Rx(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Rx(s,e.slice(o+1)),s=Rx(s,[[`exit`,c,t]]),Lx(e,a,e.length,s),e}function EC(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(Wx(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(xC,u,o?u:d)(t):t===91?e.attempt(SC,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(CC,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function DC(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)?$S(e,a)(t):a(t)}function a(t){return t===41?u(t):XS(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Qx(t)?$S(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)?$S(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 OC(e,t,n){let r=this;return i;function i(t){return ZS.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Wx(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function kC(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 AC={name:`labelStartImage`,resolveAll:bC.resolveAll,tokenize:jC};function jC(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 MC={name:`labelStartLink`,resolveAll:bC.resolveAll,tokenize:NC};function NC(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 PC={name:`lineEnding`,tokenize:FC};function FC(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),iS(e,t,`linePrefix`)}}var IC={name:`thematicBreak`,tokenize:LC};function LC(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`),$x(t)?iS(e,s,`whitespace`)(t):s(t))}}var RC={continuation:{tokenize:HC},exit:WC,name:`list`,tokenize:VC},zC={partial:!0,tokenize:GC},BC={partial:!0,tokenize:UC};function VC(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:Yx(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(IC,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 Yx(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(yS,r.interrupt?n:u,e.attempt(zC,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $x(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 HC(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(yS,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,iS(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$x(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(BC,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,iS(e,e.attempt(RC,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function UC(e,t,n){let r=this;return iS(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 WC(e){e.exit(this.containerState.type)}function GC(e,t,n){let r=this;return iS(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!$x(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var KC={name:`setextUnderline`,resolveTo:qC,tokenize:JC};function qC(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 JC(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`),$x(t)?iS(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var YC={tokenize:XC};function XC(e){let t=this,n=e.attempt(yS,r,e.attempt(this.parser.constructs.flowInitial,i,iS(e,e.attempt(this.parser.constructs.flow,i,e.attempt(GS,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 ZC={resolveAll:tw()},QC=ew(`string`),$C=ew(`text`);function ew(e){return{resolveAll:tw(e===`text`?nw: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 tw(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 nw(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 rw=s({attentionMarkers:()=>dw,contentInitial:()=>aw,disable:()=>fw,document:()=>iw,flow:()=>sw,flowInitial:()=>ow,insideSpan:()=>uw,string:()=>cw,text:()=>lw}),iw={42:RC,43:RC,45:RC,48:RC,49:RC,50:RC,51:RC,52:RC,53:RC,54:RC,55:RC,56:RC,57:RC,62:xS},aw={91:eC},ow={[-2]:NS,[-1]:NS,32:NS},sw={35:oC,42:IC,45:[KC,IC],60:dC,61:KC,95:IC,96:AS,126:AS},cw={38:DS,92:TS},lw={[-5]:PC,[-4]:PC,[-3]:PC,33:AC,38:DS,42:pS,60:[_S,vC],91:MC,92:[iC,TS],93:bC,95:pS,96:LS},uw={null:[pS,ZC]},dw={null:[42,95]},fw={null:[]};function pw(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=Rx(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=fS(a,l.events,l),l.events):[]}function f(e,t){return hw(p(e),t)}function p(e){return mw(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&&Lx(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 mw(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 hw(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
|
-
`;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 hw(e){let t={constructs:zx([nw,...(e||{}).extensions||[]]),content:n(iS),defined:[],document:n(oS),flow:n(JC),lazy:{},string:n(ZC),text:n(QC)};return t;function n(e){return n;function n(n){return fw(t,e,n)}}}function gw(e){for(;!HS(e););return e}var _w=/[\0\t\n\r]/g;function vw(){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(_w.lastIndex=u,c=_w.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 yw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bw(e){return e.replace(yw,xw)}function xw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Hx(n.slice(t?2:1),t?16:10)}return Fx(n)||e}var Sw={}.hasOwnProperty;function Cw(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),ww(n)(gw(hw(n).document().write(vw()(e,t,!0))))}function ww(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()}};Ew(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]];Sw.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]||Ow).call(a,void 0,e[0])}for(r.position={start:Tw(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Tw(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:Tw(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]||Ow).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Jb({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Tw(e.end)}function u(){return Ax(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=Ux(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:Tw(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=Tw(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=Tw(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=bw(t),n.identifier=Ux(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=Ux(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=Hx(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Fx(t);let i=this.stack[this.stack.length-1];i.value+=r}function B(e){let t=this.stack.pop();t.position.end=Tw(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 Tw(e){return{line:e.line,column:e.column,offset:e.offset}}function Ew(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Ew(e,r):Dw(e,r)}}function Dw(e,t){let n;for(n in t)if(Sw.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 Ow(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Jb({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Jb({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Jb({start:t.start,end:t.end})+`) is still open`)}function kw(e){let t=this;t.parser=n;function n(n){return Cw(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Aw(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 jw(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
19
|
-
`}]}function
|
|
20
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function
|
|
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 gw(e){let t={constructs:Bx([rw,...(e||{}).extensions||[]]),content:n(aS),defined:[],document:n(sS),flow:n(YC),lazy:{},string:n(QC),text:n($C)};return t;function n(e){return n;function n(n){return pw(t,e,n)}}}function _w(e){for(;!US(e););return e}var vw=/[\0\t\n\r]/g;function yw(){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(vw.lastIndex=u,c=vw.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 bw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xw(e){return e.replace(bw,Sw)}function Sw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ux(n.slice(t?2:1),t?16:10)}return Ix(n)||e}var Cw={}.hasOwnProperty;function ww(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),Tw(n)(_w(gw(n).document().write(yw()(e,t,!0))))}function Tw(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()}};Dw(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]];Cw.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]||kw).call(a,void 0,e[0])}for(r.position={start:Ew(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ew(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:Ew(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]||kw).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Yb({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Ew(e.end)}function u(){return jx(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=Wx(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:Ew(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=Ew(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=Ew(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=xw(t),n.identifier=Wx(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=Wx(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=Ux(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ix(t);let i=this.stack[this.stack.length-1];i.value+=r}function B(e){let t=this.stack.pop();t.position.end=Ew(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 Ew(e){return{line:e.line,column:e.column,offset:e.offset}}function Dw(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Dw(e,r):Ow(e,r)}}function Ow(e,t){let n;for(n in t)if(Cw.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 kw(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Yb({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Yb({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Yb({start:t.start,end:t.end})+`) is still open`)}function Aw(e){let t=this;t.parser=n;function n(n){return ww(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function jw(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 Mw(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
19
|
+
`}]}function Nw(e,t){let n=t.value?t.value+`
|
|
20
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Pw(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fw(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Iw(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=rS(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Lw(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rw(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function zw(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Bw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return zw(e,t);let i={src:rS(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Vw(e,t){let n={src:rS(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Hw(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Uw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return zw(e,t);let i={href:rS(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ww(e,t){let n={href:rS(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Gw(e,t,n){let r=e.all(t),i=n?Kw(n):qw(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
21
21
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
22
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function
|
|
22
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Kw(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=qw(n[r])}return t}function qw(e){return e.spread??e.children.length>1}function Jw(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Yw(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xw(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Zw(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qw(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Kb(t.children[1]),o=Gb(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function $w(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function eT(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var tT=9,nT=32;function rT(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(iT(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(iT(t.slice(i),i>0,!1)),a.join(``)}function iT(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===tT||t===nT;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===tT||t===nT;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function aT(e,t){let n={type:`text`,value:rT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function oT(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var sT={blockquote:jw,break:Mw,code:Nw,delete:Pw,emphasis:Fw,footnoteReference:Iw,heading:Lw,html:Rw,imageReference:Bw,image:Vw,inlineCode:Hw,linkReference:Uw,link:Ww,listItem:Gw,list:Jw,paragraph:Yw,root:Xw,strong:Zw,table:Qw,tableCell:eT,tableRow:$w,text:aT,thematicBreak:oT,toml:cT,yaml:cT,definition:cT,footnoteDefinition:cT};function cT(){}var lT=typeof self==`object`?self:globalThis,uT=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new lT[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new lT[a](o),i)};return r},dT=e=>uT(new Map,e)(0),fT=``,{toString:pT}={},{keys:mT}=Object,hT=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=pT.call(e).slice(8,-1);switch(n){case`Array`:return[1,fT];case`Object`:return[2,fT];case`Date`:return[3,fT];case`RegExp`:return[4,fT];case`Map`:return[5,fT];case`Set`:return[6,fT];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},gT=([e,t])=>e===0&&(t===`function`||t===`symbol`),_T=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=hT(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of mT(r))(e||!gT(hT(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(gT(hT(n))||gT(hT(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!gT(hT(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},vT=(e,{json:t,lossy:n}={})=>{let r=[];return _T(!(t||n),!!t,new Map,r)(e),r},yT=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?dT(vT(e,t)):structuredClone(e):(e,t)=>dT(vT(e,t));function bT(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function xT(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ST(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||bT,r=e.options.footnoteBackLabel||xT,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=rS(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...yT(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
23
23
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
24
|
-
`}]}}var
|
|
24
|
+
`}]}}var CT=(function(e){if(e==null)return OT;if(typeof e==`function`)return DT(e);if(typeof e==`object`)return Array.isArray(e)?wT(e):TT(e);if(typeof e==`string`)return ET(e);throw Error(`Expected function, string, or object as test`)});function wT(e){let t=[],n=-1;for(;++n<e.length;)t[n]=CT(e[n]);return DT(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function TT(e){let t=e;return DT(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ET(e){return DT(t);function t(t){return t&&t.type===e}}function DT(e){return t;function t(t,n,r){return!!(kT(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function OT(){return!0}function kT(e){return typeof e==`object`&&!!e&&`type`in e}function AT(e){return e}var jT=[];function MT(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=CT(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+AT(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=jT,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=NT(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function NT(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?jT:[e]}function PT(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),MT(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var FT={}.hasOwnProperty,IT={};function LT(e,t){let n=t||IT,r=new Map,i=new Map,a={all:s,applyData:zT,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...sT,...n.handlers},one:o,options:n,patch:RT,wrap:VT};return PT(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(FT.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=yT(n);return r.children=a.all(e),r}return yT(e)}return(a.options.unknownHandler||BT)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=HT(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=HT(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function RT(e,t){e.position&&(t.position=Jb(e))}function zT(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,yT(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function BT(e,t){let n=t.data||{},r=`value`in t&&!(FT.call(n,`hProperties`)||FT.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function VT(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
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
|
-
`}),n}function
|
|
28
|
-
`},i)),a}function UT(e,t){return e&&`run`in e?async function(n,r){let i=HT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return HT(n,{file:r,...e||t})}}function WT(e){if(e)throw e}var GT=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 KT(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 qT(){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?JT(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 JT(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 YT={basename:XT,dirname:ZT,extname:QT,join:$T,sep:`/`};function XT(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);nE(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 ZT(e){if(nE(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 QT(e){nE(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 $T(...e){let t=-1,n;for(;++t<e.length;)nE(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:eE(n)}function eE(e){nE(e);let t=e.codePointAt(0)===47,n=tE(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function tE(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 nE(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var rE={cwd:iE};function iE(){return`/`}function aE(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function oE(e){if(typeof e==`string`)e=new URL(e);else if(!aE(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 sE(e)}function sE(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 cE=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],lE=class{constructor(e){let t;t=e?aE(e)?{path:e}:typeof e==`string`||pE(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:rE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<cE.length;){let e=cE[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)cE.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?YT.basename(this.path):void 0}set basename(e){dE(e,`basename`),uE(e,`basename`),this.path=YT.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?YT.dirname(this.path):void 0}set dirname(e){fE(this.basename,`dirname`),this.path=YT.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?YT.extname(this.path):void 0}set extname(e){if(uE(e,`extname`),fE(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=YT.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){aE(e)&&(e=oE(e)),dE(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?YT.basename(this.path,this.extname):void 0}set stem(e){dE(e,`stem`),uE(e,`stem`),this.path=YT.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 Qb(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 uE(e,t){if(e&&e.includes(YT.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+YT.sep+"`")}function dE(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function fE(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function pE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var mE=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),hE=l(GT(),1),gE={}.hasOwnProperty,_E=new class e extends mE{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=qT()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,hE.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(bE(`data`,this.frozen),this.namespace[e]=t,this):gE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(bE(`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=CE(e),n=this.parser||this.Parser;return vE(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),vE(`process`,this.parser||this.Parser),yE(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=CE(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);TE(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(),vE(`processSync`,this.parser||this.Parser),yE(`processSync`,this.compiler||this.Compiler),this.process(e,r),SE(`processSync`,`process`,t),n;function r(e,r){t=!0,WT(e),n=r}}run(e,t,n){xE(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=CE(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),SE(`runSync`,`run`,n),r;function i(e,t){WT(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=CE(t),r=this.compiler||this.Compiler;return yE(`stringify`,r),xE(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(bE(`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,hE.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];KT(o)&&KT(r)&&(r=(0,hE.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function vE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function yE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function bE(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 xE(e){if(!KT(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function SE(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function CE(e){return wE(e)?e:new lE(e)}function wE(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function TE(e){return typeof e==`string`||EE(e)}function EE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var DE=[],OE={allowDangerousHtml:!0},kE=/^(https?|ircs?|mailto|xmpp)$/i,AE=[{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 jE(e){let t=ME(e),n=NE(e);return PE(t.runSync(t.parse(n),n),e)}function ME(e){let t=e.rehypePlugins||DE,n=e.remarkPlugins||DE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...OE}:OE;return _E().use(kw).use(n).use(UT,r).use(t)}function NE(e){let t=e.children||``,n=new lE;return typeof t==`string`?n.value=t:``+t,n}function PE(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||FE;for(let e of AE)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return NT(e,l),ox(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 Ox)if(Object.hasOwn(Ox,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Ox[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 FE(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||kE.test(e.slice(0,t))?e:``}function IE({children:e,className:t}){return(0,H.jsx)(`div`,{className:`markdown-view ${t??``}`,children:(0,H.jsx)(jE,{children:e})})}function LE({sessionId:e,nodeId:t,runStatus:n=`complete`,currentNodeId:r=null,executionTraceSummary:i=null}){let{data:a,isLoading:o,error:s}=Wy(e,t);return t?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(RE,{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)(UE,{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 RE({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 zE({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 BE({nodeId:e,nodeKind:t,executionTraceSummary:n}){let{whySelected:r,conditions:i,loops:a,divergences:o,forks:s}=dy(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)(iD,{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)(My,{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)(zE,{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)(My,{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=>!ay(e)),...i.filter(e=>ay(e))].map((e,t)=>{let n=ay(e);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(My,{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)(My,{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)(zE,{item:e},t))})]}),o.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(My,{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)(zE,{item:e},t))})]}),s.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(My,{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)(zE,{item:e},t))})]})]})}):(0,H.jsx)(iD,{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)(My,{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 VE({items:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsx)(iD,{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)(My,{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 HE=[{id:`routing`,column:`primary`,render:({detail:e,executionTraceSummary:t})=>t===null?null:(0,H.jsx)(BE,{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)(VE,{items:t},`run_routing`)}},{id:`recap`,column:`primary`,render:({detail:e,runStatus:t,currentNodeId:n})=>e.recapMarkdown?(0,H.jsx)(YE,{markdown:e.recapMarkdown},`recap`):t===`in_progress`&&e.nodeId===n&&!e.recapMarkdown?(0,H.jsx)(WE,{detail:e},`recap-in-progress`):null},{id:`validations`,column:`primary`,render:({detail:e})=>e.validations.length>0?(0,H.jsx)(ZE,{validations:e.validations},`validations`):null},{id:`gaps`,column:`primary`,render:({detail:e})=>e.gaps.length>0?(0,H.jsx)($E,{gaps:e.gaps},`gaps`):null},{id:`advance-outcome`,column:`primary`,render:({detail:e})=>e.advanceOutcome?(0,H.jsx)(XE,{outcome:e.advanceOutcome},`advance-outcome`):null},{id:`artifacts`,column:`primary`,render:({detail:e})=>e.artifacts.length>0?(0,H.jsx)(rD,{artifacts:e.artifacts},`artifacts`):null},{id:`node-meta`,column:`primary`,render:({detail:e})=>(0,H.jsx)(JE,{detail:e},`node-meta`)}];function UE(e){return(0,H.jsx)(`div`,{className:`space-y-4`,children:HE.map(t=>t.render(e))})}function WE({detail:e}){return(0,H.jsx)(iD,{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)(GE,{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)(KE,{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)(KE,{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)(Uo,{children:`What lands here next`})}),(0,H.jsxs)(`div`,{className:`p-4 grid gap-3 md:grid-cols-3`,children:[(0,H.jsx)(qE,{title:`Recap`,description:`A step summary is written when this node completes.`}),(0,H.jsx)(qE,{title:`Validations`,description:`Validation results appear if this step records contract checks.`}),(0,H.jsx)(qE,{title:`Artifacts`,description:`Generated outputs show up here after the step produces them.`})]})]})]})})}function GE({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 KE({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)(Uo,{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 qE({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)(Uo,{color:`var(--text-secondary)`,children:e}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:t})]})}function JE({detail:e}){return(0,H.jsx)(iD,{title:`Node details`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(aD,{label:`Kind`,value:(0,H.jsx)(sD,{kind:e.nodeKind})}),(0,H.jsx)(aD,{label:`Event index`,value:String(e.createdAtEventIndex),mono:!0}),(0,H.jsx)(aD,{label:`Parent`,value:e.parentNodeId??`Root`,mono:!0}),(0,H.jsx)(aD,{label:`Tip state`,value:e.isTip?e.isPreferredTip?`Preferred tip`:`Tip`:`Historical`})]})})}function YE({markdown:e}){return(0,H.jsx)(iD,{title:`Recap`,children:(0,H.jsx)(IE,{children:e})})}function XE({outcome:e}){let t=e.kind===`advanced`;return(0,H.jsx)(iD,{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 ZE({validations:e}){return(0,H.jsx)(iD,{title:`Validations (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsx)(QE,{validation:e},e.validationId))})})}function QE({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 $E({gaps:e}){return(0,H.jsx)(iD,{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 eD=1e5,tD=[{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 nD(e){if(e.byteLength>eD)return(0,H.jsxs)(`div`,{className:`text-[var(--text-muted)] italic`,children:[`Content too large to display (`,cD(e.byteLength),` -- limit `,cD(eD),`)`]});let t=tD.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 rD({artifacts:e}){return(0,H.jsx)(iD,{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:cD(e.byteLength)})]}),nD(e)]},e.sha256))})})}function iD({title:e,children:t}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-2`,children:(0,H.jsx)(Uo,{children:e})}),t]})}function aD({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)(Uo,{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 oD={step:{label:`Step`,color:`var(--accent)`},checkpoint:{label:`Checkpoint`,color:`var(--success)`},blocked_attempt:{label:`Blocked`,color:`var(--error)`}};function sD({kind:e}){let t=oD[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 cD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function lD(e){return e.length>16?`\u2026${e.slice(-16)}`:e}function uD({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:lD(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 dD({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 fD({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)(uD,{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)(dD,{runs:a.runs}),(0,H.jsx)(`div`,{className:`space-y-6`,children:a.runs.map(e=>(0,H.jsx)(pD,{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)(LE,{sessionId:i,nodeId:o?.nodeId??null,runStatus:s?.status??`complete`,currentNodeId:s?.preferredTipNodeId??null,executionTraceSummary:s?.executionTraceSummary??null})})]})]})}function pD({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)(Ry,{summary:e.executionTraceSummary,runStatus:e.status}):(0,H.jsx)(fy,{run:e,selectedNodeId:t,onNodeClick:t=>n(e.runId,t)})})]})}function mD(){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 hD=[{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`}],gD=Object.fromEntries(hD.map(e=>[e.id,e.label]));function _D({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 vD({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 yD({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)(TD,{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)(TD,{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)(vD,{segments:n?[{label:`Workflows`,onClick:r},{label:n}]:[{label:`Workflows`,onClick:r}]}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(bD,{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)(CD,{})})]}):(0,H.jsx)(wD,{})]})}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)(vD,{segments:s?[{label:`Workflows`,onClick:u},{label:s}]:[{label:`Workflows`,onClick:u}]}),(0,H.jsx)(bD,{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)(xD,{detail:n,name:r}),(0,H.jsx)(vD,{segments:[{label:`Workflows`,onClick:u}]})]})}function bD({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 xD({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)(IE,{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)(SD,{name:t})]}):(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] italic`,children:`No additional documentation available.`})}function SD({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 CD(){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 wD(){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)(CD,{})]})}function TD({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 ED(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 DD(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 OD(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 kD({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`?ED(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=DD(t,1,e,r);break;case`ArrowLeft`:case`a`:case`A`:o=DD(t,-1,e,r);break;case`ArrowDown`:case`s`:case`S`:o=OD(t,1,e,a,r);break;case`ArrowUp`:case`w`:case`W`:o=OD(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 AD(e){let t=Jy(e),n=()=>{t.refetch()};return t.isLoading?{kind:`loading`}:t.error?t.error instanceof By&&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 jD(){let e=Ky();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 MD(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 ND({workflowId:e,activeTag:t,onBack:n,onNavigateToWorkflow:r}){let i=AD(e),a=jD().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)(()=>MD(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?gD[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 PD(e){let t=new Set(hD.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=hD.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 FD({viewModel:e}){let{state:t,dispatch:n,triggerRef:r,onCardSelect:i}=e,a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=mD(),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)(zD,{});if(t.kind===`error`)return(0,H.jsx)(BD,{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(hD.map(e=>e.id)),v=new Set(h.flatMap(e=>e.tags)),y=new Map(hD.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)(ID,{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 ID({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=ND({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}=kD({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)(LD,{label:`All`,count:u,isActive:t===null,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:null})}),hD.filter(e=>s.has(e.id)).map(e=>(0,H.jsx)(LD,{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)(LD,{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)(LD,{label:`All Sources`,count:d,isActive:n===null,disabled:!1,onClick:()=>m({type:`source_changed`,source:null})}),o.map(e=>(0,H.jsx)(LD,{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 PD(i).map(n=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(_D,{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)(RD,{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)(_D,{label:t===`__other__`?`Other`:gD[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)(RD,{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)(yD,{viewModel:y})]})]})})]})]})}function LD({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 RD({workflow:e,onSelect:t,navProps:n,isActive:r}){let i=e.tags.filter(e=>e!==`routines`).map(e=>gD[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 zD(){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 BD({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 VD=[{value:`recent`,label:`Recent first`,compareFn:(e,t)=>t.startedAtMs-e.startedAtMs},{value:`slowest`,label:`Slowest first`,compareFn:(e,t)=>t.durationMs-e.durationMs}],HD={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 UD(e,t){let n=VD.find(e=>e.value===t);return[...e].sort(n.compareFn)}function WD(e){return e.reduce((e,t)=>Math.max(e,t.durationMs),0)}function GD(e){return e.filter(e=>HD[e.outcome].isError).length}function KD(e){return e.length===0?null:Math.round(e.reduce((e,t)=>e+t.durationMs,0)/e.length)}function qD(e){return e.length===0?null:e.reduce((e,t)=>Math.max(e,t.startedAtMs),0)}function JD(e,t){return t>0?Math.round(e/t*120):0}function YD(e){return`${e} recorded`}var XD=[{key:`tool`,label:`Tool`,minWidth:`180px`},{key:`duration`,label:`Duration`,width:`220px`},{key:`started`,label:`Started`,width:`100px`},{key:`outcome`,label:`Outcome`}];function ZD({viewModel:e}){let{state:t}=e;if(t.kind===`loading`)return(0,H.jsx)(tO,{});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`:W(o)]}),(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":`Sort order`,className:`flex items-center gap-1`,children:VD.map(e=>(0,H.jsx)(eO,{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:XD.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:XD.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)(QD,{obs:e,maxDuration:r},`${e.startedAtMs}-${e.toolName}-${t}`))})]})]})}function QD({obs:e,maxDuration:t}){let n=HD[e.outcome].isError,r=JD(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:W(e.startedAtMs)}),(0,H.jsx)(`td`,{className:`py-2`,children:(0,H.jsx)($D,{outcome:e.outcome})})]})}function $D({outcome:e}){let t=HD[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 eO({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 tO(){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 nO=`workrail:auto:mru-workflow`;function rO(){try{return localStorage.getItem(nO)}catch{return null}}function iO(e){try{localStorage.setItem(nO,e)}catch{}}function aO(){let e=Ky(),t=Yy(),n=e.data?.workflows??[],r=t.data?.triggers??[],[i,a]=(0,V.useState)(()=>rO()??``),[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),iO(e)},b=async()=>{if(!(!i||!c.trim()||!o.trim())){d(!0),p(null),h(!1);try{await Xy({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)(Uo,{color:`var(--accent)`,children:`Dispatch`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Uo,{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)(Uo,{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)(Uo,{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 oO(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 sO(){let{data:e,isLoading:t,isError:n}=Hy(),r=(e?.sessions??[]).filter(e=>e.isAutonomous),{running:i,blocked:a,completed:o}=oO(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)(Uo,{color:`var(--accent)`,children:`Queue`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(cO,{count:i,label:`RUNNING`,color:`var(--accent)`,pulse:!0}),(0,H.jsx)(cO,{count:a,label:`BLOCKED`,color:`var(--blocked)`}),(0,H.jsx)(cO,{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)(lO,{session:e},e.sessionId))})]})}function cO({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 lO({session:e}){let[t,n]=(0,V.useState)(!1),r=xi(),i=e.sessionTitle??e.workflowName??e.workflowId??`Unnamed session`,a=W(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 uO(){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)(aO,{})}),(0,H.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,H.jsx)(sO,{})})]})}function dO(){let e=Hy(),t=Gy();Zy();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 fO={scope:`active`,focusedIndex:-1,archive:null};function pO(e){throw Error(`Unhandled WorkspaceEvent type: ${String(e.type)}`)}function mO(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 pO(t)}}var hO=720*60*60*1e3,gO={in_progress:0,dormant:0,blocked:1,complete_with_gaps:2,complete:3};function _O(e){if(e.length!==0)return[...e].sort((e,t)=>{let n=gO[e.status]-gO[t.status];return n===0?t.lastModifiedMs-e.lastModifiedMs:n})[0]}function vO(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<hO||t===`all`?`visible`:`hidden`}function yO(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 bO(e,t,n){return[...e].filter(e=>vO(e,t,n)===`visible`).sort((e,t)=>{let n=yO(e)-yO(t);return n===0?t.activityMs-e.activityMs:n})}function xO(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=_O(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 SO(e,t,n,r){let i=xO(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:bO(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 CO({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 wO(e=!1){let t=xi(),n=dO(),[r,i]=(0,V.useReducer)(mO,fO),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?SO(n.sessions,n.worktreeRepos,r.scope,Date.now()):null,[n.sessions,n.worktreeRepos,r.scope]);CO({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 TO(){let e=Hy();return{sessions:e.data?.sessions,isLoading:e.isLoading,error:e.error instanceof Error?e.error:null}}function EO(e=``){return{rawSearch:e,sort:`recent`,groupBy:`none`,statusFilter:`all`,page:0,viewMode:`flat`}}function DO(e){throw Error(`Unhandled SessionListEvent type: ${String(e.type)}`)}function OO(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};case`view_mode_changed`:return t.viewMode===`tree`?{...e,viewMode:`tree`,rawSearch:``,statusFilter:`all`,page:0}:{...e,viewMode:`flat`,page:0};default:return DO(t)}}var kO={in_progress:0,blocked:1,dormant:2,complete_with_gaps:3,complete:4},AO=[{value:`recent`,label:`Recent`,compareFn:(e,t)=>t.lastModifiedMs-e.lastModifiedMs},{value:`status`,label:`Status`,compareFn:(e,t)=>kO[e.status]-kO[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}],jO=[{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)=>(kO[e]??99)-(kO[t]??99)},{value:`branch`,label:`Branch`,keyFn:e=>e.gitBranch??`No branch`}],MO=[{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 NO(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 PO(e,t){let n=AO.find(e=>e.value===t)??AO[0];return[...e].sort(n.compareFn)}function FO(e,t){let n=jO.find(e=>e.value===t)??jO[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 IO(e){let t={all:e.length};for(let n of e)t[n.status]=(t[n.status]??0)+1;return t}function LO(e){let t=new Set(e.map(e=>e.sessionId)),n=new Map,r=new Set,i=new Set;for(let a of e){let e=a.parentSessionId;if(!e||e===a.sessionId)continue;if(!t.has(e)){r.add(a.sessionId);continue}i.add(a.sessionId);let o=n.get(e)??[];o.push(a),n.set(e,o)}let a=[];for(let t of e)i.has(t.sessionId)||a.push({session:t,children:n.get(t.sessionId)??[]});return{roots:a,orphanChildIds:r}}function RO(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 zO({onSelectSession:e,initialSearch:t=``}){let n=TO(),[r,i]=(0,V.useReducer)(OO,void 0,()=>EO(t)),a=RO(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?IO(c):{},[c]),f=(0,V.useMemo)(()=>{if(!c)return null;let e=NO(c,a,r.statusFilter);return{groups:FO(PO(e,r.sort),r.groupBy),total:c.length,filtered:e.length}},[c,a,r.statusFilter,r.sort,r.groupBy]),p=(0,V.useMemo)(()=>LO(c||[]),[c]),m=r.groupBy!==`none`,h=f?Math.ceil(f.filtered/25):0,g=r.page*25,_=g+25,v=(0,V.useMemo)(()=>!f||m?[]:f.groups[0]?.sessions.slice(g,_)??[],[f,m,g,_]);o.current=v;let{getItemProps:y,containerProps:b}=kD({count:v.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:h,isGrouped:m,processed:f,statusCounts:d,flatPageSessions:v,getSessionNavProps:y,sessionContainerProps:b,sortAxes:AO,groupAxes:jO,statusFilterOptions:MO,viewMode:r.viewMode,sessionTree:p}:{kind:`loading`},[l,u,f,r,h,m,d,v,y,b,p]),dispatch:i,onSelectSession:e}}var BO={selectedWorkflowId:null,selectedTag:null,selectedSource:null,hintVisible:!1};function VO(e){throw Error(`Unhandled WorkflowsEvent type: ${String(e.type)}`)}function HO(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 VO(t)}}function UO(e){let t=new Set;for(let n of e)for(let e of n.tags)e!==`routines`&&t.add(e);let n=hD.map(e=>e.id).filter(e=>t.has(e)),r=[...t].filter(e=>!hD.some(t=>t.id===e)).sort();return[...n,...r]}function WO(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 GO(e,t,n){let r=new Set(hD.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 KO(e,t){if(t!==null)return e;let n=new Set(hD.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 hD){let t=r.get(e);t&&a.push(...t)}return a.push(...i),a}function qO({initialTag:e,onSelectTag:t}){let n=jD(),[r,i]=(0,V.useReducer)(HO,{...BO,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=UO(l),t=WO(l),i=GO(l,r.selectedTag,r.selectedSource),a=KO(i,r.selectedTag),o=GO(l,null,r.selectedSource),u=GO(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 JO(){let e=qy();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 YO(){let e=JO(),[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=UD(r,t);return{kind:`ready`,sorted:i,maxDuration:WD(i),errorCount:GD(r),avgMs:KD(r),lastCallMs:qD(r),countLabel:YD(r.length),sortOrder:t,onSortChange:n}},[e,t])}}function XO(e){let t=Uy(e);return{data:t.data,isLoading:t.isLoading,error:t.error instanceof Error?t.error:null}}function ZO(e){let t=XO(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 $O(){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=wO(l),h=zO({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=qO({initialTag:p,onSelectTag:y}),C=ND({workflowId:f,activeTag:p,onBack:b,onNavigateToWorkflow:x}),w=ZO(d??``),T=YO(),[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.63.0`]})]})]}),l&&d?(0,H.jsx)(`nav`,{className:`flex items-center flex-1 justify-center`,children:(0,H.jsx)(vD,{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)(wo,{viewModel:m,sessionListViewModel:h,hidden:l}),l&&d&&(0,H.jsx)(fD,{viewModel:w})]}),c===`workflows`&&(0,H.jsx)(`div`,{id:`panel-workflows`,role:`tabpanel`,"aria-labelledby":`tab-workflows`,children:u&&f?(0,H.jsx)(yD,{viewModel:C}):(0,H.jsx)(FD,{viewModel:S})}),c===`auto`&&(0,H.jsx)(`div`,{id:`panel-auto`,role:`tabpanel`,"aria-labelledby":`tab-auto`,children:(0,H.jsx)(uO,{})}),c===`perf`&&(0,H.jsx)(`div`,{id:`panel-perf`,role:`tabpanel`,"aria-labelledby":`tab-perf`,children:(0,H.jsx)(ZD,{viewModel:T})})]})]})}var ek=zi({component:$O}),tk=Li({getParentRoute:()=>ek,path:`/`,component:()=>null}),nk=Li({getParentRoute:()=>ek,path:`/session/$sessionId`,component:()=>null}),rk=Li({getParentRoute:()=>ek,path:`/workflows`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),ik=Li({getParentRoute:()=>ek,path:`/workflows/$workflowId`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),ak=Li({getParentRoute:()=>ek,path:`/perf`,component:()=>null}),ok=Li({getParentRoute:()=>ek,path:`/auto`,component:()=>null}),sk=ea({routeTree:ek.addChildren([tk,nk,rk,ik,ak,ok]),history:hr()}),ck=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:ck,children:(0,H.jsx)(ra,{router:sk})})}));
|
|
27
|
+
`}),n}function HT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function UT(e,t){let n=LT(e,t),r=n.one(e,void 0),i=ST(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 WT(e,t){return e&&`run`in e?async function(n,r){let i=UT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return UT(n,{file:r,...e||t})}}function GT(e){if(e)throw e}var KT=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 qT(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 JT(){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?YT(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 YT(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 XT={basename:ZT,dirname:QT,extname:$T,join:eE,sep:`/`};function ZT(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);rE(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(rE(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 $T(e){rE(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 eE(...e){let t=-1,n;for(;++t<e.length;)rE(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:tE(n)}function tE(e){rE(e);let t=e.codePointAt(0)===47,n=nE(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function nE(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 rE(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var iE={cwd:aE};function aE(){return`/`}function oE(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function sE(e){if(typeof e==`string`)e=new URL(e);else if(!oE(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 cE(e)}function cE(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 lE=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],uE=class{constructor(e){let t;t=e?oE(e)?{path:e}:typeof e==`string`||mE(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:iE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<lE.length;){let e=lE[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)lE.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?XT.basename(this.path):void 0}set basename(e){fE(e,`basename`),dE(e,`basename`),this.path=XT.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?XT.dirname(this.path):void 0}set dirname(e){pE(this.basename,`dirname`),this.path=XT.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?XT.extname(this.path):void 0}set extname(e){if(dE(e,`extname`),pE(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=XT.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){oE(e)&&(e=sE(e)),fE(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?XT.basename(this.path,this.extname):void 0}set stem(e){fE(e,`stem`),dE(e,`stem`),this.path=XT.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 $b(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 dE(e,t){if(e&&e.includes(XT.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+XT.sep+"`")}function fE(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function pE(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function mE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var hE=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),gE=l(KT(),1),_E={}.hasOwnProperty,vE=new class e extends hE{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=JT()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,gE.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(xE(`data`,this.frozen),this.namespace[e]=t,this):_E.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xE(`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=wE(e),n=this.parser||this.Parser;return yE(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),yE(`process`,this.parser||this.Parser),bE(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=wE(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);EE(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(),yE(`processSync`,this.parser||this.Parser),bE(`processSync`,this.compiler||this.Compiler),this.process(e,r),CE(`processSync`,`process`,t),n;function r(e,r){t=!0,GT(e),n=r}}run(e,t,n){SE(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=wE(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),CE(`runSync`,`run`,n),r;function i(e,t){GT(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=wE(t),r=this.compiler||this.Compiler;return bE(`stringify`,r),SE(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(xE(`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,gE.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];qT(o)&&qT(r)&&(r=(0,gE.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function yE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function bE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function xE(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 SE(e){if(!qT(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function CE(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function wE(e){return TE(e)?e:new uE(e)}function TE(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function EE(e){return typeof e==`string`||DE(e)}function DE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var OE=[],kE={allowDangerousHtml:!0},AE=/^(https?|ircs?|mailto|xmpp)$/i,jE=[{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 ME(e){let t=NE(e),n=PE(e);return FE(t.runSync(t.parse(n),n),e)}function NE(e){let t=e.rehypePlugins||OE,n=e.remarkPlugins||OE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kE}:kE;return vE().use(Aw).use(n).use(WT,r).use(t)}function PE(e){let t=e.children||``,n=new uE;return typeof t==`string`?n.value=t:``+t,n}function FE(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||IE;for(let e of jE)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return PT(e,l),sx(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 kx)if(Object.hasOwn(kx,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=kx[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 IE(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||AE.test(e.slice(0,t))?e:``}function LE({children:e,className:t}){return(0,H.jsx)(`div`,{className:`markdown-view ${t??``}`,children:(0,H.jsx)(ME,{children:e})})}function RE({sessionId:e,nodeId:t,runStatus:n=`complete`,currentNodeId:r=null,executionTraceSummary:i=null}){let{data:a,isLoading:o,error:s}=Wy(e,t);return t?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(zE,{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)(WE,{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 zE({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 BE({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 VE({nodeId:e,nodeKind:t,executionTraceSummary:n}){let{whySelected:r,conditions:i,loops:a,divergences:o,forks:s}=dy(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)(aD,{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)(My,{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)(BE,{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)(My,{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=>!ay(e)),...i.filter(e=>ay(e))].map((e,t)=>{let n=ay(e);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-xs py-0.5`,children:[(0,H.jsx)(My,{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)(My,{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)(BE,{item:e},t))})]}),o.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(My,{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)(BE,{item:e},t))})]}),s.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1.5`,children:(0,H.jsx)(My,{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)(BE,{item:e},t))})]})]})}):(0,H.jsx)(aD,{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)(My,{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 HE({items:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsx)(aD,{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)(My,{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 UE=[{id:`routing`,column:`primary`,render:({detail:e,executionTraceSummary:t})=>t===null?null:(0,H.jsx)(VE,{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)(HE,{items:t},`run_routing`)}},{id:`recap`,column:`primary`,render:({detail:e,runStatus:t,currentNodeId:n})=>e.recapMarkdown?(0,H.jsx)(XE,{markdown:e.recapMarkdown},`recap`):t===`in_progress`&&e.nodeId===n&&!e.recapMarkdown?(0,H.jsx)(GE,{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)(eD,{gaps:e.gaps},`gaps`):null},{id:`advance-outcome`,column:`primary`,render:({detail:e})=>e.advanceOutcome?(0,H.jsx)(ZE,{outcome:e.advanceOutcome},`advance-outcome`):null},{id:`artifacts`,column:`primary`,render:({detail:e})=>e.artifacts.length>0?(0,H.jsx)(iD,{artifacts:e.artifacts},`artifacts`):null},{id:`node-meta`,column:`primary`,render:({detail:e})=>(0,H.jsx)(YE,{detail:e},`node-meta`)}];function WE(e){return(0,H.jsx)(`div`,{className:`space-y-4`,children:UE.map(t=>t.render(e))})}function GE({detail:e}){return(0,H.jsx)(aD,{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)(KE,{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)(qE,{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)(qE,{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)(Uo,{children:`What lands here next`})}),(0,H.jsxs)(`div`,{className:`p-4 grid gap-3 md:grid-cols-3`,children:[(0,H.jsx)(JE,{title:`Recap`,description:`A step summary is written when this node completes.`}),(0,H.jsx)(JE,{title:`Validations`,description:`Validation results appear if this step records contract checks.`}),(0,H.jsx)(JE,{title:`Artifacts`,description:`Generated outputs show up here after the step produces them.`})]})]})]})})}function KE({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 qE({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)(Uo,{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 JE({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)(Uo,{color:`var(--text-secondary)`,children:e}),(0,H.jsx)(`div`,{className:`text-xs text-[var(--text-muted)] leading-relaxed`,children:t})]})}function YE({detail:e}){return(0,H.jsx)(aD,{title:`Node details`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(oD,{label:`Kind`,value:(0,H.jsx)(cD,{kind:e.nodeKind})}),(0,H.jsx)(oD,{label:`Event index`,value:String(e.createdAtEventIndex),mono:!0}),(0,H.jsx)(oD,{label:`Parent`,value:e.parentNodeId??`Root`,mono:!0}),(0,H.jsx)(oD,{label:`Tip state`,value:e.isTip?e.isPreferredTip?`Preferred tip`:`Tip`:`Historical`})]})})}function XE({markdown:e}){return(0,H.jsx)(aD,{title:`Recap`,children:(0,H.jsx)(LE,{children:e})})}function ZE({outcome:e}){let t=e.kind===`advanced`;return(0,H.jsx)(aD,{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)(aD,{title:`Validations (${e.length})`,children:(0,H.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,H.jsx)($E,{validation:e},e.validationId))})})}function $E({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 eD({gaps:e}){return(0,H.jsx)(aD,{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 tD=1e5,nD=[{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 rD(e){if(e.byteLength>tD)return(0,H.jsxs)(`div`,{className:`text-[var(--text-muted)] italic`,children:[`Content too large to display (`,lD(e.byteLength),` -- limit `,lD(tD),`)`]});let t=nD.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 iD({artifacts:e}){return(0,H.jsx)(aD,{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:lD(e.byteLength)})]}),rD(e)]},e.sha256))})})}function aD({title:e,children:t}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-2`,children:(0,H.jsx)(Uo,{children:e})}),t]})}function oD({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)(Uo,{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 sD={step:{label:`Step`,color:`var(--accent)`},checkpoint:{label:`Checkpoint`,color:`var(--success)`},blocked_attempt:{label:`Blocked`,color:`var(--error)`}};function cD({kind:e}){let t=sD[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 lD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function uD(e){return e.length>16?`\u2026${e.slice(-16)}`:e}function dD({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:uD(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 fD(e){if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}function pD({sessionId:e,metrics:t}){let[n,r]=(0,V.useState)({kind:`idle`}),i=Gy(e,!1),a=t.startGitSha!==null&&t.endGitSha!==null,o=async()=>{r({kind:`loading`});try{let e=await i.refetch();e.isSuccess&&e.data?r({kind:`loaded`,linesAdded:e.data.linesAdded,linesRemoved:e.data.linesRemoved,filesChanged:e.data.filesChanged}):r({kind:`error`,message:e.error instanceof Error?e.error.message:`Diff computation failed`})}catch(e){r({kind:`error`,message:e instanceof Error?e.message:`Diff computation failed`})}};return(0,H.jsxs)(`div`,{className:`bg-[var(--bg-card)] border border-[var(--border)] px-5 py-4 corner-brackets space-y-4`,style:{backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`},children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.30em] text-[var(--text-muted)]`,children:`Session Metrics`}),(0,H.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--text-muted)]`,children:`Session-level totals across all runs.`})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.outcome!==null&&(0,H.jsx)(`span`,{className:`px-2 py-1 text-xs font-mono border border-[var(--border)] text-[var(--text-secondary)] bg-[var(--bg-card)]`,children:t.outcome}),t.durationMs!==void 0&&(0,H.jsx)(`span`,{className:`px-2 py-1 text-xs font-mono border border-[var(--border)] text-[var(--text-secondary)] bg-[var(--bg-card)]`,children:fD(t.durationMs)}),t.filesChanged!==null&&(0,H.jsxs)(`span`,{className:`px-2 py-1 text-xs font-mono border border-[var(--border)] text-[var(--text-secondary)] bg-[var(--bg-card)]`,children:[t.filesChanged,` file`,t.filesChanged===1?``:`s`,` changed`]}),t.captureConfidence!==`none`&&(0,H.jsxs)(`span`,{className:`px-2 py-1 text-xs font-mono border border-[var(--border)] text-[var(--text-muted)] bg-[var(--bg-card)]`,children:[t.captureConfidence,` confidence`]})]}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-8 gap-y-2`,children:[t.gitBranch!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Git Branch`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:t.gitBranch})]}),t.startGitSha!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Start SHA`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:t.startGitSha.slice(0,12)})]}),t.endGitSha!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`End SHA`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:t.endGitSha.slice(0,12)})]}),t.durationMs!==void 0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Duration`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)] self-center`,children:fD(t.durationMs)})]}),t.agentCommitShas.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-start`,children:`Commits`}),(0,H.jsx)(`dd`,{className:`font-mono text-xs text-[var(--text-secondary)]`,children:t.agentCommitShas.map(e=>(0,H.jsx)(`div`,{children:e.slice(0,12)},e))})]}),t.outcome!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Outcome`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[t.outcome,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(agent-reported)`})]})]}),t.filesChanged!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Files Changed`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[t.filesChanged,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(agent-reported)`})]})]}),t.linesAdded!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Lines Added`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[t.linesAdded,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(agent-reported)`})]})]}),t.linesRemoved!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`Lines Removed`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[t.linesRemoved,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(agent-reported)`})]})]}),t.prNumbers.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`PRs`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[t.prNumbers.join(`, `),` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(agent-reported)`})]})]}),n.kind===`loaded`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`LOC Added`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[n.linesAdded,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(git diff)`})]}),(0,H.jsx)(`dt`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] self-center`,children:`LOC Removed`}),(0,H.jsxs)(`dd`,{className:`text-xs text-[var(--text-secondary)] self-center`,children:[n.linesRemoved,` `,(0,H.jsx)(`span`,{className:`text-[var(--text-muted)]`,children:`(git diff)`})]})]})]}),a&&n.kind!==`loaded`&&(0,H.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[n.kind===`idle`&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{o()},className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)] hover:text-[var(--text-primary)] border border-[var(--border)] px-3 py-1.5 transition-colors`,children:`Load diff`}),n.kind===`loading`&&(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.25em] text-[var(--text-muted)]`,children:`Computing...`}),n.kind===`error`&&(0,H.jsxs)(`span`,{className:`text-xs text-[var(--error)]`,children:[n.message,` `,(0,H.jsx)(`button`,{type:`button`,onClick:()=>{o()},className:`underline text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors`,children:`Retry`})]})]})]})}function mD({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 hD({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)(dD,{data:a}),a.metrics!==null&&(0,H.jsx)(pD,{sessionId:i,metrics:a.metrics}),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)(mD,{runs:a.runs}),(0,H.jsx)(`div`,{className:`space-y-6`,children:a.runs.map(e=>(0,H.jsx)(gD,{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)(RE,{sessionId:i,nodeId:o?.nodeId??null,runStatus:s?.status??`complete`,currentNodeId:s?.preferredTipNodeId??null,executionTraceSummary:s?.executionTraceSummary??null})})]})]})}function gD({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)(Ry,{summary:e.executionTraceSummary,runStatus:e.status}):(0,H.jsx)(fy,{run:e,selectedNodeId:t,onNodeClick:t=>n(e.runId,t)})})]})}function _D(){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 vD=[{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`}],yD=Object.fromEntries(vD.map(e=>[e.id,e.label]));function bD({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 xD({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 SD({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)(OD,{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)(OD,{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)(xD,{segments:n?[{label:`Workflows`,onClick:r},{label:n}]:[{label:`Workflows`,onClick:r}]}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(CD,{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)(ED,{})})]}):(0,H.jsx)(DD,{})]})}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)(xD,{segments:s?[{label:`Workflows`,onClick:u},{label:s}]:[{label:`Workflows`,onClick:u}]}),(0,H.jsx)(CD,{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)(wD,{detail:n,name:r}),(0,H.jsx)(xD,{segments:[{label:`Workflows`,onClick:u}]})]})}function CD({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 wD({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)(LE,{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)(TD,{name:t})]}):(0,H.jsx)(`p`,{className:`text-sm text-[var(--text-muted)] italic`,children:`No additional documentation available.`})}function TD({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 ED(){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 DD(){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)(ED,{})]})}function OD({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 kD(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 AD(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 jD(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 MD({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`?kD(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=AD(t,1,e,r);break;case`ArrowLeft`:case`a`:case`A`:o=AD(t,-1,e,r);break;case`ArrowDown`:case`s`:case`S`:o=jD(t,1,e,a,r);break;case`ArrowUp`:case`w`:case`W`:o=jD(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 ND(e){let t=Yy(e),n=()=>{t.refetch()};return t.isLoading?{kind:`loading`}:t.error?t.error instanceof By&&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 PD(){let e=qy();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 FD(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 ID({workflowId:e,activeTag:t,onBack:n,onNavigateToWorkflow:r}){let i=ND(e),a=PD().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)(()=>FD(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?yD[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 LD(e){let t=new Set(vD.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=vD.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 RD({viewModel:e}){let{state:t,dispatch:n,triggerRef:r,onCardSelect:i}=e,a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=_D(),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)(HD,{});if(t.kind===`error`)return(0,H.jsx)(UD,{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(vD.map(e=>e.id)),v=new Set(h.flatMap(e=>e.tags)),y=new Map(vD.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)(zD,{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 zD({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=ID({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}=MD({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)(BD,{label:`All`,count:u,isActive:t===null,disabled:!1,onClick:()=>m({type:`tag_changed`,tag:null})}),vD.filter(e=>s.has(e.id)).map(e=>(0,H.jsx)(BD,{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)(BD,{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)(BD,{label:`All Sources`,count:d,isActive:n===null,disabled:!1,onClick:()=>m({type:`source_changed`,source:null})}),o.map(e=>(0,H.jsx)(BD,{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 LD(i).map(n=>(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(bD,{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)(VD,{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)(bD,{label:t===`__other__`?`Other`:yD[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)(VD,{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)(SD,{viewModel:y})]})]})})]})]})}function BD({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 VD({workflow:e,onSelect:t,navProps:n,isActive:r}){let i=e.tags.filter(e=>e!==`routines`).map(e=>yD[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 HD(){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 UD({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 WD=[{value:`recent`,label:`Recent first`,compareFn:(e,t)=>t.startedAtMs-e.startedAtMs},{value:`slowest`,label:`Slowest first`,compareFn:(e,t)=>t.durationMs-e.durationMs}],GD={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 KD(e,t){let n=WD.find(e=>e.value===t);return[...e].sort(n.compareFn)}function qD(e){return e.reduce((e,t)=>Math.max(e,t.durationMs),0)}function JD(e){return e.filter(e=>GD[e.outcome].isError).length}function YD(e){return e.length===0?null:Math.round(e.reduce((e,t)=>e+t.durationMs,0)/e.length)}function XD(e){return e.length===0?null:e.reduce((e,t)=>Math.max(e,t.startedAtMs),0)}function ZD(e,t){return t>0?Math.round(e/t*120):0}function QD(e){return`${e} recorded`}var $D=[{key:`tool`,label:`Tool`,minWidth:`180px`},{key:`duration`,label:`Duration`,width:`220px`},{key:`started`,label:`Started`,width:`100px`},{key:`outcome`,label:`Outcome`}];function eO({viewModel:e}){let{state:t}=e;if(t.kind===`loading`)return(0,H.jsx)(iO,{});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`:W(o)]}),(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":`Sort order`,className:`flex items-center gap-1`,children:WD.map(e=>(0,H.jsx)(rO,{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:$D.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:$D.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)(tO,{obs:e,maxDuration:r},`${e.startedAtMs}-${e.toolName}-${t}`))})]})]})}function tO({obs:e,maxDuration:t}){let n=GD[e.outcome].isError,r=ZD(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:W(e.startedAtMs)}),(0,H.jsx)(`td`,{className:`py-2`,children:(0,H.jsx)(nO,{outcome:e.outcome})})]})}function nO({outcome:e}){let t=GD[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 rO({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 iO(){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 aO=`workrail:auto:mru-workflow`;function oO(){try{return localStorage.getItem(aO)}catch{return null}}function sO(e){try{localStorage.setItem(aO,e)}catch{}}function cO(){let e=qy(),t=Xy(),n=e.data?.workflows??[],r=t.data?.triggers??[],[i,a]=(0,V.useState)(()=>oO()??``),[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),sO(e)},b=async()=>{if(!(!i||!c.trim()||!o.trim())){d(!0),p(null),h(!1);try{await Zy({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)(Uo,{color:`var(--accent)`,children:`Dispatch`})}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Uo,{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)(Uo,{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)(Uo,{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 lO(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 uO(){let{data:e,isLoading:t,isError:n}=Hy(),r=(e?.sessions??[]).filter(e=>e.isAutonomous),{running:i,blocked:a,completed:o}=lO(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)(Uo,{color:`var(--accent)`,children:`Queue`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(dO,{count:i,label:`RUNNING`,color:`var(--accent)`,pulse:!0}),(0,H.jsx)(dO,{count:a,label:`BLOCKED`,color:`var(--blocked)`}),(0,H.jsx)(dO,{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)(fO,{session:e},e.sessionId))})]})}function dO({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 fO({session:e}){let[t,n]=(0,V.useState)(!1),r=xi(),i=e.sessionTitle??e.workflowName??e.workflowId??`Unnamed session`,a=W(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 pO(){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)(cO,{})}),(0,H.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,H.jsx)(uO,{})})]})}function mO(){let e=Hy(),t=Ky();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 hO={scope:`active`,focusedIndex:-1,archive:null};function gO(e){throw Error(`Unhandled WorkspaceEvent type: ${String(e.type)}`)}function _O(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 gO(t)}}var vO=720*60*60*1e3,yO={in_progress:0,dormant:0,blocked:1,complete_with_gaps:2,complete:3};function bO(e){if(e.length!==0)return[...e].sort((e,t)=>{let n=yO[e.status]-yO[t.status];return n===0?t.lastModifiedMs-e.lastModifiedMs:n})[0]}function xO(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<vO||t===`all`?`visible`:`hidden`}function SO(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 CO(e,t,n){return[...e].filter(e=>xO(e,t,n)===`visible`).sort((e,t)=>{let n=SO(e)-SO(t);return n===0?t.activityMs-e.activityMs:n})}function wO(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=bO(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 TO(e,t,n,r){let i=wO(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:CO(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 EO({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 DO(e=!1){let t=xi(),n=mO(),[r,i]=(0,V.useReducer)(_O,hO),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?TO(n.sessions,n.worktreeRepos,r.scope,Date.now()):null,[n.sessions,n.worktreeRepos,r.scope]);EO({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 OO(){let e=Hy();return{sessions:e.data?.sessions,isLoading:e.isLoading,error:e.error instanceof Error?e.error:null}}function kO(e=``){return{rawSearch:e,sort:`recent`,groupBy:`none`,statusFilter:`all`,page:0,viewMode:`flat`}}function AO(e){throw Error(`Unhandled SessionListEvent type: ${String(e.type)}`)}function jO(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};case`view_mode_changed`:return t.viewMode===`tree`?{...e,viewMode:`tree`,rawSearch:``,statusFilter:`all`,page:0}:{...e,viewMode:`flat`,page:0};default:return AO(t)}}var MO={in_progress:0,blocked:1,dormant:2,complete_with_gaps:3,complete:4},NO=[{value:`recent`,label:`Recent`,compareFn:(e,t)=>t.lastModifiedMs-e.lastModifiedMs},{value:`status`,label:`Status`,compareFn:(e,t)=>MO[e.status]-MO[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}],PO=[{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)=>(MO[e]??99)-(MO[t]??99)},{value:`branch`,label:`Branch`,keyFn:e=>e.gitBranch??`No branch`}],FO=[{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 IO(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 LO(e,t){let n=NO.find(e=>e.value===t)??NO[0];return[...e].sort(n.compareFn)}function RO(e,t){let n=PO.find(e=>e.value===t)??PO[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 zO(e){let t={all:e.length};for(let n of e)t[n.status]=(t[n.status]??0)+1;return t}function BO(e){let t=new Set(e.map(e=>e.sessionId)),n=new Map,r=new Set,i=new Set;for(let a of e){let e=a.parentSessionId;if(!e||e===a.sessionId)continue;if(!t.has(e)){r.add(a.sessionId);continue}i.add(a.sessionId);let o=n.get(e)??[];o.push(a),n.set(e,o)}let a=[];for(let t of e)i.has(t.sessionId)||a.push({session:t,children:n.get(t.sessionId)??[]});return{roots:a,orphanChildIds:r}}function VO(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 HO({onSelectSession:e,initialSearch:t=``}){let n=OO(),[r,i]=(0,V.useReducer)(jO,void 0,()=>kO(t)),a=VO(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?zO(c):{},[c]),f=(0,V.useMemo)(()=>{if(!c)return null;let e=IO(c,a,r.statusFilter);return{groups:RO(LO(e,r.sort),r.groupBy),total:c.length,filtered:e.length}},[c,a,r.statusFilter,r.sort,r.groupBy]),p=(0,V.useMemo)(()=>BO(c||[]),[c]),m=r.groupBy!==`none`,h=f?Math.ceil(f.filtered/25):0,g=r.page*25,_=g+25,v=(0,V.useMemo)(()=>!f||m?[]:f.groups[0]?.sessions.slice(g,_)??[],[f,m,g,_]);o.current=v;let{getItemProps:y,containerProps:b}=MD({count:v.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:h,isGrouped:m,processed:f,statusCounts:d,flatPageSessions:v,getSessionNavProps:y,sessionContainerProps:b,sortAxes:NO,groupAxes:PO,statusFilterOptions:FO,viewMode:r.viewMode,sessionTree:p}:{kind:`loading`},[l,u,f,r,h,m,d,v,y,b,p]),dispatch:i,onSelectSession:e}}var UO={selectedWorkflowId:null,selectedTag:null,selectedSource:null,hintVisible:!1};function WO(e){throw Error(`Unhandled WorkflowsEvent type: ${String(e.type)}`)}function GO(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 WO(t)}}function KO(e){let t=new Set;for(let n of e)for(let e of n.tags)e!==`routines`&&t.add(e);let n=vD.map(e=>e.id).filter(e=>t.has(e)),r=[...t].filter(e=>!vD.some(t=>t.id===e)).sort();return[...n,...r]}function qO(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 JO(e,t,n){let r=new Set(vD.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 YO(e,t){if(t!==null)return e;let n=new Set(vD.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 vD){let t=r.get(e);t&&a.push(...t)}return a.push(...i),a}function XO({initialTag:e,onSelectTag:t}){let n=PD(),[r,i]=(0,V.useReducer)(GO,{...UO,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=KO(l),t=qO(l),i=JO(l,r.selectedTag,r.selectedSource),a=YO(i,r.selectedTag),o=JO(l,null,r.selectedSource),u=JO(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 ZO(){let e=Jy();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 QO(){let e=ZO(),[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=KD(r,t);return{kind:`ready`,sorted:i,maxDuration:qD(i),errorCount:JD(r),avgMs:YD(r),lastCallMs:XD(r),countLabel:QD(r.length),sortOrder:t,onSortChange:n}},[e,t])}}function $O(e){let t=Uy(e);return{data:t.data,isLoading:t.isLoading,error:t.error instanceof Error?t.error:null}}function ek(e){let t=$O(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 tk=[{id:`workspace`,path:`/`},{id:`workflows`,path:`/workflows`},{id:`auto`,path:`/auto`},{id:`perf`,path:`/perf`}];function nk(){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=DO(l),h=HO({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=XO({initialTag:p,onSelectTag:y}),C=ID({workflowId:f,activeTag:p,onBack:b,onNavigateToWorkflow:x}),w=ek(d??``),T=QO(),[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=tk.findIndex(e=>e.id===c),r=tk[t.key===`ArrowRight`?(n+1)%tk.length:(n-1+tk.length)%tk.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.65.0`]})]})]}),l&&d?(0,H.jsx)(`nav`,{className:`flex items-center flex-1 justify-center`,children:(0,H.jsx)(xD,{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)(wo,{viewModel:m,sessionListViewModel:h,hidden:l}),l&&d&&(0,H.jsx)(hD,{viewModel:w})]}),c===`workflows`&&(0,H.jsx)(`div`,{id:`panel-workflows`,role:`tabpanel`,"aria-labelledby":`tab-workflows`,children:u&&f?(0,H.jsx)(SD,{viewModel:C}):(0,H.jsx)(RD,{viewModel:S})}),c===`auto`&&(0,H.jsx)(`div`,{id:`panel-auto`,role:`tabpanel`,"aria-labelledby":`tab-auto`,children:(0,H.jsx)(pO,{})}),c===`perf`&&(0,H.jsx)(`div`,{id:`panel-perf`,role:`tabpanel`,"aria-labelledby":`tab-perf`,children:(0,H.jsx)(eO,{viewModel:T})})]})]})}var rk=zi({component:nk}),ik=Li({getParentRoute:()=>rk,path:`/`,component:()=>null}),ak=Li({getParentRoute:()=>rk,path:`/session/$sessionId`,component:()=>null}),ok=Li({getParentRoute:()=>rk,path:`/workflows`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),sk=Li({getParentRoute:()=>rk,path:`/workflows/$workflowId`,validateSearch:e=>({tag:typeof e.tag==`string`?e.tag:void 0}),component:()=>null}),ck=Li({getParentRoute:()=>rk,path:`/perf`,component:()=>null}),lk=Li({getParentRoute:()=>rk,path:`/auto`,component:()=>null}),uk=ea({routeTree:rk.addChildren([ik,ak,ok,sk,ck,lk]),history:hr()}),dk=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:dk,children:(0,H.jsx)(ra,{router:uk})})}));
|