orc-ai 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.js +568 -521
- package/dist/skills/orc-platform/references/setup.md +2 -2
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/{Agents-DD4xAdLQ.js → Agents-C8dJX8px.js} +3 -3
- package/dist/web/assets/{Attention-V6qCS20I.js → Attention-BHYo8Lwr.js} +2 -2
- package/dist/web/assets/{Audit-bBVclx9F.js → Audit-CS_DZkbJ.js} +1 -1
- package/dist/web/assets/ConfirmDialog-CrSa87VF.js +1 -0
- package/dist/web/assets/Dashboard-V813oIhq.js +1 -0
- package/dist/web/assets/{DocumentWorkspace-PsD0kzUF.js → DocumentWorkspace-CNyVQTjg.js} +1 -1
- package/dist/web/assets/EmptyState-Ctm7L70B.js +1 -0
- package/dist/web/assets/ErrorState-BPTepwiG.js +1 -0
- package/dist/web/assets/{FileEditor-RVlQIVWn.js → FileEditor-Dh29_xCL.js} +1 -1
- package/dist/web/assets/JobWebhooks-TvAY8p1V.js +1 -0
- package/dist/web/assets/{Jobs-DjI_YMAA.js → Jobs-C5ggSs2T.js} +3 -3
- package/dist/web/assets/{Knowledge-DMAOn0iH.js → Knowledge-BpiN3iVE.js} +3 -3
- package/dist/web/assets/{PackageCatalog-X1ZZB-P7.js → PackageCatalog-B1U3vfhW.js} +5 -5
- package/dist/web/assets/{Pager-CMh30dp4.js → Pager-ClYYU9et.js} +1 -1
- package/dist/web/assets/PriorityBadge-BW-A50LE.js +1 -0
- package/dist/web/assets/Projects-DRao5Qpk.js +3 -0
- package/dist/web/assets/ResumeActions-DHTOr6GQ.js +11 -0
- package/dist/web/assets/{Rules-BNiDiUnr.js → Rules-DGKsAbTf.js} +2 -2
- package/dist/web/assets/{Sessions-N3CCkXrg.js → Sessions-CWHU6sYy.js} +3 -3
- package/dist/web/assets/Settings-yW1S2q4F.js +30 -0
- package/dist/web/assets/Skills-BwdXE5nT.js +16 -0
- package/dist/web/assets/SourceEditor-ft02z20v.js +43 -0
- package/dist/web/assets/StatusBadge-C5G1fdZh.js +1 -0
- package/dist/web/assets/TaskDetailSheet-fUSHPFB-.js +11 -0
- package/dist/web/assets/{Tasks-wCQWVIFY.js → Tasks-uRqvmLz7.js} +9 -9
- package/dist/web/assets/Terminals-W5nszLI1.js +120 -0
- package/dist/web/assets/ViewHeader-DXR0ZaMO.js +1 -0
- package/dist/web/assets/Webhooks-lXLoKWdt.js +1 -0
- package/dist/web/assets/{abnfDiagram-VCTEODGH-D6z8wrMR.js → abnfDiagram-VCTEODGH-K8P_VxLi.js} +1 -1
- package/dist/web/assets/{arc-BG4KWrJo.js → arc-BOl9BKfD.js} +1 -1
- package/dist/web/assets/{architectureDiagram-5GKGNRK7-Cl_LN0pI.js → architectureDiagram-5GKGNRK7-DIZ15fO5.js} +2 -2
- package/dist/web/assets/{blockDiagram-I7D4REHJ-DDcSWANX.js → blockDiagram-I7D4REHJ-DMrufypV.js} +1 -1
- package/dist/web/assets/{c4Diagram-7LVT6UL2-1TklobpM.js → c4Diagram-7LVT6UL2-BUUxjwvU.js} +1 -1
- package/dist/web/assets/channel-CQFNQIhG.js +1 -0
- package/dist/web/assets/{chunk-2Q5K7J3B-1ZXhRK9s.js → chunk-2Q5K7J3B-wRIxA2_q.js} +1 -1
- package/dist/web/assets/{chunk-5VM5RSS4--PtYqixL.js → chunk-5VM5RSS4-B6lAVcgQ.js} +1 -1
- package/dist/web/assets/{chunk-F27PBJKO-CnodLCYk.js → chunk-F27PBJKO-DVuei-Pl.js} +1 -1
- package/dist/web/assets/{chunk-IMKFNOWR-Dtujfpt3.js → chunk-IMKFNOWR-CwyogA-y.js} +1 -1
- package/dist/web/assets/{chunk-JWPE2WC7-BhzEb4oh.js → chunk-JWPE2WC7-zdsOarNZ.js} +1 -1
- package/dist/web/assets/{chunk-POPQ4Y6H-CCRH8Odz.js → chunk-POPQ4Y6H-D3ieeKih.js} +1 -1
- package/dist/web/assets/{chunk-SVP7TREG-DvO1oor5.js → chunk-SVP7TREG-CmiQdvOH.js} +1 -1
- package/dist/web/assets/{chunk-TICWLB2K-HSsE-7e0.js → chunk-TICWLB2K-CieIpfOy.js} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY-CyZDfwNW.js → chunk-XXDRQBXY-BoTHwisB.js} +1 -1
- package/dist/web/assets/classDiagram-ZZMXUADV-B5yD90Df.js +1 -0
- package/dist/web/assets/classDiagram-v2-VYDZK3BY-B5yD90Df.js +1 -0
- package/dist/web/assets/{cose-bilkent-JH36ORCC-COSptbUK.js → cose-bilkent-JH36ORCC-CtGsuuTW.js} +1 -1
- package/dist/web/assets/{cynefin-OW5HDTMX-BjeQd0nx.js → cynefin-OW5HDTMX-vMXgcpgg.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-5FMLGOSQ-D2tfpg5R.js → cynefinDiagram-5FMLGOSQ-kMbm5D7e.js} +1 -1
- package/dist/web/assets/{dagre-GXQ25YYZ-LPFS53FJ.js → dagre-GXQ25YYZ-xmoviGlr.js} +1 -1
- package/dist/web/assets/{diagram-S7CK7UJ4-CJfymrr7.js → diagram-S7CK7UJ4-CguQzzXs.js} +1 -1
- package/dist/web/assets/{diagram-UQ7AKVKN-BxKvn9Ur.js → diagram-UQ7AKVKN-CMX0u7Gf.js} +1 -1
- package/dist/web/assets/{diagram-VSXAHHWV-Nqep4NOh.js → diagram-VSXAHHWV-cuhv3Fvj.js} +1 -1
- package/dist/web/assets/{diagram-VX7I27RA-DLNoOSxD.js → diagram-VX7I27RA-Bp_JbX0e.js} +1 -1
- package/dist/web/assets/{diagram-Z3DM3KII-CY3P-ZPA.js → diagram-Z3DM3KII-oZ6jRSCd.js} +1 -1
- package/dist/web/assets/{download-zED8Kwne.js → download-UgMvjBjR.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-PWID7BFC-ChViZVtc.js → ebnfDiagram-PWID7BFC-DbxnEjb0.js} +1 -1
- package/dist/web/assets/{erDiagram-RLTQ6QDP-ul1XVJVK.js → erDiagram-RLTQ6QDP-Cl5kXPho.js} +1 -1
- package/dist/web/assets/{flowDiagram-HODETNUW-CP6v5LZZ.js → flowDiagram-HODETNUW-DueO0Ju6.js} +1 -1
- package/dist/web/assets/{folder-open-BUB_WGMS.js → folder-open-DojCP5NP.js} +1 -1
- package/dist/web/assets/{ganttDiagram-EL5Y4UJY-DL4TffYj.js → ganttDiagram-EL5Y4UJY-DNjT4iVH.js} +4 -4
- package/dist/web/assets/{gitGraphDiagram-WWUBYQGX-D6vY0fsS.js → gitGraphDiagram-WWUBYQGX-B4aUQ9gY.js} +1 -1
- package/dist/web/assets/{highlighted-body-KPVGNVTW-Cu3NJ2kc.js → highlighted-body-KPVGNVTW-gt1u8RcC.js} +1 -1
- package/dist/web/assets/index-C_jtMgr7.js +412 -0
- package/dist/web/assets/index-CyjfnRiI.css +1 -0
- package/dist/web/assets/{infoDiagram-27XIBGKW-BlFz7M9s.js → infoDiagram-27XIBGKW-CWcOvNAB.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-5VMMS53U-DmwD3lCC.js → ishikawaDiagram-5VMMS53U-ccIPCUs4.js} +1 -1
- package/dist/web/assets/{journeyDiagram-3NMN7TZE-S4Kc25zO.js → journeyDiagram-3NMN7TZE-rRe3uTLu.js} +1 -1
- package/dist/web/assets/{kanban-definition-UXKFOSKX-CjO1NhtQ.js → kanban-definition-UXKFOSKX-tAKCWntJ.js} +1 -1
- package/dist/web/assets/{layout-Dq9Y2uvt.js → layout-7xCiQ5Mn.js} +1 -1
- package/dist/web/assets/{linear-nLdM3nNe.js → linear-WCNhc07o.js} +1 -1
- package/dist/web/assets/{list-CE13IgiY.js → list-BL4eRkIg.js} +1 -1
- package/dist/web/assets/{mermaid-HWGCJPDP-pjgtNVt2.js → mermaid-HWGCJPDP-C8QwWdo5.js} +6 -6
- package/dist/web/assets/{mindmap-definition-YA3MSWOX-DsxpW-uk.js → mindmap-definition-YA3MSWOX-Cj5-j6a7.js} +1 -1
- package/dist/web/assets/{pegDiagram-XKGWAZYB-DOKdX_Ft.js → pegDiagram-XKGWAZYB-BYB3oVZ_.js} +1 -1
- package/dist/web/assets/{pencil-CKDsHvse.js → pencil-gxvh59uO.js} +1 -1
- package/dist/web/assets/{pieDiagram-E7YTZNPT-iifNLjuz.js → pieDiagram-E7YTZNPT-CSbpzXas.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-AXDQQJYC-Ca9EdnrG.js → quadrantDiagram-AXDQQJYC-DKTP6jS5.js} +1 -1
- package/dist/web/assets/{railroadDiagram-O6MQD6OU-DNcc2r4p.js → railroadDiagram-O6MQD6OU-Ct8aPeLX.js} +1 -1
- package/dist/web/assets/{refresh-cw-CBpDF1Q6.js → refresh-cw-BQRdbjy6.js} +1 -1
- package/dist/web/assets/{requirementDiagram-BXWQKSXE-Bo2W4Z-S.js → requirementDiagram-BXWQKSXE-B9hH69zu.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-P5KCCOFB-BX_lnGu7.js → sankeyDiagram-P5KCCOFB-CDqNONxU.js} +1 -1
- package/dist/web/assets/{save-BK4gikTj.js → save-CYoz3QKB.js} +1 -1
- package/dist/web/assets/scroll-area-CU4DGUBA.js +1 -0
- package/dist/web/assets/{sequenceDiagram-WJ2MYXX4-pXgbZI8i.js → sequenceDiagram-WJ2MYXX4-BF77J63J.js} +1 -1
- package/dist/web/assets/{sizeCapture-INFHLROL-Cc-w7K4o.js → sizeCapture-INFHLROL-Dpubco_U.js} +1 -1
- package/dist/web/assets/{stateDiagram-D77RDMKH-BRg29_UM.js → stateDiagram-D77RDMKH-CzslKEYw.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-MP3YSRHH-DKbNjyV-.js +1 -0
- package/dist/web/assets/{swimlanes-42K2YHIH-D1YPvrQr.js → swimlanes-42K2YHIH-bD_tUjo6.js} +1 -1
- package/dist/web/assets/swimlanesDiagram-VR7AAH4N-0wAluWQF.js +8 -0
- package/dist/web/assets/table-D3N_5Wee.js +1 -0
- package/dist/web/assets/tabs-CSlEXoxD.js +1 -0
- package/dist/web/assets/{timeline-definition-24CTP7MA-CvilnfxW.js → timeline-definition-24CTP7MA-owGoHn8z.js} +1 -1
- package/dist/web/assets/trash-2-D3Ey4I09.js +6 -0
- package/dist/web/assets/{upload-BKVutGgF.js → upload-DhVOCWST.js} +1 -1
- package/dist/web/assets/useDetailRoute-j9nlwack.js +1 -0
- package/dist/web/assets/{useJobs-DSLKgV8L.js → useJobs-Dcl-Vim3.js} +1 -1
- package/dist/web/assets/{useKnowledge-BbtBJLNm.js → useKnowledge-gIjk0_I1.js} +1 -1
- package/dist/web/assets/useListSelection-CSQd_Hmx.js +1 -0
- package/dist/web/assets/{useMemories-CPw6917_.js → useMemories-B8Zpz0Qz.js} +1 -1
- package/dist/web/assets/useProjectScope-Dk0mjyHf.js +1 -0
- package/dist/web/assets/useSessions-BrdK-12R.js +1 -0
- package/dist/web/assets/{vennDiagram-4TSXK5OY-yNMm3LJf.js → vennDiagram-4TSXK5OY-D0_6bldW.js} +1 -1
- package/dist/web/assets/view-params-Bm1Qf6KC.js +1 -0
- package/dist/web/assets/{wardleyDiagram-VM6X3IG4-CMCWNcNe.js → wardleyDiagram-VM6X3IG4-D9GbTBKy.js} +1 -1
- package/dist/web/assets/{xychartDiagram-S5SC5T6Z-CMMtcXgw.js → xychartDiagram-S5SC5T6Z-BFqPF2Hl.js} +1 -1
- package/dist/web/badge-96.png +0 -0
- package/dist/web/icon-192.png +0 -0
- package/dist/web/icon-512.png +0 -0
- package/dist/web/icon-maskable-512.png +0 -0
- package/dist/web/index.html +9 -2
- package/dist/web/manifest.webmanifest +36 -0
- package/dist/web/sw.js +123 -0
- package/package.json +1 -1
- package/dist/checksums.txt +0 -5
- package/dist/web/assets/Dashboard-CIh2K0FF.js +0 -1
- package/dist/web/assets/JobWebhooks-CoFraeFc.js +0 -1
- package/dist/web/assets/Settings-C_-DKk-Q.js +0 -20
- package/dist/web/assets/Skills-BpRge1yJ.js +0 -16
- package/dist/web/assets/SourceEditor-DcZduN5g.js +0 -14
- package/dist/web/assets/Terminals-BX77_gra.js +0 -120
- package/dist/web/assets/Webhooks-2tiGvHyx.js +0 -1
- package/dist/web/assets/channel-6li7uxlb.js +0 -1
- package/dist/web/assets/classDiagram-ZZMXUADV-DQx2YVEE.js +0 -1
- package/dist/web/assets/classDiagram-v2-VYDZK3BY-DQx2YVEE.js +0 -1
- package/dist/web/assets/index-CVKguVuJ.js +0 -468
- package/dist/web/assets/index-yWuNUmdj.css +0 -1
- package/dist/web/assets/scroll-area-BrMwE434.js +0 -1
- package/dist/web/assets/stateDiagram-v2-MP3YSRHH-IRoE1WuW.js +0 -1
- package/dist/web/assets/swimlanesDiagram-VR7AAH4N-C2iXhtwv.js +0 -8
- package/dist/web/assets/useProjectScope-Gvzzt8hR.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,K as o}from"./index-C_jtMgr7.js";const s={todo:"bg-muted-foreground",queued:"bg-progress",doing:"bg-progress",review:"bg-tertiary",changes_requested:"bg-error",blocked:"bg-error",done:"bg-secondary",cancelled:"bg-muted-foreground",paused:"bg-muted-foreground"},t={pending:"bg-muted-foreground",running:"bg-progress",success:"bg-secondary",failed:"bg-error",cancelled:"bg-muted-foreground",skipped:"bg-muted-foreground"};function a({status:e,type:n="task",className:d}){const g=n==="job"?t[e]??"bg-muted-foreground":s[e]??"bg-muted-foreground";return r.jsxs("span",{className:o("inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-label font-normal text-muted-foreground",d),children:[r.jsx("span",{className:o("size-1.5 rounded-full shrink-0",g)}),e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," ")]})}export{a as S};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as ne,j as e,av as me,aw as ue,r as x,ax as he,ay as fe,az as be,aA as ge,B as _,aB as pe,aC as je,aD as ie,aE as X,aF as ve,aG as ye,aH as Ne,p as b,q as O,s as z,t as H,v as U,w as D,I as w,T as Y,aI as we,aJ as _e,L as oe,aK as ce,G as ke,aL as Se,aM as Ce,aN as Te,aO as Le,e as de,aP as De,aQ as Pe,aR as Ee,aS as Fe,aT as Ae,a8 as Be,a9 as Oe,aa as ze,S as Z,ab as ee,ac as He,y as p,P as Ue,at as $e,al as qe,aU as se,aV as te,D as Ie,m as Me,n as Ge,o as Ve,aW as Re,aX as We,x as Ke}from"./index-C_jtMgr7.js";import{E as xe}from"./ErrorState-BPTepwiG.js";import{C as Je}from"./ConfirmDialog-CrSa87VF.js";import{P as Ye}from"./PriorityBadge-BW-A50LE.js";import{S as Qe}from"./StatusBadge-C5G1fdZh.js";import{a as Xe,f as ae,S as re,s as Ze,b as es,R as ss,L as ts}from"./ResumeActions-DHTOr6GQ.js";import{c as as}from"./useSessions-BrdK-12R.js";import{T as rs}from"./trash-2-D3Ey4I09.js";/**
|
|
2
|
+
* @license lucide-react v1.27.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ls=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],ns=ne("circle-stop",ls);/**
|
|
7
|
+
* @license lucide-react v1.27.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const is=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],os=ne("user-check",is),cs=new Set(["task_id","task_title","project_id","skill_name","required_review","max_review_rounds"]),ds={running:"bg-primary/15 text-primary border-primary/40",completed:"bg-secondary/15 text-secondary border-secondary/40",halted:"bg-error/15 text-error border-error/40",cancelled:"bg-surface-highest text-outline border-outline-variant"},xs={pending:"text-primary",running:"text-primary",awaiting_human:"text-tertiary",succeeded:"text-secondary",failed:"text-error",cancelled:"text-outline",skipped:"text-outline"};function v({children:t,className:d}){return e.jsx("span",{className:`inline-flex px-2 py-0.5 font-label text-xs rounded-md border ${d??"bg-surface-highest border-surface-highest text-on-surface-variant"}`,children:t})}function ms({taskId:t}){const{data:d,isLoading:a}=ue(t),[s,l]=x.useState(null);return a?e.jsx("div",{className:"font-body text-sm text-outline",children:"Loading flow…"}):d?e.jsx(us,{run:d,taskId:t,selectedNodeId:s,onSelectNode:o=>l(r=>r===o?null:o)}):e.jsx("div",{className:"font-body text-sm text-outline","data-testid":"flow-run-empty",children:"No flow has run on this task yet."})}function us({run:t,taskId:d,selectedNodeId:a,onSelectNode:s}){const l=x.useMemo(()=>he(t.definition),[t.definition]),o=x.useMemo(()=>fe(t),[t]),r=x.useMemo(()=>be(t),[t]),m=ge(),[h,c]=x.useState(!1),[f,g]=x.useState(!1),j=Object.entries(t.vars).filter(([u])=>!cs.has(u));return e.jsxs("div",{className:"space-y-4","data-testid":"flow-run-panel","data-flow-status":t.status,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.flow_source==="task"?e.jsx("span",{className:"font-body text-sm text-on-surface truncate","data-testid":"flow-run-name",children:t.flow_name}):e.jsx("button",{type:"button",onClick:()=>g(!0),className:"font-body text-sm text-primary hover:underline truncate","data-testid":"flow-run-name",children:t.flow_name}),e.jsx(v,{children:t.flow_source}),e.jsx(v,{className:ds[t.status],children:t.status})]}),t.status==="running"&&e.jsxs(_,{"data-testid":"flow-halt-button",size:"sm",onClick:()=>c(!0),className:"font-label text-xs bg-error/10 text-error border border-error/30 hover:bg-error/20 min-h-11 sm:min-h-9 px-3",children:[e.jsx(ns,{size:11,className:"mr-1"}),"Halt"]})]}),t.halt_reason&&e.jsxs("div",{className:"p-2 rounded-lg border border-border bg-transparent space-y-0.5","data-testid":"flow-halt-reason","data-halt-reason":t.halt_reason,children:[e.jsxs("div",{className:"font-label text-xs font-medium text-error",children:["Halted: ",t.halt_reason.replace(/_/g," ")]}),t.halt_description&&e.jsx("div",{className:"font-body text-sm text-on-surface-variant",children:t.halt_description})]}),l?e.jsxs("div",{children:[e.jsx(pe,{definition:l,states:o,selectedNodeId:a,onSelectNode:s}),e.jsx(je,{})]}):e.jsx("div",{className:"font-body text-sm text-outline",children:"This run did not record a readable definition, so its graph cannot be drawn."}),r&&e.jsx(hs,{taskId:d,nodeRun:r,definition:l,isHalting:m.isPending}),l&&a&&e.jsx(fs,{definition:l,nodeId:a}),e.jsx(bs,{run:t,selectedNodeId:a,onSelectNode:s}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:[e.jsxs(G,{label:"Executions",children:[t.node_executions,l!=null&&l.limits.max_node_executions?` / ${l.limits.max_node_executions}`:""]}),e.jsx(G,{label:"Elapsed",children:ie(t.started_at,t.ended_at)}),e.jsx(G,{label:"Started",children:X(t.started_at)}),e.jsx(G,{label:"Ended",children:X(t.ended_at)})]}),j.length>0&&e.jsxs("div",{className:"space-y-1","data-testid":"flow-run-vars",children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline",children:"Run vars"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:j.map(([u,S])=>e.jsxs(v,{children:[u,"=",JSON.stringify(S)]},u))})]}),e.jsx(ve,{flowName:f?t.flow_name:null,open:f,onClose:()=>g(!1)}),e.jsx(Je,{open:h,title:"Halt Flow",description:`Stop flow "${t.flow_name}" and kill any live agent sessions for this task? The task keeps its current status.`,confirmLabel:"Halt",variant:"destructive",isPending:m.isPending,onConfirm:()=>m.mutate({taskId:d,reason:"halted from the web dashboard"},{onSuccess:()=>c(!1)}),onCancel:()=>c(!1)})]})}function G({label:t,children:d}){return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-label text-[10px] font-medium text-outline",children:t}),e.jsx("div",{className:"font-body text-sm text-on-surface-variant",children:d})]})}function hs({taskId:t,nodeRun:d,definition:a,isHalting:s}){var g,j;const l=x.useMemo(()=>a?ye(a,d.node_id):[],[a,d.node_id]),o=Ne(),[r,m]=x.useState(l[0]??""),[h,c]=x.useState(""),f=r.trim();return e.jsxs("div",{className:"p-3 rounded-lg border border-border bg-transparent space-y-3","data-testid":"flow-gate-form","data-gate-node":d.node_id,children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-xs font-medium text-tertiary",children:[e.jsx(os,{size:12}),"Waiting for you at “",d.node_id,"”"]}),((g=a==null?void 0:a.nodeById[d.node_id])==null?void 0:g.prompt)&&e.jsx("div",{className:"font-body text-sm text-on-surface whitespace-pre-wrap",children:(j=a.nodeById[d.node_id])==null?void 0:j.prompt}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Outcome"}),l.length>0?e.jsxs(O,{value:r,onValueChange:m,children:[e.jsx(z,{"aria-label":"Outcome","data-testid":"flow-gate-outcome",className:"bg-background border-control-border text-on-surface font-label text-sm min-h-11 sm:min-h-9",children:e.jsx(H,{placeholder:"Pick an outcome"})}),e.jsx(U,{className:"bg-surface-highest border-surface-highest",children:l.map(u=>e.jsx(D,{value:u,className:"font-label text-xs",children:u},u))})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{"aria-label":"Outcome","data-testid":"flow-gate-outcome-input",value:r,onChange:u=>m(u.target.value),placeholder:"e.g. approved",className:"bg-background border-control-border text-on-surface font-body text-sm min-h-11 sm:min-h-9"}),e.jsx("p",{className:"font-body text-sm text-outline",children:"This node routes everything through a catch-all edge, so any outcome continues the flow."})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Comment (posted on the task)"}),e.jsx(Y,{"aria-label":"Comment posted on the task","data-testid":"flow-gate-comment",value:h,onChange:u=>c(u.target.value),placeholder:"Why this outcome…",className:"bg-background border-control-border text-on-surface font-body text-sm resize-none",rows:2})]}),o.error&&e.jsx("div",{className:"font-body text-sm text-error","data-testid":"flow-gate-error",children:o.error.message}),e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{"data-testid":"flow-gate-submit",size:"sm",disabled:o.isPending||s||f.length===0,onClick:()=>o.mutate({taskId:t,outcome:f,...h.trim()?{summary:h.trim()}:{},author:"human"},{onSuccess:()=>c("")}),className:"font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90 min-h-11 sm:min-h-9 px-3",children:o.isPending?"Resuming…":"Resume flow"})})]})}function fs({definition:t,nodeId:d}){const a=t.nodeById[d];if(!a)return null;const s=t.edges.map((l,o)=>({edge:l,index:o})).filter(({edge:l})=>l.from===d);return e.jsxs("div",{className:"p-2 rounded-lg border border-surface-highest bg-surface-highest/30 space-y-2","data-testid":"flow-node-detail","data-node-id":d,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-body text-sm font-medium text-on-surface",children:a.id}),e.jsx(v,{children:a.kind}),a.skill&&e.jsxs(v,{children:["skill ",a.skill]}),a.role&&e.jsx(v,{children:a.role}),a.task_status&&e.jsxs(v,{children:["sets ",a.task_status]}),a.max_visits!==void 0&&e.jsxs(v,{children:["max ",a.max_visits," visits"]}),a.routing==="all"&&e.jsx(v,{children:"fan out"}),a.join&&e.jsxs(v,{children:["join ",a.join.mode," of ",a.join.from.join(", ")]}),a.on_error&&e.jsxs(v,{children:["on error → ",a.on_error]})]}),a.description&&e.jsx("div",{className:"font-body text-sm text-on-surface-variant",children:a.description}),s.length>0&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-label text-[10px] font-medium text-outline",children:"Outgoing edges (first match wins)"}),s.map(({edge:l,index:o},r)=>e.jsxs("div",{className:"font-mono text-xs text-on-surface-variant","data-testid":"flow-node-detail-edge",children:[r+1,". → ",l.to," ",e.jsxs("span",{className:"text-outline",children:["when ",we(l.when)]}),l.label&&e.jsxs("span",{className:"text-outline",children:[" (",l.label,")"]})]},o))]})]})}function bs({run:t,selectedNodeId:d,onSelectNode:a}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"font-label text-xs font-medium text-outline",children:["Ledger (",t.nodes.length," ",t.nodes.length===1?"visit":"visits",")"]}),t.nodes.length===0?e.jsx("div",{className:"font-body text-sm text-outline",children:"Nothing has run yet."}):e.jsx("div",{className:"space-y-1",children:t.nodes.map((s,l)=>e.jsxs("div",{onClick:()=>a(s.node_id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&a(s.node_id)},"data-testid":"flow-ledger-row","data-node-id":s.node_id,"data-node-status":s.status,"data-node-outcome":s.outcome??"",className:`w-full text-left p-2 rounded-lg border transition-colors cursor-pointer ${d===s.node_id?"border-primary/40 bg-primary/5":"border-surface-highest bg-surface-highest/40 hover:bg-surface-highest/70"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-label text-[10px] text-outline",children:l+1}),e.jsx("span",{className:"font-body text-sm text-on-surface",children:s.node_id}),e.jsxs("span",{className:"font-label text-[10px] text-outline",children:["visit ",s.attempt,s.retry>0?` · retry ${s.retry}`:""]}),e.jsx("span",{className:`font-label text-[10px] ${xs[s.status]??"text-outline"}`,children:s.status.replace(/_/g," ")}),s.outcome&&e.jsxs("span",{className:"font-label text-[10px] text-primary",children:["→ ",s.outcome]}),e.jsxs("span",{className:"font-label text-[10px] text-outline ml-auto",children:[ie(s.started_at??s.created_at,s.ended_at),s.started_at===null&&_e(s.status)?" waiting":""]})]}),s.summary&&e.jsx("div",{className:"font-body text-sm text-on-surface-variant mt-1 whitespace-pre-wrap",children:s.summary}),s.error&&e.jsx("div",{className:"font-body text-sm text-error mt-1 whitespace-pre-wrap",children:s.error}),s.gateway_session_id&&e.jsxs(oe,{to:`/sessions/${s.gateway_session_id}`,onClick:o=>o.stopPropagation(),className:"font-mono text-xs text-primary hover:underline mt-1 inline-block","data-testid":"flow-ledger-session-link",children:["session ",s.gateway_session_id.slice(-8)]})]},`${s.node_id}-${s.attempt}-${s.retry}`))})]})}function gs({children:t}){return e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-xs font-medium text-outline",children:[e.jsx(me,{size:12}),"Flow",t]})}const L=["git_repo","git_branch","git_worktree","github_issue","github_pr"],le={git_repo:"Repository folder",git_branch:"Branch",git_worktree:"Worktree folder",github_issue:"GitHub issue URL",github_pr:"GitHub PR URL"};function ps({task:t}){const[d,a]=x.useState(!1),[s,l]=x.useState(()=>Object.fromEntries(L.map(r=>[r,t[r]??""]))),o=ce();return e.jsxs("section",{"data-testid":"task-git-links",className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("strong",{children:"Git / GitHub"}),e.jsx("button",{type:"button","data-testid":"task-git-edit",onClick:()=>{l(Object.fromEntries(L.map(r=>[r,t[r]??""]))),a(!d)},children:"Edit links"})]}),d?e.jsxs("form",{onSubmit:r=>{r.preventDefault(),o.mutate({id:t.id,...Object.fromEntries(L.map(m=>[m,s[m].trim()||null]))},{onSuccess:()=>a(!1)})},className:"space-y-2",children:[L.map(r=>e.jsxs("label",{className:"block",children:[le[r],e.jsx("input",{"data-testid":`task-link-${r}`,className:"w-full bg-surface-highest p-2",value:s[r],onChange:m=>l({...s,[r]:m.target.value})})]},r)),e.jsx("button",{type:"submit","data-testid":"task-git-save",disabled:o.isPending,className:"text-primary",children:"Save links"}),o.error&&e.jsx("p",{role:"alert",children:o.error.message})]}):e.jsxs("div",{className:"space-y-1",children:[L.map(r=>t[r]?e.jsxs("p",{className:"break-all",children:[le[r],":"," ",r.startsWith("github_")?e.jsx("a",{href:t[r]??"",target:"_blank",rel:"noreferrer",className:"text-primary",children:t[r]}):t[r]]},r):null),!L.some(r=>t[r])&&e.jsx("p",{className:"text-outline",children:"No links yet. Link a checkout from its terminal Git panel, or edit here."})]})]})}function js({taskId:t}){const[d]=ke(),{data:a,isLoading:s,error:l,refetch:o}=as(t),r=(a??[]).filter(c=>c.tokens_used!=null),m=r.reduce((c,f)=>c+(f.tokens_used??0),0),h=(a??[]).map(c=>c.last_activity_at??"").sort().pop();return e.jsxs("div",{className:"border-t border-surface-highest pt-4 space-y-3","data-testid":"task-sessions",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-xs text-outline",children:[e.jsx(Se,{size:12}),"Agent sessions",a&&a.length>0&&e.jsxs("span",{className:"font-body text-xs normal-case tracking-normal text-on-surface-variant",children:[" ","· ",a.length," ·"," ",Xe(m,r.some(c=>c.tokens_estimated))," ","tokens · last active ",ae(h??null)]})]}),l?e.jsx(xe,{message:l.message,onRetry:()=>o()}):s?e.jsx("p",{role:"status",className:"text-sm text-outline",children:"Loading agent sessions…"}):!a||a.length===0?e.jsx("div",{className:"font-body text-xs text-outline",children:"No session yet. Add a session: line with the session id to the task body, or pick the task on the Sessions page."}):e.jsx("div",{className:"space-y-1",children:a.map(c=>e.jsxs("div",{"data-testid":"task-session-row",className:"flex flex-wrap items-center gap-3 px-2 py-2 rounded-lg",children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${re[c.status].dot}`,title:re[c.status].label}),e.jsx("span",{className:"font-label text-xs text-primary w-14 shrink-0",children:c.agent}),e.jsx(oe,{to:Ze(`/sessions?session=${encodeURIComponent(c.id)}`,d.get("project")??c.project_id),"data-testid":"task-session-link",className:"flex-1 min-w-0 truncate font-body text-xs text-on-surface hover:text-primary",title:c.name??void 0,children:c.name??c.session_id}),e.jsx("span",{className:"font-label text-xs text-outline shrink-0",children:es(c)}),e.jsx("span",{className:"font-label text-xs text-outline shrink-0",children:ae(c.last_activity_at)}),e.jsx(ss,{session:c})]},c.id))})]})}const vs=["todo","doing","review","blocked","done"],ys=["low","normal","high","critical"],Ns=["blocks","blocked_by","relates_to","duplicates","clones","subtask_of","parent_of"];function Es({taskId:t,open:d,onOpenChange:a}){var Q;const{data:s,isLoading:l,error:o,refetch:r}=Ce(t),{data:m}=Te(t),{data:h}=Le(t),{data:c}=de(),f=De(),g=Pe(),j=Ee(),[u,S]=x.useState(""),[P,V]=x.useState("human"),[$,E]=x.useState(!1),[k,F]=x.useState(""),[C,R]=x.useState("relates_to"),[A,q]=x.useState(!1),I=()=>{!t||!u.trim()||f.mutate({id:t,content:u.trim(),author:P||"human"},{onSuccess:()=>{S("")}})},W=()=>{!t||!k.trim()||g.mutate({id:t,to_task_id:k.trim(),link_type:C},{onSuccess:()=>{F(""),E(!1)}})},B=x.useMemo(()=>h?h.reduce((i,N)=>{const y=N.link_type;return i[y]||(i[y]=[]),i[y].push(N),i},{}):{},[h]),K=Fe(s??{}),M=Ae(s??{}),n=x.useMemo(()=>{var i;return!(s!=null&&s.project_id)||!c?null:((i=c.find(N=>N.id===s.project_id))==null?void 0:i.name)??s.project_id.slice(-6)},[s==null?void 0:s.project_id,c]),T=i=>i?new Date(i).toLocaleString():"-",J=i=>i?new Date(i)<new Date:!1;return e.jsxs(e.Fragment,{children:[e.jsx(Be,{open:d,onOpenChange:a,children:e.jsxs(Oe,{"data-testid":"task-detail-sheet",className:"w-[620px] max-w-[92vw]",children:[e.jsx(ze,{children:l?e.jsx(Z,{className:"h-5 w-48 bg-surface-highest"}):s?e.jsxs("div",{className:"space-y-2 pr-6",children:[e.jsx(ee,{children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{status:s.status}),e.jsx(Ye,{priority:s.priority})]})]}):e.jsx(ee,{children:"Task not found"})}),e.jsxs(He,{children:[(f.error||g.error||j.error)&&e.jsx("p",{role:"alert",className:"mb-4 text-sm text-error",children:(Q=f.error??g.error??j.error)==null?void 0:Q.message}),o?e.jsx(xe,{message:o.message,onRetry:()=>r()}):l?e.jsx("div",{className:"space-y-4",children:Array.from({length:6}).map((i,N)=>e.jsx(Z,{className:"h-8 w-full bg-surface-highest"},N))}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(ps,{task:s},s.id),s.body&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline",children:"Body"}),e.jsx("div",{className:"font-body text-sm text-on-surface whitespace-pre-wrap break-words bg-transparent p-3 rounded-lg border border-border",children:s.body})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(p,{label:"ID",children:e.jsx("span",{className:"font-mono text-xs break-all",children:s.id})}),e.jsx(p,{label:"Author",children:s.author}),e.jsx(p,{label:"Claimed By",children:s.claimed_by??"-"}),e.jsx(p,{label:"Project",children:n??"-"}),e.jsx(p,{label:"Skill",children:s.skill_name??"-"}),e.jsxs(p,{label:"Agent Backend",children:[e.jsx("span",{"data-testid":"task-backend-name",children:M.label}),M.available===!1&&e.jsxs("span",{className:"text-error",title:"This backend is not usable right now",children:[" ","○"]})]}),e.jsx(p,{label:"Flow",children:e.jsx("span",{"data-testid":"task-flow-name",children:K.label})}),e.jsx(p,{label:"Required Review",children:s.required_review?"Yes":"No"}),e.jsx(p,{label:"Max Review Rounds",children:s.max_review_rounds}),e.jsx(p,{label:"Due",children:e.jsx("span",{className:J(s.due_at)&&s.status!=="done"?"text-error":"",children:T(s.due_at)})}),e.jsx(p,{label:"Created",children:T(s.created_at)}),e.jsx(p,{label:"Updated",children:T(s.updated_at)})]}),s.progress>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline",children:"Progress"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-surface-highest rounded-lg overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-lg transition-all",style:{width:`${Math.min(100,s.progress)}%`}})}),e.jsxs("span",{className:"font-label text-xs text-outline",children:[s.progress,"%"]})]})]}),s.tags&&s.tags.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-label text-xs font-medium text-outline",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.tags.map(i=>e.jsx("span",{className:"px-2 py-0.5 text-xs font-label bg-primary/10 text-primary border border-primary/20 rounded-lg",children:i},i))})]}),e.jsx(js,{taskId:s.id}),e.jsxs("div",{className:"border-t border-surface-highest pt-4 space-y-3",children:[e.jsx(gs,{}),e.jsx(ms,{taskId:s.id})]}),e.jsxs("div",{className:"border-t border-surface-highest pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-xs font-medium text-outline",children:[e.jsx(ts,{size:12}),"Links"]}),e.jsx("button",{type:"button",onClick:()=>E(!0),className:"text-primary hover:text-primary/80 transition-colors",children:e.jsx(Ue,{size:14})})]}),h&&h.length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(B).map(([i,N])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-label text-[10px] font-medium text-outline",children:i.replace(/_/g," ")}),N.map(y=>e.jsxs("div",{className:"flex items-center justify-between px-2 py-1 bg-surface-highest/50 rounded-lg",children:[e.jsx("span",{className:"font-mono text-xs text-on-surface-variant",children:y.from_task_id===t?y.to_task_id.slice(-6):y.from_task_id.slice(-6)}),e.jsx("button",{type:"button",onClick:()=>j.mutate({taskId:t,linkId:y.id}),className:"text-outline hover:text-error transition-colors p-0.5",children:e.jsx(rs,{size:10})})]},y.id))]},i))}):e.jsx("div",{className:"font-body text-sm text-outline",children:"No links"}),$&&e.jsxs("div",{className:"space-y-2 p-2 bg-surface-highest/30 rounded-lg border border-surface-highest",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Link Type"}),e.jsxs(O,{value:C,onValueChange:i=>R(i),children:[e.jsx(z,{className:"bg-background border-control-border text-on-surface font-label text-xs h-7",children:e.jsx(H,{})}),e.jsx(U,{className:"bg-surface-highest border-surface-highest",children:Ns.map(i=>e.jsx(D,{value:i,className:"font-label text-xs",children:i.replace(/_/g," ")},i))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Target Task ID"}),e.jsx(w,{value:k,onChange:i=>F(i.target.value),placeholder:"Task ID...",className:"bg-background border-control-border text-on-surface font-body text-sm h-7"})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(_,{type:"button",variant:"ghost",size:"sm",onClick:()=>{E(!1),F("")},className:"font-label text-xs text-outline h-6 px-2",children:"Cancel"}),e.jsx(_,{size:"sm",onClick:W,disabled:g.isPending||!k.trim(),className:"font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2",children:"Add"})]})]})]}),e.jsxs("div",{className:"border-t border-surface-highest pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-label text-xs font-medium text-outline",children:[e.jsx($e,{size:12}),"Comments (",(m==null?void 0:m.length)??0,")"]}),m&&m.length>0&&e.jsx("div",{className:"space-y-2",children:m.map(i=>e.jsxs("div",{className:"py-2 border-b border-border space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-label text-xs text-primary",children:i.author}),e.jsx("span",{className:"font-label text-[10px] text-outline",children:new Date(i.created_at).toLocaleString()})]}),e.jsx("div",{className:"font-body text-sm text-on-surface whitespace-pre-wrap break-words",children:i.content})]},i.id))}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(w,{"aria-label":"Comment author",value:P,onChange:i=>V(i.target.value),placeholder:"Author",className:"bg-background border-control-border text-on-surface font-body text-sm h-7 w-24"}),e.jsx(Y,{value:u,onChange:i=>S(i.target.value),placeholder:"Add a comment...",className:"bg-background border-control-border text-on-surface font-body text-sm resize-none flex-1",rows:2})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{"data-testid":"task-comment-submit",size:"sm",onClick:I,disabled:f.isPending||!u.trim(),className:"font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90 h-6 px-2",children:f.isPending?"...":"Comment"})})]})]})]}):e.jsx("div",{className:"text-outline font-label text-xs font-medium text-center py-8",children:"Task not found"})]}),s&&e.jsx(qe,{children:e.jsx(_,{size:"sm",onClick:()=>q(!0),className:"font-label text-xs font-medium bg-transparent text-on-surface border border-control-border hover:bg-surface",children:"Edit task"})})]})}),s&&A&&e.jsx(ws,{task:s,open:A,onClose:()=>q(!1)})]})}function ws({task:t,open:d,onClose:a}){const{data:s}=de(),l=ce(),[o,r]=x.useState(t.title),[m,h]=x.useState(t.body??""),[c,f]=x.useState(t.status),[g,j]=x.useState(t.priority),[u,S]=x.useState(t.due_at??""),[P,V]=x.useState((t.tags??[]).join(", ")),[$,E]=x.useState(t.project_id??""),[k,F]=x.useState(t.skill_name??""),[C,R]=x.useState(t.agent_backend??se),[A,q]=x.useState(t.required_review),[I,W]=x.useState(String(t.max_review_rounds)),[B,K]=x.useState(t.flow_name??te),M=n=>{if(n.preventDefault(),!o.trim())return;const T=P.split(",").map(J=>J.trim()).filter(Boolean);l.mutate({id:t.id,title:o.trim(),body:m.trim()||null,status:c,priority:g,due_at:u||null,tags:T.length>0?T:null,project_id:$||null,skill_name:k||null,agent_backend:C===se?null:C,required_review:A,max_review_rounds:Number(I)||3,...t.flow_override?{}:{flow_name:B===te?null:B}},{onSuccess:()=>a()})};return e.jsx(Ie,{open:d,onOpenChange:n=>!n&&a(),children:e.jsxs(Me,{"data-testid":"edit-task-dialog",className:"bg-surface-high border-border max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsx(Ge,{children:e.jsx(Ve,{className:"font-headline text-sm font-medium text-on-surface",children:"Edit task"})}),e.jsxs("form",{onSubmit:M,className:"space-y-4 mt-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Title *"}),e.jsx(w,{"aria-label":"Title","data-testid":"edit-task-title",value:o,onChange:n=>r(n.target.value),className:"bg-background border-control-border text-on-surface font-body text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Body"}),e.jsx(Y,{"aria-label":"Body",value:m,onChange:n=>h(n.target.value),className:"bg-background border-control-border text-on-surface font-body text-sm resize-none",rows:4})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Status"}),e.jsxs(O,{value:c,onValueChange:n=>f(n),children:[e.jsx(z,{"aria-label":"Status",className:"bg-background border-control-border text-on-surface font-label text-xs",children:e.jsx(H,{})}),e.jsx(U,{className:"bg-surface-highest border-surface-highest",children:vs.map(n=>e.jsx(D,{value:n,className:"font-label text-xs",children:n.replace(/_/g," ")},n))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Priority"}),e.jsxs(O,{value:g,onValueChange:n=>j(n),children:[e.jsx(z,{"aria-label":"Priority",className:"bg-background border-control-border text-on-surface font-label text-xs",children:e.jsx(H,{})}),e.jsx(U,{className:"bg-surface-highest border-surface-highest",children:ys.map(n=>e.jsx(D,{value:n,className:"font-label text-xs",children:n},n))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Due date"}),e.jsx(w,{type:"datetime-local",value:u?u.slice(0,16):"",onChange:n=>S(n.target.value?new Date(n.target.value).toISOString():""),className:"bg-background border-control-border text-on-surface font-body text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Project"}),e.jsxs(O,{value:$||"__none__",onValueChange:n=>E(n==="__none__"?"":n),children:[e.jsx(z,{"aria-label":"Project",className:"bg-background border-control-border text-on-surface font-label text-xs",children:e.jsx(H,{})}),e.jsxs(U,{className:"bg-surface-highest border-surface-highest",children:[e.jsx(D,{value:"__none__",className:"font-label text-xs",children:"None"}),s==null?void 0:s.map(n=>e.jsx(D,{value:n.id,className:"font-label text-xs",children:n.name},n.id))]})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Tags (comma-separated)"}),e.jsx(w,{"aria-label":"Tags",value:P,onChange:n=>V(n.target.value),placeholder:"tag1, tag2",className:"bg-background border-control-border text-on-surface font-body text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Skill Name"}),e.jsx(w,{"aria-label":"Skill override",value:k,onChange:n=>F(n.target.value),placeholder:"e.g. code-review",className:"bg-background border-control-border text-on-surface font-body text-sm"})]}),e.jsx(Re,{value:C,onChange:R,testId:"edit-task-backend"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5 flex items-center gap-2 pt-4",children:[e.jsx("input",{type:"checkbox",id:"edit-required-review",checked:A,onChange:n=>q(n.target.checked),className:"accent-primary"}),e.jsx(b,{htmlFor:"edit-required-review",className:"font-label text-xs font-medium text-outline cursor-pointer",children:"Required Review"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"font-label text-xs font-medium text-outline",children:"Max Review Rounds"}),e.jsx(w,{type:"number",value:I,onChange:n=>W(n.target.value),min:1,className:"bg-background border-control-border text-on-surface font-body text-sm"})]})]}),t.flow_override?e.jsxs("p",{className:"font-body text-sm text-outline","data-testid":"task-flow-override-note",children:["This task carries an inline flow definition (flow_override), which beats any named flow. Detach it with ",e.jsx("code",{children:"orc flow attach"})," to use a named flow instead."]}):e.jsx(We,{value:B,onChange:K,testId:"edit-task-flow"}),e.jsxs(Ke,{children:[e.jsx(_,{type:"button",variant:"ghost",size:"sm",onClick:a,className:"font-label text-xs text-outline",children:"Cancel"}),e.jsx(_,{"data-testid":"edit-task-submit",type:"submit",size:"sm",disabled:l.isPending||!o.trim(),className:"font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90",children:l.isPending?"Saving...":"Save"})]})]})]})})}export{Es as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as an,r as u,
|
|
1
|
+
import{c as an,r as u,bv as M,bw as Te,j as a,at as ft,u as Bn,a as $n,Y as ln,b as Fn,d as ht,L as Kn,G as Un,aK as Xn,bx as Yn,B as qn,P as Vn,a_ as Hn,I as Wn,q as Bt,s as $t,t as Ft,v as Kt,w as at,S as Ut,i as Gn}from"./index-C_jtMgr7.js";import{P as cn}from"./PriorityBadge-BW-A50LE.js";import{T as un}from"./trash-2-D3Ey4I09.js";import{C as Jn}from"./ConfirmDialog-CrSa87VF.js";import{E as Qn}from"./EmptyState-Ctm7L70B.js";import{E as Zn}from"./ErrorState-BPTepwiG.js";import{S as er}from"./StatusBadge-C5G1fdZh.js";import{T as tr}from"./TaskDetailSheet-fUSHPFB-.js";import{T as nr,a as rr,b as Xt,c as te,d as sr,e as ne}from"./table-D3N_5Wee.js";import{T as or,a as ar,b as ir,c as lr}from"./tabs-CSlEXoxD.js";import{V as Yt}from"./ViewHeader-DXR0ZaMO.js";import{u as cr}from"./useDetailRoute-j9nlwack.js";import{u as ur}from"./useProjectScope-Dk0mjyHf.js";import{L as dr}from"./list-BL4eRkIg.js";import"./ResumeActions-DHTOr6GQ.js";import"./useSessions-BrdK-12R.js";/**
|
|
2
2
|
* @license lucide-react v1.27.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,27 +8,27 @@ import{c as an,r as u,cr as M,cs as ke,j as a,P as ln,ct as ft,an as cn,u as Bn,
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const gr=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],pr=an("layout-grid",gr),Je=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ce(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vt(e){return"nodeType"in e}function _(e){var t,n;return e?Ce(e)?e:vt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function
|
|
11
|
+
*/const gr=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],pr=an("layout-grid",gr),Je=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ce(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vt(e){return"nodeType"in e}function _(e){var t,n;return e?Ce(e)?e:vt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=_(e);return e instanceof t}function Ie(e){return Ce(e)?!1:e instanceof _(e).HTMLElement}function dn(e){return e instanceof _(e).SVGElement}function De(e){return e?Ce(e)?e.document:vt(e)?mt(e)?e:Ie(e)||dn(e)?e.ownerDocument:document:document:document}const ae=Je?u.useLayoutEffect:u.useEffect;function Qe(e){const t=u.useRef(e);return ae(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function br(){const e=u.useRef(null),t=u.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return ae(()=>{n.current!==e&&(n.current=e)},t),n}function ze(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ye(e){const t=Qe(e),n=u.useRef(null),r=u.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function qe(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let it={};function Ze(e,t){return u.useMemo(()=>{if(t)return t;const n=it[e]==null?0:it[e]+1;return it[e]=n,e+"-"+n},[e,t])}function fn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,i)=>{const l=Object.entries(i);for(const[c,d]of l){const g=s[c];g!=null&&(s[c]=g+e*d)}return s},{...t})}}const we=fn(1),Ve=fn(-1);function vr(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=_(e.target);return t&&e instanceof t}function mr(e){if(!e)return!1;const{TouchEvent:t}=_(e.target);return t&&e instanceof t}function He(e){if(mr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vr(e)?{x:e.clientX,y:e.clientY}:null}const Se=Object.freeze({Translate:{toString(e){if(!e)return;const{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;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Se.Translate.toString(e),Se.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xr(e){return e.matches(qt)?e:e.querySelector(qt)}const yr={display:"none"};function wr(e){let{id:t,value:n}=e;return M.createElement("div",{id:t,style:yr},n)}function Sr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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"};return M.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Cr(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const hn=u.createContext(null);function Dr(e){const t=u.useContext(hn);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function jr(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,s)})},[e]),t]}const Nr={draggable:`
|
|
12
12
|
To pick up a draggable item, press the space bar.
|
|
13
13
|
While dragging, use the arrow keys to move the item.
|
|
14
14
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
15
|
-
`},Rr={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 Er(e){let{announcements:t=Rr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Nr}=e;const{announce:s,announcement:i}=Cr(),l=Ze("DndLiveRegion"),[c,d]=u.useState(!1);if(u.useEffect(()=>{d(!0)},[]),Dr(u.useMemo(()=>({onDragStart(f){let{active:b}=f;s(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:p}=f;t.onDragMove&&s(t.onDragMove({active:b,over:p}))},onDragOver(f){let{active:b,over:p}=f;s(t.onDragOver({active:b,over:p}))},onDragEnd(f){let{active:b,over:p}=f;s(t.onDragEnd({active:b,over:p}))},onDragCancel(f){let{active:b,over:p}=f;s(t.onDragCancel({active:b,over:p}))}}),[s,t])),!c)return null;const g=M.createElement(M.Fragment,null,M.createElement(wr,{id:r,value:o.draggable}),M.createElement(Sr,{id:l,announcement:i}));return n?ke.createPortal(g,n):g}var P;(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"})(P||(P={}));function We(){}function Vt(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function kr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const J=Object.freeze({x:0,y:0});function Tr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ar(e,t){const n=He(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Mr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Or(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ht(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Pr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const Lr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Ht(t),s=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const d=Ht(c),g=o.reduce((b,p,w)=>b+Tr(d[w],p),0),f=Number((g/4).toFixed(4));s.push({id:l,data:{droppableContainer:i,value:f}})}}return s.sort(Mr)};function Ir(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=s-n;if(r<o&&n<s){const c=t.width*t.height,d=e.width*e.height,g=i*l,f=g/(c+d-g);return Number(f.toFixed(4))}return 0}const zr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,l=n.get(i);if(l){const c=Ir(l,t);c>0&&o.push({id:i,data:{droppableContainer:s,value:c}})}}return o.sort(Or)};function _r(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function gn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function Br(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const $r=Br(1);function pn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Fr(e,t,n){const r=pn(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:l}=r,c=e.left-i-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=s?e.height/s:e.height;return{width:g,height:f,top:d,right:c+g,bottom:d+f,left:c}}const Ur={ignoreTransform:!1};function _e(e,t){t===void 0&&(t=Ur);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=_(e).getComputedStyle(e);d&&(n=Fr(n,d,g))}const{top:r,left:o,width:s,height:i,bottom:l,right:c}=n;return{top:r,left:o,width:s,height:i,bottom:l,right:c}}function Wt(e){return _e(e,{ignoreTransform:!0})}function Kr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xr(e,t){return t===void 0&&(t=_(e).getComputedStyle(e)),t.position==="fixed"}function Yr(e,t){t===void 0&&(t=_(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function yt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(xt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ie(o)||dn(o)||n.includes(o))return n;const s=_(e).getComputedStyle(o);return o!==e&&Yr(o,s)&&n.push(o),Xr(o,s)?n:r(o.parentNode)}return e?r(e):n}function bn(e){const[t]=yt(e,1);return t??null}function lt(e){return!Je||!e?null:Ce(e)?e:vt(e)?xt(e)||e===De(e).scrollingElement?window:Ie(e)?e:null:null}function vn(e){return Ce(e)?e.scrollX:e.scrollLeft}function xn(e){return Ce(e)?e.scrollY:e.scrollTop}function gt(e){return{x:vn(e),y:xn(e)}}var L;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(L||(L={}));function mn(e){return!Je||!e?!1:e===document.scrollingElement}function yn(e){const t={x:0,y:0},n=mn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const qr={x:.2,y:.2};function Vr(e,t,n,r,o){let{top:s,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=qr);const{isTop:d,isBottom:g,isLeft:f,isRight:b}=yn(e),p={x:0,y:0},w={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=L.Backward,w.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&c>=t.bottom-v.height&&(p.y=L.Forward,w.y=r*Math.abs((t.bottom-v.height-c)/v.height)),!b&&l>=t.right-v.width?(p.x=L.Forward,w.x=r*Math.abs((t.right-v.width-l)/v.width)):!f&&i<=t.left+v.width&&(p.x=L.Backward,w.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:p,speed:w}}function Hr(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function wn(e){return e.reduce((t,n)=>we(t,gt(n)),J)}function Wr(e){return e.reduce((t,n)=>t+vn(n),0)}function Gr(e){return e.reduce((t,n)=>t+xn(n),0)}function Sn(e,t){if(t===void 0&&(t=_e),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);bn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Jr=[["x",["left","right"],Wr],["y",["top","bottom"],Gr]];class wt{constructor(t,n){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;const r=yt(n),o=wn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,l]of Jr)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ae{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Qr(e){const{EventTarget:t}=_(e);return e instanceof t?e:De(e)}function ct(e,t){const 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:!1}var V;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(V||(V={}));function Gt(e){e.preventDefault()}function Zr(e){e.stopPropagation()}var k;(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"})(k||(k={}));const Cn={start:[k.Space,k.Enter],cancel:[k.Esc],end:[k.Space,k.Enter,k.Tab]},es=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case k.Right:return{...n,x:n.x+25};case k.Left:return{...n,x:n.x-25};case k.Down:return{...n,y:n.y+25};case k.Up:return{...n,y:n.y-25}}};class St{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ae(De(n)),this.windowListeners=new Ae(_(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(V.Resize,this.handleCancel),this.windowListeners.add(V.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(V.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Sn(r),n(J)}handleKeyDown(t){if(mt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Cn,coordinateGetter:i=es,scrollBehavior:l="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:J;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Ve(f,g),p={x:0,y:0},{scrollableAncestors:w}=r.current;for(const v of w){const y=t.code,{isTop:S,isRight:C,isLeft:x,isBottom:E,maxScroll:N,minScroll:R}=yn(v),D=Hr(v),j={x:Math.min(y===k.Right?D.right-D.width/2:D.right,Math.max(y===k.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(y===k.Down?D.bottom-D.height/2:D.bottom,Math.max(y===k.Down?D.top:D.top+D.height/2,f.y))},T=y===k.Right&&!C||y===k.Left&&!x,O=y===k.Down&&!E||y===k.Up&&!S;if(T&&j.x!==f.x){const A=v.scrollLeft+b.x,H=y===k.Right&&A<=N.x||y===k.Left&&A>=R.x;if(H&&!b.y){v.scrollTo({left:A,behavior:l});return}H?p.x=v.scrollLeft-A:p.x=y===k.Right?v.scrollLeft-N.x:v.scrollLeft-R.x,p.x&&v.scrollBy({left:-p.x,behavior:l});break}else if(O&&j.y!==f.y){const A=v.scrollTop+b.y,H=y===k.Down&&A<=N.y||y===k.Up&&A>=R.y;if(H&&!b.x){v.scrollTo({top:A,behavior:l});return}H?p.y=v.scrollTop-A:p.y=y===k.Down?v.scrollTop-N.y:v.scrollTop-R.y,p.y&&v.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,we(Ve(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}St.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Cn,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Jt(e){return!!(e&&"distance"in e)}function Qt(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=Qr(t.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=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=De(i),this.documentListeners=new Ae(this.document),this.listeners=new Ae(r),this.windowListeners=new Ae(_(i)),this.initialCoordinates=(o=He(s))!=null?o: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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(V.Resize,this.handleCancel),this.windowListeners.add(V.DragStart,Gt),this.windowListeners.add(V.VisibilityChange,this.handleCancel),this.windowListeners.add(V.ContextMenu,Gt),this.documentListeners.add(V.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Qt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Jt(n)){this.handlePending(n);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(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(V.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(V.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:l}}=s;if(!o)return;const c=(n=He(t))!=null?n:J,d=Ve(o,c);if(!r&&l){if(Jt(l)){if(l.tolerance!=null&&ct(d,l.tolerance))return this.handleCancel();if(ct(d,l.distance))return this.handleStart()}if(Qt(l)&&ct(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===k.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ts={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Dt extends Ct{constructor(t){const{event:n}=t,r=De(n.target);super(t,ts,r)}}Dt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const ns={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class rs extends Ct{constructor(t){super(t,ns,De(t.event.target))}}rs.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r==null||r({event:n}),!0)}}];const ut={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ss extends Ct{constructor(t){super(t,ut)}static setup(){return window.addEventListener(ut.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ut.move.name,t)};function t(){}}}ss.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Me;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Me||(Me={}));var Ge;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ge||(Ge={}));function os(e){let{acceleration:t,activator:n=Me.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:l=Ge.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:b}=e;const p=is({delta:f,disabled:!s}),[w,v]=br(),y=u.useRef({x:0,y:0}),S=u.useRef({x:0,y:0}),C=u.useMemo(()=>{switch(n){case Me.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Me.DraggableRect:return o}},[n,o,c]),x=u.useRef(null),E=u.useCallback(()=>{const R=x.current;if(!R)return;const D=y.current.x*S.current.x,j=y.current.y*S.current.y;R.scrollBy(D,j)},[]),N=u.useMemo(()=>l===Ge.TreeOrder?[...d].reverse():d,[l,d]);u.useEffect(()=>{if(!s||!d.length||!C){v();return}for(const R of N){if((r==null?void 0:r(R))===!1)continue;const D=d.indexOf(R),j=g[D];if(!j)continue;const{direction:T,speed:O}=Vr(R,j,C,t,b);for(const A of["x","y"])p[A][T[A]]||(O[A]=0,T[A]=0);if(O.x>0||O.y>0){v(),x.current=R,w(E,i),y.current=O,S.current=T;return}}y.current={x:0,y:0},S.current={x:0,y:0},v()},[t,E,r,v,s,i,JSON.stringify(C),JSON.stringify(p),w,d,N,g,JSON.stringify(b)])}const as={x:{[L.Backward]:!1,[L.Forward]:!1},y:{[L.Backward]:!1,[L.Forward]:!1}};function is(e){let{delta:t,disabled:n}=e;const r=qe(t);return ze(o=>{if(n||!r||!o)return as;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[L.Backward]:o.x[L.Backward]||s.x===-1,[L.Forward]:o.x[L.Forward]||s.x===1},y:{[L.Backward]:o.y[L.Backward]||s.y===-1,[L.Forward]:o.y[L.Forward]||s.y===1}}},[n,t,r])}function ls(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ze(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function cs(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Le;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Le||(Le={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const Zt=new Map;function us(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=u.useState(null),{frequency:l,measure:c,strategy:d}=o,g=u.useRef(e),f=y(),b=Pe(f),p=u.useCallback(function(S){S===void 0&&(S=[]),!b.current&&i(C=>C===null?S:C.concat(S.filter(x=>!C.includes(x))))},[b]),w=u.useRef(null),v=ze(S=>{if(f&&!n)return Zt;if(!S||S===Zt||g.current!==e||s!=null){const C=new Map;for(let x of e){if(!x)continue;if(s&&s.length>0&&!s.includes(x.id)&&x.rect.current){C.set(x.id,x.rect.current);continue}const E=x.node.current,N=E?new wt(c(E),E):null;x.rect.current=N,N&&C.set(x.id,N)}return C}return S},[e,s,n,f,c]);return u.useEffect(()=>{g.current=e},[e]),u.useEffect(()=>{f||p()},[n,f]),u.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),u.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},l))},[l,f,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Le.Always:return!1;case Le.BeforeDragging:return n;default:return!n}}}function jt(e,t){return ze(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ds(e,t){return jt(e,t)}function fs(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return u.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function et(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return u.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function hs(e){return new wt(_e(e),e)}function en(e,t,n){t===void 0&&(t=hs);const[r,o]=u.useState(null);function s(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=fs({callback(c){if(e)for(const d of c){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=et({callback:s});return ae(()=>{s(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r}function gs(e){const t=jt(e);return gn(e,t)}const tn=[];function ps(e){const t=u.useRef(e),n=ze(r=>e?r&&r!==tn&&e&&t.current&&e.parentNode===t.current.parentNode?r:yt(e):tn,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function bs(e){const[t,n]=u.useState(null),r=u.useRef(e),o=u.useCallback(s=>{const i=lt(s.target);i&&n(l=>l?(l.set(i,gt(i)),new Map(l)):null)},[]);return u.useEffect(()=>{const s=r.current;if(e!==s){i(s);const l=e.map(c=>{const d=lt(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,gt(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(s)};function i(l){l.forEach(c=>{const d=lt(c);d==null||d.removeEventListener("scroll",o)})}},[o,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>we(s,i),J):wn(e):J,[e,t])}function nn(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==J;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ve(e,n.current):J}function vs(e){u.useEffect(()=>{if(!Je)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function xs(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function Dn(e){return u.useMemo(()=>e?Kr(e):null,[e])}const rn=[];function ms(e,t){t===void 0&&(t=_e);const[n]=e,r=Dn(n?_(n):null),[o,s]=u.useState(rn);function i(){s(()=>e.length?e.map(c=>mn(c)?r:new wt(t(c),c)):rn)}const l=et({callback:i});return ae(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),o}function jn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ie(t)?t:e}function ys(e){let{measure:t}=e;const[n,r]=u.useState(null),o=u.useCallback(d=>{for(const{target:g}of d)if(Ie(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),s=et({callback:o}),i=u.useCallback(d=>{const g=jn(d);s==null||s.disconnect(),g&&(s==null||s.observe(g)),r(g?t(g):null)},[t,s]),[l,c]=Ye(i);return u.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ws=[{sensor:Dt,options:{}},{sensor:St,options:{}}],Ss={current:{}},Xe={draggable:{measure:Wt},droppable:{measure:Wt,strategy:Le.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:_e}};class Oe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Cs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Oe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:We},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xe,measureDroppableContainers:We,windowRect:null,measuringScheduled:!1},Nn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:We,draggableNodes:new Map,over:null,measureDroppableContainers:We},Be=u.createContext(Nn),Rn=u.createContext(Cs);function Ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Oe}}}function js(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.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 P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Oe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case P.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Oe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case P.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Oe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Ns(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=u.useContext(Be),s=qe(r),i=qe(n==null?void 0:n.id);return u.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!mt(s)||document.activeElement===s.target)return;const l=o.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[c.current,d.current]){if(!g)continue;const f=mr(g);if(f){f.focus();break}}})}},[r,t,o,i,s]),null}function En(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Rs(e){return u.useMemo(()=>({draggable:{...Xe.draggable,...e==null?void 0:e.draggable},droppable:{...Xe.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xe.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Es(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=u.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ae(()=>{if(!i&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=gn(g,r);if(i||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=bn(d);b&&b.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const tt=u.createContext({...J,scaleX:1,scaleY:1});var fe;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fe||(fe={}));const ks=u.memo(function(t){var n,r,o,s;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:g=ws,collisionDetection:f=zr,measuring:b,modifiers:p,...w}=t;const v=u.useReducer(js,void 0,Ds),[y,S]=v,[C,x]=jr(),[E,N]=u.useState(fe.Uninitialized),R=E===fe.Initialized,{draggable:{active:D,nodes:j,translate:T},droppable:{containers:O}}=y,A=D!=null?j.get(D):null,H=u.useRef({initial:null,translated:null}),B=u.useMemo(()=>{var z;return D!=null?{id:D,data:(z=A==null?void 0:A.data)!=null?z:Ss,rect:H}:null},[D,A]),$=u.useRef(null),[re,pe]=u.useState(null),[X,$e]=u.useState(null),se=Pe(w,Object.values(w)),be=Ze("DndDescribedBy",i),h=u.useMemo(()=>O.getEnabled(),[O]),m=Rs(b),{droppableRects:Y,measureDroppableContainers:Q,measuringScheduled:Nt}=us(h,{dragging:R,dependencies:[T.x,T.y],config:m.droppable}),W=ls(j,D),Rt=u.useMemo(()=>X?He(X):null,[X]),Et=_n(),kt=ds(W,m.draggable.measure);Es({activeNode:D!=null?j.get(D):null,config:Et.layoutShiftCompensation,initialRect:kt,measure:m.draggable.measure});const G=en(W,m.draggable.measure,kt),nt=en(W?W.parentElement:null),he=u.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Tt=O.getNodeFor((n=he.current.over)==null?void 0:n.id),ge=ys({measure:m.dragOverlay.measure}),Fe=(r=ge.nodeRef.current)!=null?r:W,ve=R?(o=ge.rect)!=null?o:G:null,At=!!(ge.nodeRef.current&&ge.rect),Mt=gs(At?null:G),rt=Dn(Fe?_(Fe):null),ie=ps(R?Tt??W:null),Ue=ms(ie),Ke=En(p,{transform:{x:T.x-Mt.x,y:T.y-Mt.y,scaleX:1,scaleY:1},activatorEvent:X,active:B,activeNodeRect:G,containerNodeRect:nt,draggingNodeRect:ve,over:he.current.over,overlayNodeRect:ge.rect,scrollableAncestors:ie,scrollableAncestorRects:Ue,windowRect:rt}),Ot=Rt?we(Rt,T):null,Pt=bs(ie),An=nn(Pt),Mn=nn(Pt,[G]),xe=we(Ke,An),me=ve?$r(ve,Ke):null,je=B&&me?f({active:B,collisionRect:me,droppableRects:Y,droppableContainers:h,pointerCoordinates:Ot}):null,Lt=Pr(je,"id"),[le,It]=u.useState(null),On=At?Ke:we(Ke,Mn),Pn=_r(On,(s=le==null?void 0:le.rect)!=null?s:null,G),st=u.useRef(null),zt=u.useCallback((z,F)=>{let{sensor:U,options:ce}=F;if($.current==null)return;const q=j.get($.current);if(!q)return;const K=z.nativeEvent,Z=new U({active:$.current,activeNode:q,event:K,options:ce,context:he,onAbort(I){if(!j.get(I))return;const{onDragAbort:ee}=se.current,oe={id:I};ee==null||ee(oe),C({type:"onDragAbort",event:oe})},onPending(I,ue,ee,oe){if(!j.get(I))return;const{onDragPending:Re}=se.current,de={id:I,constraint:ue,initialCoordinates:ee,offset:oe};Re==null||Re(de),C({type:"onDragPending",event:de})},onStart(I){const ue=$.current;if(ue==null)return;const ee=j.get(ue);if(!ee)return;const{onDragStart:oe}=se.current,Ne={activatorEvent:K,active:{id:ue,data:ee.data,rect:H}};ke.unstable_batchedUpdates(()=>{oe==null||oe(Ne),N(fe.Initializing),S({type:P.DragStart,initialCoordinates:I,active:ue}),C({type:"onDragStart",event:Ne}),pe(st.current),$e(K)})},onMove(I){S({type:P.DragMove,coordinates:I})},onEnd:ye(P.DragEnd),onCancel:ye(P.DragCancel)});st.current=Z;function ye(I){return async function(){const{active:ee,collisions:oe,over:Ne,scrollAdjustedTranslate:Re}=he.current;let de=null;if(ee&&Re){const{cancelDrop:Ee}=se.current;de={activatorEvent:K,active:ee,collisions:oe,delta:Re,over:Ne},I===P.DragEnd&&typeof Ee=="function"&&await Promise.resolve(Ee(de))&&(I=P.DragCancel)}$.current=null,ke.unstable_batchedUpdates(()=>{S({type:I}),N(fe.Uninitialized),It(null),pe(null),$e(null),st.current=null;const Ee=I===P.DragEnd?"onDragEnd":"onDragCancel";if(de){const ot=se.current[Ee];ot==null||ot(de),C({type:Ee,event:de})}})}}},[j]),Ln=u.useCallback((z,F)=>(U,ce)=>{const q=U.nativeEvent,K=j.get(ce);if($.current!==null||!K||q.dndKit||q.defaultPrevented)return;const Z={active:K};z(U,F.options,Z)===!0&&(q.dndKit={capturedBy:F.sensor},$.current=ce,zt(U,F))},[j,zt]),_t=cs(g,Ln);vs(g),ae(()=>{G&&E===fe.Initializing&&N(fe.Initialized)},[G,E]),u.useEffect(()=>{const{onDragMove:z}=se.current,{active:F,activatorEvent:U,collisions:ce,over:q}=he.current;if(!F||!U)return;const K={active:F,activatorEvent:U,collisions:ce,delta:{x:xe.x,y:xe.y},over:q};ke.unstable_batchedUpdates(()=>{z==null||z(K),C({type:"onDragMove",event:K})})},[xe.x,xe.y]),u.useEffect(()=>{const{active:z,activatorEvent:F,collisions:U,droppableContainers:ce,scrollAdjustedTranslate:q}=he.current;if(!z||$.current==null||!F||!q)return;const{onDragOver:K}=se.current,Z=ce.get(Lt),ye=Z&&Z.rect.current?{id:Z.id,rect:Z.rect.current,data:Z.data,disabled:Z.disabled}:null,I={active:z,activatorEvent:F,collisions:U,delta:{x:q.x,y:q.y},over:ye};ke.unstable_batchedUpdates(()=>{It(ye),K==null||K(I),C({type:"onDragOver",event:I})})},[Lt]),ae(()=>{he.current={activatorEvent:X,active:B,activeNode:W,collisionRect:me,collisions:je,droppableRects:Y,draggableNodes:j,draggingNode:Fe,draggingNodeRect:ve,droppableContainers:O,over:le,scrollableAncestors:ie,scrollAdjustedTranslate:xe},H.current={initial:ve,translated:me}},[B,W,je,me,j,Fe,ve,Y,O,le,ie,xe]),os({...Et,delta:T,draggingRect:me,pointerCoordinates:Ot,scrollableAncestors:ie,scrollableAncestorRects:Ue});const In=u.useMemo(()=>({active:B,activeNode:W,activeNodeRect:G,activatorEvent:X,collisions:je,containerNodeRect:nt,dragOverlay:ge,draggableNodes:j,droppableContainers:O,droppableRects:Y,over:le,measureDroppableContainers:Q,scrollableAncestors:ie,scrollableAncestorRects:Ue,measuringConfiguration:m,measuringScheduled:Nt,windowRect:rt}),[B,W,G,X,je,nt,ge,j,O,Y,le,Q,ie,Ue,m,Nt,rt]),zn=u.useMemo(()=>({activatorEvent:X,activators:_t,active:B,activeNodeRect:G,ariaDescribedById:{draggable:be},dispatch:S,draggableNodes:j,over:le,measureDroppableContainers:Q}),[X,_t,B,G,S,be,j,le,Q]);return M.createElement(hn.Provider,{value:x},M.createElement(Be.Provider,{value:zn},M.createElement(Rn.Provider,{value:In},M.createElement(tt.Provider,{value:Pn},d)),M.createElement(Ns,{disabled:(l==null?void 0:l.restoreFocus)===!1})),M.createElement(Er,{...l,hiddenTextDescribedById:be}));function _n(){const z=(re==null?void 0:re.autoScrollEnabled)===!1,F=typeof c=="object"?c.enabled===!1:c===!1,U=R&&!z&&!F;return typeof c=="object"?{...c,enabled:U}:{enabled:U}}}),Ts=u.createContext(null),sn="button",As="Draggable";function Ms(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Ze(As),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:b}=u.useContext(Be),{role:p=sn,roleDescription:w="draggable",tabIndex:v=0}=o??{},y=(c==null?void 0:c.id)===t,S=u.useContext(y?tt:Ts),[C,x]=Ye(),[E,N]=Ye(),R=xs(i,t),D=Pe(n);ae(()=>(f.set(t,{id:t,key:s,node:C,activatorNode:E,data:D}),()=>{const T=f.get(t);T&&T.key===s&&f.delete(t)}),[f,t]);const j=u.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===sn?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,p,v,y,w,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:j,isDragging:y,listeners:r?void 0:R,node:C,over:b,setNodeRef:x,setActivatorNodeRef:N,transform:S}}function Os(){return u.useContext(Rn)}const Ps="Droppable",Ls={timeout:25};function Is(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Ze(Ps),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=u.useContext(Be),g=u.useRef({disabled:n}),f=u.useRef(!1),b=u.useRef(null),p=u.useRef(null),{disabled:w,updateMeasurementsFor:v,timeout:y}={...Ls,...o},S=Pe(v??r),C=u.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),p.current=null},y)},[y]),x=et({callback:C,disabled:w||!i}),E=u.useCallback((j,T)=>{x&&(T&&(x.unobserve(T),f.current=!1),j&&x.observe(j))},[x]),[N,R]=Ye(E),D=Pe(t);return u.useEffect(()=>{!x||!N.current||(x.disconnect(),f.current=!1,x.observe(N.current))},[N,x]),u.useEffect(()=>(l({type:P.RegisterDroppable,element:{id:r,key:s,disabled:n,node:N,rect:b,data:D}}),()=>l({type:P.UnregisterDroppable,key:s,id:r})),[r]),u.useEffect(()=>{n!==g.current.disabled&&(l({type:P.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:i,rect:b,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:R}}function zs(e){let{animation:t,children:n}=e;const[r,o]=u.useState(null),[s,i]=u.useState(null),l=qe(n);return!n&&!r&&l&&o(l),ae(()=>{if(!s)return;const c=r==null?void 0:r.key,d=r==null?void 0:r.props.id;if(c==null||d==null){o(null);return}Promise.resolve(t(d,s)).then(()=>{o(null)})},[t,r,s]),M.createElement(M.Fragment,null,n,r?u.cloneElement(r,{ref:i}):null)}const _s={x:0,y:0,scaleX:1,scaleY:1};function Bs(e){let{children:t}=e;return M.createElement(Be.Provider,{value:Nn},M.createElement(tt.Provider,{value:_s},t))}const $s={position:"fixed",touchAction:"none"},Fs=e=>mt(e)?"transform 250ms ease":void 0,Us=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:s,className:i,rect:l,style:c,transform:d,transition:g=Fs}=e;if(!l)return null;const f=o?d:{...d,scaleX:1,scaleY:1},b={...$s,width:l.width,height:l.height,top:l.top,left:l.left,transform:Se.Transform.toString(f),transformOrigin:o&&r?Ar(r,l):void 0,transition:typeof g=="function"?g(r):g,...c};return M.createElement(n,{className:i,style:b,ref:t},s)}),Ks=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[l,c]of Object.entries(s.active))c!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(s!=null&&s.dragOverlay)for(const[l,c]of Object.entries(s.dragOverlay))c!==void 0&&r.node.style.setProperty(l,c);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(o))n.node.style.setProperty(c,d);i!=null&&i.active&&n.node.classList.remove(i.active)}},Xs=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Se.Transform.toString(t)},{transform:Se.Transform.toString(n)}]},Ys={duration:250,easing:"ease",keyframes:Xs,sideEffects:Ks({styles:{active:{opacity:"0"}}})};function qs(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Qe((s,i)=>{if(t===null)return;const l=n.get(s);if(!l)return;const c=l.node.current;if(!c)return;const d=jn(i);if(!d)return;const{transform:g}=_(i).getComputedStyle(i),f=pn(g);if(!f)return;const b=typeof t=="function"?t:Vs(t);return Sn(c,o.draggable.measure),b({active:{id:s,data:l.data,node:c,rect:o.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:i,rect:o.dragOverlay.measure(d)},droppableContainers:r,measuringConfiguration:o,transform:f})})}function Vs(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Ys,...e};return s=>{let{active:i,dragOverlay:l,transform:c,...d}=s;if(!t)return;const g={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},b={x:c.x-g.x,y:c.y-g.y,...f},p=o({...d,active:i,dragOverlay:l,transform:{initial:c,final:b}}),[w]=p,v=p[p.length-1];if(JSON.stringify(w)===JSON.stringify(v))return;const y=r==null?void 0:r({active:i,dragOverlay:l,...d}),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(C=>{S.onfinish=()=>{y==null||y(),C()}})}}let on=0;function Hs(e){return u.useMemo(()=>{if(e!=null)return on++,on},[e])}const Ws=M.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:s,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:g,active:f,activeNodeRect:b,containerNodeRect:p,draggableNodes:w,droppableContainers:v,dragOverlay:y,over:S,measuringConfiguration:C,scrollableAncestors:x,scrollableAncestorRects:E,windowRect:N}=Os(),R=u.useContext(tt),D=Hs(f==null?void 0:f.id),j=En(i,{activatorEvent:g,active:f,activeNodeRect:b,containerNodeRect:p,draggingNodeRect:y.rect,over:S,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:E,transform:R,windowRect:N}),T=jt(b),O=qs({config:r,draggableNodes:w,droppableContainers:v,measuringConfiguration:C}),A=T?y.setRef:void 0;return M.createElement(Bs,null,M.createElement(zs,{animation:O},f&&D?M.createElement(Us,{key:D,id:f.id,ref:A,as:l,activatorEvent:g,adjustScale:t,className:c,transition:s,rect:T,style:{zIndex:d,...o},transform:j},n):null))}),kn=[{status:"todo",label:"Todo",color:"rgb(var(--muted-foreground))"},{status:"doing",label:"In Progress",color:"rgb(var(--progress))"},{status:"review",label:"Review",color:"rgb(var(--warning))"},{status:"blocked",label:"Blocked",color:"rgb(var(--error))"},{status:"done",label:"Done",color:"rgb(var(--success))"}];kn.map(e=>e.status);function Te(e){switch(e){case"todo":case"doing":case"review":case"blocked":case"done":return e;case"queued":return"todo";case"changes_requested":return"review";case"paused":return"blocked";case"cancelled":return null;default:return null}}function Gs(e){const t=Te(e);return t===null||t===e?null:e.replace(/_/g," ")}function Tn({task:e,onDelete:t,onClick:n,isDragOverlay:r}){var S,C;const{attributes:o,listeners:s,setNodeRef:i,setActivatorNodeRef:l,transform:c,isDragging:d}=Ms({id:e.id,data:{type:"task",task:e}}),g=u.useRef(null),f={transform:Se.Translate.toString(c),opacity:d?.3:1},b=Gs(e.status),p=s==null?void 0:s.onPointerDown,w=x=>{g.current={x:x.clientX,y:x.clientY},p==null||p(x)},v=x=>{if(!n||!g.current)return;const E=Math.abs(x.clientX-g.current.x),N=Math.abs(x.clientY-g.current.y);g.current=null,E<5&&N<5&&n(e)},y=r?{}:{onPointerDown:w};return a.jsx("div",{ref:r?void 0:i,style:r?void 0:f,"data-testid":"kanban-card","data-task-id":e.id,"data-task-status":e.status,...y,onPointerUp:r?void 0:v,className:`
|
|
15
|
+
`},Rr={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 Er(e){let{announcements:t=Rr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Nr}=e;const{announce:s,announcement:i}=Cr(),l=Ze("DndLiveRegion"),[c,d]=u.useState(!1);if(u.useEffect(()=>{d(!0)},[]),Dr(u.useMemo(()=>({onDragStart(f){let{active:b}=f;s(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:p}=f;t.onDragMove&&s(t.onDragMove({active:b,over:p}))},onDragOver(f){let{active:b,over:p}=f;s(t.onDragOver({active:b,over:p}))},onDragEnd(f){let{active:b,over:p}=f;s(t.onDragEnd({active:b,over:p}))},onDragCancel(f){let{active:b,over:p}=f;s(t.onDragCancel({active:b,over:p}))}}),[s,t])),!c)return null;const g=M.createElement(M.Fragment,null,M.createElement(wr,{id:r,value:o.draggable}),M.createElement(Sr,{id:l,announcement:i}));return n?Te.createPortal(g,n):g}var P;(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"})(P||(P={}));function We(){}function Vt(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Tr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const J=Object.freeze({x:0,y:0});function kr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ar(e,t){const n=He(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Mr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Or(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ht(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Pr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const Lr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Ht(t),s=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const d=Ht(c),g=o.reduce((b,p,w)=>b+kr(d[w],p),0),f=Number((g/4).toFixed(4));s.push({id:l,data:{droppableContainer:i,value:f}})}}return s.sort(Mr)};function Ir(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,l=s-n;if(r<o&&n<s){const c=t.width*t.height,d=e.width*e.height,g=i*l,f=g/(c+d-g);return Number(f.toFixed(4))}return 0}const zr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,l=n.get(i);if(l){const c=Ir(l,t);c>0&&o.push({id:i,data:{droppableContainer:s,value:c}})}}return o.sort(Or)};function _r(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function gn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function Br(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...n})}}const $r=Br(1);function pn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Fr(e,t,n){const r=pn(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:l}=r,c=e.left-i-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=s?e.height/s:e.height;return{width:g,height:f,top:d,right:c+g,bottom:d+f,left:c}}const Kr={ignoreTransform:!1};function _e(e,t){t===void 0&&(t=Kr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=_(e).getComputedStyle(e);d&&(n=Fr(n,d,g))}const{top:r,left:o,width:s,height:i,bottom:l,right:c}=n;return{top:r,left:o,width:s,height:i,bottom:l,right:c}}function Wt(e){return _e(e,{ignoreTransform:!0})}function Ur(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xr(e,t){return t===void 0&&(t=_(e).getComputedStyle(e)),t.position==="fixed"}function Yr(e,t){t===void 0&&(t=_(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function yt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ie(o)||dn(o)||n.includes(o))return n;const s=_(e).getComputedStyle(o);return o!==e&&Yr(o,s)&&n.push(o),Xr(o,s)?n:r(o.parentNode)}return e?r(e):n}function bn(e){const[t]=yt(e,1);return t??null}function lt(e){return!Je||!e?null:Ce(e)?e:vt(e)?mt(e)||e===De(e).scrollingElement?window:Ie(e)?e:null:null}function vn(e){return Ce(e)?e.scrollX:e.scrollLeft}function mn(e){return Ce(e)?e.scrollY:e.scrollTop}function gt(e){return{x:vn(e),y:mn(e)}}var L;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(L||(L={}));function xn(e){return!Je||!e?!1:e===document.scrollingElement}function yn(e){const t={x:0,y:0},n=xn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const qr={x:.2,y:.2};function Vr(e,t,n,r,o){let{top:s,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=qr);const{isTop:d,isBottom:g,isLeft:f,isRight:b}=yn(e),p={x:0,y:0},w={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=L.Backward,w.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&c>=t.bottom-v.height&&(p.y=L.Forward,w.y=r*Math.abs((t.bottom-v.height-c)/v.height)),!b&&l>=t.right-v.width?(p.x=L.Forward,w.x=r*Math.abs((t.right-v.width-l)/v.width)):!f&&i<=t.left+v.width&&(p.x=L.Backward,w.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:p,speed:w}}function Hr(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function wn(e){return e.reduce((t,n)=>we(t,gt(n)),J)}function Wr(e){return e.reduce((t,n)=>t+vn(n),0)}function Gr(e){return e.reduce((t,n)=>t+mn(n),0)}function Sn(e,t){if(t===void 0&&(t=_e),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);bn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Jr=[["x",["left","right"],Wr],["y",["top","bottom"],Gr]];class wt{constructor(t,n){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;const r=yt(n),o=wn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,l]of Jr)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ae{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Qr(e){const{EventTarget:t}=_(e);return e instanceof t?e:De(e)}function ct(e,t){const 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:!1}var V;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(V||(V={}));function Gt(e){e.preventDefault()}function Zr(e){e.stopPropagation()}var T;(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"})(T||(T={}));const Cn={start:[T.Space,T.Enter],cancel:[T.Esc],end:[T.Space,T.Enter,T.Tab]},es=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case T.Right:return{...n,x:n.x+25};case T.Left:return{...n,x:n.x-25};case T.Down:return{...n,y:n.y+25};case T.Up:return{...n,y:n.y-25}}};class St{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ae(De(n)),this.windowListeners=new Ae(_(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(V.Resize,this.handleCancel),this.windowListeners.add(V.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(V.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Sn(r),n(J)}handleKeyDown(t){if(xt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Cn,coordinateGetter:i=es,scrollBehavior:l="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:J;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Ve(f,g),p={x:0,y:0},{scrollableAncestors:w}=r.current;for(const v of w){const y=t.code,{isTop:S,isRight:C,isLeft:m,isBottom:E,maxScroll:N,minScroll:R}=yn(v),D=Hr(v),j={x:Math.min(y===T.Right?D.right-D.width/2:D.right,Math.max(y===T.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(y===T.Down?D.bottom-D.height/2:D.bottom,Math.max(y===T.Down?D.top:D.top+D.height/2,f.y))},k=y===T.Right&&!C||y===T.Left&&!m,O=y===T.Down&&!E||y===T.Up&&!S;if(k&&j.x!==f.x){const A=v.scrollLeft+b.x,H=y===T.Right&&A<=N.x||y===T.Left&&A>=R.x;if(H&&!b.y){v.scrollTo({left:A,behavior:l});return}H?p.x=v.scrollLeft-A:p.x=y===T.Right?v.scrollLeft-N.x:v.scrollLeft-R.x,p.x&&v.scrollBy({left:-p.x,behavior:l});break}else if(O&&j.y!==f.y){const A=v.scrollTop+b.y,H=y===T.Down&&A<=N.y||y===T.Up&&A>=R.y;if(H&&!b.x){v.scrollTo({top:A,behavior:l});return}H?p.y=v.scrollTop-A:p.y=y===T.Down?v.scrollTop-N.y:v.scrollTop-R.y,p.y&&v.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,we(Ve(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}St.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Cn,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Jt(e){return!!(e&&"distance"in e)}function Qt(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=Qr(t.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=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=De(i),this.documentListeners=new Ae(this.document),this.listeners=new Ae(r),this.windowListeners=new Ae(_(i)),this.initialCoordinates=(o=He(s))!=null?o: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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(V.Resize,this.handleCancel),this.windowListeners.add(V.DragStart,Gt),this.windowListeners.add(V.VisibilityChange,this.handleCancel),this.windowListeners.add(V.ContextMenu,Gt),this.documentListeners.add(V.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Qt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Jt(n)){this.handlePending(n);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(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(V.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(V.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:l}}=s;if(!o)return;const c=(n=He(t))!=null?n:J,d=Ve(o,c);if(!r&&l){if(Jt(l)){if(l.tolerance!=null&&ct(d,l.tolerance))return this.handleCancel();if(ct(d,l.distance))return this.handleStart()}if(Qt(l)&&ct(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===T.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ts={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Dt extends Ct{constructor(t){const{event:n}=t,r=De(n.target);super(t,ts,r)}}Dt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const ns={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class rs extends Ct{constructor(t){super(t,ns,De(t.event.target))}}rs.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r==null||r({event:n}),!0)}}];const ut={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ss extends Ct{constructor(t){super(t,ut)}static setup(){return window.addEventListener(ut.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ut.move.name,t)};function t(){}}}ss.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Me;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Me||(Me={}));var Ge;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ge||(Ge={}));function os(e){let{acceleration:t,activator:n=Me.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:l=Ge.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:b}=e;const p=is({delta:f,disabled:!s}),[w,v]=br(),y=u.useRef({x:0,y:0}),S=u.useRef({x:0,y:0}),C=u.useMemo(()=>{switch(n){case Me.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Me.DraggableRect:return o}},[n,o,c]),m=u.useRef(null),E=u.useCallback(()=>{const R=m.current;if(!R)return;const D=y.current.x*S.current.x,j=y.current.y*S.current.y;R.scrollBy(D,j)},[]),N=u.useMemo(()=>l===Ge.TreeOrder?[...d].reverse():d,[l,d]);u.useEffect(()=>{if(!s||!d.length||!C){v();return}for(const R of N){if((r==null?void 0:r(R))===!1)continue;const D=d.indexOf(R),j=g[D];if(!j)continue;const{direction:k,speed:O}=Vr(R,j,C,t,b);for(const A of["x","y"])p[A][k[A]]||(O[A]=0,k[A]=0);if(O.x>0||O.y>0){v(),m.current=R,w(E,i),y.current=O,S.current=k;return}}y.current={x:0,y:0},S.current={x:0,y:0},v()},[t,E,r,v,s,i,JSON.stringify(C),JSON.stringify(p),w,d,N,g,JSON.stringify(b)])}const as={x:{[L.Backward]:!1,[L.Forward]:!1},y:{[L.Backward]:!1,[L.Forward]:!1}};function is(e){let{delta:t,disabled:n}=e;const r=qe(t);return ze(o=>{if(n||!r||!o)return as;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[L.Backward]:o.x[L.Backward]||s.x===-1,[L.Forward]:o.x[L.Forward]||s.x===1},y:{[L.Backward]:o.y[L.Backward]||s.y===-1,[L.Forward]:o.y[L.Forward]||s.y===1}}},[n,t,r])}function ls(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ze(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function cs(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Le;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Le||(Le={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const Zt=new Map;function us(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=u.useState(null),{frequency:l,measure:c,strategy:d}=o,g=u.useRef(e),f=y(),b=Pe(f),p=u.useCallback(function(S){S===void 0&&(S=[]),!b.current&&i(C=>C===null?S:C.concat(S.filter(m=>!C.includes(m))))},[b]),w=u.useRef(null),v=ze(S=>{if(f&&!n)return Zt;if(!S||S===Zt||g.current!==e||s!=null){const C=new Map;for(let m of e){if(!m)continue;if(s&&s.length>0&&!s.includes(m.id)&&m.rect.current){C.set(m.id,m.rect.current);continue}const E=m.node.current,N=E?new wt(c(E),E):null;m.rect.current=N,N&&C.set(m.id,N)}return C}return S},[e,s,n,f,c]);return u.useEffect(()=>{g.current=e},[e]),u.useEffect(()=>{f||p()},[n,f]),u.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),u.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},l))},[l,f,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Le.Always:return!1;case Le.BeforeDragging:return n;default:return!n}}}function jt(e,t){return ze(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ds(e,t){return jt(e,t)}function fs(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return u.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function et(e){let{callback:t,disabled:n}=e;const r=Qe(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return u.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function hs(e){return new wt(_e(e),e)}function en(e,t,n){t===void 0&&(t=hs);const[r,o]=u.useState(null);function s(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=fs({callback(c){if(e)for(const d of c){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=et({callback:s});return ae(()=>{s(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r}function gs(e){const t=jt(e);return gn(e,t)}const tn=[];function ps(e){const t=u.useRef(e),n=ze(r=>e?r&&r!==tn&&e&&t.current&&e.parentNode===t.current.parentNode?r:yt(e):tn,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function bs(e){const[t,n]=u.useState(null),r=u.useRef(e),o=u.useCallback(s=>{const i=lt(s.target);i&&n(l=>l?(l.set(i,gt(i)),new Map(l)):null)},[]);return u.useEffect(()=>{const s=r.current;if(e!==s){i(s);const l=e.map(c=>{const d=lt(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,gt(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(s)};function i(l){l.forEach(c=>{const d=lt(c);d==null||d.removeEventListener("scroll",o)})}},[o,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>we(s,i),J):wn(e):J,[e,t])}function nn(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==J;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ve(e,n.current):J}function vs(e){u.useEffect(()=>{if(!Je)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function ms(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function Dn(e){return u.useMemo(()=>e?Ur(e):null,[e])}const rn=[];function xs(e,t){t===void 0&&(t=_e);const[n]=e,r=Dn(n?_(n):null),[o,s]=u.useState(rn);function i(){s(()=>e.length?e.map(c=>xn(c)?r:new wt(t(c),c)):rn)}const l=et({callback:i});return ae(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),o}function jn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ie(t)?t:e}function ys(e){let{measure:t}=e;const[n,r]=u.useState(null),o=u.useCallback(d=>{for(const{target:g}of d)if(Ie(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),s=et({callback:o}),i=u.useCallback(d=>{const g=jn(d);s==null||s.disconnect(),g&&(s==null||s.observe(g)),r(g?t(g):null)},[t,s]),[l,c]=Ye(i);return u.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ws=[{sensor:Dt,options:{}},{sensor:St,options:{}}],Ss={current:{}},Xe={draggable:{measure:Wt},droppable:{measure:Wt,strategy:Le.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:_e}};class Oe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Cs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Oe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:We},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xe,measureDroppableContainers:We,windowRect:null,measuringScheduled:!1},Nn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:We,draggableNodes:new Map,over:null,measureDroppableContainers:We},Be=u.createContext(Nn),Rn=u.createContext(Cs);function Ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Oe}}}function js(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.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 P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Oe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case P.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Oe(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case P.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Oe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Ns(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=u.useContext(Be),s=qe(r),i=qe(n==null?void 0:n.id);return u.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!xt(s)||document.activeElement===s.target)return;const l=o.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[c.current,d.current]){if(!g)continue;const f=xr(g);if(f){f.focus();break}}})}},[r,t,o,i,s]),null}function En(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Rs(e){return u.useMemo(()=>({draggable:{...Xe.draggable,...e==null?void 0:e.draggable},droppable:{...Xe.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xe.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Es(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=u.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ae(()=>{if(!i&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=gn(g,r);if(i||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=bn(d);b&&b.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const tt=u.createContext({...J,scaleX:1,scaleY:1});var fe;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fe||(fe={}));const Ts=u.memo(function(t){var n,r,o,s;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:g=ws,collisionDetection:f=zr,measuring:b,modifiers:p,...w}=t;const v=u.useReducer(js,void 0,Ds),[y,S]=v,[C,m]=jr(),[E,N]=u.useState(fe.Uninitialized),R=E===fe.Initialized,{draggable:{active:D,nodes:j,translate:k},droppable:{containers:O}}=y,A=D!=null?j.get(D):null,H=u.useRef({initial:null,translated:null}),B=u.useMemo(()=>{var z;return D!=null?{id:D,data:(z=A==null?void 0:A.data)!=null?z:Ss,rect:H}:null},[D,A]),$=u.useRef(null),[re,pe]=u.useState(null),[X,$e]=u.useState(null),se=Pe(w,Object.values(w)),be=Ze("DndDescribedBy",i),h=u.useMemo(()=>O.getEnabled(),[O]),x=Rs(b),{droppableRects:Y,measureDroppableContainers:Q,measuringScheduled:Nt}=us(h,{dragging:R,dependencies:[k.x,k.y],config:x.droppable}),W=ls(j,D),Rt=u.useMemo(()=>X?He(X):null,[X]),Et=_n(),Tt=ds(W,x.draggable.measure);Es({activeNode:D!=null?j.get(D):null,config:Et.layoutShiftCompensation,initialRect:Tt,measure:x.draggable.measure});const G=en(W,x.draggable.measure,Tt),nt=en(W?W.parentElement:null),he=u.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),kt=O.getNodeFor((n=he.current.over)==null?void 0:n.id),ge=ys({measure:x.dragOverlay.measure}),Fe=(r=ge.nodeRef.current)!=null?r:W,ve=R?(o=ge.rect)!=null?o:G:null,At=!!(ge.nodeRef.current&&ge.rect),Mt=gs(At?null:G),rt=Dn(Fe?_(Fe):null),ie=ps(R?kt??W:null),Ke=xs(ie),Ue=En(p,{transform:{x:k.x-Mt.x,y:k.y-Mt.y,scaleX:1,scaleY:1},activatorEvent:X,active:B,activeNodeRect:G,containerNodeRect:nt,draggingNodeRect:ve,over:he.current.over,overlayNodeRect:ge.rect,scrollableAncestors:ie,scrollableAncestorRects:Ke,windowRect:rt}),Ot=Rt?we(Rt,k):null,Pt=bs(ie),An=nn(Pt),Mn=nn(Pt,[G]),me=we(Ue,An),xe=ve?$r(ve,Ue):null,je=B&&xe?f({active:B,collisionRect:xe,droppableRects:Y,droppableContainers:h,pointerCoordinates:Ot}):null,Lt=Pr(je,"id"),[le,It]=u.useState(null),On=At?Ue:we(Ue,Mn),Pn=_r(On,(s=le==null?void 0:le.rect)!=null?s:null,G),st=u.useRef(null),zt=u.useCallback((z,F)=>{let{sensor:K,options:ce}=F;if($.current==null)return;const q=j.get($.current);if(!q)return;const U=z.nativeEvent,Z=new K({active:$.current,activeNode:q,event:U,options:ce,context:he,onAbort(I){if(!j.get(I))return;const{onDragAbort:ee}=se.current,oe={id:I};ee==null||ee(oe),C({type:"onDragAbort",event:oe})},onPending(I,ue,ee,oe){if(!j.get(I))return;const{onDragPending:Re}=se.current,de={id:I,constraint:ue,initialCoordinates:ee,offset:oe};Re==null||Re(de),C({type:"onDragPending",event:de})},onStart(I){const ue=$.current;if(ue==null)return;const ee=j.get(ue);if(!ee)return;const{onDragStart:oe}=se.current,Ne={activatorEvent:U,active:{id:ue,data:ee.data,rect:H}};Te.unstable_batchedUpdates(()=>{oe==null||oe(Ne),N(fe.Initializing),S({type:P.DragStart,initialCoordinates:I,active:ue}),C({type:"onDragStart",event:Ne}),pe(st.current),$e(U)})},onMove(I){S({type:P.DragMove,coordinates:I})},onEnd:ye(P.DragEnd),onCancel:ye(P.DragCancel)});st.current=Z;function ye(I){return async function(){const{active:ee,collisions:oe,over:Ne,scrollAdjustedTranslate:Re}=he.current;let de=null;if(ee&&Re){const{cancelDrop:Ee}=se.current;de={activatorEvent:U,active:ee,collisions:oe,delta:Re,over:Ne},I===P.DragEnd&&typeof Ee=="function"&&await Promise.resolve(Ee(de))&&(I=P.DragCancel)}$.current=null,Te.unstable_batchedUpdates(()=>{S({type:I}),N(fe.Uninitialized),It(null),pe(null),$e(null),st.current=null;const Ee=I===P.DragEnd?"onDragEnd":"onDragCancel";if(de){const ot=se.current[Ee];ot==null||ot(de),C({type:Ee,event:de})}})}}},[j]),Ln=u.useCallback((z,F)=>(K,ce)=>{const q=K.nativeEvent,U=j.get(ce);if($.current!==null||!U||q.dndKit||q.defaultPrevented)return;const Z={active:U};z(K,F.options,Z)===!0&&(q.dndKit={capturedBy:F.sensor},$.current=ce,zt(K,F))},[j,zt]),_t=cs(g,Ln);vs(g),ae(()=>{G&&E===fe.Initializing&&N(fe.Initialized)},[G,E]),u.useEffect(()=>{const{onDragMove:z}=se.current,{active:F,activatorEvent:K,collisions:ce,over:q}=he.current;if(!F||!K)return;const U={active:F,activatorEvent:K,collisions:ce,delta:{x:me.x,y:me.y},over:q};Te.unstable_batchedUpdates(()=>{z==null||z(U),C({type:"onDragMove",event:U})})},[me.x,me.y]),u.useEffect(()=>{const{active:z,activatorEvent:F,collisions:K,droppableContainers:ce,scrollAdjustedTranslate:q}=he.current;if(!z||$.current==null||!F||!q)return;const{onDragOver:U}=se.current,Z=ce.get(Lt),ye=Z&&Z.rect.current?{id:Z.id,rect:Z.rect.current,data:Z.data,disabled:Z.disabled}:null,I={active:z,activatorEvent:F,collisions:K,delta:{x:q.x,y:q.y},over:ye};Te.unstable_batchedUpdates(()=>{It(ye),U==null||U(I),C({type:"onDragOver",event:I})})},[Lt]),ae(()=>{he.current={activatorEvent:X,active:B,activeNode:W,collisionRect:xe,collisions:je,droppableRects:Y,draggableNodes:j,draggingNode:Fe,draggingNodeRect:ve,droppableContainers:O,over:le,scrollableAncestors:ie,scrollAdjustedTranslate:me},H.current={initial:ve,translated:xe}},[B,W,je,xe,j,Fe,ve,Y,O,le,ie,me]),os({...Et,delta:k,draggingRect:xe,pointerCoordinates:Ot,scrollableAncestors:ie,scrollableAncestorRects:Ke});const In=u.useMemo(()=>({active:B,activeNode:W,activeNodeRect:G,activatorEvent:X,collisions:je,containerNodeRect:nt,dragOverlay:ge,draggableNodes:j,droppableContainers:O,droppableRects:Y,over:le,measureDroppableContainers:Q,scrollableAncestors:ie,scrollableAncestorRects:Ke,measuringConfiguration:x,measuringScheduled:Nt,windowRect:rt}),[B,W,G,X,je,nt,ge,j,O,Y,le,Q,ie,Ke,x,Nt,rt]),zn=u.useMemo(()=>({activatorEvent:X,activators:_t,active:B,activeNodeRect:G,ariaDescribedById:{draggable:be},dispatch:S,draggableNodes:j,over:le,measureDroppableContainers:Q}),[X,_t,B,G,S,be,j,le,Q]);return M.createElement(hn.Provider,{value:m},M.createElement(Be.Provider,{value:zn},M.createElement(Rn.Provider,{value:In},M.createElement(tt.Provider,{value:Pn},d)),M.createElement(Ns,{disabled:(l==null?void 0:l.restoreFocus)===!1})),M.createElement(Er,{...l,hiddenTextDescribedById:be}));function _n(){const z=(re==null?void 0:re.autoScrollEnabled)===!1,F=typeof c=="object"?c.enabled===!1:c===!1,K=R&&!z&&!F;return typeof c=="object"?{...c,enabled:K}:{enabled:K}}}),ks=u.createContext(null),sn="button",As="Draggable";function Ms(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Ze(As),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:b}=u.useContext(Be),{role:p=sn,roleDescription:w="draggable",tabIndex:v=0}=o??{},y=(c==null?void 0:c.id)===t,S=u.useContext(y?tt:ks),[C,m]=Ye(),[E,N]=Ye(),R=ms(i,t),D=Pe(n);ae(()=>(f.set(t,{id:t,key:s,node:C,activatorNode:E,data:D}),()=>{const k=f.get(t);k&&k.key===s&&f.delete(t)}),[f,t]);const j=u.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===sn?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,p,v,y,w,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:j,isDragging:y,listeners:r?void 0:R,node:C,over:b,setNodeRef:m,setActivatorNodeRef:N,transform:S}}function Os(){return u.useContext(Rn)}const Ps="Droppable",Ls={timeout:25};function Is(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Ze(Ps),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=u.useContext(Be),g=u.useRef({disabled:n}),f=u.useRef(!1),b=u.useRef(null),p=u.useRef(null),{disabled:w,updateMeasurementsFor:v,timeout:y}={...Ls,...o},S=Pe(v??r),C=u.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),p.current=null},y)},[y]),m=et({callback:C,disabled:w||!i}),E=u.useCallback((j,k)=>{m&&(k&&(m.unobserve(k),f.current=!1),j&&m.observe(j))},[m]),[N,R]=Ye(E),D=Pe(t);return u.useEffect(()=>{!m||!N.current||(m.disconnect(),f.current=!1,m.observe(N.current))},[N,m]),u.useEffect(()=>(l({type:P.RegisterDroppable,element:{id:r,key:s,disabled:n,node:N,rect:b,data:D}}),()=>l({type:P.UnregisterDroppable,key:s,id:r})),[r]),u.useEffect(()=>{n!==g.current.disabled&&(l({type:P.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:i,rect:b,isOver:(c==null?void 0:c.id)===r,node:N,over:c,setNodeRef:R}}function zs(e){let{animation:t,children:n}=e;const[r,o]=u.useState(null),[s,i]=u.useState(null),l=qe(n);return!n&&!r&&l&&o(l),ae(()=>{if(!s)return;const c=r==null?void 0:r.key,d=r==null?void 0:r.props.id;if(c==null||d==null){o(null);return}Promise.resolve(t(d,s)).then(()=>{o(null)})},[t,r,s]),M.createElement(M.Fragment,null,n,r?u.cloneElement(r,{ref:i}):null)}const _s={x:0,y:0,scaleX:1,scaleY:1};function Bs(e){let{children:t}=e;return M.createElement(Be.Provider,{value:Nn},M.createElement(tt.Provider,{value:_s},t))}const $s={position:"fixed",touchAction:"none"},Fs=e=>xt(e)?"transform 250ms ease":void 0,Ks=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:s,className:i,rect:l,style:c,transform:d,transition:g=Fs}=e;if(!l)return null;const f=o?d:{...d,scaleX:1,scaleY:1},b={...$s,width:l.width,height:l.height,top:l.top,left:l.left,transform:Se.Transform.toString(f),transformOrigin:o&&r?Ar(r,l):void 0,transition:typeof g=="function"?g(r):g,...c};return M.createElement(n,{className:i,style:b,ref:t},s)}),Us=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[l,c]of Object.entries(s.active))c!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(s!=null&&s.dragOverlay)for(const[l,c]of Object.entries(s.dragOverlay))c!==void 0&&r.node.style.setProperty(l,c);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(o))n.node.style.setProperty(c,d);i!=null&&i.active&&n.node.classList.remove(i.active)}},Xs=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Se.Transform.toString(t)},{transform:Se.Transform.toString(n)}]},Ys={duration:250,easing:"ease",keyframes:Xs,sideEffects:Us({styles:{active:{opacity:"0"}}})};function qs(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Qe((s,i)=>{if(t===null)return;const l=n.get(s);if(!l)return;const c=l.node.current;if(!c)return;const d=jn(i);if(!d)return;const{transform:g}=_(i).getComputedStyle(i),f=pn(g);if(!f)return;const b=typeof t=="function"?t:Vs(t);return Sn(c,o.draggable.measure),b({active:{id:s,data:l.data,node:c,rect:o.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:i,rect:o.dragOverlay.measure(d)},droppableContainers:r,measuringConfiguration:o,transform:f})})}function Vs(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Ys,...e};return s=>{let{active:i,dragOverlay:l,transform:c,...d}=s;if(!t)return;const g={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},b={x:c.x-g.x,y:c.y-g.y,...f},p=o({...d,active:i,dragOverlay:l,transform:{initial:c,final:b}}),[w]=p,v=p[p.length-1];if(JSON.stringify(w)===JSON.stringify(v))return;const y=r==null?void 0:r({active:i,dragOverlay:l,...d}),S=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(C=>{S.onfinish=()=>{y==null||y(),C()}})}}let on=0;function Hs(e){return u.useMemo(()=>{if(e!=null)return on++,on},[e])}const Ws=M.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:s,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:g,active:f,activeNodeRect:b,containerNodeRect:p,draggableNodes:w,droppableContainers:v,dragOverlay:y,over:S,measuringConfiguration:C,scrollableAncestors:m,scrollableAncestorRects:E,windowRect:N}=Os(),R=u.useContext(tt),D=Hs(f==null?void 0:f.id),j=En(i,{activatorEvent:g,active:f,activeNodeRect:b,containerNodeRect:p,draggingNodeRect:y.rect,over:S,overlayNodeRect:y.rect,scrollableAncestors:m,scrollableAncestorRects:E,transform:R,windowRect:N}),k=jt(b),O=qs({config:r,draggableNodes:w,droppableContainers:v,measuringConfiguration:C}),A=k?y.setRef:void 0;return M.createElement(Bs,null,M.createElement(zs,{animation:O},f&&D?M.createElement(Ks,{key:D,id:f.id,ref:A,as:l,activatorEvent:g,adjustScale:t,className:c,transition:s,rect:k,style:{zIndex:d,...o},transform:j},n):null))}),Tn=[{status:"todo",label:"Todo",color:"rgb(var(--muted-foreground))"},{status:"doing",label:"In Progress",color:"rgb(var(--progress))"},{status:"review",label:"Review",color:"rgb(var(--warning))"},{status:"blocked",label:"Blocked",color:"rgb(var(--error))"},{status:"done",label:"Done",color:"rgb(var(--success))"}];Tn.map(e=>e.status);function ke(e){switch(e){case"todo":case"doing":case"review":case"blocked":case"done":return e;case"queued":return"todo";case"changes_requested":return"review";case"paused":return"blocked";case"cancelled":return null;default:return null}}function Gs(e){const t=ke(e);return t===null||t===e?null:e.replace(/_/g," ")}function kn({task:e,onDelete:t,onClick:n,isDragOverlay:r}){var S,C;const{attributes:o,listeners:s,setNodeRef:i,setActivatorNodeRef:l,transform:c,isDragging:d}=Ms({id:e.id,data:{type:"task",task:e}}),g=u.useRef(null),f={transform:Se.Translate.toString(c),opacity:d?.3:1},b=Gs(e.status),p=s==null?void 0:s.onPointerDown,w=m=>{g.current={x:m.clientX,y:m.clientY},p==null||p(m)},v=m=>{if(!n||!g.current)return;const E=Math.abs(m.clientX-g.current.x),N=Math.abs(m.clientY-g.current.y);g.current=null,E<5&&N<5&&n(e)},y=r?{}:{onPointerDown:w};return a.jsx("div",{ref:r?void 0:i,style:r?void 0:f,"data-testid":"kanban-card","data-task-id":e.id,"data-task-status":e.status,...y,onPointerUp:r?void 0:v,className:`
|
|
16
16
|
group relative bg-background border-b border-border/65 rounded-md
|
|
17
17
|
cursor-grab active:cursor-grabbing
|
|
18
18
|
hover:bg-surface-high
|
|
19
19
|
transition-colors duration-150
|
|
20
20
|
${r?"bg-surface shadow-lg":""}
|
|
21
|
-
`,children:a.jsxs("div",{className:"pl-4 pr-3 py-4",children:[a.jsx("button",{type:"button","aria-label":`Open task: ${e.title}`,onClick:
|
|
21
|
+
`,children:a.jsxs("div",{className:"pl-4 pr-3 py-4",children:[a.jsx("button",{type:"button","aria-label":`Open task: ${e.title}`,onClick:m=>{m.detail===0&&(n==null||n(e))},className:"w-full text-left font-body text-sm text-on-surface line-clamp-2 leading-relaxed hover:text-primary",children:e.title}),(e.git_branch||e.github_issue||e.github_pr)&&a.jsxs("p",{"data-testid":"task-git-badge",className:"text-xs text-primary truncate",children:[e.git_branch,e.github_issue&&` · Issue #${e.github_issue.split("/").pop()}`,e.github_pr&&` · PR #${e.github_pr.split("/").pop()}`]}),a.jsxs("div",{className:"flex items-center justify-between mt-2 gap-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 min-w-0",children:[a.jsx(cn,{priority:e.priority}),a.jsx("span",{className:`flex-shrink-0 w-4 h-4 rounded-lg bg-surface-highest
|
|
22
22
|
text-[8px] font-label font-bold text-outline
|
|
23
23
|
flex items-center justify-center`,children:((S=e.author)==null?void 0:S[0])??"?"}),b&&a.jsx("span",{"data-testid":"kanban-card-status",className:`text-xs font-label text-on-surface-variant
|
|
24
|
-
px-1.5 py-0.5 rounded flex-shrink-0`,children:b}),(C=e.tags)==null?void 0:C.slice(0,2).map(
|
|
25
|
-
px-1.5 py-0.5 rounded-lg truncate max-w-[60px]`,children:
|
|
26
|
-
transition-opacity min-h-11 min-w-11 md:min-h-8 md:min-w-8 inline-flex items-center justify-center`,children:a.jsx(
|
|
24
|
+
px-1.5 py-0.5 rounded flex-shrink-0`,children:b}),(C=e.tags)==null?void 0:C.slice(0,2).map(m=>a.jsx("span",{className:`text-xs font-label text-outline
|
|
25
|
+
px-1.5 py-0.5 rounded-lg truncate max-w-[60px]`,children:m},m))]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[!r&&a.jsx("button",{type:"button",ref:l,...o,onKeyDown:m=>{var E;return(E=s==null?void 0:s.onKeyDown)==null?void 0:E.call(s,m)},"aria-label":`Move task: ${e.title}`,title:"Move task with Space, arrow keys, then Space to drop",onPointerUp:m=>m.stopPropagation(),onClick:m=>m.stopPropagation(),className:"inline-flex min-h-11 min-w-11 md:min-h-8 md:min-w-8 items-center justify-center rounded text-outline hover:text-on-surface focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:a.jsx(hr,{size:14})}),e.comments_count!=null&&e.comments_count>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-xs font-label text-outline",title:`${e.comments_count} comment${e.comments_count===1?"":"s"}`,children:[a.jsx(ft,{size:9}),e.comments_count]}),a.jsx("span",{className:"text-xs font-label text-outline",children:Js(e.updated_at)}),a.jsx("button",{type:"button","aria-label":`Delete task: ${e.title}`,onPointerDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),t(e.id)},className:`opacity-100 md:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 text-outline hover:text-error
|
|
26
|
+
transition-opacity min-h-11 min-w-11 md:min-h-8 md:min-w-8 inline-flex items-center justify-center`,children:a.jsx(un,{size:14})})]})]})]})})}function Js(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function Qs({activeTask:e}){return a.jsx(Ws,{dropAnimation:null,children:e?a.jsx("div",{className:"w-[260px]",children:a.jsx(kn,{task:e,onDelete:()=>{},isDragOverlay:!0})}):null})}function Zs({status:e,label:t,color:n,tasks:r,onDeleteTask:o,onCardClick:s,isValidDrop:i}){const{setNodeRef:l,isOver:c}=Is({id:e,data:{type:"column",status:e}});let d="border-transparent";return i===!0&&c?d="border-outline bg-surface-high":i===!0?d="border-border":i===!1&&(d="border-error border-dashed"),a.jsxs("div",{className:`
|
|
27
27
|
flex flex-col w-full md:min-w-[260px] md:max-w-[300px] md:flex-1
|
|
28
28
|
bg-background border rounded-lg
|
|
29
29
|
transition-all duration-200
|
|
30
30
|
${d}
|
|
31
31
|
`,children:[a.jsx("div",{className:"flex-shrink-0 px-3 py-2.5 border-b border-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:n}}),a.jsx("span",{className:"font-label text-sm font-medium text-on-surface-variant",children:t})]}),a.jsx("span",{className:`text-[11px] font-label px-1.5 py-0.5 rounded-sm
|
|
32
|
-
text-outline`,children:r.length})]})}),a.jsxs("div",{ref:l,"data-testid":"kanban-column","data-column-status":e,"data-drop-target":c,className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px]",children:[r.map(g=>a.jsx(Tn,{task:g,onDelete:o,onClick:s},g.id)),r.length===0&&a.jsx("div",{className:"flex items-center justify-center h-16 text-outline text-sm font-label",children:"Empty"})]})]})}function eo({tasks:e,onUpdateStatus:t,onDeleteTask:n,onCardClick:r}){const[o,s]=u.useState(null),i=kr(Vt(Dt,{activationConstraint:{distance:5}}),Vt(St)),l=u.useMemo(()=>{const f={todo:[],doing:[],review:[],blocked:[],done:[]};for(const b of e){const p=Te(b.status);p&&f[p].push(b)}return f},[e]);function c(f){var p;const b=(p=f.active.data.current)==null?void 0:p.task;b&&s(b)}function d(f){var y,S,C;const{active:b,over:p}=f;if(s(null),!p)return;const w=(y=b.data.current)==null?void 0:y.task;if(!w)return;let v;if(((S=p.data.current)==null?void 0:S.type)==="column")v=p.data.current.status;else if(((C=p.data.current)==null?void 0:C.type)==="task"){const x=p.data.current.task,E=Te(x.status);E&&(v=E)}v&&Te(w.status)!==v&&t(w.id,v)}function g(f){return!o||Te(o.status)===f?null:!0}return a.jsxs(ks,{sensors:i,collisionDetection:Lr,onDragStart:c,onDragEnd:d,children:[a.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-4 pb-4 md:flex-row md:overflow-x-auto",children:kn.map(f=>a.jsx(Zs,{status:f.status,label:f.label,color:f.color,tasks:l[f.status],onDeleteTask:n,onCardClick:r,isValidDrop:g(f.status)},f.status))}),a.jsx(Qs,{activeTask:o})]})}function to({projectId:e}){var i,l,c,d,g,f,b;const[t,n]=u.useState("relevant"),[r,o]=u.useState(!1),s=Bn({queryKey:["github",e,t],queryFn:()=>ht.git.githubItems(t,e),enabled:r,staleTime:3e4,retry:!1});return a.jsxs("section",{className:"border-b border-surface-highest p-3 text-xs space-y-2",children:[a.jsx("button",{type:"button","data-testid":"github-board-toggle",onClick:()=>o(!r),className:"text-primary",children:r?"Hide GitHub":"GitHub issues / PRs"}),r&&a.jsxs("div",{"data-testid":"github-board",className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[a.jsxs("label",{children:["Show"," ",a.jsxs("select",{"data-testid":"github-filter",value:t,onChange:p=>n(p.target.value),className:"bg-surface-highest p-1",children:[a.jsx("option",{value:"relevant",children:"My work (branches + assignee + linked)"}),a.jsx("option",{value:"branches",children:"Current branches / worktrees + linked"}),a.jsx("option",{value:"assigned",children:"Assigned to me"}),a.jsx("option",{value:"all",children:"All open items in known repositories"})]})]}),a.jsx("button",{type:"button","data-testid":"github-refresh",onClick:()=>void s.refetch(),children:"Refresh"}),((i=s.data)==null?void 0:i.login)&&a.jsxs("span",{"data-testid":"github-auth",children:[s.data.login," · ",s.data.auth]})]}),s.isFetching&&a.jsx("p",{children:"Loading GitHub…"}),s.error&&a.jsx("p",{role:"alert",children:s.error.message}),((l=s.data)==null?void 0:l.auth)==="none"&&a.jsx("p",{"data-testid":"github-no-auth",children:"Sign in with gh auth login, or configure github.token / ORC_GITHUB_TOKEN on the API machine."}),((c=s.data)==null?void 0:c.auth)!=="none"&&((d=s.data)==null?void 0:d.items.length)===0&&a.jsx("p",{"data-testid":"github-empty",children:"No matching open issues or PRs. Add a project repository folder, launch a terminal there, or choose a broader filter."}),((g=s.data)==null?void 0:g.truncated)&&a.jsx("p",{role:"alert",children:"Results limited by repository, pagination or request time budget. Narrow the project scope."}),(f=s.data)==null?void 0:f.errors.map(p=>a.jsxs("p",{role:"alert",children:[p.repo,": ",p.error]},p.repo)),a.jsx("div",{className:"grid gap-2 md:grid-cols-2 xl:grid-cols-3 max-h-80 overflow-auto",children:(b=s.data)==null?void 0:b.items.map(p=>a.jsx(no,{item:p,projectId:e},p.url))})]})]})}function no({item:e,projectId:t}){var l;const[n,r]=u.useState(""),o=$n(),s=un(t?{project_id:t}:void 0),i=Fn({mutationFn:async c=>{const d={[e.kind==="issue"?"github_issue":"github_pr"]:e.url,...e.branch?{git_branch:e.branch}:{}};return c?ht.tasks.create({title:e.title,project_id:t,body:`${e.kind==="pr"?"PR":"Issue"} #${e.number}: ${e.url}`,...d}):ht.tasks.update(n,d)},onSuccess:()=>{o.invalidateQueries({queryKey:["tasks"]}),o.invalidateQueries({queryKey:["task"]}),o.invalidateQueries({queryKey:["github"]})}});return a.jsxs("article",{"data-testid":"github-item","data-url":e.url,className:"bg-surface-high p-3 border border-surface-highest rounded-lg space-y-2",children:[a.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"text-primary",children:[e.kind==="pr"?"PR":"Issue"," #",e.number," · ",e.repo]}),a.jsx("p",{children:e.title}),e.branch&&a.jsx("p",{children:e.branch}),a.jsx("div",{className:"flex gap-2",children:e.task_ids.map(c=>a.jsx(Un,{"data-testid":"github-linked-task",to:`/tasks/${c}`,className:"text-primary",children:"Open task"},c))}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("select",{"data-testid":"github-link-task","aria-label":`Link ${e.kind} ${e.number} to task`,value:n,onChange:c=>r(c.target.value),className:"bg-surface-highest p-1 max-w-44",children:[a.jsx("option",{value:"",children:"Choose task"}),(l=s.data)==null?void 0:l.map(c=>a.jsx("option",{value:c.id,children:c.title},c.id))]}),a.jsx("button",{type:"button","data-testid":"github-link-save",disabled:!n||i.isPending,onClick:()=>i.mutate(!1),children:"Link task"}),!e.task_ids.length&&a.jsx("button",{type:"button","data-testid":"github-create-task",disabled:i.isPending,onClick:()=>i.mutate(!0),className:"text-primary",children:"Create task"})]}),i.error&&a.jsx("p",{role:"alert",children:i.error.message})]})}const ro=["low","normal","high","critical"],dt=[{value:"all",label:"All"},{value:"todo",label:"Todo"},{value:"doing",label:"Doing"},{value:"review",label:"Review"},{value:"blocked",label:"Blocked"},{value:"done",label:"Done"}],so=["todo","doing","review","blocked","done"],oo=new Set(["all","todo","queued","doing","review","changes_requested","blocked","done","cancelled","paused"]),ao=new Set(["all","low","normal","high","critical"]);function uo({projectId:e}){var be;const t=ur(e),[n,r]=Kn(),o=u.useRef(n);o.current=n;const{selectedId:s,openDetail:i,closeDetail:l}=Xn("/tasks","taskId"),c=n.get("status"),d=c&&oo.has(c)?c:"all",g=dt.some(({value:h})=>h===d)?dt:[...dt,{value:d,label:d.charAt(0).toUpperCase()+d.slice(1).replace(/_/g," ")}],f=n.get("priority"),b=f&&ao.has(f)?f:"all",p=n.get("q")??"",w=n.get("view")==="table"?"table":"board",v=u.useCallback((h,m,Y)=>{const Q=new URLSearchParams(o.current);m===null||m===""||m===Y?Q.delete(h):Q.set(h,m),Q.toString()!==o.current.toString()&&(o.current=Q,r(Q,{replace:h==="q"}))},[r]),y=h=>v("status",h,"all"),S=h=>v("priority",h,"all"),C=h=>v("q",h||null),x=h=>v("view",h,"board"),[E,N]=u.useState(!1),[R,D]=u.useState(null),j=t==="all"||t==="unassigned"?void 0:t,{data:T,isLoading:O,error:A,refetch:H}=un(j?{project_id:j}:void 0),B=Yn(),$=qn(),re=u.useMemo(()=>{const h=T??[];return t==="unassigned"?h.filter(m=>!m.project_id):h},[T,t]),pe=u.useMemo(()=>{let h=re;if(d!=="all"&&(h=h.filter(m=>m.status===d)),b!=="all"&&(h=h.filter(m=>m.priority===b)),p.trim()){const m=p.trim().toLowerCase();h=h.filter(Y=>Y.title.toLowerCase().includes(m))}return h},[re,d,b,p]),X=u.useMemo(()=>re.reduce((h,m)=>(h[m.status]=(h[m.status]??0)+1,h),{}),[re]),$e=()=>{R&&$.mutate(R.id,{onSuccess:()=>D(null)})},se=(h,m)=>!h||m==="done"||m==="cancelled"?!1:new Date(h)<new Date;return A?a.jsxs("div",{children:[a.jsx(Bt,{title:"Tasks"}),a.jsx(Vn,{message:A.message,onRetry:()=>H()})]}):a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[a.jsx(Bt,{title:"Tasks",meta:`${re.length} total`,action:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex rounded-md overflow-hidden",children:[a.jsx("button",{type:"button","data-testid":"tasks-view-board",title:"Board view","aria-label":"Board view","aria-pressed":w==="board",onClick:()=>x("board"),className:`p-3 transition-colors ${w==="board"?"bg-surface-highest text-on-surface":"text-outline hover:text-on-surface-variant"}`,children:a.jsx(pr,{size:14})}),a.jsx("button",{type:"button","data-testid":"tasks-view-table",title:"Table view","aria-label":"Table view","aria-pressed":w==="table",onClick:()=>x("table"),className:`p-3 transition-colors ${w==="table"?"bg-surface-highest text-on-surface":"text-outline hover:text-on-surface-variant"}`,children:a.jsx(dr,{size:14})})]}),a.jsxs(Hn,{"data-testid":"new-task-button",size:"sm",onClick:()=>N(!0),className:"font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90",children:[a.jsx(Wn,{size:14,className:"mr-1"}),"New task"]})]})}),a.jsx(to,{projectId:j}),(B.error||$.error)&&a.jsx("p",{role:"alert",className:"mb-4 text-sm text-error",children:(be=B.error??$.error)==null?void 0:be.message}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx(Gn,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-outline"}),a.jsx(Jn,{"aria-label":"Search tasks",value:p,onChange:h=>C(h.target.value),placeholder:"Search tasks...",className:"bg-background border-control-border text-on-surface font-body text-xs pl-8 min-h-11"})]}),a.jsxs($t,{value:b,onValueChange:h=>S(h),children:[a.jsx(Ft,{"aria-label":"Filter by priority",className:"bg-background border-control-border text-on-surface font-label text-xs w-36 min-h-11",children:a.jsx(Ut,{placeholder:"Priority"})}),a.jsxs(Kt,{className:"bg-surface border-border",children:[a.jsx(at,{value:"all",className:"font-label text-xs",children:"All Priorities"}),ro.map(h=>a.jsx(at,{value:h,className:"font-label text-xs",children:h},h))]})]})]}),w==="board"?O?a.jsx("div",{role:"status","aria-label":"Loading tasks",className:"space-y-2",children:Array.from({length:5}).map((h,m)=>a.jsx(Xt,{className:"h-10 w-full bg-surface-highest"},m))}):a.jsx(eo,{tasks:pe,onUpdateStatus:(h,m)=>B.mutate({id:h,status:m}),onDeleteTask:h=>{const m=(T??[]).find(Y=>Y.id===h);m&&D(m)},onCardClick:h=>i(h.id)}):a.jsxs(Qn,{value:d,onValueChange:h=>y(h),className:"mb-4",children:[a.jsx(Zn,{className:"bg-background gap-1 h-auto p-0 flex-wrap justify-start",children:g.map(({value:h,label:m})=>a.jsxs(er,{value:h,className:`font-label text-sm px-4 py-2 rounded-md
|
|
32
|
+
text-outline`,children:r.length})]})}),a.jsxs("div",{ref:l,"data-testid":"kanban-column","data-column-status":e,"data-drop-target":c,className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px]",children:[r.map(g=>a.jsx(kn,{task:g,onDelete:o,onClick:s},g.id)),r.length===0&&a.jsx("div",{className:"flex items-center justify-center h-16 text-outline text-sm font-label",children:"Empty"})]})]})}function eo({tasks:e,onUpdateStatus:t,onDeleteTask:n,onCardClick:r}){const[o,s]=u.useState(null),i=Tr(Vt(Dt,{activationConstraint:{distance:5}}),Vt(St)),l=u.useMemo(()=>{const f={todo:[],doing:[],review:[],blocked:[],done:[]};for(const b of e){const p=ke(b.status);p&&f[p].push(b)}return f},[e]);function c(f){var p;const b=(p=f.active.data.current)==null?void 0:p.task;b&&s(b)}function d(f){var y,S,C;const{active:b,over:p}=f;if(s(null),!p)return;const w=(y=b.data.current)==null?void 0:y.task;if(!w)return;let v;if(((S=p.data.current)==null?void 0:S.type)==="column")v=p.data.current.status;else if(((C=p.data.current)==null?void 0:C.type)==="task"){const m=p.data.current.task,E=ke(m.status);E&&(v=E)}v&&ke(w.status)!==v&&t(w.id,v)}function g(f){return!o||ke(o.status)===f?null:!0}return a.jsxs(Ts,{sensors:i,collisionDetection:Lr,onDragStart:c,onDragEnd:d,children:[a.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-4 pb-4 md:flex-row md:overflow-x-auto",children:Tn.map(f=>a.jsx(Zs,{status:f.status,label:f.label,color:f.color,tasks:l[f.status],onDeleteTask:n,onCardClick:r,isValidDrop:g(f.status)},f.status))}),a.jsx(Qs,{activeTask:o})]})}function to({projectId:e}){var i,l,c,d,g,f,b;const[t,n]=u.useState("relevant"),[r,o]=u.useState(!1),s=Bn({queryKey:["github",e,t],queryFn:()=>ht.git.githubItems(t,e),enabled:r,staleTime:3e4,retry:!1});return a.jsxs("section",{className:"border-b border-surface-highest p-3 text-xs space-y-2",children:[a.jsx("button",{type:"button","data-testid":"github-board-toggle",onClick:()=>o(!r),className:"text-primary",children:r?"Hide GitHub":"GitHub issues / PRs"}),r&&a.jsxs("div",{"data-testid":"github-board",className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[a.jsxs("label",{children:["Show"," ",a.jsxs("select",{"data-testid":"github-filter",value:t,onChange:p=>n(p.target.value),className:"bg-surface-highest p-1",children:[a.jsx("option",{value:"relevant",children:"My work (branches + assignee + linked)"}),a.jsx("option",{value:"branches",children:"Current branches / worktrees + linked"}),a.jsx("option",{value:"assigned",children:"Assigned to me"}),a.jsx("option",{value:"all",children:"All open items in known repositories"})]})]}),a.jsx("button",{type:"button","data-testid":"github-refresh",onClick:()=>void s.refetch(),children:"Refresh"}),((i=s.data)==null?void 0:i.login)&&a.jsxs("span",{"data-testid":"github-auth",children:[s.data.login," · ",s.data.auth]})]}),s.isFetching&&a.jsx("p",{children:"Loading GitHub…"}),s.error&&a.jsx("p",{role:"alert",children:s.error.message}),((l=s.data)==null?void 0:l.auth)==="none"&&a.jsx("p",{"data-testid":"github-no-auth",children:"Sign in with gh auth login, or configure github.token / ORC_GITHUB_TOKEN on the API machine."}),((c=s.data)==null?void 0:c.auth)!=="none"&&((d=s.data)==null?void 0:d.items.length)===0&&a.jsx("p",{"data-testid":"github-empty",children:"No matching open issues or PRs. Add a project repository folder, launch a terminal there, or choose a broader filter."}),((g=s.data)==null?void 0:g.truncated)&&a.jsx("p",{role:"alert",children:"Results limited by repository, pagination or request time budget. Narrow the project scope."}),(f=s.data)==null?void 0:f.errors.map(p=>a.jsxs("p",{role:"alert",children:[p.repo,": ",p.error]},p.repo)),a.jsx("div",{className:"grid gap-2 md:grid-cols-2 xl:grid-cols-3 max-h-80 overflow-auto",children:(b=s.data)==null?void 0:b.items.map(p=>a.jsx(no,{item:p,projectId:e},p.url))})]})]})}function no({item:e,projectId:t}){var l;const[n,r]=u.useState(""),o=$n(),s=ln(t?{project_id:t}:void 0),i=Fn({mutationFn:async c=>{const d={[e.kind==="issue"?"github_issue":"github_pr"]:e.url,...e.branch?{git_branch:e.branch}:{}};return c?ht.tasks.create({title:e.title,project_id:t,body:`${e.kind==="pr"?"PR":"Issue"} #${e.number}: ${e.url}`,...d}):ht.tasks.update(n,d)},onSuccess:()=>{o.invalidateQueries({queryKey:["tasks"]}),o.invalidateQueries({queryKey:["task"]}),o.invalidateQueries({queryKey:["github"]})}});return a.jsxs("article",{"data-testid":"github-item","data-url":e.url,className:"bg-surface-high p-3 border border-surface-highest rounded-lg space-y-2",children:[a.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"text-primary",children:[e.kind==="pr"?"PR":"Issue"," #",e.number," · ",e.repo]}),a.jsx("p",{children:e.title}),e.branch&&a.jsx("p",{children:e.branch}),a.jsx("div",{className:"flex gap-2",children:e.task_ids.map(c=>a.jsx(Kn,{"data-testid":"github-linked-task",to:`/tasks/${c}`,className:"text-primary",children:"Open task"},c))}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("select",{"data-testid":"github-link-task","aria-label":`Link ${e.kind} ${e.number} to task`,value:n,onChange:c=>r(c.target.value),className:"bg-surface-highest p-1 max-w-44",children:[a.jsx("option",{value:"",children:"Choose task"}),(l=s.data)==null?void 0:l.map(c=>a.jsx("option",{value:c.id,children:c.title},c.id))]}),a.jsx("button",{type:"button","data-testid":"github-link-save",disabled:!n||i.isPending,onClick:()=>i.mutate(!1),children:"Link task"}),!e.task_ids.length&&a.jsx("button",{type:"button","data-testid":"github-create-task",disabled:i.isPending,onClick:()=>i.mutate(!0),className:"text-primary",children:"Create task"})]}),i.error&&a.jsx("p",{role:"alert",children:i.error.message})]})}const ro=["low","normal","high","critical"],dt=[{value:"all",label:"All"},{value:"todo",label:"Todo"},{value:"doing",label:"Doing"},{value:"review",label:"Review"},{value:"blocked",label:"Blocked"},{value:"done",label:"Done"}],so=["todo","doing","review","blocked","done"],oo=new Set(["all","todo","queued","doing","review","changes_requested","blocked","done","cancelled","paused"]),ao=new Set(["all","low","normal","high","critical"]);function Do({projectId:e}){var be;const t=ur(e),[n,r]=Un(),o=u.useRef(n);o.current=n;const{selectedId:s,openDetail:i,closeDetail:l}=cr("/tasks","taskId"),c=n.get("status"),d=c&&oo.has(c)?c:"all",g=dt.some(({value:h})=>h===d)?dt:[...dt,{value:d,label:d.charAt(0).toUpperCase()+d.slice(1).replace(/_/g," ")}],f=n.get("priority"),b=f&&ao.has(f)?f:"all",p=n.get("q")??"",w=n.get("view")==="table"?"table":"board",v=u.useCallback((h,x,Y)=>{const Q=new URLSearchParams(o.current);x===null||x===""||x===Y?Q.delete(h):Q.set(h,x),Q.toString()!==o.current.toString()&&(o.current=Q,r(Q,{replace:h==="q"}))},[r]),y=h=>v("status",h,"all"),S=h=>v("priority",h,"all"),C=h=>v("q",h||null),m=h=>v("view",h,"board"),[E,N]=u.useState(!1),[R,D]=u.useState(null),j=t==="all"||t==="unassigned"?void 0:t,{data:k,isLoading:O,error:A,refetch:H}=ln(j?{project_id:j}:void 0),B=Xn(),$=Yn(),re=u.useMemo(()=>{const h=k??[];return t==="unassigned"?h.filter(x=>!x.project_id):h},[k,t]),pe=u.useMemo(()=>{let h=re;if(d!=="all"&&(h=h.filter(x=>x.status===d)),b!=="all"&&(h=h.filter(x=>x.priority===b)),p.trim()){const x=p.trim().toLowerCase();h=h.filter(Y=>Y.title.toLowerCase().includes(x))}return h},[re,d,b,p]),X=u.useMemo(()=>re.reduce((h,x)=>(h[x.status]=(h[x.status]??0)+1,h),{}),[re]),$e=()=>{R&&$.mutate(R.id,{onSuccess:()=>D(null)})},se=(h,x)=>!h||x==="done"||x==="cancelled"?!1:new Date(h)<new Date;return A?a.jsxs("div",{children:[a.jsx(Yt,{title:"Tasks"}),a.jsx(Zn,{message:A.message,onRetry:()=>H()})]}):a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[a.jsx(Yt,{title:"Tasks",meta:`${re.length} total`,action:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex rounded-md overflow-hidden",children:[a.jsx("button",{type:"button","data-testid":"tasks-view-board",title:"Board view","aria-label":"Board view","aria-pressed":w==="board",onClick:()=>m("board"),className:`p-3 transition-colors ${w==="board"?"bg-surface-highest text-on-surface":"text-outline hover:text-on-surface-variant"}`,children:a.jsx(pr,{size:14})}),a.jsx("button",{type:"button","data-testid":"tasks-view-table",title:"Table view","aria-label":"Table view","aria-pressed":w==="table",onClick:()=>m("table"),className:`p-3 transition-colors ${w==="table"?"bg-surface-highest text-on-surface":"text-outline hover:text-on-surface-variant"}`,children:a.jsx(dr,{size:14})})]}),a.jsxs(qn,{"data-testid":"new-task-button",size:"sm",onClick:()=>N(!0),className:"font-label text-xs bg-primary text-primary-foreground hover:bg-primary/90",children:[a.jsx(Vn,{size:14,className:"mr-1"}),"New task"]})]})}),a.jsx(to,{projectId:j}),(B.error||$.error)&&a.jsx("p",{role:"alert",className:"mb-4 text-sm text-error",children:(be=B.error??$.error)==null?void 0:be.message}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx(Hn,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-outline"}),a.jsx(Wn,{"aria-label":"Search tasks",value:p,onChange:h=>C(h.target.value),placeholder:"Search tasks...",className:"bg-background border-control-border text-on-surface font-body text-xs pl-8 min-h-11"})]}),a.jsxs(Bt,{value:b,onValueChange:h=>S(h),children:[a.jsx($t,{"aria-label":"Filter by priority",className:"bg-background border-control-border text-on-surface font-label text-xs w-36 min-h-11",children:a.jsx(Ft,{placeholder:"Priority"})}),a.jsxs(Kt,{className:"bg-surface border-border",children:[a.jsx(at,{value:"all",className:"font-label text-xs",children:"All Priorities"}),ro.map(h=>a.jsx(at,{value:h,className:"font-label text-xs",children:h},h))]})]})]}),w==="board"?O?a.jsx("div",{role:"status","aria-label":"Loading tasks",className:"space-y-2",children:Array.from({length:5}).map((h,x)=>a.jsx(Ut,{className:"h-10 w-full bg-surface-highest"},x))}):a.jsx(eo,{tasks:pe,onUpdateStatus:(h,x)=>B.mutate({id:h,status:x}),onDeleteTask:h=>{const x=(k??[]).find(Y=>Y.id===h);x&&D(x)},onCardClick:h=>i(h.id)}):a.jsxs(or,{value:d,onValueChange:h=>y(h),className:"mb-4",children:[a.jsx(ar,{className:"bg-background gap-1 h-auto p-0 flex-wrap justify-start",children:g.map(({value:h,label:x})=>a.jsxs(ir,{value:h,className:`font-label text-sm px-4 py-2 rounded-md
|
|
33
33
|
data-[state=active]:bg-surface-highest data-[state=active]:text-on-surface data-[state=active]:shadow-none
|
|
34
|
-
text-outline hover:text-on-surface-variant`,children:[
|
|
34
|
+
text-outline hover:text-on-surface-variant`,children:[x,h!=="all"&&X[h]!=null&&a.jsx("span",{className:"ml-1.5 text-xs text-outline px-1.5 py-0.5",children:X[h]}),h==="all"&&a.jsx("span",{className:"ml-1.5 text-xs text-outline px-1.5 py-0.5",children:re.length})]},h))}),a.jsx(lr,{value:d,children:O?a.jsx("div",{role:"status","aria-label":"Loading tasks",className:"space-y-2",children:Array.from({length:5}).map((h,x)=>a.jsx(Ut,{className:"h-10 w-full bg-surface-highest"},x))}):pe.length===0?a.jsx(Qn,{message:"No tasks"}):a.jsx("div",{className:"overflow-hidden",children:a.jsxs(nr,{children:[a.jsx(rr,{children:a.jsxs(Xt,{className:"border-b border-border hover:bg-transparent",children:[a.jsx(te,{className:"font-label text-xs text-outline w-16",children:"ID"}),a.jsx(te,{className:"font-label text-xs text-outline",children:"Title"}),a.jsx(te,{className:"font-label text-xs text-outline w-40",children:"Status"}),a.jsx(te,{className:"font-label text-xs text-outline w-28",children:"Priority"}),a.jsx(te,{className:"font-label text-xs text-outline w-24",children:"Tags"}),a.jsx(te,{className:"font-label text-xs text-outline w-16",title:"Comments",children:a.jsx(ft,{size:12,className:"inline"})}),a.jsx(te,{className:"font-label text-xs text-outline w-24",children:"Due"}),a.jsx(te,{className:"font-label text-xs text-outline w-24",children:"Author"}),a.jsx(te,{className:"font-label text-xs text-outline w-24",children:"Updated"}),a.jsx(te,{className:"w-10"})]})}),a.jsx(sr,{children:pe.map(h=>a.jsxs(Xt,{"data-testid":"task-row","data-task-id":h.id,"data-task-title":h.title,className:"border-b border-border/65 hover:bg-surface-high cursor-pointer",onClick:()=>i(h.id),children:[a.jsx(ne,{className:"font-label text-xs text-outline",children:h.id.slice(-6)}),a.jsx(ne,{className:"font-body text-xs text-on-surface max-w-xs truncate",children:a.jsx("button",{type:"button",className:"text-left font-medium hover:text-primary",onClick:x=>{x.stopPropagation(),i(h.id)},children:h.title})}),a.jsx(ne,{children:a.jsx("div",{onClick:x=>x.stopPropagation(),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&x.stopPropagation()},children:a.jsxs(Bt,{value:h.status,onValueChange:x=>B.mutate({id:h.id,status:x}),children:[a.jsx($t,{"aria-label":`Status for ${h.title}`,className:"min-h-10 w-auto border-0 bg-transparent p-1 gap-1",children:a.jsx(Ft,{children:a.jsx(er,{status:h.status})})}),a.jsx(Kt,{className:"bg-surface border-border",children:so.map(x=>a.jsx(at,{value:x,className:"font-label text-xs",children:x.replace(/_/g," ")},x))})]})})}),a.jsx(ne,{children:a.jsx(cn,{priority:h.priority})}),a.jsx(ne,{children:a.jsxs("div",{className:"flex flex-wrap gap-0.5",children:[h.tags&&h.tags.length>0?h.tags.slice(0,2).map(x=>a.jsx("span",{className:"px-1.5 py-0.5 text-xs font-label text-outline",children:x},x)):a.jsx("span",{className:"text-outline text-xs",children:"-"}),h.tags&&h.tags.length>2&&a.jsxs("span",{className:"text-outline text-xs",children:["+",h.tags.length-2]})]})}),a.jsx(ne,{className:"font-label text-xs text-outline","data-testid":"task-comments-count",children:h.comments_count&&h.comments_count>0?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(ft,{size:10}),h.comments_count]}):a.jsx("span",{className:"text-outline",children:"-"})}),a.jsx(ne,{className:`font-label text-xs ${se(h.due_at,h.status)?"text-error":"text-outline"}`,children:h.due_at?new Date(h.due_at).toLocaleDateString():"-"}),a.jsx(ne,{className:"font-label text-xs text-outline",children:h.author}),a.jsx(ne,{className:"font-label text-xs text-outline",children:new Date(h.updated_at).toLocaleDateString()}),a.jsx(ne,{children:a.jsx("button",{type:"button","data-testid":"task-delete","aria-label":`Delete ${h.title}`,onClick:x=>{x.stopPropagation(),D(h)},className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-md text-outline hover:text-error hover:bg-error/10 transition-colors p-2",children:a.jsx(un,{size:12})})})]},h.id))})]})})})]}),E&&a.jsx(Gn,{open:E,onClose:()=>N(!1),onCreated:i,defaultProjectId:t!=="all"&&t!=="unassigned"?t:void 0}),a.jsx(Jn,{open:R!==null,title:"Delete Task",description:`Are you sure you want to delete "${(R==null?void 0:R.title)??""}"? This action cannot be undone.`,confirmLabel:"Delete",variant:"destructive",isPending:$.isPending,onConfirm:$e,onCancel:()=>D(null)}),a.jsx(tr,{taskId:s,open:s!==null,onOpenChange:h=>{h||l()}})]})}export{Do as default};
|