@open-mercato/cezar 0.9.0-pr646.708 → 0.9.0-pr647.716
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/runs/store.d.ts +6 -0
- package/dist/runs/store.js +14 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/server/server.js +3 -2
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/run.d.ts +2 -14
- package/dist/workflows/run.js +7 -23
- package/dist/workflows/run.js.map +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{compare-variants-B5BlnpUb.js → compare-variants-BR6ZhIbj.js} +1 -1
- package/web/dist/assets/{diff-view-CYKPGL2w.js → diff-view-CNqm5bjB.js} +3 -3
- package/web/dist/assets/{git-toolbar-CDII-3Uv.js → git-toolbar-A1hGl9ke.js} +1 -1
- package/web/dist/assets/github-CNdzanog.js +1 -0
- package/web/dist/assets/{index-CcfkF2Ey.js → index-MN3Lxn3t.js} +9 -9
- package/web/dist/assets/{repo-git-4l-2tm7d.js → repo-git-BVbeQnIX.js} +1 -1
- package/web/dist/assets/{run-diff-Cksr4Dk5.js → run-diff-BGNJAOm7.js} +1 -1
- package/web/dist/assets/run-header-fLV2ZvNw.js +1 -0
- package/web/dist/assets/{skills-D7hPgl4y.js → skills-DbXoq215.js} +1 -1
- package/web/dist/assets/{task-changes-DvIUGL9a.js → task-changes-CVIoIFuR.js} +1 -1
- package/web/dist/assets/{task-commits-QD2JI3zj.js → task-commits-DwIx0CP-.js} +1 -1
- package/web/dist/assets/{task-files-BE7JDEwK.js → task-files-tHtq2G2M.js} +2 -2
- package/web/dist/assets/{task-thread-CRjuPhsl.js → task-thread-D5physox.js} +5 -5
- package/web/dist/assets/{use-desktop-4e8LLqMG.js → use-desktop-DDySz-Hn.js} +2 -2
- package/web/dist/assets/workflows-mVvkUyVO.js +11 -0
- package/web/dist/index.html +1 -1
- package/web/dist/assets/github-C7SNDPf3.js +0 -1
- package/web/dist/assets/run-header-B3kW2sWC.js +0 -1
- package/web/dist/assets/workflows-bPYx0nbO.js +0 -11
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-
|
|
2
|
-
import{a as e,i as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{a as i}from"./centered-state-CLmJ67EV.js";import{r as a,t as o}from"./utils-B8s5qIcK.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CNqm5bjB.js","assets/bundle-mjs-BegPhL5c.js","assets/utils-B8s5qIcK.js","assets/index-MN3Lxn3t.js","assets/centered-state-CLmJ67EV.js","assets/search-x-BDjaMrzG.js","assets/triangle-alert-Uy8rokUh.js","assets/textarea-Bj_LCreg.js","assets/dist-CqH67S8q.js","assets/project-router-BaWVyqc8.js","assets/chunk-BO2N2NFS-DtrdTCWa.js","assets/lib-uHpeUPzK.js","assets/index-DzroxqBG.css","assets/lib-DPEZDBUN.js","assets/image-preview-DEhW0TFz.js","assets/zoomable-image-PEDOqyLQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,i as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{a as i}from"./centered-state-CLmJ67EV.js";import{r as a,t as o}from"./utils-B8s5qIcK.js";import{rt as s,tn as c}from"./index-MN3Lxn3t.js";import{n as l,t as u}from"./image-preview-DEhW0TFz.js";var d=a(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),f=a(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),p=e();function m({mode:e,wrap:t,onModeChange:n,onWrapChange:r}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,p.jsx)(h,{current:e,value:`unified`,onModeChange:n}),(0,p.jsx)(h,{current:e,value:`split`,onModeChange:n})]}),(0,p.jsx)(i,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:o(t&&`bg-muted text-foreground`),onClick:()=>r(!t),children:(0,p.jsx)(f,{"aria-hidden":`true`})})]})}function h({current:e,value:t,onModeChange:n}){let r=e===t;return(0,p.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:o(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function g({branch:e}){return(0,p.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,p.jsx)(c,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,p.jsx)(`span`,{className:`truncate`,children:e})]})}var _=r(n(),1);function v(e){let[n,r]=(0,_.useState)(null);return(0,_.useEffect)(()=>{let e=!1;return t(()=>import(`./diff-view-CNqm5bjB.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),()=>{e=!0}},[]),e.files.length===0?(0,p.jsx)(`p`,{"data-slot":`diff-empty`,className:o(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,p.jsx)(y,{...e}):n===null?(0,p.jsx)(`p`,{"data-slot":`diff-loading`,className:o(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,p.jsx)(n.View,{...e})}function y({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:r,viewRef:i,className:a}){let c={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},l=(0,_.useRef)(null);return(0,_.useImperativeHandle)(i,()=>({scrollToPath:e=>{for(let t of l.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,p.jsxs)(`div`,{ref:l,"data-slot":`diff`,"data-fallback":`true`,className:o(`flex min-w-0 flex-col gap-3`,a),children:[(0,p.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,p.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,p.jsx)(s,{stat:c})]}),e.map(e=>(0,p.jsx)(b,{file:e,wrap:t,imageSrc:n,onOpenInApp:r},`${e.oldPath??``}→${e.path}`))]})}function b({file:e,wrap:t,imageSrc:n,onOpenInApp:r}){return(0,p.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,p.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,p.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,p.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,p.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),l(e)?(0,p.jsx)(u,{file:e,imageSrc:n,onOpenInApp:r}):e.binary?(0,p.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,p.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,p.jsx)(`pre`,{className:o(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
3
|
`).map((e,t)=>(0,p.jsxs)(`span`,{className:o(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}function x(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{d as a,m as i,v as n,g as r,x as t};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as e,o as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{A as i,At as a,Ht as o,Ot as s,a as c,fn as l,ft as u,i as d,k as f,mn as p,mt as m,t as h,un as g,ut as _,yt as v,zt as y}from"./centered-state-CLmJ67EV.js";import{r as b,t as x}from"./utils-B8s5qIcK.js";import{n as S,t as C}from"./trash-2-DAyZ0VSi.js";import{n as w,r as ee}from"./skill-empty-hint-DTUSp6Vl.js";import{t as te}from"./square-terminal-Ckjjn0vb.js";import{t as T}from"./triangle-alert-Uy8rokUh.js";import{t as ne}from"./upload-CDdyPPo_.js";import{n as E,t as re}from"./textarea-Bj_LCreg.js";import{Jt as ie,St as ae,Zt as D,_ as oe,bt as se,c as O,cn as ce,d as le,en as ue,f as k,g as de,h as A,m as fe,p as j,u as pe,zt as M}from"./index-MN3Lxn3t.js";var me=b(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),N=r(t()),P=r(n());function he(){var e=[...arguments];return(0,P.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var F=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function I(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function L(e){return`nodeType`in e}function R(e){return e?I(e)?e:L(e)?e.ownerDocument?.defaultView??window:window:window}function z(e){let{Document:t}=R(e);return e instanceof t}function ge(e){return!I(e)&&e instanceof R(e).HTMLElement}function _e(e){return e instanceof R(e).SVGElement}function B(e){return e?I(e)?e.document:L(e)?z(e)?e:ge(e)||_e(e)?e.ownerDocument:document:document:document}var V=F?P.useLayoutEffect:P.useEffect;function ve(e){let t=(0,P.useRef)(e);return V(()=>{t.current=e}),(0,P.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function ye(){let e=(0,P.useRef)(null);return[(0,P.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,P.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function be(e,t){t===void 0&&(t=[e]);let n=(0,P.useRef)(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function H(e,t){let n=(0,P.useRef)();return(0,P.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function U(e){let t=ve(e),n=(0,P.useRef)(null);return[n,(0,P.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function xe(e){let t=(0,P.useRef)();return(0,P.useEffect)(()=>{t.current=e},[e]),t.current}var W={};function Se(e,t){return(0,P.useMemo)(()=>{if(t)return t;let n=W[e]==null?0:W[e]+1;return W[e]=n,e+`-`+n},[e,t])}function Ce(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var we=Ce(1),Te=Ce(-1);function Ee(e){return`clientX`in e&&`clientY`in e}function G(e){if(!e)return!1;let{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function De(e){if(!e)return!1;let{TouchEvent:t}=R(e.target);return t&&e instanceof t}function Oe(e){if(De(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ee(e)?{x:e.clientX,y:e.clientY}:null}var K=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ke=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ae(e){return e.matches(ke)?e:e.querySelector(ke)}var je={display:`none`};function Me(e){let{id:t,value:n}=e;return P.createElement(`div`,{id:t,style:je},n)}function Ne(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return P.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Pe(){let[e,t]=(0,P.useState)(``);return{announce:(0,P.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Fe=(0,P.createContext)(null);function Ie(e){let t=(0,P.useContext)(Fe);(0,P.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Le(){let[e]=(0,P.useState)(()=>new Set),t=(0,P.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,P.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Re={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},ze={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Be(e){let{announcements:t=ze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Re}=e,{announce:a,announcement:o}=Pe(),s=Se(`DndLiveRegion`),[c,l]=(0,P.useState)(!1);if((0,P.useEffect)(()=>{l(!0)},[]),Ie((0,P.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=P.createElement(P.Fragment,null,P.createElement(Me,{id:r,value:i.draggable}),P.createElement(Ne,{id:s,announcement:o}));return n?(0,N.createPortal)(u,n):u}var q;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(q||={});function Ve(){}function He(e,t){return(0,P.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ue(){var e=[...arguments];return(0,P.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function We(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ge(e,t){let n=Oe(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ke(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Je(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Ye(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Xe(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Ze=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Xe(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=We(Xe(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ke)},Qe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Je(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Je(r),o=i.reduce((e,t,r)=>e+We(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Ke)};function $e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var et=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(qe)};function tt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function rt(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var it=rt(1);function at(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ot(e,t,n){let r=at(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var st={ignoreTransform:!1};function ct(e,t){t===void 0&&(t=st);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=R(e).getComputedStyle(e);t&&(n=ot(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function lt(e){return ct(e,{ignoreTransform:!0})}function ut(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function dt(e,t){return t===void 0&&(t=R(e).getComputedStyle(e)),t.position===`fixed`}function ft(e,t){t===void 0&&(t=R(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function pt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(z(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ge(i)||_e(i)||n.includes(i))return n;let a=R(e).getComputedStyle(i);return i!==e&&ft(i,a)&&n.push(i),dt(i,a)?n:r(i.parentNode)}return e?r(e):n}function mt(e){let[t]=pt(e,1);return t??null}function ht(e){return!F||!e?null:I(e)?e:L(e)?z(e)||e===B(e).scrollingElement?window:ge(e)?e:null:null}function gt(e){return I(e)?e.scrollX:e.scrollLeft}function _t(e){return I(e)?e.scrollY:e.scrollTop}function vt(e){return{x:gt(e),y:_t(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function yt(e){return!F||!e?!1:e===document.scrollingElement}function bt(e){let t={x:0,y:0},n=yt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var xt={x:.2,y:.2};function St(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=xt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ct(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wt(e){return e.reduce((e,t)=>we(e,vt(t)),J)}function Tt(e){return e.reduce((e,t)=>e+gt(t),0)}function Et(e){return e.reduce((e,t)=>e+_t(t),0)}function Dt(e,t){if(t===void 0&&(t=ct),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);mt(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ot=[[`x`,[`left`,`right`],Tt],[`y`,[`top`,`bottom`],Et]],kt=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=pt(t),r=wt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ot)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},At=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function jt(e){let{EventTarget:t}=R(e);return e instanceof t?e:B(e)}function Mt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function Nt(e){e.preventDefault()}function Pt(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var Ft={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},It=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},Lt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new At(B(t)),this.windowListeners=new At(R(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Dt(n),t(J)}handleKeyDown(e){if(G(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ft,coordinateGetter:a=It,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Te(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=bt(n),p=Ct(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,we(Te(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Lt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ft,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Rt(e){return!!(e&&`distance`in e)}function zt(e){return!!(e&&`delay`in e)}var Bt=class{constructor(e,t,n){n===void 0&&(n=jt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=B(i),this.documentListeners=new At(this.document),this.listeners=new At(n),this.windowListeners=new At(R(i)),this.initialCoordinates=Oe(r)??J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,Nt),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,Nt),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Rt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(X.Click,Pt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Oe(e)??J,s=Te(n,o);if(!t&&a){if(Rt(a)){if(a.tolerance!=null&&Mt(s,a.tolerance))return this.handleCancel();if(Mt(s,a.distance))return this.handleStart()}if(zt(a)&&Mt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Vt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Ht=class extends Bt{constructor(e){let{event:t}=e,n=B(t.target);super(e,Vt,n)}};Ht.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ut={move:{name:`mousemove`},end:{name:`mouseup`}},Wt;(function(e){e[e.RightClick=2]=`RightClick`})(Wt||={});var Gt=class extends Bt{constructor(e){super(e,Ut,B(e.event.target))}};Gt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Wt.RightClick?!1:(r?.({event:n}),!0)}}];var Kt={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},qt=class extends Bt{constructor(e){super(e,Kt)}static setup(){return window.addEventListener(Kt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Kt.move.name,e)};function e(){}}};qt.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Jt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Jt||={});var Yt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Yt||={});function Xt(e){let{acceleration:t,activator:n=Jt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Yt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Qt({delta:d,disabled:!a}),[m,h]=ye(),g=(0,P.useRef)({x:0,y:0}),_=(0,P.useRef)({x:0,y:0}),v=(0,P.useMemo)(()=>{switch(n){case Jt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Jt.DraggableRect:return i}},[n,i,c]),y=(0,P.useRef)(null),b=(0,P.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,P.useMemo)(()=>s===Yt.TreeOrder?[...l].reverse():l,[s,l]);(0,P.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=St(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Zt={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function Qt(e){let{delta:t,disabled:n}=e,r=xe(t);return H(e=>{if(n||!r||!e)return Zt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function $t(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return H(e=>t==null?null:r??e??null,[r,t])}function en(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var tn;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(tn||={});var nn;(function(e){e.Optimized=`optimized`})(nn||={});var rn=new Map;function an(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,P.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,P.useRef)(e),d=g(),f=be(d),p=(0,P.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,P.useRef)(null),h=H(t=>{if(d&&!n)return rn;if(!t||t===rn||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new kt(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,P.useEffect)(()=>{u.current=e},[e]),(0,P.useEffect)(()=>{d||p()},[n,d]),(0,P.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,P.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case tn.Always:return!1;case tn.BeforeDragging:return n;default:return!n}}}function on(e,t){return H(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function sn(e,t){return on(e,t)}function cn(e){let{callback:t,disabled:n}=e,r=ve(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ln(e){let{callback:t,disabled:n}=e,r=ve(t),i=(0,P.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,P.useEffect)(()=>()=>i?.disconnect(),[i]),i}function un(e){return new kt(ct(e),e)}function dn(e,t,n){t===void 0&&(t=un);let[r,i]=(0,P.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=cn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ln({callback:a});return V(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function fn(e){return nt(e,on(e))}var pn=[];function mn(e){let t=(0,P.useRef)(e),n=H(n=>e?n&&n!==pn&&e&&t.current&&e.parentNode===t.current.parentNode?n:pt(e):pn,[e]);return(0,P.useEffect)(()=>{t.current=e},[e]),n}function hn(e){let[t,n]=(0,P.useState)(null),r=(0,P.useRef)(e),i=(0,P.useCallback)(e=>{let t=ht(e.target);t&&n(e=>e?(e.set(t,vt(t)),new Map(e)):null)},[]);return(0,P.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ht(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,vt(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ht(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,P.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>we(e,t),J):wt(e):J,[e,t])}function gn(e,t){t===void 0&&(t=[]);let n=(0,P.useRef)(null);return(0,P.useEffect)(()=>{n.current=null},t),(0,P.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Te(e,n.current):J}function _n(e){(0,P.useEffect)(()=>{if(!F)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function vn(e,t){return(0,P.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function yn(e){return(0,P.useMemo)(()=>e?ut(e):null,[e])}var bn=[];function xn(e,t){t===void 0&&(t=ct);let[n]=e,r=yn(n?R(n):null),[i,a]=(0,P.useState)(bn);function o(){a(()=>e.length?e.map(e=>yt(e)?r:new kt(t(e),e)):bn)}let s=ln({callback:o});return V(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Sn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ge(t)?t:e}function Cn(e){let{measure:t}=e,[n,r]=(0,P.useState)(null),i=ln({callback:(0,P.useCallback)(e=>{for(let{target:n}of e)if(ge(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=U((0,P.useCallback)(e=>{let n=Sn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,P.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var wn=[{sensor:Ht,options:{}},{sensor:Lt,options:{}}],Tn={current:{}},En={draggable:{measure:lt},droppable:{measure:lt,strategy:tn.WhileDragging,frequency:nn.Optimized},dragOverlay:{measure:ct}},Dn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},On={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:En,measureDroppableContainers:Ve,windowRect:null,measuringScheduled:!1},kn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Ve,draggableNodes:new Map,over:null,measureDroppableContainers:Ve},An=(0,P.createContext)(kn),jn=(0,P.createContext)(On);function Mn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Dn}}}function Nn(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Dn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Dn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Dn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Pn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,P.useContext)(An),a=xe(r),o=xe(n?.id);return(0,P.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!G(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ae(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Fn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function In(e){return(0,P.useMemo)(()=>({draggable:{...En.draggable,...e?.draggable},droppable:{...En.droppable,...e?.droppable},dragOverlay:{...En.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ln(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,P.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;V(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=nt(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=mt(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Rn=(0,P.createContext)({...J,scaleX:1,scaleY:1}),zn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(zn||={});var Bn=(0,P.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=wn,collisionDetection:o=et,measuring:s,modifiers:c,...l}=e,[u,d]=(0,P.useReducer)(Nn,void 0,Mn),[f,p]=Le(),[m,h]=(0,P.useState)(zn.Uninitialized),g=m===zn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,P.useRef)({initial:null,translated:null}),C=(0,P.useMemo)(()=>_==null?null:{id:_,data:x?.data??Tn,rect:S},[_,x]),w=(0,P.useRef)(null),[ee,te]=(0,P.useState)(null),[T,ne]=(0,P.useState)(null),E=be(l,Object.values(l)),re=Se(`DndDescribedBy`,t),ie=(0,P.useMemo)(()=>b.getEnabled(),[b]),ae=In(s),{droppableRects:D,measureDroppableContainers:oe,measuringScheduled:se}=an(ie,{dragging:g,dependencies:[y.x,y.y],config:ae.droppable}),O=$t(v,_),ce=(0,P.useMemo)(()=>T?Oe(T):null,[T]),le=Ae(),ue=sn(O,ae.draggable.measure);Ln({activeNode:_==null?null:v.get(_),config:le.layoutShiftCompensation,initialRect:ue,measure:ae.draggable.measure});let k=dn(O,ae.draggable.measure,ue),de=dn(O?O.parentElement:null),A=(0,P.useRef)({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=b.getNodeFor(A.current.over?.id),j=Cn({measure:ae.dragOverlay.measure}),pe=j.nodeRef.current??O,M=g?j.rect??k:null,me=!!(j.nodeRef.current&&j.rect),he=fn(me?null:k),F=yn(pe?R(pe):null),I=mn(g?fe??O:null),L=xn(I),z=Fn(c,{transform:{x:y.x-he.x,y:y.y-he.y,scaleX:1,scaleY:1},activatorEvent:T,active:C,activeNodeRect:k,containerNodeRect:de,draggingNodeRect:M,over:A.current.over,overlayNodeRect:j.rect,scrollableAncestors:I,scrollableAncestorRects:L,windowRect:F}),ge=ce?we(ce,y):null,_e=hn(I),B=gn(_e),ve=gn(_e,[k]),ye=we(z,B),H=M?it(M,z):null,U=C&&H?o({active:C,collisionRect:H,droppableRects:D,droppableContainers:ie,pointerCoordinates:ge}):null,xe=Ye(U,`id`),[W,Ce]=(0,P.useState)(null),Te=tt(me?z:we(z,ve),W?.rect??null,k),Ee=(0,P.useRef)(null),G=(0,P.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:A,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=E.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=E.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=E.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,N.unstable_batchedUpdates)(()=>{r?.(i),h(zn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),te(Ee.current),ne(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});Ee.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=A.current,o=null;if(t&&i){let{cancelDrop:s}=E.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}w.current=null,(0,N.unstable_batchedUpdates)(()=>{d({type:e}),h(zn.Uninitialized),Ce(null),te(null),ne(null),Ee.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=E.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),De=en(a,(0,P.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,G(n,t))},[v,G]));_n(a),V(()=>{k&&m===zn.Initializing&&h(zn.Initialized)},[k,m]),(0,P.useEffect)(()=>{let{onDragMove:e}=E.current,{active:t,activatorEvent:n,collisions:r,over:i}=A.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};(0,N.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ye.x,ye.y]),(0,P.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=A.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=E.current,o=r.get(xe),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,N.unstable_batchedUpdates)(()=>{Ce(s),a?.(c),f({type:`onDragOver`,event:c})})},[xe]),V(()=>{A.current={activatorEvent:T,active:C,activeNode:O,collisionRect:H,collisions:U,droppableRects:D,draggableNodes:v,draggingNode:pe,draggingNodeRect:M,droppableContainers:b,over:W,scrollableAncestors:I,scrollAdjustedTranslate:ye},S.current={initial:M,translated:H}},[C,O,U,H,v,pe,M,D,b,W,I,ye]),Xt({...le,delta:y,draggingRect:H,pointerCoordinates:ge,scrollableAncestors:I,scrollableAncestorRects:L});let K=(0,P.useMemo)(()=>({active:C,activeNode:O,activeNodeRect:k,activatorEvent:T,collisions:U,containerNodeRect:de,dragOverlay:j,draggableNodes:v,droppableContainers:b,droppableRects:D,over:W,measureDroppableContainers:oe,scrollableAncestors:I,scrollableAncestorRects:L,measuringConfiguration:ae,measuringScheduled:se,windowRect:F}),[C,O,k,T,U,de,j,v,b,D,W,oe,I,L,ae,se,F]),ke=(0,P.useMemo)(()=>({activatorEvent:T,activators:De,active:C,activeNodeRect:k,ariaDescribedById:{draggable:re},dispatch:d,draggableNodes:v,over:W,measureDroppableContainers:oe}),[T,De,C,k,d,re,v,W,oe]);return P.createElement(Fe.Provider,{value:p},P.createElement(An.Provider,{value:ke},P.createElement(jn.Provider,{value:K},P.createElement(Rn.Provider,{value:Te},i)),P.createElement(Pn,{disabled:n?.restoreFocus===!1})),P.createElement(Be,{...n,hiddenTextDescribedById:re}));function Ae(){let e=ee?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Vn=(0,P.createContext)(null),Hn=`button`,Un=`Draggable`;function Wn(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Se(Un),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,P.useContext)(An),{role:p=Hn,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,P.useContext)(g?Rn:Vn),[v,y]=U(),[b,x]=U(),S=vn(o,t),C=be(n);return V(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,P.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Hn?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Gn(){return(0,P.useContext)(jn)}var Kn=`Droppable`,qn={timeout:25};function Jn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Se(Kn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,P.useContext)(An),u=(0,P.useRef)({disabled:n}),d=(0,P.useRef)(!1),f=(0,P.useRef)(null),p=(0,P.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...qn,...i},_=be(h??r),v=ln({callback:(0,P.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=U((0,P.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=be(t);return(0,P.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,P.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,P.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Yn(e){let{animation:t,children:n}=e,[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),s=xe(n);return!n&&!r&&s&&i(s),V(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),P.createElement(P.Fragment,null,n,r?(0,P.cloneElement)(r,{ref:o}):null)}var Xn={x:0,y:0,scaleX:1,scaleY:1};function Zn(e){let{children:t}=e;return P.createElement(An.Provider,{value:kn},P.createElement(Rn.Provider,{value:Xn},t))}var Qn={position:`fixed`,touchAction:`none`},$n=e=>G(e)?`transform 250ms ease`:void 0,er=(0,P.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=$n}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Qn,width:s.width,height:s.height,top:s.top,left:s.left,transform:K.Transform.toString(d),transformOrigin:i&&r?Ge(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return P.createElement(n,{className:o,style:f,ref:t},a)}),tr={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:K.Transform.toString(t)},{transform:K.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function nr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ve((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Sn(a);if(!c)return;let{transform:l}=R(a).getComputedStyle(a),u=at(l);if(!u)return;let d=typeof t==`function`?t:rr(t);return Dt(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function rr(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...tr,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var ir=0;function ar(e){return(0,P.useMemo)(()=>{if(e!=null)return ir++,ir},[e])}var or=P.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Gn(),S=(0,P.useContext)(Rn),C=ar(d?.id),w=Fn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),ee=on(f),te=nr({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),T=ee?g.setRef:void 0;return P.createElement(Zn,null,P.createElement(Yn,{animation:te},d&&C?P.createElement(er,{key:C,id:d.id,ref:T,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:ee,style:{zIndex:l,...i},transform:w},n):null))});function sr(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function cr(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function lr(e){return e!==null&&e>=0}function ur(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function dr(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var fr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=sr(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pr={scaleX:1,scaleY:1},mr=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pr}:null}let s=hr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pr}:r<t&&r>=a?{x:0,y:o.height+s,...pr}:{x:0,y:0,...pr}};function hr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gr=`Sortable`,_r=P.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:i=fr,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Gn(),d=Se(gr,n),f=s.rect!==null,p=(0,P.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,P.useRef)(p),v=!ur(p,_.current),y=g!==-1&&h===-1||v,b=dr(a);V(()=>{v&&m&&u(p)},[v,p,m,u]),(0,P.useEffect)(()=>{_.current=p},[p]);let x=(0,P.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:cr(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return P.createElement(_r.Provider,{value:x},t)}var yr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return sr(n,r,i).indexOf(t)},br=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xr={duration:200,easing:`ease`},Sr=`transform`,Cr=K.Transition.toString({property:Sr,duration:0,easing:`linear`}),wr={roleDescription:`sortable`};function Tr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,P.useState)(null),s=(0,P.useRef)(n);return V(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ct(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,P.useEffect)(()=>{a&&o(null)},[a]),a}function Er(e){let{animateLayoutChanges:t=br,attributes:n,disabled:r,data:i,getNewIndex:a=yr,id:o,strategy:s,resizeObserverConfig:c,transition:l=xr}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,P.useContext)(_r),y=Dr(r,p),b=u.indexOf(o),x=(0,P.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,P.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:ee,setNodeRef:te}=Jn({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:T,activatorEvent:ne,activeNodeRect:E,attributes:re,setNodeRef:ie,listeners:ae,isDragging:D,over:oe,setActivatorNodeRef:se,transform:O}=Wn({id:o,data:x,attributes:{...wr,...n},disabled:y.draggable}),ce=he(te,ie),le=!!T,ue=le&&!m&&lr(f)&&lr(g),k=!_&&D,de=ue?(k&&ue?O:null)??(s??v)({rects:h,activeNodeRect:E,activeIndex:f,overIndex:g,index:b}):null,A=lr(f)&&lr(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,fe=T?.id,j=(0,P.useRef)({activeId:fe,items:u,newIndex:A,containerId:d}),pe=u!==j.current.items,M=t({active:T,containerId:d,isDragging:D,isSorting:le,id:o,index:b,items:u,newIndex:j.current.newIndex,previousItems:j.current.items,previousContainerId:j.current.containerId,transition:l,wasDragging:j.current.activeId!=null}),me=Tr({disabled:!M,index:b,node:w,rect:C});return(0,P.useEffect)(()=>{le&&j.current.newIndex!==A&&(j.current.newIndex=A),d!==j.current.containerId&&(j.current.containerId=d),u!==j.current.items&&(j.current.items=u)},[le,A,d,u]),(0,P.useEffect)(()=>{if(fe===j.current.activeId)return;if(fe!=null&&j.current.activeId==null){j.current.activeId=fe;return}let e=setTimeout(()=>{j.current.activeId=fe},50);return()=>clearTimeout(e)},[fe]),{active:T,activeIndex:f,attributes:re,data:x,rect:C,index:b,newIndex:A,items:u,isOver:ee,isSorting:le,isDragging:D,listeners:ae,node:w,overIndex:g,over:oe,setNodeRef:ce,setActivatorNodeRef:se,setDroppableNodeRef:te,setDraggableNodeRef:ie,transform:me??de,transition:N()};function N(){if(me||pe&&j.current.newIndex===b)return Cr;if(!(k&&!G(ne)||!l)&&(le||M))return K.Transition.toString({...l,property:Sr})}}function Dr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Or(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var kr=[Z.Down,Z.Right,Z.Up,Z.Left],Ar=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(kr.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Z.Down:r.top<a.top&&t.push(n);break;case Z.Up:r.top>a.top&&t.push(n);break;case Z.Left:r.left>a.left&&t.push(n);break;case Z.Right:r.left<a.left&&t.push(n);break}});let c=Qe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Ye(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=pt(c).some((e,t)=>s[t]!==e),i=jr(e,t),a=Mr(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Te(u,l)}}}};function jr(e,t){return!Or(e)||!Or(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mr(e,t){return!Or(e)||!Or(t)||!jr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Nr(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.model||n.runner||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Pr(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Fr(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Ir(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Lr(e,t){return e.filter((e,n)=>n!==t)}function Q(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function Rr(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
6
|
+
`)?[`${r}${e}: |`,...t.split(`
|
|
7
|
+
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Q(t)}`]}function zr(e,t,n){let r=[`name: ${Q(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Rr(`description`,t.trim(),0));let i=Nr(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Q(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(` - id: ${Q(e.id)}`),e.name&&e.name!==e.id&&r.push(` name: ${Q(e.name)}`),e.skill&&r.push(` skill: ${Q(e.skill)}`),e.prompt&&r.push(...Rr(`prompt`,e.prompt,4)),e.model&&r.push(` model: ${Q(e.model)}`),e.runner&&r.push(` runner: ${Q(e.runner)}`),e.allowedTools&&r.push(` allowedTools: [${e.allowedTools.map(Q).join(`, `)}]`),e.bashAllowlist&&r.push(` bashAllowlist: [${e.bashAllowlist.map(Q).join(`, `)}]`),e.command&&r.push(...Rr(`command`,e.command,4)),e.onFail&&r.push(` onFail:`,` retry: ${Q(e.onFail.retry)}`,` max: ${e.onFail.max??2}`)}else r.push(`skills: []`);return`${r.join(`
|
|
8
|
+
`)}\n`}function Br(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Vr(e){let t=Nr(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Hr(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Ur(e,t,n){let r=Nr(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var $=e(),Wr=`wb-canvas`;function Gr(){return{name:`my-workflow`,description:``,steps:[]}}function Kr(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function qr(){let{name:e}=g();return(0,$.jsx)(Jr,{routeName:e},e??``)}function Jr({routeName:e}){let t=m(),n=_(),r=u(),g=p(),[b,S]=(0,P.useState)(null),[w,te]=(0,P.useState)(``),[E,D]=(0,P.useState)(!1),[se,ce]=(0,P.useState)(``),[ue,N]=(0,P.useState)(``),[he,F]=(0,P.useState)(!1),[I,L]=(0,P.useState)(``),[R,z]=(0,P.useState)(!1),[ge,_e]=(0,P.useState)(!1),[B,V]=(0,P.useState)(null),[ve,ye]=(0,P.useState)(null),be=(0,P.useRef)(null),H=t.data?.workflows??[],U=n.data??[],xe=ae(U,r.data?.skillUsage);(0,P.useEffect)(()=>{if(b!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);S(r?Kr(r):Gr())},[b,t.data,e]);let W=e=>S(t=>t===null?t:{...t,steps:e}),Se=l({mutationFn:e=>y(e),onSuccess:e=>{S({name:e.name,description:e.description??``,steps:e.steps}),D(!1),ce(``),N(``),d(`Imported "${e.name}" — review, then Save.`)},onError:e=>N(e.message)}),Ce=l({mutationFn:e=>o(e),onSuccess:e=>{S(t=>{let n=t??Gr(),{name:r,steps:i}=Hr(e,n.name);return{...n,name:r,steps:i}}),F(!1),L(``),d(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??b?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>d(e instanceof Error?e.message:String(e),{tone:`danger`})}),we=l({mutationFn:e=>s({...Ur(b?.name??``,b?.description??``,b?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{z(!1),d(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:i.workflows})},onError:e=>{e instanceof v&&e.exists===!0?z(!0):d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=l({mutationFn:e=>a(e),onSuccess:(e,t)=>{_e(!1),d(`Deleted "${t}".`),S(Gr()),g.invalidateQueries({queryKey:i.workflows})},onError:e=>{_e(!1),d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ee=Ue(He(Ht,{activationConstraint:{distance:4}}),He(Lt,{coordinateGetter:Ar}));if(t.isError)return(0,$.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(h,{icon:(0,$.jsx)(T,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(b===null)return(0,$.jsx)(O,{});let G=b.steps,De=b.name.trim(),Oe=H.find(e=>e.name===De&&e.source===`file`),K=zr(b.name,b.description,G),ke=(e,t=G.length)=>{if(G.length>=8){d(`A workflow holds at most 8 steps.`,{tone:`danger`});return}W(Fr(G,Pr(e,G),t))},Ae=e=>{let t=e.active.data.current;V(t??null)},je=e=>{ye(e.over?String(e.over.id):null)},Me=e=>{V(null),ye(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===Wr?G.length:G.findIndex(e=>e.id===n.id);ke(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&W(Ir(G,i,a))},Ne=()=>{let e=se.trim();e!==``&&Se.mutate(e)},Pe=()=>{let e=I.trim();e===``||Ce.isPending||Ce.mutate(e)};return(0,$.jsxs)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Workflows`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Portable skill chains — the agent applies them top to bottom.`})]}),(0,$.jsxs)(Bn,{sensors:Ee,collisionDetection:Ze,onDragStart:Ae,onDragOver:je,onDragEnd:Me,onDragCancel:()=>{V(null),ye(null)},children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:flex-row md:p-5 md:pb-5`,children:[(0,$.jsxs)(`section`,{"data-slot":`wb-main`,className:`mx-auto w-full min-w-0 max-w-3xl flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,$.jsx)(M,{ref:be,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:b.name,onChange:e=>S({...b,name:e.target.value}),className:`h-8 max-w-56 font-mono text-[13px] font-semibold`}),(0,$.jsx)(`span`,{"data-slot":`wb-count`,className:`shrink-0 font-mono text-xs text-soft-foreground`,children:Vr(G)})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[Oe?(0,$.jsxs)(c,{type:`button`,variant:`danger-ghost`,size:`sm`,"data-slot":`wb-delete`,title:`Delete the saved workflow file`,onClick:()=>_e(!0),children:[(0,$.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null,(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":he,title:`Describe a chain — the agent builds it`,onClick:()=>{D(!1),F(e=>!e)},children:[(0,$.jsx)(me,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,onClick:()=>{N(``),F(!1),D(e=>!e)},children:[(0,$.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,title:`Download workflow.yaml`,onClick:()=>{let e=new Blob([K],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Br(b.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},children:[(0,$.jsx)(ee,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-save`,disabled:we.isPending,onClick:()=>{if(De===``){be.current?.focus();return}if(G.length===0){d(`Add at least one step first.`,{tone:`danger`});return}we.mutate(!1)},children:[(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,$.jsxs)(`div`,{"data-slot":`wb-load`,className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`mr-0.5 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`edit`}),H.map(e=>(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-load-chip`,"data-name":e.name,title:e.description??``,"aria-pressed":De===e.name,onClick:()=>S(Kr(e)),className:x(`rounded-full border border-border bg-card px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,De===e.name&&`border-primary/40 bg-primary/10 text-foreground`),children:e.name},e.name)),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-new`,title:`Start an empty workflow`,onClick:()=>S(Gr()),className:`rounded-full border border-dashed border-border px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`+ new`})]}),he?(0,$.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Build a chain from a prompt`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Describe what the chain should do. An agent proposes a title and an ordered set of skill / check steps — land it on the canvas, then tweak and Save.`}),(0,$.jsx)(re,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:I,onChange:e=>L(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Pe())},className:`mt-2 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-auto-run`,disabled:Ce.isPending||I.trim()===``,onClick:Pe,children:[(0,$.jsx)(me,{"aria-hidden":`true`,className:`size-3`}),Ce.isPending?`Building…`:`Build chain`]}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:()=>{F(!1),L(``)},children:`Cancel`})]})]}):null,E?(0,$.jsxs)(`div`,{"data-slot":`wb-import-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Import workflow YAML`}),(0,$.jsx)(re,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:6,spellCheck:!1,placeholder:`name: my-flow
|
|
9
|
+
skills:
|
|
10
|
+
- test-conventions
|
|
11
|
+
- commit-style`,value:se,onChange:e=>ce(e.target.value),className:`mt-2 min-h-28 font-mono text-xs`}),ue===``?null:(0,$.jsx)(`p`,{"data-slot":`wb-import-error`,className:`mt-2 text-xs text-danger`,children:ue}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsx)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-import-run`,disabled:Se.isPending,onClick:Ne,children:`Import`}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:()=>{D(!1),ce(``),N(``)},children:`Cancel`})]})]}):null,(0,$.jsx)(Yr,{steps:G,skills:U,dragging:B!==null,overId:ve,activeStepId:B?.type===`step`?B.step.id:null,onRemove:e=>W(Lr(G,e))})]}),(0,$.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`w-full shrink-0 md:w-[320px]`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Skills`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Drag into the flow. Order is execution order — the agent applies them top to bottom.`}),(0,$.jsx)(M,{"data-slot":`wb-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:w,onChange:e=>te(e.target.value),className:`mt-2.5 h-8 text-[13px]`}),(0,$.jsx)(Qr,{skills:xe,query:w,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>ke(e)}),(0,$.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`workflow.yaml`}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(ei,{yaml:K})]}),(0,$.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 overflow-x-auto rounded-lg border border-border bg-card p-3 font-mono text-[11.5px] leading-relaxed whitespace-pre text-muted-foreground shadow-xs`,children:K}),(0,$.jsx)(`p`,{className:`mt-2 text-[11.5px] leading-relaxed text-soft-foreground`,children:`Portable — export this file and import it in any repo running cezar.`})]})]}),(0,$.jsx)(or,{children:B?.type===`palette`?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,$.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 text-primary`}),B.skill]}):B?.type===`step`?(0,$.jsx)(Zr,{step:B.step,index:G.findIndex(e=>e.id===B.step.id),skills:U,overlay:!0}):null})]}),(0,$.jsx)(pe,{open:R,onOpenChange:e=>!e&&z(!1),children:(0,$.jsxs)(j,{"data-slot":`wb-overwrite-dialog`,children:[(0,$.jsxs)(de,{children:[(0,$.jsxs)(oe,{children:[`“`,De,`” already exists`]}),(0,$.jsx)(fe,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,$.jsxs)(A,{children:[(0,$.jsx)(k,{children:`Keep the file`}),(0,$.jsx)(le,{"data-slot":`wb-overwrite-confirm`,onClick:()=>we.mutate(!0),children:`Overwrite`})]})]})}),(0,$.jsx)(pe,{open:ge,onOpenChange:e=>!e&&_e(!1),children:(0,$.jsxs)(j,{"data-slot":`wb-delete-dialog`,children:[(0,$.jsxs)(de,{children:[(0,$.jsxs)(oe,{children:[`Delete workflow “`,De,`”?`]}),(0,$.jsxs)(fe,{children:[`Removes `,Oe?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,$.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,$.jsxs)(A,{children:[(0,$.jsx)(k,{children:`Keep it`}),(0,$.jsx)(le,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>Te.mutate(De),children:`Delete`})]})]})})]})}function Yr({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a}){let{setNodeRef:o,isOver:s}=Jn({id:Wr}),c=n&&r===Wr;return(0,$.jsx)(`div`,{ref:o,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:x(`mt-4 rounded-lg border border-dashed p-2 transition-colors`,s?`border-primary/60 bg-primary/5`:`border-muted-foreground/25`),children:e.length===0?(0,$.jsx)(`p`,{className:x(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,s?`text-primary`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,$.jsxs)(vr,{items:e.map(e=>e.id),strategy:mr,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((e,o)=>(0,$.jsx)(Xr,{step:e,index:o,skills:t,connector:o>0,dragging:n,insertBefore:n&&r===e.id&&i!==e.id,onRemove:()=>a(o)},e.id))}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:x(`mx-1 mt-2.5 h-[3px] rounded-full transition-colors`,c?`bg-primary`:`bg-transparent`)}),(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 pt-1.5 pb-1 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),`runs top to bottom`]})]})})}function Xr({step:e,index:t,skills:n,connector:r,dragging:i,insertBefore:a,onRemove:o}){let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=Er({id:e.id,data:{type:`step`,step:e}});return(0,$.jsxs)(`li`,{ref:l,style:{transform:K.Transform.toString(u),transition:d},className:x(`relative`,f&&`opacity-40`),children:[r&&!i?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-[11px] left-1/2 h-[9px] w-px -translate-x-1/2 bg-muted-foreground/30`}):null,a?(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-primary`}):null,(0,$.jsx)(Zr,{step:e,index:t,skills:n,onRemove:o,gripProps:{...s,...c}})]})}function Zr({step:e,index:t,skills:n,onRemove:r,gripProps:i,overlay:a=!1}){let o=n.find(t=>t.name===e.skill),s=!!e.command,c=s||!e.skill?e.name??e.id:e.skill,l=s?`$ ${e.command}${e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``}`:e.skill?o?.description??`Not in this repo or the team skills — the step runs on its plain prompt.`:e.prompt??``,u=s?`check`:e.skill?o?null:`unknown`:`prompt`;return(0,$.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:x(`flex items-center gap-2.5 rounded-md border border-muted-foreground/20 bg-card-2 px-2.5 py-2 shadow-xs`,a&&`shadow-md`),children:[(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${t+1}: ${c}`,className:`shrink-0 cursor-grab rounded text-muted-foreground outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...i,children:(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:String(t+1).padStart(2,`0`)}),s?(0,$.jsx)(te,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):(0,$.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-mono text-[13px] font-medium`,children:c}),l?(0,$.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:l}):null]}),u?(0,$.jsx)(`span`,{"data-slot":`wb-step-badge`,className:x(`shrink-0 rounded-full border px-2 py-px font-mono text-[10.5px]`,u===`check`&&`border-success/30 text-success`,u===`unknown`&&`border-danger/35 text-danger`,u===`prompt`&&`border-border text-soft-foreground`),children:u}):null,r?(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-remove`,"aria-label":`Remove step ${t+1}: ${c}`,title:`Remove from flow`,onClick:r,className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-danger focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(E,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function Qr({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,$.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=t.trim().toLowerCase(),o=e.filter(e=>a===``||e.name.toLowerCase().includes(a)||(e.description??``).toLowerCase().includes(a));return(0,$.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:o.length>0?o.map(e=>(0,$.jsx)($r,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,$.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,$.jsx)(w,{})})})}function $r({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:i,setNodeRef:a,isDragging:o}=Wn({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,$.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.name,title:e.description??``,className:x(`flex cursor-grab items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 shadow-xs transition-colors hover:bg-muted`,o&&`opacity-40`),...r,...i,children:[(0,$.jsx)(ie,{"aria-hidden":`true`,className:x(`size-3.5 shrink-0`,se(e)?`text-violet`:`text-soft-foreground`)}),(0,$.jsx)(`span`,{className:x(`min-w-0 flex-1 truncate font-mono text-[13px]`,se(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),t?(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`})})]})}function ei({yaml:e}){let[t,n]=(0,P.useState)(!1),r=(0,P.useRef)(null);return(0,P.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}export{qr as WorkflowsRoute};
|
package/web/dist/index.html
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
})()
|
|
43
43
|
</script>
|
|
44
|
-
<script type="module" crossorigin src="/assets/index-
|
|
44
|
+
<script type="module" crossorigin src="/assets/index-MN3Lxn3t.js"></script>
|
|
45
45
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BegPhL5c.js">
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/assets/utils-B8s5qIcK.js">
|
|
47
47
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-CLmJ67EV.js">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{A as r,Et as i,Gt as a,L as o,Mt as s,Nt as c,R as l,a as u,bn as d,fn as f,ft as p,i as m,k as h,mn as ee,mt as te,t as g,un as ne,ut as _}from"./centered-state-CLmJ67EV.js";import{n as v,r as y,t as b}from"./utils-B8s5qIcK.js";import{t as x}from"./arrow-left-CnSdp92h.js";import{n as S,t as C}from"./tab-link-vtgjgL_M.js";import{t as w}from"./git-pull-request-DnR8Xh4_.js";import{t as T}from"./refresh-cw-BT8E96Tm.js";import{t as re}from"./triangle-alert-Uy8rokUh.js";import{n as E,t as ie}from"./textarea-Bj_LCreg.js";import{r as D,t as O}from"./project-router-BaWVyqc8.js";import{A as k,At as A,Ct as j,D as ae,E as oe,Et as M,F as N,Ft as P,Gt as F,H as I,J as se,Kt as ce,L as le,M as L,Mt as R,N as z,Nt as B,O as V,Ot as H,P as U,R as W,St as ue,Ut as G,Wt as de,Yt as K,_t as q,bt as fe,en as pe,ht as me,j as he,jt as J,k as ge,kt as Y,rn as _e,x as ve,xt as ye,y as be,yt as xe,z as Se}from"./index-CcfkF2Ey.js";var Ce=y(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),we=y(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Te=y(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),X=n(t(),1),Z=e();function Q({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:b(`animate-pulse rounded-md bg-accent`,e),...t})}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Ee(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=De(t)),n}function De(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Oe(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function ke(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ae(e,t,n){let r=(n??``).trim();if(!r)return Ee(e,t);let i=$(e),a=r.startsWith(i)?i+Oe(r.slice(i.length),e):Oe(r,e),o=ke(a,e)?a:`${i}\n\n${a}`;return t.length?o+De(t):o}function je(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function Me(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ae(e,n,r)}:n.length?{...i,steps:je(n),task:Ae(e,[],r)}:{...i,workflow:`quick-task`,task:Ae(e,[],r)}}function Ne(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function Pe(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function Fe(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var Ie={workflow:null,skills:[]},Le=`cez-followup-selection`;function Re(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ze(){try{let e=localStorage.getItem(Le);return e?Re(JSON.parse(e)):{...Ie}}catch{return{...Ie}}}function Be(e){try{localStorage.setItem(Le,JSON.stringify(e))}catch{}}var Ve=`cez-followup-prompt:`;function He(e){try{return localStorage.getItem(Ve+e)??``}catch{return``}}function Ue(e,t){try{t===``?localStorage.removeItem(Ve+e):localStorage.setItem(Ve+e,t)}catch{}}function We({item:e,workflows:t,skills:n,workflow:o,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:te,queuedRunId:g,onQueued:ne}){let _=ee(),v=p(),y=c.filter(e=>n.some(t=>t.name===e)),[b]=(0,X.useState)(()=>$(e)),[x,S]=(0,X.useState)(()=>He(e.url)||b),C=Se(d),w=(0,X.useRef)(null);(0,X.useEffect)(()=>{Ue(e.url,x===b?``:x)},[e.url,x,b]);let T=(0,X.useMemo)(()=>k(v.data?.promptTemplates),[v.data?.promptTemplates]),re=e=>{let t=w.current,n=x===b?x.length:t?.selectionStart??x.length,r=ge(x,n,e);S(r.text),requestAnimationFrame(()=>{w.current?.focus(),w.current?.setSelectionRange(r.caret,r.caret)})},D=V(T,y),A=(0,X.useRef)(x);A.current=x;let j=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=he(A.current,j.current,D,b);j.current=e.applied,e.text!==A.current&&S(e.text)},[D,b]);let M=f({mutationFn:()=>i(Me(e,o,y,x,W(C))),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;n&&ne(e.url,n.id),y.length>0&&v.data!==void 0&&a({skillUsage:y.reduce((e,t)=>me(e,t),v.data.skillUsage)}).then(()=>_.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),Ue(e.url,``),S(b),j.current=``,_.invalidateQueries({queryKey:r.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),N=e=>{oe({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),M.isPending||M.mutate())},P=e=>l(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Z.jsx)(G,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ge,{workflows:t,value:o,onChange:s}),(0,Z.jsx)(Ke,{skills:n,skillUsage:v.data?.skillUsage,selected:y,onToggle:P}),(0,Z.jsx)(le,{pick:d,onChange:te,disabled:M.isPending}),(0,Z.jsx)(L,{templates:T,onInsert:re})]}),y.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:y.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>P(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Z.jsx)(E,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsx)(ie,{ref:w,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:x,onChange:e=>S(e.target.value),onKeyDown:N,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(u,{variant:`contrast`,"data-action":`gh-run`,disabled:M.isPending,onClick:()=>M.mutate(),children:[(0,Z.jsx)(K,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,e.kind===`pr`?`PR`:`issue`]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ae()}),g?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(O,{to:`/tasks/${g}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function Ge({workflows:e,value:t,onChange:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c=ue(e,a);return(0,Z.jsxs)(z,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:b(I,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(de,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Z.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(U,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(H,{shouldFilter:!1,children:[(0,Z.jsx)(J,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(B,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Z.jsx)(Y,{children:`Nothing matches.`}):null,(0,Z.jsx)(A,{children:c.map(e=>{let r=t===e.name;return(0,Z.jsxs)(R,{value:`workflow ${e.name}`,keywords:j(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(h,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function Ke({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p}=fe(ye(e,o,t),t),m=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(R,{value:`skill ${e.name} ${e.path}`,keywords:j(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Z.jsx)(`span`,{className:b(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(pe,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(be,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(z,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:b(I,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(F,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(U,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(H,{shouldFilter:!1,children:[(0,Z.jsx)(J,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(B,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,Z.jsx)(Y,{children:`Nothing matches.`}):null,d.length>0?(0,Z.jsx)(A,{heading:`Most used`,children:d.map(e=>m(e,q(e)))}):null,f.length>0?(0,Z.jsx)(A,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,Z.jsx)(A,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})]})}var qe=30,Je=1e3;function Ye(){return p().data?.githubView===`prs`?(0,Z.jsx)(D,{to:`/github/prs`,replace:!0}):(0,Z.jsx)(Xe,{view:`issues`})}function Xe({view:e}){let{n:t}=ne(),n=o(),i=o({limit:Je},n.data?.available===!0),l=i.data?.available?i.data:n.data,h=i.data?.available===!0,v=ee(),y=e=>{v.setQueryData(r.uiState,t=>({...t,githubView:e})),a({githubView:e}).then(e=>v.setQueryData(r.uiState,e)).catch(e=>{m(e instanceof Error?e.message:String(e),{tone:`danger`}),v.invalidateQueries({queryKey:r.uiState})})},x=(0,X.useRef)(null),S=f({mutationFn:()=>s({refresh:!0}),onSuccess:e=>{v.setQueryData(r.github({}),e),v.invalidateQueries({queryKey:r.github({limit:Je})});let t=x.current;if(!t){v.removeQueries({queryKey:[`github`,`comments`]});return}let n=r.githubComments(t.kind,t.number);c(t.kind,t.number,{refresh:!0}).then(e=>v.setQueryData(n,e)).catch(()=>{}),v.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==d(n)})},onError:e=>m(e.message,{tone:`danger`})}),E=te(),ie=_(),D=p(),[O,k]=(0,X.useState)(()=>ze().workflow),[A,j]=(0,X.useState)(()=>ze().skills),[ae,oe]=(0,X.useState)({runner:null,model:null});(0,X.useEffect)(()=>{Be({workflow:O,skills:[...A]})},[O,A]);let N=E.data?.workflows;(0,X.useEffect)(()=>{N&&O!==null&&!N.some(e=>e.name===O)&&k(null)},[N,O]);let F=ie.data,I=D.data?.skillUsage,le=(0,X.useMemo)(()=>xe(F??[],I),[F,I]),[L,R]=(0,X.useState)(new Map),[z,B]=(0,X.useState)(``),[V,H]=(0,X.useState)([]);if(!l)return n.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(g,{icon:(0,Z.jsx)(re,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:n.error.message})}):(0,Z.jsx)(se,{});if(x.current=null,!l.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(g,{icon:(0,Z.jsx)(P,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:l.reason??`unknown reason`,actions:(0,Z.jsx)(u,{variant:`outline`,"data-action":`gh-retry`,disabled:S.isPending,onClick:()=>S.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let U=e===`issues`?l.issues:l.prs,W=l.labelColors??{},ue=Ne(U),G=Pe(U,{query:z,labels:V}),de=z.trim()!==``||V.length>0,K=t===void 0?null:Number.parseInt(t,10),q=K===null?G[0]??null:U.find(e=>e.number===K)??null;x.current=q?{kind:q.kind,number:q.number}:null;let fe=e===`issues`?`/github`:`/github/prs`;return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-list`,className:b(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,t===void 0?`flex`:`hidden`),children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),l.repo?(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:l.repo}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:S.isPending,onClick:()=>S.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Z.jsx)(T,{"aria-hidden":`true`,className:b(`size-[9px]`,S.isPending&&`motion-safe:animate-spin`)}),l.syncedAt?`synced ${M(l.syncedAt)} ago`:`refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Z.jsxs)(C,{to:`/github`,active:e===`issues`,onClick:()=>y(`issues`),children:[`Issues · `,Ze(l.issues.length,h)]}),(0,Z.jsxs)(C,{to:`/github/prs`,active:e===`prs`,onClick:()=>y(`prs`),children:[`Pull requests · `,Ze(l.prs.length,h)]})]}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Z.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:z,onChange:e=>B(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Z.jsx)($e,{options:ue,colors:W,selected:V,onChange:H})]})]}),G.length===0?(0,Z.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:de?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:G.map(t=>(0,Z.jsx)(Qe,{item:t,view:e,colors:W,active:q?.url===t.url,queued:L.has(t.url)},t.url))})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:b(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,t===void 0?`hidden md:flex`:`flex`),children:q?(0,Z.jsx)(tt,{item:q,listPath:fe,colors:W,children:(0,Z.jsx)(We,{item:q,workflows:E.data?.workflows??[],skills:le,workflow:O,onWorkflowChange:k,selectedSkills:A,onSkillsChange:j,engine:ae,onEngineChange:oe,queuedRunId:L.get(q.url)??null,onQueued:(e,t)=>R(n=>new Map(n).set(e,t))},q.url)}):(0,Z.jsx)(g,{icon:e===`issues`?(0,Z.jsx)(Ce,{}):(0,Z.jsx)(w,{}),tone:`neutral`,heading:`h2`,title:K===null?`Nothing selected`:`Not in the open list`,subtitle:K===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${K} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function Ze(e,t){return`${e}${!t&&e>=qe?`+`:``}`}function Qe({item:e,view:t,colors:n,active:r,queued:i}){let a=e.kind===`issue`?Ce:w;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(O,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Ee(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:b(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(a,{"aria-hidden":`true`,className:b(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Z.jsx)(`span`,{className:b(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Z.jsx)(`span`,{children:M(e.createdAt)}),(0,Z.jsx)(ht,{count:e.comments}),e.checks?(0,Z.jsx)(_t,{checks:e.checks}):null,i?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(et,{label:e,color:n[e]},e))}):null]})})}function $e({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(z,{open:i,onOpenChange:a,children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:b(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,Z.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(U,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(J,{placeholder:`Filter labels…`}),(0,Z.jsxs)(B,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(Y,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(R,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Z.jsxs)(R,{value:e,onSelect:()=>o(e),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Fe(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function et({label:e,color:t}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Fe(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function tt({item:e,listPath:t,colors:n,children:r}){let i=e.kind===`pr`?`pull request`:`issue`,a=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsxs)(O,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:i}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[M(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(ht,{count:e.comments})]}):null,a?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,v(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Z.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.labels.length>0||e.checks?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(et,{label:e,color:n[e]},e)),e.checks?(0,Z.jsx)(gt,{checks:e.checks,url:e.url}):null]}):null,(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(ve,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(nt,{item:e,colors:n}),r]})}function nt({item:e,colors:t}){let n=l(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(rt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Q,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Q,{className:`h-14 w-full`}),(0,Z.jsx)(Q,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:it(i).map(e=>e.group===`commits`?(0,Z.jsx)(at,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(dt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(st,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var rt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function it(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function at({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(st,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:M(e[e.length-1].createdAt)})]})})}var ot={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function st({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:b(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:ot[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(ct,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:M(e.createdAt)}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function ct({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(lt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:Fe(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function lt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:b(`shrink-0`,mt[e]),children:pt[e]}):null}var ut={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function dt({comment:e}){let t=e.reviewState?ut[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(ft,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:M(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:b(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(ve,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function ft({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var pt={passing:`✓`,failing:`✗`,pending:`○`},mt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function ht({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function gt({checks:e,url:t}){let n=b(`text-[11px] font-medium`,mt[e],t&&`hover:underline`),r=`${pt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function _t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:b(`shrink-0 font-sans text-[11px] font-semibold`,mt[e]),children:pt[e]})}export{Ye as GithubIndexRoute,Xe as GithubRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{A as r,B as i,Lt as a,O as o,Rt as s,St as c,U as l,W as u,a as d,ct as ee,fn as f,i as p,jt as te,k as m,kt as ne,mn as h,ot as g,wt as _,xt as v,yt as re}from"./centered-state-CLmJ67EV.js";import{r as y,t as b}from"./utils-B8s5qIcK.js";import{n as x,t as S}from"./trash-2-DAyZ0VSi.js";import{t as C}from"./ellipsis-vertical-CNnSLn5a.js";import{n as w,t as T}from"./tab-link-vtgjgL_M.js";import{t as E}from"./square-terminal-Ckjjn0vb.js";import{c as ie}from"./project-router-BaWVyqc8.js";import{$ as ae,$t as oe,Dt as se,Gt as ce,Tt as le,Ut as ue,Xt as de,Yt as D,Z as fe,_ as pe,ct as O,d as me,dt as k,et as he,f as ge,g as _e,h as A,in as j,lt as M,m as N,mt as P,n as F,on as I,ot as L,p as ve,pt as ye,r as be,st as R,t as xe,tn as Se,u as Ce,ut as z,x as we}from"./index-CcfkF2Ey.js";var B=y(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Te=y(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ee=y(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),De=y(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),V=y(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Oe=y(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ke=y(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ae=y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),je=y(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Me=y(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),H=y(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ne=y(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),U=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Pe=y(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Fe=y(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),Ie=y(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Le=y(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Re=y(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),ze=y(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Be=y(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),W=n(t(),1);function G(e){return e===`running`||e===`queued`||e===`waiting`}function K(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var Ve=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function He(e,t){if(Ve.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`opencode`:return`opencode --session ${t}`;default:return`claude --resume ${t}`}}function Ue(e){if(G(e.status))return;let t=K(e);if(t===void 0)return;let n=He(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function We(e){let t=/^cli:(claude|codex|opencode)$/.exec(e);return t?t[1]:void 0}function Ge(e,t){let n=We(t);return!n||G(e.status)?!1:n===(e.runner??`claude`)&&K(e)!==void 0}function q(e){let t=G(e.status),n=K(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&n,terminal:!t&&n,notes:!0,archive:!t,cancel:t,deleteRun:!t}}function J(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Ke(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var Y=e();function X(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function qe(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function Je({steps:e}){if(e.length===0)return null;let t=qe(e)*100;return(0,Y.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,Y.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":X(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,Y.jsx)(Ye,{visual:X(t.status)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,Y.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,Y.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,Y.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function Ye({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,Y.jsx)(De,{"aria-hidden":!0,className:b(t,`text-success`)});case`active`:return(0,Y.jsx)(o,{role:`status`,"aria-label":`Step running`,className:b(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,Y.jsx)(Oe,{"aria-hidden":!0,className:b(t,`text-danger`)});case`pending`:return(0,Y.jsx)(Se,{"aria-hidden":!0,className:b(t,`text-soft-foreground`)})}}function Z(e){let t=h();return f({mutationFn:()=>te(e),onSuccess:()=>t.invalidateQueries({queryKey:r.runs.all}),onError:e=>p(e.message,{tone:`danger`})})}function Q({run:e,planTally:t,tab:n=`session`}){let r=se(e),i=q(e),a=Ue(e),[o,s]=(0,W.useState)(!1),c=$e(e),l=ee(),u=e.status===`queued`?ye(l.data??[]).get(e.id):void 0;return(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[820px]`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(et,{run:e}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[t?(0,Y.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`text-[11px] text-soft-foreground tabular-nums`,children:[`Plan `,t.done,`/`,t.total]}):null,(0,Y.jsxs)(xe,{dot:r.tone,pulse:r.pulse,children:[r.label,u===void 0?``:` #${u}`]}),(0,Y.jsx)(rt,{run:e,actions:c,onToggleNotes:()=>s(e=>!e)})]})]}),(0,Y.jsx)(tt,{run:e}),(0,Y.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Y.jsx)(T,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,Y.jsx)(T,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,Y.jsx)(T,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,Y.jsx)(T,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),(0,Y.jsxs)(`div`,{"data-slot":`run-actions`,className:`ml-auto hidden items-center gap-1 pb-1 md:flex`,children:[i.finish?(0,Y.jsxs)(d,{variant:`outline`,size:`sm`,title:J(e.status),onClick:()=>c.finish.mutate(),children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Finish`]}):null,i.continueRun?(0,Y.jsxs)(d,{variant:`outline`,size:`sm`,title:`Reopen the session`,onClick:()=>c.continueRun.mutate(),children:[(0,Y.jsx)(D,{"aria-hidden":`true`}),`Continue`]}):null,(0,Y.jsx)(Qe,{run:e,canResume:i.terminal,onResume:()=>c.terminal.mutate()}),(0,Y.jsxs)(d,{variant:`ghost`,size:`sm`,title:`Handoff notes — what the agent did and what's left`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Notes`]}),i.archive?(0,Y.jsxs)(d,{variant:`ghost`,size:`sm`,onClick:()=>c.archive.mutate(),children:[e.archived?(0,Y.jsx)(B,{"aria-hidden":`true`}):(0,Y.jsx)(I,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,i.cancel?(0,Y.jsxs)(d,{variant:`danger-ghost`,size:`sm`,onClick:()=>c.setConfirming(`cancel`),children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),`Cancel`]}):null,i.deleteRun?(0,Y.jsxs)(d,{variant:`danger-ghost`,size:`sm`,onClick:()=>c.setConfirming(`delete`),children:[(0,Y.jsx)(S,{"aria-hidden":`true`}),`Delete`]}):null]})]}),e.steps.length>0?(0,Y.jsx)(`div`,{className:`border-t border-border pt-2.5 pb-1`,children:(0,Y.jsx)(Je,{steps:e.steps})}):null,a?(0,Y.jsx)(at,{hint:a}):null,o?(0,Y.jsx)(ot,{runId:e.id}):null]}),(0,Y.jsx)(it,{run:e,actions:c})]})}var Xe={folder:oe,terminal:E,vscode:ke,cursor:Ie,zed:ue,windsurf:Be,sublime:Me,idea:je,pycharm:Fe,webstorm:U,goland:Re,rubymine:Ne,phpstorm:Ee,clion:Ae,rider:Te,"android-studio":ze,xcode:Pe,warp:Le,claude:j,codex:ce,opencode:j};function Ze(e){return e.icon&&Xe[e.icon]||w}function Qe({run:e,canResume:t,onResume:n}){let r=l(),i=f({mutationFn:t=>a(e.id,t),onError:e=>p(e.message,{tone:`danger`})}),o=e.worktreePath?r.data?.targets??[]:[];return!t&&o.length===0?null:(0,Y.jsxs)(L,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(d,{variant:`ghost`,size:`sm`,title:`Resume in a terminal, or open the worktree locally`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`}),`Open in…`]})}),(0,Y.jsxs)(R,{align:`end`,children:[t?(0,Y.jsxs)(O,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(E,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,t&&o.length>0?(0,Y.jsx)(z,{}):null,o.map(t=>{let n=Ge(e,t.id),r=Ze(t);return(0,Y.jsxs)(O,{"data-target":t.id,title:n?`Resume this run's session`:void 0,onSelect:()=>i.mutate(t.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),t.label,n?` (resume)`:``]},t.id)}),e.worktreePath?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{}),(0,Y.jsxs)(O,{onSelect:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>p(`Worktree path copied`)).catch(()=>p(`Path: ${t}`))},children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null]})]})}function $e(e){let t=h(),n=ie(),[i,a]=(0,W.useState)(null),o=()=>t.invalidateQueries({queryKey:r.runs.all}),l=e=>p(e.message,{tone:`danger`});return{finish:Z(e.id),continueRun:f({mutationFn:()=>_(e.id),onSuccess:o,onError:l}),archive:f({mutationFn:()=>v(e.id,!e.archived),onSuccess:o,onError:l}),cancel:f({mutationFn:()=>c(e.id),onSuccess:o,onError:l}),delete:f({mutationFn:()=>ne(e.id),onSuccess:()=>{o(),n(`/`)},onError:l}),terminal:f({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof re&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}l(e)}}),confirming:i,setConfirming:a}}async function $(e,t){try{await navigator.clipboard.writeText(e),p(t)}catch{p(`Run manually: ${e}`)}}function et({run:e}){let t=u(e.id),n=P(e),r=be(n,e=>t.mutate({title:e},{onError:e=>p(e.message,{tone:`danger`})}));return r.editing?(0,Y.jsx)(F,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`min-w-0 truncate text-[15px] font-semibold`,title:e.task,children:n}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:r.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(de,{className:`size-3.5`,"aria-hidden":`true`})})]})}function tt({run:e}){let t=[(0,Y.jsx)(`span`,{children:ae(e)},`workflow`)];e.branch&&t.push((0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:e.branch},`branch`)),e.diffStat&&t.push((0,Y.jsx)(he,{stat:e.diffStat},`diff`));let n=[];return e.tokensUsed>0&&n.push((0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[le(e.tokensUsed),` tokens`]},`tokens`)),e.costUsd&&n.push((0,Y.jsx)(`span`,{className:`tabular-nums`,children:fe(e.costUsd)},`cost`)),(0,Y.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[t.map((e,t)=>(0,Y.jsxs)(W.Fragment,{children:[t>0?(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[n.map((e,t)=>(0,Y.jsxs)(W.Fragment,{children:[t>0?(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Y.jsx)(nt,{run:e})]})]})}function nt({run:e}){let t=i(),n=e.runner??t.data?.defaultRunner??`claude`,r=e.model??`auto`;return(0,Y.jsxs)(L,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-slot":`agent-badge`,title:`${n} · ${r}`,"aria-label":`Agent: ${n}, model ${r}`,className:`flex shrink-0 items-center justify-center rounded-sm p-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsxs)(R,{align:`end`,className:`min-w-[9rem]`,children:[(0,Y.jsxs)(M,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,n]}),(0,Y.jsxs)(M,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,r]})]})]})}function rt({run:e,actions:t,onToggleNotes:n}){let r=q(e);return(0,Y.jsxs)(L,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,Y.jsx)(C,{"aria-hidden":`true`})})}),(0,Y.jsxs)(R,{align:`end`,"data-slot":`run-actions-menu`,children:[r.finish?(0,Y.jsxs)(O,{onSelect:()=>t.finish.mutate(),children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),` Finish`]}):null,r.continueRun?(0,Y.jsxs)(O,{onSelect:()=>t.continueRun.mutate(),children:[(0,Y.jsx)(D,{"aria-hidden":`true`}),` Continue`]}):null,r.terminal?(0,Y.jsxs)(O,{onSelect:()=>t.terminal.mutate(),children:[(0,Y.jsx)(E,{"aria-hidden":`true`}),` Terminal`]}):null,(0,Y.jsxs)(O,{onSelect:n,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),` Notes`]}),r.archive?(0,Y.jsxs)(O,{onSelect:()=>t.archive.mutate(),children:[e.archived?(0,Y.jsx)(B,{"aria-hidden":`true`}):(0,Y.jsx)(I,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,r.cancel||r.deleteRun?(0,Y.jsx)(z,{}):null,r.cancel?(0,Y.jsxs)(O,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),` Cancel`]}):null,r.deleteRun?(0,Y.jsxs)(O,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(S,{"aria-hidden":`true`}),` Delete`]}):null]})]})}function it({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(Ce,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(ve,{children:[(0,Y.jsxs)(_e,{children:[(0,Y.jsx)(pe,{children:n===`delete`?`Delete this task?`:`Cancel this task?`}),(0,Y.jsx)(N,{children:n===`delete`?(0,Y.jsxs)(Y.Fragment,{children:[`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:P(e),children:P(e)})]}):`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,Y.jsxs)(A,{children:[(0,Y.jsx)(ge,{children:`Keep it`}),(0,Y.jsx)(me,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{n===`delete`?t.delete.mutate():t.cancel.mutate(),t.setConfirming(null)},children:n===`delete`?`Delete`:`Cancel the run`})]})]})})}function at({hint:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void $(e,`Command copied to clipboard.`),className:`mb-2 flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(x,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}function ot({runId:e}){let t=g(e);return(0,Y.jsx)(`div`,{"data-slot":`notes-panel`,className:`mb-3 max-h-72 overflow-y-auto rounded-md border border-border bg-card px-4 py-3`,children:t.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):t.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}):t.data.trim().length>0?(0,Y.jsx)(we,{children:t.data}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})})}export{K as a,U as c,G as i,H as l,Z as n,Ke as o,J as r,q as s,Q as t};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,s as n,u as r}from"./bundle-mjs-BegPhL5c.js";import{A as i,At as a,Ht as o,Ot as s,a as c,fn as l,ft as u,i as d,k as f,mn as p,mt as m,t as h,un as g,ut as _,yt as v,zt as y}from"./centered-state-CLmJ67EV.js";import{r as b,t as x}from"./utils-B8s5qIcK.js";import{n as S,t as C}from"./trash-2-DAyZ0VSi.js";import{n as w,r as ee}from"./skill-empty-hint-DTUSp6Vl.js";import{t as te}from"./square-terminal-Ckjjn0vb.js";import{t as T}from"./triangle-alert-Uy8rokUh.js";import{t as ne}from"./upload-CDdyPPo_.js";import{n as re,t as ie}from"./textarea-Bj_LCreg.js";import{Gt as ae,It as E,Jt as D,Zt as oe,_ as se,_t as O,an as ce,c as le,d as ue,f as k,g as de,h as A,m as fe,p as j,u as pe,yt as me}from"./index-CcfkF2Ey.js";var he=b(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),M=r(t()),N=r(n());function ge(){var e=[...arguments];return(0,N.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var P=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function F(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _e(e){return`nodeType`in e}function I(e){return e?F(e)?e:_e(e)?e.ownerDocument?.defaultView??window:window:window}function L(e){let{Document:t}=I(e);return e instanceof t}function ve(e){return!F(e)&&e instanceof I(e).HTMLElement}function ye(e){return e instanceof I(e).SVGElement}function R(e){return e?F(e)?e.document:_e(e)?L(e)?e:ve(e)||ye(e)?e.ownerDocument:document:document:document}var z=P?N.useLayoutEffect:N.useEffect;function be(e){let t=(0,N.useRef)(e);return z(()=>{t.current=e}),(0,N.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function B(){let e=(0,N.useRef)(null);return[(0,N.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,N.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function xe(e,t){t===void 0&&(t=[e]);let n=(0,N.useRef)(e);return z(()=>{n.current!==e&&(n.current=e)},t),n}function V(e,t){let n=(0,N.useRef)();return(0,N.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function H(e){let t=be(e),n=(0,N.useRef)(null);return[n,(0,N.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Se(e){let t=(0,N.useRef)();return(0,N.useEffect)(()=>{t.current=e},[e]),t.current}var U={};function Ce(e,t){return(0,N.useMemo)(()=>{if(t)return t;let n=U[e]==null?0:U[e]+1;return U[e]=n,e+`-`+n},[e,t])}function we(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Te=we(1),Ee=we(-1);function De(e){return`clientX`in e&&`clientY`in e}function W(e){if(!e)return!1;let{KeyboardEvent:t}=I(e.target);return t&&e instanceof t}function G(e){if(!e)return!1;let{TouchEvent:t}=I(e.target);return t&&e instanceof t}function Oe(e){if(G(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return De(e)?{x:e.clientX,y:e.clientY}:null}var K=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ke=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ae(e){return e.matches(ke)?e:e.querySelector(ke)}var je={display:`none`};function Me(e){let{id:t,value:n}=e;return N.createElement(`div`,{id:t,style:je},n)}function Ne(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return N.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Pe(){let[e,t]=(0,N.useState)(``);return{announce:(0,N.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Fe=(0,N.createContext)(null);function Ie(e){let t=(0,N.useContext)(Fe);(0,N.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Le(){let[e]=(0,N.useState)(()=>new Set),t=(0,N.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,N.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Re={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},ze={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Be(e){let{announcements:t=ze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Re}=e,{announce:a,announcement:o}=Pe(),s=Ce(`DndLiveRegion`),[c,l]=(0,N.useState)(!1);if((0,N.useEffect)(()=>{l(!0)},[]),Ie((0,N.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=N.createElement(N.Fragment,null,N.createElement(Me,{id:r,value:i.draggable}),N.createElement(Ne,{id:s,announcement:o}));return n?(0,M.createPortal)(u,n):u}var q;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(q||={});function Ve(){}function He(e,t){return(0,N.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ue(){var e=[...arguments];return(0,N.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function We(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ge(e,t){let n=Oe(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ke(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Je(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Ye(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Xe(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Ze=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Xe(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=We(Xe(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ke)},Qe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Je(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Je(r),o=i.reduce((e,t,r)=>e+We(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Ke)};function $e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var et=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(qe)};function tt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function rt(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var it=rt(1);function at(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ot(e,t,n){let r=at(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var st={ignoreTransform:!1};function ct(e,t){t===void 0&&(t=st);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=I(e).getComputedStyle(e);t&&(n=ot(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function lt(e){return ct(e,{ignoreTransform:!0})}function ut(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function dt(e,t){return t===void 0&&(t=I(e).getComputedStyle(e)),t.position===`fixed`}function ft(e,t){t===void 0&&(t=I(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function pt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(L(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ve(i)||ye(i)||n.includes(i))return n;let a=I(e).getComputedStyle(i);return i!==e&&ft(i,a)&&n.push(i),dt(i,a)?n:r(i.parentNode)}return e?r(e):n}function mt(e){let[t]=pt(e,1);return t??null}function ht(e){return!P||!e?null:F(e)?e:_e(e)?L(e)||e===R(e).scrollingElement?window:ve(e)?e:null:null}function gt(e){return F(e)?e.scrollX:e.scrollLeft}function _t(e){return F(e)?e.scrollY:e.scrollTop}function vt(e){return{x:gt(e),y:_t(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function yt(e){return!P||!e?!1:e===document.scrollingElement}function bt(e){let t={x:0,y:0},n=yt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var xt={x:.2,y:.2};function St(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=xt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ct(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wt(e){return e.reduce((e,t)=>Te(e,vt(t)),J)}function Tt(e){return e.reduce((e,t)=>e+gt(t),0)}function Et(e){return e.reduce((e,t)=>e+_t(t),0)}function Dt(e,t){if(t===void 0&&(t=ct),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);mt(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ot=[[`x`,[`left`,`right`],Tt],[`y`,[`top`,`bottom`],Et]],kt=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=pt(t),r=wt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ot)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},At=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function jt(e){let{EventTarget:t}=I(e);return e instanceof t?e:R(e)}function Mt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function Nt(e){e.preventDefault()}function Pt(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var Ft={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},It=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},Lt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new At(R(t)),this.windowListeners=new At(I(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Dt(n),t(J)}handleKeyDown(e){if(W(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ft,coordinateGetter:a=It,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ee(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=bt(n),p=Ct(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Te(Ee(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Lt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ft,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Rt(e){return!!(e&&`distance`in e)}function zt(e){return!!(e&&`delay`in e)}var Bt=class{constructor(e,t,n){n===void 0&&(n=jt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=R(i),this.documentListeners=new At(this.document),this.listeners=new At(n),this.windowListeners=new At(I(i)),this.initialCoordinates=Oe(r)??J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,Nt),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,Nt),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(zt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Rt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(X.Click,Pt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Oe(e)??J,s=Ee(n,o);if(!t&&a){if(Rt(a)){if(a.tolerance!=null&&Mt(s,a.tolerance))return this.handleCancel();if(Mt(s,a.distance))return this.handleStart()}if(zt(a)&&Mt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Vt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Ht=class extends Bt{constructor(e){let{event:t}=e,n=R(t.target);super(e,Vt,n)}};Ht.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ut={move:{name:`mousemove`},end:{name:`mouseup`}},Wt;(function(e){e[e.RightClick=2]=`RightClick`})(Wt||={});var Gt=class extends Bt{constructor(e){super(e,Ut,R(e.event.target))}};Gt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Wt.RightClick?!1:(r?.({event:n}),!0)}}];var Kt={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},qt=class extends Bt{constructor(e){super(e,Kt)}static setup(){return window.addEventListener(Kt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Kt.move.name,e)};function e(){}}};qt.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Jt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Jt||={});var Yt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Yt||={});function Xt(e){let{acceleration:t,activator:n=Jt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Yt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Qt({delta:d,disabled:!a}),[m,h]=B(),g=(0,N.useRef)({x:0,y:0}),_=(0,N.useRef)({x:0,y:0}),v=(0,N.useMemo)(()=>{switch(n){case Jt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Jt.DraggableRect:return i}},[n,i,c]),y=(0,N.useRef)(null),b=(0,N.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,N.useMemo)(()=>s===Yt.TreeOrder?[...l].reverse():l,[s,l]);(0,N.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=St(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Zt={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function Qt(e){let{delta:t,disabled:n}=e,r=Se(t);return V(e=>{if(n||!r||!e)return Zt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function $t(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return V(e=>t==null?null:r??e??null,[r,t])}function en(e,t){return(0,N.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var tn;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(tn||={});var nn;(function(e){e.Optimized=`optimized`})(nn||={});var rn=new Map;function an(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,N.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,N.useRef)(e),d=g(),f=xe(d),p=(0,N.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,N.useRef)(null),h=V(t=>{if(d&&!n)return rn;if(!t||t===rn||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new kt(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,N.useEffect)(()=>{u.current=e},[e]),(0,N.useEffect)(()=>{d||p()},[n,d]),(0,N.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,N.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case tn.Always:return!1;case tn.BeforeDragging:return n;default:return!n}}}function on(e,t){return V(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function sn(e,t){return on(e,t)}function cn(e){let{callback:t,disabled:n}=e,r=be(t),i=(0,N.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,N.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ln(e){let{callback:t,disabled:n}=e,r=be(t),i=(0,N.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,N.useEffect)(()=>()=>i?.disconnect(),[i]),i}function un(e){return new kt(ct(e),e)}function dn(e,t,n){t===void 0&&(t=un);let[r,i]=(0,N.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=cn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ln({callback:a});return z(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function fn(e){return nt(e,on(e))}var pn=[];function mn(e){let t=(0,N.useRef)(e),n=V(n=>e?n&&n!==pn&&e&&t.current&&e.parentNode===t.current.parentNode?n:pt(e):pn,[e]);return(0,N.useEffect)(()=>{t.current=e},[e]),n}function hn(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(e),i=(0,N.useCallback)(e=>{let t=ht(e.target);t&&n(e=>e?(e.set(t,vt(t)),new Map(e)):null)},[]);return(0,N.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ht(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,vt(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ht(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,N.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Te(e,t),J):wt(e):J,[e,t])}function gn(e,t){t===void 0&&(t=[]);let n=(0,N.useRef)(null);return(0,N.useEffect)(()=>{n.current=null},t),(0,N.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ee(e,n.current):J}function _n(e){(0,N.useEffect)(()=>{if(!P)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function vn(e,t){return(0,N.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function yn(e){return(0,N.useMemo)(()=>e?ut(e):null,[e])}var bn=[];function xn(e,t){t===void 0&&(t=ct);let[n]=e,r=yn(n?I(n):null),[i,a]=(0,N.useState)(bn);function o(){a(()=>e.length?e.map(e=>yt(e)?r:new kt(t(e),e)):bn)}let s=ln({callback:o});return z(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Sn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ve(t)?t:e}function Cn(e){let{measure:t}=e,[n,r]=(0,N.useState)(null),i=ln({callback:(0,N.useCallback)(e=>{for(let{target:n}of e)if(ve(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=H((0,N.useCallback)(e=>{let n=Sn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,N.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var wn=[{sensor:Ht,options:{}},{sensor:Lt,options:{}}],Tn={current:{}},En={draggable:{measure:lt},droppable:{measure:lt,strategy:tn.WhileDragging,frequency:nn.Optimized},dragOverlay:{measure:ct}},Dn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},On={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ve},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:En,measureDroppableContainers:Ve,windowRect:null,measuringScheduled:!1},kn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Ve,draggableNodes:new Map,over:null,measureDroppableContainers:Ve},An=(0,N.createContext)(kn),jn=(0,N.createContext)(On);function Mn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Dn}}}function Nn(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Dn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Dn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Dn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Pn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,N.useContext)(An),a=Se(r),o=Se(n?.id);return(0,N.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!W(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ae(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Fn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function In(e){return(0,N.useMemo)(()=>({draggable:{...En.draggable,...e?.draggable},droppable:{...En.droppable,...e?.droppable},dragOverlay:{...En.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ln(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,N.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;z(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=nt(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=mt(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Rn=(0,N.createContext)({...J,scaleX:1,scaleY:1}),zn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(zn||={});var Bn=(0,N.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=wn,collisionDetection:o=et,measuring:s,modifiers:c,...l}=e,[u,d]=(0,N.useReducer)(Nn,void 0,Mn),[f,p]=Le(),[m,h]=(0,N.useState)(zn.Uninitialized),g=m===zn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,N.useRef)({initial:null,translated:null}),C=(0,N.useMemo)(()=>_==null?null:{id:_,data:x?.data??Tn,rect:S},[_,x]),w=(0,N.useRef)(null),[ee,te]=(0,N.useState)(null),[T,ne]=(0,N.useState)(null),re=xe(l,Object.values(l)),ie=Ce(`DndDescribedBy`,t),ae=(0,N.useMemo)(()=>b.getEnabled(),[b]),E=In(s),{droppableRects:D,measureDroppableContainers:oe,measuringScheduled:se}=an(ae,{dragging:g,dependencies:[y.x,y.y],config:E.droppable}),O=$t(v,_),ce=(0,N.useMemo)(()=>T?Oe(T):null,[T]),le=Ae(),ue=sn(O,E.draggable.measure);Ln({activeNode:_==null?null:v.get(_),config:le.layoutShiftCompensation,initialRect:ue,measure:E.draggable.measure});let k=dn(O,E.draggable.measure,ue),de=dn(O?O.parentElement:null),A=(0,N.useRef)({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=b.getNodeFor(A.current.over?.id),j=Cn({measure:E.dragOverlay.measure}),pe=j.nodeRef.current??O,me=g?j.rect??k:null,he=!!(j.nodeRef.current&&j.rect),ge=fn(he?null:k),P=yn(pe?I(pe):null),F=mn(g?fe??O:null),_e=xn(F),L=Fn(c,{transform:{x:y.x-ge.x,y:y.y-ge.y,scaleX:1,scaleY:1},activatorEvent:T,active:C,activeNodeRect:k,containerNodeRect:de,draggingNodeRect:me,over:A.current.over,overlayNodeRect:j.rect,scrollableAncestors:F,scrollableAncestorRects:_e,windowRect:P}),ve=ce?Te(ce,y):null,ye=hn(F),R=gn(ye),be=gn(ye,[k]),B=Te(L,R),V=me?it(me,L):null,H=C&&V?o({active:C,collisionRect:V,droppableRects:D,droppableContainers:ae,pointerCoordinates:ve}):null,Se=Ye(H,`id`),[U,we]=(0,N.useState)(null),Ee=tt(he?L:Te(L,be),U?.rect??null,k),De=(0,N.useRef)(null),W=(0,N.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:A,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=re.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=re.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=re.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,M.unstable_batchedUpdates)(()=>{r?.(i),h(zn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),te(De.current),ne(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});De.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=A.current,o=null;if(t&&i){let{cancelDrop:s}=re.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}w.current=null,(0,M.unstable_batchedUpdates)(()=>{d({type:e}),h(zn.Uninitialized),we(null),te(null),ne(null),De.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=re.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),G=en(a,(0,N.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,W(n,t))},[v,W]));_n(a),z(()=>{k&&m===zn.Initializing&&h(zn.Initialized)},[k,m]),(0,N.useEffect)(()=>{let{onDragMove:e}=re.current,{active:t,activatorEvent:n,collisions:r,over:i}=A.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:B.x,y:B.y},over:i};(0,M.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[B.x,B.y]),(0,N.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=A.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=re.current,o=r.get(Se),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,M.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Se]),z(()=>{A.current={activatorEvent:T,active:C,activeNode:O,collisionRect:V,collisions:H,droppableRects:D,draggableNodes:v,draggingNode:pe,draggingNodeRect:me,droppableContainers:b,over:U,scrollableAncestors:F,scrollAdjustedTranslate:B},S.current={initial:me,translated:V}},[C,O,H,V,v,pe,me,D,b,U,F,B]),Xt({...le,delta:y,draggingRect:V,pointerCoordinates:ve,scrollableAncestors:F,scrollableAncestorRects:_e});let K=(0,N.useMemo)(()=>({active:C,activeNode:O,activeNodeRect:k,activatorEvent:T,collisions:H,containerNodeRect:de,dragOverlay:j,draggableNodes:v,droppableContainers:b,droppableRects:D,over:U,measureDroppableContainers:oe,scrollableAncestors:F,scrollableAncestorRects:_e,measuringConfiguration:E,measuringScheduled:se,windowRect:P}),[C,O,k,T,H,de,j,v,b,D,U,oe,F,_e,E,se,P]),ke=(0,N.useMemo)(()=>({activatorEvent:T,activators:G,active:C,activeNodeRect:k,ariaDescribedById:{draggable:ie},dispatch:d,draggableNodes:v,over:U,measureDroppableContainers:oe}),[T,G,C,k,d,ie,v,U,oe]);return N.createElement(Fe.Provider,{value:p},N.createElement(An.Provider,{value:ke},N.createElement(jn.Provider,{value:K},N.createElement(Rn.Provider,{value:Ee},i)),N.createElement(Pn,{disabled:n?.restoreFocus===!1})),N.createElement(Be,{...n,hiddenTextDescribedById:ie}));function Ae(){let e=ee?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Vn=(0,N.createContext)(null),Hn=`button`,Un=`Draggable`;function Wn(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ce(Un),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,N.useContext)(An),{role:p=Hn,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,N.useContext)(g?Rn:Vn),[v,y]=H(),[b,x]=H(),S=vn(o,t),C=xe(n);return z(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,N.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Hn?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Gn(){return(0,N.useContext)(jn)}var Kn=`Droppable`,qn={timeout:25};function Jn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ce(Kn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,N.useContext)(An),u=(0,N.useRef)({disabled:n}),d=(0,N.useRef)(!1),f=(0,N.useRef)(null),p=(0,N.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...qn,...i},_=xe(h??r),v=ln({callback:(0,N.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=H((0,N.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=xe(t);return(0,N.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,N.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,N.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Yn(e){let{animation:t,children:n}=e,[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(null),s=Se(n);return!n&&!r&&s&&i(s),z(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),N.createElement(N.Fragment,null,n,r?(0,N.cloneElement)(r,{ref:o}):null)}var Xn={x:0,y:0,scaleX:1,scaleY:1};function Zn(e){let{children:t}=e;return N.createElement(An.Provider,{value:kn},N.createElement(Rn.Provider,{value:Xn},t))}var Qn={position:`fixed`,touchAction:`none`},$n=e=>W(e)?`transform 250ms ease`:void 0,er=(0,N.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=$n}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Qn,width:s.width,height:s.height,top:s.top,left:s.left,transform:K.Transform.toString(d),transformOrigin:i&&r?Ge(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return N.createElement(n,{className:o,style:f,ref:t},a)}),tr={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:K.Transform.toString(t)},{transform:K.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function nr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return be((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Sn(a);if(!c)return;let{transform:l}=I(a).getComputedStyle(a),u=at(l);if(!u)return;let d=typeof t==`function`?t:rr(t);return Dt(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function rr(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...tr,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var ir=0;function ar(e){return(0,N.useMemo)(()=>{if(e!=null)return ir++,ir},[e])}var or=N.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Gn(),S=(0,N.useContext)(Rn),C=ar(d?.id),w=Fn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),ee=on(f),te=nr({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),T=ee?g.setRef:void 0;return N.createElement(Zn,null,N.createElement(Yn,{animation:te},d&&C?N.createElement(er,{key:C,id:d.id,ref:T,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:ee,style:{zIndex:l,...i},transform:w},n):null))});function sr(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function cr(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function lr(e){return e!==null&&e>=0}function ur(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function dr(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var fr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=sr(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pr={scaleX:1,scaleY:1},mr=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pr}:null}let s=hr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pr}:r<t&&r>=a?{x:0,y:o.height+s,...pr}:{x:0,y:0,...pr}};function hr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gr=`Sortable`,_r=N.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:i=fr,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Gn(),d=Ce(gr,n),f=s.rect!==null,p=(0,N.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,N.useRef)(p),v=!ur(p,_.current),y=g!==-1&&h===-1||v,b=dr(a);z(()=>{v&&m&&u(p)},[v,p,m,u]),(0,N.useEffect)(()=>{_.current=p},[p]);let x=(0,N.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:cr(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return N.createElement(_r.Provider,{value:x},t)}var yr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return sr(n,r,i).indexOf(t)},br=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xr={duration:200,easing:`ease`},Sr=`transform`,Cr=K.Transition.toString({property:Sr,duration:0,easing:`linear`}),wr={roleDescription:`sortable`};function Tr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,N.useState)(null),s=(0,N.useRef)(n);return z(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=ct(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,N.useEffect)(()=>{a&&o(null)},[a]),a}function Er(e){let{animateLayoutChanges:t=br,attributes:n,disabled:r,data:i,getNewIndex:a=yr,id:o,strategy:s,resizeObserverConfig:c,transition:l=xr}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,N.useContext)(_r),y=Dr(r,p),b=u.indexOf(o),x=(0,N.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,N.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:ee,setNodeRef:te}=Jn({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:T,activatorEvent:ne,activeNodeRect:re,attributes:ie,setNodeRef:ae,listeners:E,isDragging:D,over:oe,setActivatorNodeRef:se,transform:O}=Wn({id:o,data:x,attributes:{...wr,...n},disabled:y.draggable}),ce=ge(te,ae),le=!!T,ue=le&&!m&&lr(f)&&lr(g),k=!_&&D,de=ue?(k&&ue?O:null)??(s??v)({rects:h,activeNodeRect:re,activeIndex:f,overIndex:g,index:b}):null,A=lr(f)&&lr(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,fe=T?.id,j=(0,N.useRef)({activeId:fe,items:u,newIndex:A,containerId:d}),pe=u!==j.current.items,me=t({active:T,containerId:d,isDragging:D,isSorting:le,id:o,index:b,items:u,newIndex:j.current.newIndex,previousItems:j.current.items,previousContainerId:j.current.containerId,transition:l,wasDragging:j.current.activeId!=null}),he=Tr({disabled:!me,index:b,node:w,rect:C});return(0,N.useEffect)(()=>{le&&j.current.newIndex!==A&&(j.current.newIndex=A),d!==j.current.containerId&&(j.current.containerId=d),u!==j.current.items&&(j.current.items=u)},[le,A,d,u]),(0,N.useEffect)(()=>{if(fe===j.current.activeId)return;if(fe!=null&&j.current.activeId==null){j.current.activeId=fe;return}let e=setTimeout(()=>{j.current.activeId=fe},50);return()=>clearTimeout(e)},[fe]),{active:T,activeIndex:f,attributes:ie,data:x,rect:C,index:b,newIndex:A,items:u,isOver:ee,isSorting:le,isDragging:D,listeners:E,node:w,overIndex:g,over:oe,setNodeRef:ce,setActivatorNodeRef:se,setDroppableNodeRef:te,setDraggableNodeRef:ae,transform:he??de,transition:M()};function M(){if(he||pe&&j.current.newIndex===b)return Cr;if(!(k&&!W(ne)||!l)&&(le||me))return K.Transition.toString({...l,property:Sr})}}function Dr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Or(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var kr=[Z.Down,Z.Right,Z.Up,Z.Left],Ar=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(kr.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Z.Down:r.top<a.top&&t.push(n);break;case Z.Up:r.top>a.top&&t.push(n);break;case Z.Left:r.left>a.left&&t.push(n);break;case Z.Right:r.left<a.left&&t.push(n);break}});let c=Qe({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Ye(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=pt(c).some((e,t)=>s[t]!==e),i=jr(e,t),a=Mr(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ee(u,l)}}}};function jr(e,t){return!Or(e)||!Or(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Mr(e,t){return!Or(e)||!Or(t)||!jr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Nr(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.model||n.runner||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Pr(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Fr(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Ir(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Lr(e,t){return e.filter((e,n)=>n!==t)}function Q(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function Rr(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
6
|
-
`)?[`${r}${e}: |`,...t.split(`
|
|
7
|
-
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Q(t)}`]}function zr(e,t,n){let r=[`name: ${Q(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Rr(`description`,t.trim(),0));let i=Nr(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Q(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(` - id: ${Q(e.id)}`),e.name&&e.name!==e.id&&r.push(` name: ${Q(e.name)}`),e.skill&&r.push(` skill: ${Q(e.skill)}`),e.prompt&&r.push(...Rr(`prompt`,e.prompt,4)),e.model&&r.push(` model: ${Q(e.model)}`),e.runner&&r.push(` runner: ${Q(e.runner)}`),e.allowedTools&&r.push(` allowedTools: [${e.allowedTools.map(Q).join(`, `)}]`),e.bashAllowlist&&r.push(` bashAllowlist: [${e.bashAllowlist.map(Q).join(`, `)}]`),e.command&&r.push(...Rr(`command`,e.command,4)),e.onFail&&r.push(` onFail:`,` retry: ${Q(e.onFail.retry)}`,` max: ${e.onFail.max??2}`)}else r.push(`skills: []`);return`${r.join(`
|
|
8
|
-
`)}\n`}function Br(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Vr(e){let t=Nr(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Hr(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Ur(e,t,n){let r=Nr(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var $=e(),Wr=`wb-canvas`;function Gr(){return{name:`my-workflow`,description:``,steps:[]}}function Kr(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function qr(){let{name:e}=g();return(0,$.jsx)(Jr,{routeName:e},e??``)}function Jr({routeName:e}){let t=m(),n=_(),r=u(),g=p(),[b,S]=(0,N.useState)(null),[w,te]=(0,N.useState)(``),[re,D]=(0,N.useState)(!1),[oe,O]=(0,N.useState)(``),[ce,M]=(0,N.useState)(``),[ge,P]=(0,N.useState)(!1),[F,_e]=(0,N.useState)(``),[I,L]=(0,N.useState)(!1),[ve,ye]=(0,N.useState)(!1),[R,z]=(0,N.useState)(null),[be,B]=(0,N.useState)(null),xe=(0,N.useRef)(null),V=t.data?.workflows??[],H=n.data??[],Se=me(H,r.data?.skillUsage);(0,N.useEffect)(()=>{if(b!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);S(r?Kr(r):Gr())},[b,t.data,e]);let U=e=>S(t=>t===null?t:{...t,steps:e}),Ce=l({mutationFn:e=>y(e),onSuccess:e=>{S({name:e.name,description:e.description??``,steps:e.steps}),D(!1),O(``),M(``),d(`Imported "${e.name}" — review, then Save.`)},onError:e=>M(e.message)}),we=l({mutationFn:e=>o(e),onSuccess:e=>{S(t=>{let n=t??Gr(),{name:r,steps:i}=Hr(e,n.name);return{...n,name:r,steps:i}}),P(!1),_e(``),d(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??b?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>d(e instanceof Error?e.message:String(e),{tone:`danger`})}),Te=l({mutationFn:e=>s({...Ur(b?.name??``,b?.description??``,b?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{L(!1),d(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:i.workflows})},onError:e=>{e instanceof v&&e.exists===!0?L(!0):d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ee=l({mutationFn:e=>a(e),onSuccess:(e,t)=>{ye(!1),d(`Deleted "${t}".`),S(Gr()),g.invalidateQueries({queryKey:i.workflows})},onError:e=>{ye(!1),d(e instanceof Error?e.message:String(e),{tone:`danger`})}}),De=Ue(He(Ht,{activationConstraint:{distance:4}}),He(Lt,{coordinateGetter:Ar}));if(t.isError)return(0,$.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(h,{icon:(0,$.jsx)(T,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(b===null)return(0,$.jsx)(le,{});let W=b.steps,G=b.name.trim(),Oe=V.find(e=>e.name===G&&e.source===`file`),K=zr(b.name,b.description,W),ke=(e,t=W.length)=>{if(W.length>=8){d(`A workflow holds at most 8 steps.`,{tone:`danger`});return}U(Fr(W,Pr(e,W),t))},Ae=e=>{let t=e.active.data.current;z(t??null)},je=e=>{B(e.over?String(e.over.id):null)},Me=e=>{z(null),B(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===Wr?W.length:W.findIndex(e=>e.id===n.id);ke(r.skill,e===-1?W.length:e);return}if(n.id===t.id)return;let i=W.findIndex(e=>e.id===t.id),a=W.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&U(Ir(W,i,a))},Ne=()=>{let e=oe.trim();e!==``&&Ce.mutate(e)},Pe=()=>{let e=F.trim();e===``||we.isPending||we.mutate(e)};return(0,$.jsxs)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:[(0,$.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Workflows`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Portable skill chains — the agent applies them top to bottom.`})]}),(0,$.jsxs)(Bn,{sensors:De,collisionDetection:Ze,onDragStart:Ae,onDragOver:je,onDragEnd:Me,onDragCancel:()=>{z(null),B(null)},children:[(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-6 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:flex-row md:p-5 md:pb-5`,children:[(0,$.jsxs)(`section`,{"data-slot":`wb-main`,className:`mx-auto w-full min-w-0 max-w-3xl flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,$.jsx)(E,{ref:xe,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:b.name,onChange:e=>S({...b,name:e.target.value}),className:`h-8 max-w-56 font-mono text-[13px] font-semibold`}),(0,$.jsx)(`span`,{"data-slot":`wb-count`,className:`shrink-0 font-mono text-xs text-soft-foreground`,children:Vr(W)})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[Oe?(0,$.jsxs)(c,{type:`button`,variant:`danger-ghost`,size:`sm`,"data-slot":`wb-delete`,title:`Delete the saved workflow file`,onClick:()=>ye(!0),children:[(0,$.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null,(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":ge,title:`Describe a chain — the agent builds it`,onClick:()=>{D(!1),P(e=>!e)},children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,onClick:()=>{M(``),P(!1),D(e=>!e)},children:[(0,$.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,$.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,title:`Download workflow.yaml`,onClick:()=>{let e=new Blob([K],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Br(b.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},children:[(0,$.jsx)(ee,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-save`,disabled:Te.isPending,onClick:()=>{if(G===``){xe.current?.focus();return}if(W.length===0){d(`Add at least one step first.`,{tone:`danger`});return}Te.mutate(!1)},children:[(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,$.jsxs)(`div`,{"data-slot":`wb-load`,className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`mr-0.5 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`edit`}),V.map(e=>(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-load-chip`,"data-name":e.name,title:e.description??``,"aria-pressed":G===e.name,onClick:()=>S(Kr(e)),className:x(`rounded-full border border-border bg-card px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,G===e.name&&`border-primary/40 bg-primary/10 text-foreground`),children:e.name},e.name)),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-new`,title:`Start an empty workflow`,onClick:()=>S(Gr()),className:`rounded-full border border-dashed border-border px-2.5 py-1 font-mono text-[11.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`+ new`})]}),ge?(0,$.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Build a chain from a prompt`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Describe what the chain should do. An agent proposes a title and an ordered set of skill / check steps — land it on the canvas, then tweak and Save.`}),(0,$.jsx)(ie,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:F,onChange:e=>_e(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Pe())},className:`mt-2 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsxs)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-auto-run`,disabled:we.isPending||F.trim()===``,onClick:Pe,children:[(0,$.jsx)(he,{"aria-hidden":`true`,className:`size-3`}),we.isPending?`Building…`:`Build chain`]}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:()=>{P(!1),_e(``)},children:`Cancel`})]})]}):null,re?(0,$.jsxs)(`div`,{"data-slot":`wb-import-panel`,className:`mt-4 rounded-lg border border-border bg-card p-3 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Import workflow YAML`}),(0,$.jsx)(ie,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:6,spellCheck:!1,placeholder:`name: my-flow
|
|
9
|
-
skills:
|
|
10
|
-
- test-conventions
|
|
11
|
-
- commit-style`,value:oe,onChange:e=>O(e.target.value),className:`mt-2 min-h-28 font-mono text-xs`}),ce===``?null:(0,$.jsx)(`p`,{"data-slot":`wb-import-error`,className:`mt-2 text-xs text-danger`,children:ce}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsx)(c,{type:`button`,variant:`contrast`,size:`sm`,"data-slot":`wb-import-run`,disabled:Ce.isPending,onClick:Ne,children:`Import`}),(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:()=>{D(!1),O(``),M(``)},children:`Cancel`})]})]}):null,(0,$.jsx)(Yr,{steps:W,skills:H,dragging:R!==null,overId:be,activeStepId:R?.type===`step`?R.step.id:null,onRemove:e=>U(Lr(W,e))})]}),(0,$.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`w-full shrink-0 md:w-[320px]`,children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`Skills`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-soft-foreground`,children:`Drag into the flow. Order is execution order — the agent applies them top to bottom.`}),(0,$.jsx)(E,{"data-slot":`wb-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:w,onChange:e=>te(e.target.value),className:`mt-2.5 h-8 text-[13px]`}),(0,$.jsx)(Qr,{skills:Se,query:w,error:n.isError?n.error.message:null,inFlow:new Set(W.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>ke(e)}),(0,$.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:`workflow.yaml`}),(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(ei,{yaml:K})]}),(0,$.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 overflow-x-auto rounded-lg border border-border bg-card p-3 font-mono text-[11.5px] leading-relaxed whitespace-pre text-muted-foreground shadow-xs`,children:K}),(0,$.jsx)(`p`,{className:`mt-2 text-[11.5px] leading-relaxed text-soft-foreground`,children:`Portable — export this file and import it in any repo running cezar.`})]})]}),(0,$.jsx)(or,{children:R?.type===`palette`?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 text-primary`}),R.skill]}):R?.type===`step`?(0,$.jsx)(Zr,{step:R.step,index:W.findIndex(e=>e.id===R.step.id),skills:H,overlay:!0}):null})]}),(0,$.jsx)(pe,{open:I,onOpenChange:e=>!e&&L(!1),children:(0,$.jsxs)(j,{"data-slot":`wb-overwrite-dialog`,children:[(0,$.jsxs)(de,{children:[(0,$.jsxs)(se,{children:[`“`,G,`” already exists`]}),(0,$.jsx)(fe,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,$.jsxs)(A,{children:[(0,$.jsx)(k,{children:`Keep the file`}),(0,$.jsx)(ue,{"data-slot":`wb-overwrite-confirm`,onClick:()=>Te.mutate(!0),children:`Overwrite`})]})]})}),(0,$.jsx)(pe,{open:ve,onOpenChange:e=>!e&&ye(!1),children:(0,$.jsxs)(j,{"data-slot":`wb-delete-dialog`,children:[(0,$.jsxs)(de,{children:[(0,$.jsxs)(se,{children:[`Delete workflow “`,G,`”?`]}),(0,$.jsxs)(fe,{children:[`Removes `,Oe?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,$.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,$.jsxs)(A,{children:[(0,$.jsx)(k,{children:`Keep it`}),(0,$.jsx)(ue,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>Ee.mutate(G),children:`Delete`})]})]})})]})}function Yr({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a}){let{setNodeRef:o,isOver:s}=Jn({id:Wr}),c=n&&r===Wr;return(0,$.jsx)(`div`,{ref:o,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:x(`mt-4 rounded-lg border border-dashed p-2 transition-colors`,s?`border-primary/60 bg-primary/5`:`border-muted-foreground/25`),children:e.length===0?(0,$.jsx)(`p`,{className:x(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,s?`text-primary`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,$.jsxs)(vr,{items:e.map(e=>e.id),strategy:mr,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((e,o)=>(0,$.jsx)(Xr,{step:e,index:o,skills:t,connector:o>0,dragging:n,insertBefore:n&&r===e.id&&i!==e.id,onRemove:()=>a(o)},e.id))}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:x(`mx-1 mt-2.5 h-[3px] rounded-full transition-colors`,c?`bg-primary`:`bg-transparent`)}),(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 pt-1.5 pb-1 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),`runs top to bottom`]})]})})}function Xr({step:e,index:t,skills:n,connector:r,dragging:i,insertBefore:a,onRemove:o}){let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=Er({id:e.id,data:{type:`step`,step:e}});return(0,$.jsxs)(`li`,{ref:l,style:{transform:K.Transform.toString(u),transition:d},className:x(`relative`,f&&`opacity-40`),children:[r&&!i?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-[11px] left-1/2 h-[9px] w-px -translate-x-1/2 bg-muted-foreground/30`}):null,a?(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-primary`}):null,(0,$.jsx)(Zr,{step:e,index:t,skills:n,onRemove:o,gripProps:{...s,...c}})]})}function Zr({step:e,index:t,skills:n,onRemove:r,gripProps:i,overlay:a=!1}){let o=n.find(t=>t.name===e.skill),s=!!e.command,c=s||!e.skill?e.name??e.id:e.skill,l=s?`$ ${e.command}${e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``}`:e.skill?o?.description??`Not in this repo or the team skills — the step runs on its plain prompt.`:e.prompt??``,u=s?`check`:e.skill?o?null:`unknown`:`prompt`;return(0,$.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:x(`flex items-center gap-2.5 rounded-md border border-muted-foreground/20 bg-card-2 px-2.5 py-2 shadow-xs`,a&&`shadow-md`),children:[(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${t+1}: ${c}`,className:`shrink-0 cursor-grab rounded text-muted-foreground outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...i,children:(0,$.jsx)(oe,{"aria-hidden":`true`,className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:String(t+1).padStart(2,`0`)}),s?(0,$.jsx)(te,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-mono text-[13px] font-medium`,children:c}),l?(0,$.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:l}):null]}),u?(0,$.jsx)(`span`,{"data-slot":`wb-step-badge`,className:x(`shrink-0 rounded-full border px-2 py-px font-mono text-[10.5px]`,u===`check`&&`border-success/30 text-success`,u===`unknown`&&`border-danger/35 text-danger`,u===`prompt`&&`border-border text-soft-foreground`),children:u}):null,r?(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-remove`,"aria-label":`Remove step ${t+1}: ${c}`,title:`Remove from flow`,onClick:r,className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-danger focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function Qr({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,$.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=t.trim().toLowerCase(),o=e.filter(e=>a===``||e.name.toLowerCase().includes(a)||(e.description??``).toLowerCase().includes(a));return(0,$.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:o.length>0?o.map(e=>(0,$.jsx)($r,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,$.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,$.jsx)(w,{})})})}function $r({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:i,setNodeRef:a,isDragging:o}=Wn({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,$.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.name,title:e.description??``,className:x(`flex cursor-grab items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 shadow-xs transition-colors hover:bg-muted`,o&&`opacity-40`),...r,...i,children:[(0,$.jsx)(ae,{"aria-hidden":`true`,className:x(`size-3.5 shrink-0`,O(e)?`text-violet`:`text-soft-foreground`)}),(0,$.jsx)(`span`,{className:x(`min-w-0 flex-1 truncate font-mono text-[13px]`,O(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),t?(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-success`}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`shrink-0 rounded p-0.5 text-soft-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`})})]})}function ei({yaml:e}){let[t,n]=(0,N.useState)(!1),r=(0,N.useRef)(null);return(0,N.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}export{qr as WorkflowsRoute};
|