local-operator-ui 0.31.17 → 0.31.18
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 +5 -0
- package/out/main/index.js +81 -2
- package/out/renderer/assets/{_basePickBy-BFVaG15n.js → _basePickBy-D1XXNWdy.js} +1 -1
- package/out/renderer/assets/{_baseUniq-gJCk0rG2.js → _baseUniq-DD_DKvaU.js} +1 -1
- package/out/renderer/assets/{agent-details-page-DFrsX5r2.js → agent-details-page-Q8dgdQp2.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-RsTVS8Ja.js → agent-hub-page-CBHsotVj.js} +2 -2
- package/out/renderer/assets/{agents-page-C6V9rtk2.js → agents-page-9zkhLfa8.js} +2 -2
- package/out/renderer/assets/{arc-CIknpWp5.js → arc-BII0LAll.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BMMotc_h.js → architectureDiagram-IEHRJDOE-Yh4i0oDy.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BmYuuE4d.js → blockDiagram-JOT3LUYC-BsfIO03o.js} +1 -1
- package/out/renderer/assets/{book-open-DlCeQ__D.js → book-open-Bau36KjM.js} +1 -1
- package/out/renderer/assets/browser-page-CrHmmBk0.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CvutQHI8.js → browser-webauthn-prompt-_nNd3iSK.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BFuObwFK.js → c4Diagram-VJAJSXHY-CHKu8u4B.js} +1 -1
- package/out/renderer/assets/channel-DXiH5yDB.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CZKl836f.js → chunk-4BMEZGHF-Do_SeY3I.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-B9wNLZPW.js → chunk-A2AXSNBT-C7_NoYUm.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BTkxXUpV.js → chunk-AEK57VVT-C3I1E4qy.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DNN6I0j-.js → chunk-D6G4REZN-BEkTCb-4.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2--dr35NK8.js → chunk-RZ5BOZE2-Ccs-Kaym.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-ugREPL6z.js → chunk-XZIHB7SX-Db28vmME.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-D2MG4USX.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-D2MG4USX.js +1 -0
- package/out/renderer/assets/clone-BDi6ICAs.js +1 -0
- package/out/renderer/assets/{console-mirror-DxuGXeGm.js → console-mirror-CUQyeXIE.js} +1 -1
- package/out/renderer/assets/{consoleCapture-WxJX_qTe.js → consoleCapture-emgU7WyW.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-D8LZ8Svf.js → dagre-OKDRZEBW-k4D1AM8X.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-D0g-M9XO.js → diagram-SSKATNLV-B0DOtyf9.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-vsLld6BG.js → diagram-VNBRO52H-BmzuI3Lr.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-CK_yOr_W.js → erDiagram-Q7BY3M3F-BYRglvp5.js} +1 -1
- package/out/renderer/assets/{error-boundary-zYOCmQTl.js → error-boundary-BFYdHP26.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-vKK0hQ3c.js → flowDiagram-4HSFHLVR-C6ReCJC9.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BtTtHUdt.js → ganttDiagram-APWFNJXF-CMDShfzg.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-YAgfNmRP.js → gitGraphDiagram-7IBYFJ6S-pvPc8CHP.js} +1 -1
- package/out/renderer/assets/{graph-DLVpoZ2t.js → graph-BK-Vf19N.js} +1 -1
- package/out/renderer/assets/{index-6ATVV_hs.js → index-B5DwqFlK.js} +1 -1
- package/out/renderer/assets/{index-9kSbYL-A.js → index-BDPyvriR.js} +379 -374
- package/out/renderer/assets/index-DITdBETY.css +1 -0
- package/out/renderer/assets/{index-DYiBCsga.js → index-_oyU7kmX.js} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-COePE42k.js +2 -0
- package/out/renderer/assets/{installer-CuqnZBf2.js → installer-DfFRjYBs.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-DukH-Gm5.js → journeyDiagram-U35MCT3I-CeBVrNEA.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-z76URjv7.js → kanban-definition-NDS4AKOZ-DnIH3R0V.js} +1 -1
- package/out/renderer/assets/{layout-DXsudZzz.js → layout-IqcTjCQI.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-9xdh9z0y.js → legacy-agents-page-DbLTVwq0.js} +1 -1
- package/out/renderer/assets/{mermaid.core-BisXdtq8.js → mermaid.core-BrRc254F.js} +5 -5
- package/out/renderer/assets/{mesh-page-CAEapbX4.js → mesh-page-W9oV_bPF.js} +2 -2
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-CNYyqj85.js → mindmap-definition-ALO5MXBD-BMHndK7E.js} +1 -1
- package/out/renderer/assets/mini-CbmMlUkq.js +1 -0
- package/out/renderer/assets/{org-surface-gate-DgwB0Qtt.js → org-surface-gate-BgtTWHt3.js} +1 -1
- package/out/renderer/assets/{page-header-B-3TG7Ed.js → page-header-BtO13sx8.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-Cw8m6eUb.js → pieDiagram-IB7DONF6-CnRMxjLj.js} +1 -1
- package/out/renderer/assets/projects-page-BgRRDkEz.js +40 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DOXOQdsa.js → quadrantDiagram-7GDLP6J5-bRLUBm5r.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CcKir_MA.js → radar-MK3ICKWK-BV3WfB2Y.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-PT3JBz4t.js → radient-auth-buttons-Briy2cZb.js} +1 -1
- package/out/renderer/assets/renderer-platform-RsXXlY5x.js +42 -0
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-Dq-MDul5.js → requirementDiagram-KVF5MWMF-Bzqys165.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-pAkVtAtk.js → sankeyDiagram-QLVOVGJD--IgSaXgN.js} +1 -1
- package/out/renderer/assets/{schedules-page-k2yi4LKh.js → schedules-page-CbOATI1U.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BW8wMwAQ.js → sequenceDiagram-X6HHIX6F-bfcEv3LN.js} +1 -1
- package/out/renderer/assets/{settings-page-D06D41PG.js → settings-page-Bn87mGZ1.js} +1 -1
- package/out/renderer/assets/{settings-section-DTEnr98J.js → settings-section-BXGO9Lv0.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-Cvk9-LLw.js → stateDiagram-DGXRK772-CDJAoYUf.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Di7PMVrt.js +1 -0
- package/out/renderer/assets/{textarea-DRfVCtHc.js → textarea-B83uQCj2.js} +2 -2
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-B7RxGk8T.js → timeline-definition-BDJGKUSR-BlN_DgVS.js} +1 -1
- package/out/renderer/assets/{ui-preferences-store-Y6swLMAE.js → ui-preferences-store-DzXZGWGz.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-BffNJt-E.js → use-download-agent-mutation-DrENBWNa.js} +1 -1
- package/out/renderer/assets/{use-memberships-query-B5iErNyL.js → use-memberships-query-C2Yus1QJ.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DHcK38Dl.js → xychartDiagram-VJFVF3MP-C1DOS4ES.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +8 -8
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +6 -6
- package/package.json +2 -2
- package/out/renderer/assets/browser-page-BDBoJvY8.js +0 -1
- package/out/renderer/assets/channel-BppvpJLX.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BG2N01MY.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BG2N01MY.js +0 -1
- package/out/renderer/assets/clone-DjBhwTw6.js +0 -1
- package/out/renderer/assets/index-DAfI2ih0.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-BWQZxLJr.js +0 -2
- package/out/renderer/assets/mini-DPUFcBTO.js +0 -1
- package/out/renderer/assets/projects-page-D2TlKcUC.js +0 -22
- package/out/renderer/assets/renderer-platform-DV4X4aCW.js +0 -42
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Cu3aMWlw.js +0 -1
- /package/out/renderer/assets/{index-1jk3-3ca.js → index-CDaH3A1m.js} +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{r as x,j as t,c as A}from"./index-1jk3-3ca.js";import{H as qt,I as Te,J as zt,Q as ut,a as mt,L as Qt,N as Kt,O as Wt,R as Ht,U as Vt,V as Xt,W as We,X as He,Y as Gt,Z as Jt,b as ht,e as Y,y as Ie,_ as Ne,$ as Zt,a0 as es,c as ue,u as xt,D as ts,d as Ve,p as ss,l as as,a1 as ns,F as rs}from"./renderer-platform-DV4X4aCW.js";import{P as Xe}from"./page-header-B-3TG7Ed.js";import{c as fe,B as O,v as is,w as os,x as ls,E as we,O as cs,Q as ds,R as us,U as ms,V as hs,z as xs,F as ee,P as fs,W as ps,K as gs,I as U,S as ne,L as I,a as js,q as _e,r as Ce,s as De,t as Me,u as de,Y as ft,M as bs,X as ys,j as vs,A as Ee,Z as ks,_ as Ns,$ as ws,a0 as Ss,f as ae}from"./textarea-DRfVCtHc.js";import{aa as te,aG as Ts,e as pe,bS as pt,a3 as ge,aj as je,bT as _s,bU as Cs,bV as Ds,ak as gt,bW as Ms,bs as Es,P as me,d as $s,c as Ps,bX as Os,bY as As,bZ as Ls,b_ as Rs,b$ as Is,c0 as Fs,c1 as Us,af as Ge,c2 as Bs,ae as Ys,a4 as H,ab as G,a as qs,c3 as Je,c4 as zs}from"./index-9kSbYL-A.js";import"./ui-preferences-store-Y6swLMAE.js";import"./error-boundary-zYOCmQTl.js";import"./console-mirror-DxuGXeGm.js";function Ze(e,s){return e.filter(a=>!s.includes(a))}function Qs(e,s,a){const n=e.slice(0);return n[s]=a,n}var Ks=class extends qt{#a;#e;#n;#r;#t;#s;#i;#o;#l=[];constructor(e,s,a){super(),this.#a=e,this.#r=a,this.#n=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#m(e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,s){this.#n=e,this.#r=s,Te.batch(()=>{const a=this.#t,n=this.#u(this.#n);this.#l=n,n.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=n.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),l=r.some((o,f)=>o!==a[f]);a.length===r.length&&!l||(this.#t=r,this.#e=i,this.hasListeners()&&(Ze(a,r).forEach(o=>{o.destroy()}),Ze(r,a).forEach(o=>{o.subscribe(f=>{this.#m(o,f)})}),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const a=this.#u(e),n=a.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[n,r=>this.#d(r??n,s),()=>this.#c(n,a)]}#c(e,s){return s.map((a,n)=>{const r=e[n];return a.defaultedQueryOptions.notifyOnChangeProps?r:a.observer.trackResult(r,i=>{s.forEach(l=>{l.observer.trackProp(i)})})})}#d(e,s){return s?((!this.#s||this.#e!==this.#o||s!==this.#i)&&(this.#i=s,this.#o=this.#e,this.#s=zt(this.#s,s(e))),this.#s):e}#u(e){const s=new Map(this.#t.map(n=>[n.options.queryHash,n])),a=[];return e.forEach(n=>{const r=this.#a.defaultQueryOptions(n),i=s.get(r.queryHash);i?a.push({defaultedQueryOptions:r,observer:i}):a.push({defaultedQueryOptions:r,observer:new ut(this.#a,r)})}),a}#m(e,s){const a=this.#t.indexOf(e);a!==-1&&(this.#e=Qs(this.#e,a,s),this.#h())}#h(){if(this.hasListeners()){const e=this.#s,s=this.#c(this.#e,this.#l),a=this.#d(s,this.#r?.combine);e!==a&&Te.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ws({queries:e,...s},a){const n=mt(),r=Qt(),i=Kt(),l=x.useMemo(()=>e.map(j=>{const C=n.defaultQueryOptions(j);return C._optimisticResults=r?"isRestoring":"optimistic",C}),[e,n,r]);l.forEach(j=>{Wt(j),Ht(j,i)}),Vt(i);const[o]=x.useState(()=>new Ks(n,l,s)),[f,g,c]=o.getOptimisticResult(l,s.combine),N=!r&&s.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>N?o.subscribe(Te.batchCalls(j)):Xt,[o,N]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),x.useEffect(()=>{o.setQueries(l,s)},[l,s,o]);const h=f.some((j,C)=>We(l[C],j))?f.flatMap((j,C)=>{const p=l[C];if(p){const d=new ut(n,p);if(We(p,j))return He(p,d,i);Gt(j,r)&&He(p,d,i)}return[]}):[];if(h.length>0)throw Promise.all(h);const k=f.find((j,C)=>{const p=l[C];return p&&Jt({result:j,errorResetBoundary:i,throwOnError:p.throwOnError,query:n.getQueryCache().get(p.queryHash),suspense:p.suspense})});if(k?.error)throw k.error;return g(c())}/**
|
|
2
|
-
* @license lucide-react v0.507.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 Hs=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Vs=fe("grip-vertical",Hs);/**
|
|
7
|
-
* @license lucide-react v0.507.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 Xs=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Gs=fe("link-2",Xs);/**
|
|
12
|
-
* @license lucide-react v0.507.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Js=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],Zs=fe("send-horizontal",Js);/**
|
|
17
|
-
* @license lucide-react v0.507.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const ea=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],ta=fe("unlink",ea),be={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function sa(e){return ht({queryKey:be.list,enabled:e,queryFn:()=>Y({op:"projects.list"}).then(s=>s.projects),retry:Ie,staleTime:1e4})}function aa(e,s){return Ws({queries:e.map(a=>({queryKey:be.detail(a),enabled:s&&!!a,queryFn:()=>Y({op:"projects.get",key:a}),retry:Ie,staleTime:1e4}))})}function jt(e,s){return ht({queryKey:be.detail(e??""),enabled:s&&!!e,queryFn:()=>Y({op:"projects.get",key:e??""}),retry:Ie,staleTime:1e4})}function se(){const e=mt();return()=>{e.invalidateQueries({queryKey:be.list})}}function na(){const e=se();return te({mutationFn:s=>Y({op:"projects.create",name:s.name,...s.description!==void 0?{description:s.description}:{},...s.status!==void 0?{status:s.status}:{},...s.tags!==void 0?{tags:s.tags}:{}}),onSuccess:()=>e()})}function bt(){const e=se();return te({mutationFn:s=>Y({op:"projects.update",key:s.key,fields:s.fields}),onSuccess:()=>e()})}function yt(){const e=se();return te({mutationFn:s=>Y({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function ra(){const e=se();return te({mutationFn:s=>Y({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ia(){const e=se();return te({mutationFn:s=>Y({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function oa(){const e=se();return te({mutationFn:s=>Y({op:"projects.milestone",key:s.key,name:s.name,...s.targetDate!==void 0?{targetDate:s.targetDate}:{},...s.completed!==void 0?{completed:s.completed}:{}}),onSuccess:()=>e()})}function la(){const e=se();return te({mutationFn:s=>Y({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const ca={planning:{label:"Planning",variant:"info"},active:{label:"Active",variant:"accent"},qa:{label:"QA",variant:"attention"},validation:{label:"Validation",variant:"warning"},done:{label:"Done",variant:"success"},paused:{label:"Paused",variant:"neutral"},archived:{label:"Archived",variant:"outline"}};function F(e){return ca[e]??{label:e||"Unknown",variant:"neutral"}}function da(e){return e==="done"}const ua={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function ma(e){return ua[e]??{label:String(e),variant:"neutral"}}const he="Stale",ha=/^(\d{4})-(\d{2})-(\d{2})$/;function z(e,s,a=new Date){if(!e)return"";const n=ha.exec(e);if(!n)return e;const r=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));if(Number.isNaN(r.getTime()))return e;const i=r.toLocaleDateString(s,{month:"short",day:"numeric"});return r.getFullYear()===a.getFullYear()?i:`${i}, ${r.getFullYear()}`}function ie(e,s){if(e==null)return"";const a=Math.max(0,Math.floor(s/1e3-e));return a<60?"just now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function oe(e){return e==="just now"?"just now":`${e} ago`}function xa(e){return e?`reported ${oe(e)}`:"no progress"}const vt=/^$|^\d{4}-\d{2}-\d{2}$/;function kt(e){return e?e==="operator"?"the operator":`session ${e}`:""}function fa(e,s){if(!e.progress)return"not reported yet";const a=ie(e.progress_updated_at,s),n=kt(e.progress_reported_by),r=[a?`reported ${oe(a)}`:"reported"];return n&&r.push(`by ${n}`),r.join(" ")}function Nt(e,s){if(e==null)return"";const a=String(e);return s==="points"?`${a} pt`:s==="days"?`${a}d`:a}function wt(e,s){return s<=0?"":`${e}/${s}`}function Fe(e){return e<=0?"":`${e} live`}function pa(e){return e<=0?"":e===1?"1 session":`${e} sessions`}function ga(e){const s=pa(e.sessions);if(!s)return"";const a=Fe(e.live_sessions);return a?`${s} · ${a}`:s}function ja(e){if(!e.exists)return{label:"Missing",variant:"outline"};if(e.archived)return{label:"Archived",variant:"neutral"};switch(e.runtime?.state){case"live":return{label:"Live",variant:"success"};case"wedged":return{label:"Wedged",variant:"warning"};case"stale":return{label:"Stale",variant:"warning"};case"stopped":return{label:"Stopped",variant:"neutral"};default:return{label:String(e.runtime?.state??"Unknown"),variant:"neutral"}}}function ba(e){return e?e.running>0?e.running===1?"1 subagent running":`${e.running} subagents running`:e.settled===1?"1 subagent":`${e.settled} subagents`:""}function ya(e){return e?e.total===1?"1 todo":`${e.total} todos`:""}function St(e,s){const a=[],n=z(e.completed_at??e.target_date,s);n&&a.push({key:e.completed_at?"completed":"target",text:e.completed_at?`completed ${n}`:`due ${n}`});const r=Nt(e.estimate,e.estimate_unit);r&&a.push({key:"estimate",text:r});const i=wt(e.milestones_completed,e.milestones_total);i&&a.push({key:"milestones",text:`milestones ${i}`});const l=Fe(e.live_sessions);return l&&a.push({key:"live",text:l}),a}const re=864e5,va=/^(\d{4})-(\d{2})-(\d{2})$/;function Z(e){if(!e)return null;const s=va.exec(e);if(!s)return null;const a=Number(s[1]),n=Number(s[2]),r=Number(s[3]),i=Date.UTC(a,n-1,r),l=new Date(i);return l.getUTCFullYear()!==a||l.getUTCMonth()!==n-1||l.getUTCDate()!==r?null:i}const $e=["planning","active","qa","validation","done"],Pe=["paused","archived"],Tt="projects-board-column-order";let Oe=null;function ka(){if(Oe)return[...Oe];try{const e=localStorage.getItem(Tt);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const a=[];for(const n of s){if(typeof n!="string"||n.length===0)return[];a.includes(n)||a.push(n)}return a}catch{return[]}}function Na(e){Oe=[...e];try{localStorage.setItem(Tt,JSON.stringify(e))}catch{}}function wa(e,s,a){const n=e.filter(i=>i!==s),r=Math.max(0,Math.min(a,n.length));return n.splice(r,0,s),n}function Sa(e,s=[]){const a=new Map;for(const o of e){const f=a.get(o.status)??[];f.push(o),a.set(o.status,f)}const n=$e.map(o=>({status:o,projects:a.get(o)??[]}));for(const o of Pe){const f=a.get(o)??[];f.length>0&&n.push({status:o,projects:f})}for(const[o,f]of a)!Pe.includes(o)&&!$e.includes(o)&&n.push({status:o,projects:f});if(s.length===0)return n;const r=new Map(s.map((o,f)=>[o,f])),i=n.filter(o=>r.has(o.status));i.sort((o,f)=>(r.get(o.status)??0)-(r.get(f.status)??0));const l=n.filter(o=>!r.has(o.status));return[...i,...l]}function Ta(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const a=Z(e.target_date);return a===null?!1:a<s}function _t(e){return e.title||e.name}function _a(e,s){const a=[];for(const n of[e,s]){const r=n?.trim();r&&!a.includes(r)&&a.push(r)}return a.join(" · ")}const Ue="No team";function Be(e){const s=e.team?.trim();if(s)return s;const a=e.owner?.trim();return a||null}function Ye(e,s){const a=new Map,n=[];for(const i of e){const l=s(i);if(l===null){n.push(i);continue}const o=a.get(l);o?o.push(i):a.set(l,[i])}const r=[...a.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return n.length>0&&r.push({team:null,items:n}),r}function qe(e){return e.title||e.session_id}function Ca(e){return[...e].reverse()}function Da(e){return e<=0?"":e===1?"1 update":`${e} updates`}const et=e=>String(e).padStart(2,"0");function Ae(e){return`${e.getFullYear()}-${et(e.getMonth()+1)}-${et(e.getDate())}`}function Ma(e){const s=Date.parse(e);return Number.isNaN(s)?"":Ae(new Date(s))}function Ea(e,s,a=new Date){if(!e)return"";if(e===Ae(a))return"Today";const n=new Date(a.getFullYear(),a.getMonth(),a.getDate()-1);return e===Ae(n)?"Yesterday":z(e,s,a)}function $a(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":new Date(a).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit"})}function Pa(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":oe(ie(a/1e3,s))}function Oa(e,s,a=Date.now()){const n=[],r=kt(e.by);r&&n.push({key:"author",text:r});const i=$a(e.at,s);i&&n.push({key:"time",text:i});const l=Pa(e.at,a);return l&&n.push({key:"age",text:l}),n}function Aa(e,s,a=new Date){const n=[];for(const r of Ca(e)){const i=Ma(r.at),l=n[n.length-1];if(l&&l.key===i){l.entries.push(r);continue}n.push({key:i,label:Ea(i,s,a),entries:[r]})}return n}function La(e){return!Number.isFinite(e)||e<0?"":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`}function Ra(e,s){return s<=0?"":`${e} of ${s} complete`}function Ia(e){let s=0,a=0,n=!1;for(const r of e)r.todos&&(n=!0,s+=r.todos.open,a+=r.todos.total);return n?{open:s,total:a}:null}function tt(e){return`${e.open} open of ${e.total}`}function Fa(e){const s=e.filter(n=>n.exists);return(s.find(n=>n.runtime?.state==="live")??s[0])?.session_id??null}function Ua(e){const s=_t(e),a=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${a}`,"Review the project details and continue or complete the work."].join(`
|
|
22
|
-
`)}function Ba(e){return e?e.kind==="team"?`team ${e.name}`:`agent ${e.name}`:""}const st="complete them, or pass force_done=true to close with them open",Ya="complete or remove the incomplete milestones, then mark it done";function qa(e){return e.includes(st)?e.replace(st,Ya):e}const X=["day","week","month","quarter"],ze={day:24,week:9,month:3,quarter:1};function Ct(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function J(e,s){return Math.round((s-e)/re)}function at(e,s){return J(e,s)+1}function za(e,s){for(const a of X)if(e*ze[a]<=s)return a;return X[X.length-1]}function Qa(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(a=>!!a.target_date)}function Ka(e,s){const a=[s];for(const n of e){for(const r of[n.project.start_date,n.project.target_date,n.project.completed_at]){const i=Z(r);i!==null&&a.push(i)}for(const r of n.milestones){const i=Z(r.target_date);i!==null&&a.push(i)}}return a.length===1?null:{startMs:Math.min(...a),endMs:Math.max(...a)}}function Wa(e){const s=[],a=[];for(const n of e)(Qa(n)?s:a).push(n);return{dated:s,undated:a}}function Ha(e){const{project:s}=e,a=Z(s.start_date),n=Z(s.target_date),r=Z(s.completed_at),i=s.status==="done"&&r!==null?r:n,l=a??i,o=i??a;return l===null||o===null?null:{fromMs:Math.min(l,o),toMs:Math.max(l,o)}}function Va(e){const s=[];for(const a of e.milestones){const n=Z(a.target_date);n!==null&&s.push({name:a.name,dayMs:n,status:a.status})}return s}const ce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Xa(e){const{year:s,month:a}=B(e);return Date.UTC(s,a-1,1)}function Ga(e){const{year:s,month:a}=B(e);return a===12?Date.UTC(s+1,0,1):Date.UTC(s,a,1)}function Ja(e){const{year:s,month:a}=B(e);return Date.UTC(s,Math.floor((a-1)/3)*3,1)}function Za(e){const{year:s,month:a}=B(e),n=Math.floor((a-1)/3);return n===3?Date.UTC(s+1,0,1):Date.UTC(s,n*3+3,1)}function en(e){const{weekday:s}=B(e);return e-(s+6)%7*re}const tn=26;function sn(e,s,a){const n=[],r=(c,N,u)=>{c<e||c>s||n.push({dayMs:c,label:N,major:u})};if(a==="day"){let c=!1;for(let N=e;N<=s;N+=re){const{day:u,month:h}=B(N);u===1?(r(N,ce[h-1],!0),c=!0):c?(r(N,"",!1),c=!1):r(N,String(u),!1)}return n}if(a==="week"){for(let c=en(e);c<=s;c+=7*re){if(c<e)continue;const{day:N,month:u}=B(c);B(c-7*re).month!==u?r(c,`${ce[u-1]} ${N}`,!0):r(c,String(N),!1)}return n}const i=a==="month"?Xa:Ja,l=a==="month"?Ga:Za,o=c=>{const{year:N,month:u}=B(c);if(a==="month")return u===1&&N!==B(e).year?`${ce[0]} '${String(N%100).padStart(2,"0")}`:ce[u-1];const h=Math.floor((u-1)/3)+1;return h===1&&N!==B(e).year?`Q1 '${String(N%100).padStart(2,"0")}`:`Q${h}`};r(e,o(i(e)),!0);const f=Math.ceil(tn/ze[a]);let g=e;for(let c=l(i(e));c<=s;c=l(c))J(g,c)<f||(r(c,o(c),!0),g=c);return n}const nt={active:"In flight",paused:"On hold",done:"Finished"};function an(){const[e,s]=x.useState(null);return x.useEffect(()=>{if(!e)return;const a=document.querySelector(`[data-project-menu="${e}"]`);a&&(a.focus(),s(null))}),x.useCallback(a=>s(a),[])}const nn=4,Se="Drag the header, or press the arrow keys, to move this column.",rt="board-column-move-hint",rn=({projects:e,nowMs:s,onOpen:a,onEdit:n,onDelete:r,onMove:i,movingKeys:l=[]})=>{const[o,f]=x.useState(ka),g=Sa(e,o),[c,N]=x.useState(null),[u,h]=x.useState(""),k=x.useRef(null),j=x.useRef(null),C=x.useRef(null),p=x.useRef(null),d=x.useRef(null),m=new Set(l),T=(b,v)=>{const w=wa(g.map(D=>D.status),b,v);f(w),Na(w),h(`Moved ${F(b).label} column to position ${w.indexOf(b)+1} of ${w.length}.`)},S=(b,v)=>{const w=k.current;if(!w)return 0;let D=0;const P=w.querySelectorAll("[data-board-column]");for(const L of P){if(L.dataset.boardColumn===v)continue;const W=L.getBoundingClientRect();b>(W.left+W.right)/2&&(D+=1)}return D},M=(b,v)=>{const w=g.filter(L=>L.status!==b),D=w[v-1]?.status,P=w[v]?.status;return D&&P?`between ${F(D).label} and ${F(P).label}`:P?`before ${F(P).label}`:D?`after ${F(D).label}`:"in place"},E=(b,v)=>{const w=S(b,v.status);w!==v.over&&(v.over=w,N({status:v.status,over:w}),h(`Moving ${F(v.status).label} column; it will drop ${M(v.status,w)}.`))},Q=()=>{p.current!==null&&(cancelAnimationFrame(p.current),p.current=null)},_=32,y=12,$=()=>{p.current=null;const b=d.current,v=k.current,w=C.current;if(!b?.armed||!v||w===null)return;const D=v.getBoundingClientRect(),P=v.scrollWidth-v.clientWidth;let L=0;if(w-D.left<_&&v.scrollLeft>0?L=-1:D.right-w<_&&v.scrollLeft<P&&(L=1),L!==0){const W=v.scrollLeft;v.scrollLeft=W+L*y,v.scrollLeft!==W&&E(w,b)}else E(w,b);ve(b.status,b.over),p.current=requestAnimationFrame($)};x.useEffect(()=>()=>{p.current!==null&&cancelAnimationFrame(p.current)},[]);const q=(b,v)=>{if(b.button===0){try{b.currentTarget.setPointerCapture(b.pointerId)}catch{}d.current={pointerId:b.pointerId,status:v,startX:b.clientX,startY:b.clientY,armed:!1,over:g.findIndex(w=>w.status===v)},C.current=b.clientX}},K=b=>{const v=d.current;if(!(!v||b.pointerId!==v.pointerId)){if(C.current=b.clientX,!v.armed){if(Math.hypot(b.clientX-v.startX,b.clientY-v.startY)<nn)return;v.armed=!0,N({status:v.status,over:v.over}),h(`Moving ${F(v.status).label} column.`),p.current===null&&(p.current=requestAnimationFrame($))}E(b.clientX,v)}},R=b=>{const v=d.current;if(d.current=null,Q(),N(null),!v?.armed)return;if(!b){h("Move cancelled.");return}const w=g.findIndex(D=>D.status===v.status);if(v.over===w){h("");return}T(v.status,v.over)},le=b=>{const v=d.current;!v||b.pointerId!==v.pointerId||R(!0)},ye=()=>{R(!1)};x.useEffect(()=>{if(!c)return;const b=v=>{v.key==="Escape"&&R(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[c!==null]);const ve=x.useCallback((b,v)=>{const w=k.current,D=j.current;if(!w||!D)return;const P=w.getBoundingClientRect(),L=[];for(const Ke of w.querySelectorAll("[data-board-column]"))Ke.dataset.boardColumn!==b&&L.push(Ke.getBoundingClientRect());const W=6,It=v>=L.length?(L[L.length-1]?.right??P.left)+W:(L[v]?.left??P.right)-W,ke=w.scrollLeft,Ft=2,Ut=It-P.left+ke,Qe=ke+1,Bt=ke+P.width-Ft-1,Yt=Math.round(Math.min(Math.max(Ut,Qe),Math.max(Qe,Bt)));D.style.left=`${Yt}px`},[]);x.useLayoutEffect(()=>{c&&ve(c.status,c.over)},[c,ve]);const Rt=(b,v)=>{if(b.key==="Enter"||b.key===" "){b.preventDefault(),h(Se);return}if(b.key!=="ArrowLeft"&&b.key!=="ArrowRight")return;b.preventDefault();const w=g.map(L=>L.status),D=w.indexOf(v),P=b.key==="ArrowLeft"?D-1:D+1;if(P<0||P>=w.length){h(`${F(v).label} column is already ${P<0?"the first column":"the last column"}.`);return}T(v,P)};return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children:u}),t.jsx("span",{id:rt,className:"sr-only",children:Se}),t.jsxs("div",{ref:k,"data-board-strip":"",className:A("relative flex min-h-0 flex-1 items-start gap-3 overflow-auto px-3 pb-3",c&&"cursor-grabbing select-none"),children:[c&&t.jsx("div",{ref:j,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),g.map(b=>{const v=F(b.status);return t.jsxs("section",{"data-board-column":b.status,className:"flex w-64 shrink-0 flex-col rounded-md bg-sunken",children:[t.jsxs("header",{"data-board-column-handle":b.status,onPointerDown:w=>q(w,b.status),onPointerMove:K,onPointerUp:le,onPointerCancel:ye,className:A("sticky top-0 z-20 flex h-11 shrink-0 cursor-grab items-center justify-between gap-2 rounded-t-md bg-sunken px-3 active:cursor-grabbing",c?.status===b.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(O,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":b.status,"aria-label":`Move ${v.label} column`,"aria-describedby":rt,title:Se,className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:w=>Rt(w,b.status),children:t.jsx(Vs,{"aria-hidden":"true"})}),t.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"truncate text-body-sm font-medium text-ink",children:v.label}),nt[b.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:nt[b.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:b.projects.length})]}),b.projects.length===0?t.jsx("p",{className:"px-3 py-4 text-meta text-ink-muted",children:"No projects here."}):t.jsx("ul",{className:"flex flex-col gap-2 p-2",children:Ye(b.projects,Be).map(w=>t.jsxs("li",{className:"flex flex-col gap-2","data-board-group":w.team??"",children:[t.jsxs("div",{className:"sticky top-11 z-10 flex items-center gap-2 bg-sunken px-3 py-1 text-meta","data-board-team":w.team??"",children:[t.jsx("span",{className:"truncate text-ink-muted",children:w.team??Ue}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:w.items.length})]}),t.jsx("ul",{className:"flex flex-col gap-2",children:w.items.map(D=>t.jsx("li",{children:t.jsx(on,{project:D,nowMs:s,busy:m.has(D.id),onOpen:()=>a(D),onEdit:()=>n(D),onDelete:()=>r(D),onMove:P=>i(D,P)})},D.id))})]},w.team??""))})]},b.status)})]})]})},on=({project:e,nowMs:s,busy:a,onOpen:n,onEdit:r,onDelete:i,onMove:l})=>{const o=St(e,typeof navigator>"u"?void 0:navigator.language),f=Ta(e,Ct(s)),g=ie(e.progress_updated_at,s),c=()=>{const u=window.getSelection();u&&!u.isCollapsed||n()},N=u=>{u.key!=="Enter"&&u.key!==" "||u.target===u.currentTarget&&(u.preventDefault(),n())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":`Open ${e.name}`,onClick:c,onKeyDown:N,className:A("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",f&&"border border-warning-border"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-body-sm font-medium text-ink",children:e.name}),e.description&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.description})]}),t.jsxs(is,{children:[t.jsx(os,{"data-project-menu":e.id,"aria-label":`Actions for ${e.name}`,disabled:a,onClick:u=>u.stopPropagation(),className:A("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:t.jsx(Ts,{className:"size-4"})}),t.jsxs(ls,{align:"end",onClick:u=>u.stopPropagation(),children:[t.jsx(we,{onSelect:n,children:"Open"}),t.jsxs(cs,{children:[t.jsx(ds,{children:"Set status"}),t.jsx(us,{children:t.jsx(ms,{value:e.status,onValueChange:l,children:[...$e,...Pe].map(u=>t.jsx(hs,{value:u,children:F(u).label},u))})})]}),t.jsx(xs,{}),t.jsx(we,{onSelect:r,children:"Edit"}),t.jsx(we,{onSelect:i,children:"Delete"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.filter(u=>u.key!=="live").map(u=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:u.text},u.key)),f&&t.jsx(ee,{variant:"warning",children:"Overdue"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-meta text-ink-muted",children:xa(g)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!g)&&t.jsx("span",{"aria-label":he,title:he,className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(ln,{project:e})]})]})]})},ln=({project:e})=>{const[s,a]=x.useState(!1),n=pe(),r=jt(e.id,s),i=r.data?.links??[],l=ga(e);return t.jsxs(fs,{open:s,onOpenChange:a,children:[t.jsx(ps,{"data-project-sessions":e.id,"aria-label":`Sessions linked to ${e.name}`,onClick:o=>o.stopPropagation(),className:A("rounded-sm px-1 text-meta whitespace-nowrap",e.live_sessions>0?"text-success hover:bg-sunken":"text-ink-muted hover:bg-sunken"),children:l}),t.jsx(gs,{align:"end",className:"w-64 p-2 outline-none",onClick:o=>o.stopPropagation(),children:r.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"Loading linked sessions…"}):r.isError?t.jsxs("div",{className:"flex flex-col items-start gap-1.5 px-1 py-2",children:[t.jsx("p",{className:"text-meta text-ink-muted",children:r.error instanceof Error&&r.error.message?r.error.message:"The linked sessions could not be read."}),t.jsx(O,{variant:"secondary",size:"sm",onClick:()=>void r.refetch(),children:"Try again"})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"No sessions linked yet."}):t.jsx("ul",{className:"flex flex-col",children:i.map(o=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!o.exists,onClick:()=>{o.exists&&(a(!1),pt(n,o.session_id))},className:A("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",o.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:o.title||o.session_id})})},o.session_id))})})]})},Dt=({open:e,projectName:s,onClose:a,onConfirm:n})=>{const[r,i]=x.useState(""),[l,o]=x.useState(null),[f,g]=x.useState(!1),c=x.useId();x.useEffect(()=>{e&&(i(""),o(null),g(!1))},[e]);const N=r.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,u=async()=>{g(!0),o(null);try{await n(r.trim()),a()}catch(h){o(h instanceof Error&&h.message?h.message:"The project was not deleted.")}finally{g(!1)}};return t.jsx(ge,{open:e,onClose:a,title:"Delete this project?",dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(je,{onClick:a,disabled:f,children:"Cancel"}),t.jsxs(_s,{onClick:()=>void u(),disabled:!N||f,children:[f&&t.jsx(ne,{size:"xs"}),"Delete project"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:"This deletes the project and its milestones. The sessions linked to it are not touched."}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Type"," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ","to confirm."]}),t.jsx(U,{id:`${c}-confirm`,value:r,onChange:h=>i(h.target.value),placeholder:s,"aria-label":"Type the project name to confirm","aria-invalid":r.length>0&&!N,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})},cn=/^(https?:|mailto:)/i,dn={a:({href:e,children:s})=>typeof e=="string"&&cn.test(e)?t.jsx("a",{href:e,target:"_blank",rel:"noreferrer",children:s}):t.jsx("span",{className:"font-mono text-mono-sm",children:s})},Le=x.memo(({children:e,className:s})=>t.jsx("div",{className:A("lo-markdown",s),children:t.jsx(Cs,{remarkPlugins:[Ds],components:dn,children:e})})),un=[{value:"planning",label:"Planning"},{value:"active",label:"Active"},{value:"qa",label:"QA"},{value:"validation",label:"Validation"},{value:"done",label:"Done"},{value:"paused",label:"Paused"},{value:"archived",label:"Archived"}],Mt={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},it=vt;function ot(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}function mn(e){return e?{name:e.name,title:e.title??"",owner:e.owner??"",team:e.team??"",description:e.description,status:e.status,tags:e.tags.join(", "),startDate:e.start_date??"",targetDate:e.target_date??"",estimate:e.estimate===null||e.estimate===void 0?"":String(e.estimate),estimateUnit:e.estimate_unit||"points"}:Mt}const Re=({open:e,mode:s,initial:a,onClose:n,onSubmit:r})=>{const[i,l]=x.useState(Mt),[o,f]=x.useState({}),[g,c]=x.useState(null),N=x.useRef(null),[u,h]=x.useState(!1),k=x.useId();x.useEffect(()=>{e&&(l(mn(a)),f({}),c(null),h(!1))},[e]),x.useEffect(()=>{g&&N.current?.scrollIntoView({block:"nearest"})},[g]);const j=(m,T)=>{l(S=>({...S,[m]:T}))},C=m=>{const T={},S=Zt(m.name.trim());S&&(T.name=S),m.description.length>Ne&&(T.description=`Keep the description within ${Ne} characters.`);const M=ot(m.tags);if(M.length>8)T.tags="At most 8 tags.";else for(const E of M){const Q=es(E);if(Q){T.tags=Q;break}}if(s==="edit"){if(it.test(m.startDate)||(T.startDate="Dates are YYYY-MM-DD, or empty."),it.test(m.targetDate)||(T.targetDate="Dates are YYYY-MM-DD, or empty."),!T.startDate&&!T.targetDate&&m.startDate&&m.targetDate&&m.targetDate<m.startDate&&(T.targetDate="The target date is before the start date."),m.estimate){const E=Number(m.estimate);(!Number.isFinite(E)||!(E>0)||E>1e3)&&(T.estimate="Estimates are greater than 0 and at most 1000.")}for(const E of["title","owner","team"])m[E].trim().length>80&&(T[E]=`${E==="title"?"Titles":E==="owner"?"Owners":"Teams"} are at most 80 characters.`)}return T},p=async()=>{const m=C(i);if(f(m),Object.keys(m).length>0)return;h(!0),c(null);const T=ot(i.tags);try{s==="create"?await r({mode:"create",fields:{name:i.name.trim(),...i.description.trim()?{description:i.description.trim()}:{},status:i.status,...T.length>0?{tags:T}:{}}}):await r({mode:"edit",key:a?.key??"",fields:{name:i.name.trim(),description:i.description.trim(),title:i.title.trim(),owner:i.owner.trim(),team:i.team.trim(),status:i.status,tags:T,start_date:i.startDate,target_date:i.targetDate,...i.estimate?{estimate:Number(i.estimate)}:{},estimate_unit:i.estimateUnit}}),n()}catch(S){const M=S instanceof Error&&S.message?S.message:"";c(qa(M)||"The project was not saved.")}finally{h(!1)}},d=s==="create"?"New project":"Edit project";return t.jsx(ge,{open:e,onClose:n,title:d,maxWidth:"sm",dataTourTag:s==="create"?"project-create-dialog":"project-edit-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(je,{onClick:n,disabled:u,children:"Cancel"}),t.jsxs(gt,{onClick:()=>void p(),disabled:u,children:[u&&t.jsx(ne,{size:"xs"}),s==="create"?"Create project":"Save changes"]})]}),children:t.jsxs("form",{className:"flex flex-col gap-4 px-1 py-1",onSubmit:m=>{m.preventDefault(),p()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-name`,children:"Name"}),t.jsx(U,{id:`${k}-name`,value:i.name,onChange:m=>j("name",m.target.value),placeholder:"payments-migration",autoFocus:!0,"aria-invalid":!!o.name}),o.name?t.jsx("p",{className:"text-meta text-danger",children:o.name}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Letters, digits, dot, underscore or dash; no spaces."})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-description`,children:"Description"}),t.jsx(js,{id:`${k}-description`,value:i.description,onChange:m=>j("description",m.target.value),rows:2,"aria-invalid":!!o.description}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.description?t.jsx("p",{className:"text-meta text-danger",children:o.description}):t.jsx("span",{}),t.jsxs("p",{className:"text-meta text-ink-muted tabular-nums",children:[i.description.length,"/",Ne]})]})]}),s==="edit"&&t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-title`,children:"Display title"}),t.jsx(U,{id:`${k}-title`,value:i.title,onChange:m=>j("title",m.target.value),placeholder:"Payments migration","aria-invalid":!!o.title}),o.title?t.jsx("p",{className:"text-meta text-danger",children:o.title}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Shown instead of the name; the name stays the key everything is addressed by."})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{children:"Status"}),t.jsxs(_e,{value:i.status,onValueChange:m=>j("status",m),children:[t.jsx(Ce,{"aria-label":"Status",children:t.jsx(De,{})}),t.jsx(Me,{children:un.map(m=>t.jsx(de,{value:m.value,children:m.label},m.value))})]}),i.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Moving a project to Done stamps today as its completion date."})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-tags`,children:"Tags"}),t.jsx(U,{id:`${k}-tags`,value:i.tags,onChange:m=>j("tags",m.target.value),placeholder:"q4, payments","aria-invalid":!!o.tags}),o.tags?t.jsx("p",{className:"text-meta text-danger",children:o.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Comma-separated, up to 8. Lowercase letters, digits, underscore or dash."})]}),s==="edit"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-start`,children:"Start date"}),t.jsx(U,{id:`${k}-start`,value:i.startDate,onChange:m=>j("startDate",m.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.startDate}),o.startDate&&t.jsx("p",{className:"text-meta text-danger",children:o.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-target`,children:"Target date"}),t.jsx(U,{id:`${k}-target`,value:i.targetDate,onChange:m=>j("targetDate",m.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.targetDate}),o.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:o.targetDate})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-owner`,children:"Owner"}),t.jsx(U,{id:`${k}-owner`,value:i.owner,onChange:m=>j("owner",m.target.value),placeholder:"atlas","aria-invalid":!!o.owner}),o.owner&&t.jsx("p",{className:"text-meta text-danger",children:o.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-team`,children:"Team"}),t.jsx(U,{id:`${k}-team`,value:i.team,onChange:m=>j("team",m.target.value),placeholder:"platform","aria-invalid":!!o.team}),o.team&&t.jsx("p",{className:"text-meta text-danger",children:o.team})]})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(I,{htmlFor:`${k}-estimate`,children:"Estimate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(U,{id:`${k}-estimate`,value:i.estimate,onChange:m=>j("estimate",m.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!o.estimate,className:"max-w-28"}),t.jsxs(_e,{value:i.estimateUnit,onValueChange:m=>j("estimateUnit",m),children:[t.jsx(Ce,{"aria-label":"Estimate unit",className:"max-w-32",children:t.jsx(De,{})}),t.jsxs(Me,{children:[t.jsx(de,{value:"points",children:"Points"}),t.jsx(de,{value:"days",children:"Days"})]})]})]}),o.estimate&&t.jsx("p",{className:"text-meta text-danger",children:o.estimate}),s==="edit"&&i.estimate.trim()===""&&a?.estimate!==null&&a?.estimate!==void 0&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Clearing an estimate is not supported yet — saving keeps its current value."})]})]}),g&&t.jsx("p",{ref:N,className:"text-body-sm text-danger",children:g})]})})},hn=({links:e,target:s,onTargetChange:a,onSend:n,focusTick:r})=>{const[i,l]=x.useState(""),[o,f]=x.useState(!1),g=x.useRef(null);x.useEffect(()=>{r>0&&g.current?.focus()},[r]);const c=e.filter(j=>j.exists),u=(c.find(j=>j.session_id===s)??null)?.runtime?.busy===!0,h=!!s&&i.trim().length>0&&!o,k=async()=>{if(!(!h||!s)){f(!0);try{await n(s,i.trim(),u?"steer":"prompt")&&l("")}finally{f(!1),g.current?.focus()}}};return t.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-elevated p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-ink-muted",children:"Send to"}),t.jsxs(_e,{value:s??void 0,onValueChange:j=>a(j),children:[t.jsx(Ce,{"aria-label":"Select the session to message",className:"max-w-72",children:t.jsx(De,{placeholder:"No session selected"})}),t.jsx(Me,{children:c.map(j=>t.jsx(de,{value:j.session_id,children:qe(j)},j.session_id))})]}),u&&t.jsx("span",{className:"text-meta text-ink-muted",children:"The session is working — this message steers the running turn."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U,{ref:g,"aria-label":"Message the selected session",placeholder:"Message the session",value:i,onChange:j=>l(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),k())}}),t.jsxs(O,{variant:"secondary",disabled:!h,onClick:()=>void k(),"data-tour-tag":"project-quick-send",children:[o?t.jsx(ne,{size:"xs"}):t.jsx(Zs,{}),"Send"]})]})]})},xn=({links:e,busy:s,onUnlink:a,onLink:n,onQuickSend:r,onStartSession:i})=>{const l=pe(),o=ue(p=>p.sessions),[f,g]=x.useState(!1),[c,N]=x.useState(null),[u,h]=x.useState(0),k=c&&e.some(p=>p.session_id===c&&p.exists)?c:Fa(e),j=x.useMemo(()=>{const p=new Set(e.map(d=>d.session_id));return o.filter(d=>!p.has(d.session_id)).map(d=>({id:d.session_id,name:d.title||d.session_id,description:d.cwd??void 0}))},[o,e]),C=p=>{ue.getState().openSession(p).then(d=>{d&&l(`/chat/${p}`)})};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Linked sessions"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(O,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Ms,{}),"New session"]}),t.jsxs(O,{variant:"secondary",size:"sm",disabled:s,onClick:()=>g(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Gs,{}),"Link session"]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No sessions linked yet. Link the conversations that are working on this project so its progress stays with them."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(p=>{const d=ja(p),m=ba(p.subagents),T=ya(p.todos),S=p.title||p.session_id,M=p.exists;return t.jsxs("li",{className:A("flex items-center gap-2 rounded-sm px-2 py-2",M&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!M,onClick:()=>{M&&C(p.session_id)},className:A("flex min-w-0 flex-1 items-center gap-2 text-left",M?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{className:A("min-w-0 truncate text-body-sm",p.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:S})}),p.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),m&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:m}),T&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:T}),t.jsx(ee,{variant:d.variant,children:d.label}),M&&t.jsx(O,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Message ${S}`,title:`Message ${S}`,onClick:()=>{N(p.session_id),h(E=>E+1)},children:t.jsx(Es,{})}),t.jsx(O,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${S}`,onClick:()=>a(p.session_id),children:t.jsx(ta,{})})]},p.session_id)})}),e.length>0&&t.jsx(hn,{links:e,target:k,onTargetChange:N,onSend:r,focusTick:u}),t.jsx(ge,{open:f,onClose:()=>g(!1),title:"Link a session",maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(je,{onClick:()=>g(!1),children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(I,{children:"Session"}),t.jsx(ft,{showLabel:!1,ariaLabel:"Search sessions",busyLabel:"Loading sessions",placeholder:"Search conversations",options:j,selected:null,onSelect:p=>{g(!1),n(p.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:"Conversations already linked to this project are not listed."})]})})]})},fn=({milestones:e,summary:s,busy:a,onToggle:n,onRemove:r,onAdd:i})=>{const[l,o]=x.useState(""),[f,g]=x.useState(""),c=!vt.test(f.trim()),N=l.trim().length>0&&!c&&!a,u=()=>{N&&(i(l.trim(),f.trim()),o(""),g(""))};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Milestones"}),s&&e.length>0&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:s})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No milestones yet. Add one below to mark the dates this project is planned around."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(h=>{const k=ma(h.status),j=h.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(bs,{checked:j,disabled:a,onCheckedChange:C=>n(h.name,C===!0),"aria-label":j?`Mark ${h.name} not complete`:`Mark ${h.name} complete`}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:h.name}),h.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:z(h.target_date,typeof navigator>"u"?void 0:navigator.language)}),t.jsx(ee,{variant:k.variant,children:k.label}),t.jsx(O,{variant:"ghost",size:"icon-sm",disabled:a,"aria-label":`Remove ${h.name}`,onClick:()=>r(h.name),children:t.jsx(ys,{})})]},h.name)})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[t.jsx(I,{htmlFor:"project-milestone-name",children:"New milestone"}),t.jsx(U,{id:"project-milestone-name",value:l,onChange:h=>o(h.target.value),placeholder:"beta cut",onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),u())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(I,{htmlFor:"project-milestone-date",children:"Target date"}),t.jsx(U,{id:"project-milestone-date",value:f,onChange:h=>g(h.target.value),placeholder:"YYYY-MM-DD","aria-invalid":c}),c&&t.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),t.jsxs(O,{variant:"secondary",disabled:!N,onClick:u,"data-tour-tag":"project-milestone-add",children:[t.jsx(me,{}),"Add"]})]})]})},pn=({project:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=new Date(s),r=[],i=z(e.start_date,a,n);i&&r.push({label:"Start",value:i});const l=z(e.target_date,a,n);l&&r.push({label:"Target",value:l});const o=z(e.completed_at,a,n);o&&r.push({label:"Completed",value:o});const f=Nt(e.estimate,e.estimate_unit);if(f&&r.push({label:"Estimate",value:f}),e.tags.length>0&&r.push({label:"Tags",value:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(g=>t.jsx(ee,{variant:"outline",children:g},g))})}),e.updated_at>0){const g=oe(ie(e.updated_at,s)),c=new Date(e.updated_at*1e3).toLocaleString(a);r.push({label:"Updated",value:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:c,children:g})})}return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Properties"}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No dates, estimate or tags yet."}):t.jsx("dl",{className:"flex flex-col gap-2",children:r.map(g=>t.jsxs("div",{className:"flex items-baseline gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 text-body-sm text-ink-muted",children:g.label}),t.jsx("dd",{className:"min-w-0 text-body-sm text-ink",children:g.value})]},g.label))})]})},Et="plain",$t=e=>`team:${e}`,Pt=e=>`agent:${e}`;function gn(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function jn(e){return e.kind==="team"?$t(e.name):e.kind==="agent"?Pt(e.name):Et}const lt={kind:"plain"},bn=({open:e,onClose:s,onStart:a,teamsEnabled:n,profilesEnabled:r})=>{const[i,l]=x.useState(lt),[o,f]=x.useState(null),[g,c]=x.useState(!1),N=$s(e&&n),u=Ps(e&&r);x.useEffect(()=>{e&&(l(lt),f(null),c(!1))},[e]);const h=x.useMemo(()=>{const d=[{id:Et,name:"Nothing in particular",description:"A plain session; assign a team or agent later.",group:"Plain"}];for(const m of N.data??[])d.push({id:$t(m.name),name:m.name,description:`Team · manager: ${m.manager}`,group:"Teams"});for(const m of(u.data??[]).filter(T=>T.source!=="builtin"))d.push({id:Pt(m.name),name:m.name,description:m.description||m.kind,group:"Agents"});return d},[N.data,u.data]),k=h.find(d=>d.id===jn(i))??h[0],j=!n||!r,C=N.isLoading||u.isLoading,p=async()=>{c(!0),f(null);try{await a(i),s()}catch(d){f(d instanceof Error&&d.message?d.message:"The session could not be started.")}finally{c(!1)}};return t.jsx(ge,{open:e,onClose:s,title:"Start a session",maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(je,{onClick:s,disabled:g,children:"Cancel"}),t.jsxs(gt,{onClick:()=>void p(),disabled:g,children:[g&&t.jsx(ne,{size:"xs"}),"Start session"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(ft,{label:"Work with",placeholder:"Search teams and agents",options:h,selected:k,onSelect:d=>l(gn(d.id)),busy:C,busyLabel:"Loading teams and agents"}),t.jsx("p",{className:"text-meta text-ink-muted",children:"The session starts now, links itself to this project, and opens with a prompt you can edit before sending."}),j&&t.jsx("p",{className:"text-meta text-ink-muted",children:"This server does not offer the team or agent catalogues yet, so only a plain session can be started."}),o&&t.jsx("p",{className:"text-body-sm text-danger",children:o})]})})},Ot=({status:e})=>{const s=F(e);return t.jsxs(ee,{variant:s.variant,children:[da(e)&&t.jsx(vs,{"aria-hidden":!0}),s.label]})},yn=({links:e})=>{const s=Ia(e),a=e.filter(n=>n.todos!==null);return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"To-dos"}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:tt(s)})]}),a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No to-do snapshots from the linked sessions yet. A session publishes its list as it works, and it appears here once it has."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:a.map(n=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:n.title?"min-w-0 flex-1 truncate text-body-sm text-ink":"min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-muted",children:qe(n)}),n.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:tt(n.todos)})]},n.session_id))})]})},vn=/[/\\]/;function At(e){if(e.name)return e.name;const s=e.path.split(vn);return s[s.length-1]||"Attachment"}const kn=({attachment:e})=>{const s=At(e),a=La(e.bytes);return t.jsxs("div",{className:"flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-surface px-3 py-2",children:[t.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2.5 text-left",onClick:()=>{window.api?.openFile(e.path)},title:`Open ${s}`,children:[t.jsx(Fs,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),a&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:a}),t.jsx(Us,{filePath:e.path,"aria-label":`File actions for ${s}`})]})},Nn=({attachment:e})=>{const s=At(e),a=Os(e.path,{mimeType:As(e.name||e.path),sizeBytes:e.bytes});return a.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(Ls,{file:e.path,src:a.url,label:s,conversationId:""})}):a.status==="loading"?t.jsx(Rs,{children:t.jsxs("span",{className:"sr-only",children:["Loading ",s]})}):t.jsx(Is,{name:s})},wn=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(Nn,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(kn,{attachment:s},`${s.path}:${s.added_at}`))}),Sn=({update:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=Oa(e,a,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[n.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:n.map((r,i)=>t.jsxs(x.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:r.text})]},r.key))}),e.text&&t.jsx(Le,{children:e.text}),e.attachments.length>0&&t.jsx(wn,{attachments:e.attachments})]})},Tn=({updates:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=Da(e.length),r=Aa(e,a,new Date(s));return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Updates"}),n&&t.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No updates yet. Progress reported by you or by the sessions working on this project is appended here."}):t.jsx("div",{className:"flex flex-col gap-4",children:r.map(i=>t.jsxs("div",{className:"flex flex-col gap-2",children:[i.label&&t.jsx("h3",{className:"text-meta text-ink-muted",children:i.label}),t.jsx("div",{className:"flex flex-col divide-y divide-hairline",children:i.entries.map((l,o)=>t.jsx(Sn,{update:l,nowMs:s},`${l.at}:${l.by}:${o}`))})]},i.key||"ungrouped"))})]})},_n="project_not_found",Cn=({projectKey:e,nowMs:s})=>{const a=pe(),n=xt(),r=jt(e,!0),i=bt(),l=yt(),o=oa(),f=la(),g=ra(),c=ia(),[N,u]=x.useState(!1),[h,k]=x.useState(!1),[j,C]=x.useState(!1),p=i.isPending||l.isPending||o.isPending||f.isPending||g.isPending||c.isPending;if(r.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(ne,{label:"Loading project"})});if(r.isError||!r.data){const _=r.error instanceof ts&&(r.error.code===_n||r.error.status===404);return t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col items-start gap-4",children:[t.jsx(Ee,{variant:"danger",className:"w-full",children:_?"This project could not be found. It may have been deleted.":r.error instanceof Error&&r.error.message?r.error.message:"The project could not be read."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{variant:"secondary",onClick:()=>void r.refetch(),children:"Try again"}),t.jsxs(O,{variant:"secondary",onClick:()=>void a("/projects"),children:[t.jsx(Ge,{}),"All projects"]})]})]})}const{project:d,links:m}=r.data,T=_t(d),S=_a(d.owner,d.team),M=Ra(d.milestones.filter(_=>_.completed_at!==null).length,d.milestones.length),E=async(_,y,$)=>{const q=ue.getState(),K=ss(null,_,q.drafts);if(!K)return!1;try{if(await as(K,{text:y,attachments:[],images:[],mode:$,cwd:q.cwd},_)===null)return H("That session already has a message going out. Try again in a moment."),!1;const le=m.find(ye=>ye.session_id===_);return G(`Sent to ${le?qe(le):_}`),!0}catch(R){return H(R instanceof Error&&R.message?R.message:"The message was not sent."),!1}},Q=async _=>{const y=ue.getState(),$=_.kind==="plain"?void 0:{kind:_.kind,name:_.name},q=await y.createSession(y.cwd||"~",$);if(!q)throw new Error(y.error??"The session could not be started.");ns.getState().setCurrentInput(q,Ua(d));let K=null;try{await g.mutateAsync({key:d.id,sessionId:q})}catch(R){K=R instanceof Error&&R.message?R.message:"the link was refused"}if(K)H(`Session started, but linking it failed: ${K}`);else{const R=$?` with ${Ba($)}`:"";G(`Session started${R} and linked to ${T}.`)}await pt(a,q)};return t.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-200 flex-1 flex-col gap-8 overflow-y-auto",children:[t.jsxs("header",{className:"flex flex-col gap-4",children:[t.jsxs("button",{type:"button",onClick:()=>void a("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(Ge,{className:"size-4"}),"All projects"]}),t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h1",{className:"min-w-0 truncate text-display text-ink",children:T}),t.jsx(Ot,{status:d.status}),d.progress_stale&&t.jsx(ee,{variant:"warning",children:he})]}),d.title&&t.jsx("p",{className:"font-mono text-mono-sm text-ink-muted",children:d.name}),S&&t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Managed by ",S]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(O,{variant:"secondary",onClick:()=>u(!0),"data-tour-tag":"project-edit",children:[t.jsx(Bs,{}),"Edit"]}),t.jsxs(O,{variant:"secondary",onClick:()=>k(!0),"data-tour-tag":"project-delete",children:[t.jsx(Ys,{}),"Delete"]})]})]})]}),d.description.trim()&&t.jsx(Le,{className:"text-body",children:d.description}),t.jsx(pn,{project:d,nowMs:s}),d.updates.length===0&&d.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:"Progress"}),t.jsx(Le,{className:"text-body",children:d.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:fa(d,s)})]}),t.jsx(fn,{milestones:d.milestones,summary:M,busy:p,onToggle:(_,y)=>{o.mutateAsync({key:d.id,name:_,completed:y}).catch($=>{H($ instanceof Error&&$.message?$.message:"The milestone was not updated.")})},onRemove:_=>{f.mutateAsync({key:d.id,name:_}).catch(y=>{H(y instanceof Error&&y.message?y.message:"The milestone was not removed.")})},onAdd:(_,y)=>{o.mutateAsync({key:d.id,name:_,targetDate:y}).catch($=>{H($ instanceof Error&&$.message?$.message:"The milestone was not added.")})}}),t.jsx(xn,{projectKey:d.id,links:m,busy:p,onStartSession:()=>C(!0),onQuickSend:E,onLink:_=>{g.mutateAsync({key:d.id,sessionId:_}).catch(y=>{H(y instanceof Error&&y.message?y.message:"The session was not linked.")})},onUnlink:_=>{c.mutateAsync({key:d.id,sessionId:_}).catch(y=>{H(y instanceof Error&&y.message?y.message:"The session was not unlinked.")})}}),t.jsx(yn,{links:m}),t.jsx(Tn,{updates:d.updates,nowMs:s}),t.jsx(Re,{open:N,mode:"edit",initial:{key:d.id,name:d.name,title:d.title,owner:d.owner,team:d.team,description:d.description,status:d.status,tags:d.tags,start_date:d.start_date,target_date:d.target_date,estimate:d.estimate,estimate_unit:d.estimate_unit},onClose:()=>u(!1),onSubmit:async _=>{_.mode==="edit"&&(await i.mutateAsync({key:_.key,fields:_.fields}),G("Project saved"))}}),t.jsx(Dt,{open:h,projectName:d.name,onClose:()=>k(!1),onConfirm:async _=>{await l.mutateAsync({key:d.id,confirmedName:_}),G("Project deleted"),a("/projects")}}),t.jsx(bn,{open:j,onClose:()=>C(!1),onStart:Q,teamsEnabled:Ve(n.data,"team_catalogue"),profilesEnabled:Ve(n.data,"profile_catalogue")})]})},V=[{key:"name",label:"Project",className:"min-w-0 flex-1"},{key:"status",label:"Status",className:"w-20 shrink-0"},{key:"target",label:"Target",className:"hidden w-32 shrink-0 @[40rem]:block"},{key:"estimate",label:"Estimate",className:"hidden w-16 shrink-0 @[40rem]:block"},{key:"milestones",label:"Milestones",className:"hidden w-20 shrink-0 @[34rem]:block"},{key:"live",label:"Live",className:"hidden w-14 shrink-0 @[34rem]:block"},{key:"progress",label:"Progress",className:"w-40 shrink-0"}];function Dn(e,s){const a=ie(e.progress_updated_at,s);return a?oe(a):"not reported"}const Mn=({projects:e,nowMs:s,onOpen:a})=>{const n=Ye(e,Be);return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("div",{className:"flex shrink-0 items-center gap-3 px-3 py-2 text-meta text-ink-muted","aria-hidden":"true",children:V.map(r=>t.jsx("span",{className:r.className,children:r.label},r.key))}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto",children:n.map(r=>t.jsxs("li",{children:[t.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 bg-canvas px-3 py-1.5 text-meta","data-project-team":r.team??"",children:[t.jsx("span",{className:"truncate text-ink",children:r.team??Ue}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:r.items.length})]}),t.jsx("ul",{className:"divide-y divide-hairline",children:r.items.map(i=>{const l=new Map(St(i,typeof navigator>"u"?void 0:navigator.language).map(g=>[g.key,g.text])),o=wt(i.milestones_completed,i.milestones_total),f=Fe(i.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(i),"data-project-name":i.name,className:A("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-elevated"),children:[t.jsx("span",{className:A(V[0].className,"truncate text-body-sm text-ink"),children:i.name}),t.jsx("span",{className:V[1].className,children:t.jsx(Ot,{status:i.status})}),t.jsx("span",{className:A(V[2].className,"truncate text-meta text-ink-muted"),children:l.get("target")??l.get("completed")??""}),t.jsx("span",{className:A(V[3].className,"truncate text-meta text-ink-muted"),children:l.get("estimate")??""}),t.jsx("span",{className:A(V[4].className,"truncate text-meta text-ink-muted"),children:o}),t.jsx("span",{className:A(V[5].className,"truncate text-meta text-ink-muted"),children:f}),t.jsxs("span",{className:A(V[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:Dn(i,s)}),i.progress_stale&&t.jsx(ee,{variant:"warning",children:he})]})]})},i.id)})})]},r.team??""))})]})},xe=224,ct=36,En={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},$n=({items:e,nowMs:s,onOpen:a,pendingDetails:n,failedDetails:r,onRetryDetails:i})=>{const[l,o]=x.useState(null),[f,g]=x.useState(0),c=x.useRef(null),N=Ct(s),u=x.useMemo(()=>Ka(e,N),[e,N]),h=x.useMemo(()=>Wa(e),[e]),k=x.useMemo(()=>Ye(h.dated,S=>Be(S.project)),[h]);x.useLayoutEffect(()=>{const S=c.current;if(!S)return;const M=()=>g(S.clientWidth);if(M(),typeof ResizeObserver>"u")return;const E=new ResizeObserver(M);return E.observe(S),()=>E.disconnect()},[]);const j=Math.max(f-xe-24,160),C=u?za(at(u.startMs,u.endMs),j):"month",p=l??C,d=S=>{const M=X.indexOf(p),E=X[M-S];E&&o(E)},m=ze[p],T=u?at(u.startMs,u.endMs)*m:0;return t.jsxs("div",{ref:c,className:"flex min-h-0 flex-1 flex-col","data-testid":"project-timeline",children:[t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-2",children:[t.jsx("span",{className:"truncate text-meta text-ink-muted","data-timeline-note":!0,children:r>0?`Milestones could not be read for ${r} project${r===1?"":"s"}.`:n>0?`Loading milestones for ${n} project${n===1?"":"s"}…`:`${h.dated.length} dated · ${h.undated.length} without dates`}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&t.jsx(O,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}),t.jsx(O,{variant:"secondary",size:"icon","aria-label":"Zoom in",title:"Zoom in (finer)",disabled:!u||p===X[0],onClick:()=>d(1),children:t.jsx(me,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:En[p]}),t.jsx(O,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!u||p===X[X.length-1],onClick:()=>d(-1),children:t.jsx(ks,{})})]})]}),u&&h.dated.length>0?t.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t.jsxs("div",{className:"min-w-max",children:[t.jsx(Pn,{startMs:u.startMs,endMs:u.endMs,tier:p,pxPerDay:m,trackPx:T}),k.map(S=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":S.team??"",children:t.jsxs("span",{className:"sticky left-0 z-20 flex shrink-0 items-center gap-2 bg-canvas px-3 py-1 text-meta",style:{width:xe},children:[t.jsx("span",{className:"truncate text-ink",children:S.team??Ue}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:S.items.length})]})}),S.items.map(M=>t.jsx(On,{item:M,spanStart:u.startMs,pxPerDay:m,trackPx:T,today:N,onOpen:()=>a(M)},M.project.id))]},S.team??""))]})}):t.jsx("p",{className:"px-3 py-6 text-body-sm text-ink-muted",children:"No dates on any project yet. Set a start date, a target date or a milestone date and it will appear on the timeline."}),h.undated.length>0&&t.jsxs("div",{className:"shrink-0 px-3 py-2 text-meta text-ink-muted",children:["No dates (",h.undated.length,"):"," ",h.undated.map((S,M)=>t.jsxs("span",{children:[M>0&&", ",t.jsx("button",{type:"button",className:"text-ink hover:underline",onClick:()=>a(S),children:S.project.name})]},S.project.id))]})]})},Pn=({startMs:e,endMs:s,tier:a,pxPerDay:n,trackPx:r})=>{const i=sn(e,s,a);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:xe}}),t.jsx("span",{className:"relative block h-6",style:{width:r},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:J(e,l.dayMs)*n},children:[t.jsx("span",{className:A("absolute top-0 h-full w-px",l.major?"bg-hairline":"bg-hairline/60"),"aria-hidden":"true"}),t.jsx("span",{className:"absolute top-1/2 left-1 -translate-y-1/2 whitespace-nowrap text-meta text-ink-muted",children:l.label})]},l.dayMs))})]})},On=({item:e,spanStart:s,pxPerDay:a,trackPx:n,today:r,onOpen:i})=>{const{project:l}=e,o=Ha(e),f=Va(e),g=c=>new Date(c).toISOString().slice(0,10);return t.jsxs("button",{type:"button",onClick:i,"data-project-name":l.name,className:"flex w-full items-stretch text-left transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[t.jsx("span",{className:"sticky left-0 z-10 flex shrink-0 items-center gap-2 border-r border-hairline bg-canvas px-3",style:{width:xe,height:ct},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:l.name})}),t.jsxs("span",{className:"relative block",style:{width:n,height:ct},children:[o&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:J(s,o.fromMs)*a,width:(J(o.fromMs,o.toMs)+1)*a},title:`${z(g(o.fromMs))} → ${z(g(o.toMs))}`}),f.map(c=>t.jsx("span",{"data-milestone":c.status,className:A("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",c.status==="completed"&&"bg-success",c.status==="overdue"&&"bg-warning",c.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:J(s,c.dayMs)*a},title:`${c.name} · ${c.status} · ${z(g(c.dayMs))}`},`${c.name}-${c.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:J(s,r)*a},"aria-hidden":"true"})]})]})},Lt="projects-view",An=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function Ln(){try{const e=localStorage.getItem(Lt);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"list"}function Rn(e){try{localStorage.setItem(Lt,e)}catch{}}const In=({value:e,onChange:s})=>t.jsx(Ns,{value:e,onValueChange:a=>s(a),children:t.jsx(ws,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:An.map(a=>t.jsx(Ss,{value:a.value,children:a.label},a.value))})}),Fn=["r1","r2","r3","r4","r5","r6"],dt={unpaired:"This app is not paired with the Local Operator server, so Projects are unavailable.","below-version":"The Local Operator server is older than this app expects, so Projects are unavailable. Update the server and try again.",unknown:"The server's capabilities could not be read, so Projects are unavailable."},Hn=({nowMs:e=Date.now()})=>{const{projectId:s}=qs(),a=pe(),n=xt(),r=rs(n.data,"projects",1),i=r==="enabled",l=sa(i),o=na(),f=bt(),g=yt(),[c,N]=x.useState(!1),[u,h]=x.useState(()=>Ln()),[k,j]=x.useState(null),[C,p]=x.useState(null),d=an(),m=l.data??[],T=aa(u==="timeline"?m.map(y=>y.id):[],i),S=m.map((y,$)=>({project:y,milestones:T[$]?.data?.project.milestones??[]})),M=u==="timeline"?T.filter(y=>y.isLoading).length:0,E=u==="timeline"?T.filter(y=>y.isError).length:0,Q=()=>{for(const y of T)y.isError&&y.refetch()},_=(y,$)=>{f.mutate({key:y.id,fields:{status:$}},{onSuccess:()=>{G(`Moved to ${F($).label}`),l.refetch().then(()=>d(y.id))}})};return i?s?t.jsx("div",{className:"flex h-full min-h-0 flex-col gap-8 p-6",children:t.jsx(Cn,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-8 p-6",children:[t.jsx(Xe,{title:"Projects",icon:Je,subtitle:"Workstreams you and your agents track across sessions.",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{variant:"secondary",size:"icon","aria-label":"Refresh projects",title:"Refresh projects",disabled:l.isFetching,onClick:()=>void l.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(zs,{})}),t.jsxs(O,{variant:"secondary",onClick:()=>N(!0),"data-tour-tag":"create-project-button",children:[t.jsx(me,{}),"New project"]})]})}),t.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3",children:t.jsx(In,{value:u,onChange:y=>{h(y),Rn(y)}})}),l.isLoading&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("output",{className:"px-3 py-2 text-meta text-ink-dim",children:"Loading projects…"}),Fn.map(y=>t.jsxs("div",{className:"flex items-center gap-3 px-3 py-2","aria-hidden":"true",children:[t.jsx(ae,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(ae,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ae,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(ae,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(ae,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ae,{className:"h-4 w-40 shrink-0 bg-elevated"})]},y))]}),l.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx(Ee,{variant:"danger",children:l.error instanceof Error&&l.error.message?l.error.message:"The projects could not be read."}),t.jsx(O,{variant:"secondary",size:"sm",onClick:()=>void l.refetch(),children:"Try again"})]}),l.isSuccess&&l.data.length===0&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4",children:[t.jsx("p",{className:"text-heading text-ink",children:"No projects yet."}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Create one here, or ask an agent to create one and link this session."}),t.jsxs(O,{variant:"primary",onClick:()=>N(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(me,{}),"New project"]})]}),l.isSuccess&&l.data.length>0&&u==="list"&&t.jsx(Mn,{projects:l.data,nowMs:e,onOpen:y=>void a(`/projects/${y.id}`)}),l.isSuccess&&l.data.length>0&&u==="board"&&t.jsx(rn,{projects:m,nowMs:e,onOpen:y=>void a(`/projects/${y.id}`),onEdit:j,onDelete:p,onMove:_,movingKeys:f.isPending&&f.variables?[f.variables.key]:[]}),l.isSuccess&&l.data.length>0&&u==="timeline"&&t.jsx($n,{items:S,nowMs:e,onOpen:y=>void a(`/projects/${y.project.id}`),pendingDetails:M,failedDetails:E,onRetryDetails:Q}),t.jsx(Re,{open:k!==null,mode:"edit",initial:k?{key:k.id,name:k.name,title:k.title,owner:k.owner,team:k.team,description:k.description,status:k.status,tags:k.tags,start_date:k.start_date,target_date:k.target_date,estimate:k.estimate,estimate_unit:k.estimate_unit}:null,onClose:()=>j(null),onSubmit:async y=>{y.mode==="edit"&&(await f.mutateAsync({key:y.key,fields:y.fields}),G("Project saved"),j(null))}}),t.jsx(Dt,{open:C!==null,projectName:C?.name??"",onClose:()=>p(null),onConfirm:async y=>{C&&(await g.mutateAsync({key:C.id,confirmedName:y}),G("Project deleted"),p(null))}}),t.jsx(Re,{open:c,mode:"create",onClose:()=>N(!1),onSubmit:async y=>{y.mode==="create"&&(await o.mutateAsync(y.fields),G(`Project ${y.fields.name} created`))}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Xe,{title:"Projects",icon:Je}),n.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(ne,{label:"Checking the server's Projects support"})}):t.jsx(Ee,{variant:"warning",children:dt[r]??dt.unknown})]})};export{Hn as ProjectsPage};
|