local-operator-ui 0.34.6 → 0.34.7
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/out/renderer/assets/{_basePickBy-QjKMgTXT.js → _basePickBy-BbIcow98.js} +1 -1
- package/out/renderer/assets/{_baseUniq-OgiSUJX8.js → _baseUniq-BHZ5XWFU.js} +1 -1
- package/out/renderer/assets/{agent-details-page-DxRi7Nmn.js → agent-details-page-DkrAoir8.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-DaL6uU4d.js → agent-hub-page-CR5nZ4aX.js} +1 -1
- package/out/renderer/assets/agents-page-B_XCqUPH.js +7 -0
- package/out/renderer/assets/{arc-BSCcjeGn.js → arc-CjJi3dKI.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BZqqgCuf.js → architectureDiagram-IEHRJDOE-SW8k9E6r.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BjDFJLPH.js → blockDiagram-JOT3LUYC-d42AVe1G.js} +1 -1
- package/out/renderer/assets/{book-open-BkNVD8Xx.js → book-open--Rkaye1b.js} +1 -1
- package/out/renderer/assets/browser-page-9iJf7wD6.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-DgEvywX-.js → browser-webauthn-prompt-DLDyr48Y.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-84HJuyJq.js → c4Diagram-VJAJSXHY-DsJL1d7_.js} +1 -1
- package/out/renderer/assets/channel-Sc5kpJLm.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-BFIZ_Ygh.js → chunk-4BMEZGHF-CZ9Rb3BK.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CpxbUmXJ.js → chunk-A2AXSNBT-CpEuHwzL.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BMwqkWh4.js → chunk-AEK57VVT-CILmQq37.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-BoP_RCH8.js → chunk-D6G4REZN-3ivauQSR.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-jI-9KlAm.js → chunk-RZ5BOZE2-BC2kHOhT.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-Cx3yDw5S.js → chunk-XZIHB7SX-DkBq8WSM.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2--M7QwpQ1.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW--M7QwpQ1.js +1 -0
- package/out/renderer/assets/clone-B8-wkAHu.js +1 -0
- package/out/renderer/assets/{console-mirror-B7AdscIi.js → console-mirror-m4iYesBg.js} +1 -1
- package/out/renderer/assets/{consoleCapture-CrogV1iL.js → consoleCapture-dpX-dZJb.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-qo2vdthg.js → conversation-input-sync-D-zN-3c7.js} +238 -238
- package/out/renderer/assets/{dagre-OKDRZEBW-BVRCY-p3.js → dagre-OKDRZEBW-BmGkDFUR.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DRr8ps2R.js → diagram-SSKATNLV-B6JGTKYn.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-WNa5whfz.js → diagram-VNBRO52H-5k2QLmcA.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BQo6e0ob.js → erDiagram-Q7BY3M3F-DQhMxNvI.js} +1 -1
- package/out/renderer/assets/{error-boundary-S6g2GwKk.js → error-boundary-XLnRMwpt.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-C98I-N_J.js → flowDiagram-4HSFHLVR-Mqh6-XNm.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-B88AGEe-.js → ganttDiagram-APWFNJXF-CaW9Yr7H.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BF3ia1yD.js → gitGraphDiagram-7IBYFJ6S-BlL0KvLS.js} +1 -1
- package/out/renderer/assets/{graph-CvNo4sbB.js → graph-BzlO8_OF.js} +1 -1
- package/out/renderer/assets/{index-D5ugIzNj.js → index-5YWUQFTM.js} +49 -49
- package/out/renderer/assets/{index-r_zBBOsy.js → index-B1VaRjk6.js} +1 -1
- package/out/renderer/assets/index-CV4EKbhw.css +1 -0
- package/out/renderer/assets/{index-DDrspJMh.js → index-om35ZNCk.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-CZrihcIz.js → infoDiagram-PH2N3AL5-hFRcA9yT.js} +1 -1
- package/out/renderer/assets/{installer-q9AlWXtv.js → installer-D3e1sYLn.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-2kbx8-0B.js → journeyDiagram-U35MCT3I-DAAUenAU.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-63HJcpT6.js → kanban-definition-NDS4AKOZ-_uRMig6I.js} +1 -1
- package/out/renderer/assets/{layout-CF_AdB0T.js → layout-Bb28G46z.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-fDSOngDd.js → legacy-agents-page-b-XqVCAg.js} +1 -1
- package/out/renderer/assets/{mermaid.core-CK-ur8jr.js → mermaid.core-BbzxawE5.js} +5 -5
- package/out/renderer/assets/{mesh-page-Bvpnd7KS.js → mesh-page-BX5RFpfj.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-Bc39DRlN.js → mindmap-definition-ALO5MXBD-1DklaQ5H.js} +1 -1
- package/out/renderer/assets/mini-DBZWXbBG.js +1 -0
- package/out/renderer/assets/{org-surface-gate-DHC9peiu.js → org-surface-gate-DHuv-VKy.js} +1 -1
- package/out/renderer/assets/{page-header-B3QWXojp.js → page-header-Diz2YHGd.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-DNqdj5TC.js → pieDiagram-IB7DONF6-Dg00RNbc.js} +1 -1
- package/out/renderer/assets/projects-page-BEOdjzjG.js +50 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DPbCAVhR.js → quadrantDiagram-7GDLP6J5-CJOsspqp.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-15hhF3TI.js → radar-MK3ICKWK-BxWOGuva.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-Bk72NsEo.js → radient-auth-buttons-DnVWkXEp.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-dKo8EQJY.js → requirementDiagram-KVF5MWMF-CZL4kSrN.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-fghCopFE.js → sankeyDiagram-QLVOVGJD-nD6CYbg4.js} +1 -1
- package/out/renderer/assets/{schedules-page-BgNO2Q0i.js → schedules-page-gh6Av6W1.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CsTWQItW.js → sequenceDiagram-X6HHIX6F-DPrYFqys.js} +1 -1
- package/out/renderer/assets/{settings-page-z5hijnRJ.js → settings-page-BPYZGfHW.js} +1 -1
- package/out/renderer/assets/{settings-section-eCy-EDNn.js → settings-section-CMKRYEph.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-DEK0oFVA.js → stateDiagram-DGXRK772-BQNHz5TA.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BphWy-95.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-3vkqkmgE.js → timeline-definition-BDJGKUSR-_5ZFlDfV.js} +1 -1
- package/out/renderer/assets/{ui-preferences-store-DXlcXfat.js → ui-preferences-store-B23VrKBG.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-KCBeh0Xl.js → use-download-agent-mutation-p6HWkslv.js} +1 -1
- package/out/renderer/assets/{use-memberships-query-BOTHXYIS.js → use-memberships-query-BGtDxsrR.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-DlX1HoYM.js → use-session-snapshot-B_SpQFPC.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CHvM9hP2.js → xychartDiagram-VJFVF3MP-D34_wcok.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +2 -2
- package/out/renderer/assets/agents-page-BV9fcDLX.js +0 -7
- package/out/renderer/assets/browser-page-BvRdo8wr.js +0 -1
- package/out/renderer/assets/channel-BD-K6d4A.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BmNemiy8.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BmNemiy8.js +0 -1
- package/out/renderer/assets/clone-CswMflD3.js +0 -1
- package/out/renderer/assets/index-UN1QuqvT.css +0 -1
- package/out/renderer/assets/mini-wNSQi0qe.js +0 -1
- package/out/renderer/assets/projects-page-DJGJxbb8.js +0 -50
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-uwg2tbMn.js +0 -1
- /package/out/renderer/assets/{index-BkcJ58S7.js → index-DYPQY4Aq.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{r as d,j as t,c as $}from"./index-DYPQY4Aq.js";import{bV as Ta,bW as Bt,bX as _a,bY as xn,u as gn,bZ as Ca,b_ as Ea,b$ as Ra,c0 as Da,c1 as Aa,c2 as Oa,c3 as _s,c4 as Cs,c5 as $a,c6 as Pa,aH as is,aO as Oe,d as ce,c7 as Ma,aI as os,c8 as Ia,c9 as La,ca as qe,cb as Fa,T as Ct,cc as Es,cd as Rs,ce as Ds,bH as qa,aP as ye,cf as Ua,a as Ke,b as fe,a_ as Ba,aR as Et,ax as lt,aV as Ue,cg as Ya,ch as za,ci as Ha,cj as Wa,ck as Ka,aX as bn,aW as jt,cl as Yt,b1 as Ga,as as Va,ah as vt,bd as Qa,bc as Xa,b9 as As,cm as Ja,cn as Za,co as er,cp as tr,cq as sr,cr as nr,cs as ar,ct as jn,aQ as rr,ay as le,ag as ir,ab as or,ac as lr,ae as cr,af as dr,ai as ur,ao as mr,cu as fr,cv as vn,bh as hr,cw as pr,aq as xr,aS as gr,a$ as br}from"./conversation-input-sync-D-zN-3c7.js";import{P as Os}from"./page-header-Diz2YHGd.js";import{c as Ge,s as Be,f as ls,t as Ye,u as ze,v as He,w as Te,B as U,D as yn,l as kn,S as ke,m as wn,p as tt,_ as jr,$ as vr,a0 as yr,a1 as kr,a2 as wr,o as Nr,j as pe,U as cs,a3 as ds,W as us,I as ne,X as Rt,C as ms,T as Nn,L as ie,y as Sn,Y as Tn,A as zt,M as Sr,N as Tr,O as _r,P as Cr,e as Ie}from"./error-boundary-XLnRMwpt.js";import{aM as _n,aS as Er,aT as Cn,aU as Rr,ay as Dr,an as at,A as $s,aV as Ps,aW as Ar}from"./index-5YWUQFTM.js";import{u as Or}from"./use-session-snapshot-B_SpQFPC.js";import"./ui-preferences-store-B23VrKBG.js";import"./console-mirror-m4iYesBg.js";function Ms(e,s){return e.filter(n=>!s.includes(n))}function $r(e,s,n){const a=e.slice(0);return a[s]=n,a}var Pr=class extends Ta{#n;#e;#a;#r;#t;#s;#i;#o;#l=[];constructor(e,s,n){super(),this.#n=e,this.#r=n,this.#a=[],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.#a=e,this.#r=s,Bt.batch(()=>{const n=this.#t,a=this.#u(this.#a);this.#l=a,a.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=a.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),l=r.some((o,c)=>o!==n[c]);n.length===r.length&&!l||(this.#t=r,this.#e=i,this.hasListeners()&&(Ms(n,r).forEach(o=>{o.destroy()}),Ms(r,n).forEach(o=>{o.subscribe(c=>{this.#m(o,c)})}),this.#f()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const n=this.#u(e),a=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[a,r=>this.#d(r??a,s),()=>this.#c(a,n)]}#c(e,s){return s.map((n,a)=>{const r=e[a];return n.defaultedQueryOptions.notifyOnChangeProps?r:n.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=_a(this.#s,s(e))),this.#s):e}#u(e){const s=new Map(this.#t.map(a=>[a.options.queryHash,a])),n=[];return e.forEach(a=>{const r=this.#n.defaultQueryOptions(a),i=s.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new xn(this.#n,r)})}),n}#m(e,s){const n=this.#t.indexOf(e);n!==-1&&(this.#e=$r(this.#e,n,s),this.#f())}#f(){if(this.hasListeners()){const e=this.#s,s=this.#c(this.#e,this.#l),n=this.#d(s,this.#r?.combine);e!==n&&Bt.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function Mr({queries:e,...s},n){const a=gn(n),r=Ca(),i=Ea(),l=d.useMemo(()=>e.map(v=>{const g=a.defaultQueryOptions(v);return g._optimisticResults=r?"isRestoring":"optimistic",g}),[e,a,r]);l.forEach(v=>{Ra(v),Da(v,i)}),Aa(i);const[o]=d.useState(()=>new Pr(a,l,s)),[c,m,u]=o.getOptimisticResult(l,s.combine),h=!r&&s.subscribed!==!1;d.useSyncExternalStore(d.useCallback(v=>h?o.subscribe(Bt.batchCalls(v)):Oa,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),d.useEffect(()=>{o.setQueries(l,s)},[l,s,o]);const f=c.some((v,g)=>_s(l[g],v))?c.flatMap((v,g)=>{const x=l[g];if(x){const j=new xn(a,x);if(_s(x,v))return Cs(x,j,i);$a(v,r)&&Cs(x,j,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const w=c.find((v,g)=>{const x=l[g];return x&&Pa({result:v,errorResetBoundary:i,throwOnError:x.throwOnError,query:a.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(w?.error)throw w.error;return m(u())}/**
|
|
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 Ir=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],En=Ge("arrow-up",Ir);/**
|
|
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 Lr=[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Fr=Ge("calendar-off",Lr);/**
|
|
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 qr=[["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"}]],Ur=Ge("link-2",qr);/**
|
|
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 Br=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Yr=Ge("list-filter",Br);/**
|
|
22
|
+
* @license lucide-react v0.507.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const zr=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]],Hr=Ge("message-square-more",zr);/**
|
|
27
|
+
* @license lucide-react v0.507.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Wr=[["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"}]],Kr=Ge("unlink",Wr),Dt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Gr(e){return is({queryKey:Dt.list,enabled:e,queryFn:()=>ce({op:"projects.list"}).then(s=>s.projects),retry:os,staleTime:1e4})}function Vr(e,s){return Mr({queries:e.map(n=>({queryKey:Dt.detail(n),enabled:s&&!!n,queryFn:()=>ce({op:"projects.get",key:n}),retry:os,staleTime:1e4}))})}function Rn(e,s){return is({queryKey:Dt.detail(e??""),enabled:s&&!!e,queryFn:()=>ce({op:"projects.get",key:e??""}),retry:os,staleTime:1e4})}function $e(){const e=gn();return()=>{e.invalidateQueries({queryKey:Dt.list})}}function Qr(){const e=$e();return Oe({mutationFn:s=>ce({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 Dn(){const e=$e();return Oe({mutationFn:s=>ce({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:Ma,onSuccess:()=>e()})}function An(){const e=$e();return Oe({mutationFn:s=>ce({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function Xr(){const e=$e();return Oe({mutationFn:s=>ce({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function Jr(){const e=$e();return Oe({mutationFn:s=>ce({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function Zr(){const e=$e();return Oe({mutationFn:s=>ce({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 ei(){const e=$e();return Oe({mutationFn:s=>ce({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const On={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"}},Le=Object.keys(On);function Z(e){return On[e]??{label:e||"Unknown",variant:"neutral"}}const $n=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:Z(e).label}));function ti(e){return e==="done"}const si={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function ni(e){return si[e]??{label:String(e),variant:"neutral"}}const yt="Stale",ai=/^(\d{4})-(\d{2})-(\d{2})$/;function _e(e,s,n=new Date){if(!e)return"";const a=ai.exec(e);if(!a)return e;const r=new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));if(Number.isNaN(r.getTime()))return e;const i=r.toLocaleDateString(s,{month:"short",day:"numeric"});return r.getFullYear()===n.getFullYear()?i:`${i}, ${r.getFullYear()}`}function ct(e,s){if(e==null)return"";const n=Math.max(0,Math.floor(s/1e3-e));return n<60?"just now":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}d`}function dt(e){return e==="just now"?"just now":`${e} ago`}function ri(e){return e?`reported ${dt(e)}`:"no progress"}const Pn=/^$|^\d{4}-\d{2}-\d{2}$/;function Mn(e){return e?e==="operator"?"the operator":`session ${e}`:""}function ii(e,s){if(!e.progress)return"not reported yet";const n=ct(e.progress_updated_at,s),a=Mn(e.progress_reported_by),r=[n?`reported ${dt(n)}`:"reported"];return a&&r.push(`by ${a}`),r.join(" ")}function In(e,s){if(e==null)return"";const n=String(e);return s==="points"?`${n} pt`:s==="days"?`${n}d`:n}function Ln(e,s){return s<=0?"":`${e}/${s}`}function fs(e){return e<=0?"":`${e} live`}function oi(e){return e<=0?"":e===1?"1 session":`${e} sessions`}function li(e){return e===1?"1 project":`${e} projects`}function ci(e){const s=oi(e.sessions);if(!s)return"";const n=fs(e.live_sessions);return n?`${s} · ${n}`:s}function di(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 ui(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 mi(e){return e?e.total===1?"1 todo":`${e.total} todos`:""}function Fn(e,s){const n=[],a=_e(e.completed_at??e.target_date,s);a&&n.push({key:e.completed_at?"completed":"target",text:e.completed_at?`completed ${a}`:`due ${a}`});const r=In(e.estimate,e.estimate_unit);r&&n.push({key:"estimate",text:r});const i=Ln(e.milestones_completed,e.milestones_total);i&&n.push({key:"milestones",text:`milestones ${i}`});const l=fs(e.live_sessions);return l&&n.push({key:"live",text:l}),n}const Fe=864e5,fi=/^(\d{4})-(\d{2})-(\d{2})$/;function he(e){if(!e)return null;const s=fi.exec(e);if(!s)return null;const n=Number(s[1]),a=Number(s[2]),r=Number(s[3]),i=Date.UTC(n,a-1,r),l=new Date(i);return l.getUTCFullYear()!==n||l.getUTCMonth()!==a-1||l.getUTCDate()!==r?null:i}const Ht=["planning","active","qa","validation","done"],Wt=["paused","archived"],At=[{value:"24h",label:"Last 24 hours",phrase:"the last 24 hours",seconds:86400},{value:"7d",label:"Last 7 days",phrase:"the last 7 days",seconds:604800},{value:"30d",label:"Last 30 days",phrase:"the last 30 days",seconds:2592e3},{value:"90d",label:"Last 90 days",phrase:"the last 90 days",seconds:7776e3},{value:"all",label:"All time",phrase:null,seconds:null}],qn="7d",hi=At.find(e=>e.value===qn);function Un(e){return At.find(s=>s.value===e)??hi}function pi(e){return At.some(s=>s.value===e)}function Is(e,s,n){const a=Un(s);return a.seconds===null?e:e.filter(r=>n/1e3-r.updated_at<=a.seconds)}function xi(e){const s=Un(e);return s.seconds===null?null:`Nothing changed in ${s.phrase}.`}const Bn="projects-board-window";function gi(){try{const e=localStorage.getItem(Bn);if(e!==null&&pi(e))return e}catch{}return qn}function Ls(e){try{localStorage.setItem(Bn,e)}catch{}}const Yn="projects-board-column-order";let Kt=null;function bi(){if(Kt)return[...Kt];try{const e=localStorage.getItem(Yn);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const n=[];for(const a of s){if(typeof a!="string"||a.length===0)return[];n.includes(a)||n.push(a)}return n}catch{return[]}}function ji(e){Kt=[...e];try{localStorage.setItem(Yn,JSON.stringify(e))}catch{}}function vi(e,s,n){const a=e.filter(i=>i!==s),r=Math.max(0,Math.min(n,a.length));return a.splice(r,0,s),a}function yi(e,s=[]){const n=new Map;for(const o of e){const c=n.get(o.status)??[];c.push(o),n.set(o.status,c)}const a=Ht.map(o=>({status:o,projects:n.get(o)??[]}));for(const o of Wt){const c=n.get(o)??[];c.length>0&&a.push({status:o,projects:c})}for(const[o,c]of n)!Wt.includes(o)&&!Ht.includes(o)&&a.push({status:o,projects:c});if(s.length===0)return a;const r=new Map(s.map((o,c)=>[o,c])),i=a.filter(o=>r.has(o.status));i.sort((o,c)=>(r.get(o.status)??0)-(r.get(c.status)??0));const l=a.filter(o=>!r.has(o.status));return[...i,...l]}function zn(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const n=he(e.target_date);return n===null?!1:n<s}function G(e){return e.title||e.name}const hs="No team";function ut(e){const s=e.team?.trim();if(s)return s;const n=e.owner?.trim();return n||null}function ps(e,s){const n=new Map,a=[];for(const i of e){const l=s(i);if(l===null){a.push(i);continue}const o=n.get(l);o?o.push(i):n.set(l,[i])}const r=[...n.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return a.length>0&&r.push({team:null,items:a}),r}function Ot(e){return e.title||e.session_id}function ki(e){return[...e].reverse()}function wi(e){return e<=0?"":e===1?"1 update":`${e} updates`}const Fs=e=>String(e).padStart(2,"0");function Gt(e){return`${e.getFullYear()}-${Fs(e.getMonth()+1)}-${Fs(e.getDate())}`}function Ni(e){const s=Date.parse(e);return Number.isNaN(s)?"":Gt(new Date(s))}function Si(e,s,n=new Date){if(!e)return"";if(e===Gt(n))return"Today";const a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);return e===Gt(a)?"Yesterday":_e(e,s,n)}function Ti(e,s){const n=Date.parse(e);return Number.isNaN(n)?"":new Date(n).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit"})}function _i(e,s){const n=Date.parse(e);return Number.isNaN(n)?"":dt(ct(n/1e3,s))}function Ci(e,s,n=Date.now()){const a=[],r=Mn(e.by);r&&a.push({key:"author",text:r});const i=Ti(e.at,s);i&&a.push({key:"time",text:i});const l=_i(e.at,n);return l&&a.push({key:"age",text:l}),a}function Ei(e,s,n=new Date){const a=[];for(const r of ki(e)){const i=Ni(r.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(r);continue}a.push({key:i,label:Si(i,s,n),entries:[r]})}return a}function Ri(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 Di(e,s){return s<=0?"":`${e} of ${s} complete`}function Ai(e){let s=0,n=0,a=!1;for(const r of e)r.todos&&(a=!0,s+=r.todos.open,n+=r.todos.total);return a?{open:s,total:n}:null}function qs(e){return`${e.open} open of ${e.total}`}function Oi(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function $i(e){const s=G(e),n=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${n}`,"Review the project details and continue or complete the work."].join(`
|
|
32
|
+
`)}function Pi(e){return e?e.kind==="team"?`team ${e.name}`:`agent ${e.name}`:""}const Mi=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Hn(e){const s=[];for(const n of e.matchAll(Mi))s.push((n[1]??n[2]??"").replace(/\\(.)/g,"$1"));return s}const bt=3;function xs(e){if(e.length<=bt+1)return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;const s=e.length-bt;return`${e.slice(0,bt).join(", ")} and ${s} more`}function gs(e){return`${e} milestone${e===1?" is":"s are"}`}const Us="complete them, or pass force_done=true to close with them open",Ii="complete or remove the incomplete milestones, then mark it done",Wn=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function mt(e){const s=e.match(Wn);if(s){const n=Number(s[1]),a=Hn(s[2]),r=a.length>0?xs(a):s[2];return`This can't be marked done yet: ${gs(n)} still incomplete (${r}). Complete or remove the incomplete milestones, then mark it done.`}return e.includes(Us)?e.replace(Us,Ii):e}const Li="project_done_incomplete";function Fi(e){const s=e.message.match(Wn),n=e.code===Li;if(!n&&!s)return null;const a=typeof e.detail=="object"&&e.detail!==null&&Array.isArray(e.detail.incomplete)?e.detail.incomplete.filter(l=>typeof l=="string"):null,r=a&&a.length>0?a:s?Hn(s[2]):[];return{count:r.length>0?r.length:s?Number(s[1]):0,names:r,coded:n,message:e.message}}function qi(e){if(e.count>0){const s=xs(e.names);return`${gs(e.count)} still open${s?` (${s})`:""}.`}return mt(e.message)||"Some milestones are still open."}function Ui(e){return e.count>0&&e.names.length>0?`This can't be marked done yet: ${gs(e.count)} still incomplete (${xs(e.names)}). Complete or remove the incomplete milestones, then mark it done.`:mt(e.message)||"Milestones are still open on this project. Complete or remove them, then mark it done."}function Kn(e,s,n){if(!e||e.forced_done!==!0)return`Moved to ${n}`;const a=typeof e.milestones_total=="number"&&typeof e.milestones_completed=="number"?e.milestones_total-e.milestones_completed:s,r=a>0?a:s;return`Moved to ${n} with ${r} milestone${r===1?"":"s"} still open`}const Bi="The project was not moved. Try again, or open it to change its status.";function Gn(e){return e.trim().slice(0,Ia)}const Yi={client:"Searches names, descriptions, tags, owners and teams. Update text is not searched. Clearing the search and filters restores the list.",backend:"Searches names, descriptions, tags, owners, teams and update text. Clearing the search and filters restores the list."},zi=2,Hi=4,Wi=3,Ki=2,Gi=1,Vi=3,Re={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},Qi=/[^\p{L}\p{N}]+/u,Xi=/\s+/;function Bs(e,s){const n=s.trim().toLowerCase();if(!n)return 0;if(n===e)return Hi;if(n.startsWith(e))return Wi;const a=n.split(Qi).filter(Boolean),r=e.split(Xi).filter(Boolean);if(r.length>0&&r.every(l=>a.some(o=>o.startsWith(l))))return Ki;const i=r.join("");return i.length>=Vi&&Ji(i,n)?Gi:0}function Ji(e,s){let n=0;for(const a of e){if(n=s.indexOf(a,n),n<0)return!1;n+=1}return!0}function Zi(e,s){const n=s.trim().toLowerCase();if(!n)return 0;const a=[[e.title,Re.title],[e.name,Re.name],[e.description,Re.description],[e.owner,Re.attribution],[e.team,Re.attribution],[e.status,Re.status]];let r=0;for(const[i,l]of a){if(!i)continue;const o=Bs(n,i)*l;o>r&&(r=o)}for(const i of e.tags){const l=Bs(n,i)*Re.tags;l>r&&(r=l)}return r}function eo(e,s){const n=s.trim();if(!n)return e;const a=[];for(const r of e){const i=Zi(r,n);i>0&&a.push({project:r,score:i})}return a.sort((r,i)=>{if(r.score!==i.score)return i.score-r.score;if(r.project.updated_at!==i.project.updated_at)return i.project.updated_at-r.project.updated_at;const l=G(r.project).localeCompare(G(i.project),void 0,{sensitivity:"base"});if(l!==0)return l;const o=r.project.name.localeCompare(i.project.name,void 0,{sensitivity:"base"});return o!==0?o:r.project.id<i.project.id?-1:r.project.id>i.project.id?1:0}),a.map(r=>r.project)}function to(e,s){if(s.length===0)return[];const n=new Map(e.map(r=>[r.id,r])),a=[];for(const r of s){const i=n.get(r.id);i!==void 0&&a.push(i)}return a}const so=180;function no(e,s){const n=Gn(e),a=_n(n,so),r=is({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>ce({op:"projects.search",q:a,limit:La}),retry:!1,staleTime:3e4}),i=a===n,l=i&&r.data&&r.data.query===n?r.data:null,o=i&&n.length>0&&!l&&r.isError;return{answer:l,pending:s&&n.length>0&&!l&&!o}}const Ve=["status","team","owner","tags","progress","target","estimate","milestones","live"],Ys={status:[],team:[],owner:[],tags:[],progress:[],target:[],estimate:[],milestones:[],live:[]},nt={status:"Status",team:"Team",owner:"Owner",tags:"Tags",progress:"Progress",target:"Target date",estimate:"Estimate",milestones:"Milestones",live:"Live sessions"},ao=new Set(["status","progress","target","estimate","milestones","live"]),ro={progress:["stale","up-to-date","not-reported"],target:["none","overdue","within-7","within-30"],estimate:["none","points","days"],milestones:["none","incomplete","complete"],live:["has-live","no-live"]},io={stale:"Stale","up-to-date":"Up to date","not-reported":"Not reported",none:"No target date",overdue:"Overdue","within-7":"Due within 7 days","within-30":"Due within 30 days",points:"Points",days:"Days",incomplete:"Incomplete",complete:"Complete","has-live":"Has live sessions","no-live":"No live sessions"};function Vn(e,s){switch(e){case"status":return Z(s).label;case"team":return s===null?"No team":s;case"owner":return s===null?"No owner":s;case"tags":return s??"";case"estimate":if(s==="none")return"No estimate";break;case"milestones":if(s==="none")return"None set";break;case"target":if(s==="none")return"No target date";break}return io[s]??s??""}function oo(e,s){return e[s].length>0}function rt(e){return Ve.every(s=>!oo(e,s))}function lo(e){return Ve.reduce((s,n)=>s+e[n].length,0)}function Qn(e,s,n){const a=e[s],r=a.includes(n)?a.filter(i=>i!==n):[...a,n];return{...e,[s]:r}}function Xn(e,s,n,a){switch(e){case"status":return s.status===n;case"team":return ut(s)===n;case"owner":return(s.owner?.trim()||null)===n;case"tags":return s.tags.includes(n??"");case"progress":return n==="stale"?s.progress_stale===!0:n==="up-to-date"?s.progress_stale===!1:s.progress_updated_at===null;case"target":{if(n==="none")return he(s.target_date)===null;if(n==="overdue")return zn(s,a);const r=he(s.target_date);if(r===null)return!1;const i=(r-a)/Fe;return n==="within-7"?i>=0&&i<=7:i>=0&&i<=30}case"estimate":return n==="none"?s.estimate===null:s.estimate===null?!1:n==="points"?s.estimate_unit==="points":s.estimate_unit==="days";case"milestones":return n==="none"?s.milestones_total===0:s.milestones_total===0?!1:n==="complete"?s.milestones_completed>=s.milestones_total:s.milestones_completed<s.milestones_total;case"live":return n==="has-live"?s.live_sessions>0:s.live_sessions===0}}function Jn(e,s,n,a){const r=e[s];return r.length===0?!0:r.some(i=>Xn(s,n,i,a))}function co(e,s,n){return rt(s)?e:e.filter(a=>Ve.every(r=>Jn(s,r,a,n)))}function uo(e,s,n,a){return s.filter(r=>Ve.every(i=>i===e||Jn(n,i,r,a)))}function mo(e,s,n){const a=n[e];switch(e){case"status":{const i=[...new Set(s.map(o=>o.status))].filter(o=>!Le.includes(o)).sort((o,c)=>o.localeCompare(c,void 0,{sensitivity:"base"})),l=a.filter(o=>typeof o=="string"&&!Le.includes(o)&&!i.includes(o));return[...Le,...i,...l]}case"team":{const r=new Set;let i=!1;for(const o of s){const c=ut(o);c===null?i=!0:r.add(c)}for(const o of a)o===null?i=!0:r.add(o);const l=[...r].sort((o,c)=>o.localeCompare(c,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"owner":{const r=new Set;let i=!1;for(const o of s){const c=o.owner?.trim();c?r.add(c):i=!0}for(const o of a)o===null?i=!0:r.add(o);const l=[...r].sort((o,c)=>o.localeCompare(c,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"tags":{const r=new Set;for(const i of s)for(const l of i.tags)r.add(l);for(const i of a)r.add(i??"");return[...r].sort((i,l)=>i.localeCompare(l,void 0,{sensitivity:"base"}))}case"progress":case"target":case"estimate":case"milestones":case"live":return ro[e]}}function Zn(e,s,n,a){const r=uo(e,s,n,a),i=ao.has(e),l=[];for(const o of mo(e,r,n)){const c=n[e].includes(o),m=r.reduce((u,h)=>u+(Xn(e,h,o,a)?1:0),0);!i&&m===0&&!c||l.push({value:o,label:Vn(e,o),count:m,selected:c})}return{facet:e,label:nt[e],options:l}}function fo(e,s,n){return Ve.map(a=>Zn(a,e,s,n))}const Vt="projects-sort",ho="Default (as listed)";function po(e){return xo.includes(e)}const xo=["name","status","target","estimate","milestones","live","progress"];function go(){try{const e=localStorage.getItem(Vt);if(e===null)return null;const[s,n,...a]=e.split(":");if(a.length>0)return null;if(s&&po(s)&&(n==="asc"||n==="desc"))return{key:s,direction:n}}catch{}return null}function bo(e){try{e===null?localStorage.removeItem(Vt):localStorage.setItem(Vt,`${e.key}:${e.direction}`)}catch{}}function We(e){switch(e){case"name":return"Project";case"status":return"Status";case"target":return"Target";case"estimate":return"Estimate";case"milestones":return"Milestones";case"live":return"Live";case"progress":return"Progress"}}function It(e){return e==="target"||e==="progress"?"desc":"asc"}function bs(e,s){const n=s==="desc";switch(e){case"name":return n?"Z to A":"A to Z";case"status":return n?"Archived first":"Planning first";case"target":return n?"latest first":"soonest first";case"estimate":return n?"days first":"points first";case"milestones":return n?"most complete first":"least complete first";case"live":return n?"most first":"fewest first";case"progress":return n?"most recent first":"most stale first"}}function jo(e){return e===null?"Sort cleared.":`Sorted by ${We(e.key)}, ${bs(e.key,e.direction)}.`}function vo(e){const s=[e.search?"search":null,e.filters?"filters":null,e.sort?"sort":null].filter(a=>a!==null);if(s.length===0)return"";const n=s.length===1?`${s[0]} cleared.`:`${s.slice(0,-1).join(", ")} and ${s[s.length-1]} cleared.`;return n.charAt(0).toUpperCase()+n.slice(1)}function zs(e,s){switch(e){case"name":return 0;case"status":return Le.includes(s.status)?0:1;case"target":return Qt(s)===null?1:0;case"estimate":return s.estimate===null?1:0;case"milestones":return s.milestones_total===0?1:0;case"live":return 0;case"progress":return s.progress_updated_at===null?1:0}}function Qt(e){return he(e.completed_at??e.target_date)}function Hs(e){return e==="points"?0:e==="days"?1:2}function yo(e,s,n){switch(e){case"name":return G(s).localeCompare(G(n),void 0,{sensitivity:"base"});case"status":return Le.indexOf(s.status)-Le.indexOf(n.status);case"target":{const a=Qt(s)??0,r=Qt(n)??0;return a-r}case"estimate":{const a=Hs(s.estimate_unit)-Hs(n.estimate_unit);return a!==0?a:(s.estimate??0)-(n.estimate??0)}case"milestones":return s.milestones_completed*n.milestones_total-n.milestones_completed*s.milestones_total;case"live":return s.live_sessions-n.live_sessions;case"progress":return(s.progress_updated_at??0)-(n.progress_updated_at??0)}}function Ws(e,s){if(e.updated_at!==s.updated_at)return s.updated_at-e.updated_at;const n=G(e).localeCompare(G(s),void 0,{sensitivity:"base"});if(n!==0)return n;const a=e.name.localeCompare(s.name,void 0,{sensitivity:"base"});return a!==0?a:e.id<s.id?-1:e.id>s.id?1:0}function ko(e,s,n){const a=zs(n.key,e),r=zs(n.key,s);if(a!==r)return a-r;if(a===1)return Ws(e,s);const i=yo(n.key,e,s);return i!==0?n.direction==="desc"?-i:i:Ws(e,s)}function wo(e,s){return[...e].sort((n,a)=>ko(n,a,s))}const Se=["day","week","month","quarter"],js={day:24,week:9,month:3,quarter:1};function vs(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function De(e,s){return Math.round((s-e)/Fe)}function Ks(e,s){return De(e,s)+1}function No(e,s){for(const n of Se)if(e*js[n]<=s)return n;return Se[Se.length-1]}function So(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(n=>!!n.target_date)}function To(e,s){const n=[s];for(const a of e){for(const r of[a.project.start_date,a.project.target_date,a.project.completed_at]){const i=he(r);i!==null&&n.push(i)}for(const r of a.milestones){const i=he(r.target_date);i!==null&&n.push(i)}}return n.length===1?null:{startMs:Math.min(...n),endMs:Math.max(...n)}}function _o(e){const s=[],n=[];for(const a of e)(So(a)?s:n).push(a);return{dated:s,undated:n}}function Co(e){return`${e} project${e===1?"":"s"} without dates`}function Eo(e){const{project:s}=e,n=he(s.start_date),a=he(s.target_date),r=he(s.completed_at),i=s.status==="done"&&r!==null?r:a,l=n??i,o=i??n;return l===null||o===null?null:{fromMs:Math.min(l,o),toMs:Math.max(l,o)}}function Ro(e){const s=[];for(const n of e.milestones){const a=he(n.target_date);a!==null&&s.push({name:n.name,dayMs:a,status:n.status})}return s}const gt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function de(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Do(e){const{year:s,month:n}=de(e);return Date.UTC(s,n-1,1)}function Ao(e){const{year:s,month:n}=de(e);return n===12?Date.UTC(s+1,0,1):Date.UTC(s,n,1)}function Oo(e){const{year:s,month:n}=de(e);return Date.UTC(s,Math.floor((n-1)/3)*3,1)}function $o(e){const{year:s,month:n}=de(e),a=Math.floor((n-1)/3);return a===3?Date.UTC(s+1,0,1):Date.UTC(s,a*3+3,1)}function Po(e){const{weekday:s}=de(e);return e-(s+6)%7*Fe}const Mo=26;function Io(e,s,n){const a=[],r=(u,h,b)=>{u<e||u>s||a.push({dayMs:u,label:h,major:b})};if(n==="day"){let u=!1;for(let h=e;h<=s;h+=Fe){const{day:b,month:f}=de(h);b===1?(r(h,gt[f-1],!0),u=!0):u?(r(h,"",!1),u=!1):r(h,String(b),!1)}return a}if(n==="week"){for(let u=Po(e);u<=s;u+=7*Fe){if(u<e)continue;const{day:h,month:b}=de(u);de(u-7*Fe).month!==b?r(u,`${gt[b-1]} ${h}`,!0):r(u,String(h),!1)}return a}const i=n==="month"?Do:Oo,l=n==="month"?Ao:$o,o=u=>{const{year:h,month:b}=de(u);if(n==="month")return b===1&&h!==de(e).year?`${gt[0]} '${String(h%100).padStart(2,"0")}`:gt[b-1];const f=Math.floor((b-1)/3)+1;return f===1&&h!==de(e).year?`Q1 '${String(h%100).padStart(2,"0")}`:`Q${f}`};r(e,o(i(e)),!0);const c=Math.ceil(Mo/js[n]);let m=e;for(let u=l(i(e));u<=s;u=l(u))De(m,u)<c||(r(u,o(u),!0),m=u);return a}function it(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}const kt=80,wt=80,Gs=64,Vs=8;function Xt(e){return e.trim().length>kt?`Titles are at most ${kt} characters.`:null}function ea(e){return e.length>qe?`Keep the description within ${qe} characters.`:null}function Nt(e,s){return e.trim().length>wt?`${s==="owner"?"Owners":"Teams"} are at most ${wt} characters.`:null}function Jt(e){return Pn.test(e)?null:"Dates are YYYY-MM-DD, or empty."}function Zt(e,s){return e&&s&&s<e?"The target date is before the start date.":null}function ta(e){const s=e.trim();if(s==="")return null;const n=Number(s);return!Number.isFinite(n)||!(n>0)||n>1e3?"Estimates are greater than 0 and at most 1000.":null}function es(e){const s=it(e);if(s.length>Vs)return{tags:s,error:`Up to ${Vs} tags.`};for(const n of s){const a=Fa(n);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const Lo="project_name_exists";function Qs(e){return e.code===Lo?"A project with this key already exists.":mt(e.message)||"The project was not saved."}function Fo(e,s){if(e.unit!==s.unit)return!1;const n=e.number.trim(),a=s.number.trim();return a===""?!0:n===""?!1:Number(n)===Number(a)}function qo(e,s){const n=it(s);return n.length!==e.length?!1:n.every((a,r)=>a===e[r])}function Uo(e,s){const n={},a=s.number.trim();if(a!==""){const r=Number(a);(e.estimate===null||e.estimate!==r)&&(n.estimate=r)}return s.unit!==e.unit&&(n.estimate_unit=s.unit),Object.keys(n).length>0?n:null}function Qe(e){return e instanceof Ct?Qs({code:e.code,message:e.message}):Qs({message:e instanceof Error?e.message:""})}function sa(e){return e instanceof Ct&&(e.code==="project_not_found"||e.status===404)}function na(e){return!(e instanceof Error)||!e.message?Bi:sa(e)?"This project could not be found. It may have been deleted.":Qe(e)}function aa(e){if(!(e instanceof Error))return null;const s=e instanceof Ct?e:null;return Fi({code:s?.code??null,message:e.message,detail:s?.detail})}async function Bo(e){try{return await e.move(),{kind:"accepted"}}catch(s){const n=aa(s);return n?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:n}:{kind:"spoken",copy:n?Ui(n):na(s),refusal:n}}}const Yo="Shows projects last updated within this window; older ones are hidden.",zo=({value:e,onChange:s})=>t.jsxs(Be,{value:e,onValueChange:n=>s(n),children:[t.jsx(ls,{content:e==="all"?null:Yo,side:"bottom",disableHoverableContent:!0,children:t.jsx(Ye,{"aria-label":"Projects updated within",className:$("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(ze,{})})}),t.jsx(He,{children:At.map(n=>t.jsx(Te,{value:n.value,children:n.label},n.value))})]}),ts=6e4,ss=6e3,Xs="Requesting updates…",Ho=400,Wo="Ask the sessions linked to this project to post a progress update",Ko="linked but not yet in use — it becomes a recipient after the first message",Js=e=>`project-request-update-${e}`,Go=e=>`project-request-cooldown-${e}`,Vo=e=>`project-request-update-cooldown-${e}`,Lt=e=>e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]}, ${e[1]} and ${e.length-2} more`,Zs=(e,s)=>e.sessions.filter(n=>n.outcome===s).map(n=>Ot({session_id:n.session_id,title:n.title})),Qo=e=>e.outcome==="failed"&&e.detail===Ko;function St(e,s){const n=Math.max(1,Math.ceil(s/1e3));return`Update already requested ${Math.max(0,Math.ceil(ts/1e3)-n)} s ago on ${e}. Try again in ${n} s.`}function Xo(e){const s=G({title:e.project.title,name:e.project.key}),{delivered:n,unconfirmed:a,failed:r,total:i}=e.counts;if(e.state==="empty")return{variant:"info",title:`No linked sessions to ask. Link a session to ${s} first.`,duration:ss};if(e.state==="cooldown")return{variant:"info",title:St(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:ss};if(e.state!=="sent")return null;const l=Zs(e,"failed"),o=Zs(e,"unconfirmed");if(n>=1&&r===0&&a===0)return{variant:"success",title:n===1?`Requested an update from 1 session on ${s}.`:`Requested updates from ${n} sessions on ${s}.`};if(n>=1){let c=`Requested updates from ${n} of ${i} sessions on ${s}.`;return r>0&&(c+=` ${Lt(l)} could not be reached.`),a>0&&(c+=` Delivery to ${Lt(o)} could not be confirmed.`),{variant:"warning",title:c,duration:Number.POSITIVE_INFINITY}}if(r===0)return{variant:"warning",title:`Could not confirm delivery on ${s} — the requests may still reach its sessions.`,duration:Number.POSITIVE_INFINITY};if(a===0){const c=e.sessions.every(Qo);let m;return c?m=i===1?"The linked session has not started yet — it becomes a recipient after its first message.":`The ${i} linked sessions have not started yet — they become recipients after their first message.`:m=`Could not reach any of the ${i} linked sessions on ${s}.`,{variant:"error",title:m,duration:Number.POSITIVE_INFINITY}}return{variant:"warning",title:`Could not reach ${r} of the ${i} linked sessions on ${s}. Delivery to ${Lt(o)} could not be confirmed.`,duration:Number.POSITIVE_INFINITY}}const st=new Map,ys=new Set,Ft=new Map,ns=new Set;let ra=0;const Tt=()=>{ra+=1;for(const e of ns)e()},Jo=e=>(ns.add(e),()=>{ns.delete(e)}),en=()=>ra,ia=e=>ys.has(e),oa=e=>st.get(e);function Zo(e){ys.add(e),Tt()}function el(e){ys.delete(e),Tt()}function tn(e,s,n){const a=Date.now();if(n<=a)return;const r=st.get(e);if(r&&r.untilMs>=n)return;st.set(e,{startedMs:s,untilMs:n});const i=Ft.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Ft.delete(e);const o=st.get(e);o&&o.untilMs<=Date.now()&&(st.delete(e),Tt())},n-a);l.unref?.(),Ft.set(e,l),Tt()}const tl=e=>/[.!?…]$/.test(e)?e:`${e}.`;function sl(e,s){const n=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;tn(e,n-(ts-a),n+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&tn(e,n,n+ts)}async function nl(e){const s=e.id;if(ia(s)){Es(Xs,{id:Js(s)});return}const n=Date.now(),a=oa(s);if(a&&a.untilMs>n){Rs(St(G(e),a.untilMs-n),{id:Go(s),duration:ss});return}Zo(s);const r=Js(s);let i=!1;const l=setTimeout(()=>{i=!0,Es(Xs,{id:r})},Ho);try{const o=await ce({op:"projects.request_update",key:s});sl(s,o);const c=Xo(o);if(c){const m={id:r,...c.duration!==void 0?{duration:c.duration}:{}};switch(c.variant){case"success":ye(c.title,m);break;case"warning":qa(c.title,m);break;case"error":Ds(c.title,m);break;default:Rs(c.title,m)}}else i&&Ua(r)}catch(o){const c=o instanceof Error&&o.message.trim()!==""?o.message.trim():null;Ds(c?`Could not request updates: ${tl(c)}`:"The request could not be confirmed.",{id:r,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),el(s)}}function la(){return d.useCallback(e=>{nl(e)},[])}function al(e){d.useSyncExternalStore(Jo,en,en);const s=ia(e),n=oa(e),a=n!==void 0?n.untilMs-Date.now():0,r=a>0;return{sending:s,cooling:r,cooldownRemainingMs:r?a:null}}const sn={active:"In flight",paused:"On hold",done:"Finished"};function rl(){const[e,s]=d.useState(null);return d.useEffect(()=>{if(!e)return;const n=document.querySelector(`[data-project-menu="${e}"]`);n&&(n.focus(),s(null))}),d.useCallback(n=>s(n),[])}const il=4,qt="Drag the header, or press the arrow keys, to move this column.",nn="board-column-move-hint",ol=({projects:e,nowMs:s,onOpen:n,onEdit:a,onDelete:r,onMove:i,movingKeys:l=[],teamLabelFor:o=c=>c})=>{const[c,m]=d.useState(bi),u=yi(e,c),h=ps(e,ut),[b,f]=d.useState(null),[w,v]=d.useState(""),g=d.useRef(null),x=d.useRef(null),j=d.useRef(null),y=d.useRef(null),E=d.useRef(null),O=new Set(l),_=(k,N)=>{const C=vi(u.map(I=>I.status),k,N);m(C),ji(C),v(`Moved ${Z(k).label} column to position ${C.indexOf(k)+1} of ${C.length}.`)},T=(k,N)=>{const C=g.current;if(!C)return 0;let I=0;const F=C.querySelectorAll("[data-board-column]");for(const q of F){if(q.dataset.boardColumn===N)continue;const ae=q.getBoundingClientRect();k>(ae.left+ae.right)/2&&(I+=1)}return I},M=(k,N)=>{const C=u.filter(q=>q.status!==k),I=C[N-1]?.status,F=C[N]?.status;return I&&F?`between ${Z(I).label} and ${Z(F).label}`:F?`before ${Z(F).label}`:I?`after ${Z(I).label}`:"in place"},p=(k,N)=>{const C=T(k,N.status);C!==N.over&&(N.over=C,f({status:N.status,over:C}),v(`Moving ${Z(N.status).label} column; it will drop ${M(N.status,C)}.`))},R=()=>{y.current!==null&&(cancelAnimationFrame(y.current),y.current=null)},D=32,P=12,Y=()=>{y.current=null;const k=E.current,N=g.current,C=j.current;if(!k?.armed||!N||C===null)return;const I=N.getBoundingClientRect(),F=N.scrollWidth-N.clientWidth;let q=0;if(C-I.left<D&&N.scrollLeft>0?q=-1:I.right-C<D&&N.scrollLeft<F&&(q=1),q!==0){const ae=N.scrollLeft;N.scrollLeft=ae+q*P,N.scrollLeft!==ae&&p(C,k)}else p(C,k);Q(k.status,k.over),y.current=requestAnimationFrame(Y)};d.useEffect(()=>()=>{y.current!==null&&cancelAnimationFrame(y.current)},[]);const L=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}E.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:u.findIndex(C=>C.status===N)},j.current=k.clientX}},B=k=>{const N=E.current;if(!(!N||k.pointerId!==N.pointerId)){if(j.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<il)return;N.armed=!0,f({status:N.status,over:N.over}),v(`Moving ${Z(N.status).label} column.`),y.current===null&&(y.current=requestAnimationFrame(Y))}p(k.clientX,N)}},W=k=>{const N=E.current;if(E.current=null,R(),f(null),!N?.armed)return;if(!k){v("Move cancelled.");return}const C=u.findIndex(I=>I.status===N.status);if(N.over===C){v("");return}_(N.status,N.over)},V=k=>{const N=E.current;!N||k.pointerId!==N.pointerId||W(!0)},oe=()=>{W(!1)};d.useEffect(()=>{if(!b)return;const k=N=>{N.key==="Escape"&&W(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[b!==null]);const Q=d.useCallback((k,N)=>{const C=g.current,I=x.current;if(!C||!I)return;const F=C.getBoundingClientRect(),q=[];for(const re of C.querySelectorAll("[data-board-column]"))re.dataset.boardColumn!==k&&q.push(re.getBoundingClientRect());const ae=6,Ce=N>=q.length?(q[q.length-1]?.right??F.left)+ae:(q[N]?.left??F.right)-ae,z=C.scrollLeft,we=2,xe=Ce-F.left+z,me=z+1,J=z+F.width-we-1,Ee=Math.round(Math.min(Math.max(xe,me),Math.max(me,J)));I.style.left=`${Ee}px`},[]);d.useLayoutEffect(()=>{b&&Q(b.status,b.over)},[b,Q]);const X=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(qt);return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const C=u.map(q=>q.status),I=C.indexOf(N),F=k.key==="ArrowLeft"?I-1:I+1;if(F<0||F>=C.length){v(`${Z(N).label} column is already ${F<0?"the first column":"the last column"}.`);return}_(N,F)};return t.jsxs("div",{className:"[container-type:size] 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:w}),t.jsx("span",{id:nn,className:"sr-only",children:qt}),t.jsxs("div",{ref:g,"data-board-strip":"",className:$("relative flex min-h-0 flex-1 items-start overflow-auto px-6 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:x,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsxs("div",{className:"flex w-max flex-col",children:[t.jsx("div",{className:"sticky top-0 z-30 flex gap-3",children:u.map(k=>{const N=Z(k.status);return t.jsxs("header",{"data-board-column":k.status,"data-board-column-handle":k.status,onPointerDown:C=>L(C,k.status),onPointerMove:B,onPointerUp:V,onPointerCancel:oe,className:$("flex h-11 w-64 shrink-0 cursor-grab items-center justify-between gap-2 rounded-t-md bg-sunken px-3 active:cursor-grabbing",b?.status===k.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(U,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":k.status,"aria-label":`Move ${N.label} column`,"aria-describedby":nn,title:qt,className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:C=>X(C,k.status),children:t.jsx(Er,{"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:N.label}),sn[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:sn[k.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:k.projects.length})]},k.status)})}),h.map(k=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":k.team??"",className:"sticky top-11 z-20 flex h-8 items-center bg-canvas px-3 text-meta",children:t.jsxs("span",{className:"sticky left-3 flex min-w-0 max-w-[calc(100cqw-2.25rem)] items-center gap-2",children:[t.jsx("span",{className:"truncate text-ink",children:k.team==null?hs:o(k.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:k.items.length})]})}),t.jsx("div",{className:"flex gap-3 rounded-md bg-sunken py-2",children:u.map(N=>{const C=k.items.filter(I=>I.status===N.status);return t.jsx("div",{"data-board-cell":N.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:C.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:C.map(I=>t.jsx("li",{children:t.jsx(ll,{project:I,nowMs:s,busy:O.has(I.id),onOpen:()=>n(I),onEdit:()=>a(I),onDelete:()=>r(I),onMove:F=>i(I,F)})},I.id))})},N.status)})})]},k.team??""))]})]})]})},ll=({project:e,nowMs:s,busy:n,onOpen:a,onEdit:r,onDelete:i,onMove:l})=>{const o=Fn(e,typeof navigator>"u"?void 0:navigator.language),c=Ke(),m=la(),u=fe(c.data,"projects_request_update"),h=G(e),b=d.useRef(null),[f,w]=d.useState(!1);d.useEffect(()=>{const y=b.current;if(!y)return;const E=()=>{y.isConnected&&w(y.scrollWidth-y.clientWidth>.5)},O=requestAnimationFrame(E),_=new ResizeObserver(E);return _.observe(y),document.fonts?.ready.then(E).catch(()=>{}),()=>{cancelAnimationFrame(O),_.disconnect()}},[h,f]);const v=zn(e,vs(s)),g=ct(e.progress_updated_at,s),x=()=>{const y=window.getSelection();y&&!y.isCollapsed||a()},j=y=>{y.key!=="Enter"&&y.key!==" "||y.target===y.currentTarget&&(y.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":`Open ${h}`,onClick:x,onKeyDown:j,className:$("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",v&&"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(ls,{content:f?h:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:b,"data-project-title":e.name,tabIndex:f?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:h})}),e.title&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.name}),e.description&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.description})]}),t.jsxs(yn,{children:[t.jsx(kn,{"data-project-menu":e.id,"aria-label":`Actions for ${h}`,disabled:n,onClick:y=>y.stopPropagation(),className:$("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:n?t.jsx(ke,{size:"xs"}):t.jsx(Ba,{className:"size-4"})}),t.jsxs(wn,{align:"end",onClick:y=>y.stopPropagation(),children:[t.jsx(tt,{onSelect:a,children:"Open"}),t.jsxs(jr,{children:[t.jsx(vr,{children:"Set status"}),t.jsx(yr,{children:t.jsx(kr,{value:e.status,onValueChange:l,children:[...Ht,...Wt].map(y=>t.jsx(wr,{value:y,children:Z(y).label},y))})})]}),u&&t.jsx(tt,{onSelect:()=>m(e),children:"Request update"}),t.jsx(Nr,{}),t.jsx(tt,{onSelect:r,children:"Edit"}),t.jsx(tt,{onSelect:i,children:"Delete"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.filter(y=>y.key!=="live").map(y=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:y.text},y.key)),v&&t.jsx(pe,{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:ri(g)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!g)&&t.jsx("span",{"aria-label":yt,title:yt,className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(cl,{project:e})]})]})]})},cl=({project:e})=>{const[s,n]=d.useState(!1),a=Et(),r=Rn(e.id,s),i=r.data?.links??[],l=ci(e),o=G(e);return t.jsxs(cs,{open:s,onOpenChange:n,children:[t.jsx(ds,{"data-project-sessions":e.id,"aria-label":`Sessions linked to ${o}`,onClick:c=>c.stopPropagation(),className:$("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(us,{align:"end",className:"w-64 p-2 outline-none",onClick:c=>c.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(U,{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(c=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!c.exists,onClick:()=>{c.exists&&(n(!1),Cn(a,c.session_id))},className:$("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",c.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:c.title||c.session_id})})},c.session_id))})})]})},ca=({open:e,projectName:s,onClose:n,onConfirm:a})=>{const[r,i]=d.useState(""),[l,o]=d.useState(null),[c,m]=d.useState(!1),u=d.useId();d.useEffect(()=>{e&&(i(""),o(null),m(!1))},[e]);const h=r.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),o(null);try{await a(r.trim()),n()}catch(f){o(f instanceof Error&&f.message?f.message:"The project was not deleted.")}finally{m(!1)}};return t.jsx(lt,{open:e,onClose:n,title:"Delete this project?",dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{onClick:n,disabled:c,children:"Cancel"}),t.jsxs(Ya,{onClick:()=>void b(),disabled:!h||c,children:[c&&t.jsx(ke,{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(ne,{id:`${u}-confirm`,value:r,onChange:f=>i(f.target.value),placeholder:s,"aria-label":"Type the project name to confirm","aria-invalid":r.length>0&&!h,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function dl(e){return e==="editing"||e==="saving"||e==="error"}function ul(e,s,n=Object.is){return!n(e,s)}function ml(e,s){if(e.key==="Escape")return e.defaultPrevented===!0?null:"revert";if(e.key!=="Enter"||!s.keyboardCommit)return null;const n=e.metaKey===!0||e.ctrlKey===!0;return s.multiline?n?"accept":null:s.onEditor?"accept":null}function fl(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function hl(e){const{phase:s,base:n,draft:a,fresh:r,equals:i}=e;return s==="saving"||s==="saved"||i(n,r)?"none":s==="idle"||i(n,a)||i(r,a)?"adopt":"conflict"}function an(e,s,n=Object.is){return!n(e,s)}const ks="group/inline-edit",Ut="inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-xs text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink-muted",pl="relative before:absolute before:-inset-1.5 before:content-['']",xl="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",gl="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",as=({api:e,idle:s="affordance",className:n})=>{const{phase:a,labels:r}=e,i=a==="editing"||a==="saving"||a==="error",l=fl(a,e.dirty),o=e.acceptBlocked===!0;return t.jsx("span",{"data-inline-edit-slot":a,className:$("inline-flex shrink-0 items-center gap-0.5",n),children:l?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","data-inline-edit-control":"cancel","aria-label":a==="saving"?r.busy:r.cancel,title:a==="saving"?r.busy:r.cancel,"aria-disabled":a==="saving"||void 0,onMouseDown:c=>c.preventDefault(),onClick:c=>{c.detail>1||a!=="saving"&&e.cancel()},className:$(Ut,xl,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(Rt,{className:"size-3","aria-hidden":"true"})}),a==="saving"?t.jsx("span",{"data-inline-edit-control":"busy",className:"inline-flex size-5 shrink-0 items-center justify-center",children:t.jsx(ke,{size:"xs"})}):t.jsx("button",{type:"button","data-inline-edit-control":"accept","aria-label":a==="error"?r.retry??r.accept:r.accept,title:a==="error"?r.retry??r.accept:r.accept,"aria-disabled":o||void 0,onMouseDown:c=>c.preventDefault(),onClick:c=>{c.detail>1||o||e.accept()},className:$(Ut,gl,o&&"cursor-default text-ink-disabled"),children:t.jsx(ms,{className:"size-3","aria-hidden":"true"})})]}):i?null:s==="affordance"?t.jsx("button",{ref:e.slotRef,type:"button","data-inline-edit-control":"begin","aria-label":r.begin,title:r.begin,onClick:c=>{c.detail>1||e.begin()},className:$(Ut,pl,"opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","focus-visible:opacity-100"),children:t.jsx(za,{className:"size-3","aria-hidden":"true"})}):null})},bl="This changed while you were editing",jl="Keep mine",vl="Use theirs",rs=({api:e,className:s})=>{const{phase:n,error:a,conflict:r}=e;return n==="saved"?t.jsx("p",{"data-inline-edit-feedback":"saved",className:$("text-meta text-success",s),children:e.labels.saved}):!a&&!r?null:t.jsxs("div",{id:e.feedbackId,"data-inline-edit-feedback":a&&r?"error+conflict":a?"error":"conflict",role:"alert",className:$("flex flex-wrap items-center gap-x-3 gap-y-1",s),children:[a&&t.jsx("p",{className:"text-meta text-danger",children:a}),a&&r===null&&t.jsx("button",{type:"button","data-inline-edit-control":"retry",onClick:()=>e.accept(),className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:"Retry"}),r!==null&&t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-warning",children:bl}),t.jsx("button",{type:"button","data-inline-edit-control":"keep-mine",onClick:e.keepMine,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:jl}),t.jsx("button",{type:"button","data-inline-edit-control":"use-theirs",onClick:e.useTheirs,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:vl})]})]})},da=d.createContext(null),yl=50,kl=({children:e})=>{const[s,n]=d.useState(""),a=d.useMemo(()=>({current:r=>{n(""),window.setTimeout(()=>n(r),yl)}}),[]);return t.jsxs(da.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},wl=1200;function Nl(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function ft(e){const{value:s,multiline:n=!1,keyboardCommit:a=!0,selectAllOnBegin:r=!1,beginOnMount:i=!1,savedDwellMs:l=wl,labels:o}=e,c=d.useRef(e.equals??Object.is);c.current=e.equals??Object.is;const m=d.useRef(e.commit);m.current=e.commit;const u=d.useRef(e.validate);u.current=e.validate;const h=d.useRef(e.errorCopy);h.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const f=d.useRef(e.onBegin);f.current=e.onBegin;const w=d.useRef(o);w.current=o;const[v,g]=d.useState(i?"editing":"idle"),[x,j]=d.useState(s),[y,E]=d.useState(s),[O,_]=d.useState(null),[T,M]=d.useState(null),p=d.useRef(v),R=d.useRef(x),D=d.useRef(y),P=d.useRef(O),Y=d.useRef(s);Y.current=s;const L=d.useCallback(A=>{p.current=A,g(A)},[]),B=d.useCallback(A=>{R.current=A,j(A)},[]),W=d.useCallback(A=>{D.current=A,E(A)},[]),V=d.useCallback(A=>{P.current=A,_(A)},[]),oe=d.useRef(null),Q=d.useRef(null),X=d.useRef(null),k=e.editorRef??X,N=d.useRef(k);N.current=k;const C=`${d.useId()}-inline-edit`,I=d.useContext(da),F=d.useRef(null),q=F.current,Ce=q!==null&&(e.equals??Object.is)(s,q.previous)&&!(e.equals??Object.is)(s,q.saved)&&q!==null?q.saved:s,z=d.useRef(Ce);z.current=Ce,d.useEffect(()=>{const A=F.current;if(A===null)return;const te=c.current;(te(s,A.saved)||!te(s,A.previous))&&(F.current=null)},[s]);const we=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!we.current)return;we.current=!1;const A=N.current.current;A&&(A.focus(),r&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[v,r]);const xe=d.useRef(!1);d.useEffect(()=>{xe.current&&(v!=="idle"&&v!=="saved"||(xe.current=!1,Q.current?.focus()))});const me=d.useRef(null),J=d.useCallback(()=>{me.current!==null&&(clearTimeout(me.current),me.current=null)},[]);d.useEffect(()=>()=>J(),[J]);const Ee=d.useRef(v);d.useEffect(()=>{const A=Ee.current;if(Ee.current=v,A==="saving"&&v==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const A=hl({phase:p.current,base:D.current,draft:R.current,fresh:z.current,equals:c.current});A==="adopt"?(c.current(D.current,z.current)||W(z.current),c.current(z.current,R.current)||B(z.current)):A==="conflict"&&(P.current===null||!c.current(P.current,z.current))&&V(z.current)},[s,v,W,B,V]);const re=d.useCallback(A=>{V(null),M(null),B(D.current),L("idle"),A&&(xe.current=!0)},[V,B,L]),Xe=d.useCallback(()=>{p.current!=="saving"&&(p.current==="idle"||p.current==="saved"||(J(),re(!0)))},[J,re]),ee=d.useCallback((A,te=!0)=>{const et=p.current;if(et==="saving"||et==="saved"||P.current!==null)return;const ge=A!==void 0?A:R.current;if(!an(D.current,ge,c.current)){re(te&&et!=="idle");return}const pt=u.current?.(ge)??null;if(pt!==null){L("error"),M(pt);return}B(ge),M(null),L("saving"),m.current(ge).then(()=>{p.current==="saving"&&(F.current={saved:ge,previous:D.current},W(ge),B(ge),te&&(xe.current=!0),L("saved"),J(),me.current=setTimeout(()=>{me.current=null,p.current==="saved"&&L("idle")},l),I?.current?.(w.current.saved))},Me=>{p.current==="saving"&&(L("error"),M(h.current?h.current(Me):Nl(Me)))})},[I,J,re,l,W,B,L]),Ne=d.useCallback(()=>{p.current==="editing"||p.current==="saving"||(J(),we.current=!0,B(z.current),W(z.current),V(null),M(null),L("editing"),f.current?.())},[J,W,V,B,L]),Pe=d.useCallback(()=>{const A=P.current;A!==null&&(V(null),W(A),ee())},[ee,W,V]),Pt=d.useCallback(()=>{const A=P.current;A!==null&&(W(A),re(!0))},[re,W]),Je=d.useCallback(A=>{const te=ml(A,{multiline:n,keyboardCommit:a,onEditor:A.target===N.current.current});if(te==="revert"){A.preventDefault(),Xe();return}te==="accept"&&(A.preventDefault(),ee())},[ee,Xe,a,n]),Ze=d.useCallback(A=>{if(p.current!=="editing")return;const te=A.relatedTarget;if(!(te!==null&&oe.current?.contains(te))&&!(te instanceof Element&&te.closest("[data-radix-popper-content-wrapper]")!==null)&&P.current===null){if(!an(D.current,R.current,c.current)){re(!1);return}ee(void 0,!1)}},[ee,re]),ht=v==="saved"?x:Ce;return{phase:v,dirty:ul(y,x,c.current),conflict:O,error:T,draft:x,setDraft:B,displayValue:ht,editing:dl(v),begin:Ne,accept:ee,cancel:Xe,keepMine:Pe,useTheirs:Pt,handleKeyDown:Je,handleBlur:Ze,fieldProps:{onKeyDown:Je,onBlur:Ze,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":T!==null?!0:void 0,"aria-describedby":T!==null||O!==null?C:void 0},fieldRef:oe,editorRef:k,slotRef:Q,feedbackId:C,labels:o}}const Sl=/^(https?:|mailto:)/i,Tl={a:({href:e,children:s})=>typeof e=="string"&&Sl.test(e)?t.jsx("a",{href:e,target:"_blank",rel:"noreferrer",children:s}):t.jsx("span",{className:"font-mono text-mono-sm",children:s}),table:Wa},ot=d.memo(({children:e,className:s})=>t.jsx("div",{className:$("lo-markdown",s),children:t.jsx(Ha,{remarkPlugins:[Ka],components:Tl,children:e})})),rn=`## Summary
|
|
33
|
+
|
|
34
|
+
## Goals
|
|
35
|
+
|
|
36
|
+
## Notes`,_l=new RegExp("\\p{Mn}","gu"),Cl=/[^a-z0-9._-]+/g,El=/[._-]{2,}/g,Rl=/^[^a-z0-9]+/,on=/[^a-z0-9]+$/;function Dl(e){return e.normalize("NFKD").replace(_l,"").toLowerCase().replace(Cl,"-").replace(El,"-").replace(Rl,"").replace(on,"").slice(0,64).replace(on,"")}const Al=/&#x([0-9a-f]+);/gi,Ol=/&#(\d+);/g,$l=/ /g,Pl=/</g,Ml=/>/g,Il=/"/g,Ll=/'|'/g,Fl=/&/g,ln=e=>e.replace(Al,(s,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(Ol,(s,n)=>String.fromCodePoint(Number.parseInt(n,10))).replace($l," ").replace(Pl,"<").replace(Ml,">").replace(Il,'"').replace(Ll,"'").replace(Fl,"&"),ql=/<[^>]*>|[^<]+/g,Ul=/^<\//,Bl=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,Yl=/\s+/g,cn=/class="[^"]*language-([\w+-]+)/,zl=/href="([^"]*)"/,Hl=/src="([^"]*)"/,Wl=/alt="([^"]*)"/,Kl=/[ \t]+\n/g,Gl=/\n{3,}/g;function Vl(e){const s=[],n=(...m)=>{for(let u=s.length-1;u>=0;u--)if(m.includes(s[u].tag)){const[h]=s.splice(u,1);return h}},a=[],r=()=>s.some(m=>m.tag==="pre"),i=()=>s.filter(m=>m.tag==="blockquote").length;let l=!0;const o=m=>{m&&(i()>0&&l&&!r()&&a.push("> ".repeat(i())),a.push(m),l=m.endsWith(`
|
|
37
|
+
`))},c=e.match(ql)??[];for(let m=0;m<c.length;m++){const u=c[m];if(!u.startsWith("<")){o(r()?ln(u):ln(u).replace(Yl," "));continue}const h=Ul.test(u),b=(u.match(Bl)?.[1]??"").toLowerCase();if(h){switch(b){case"p":case"div":o(`
|
|
38
|
+
|
|
39
|
+
`);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":n(b),o(`
|
|
40
|
+
|
|
41
|
+
`);break;case"li":{n("li"),o(`
|
|
42
|
+
`);const f=[...s].reverse().find(w=>w.tag==="ul"||w.tag==="ol");f?.ordered&&(f.index=(f.index??1)+1);break}case"ul":case"ol":n(b),o(`
|
|
43
|
+
`);break;case"strong":case"b":n("strong","b")&&o("**");break;case"em":case"i":n("em","i")&&o("*");break;case"del":case"s":n("del","s")&&o("~~");break;case"code":{n("code")?.inline&&o("`");break}case"pre":n("pre")&&o("\n```\n\n");break;case"a":{const f=n("a");f?.href&&o(`](${f.href})`);break}case"blockquote":n("blockquote")&&o(`
|
|
44
|
+
`);break}continue}switch(b){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{const f=Number(b[1]);s.push({tag:b}),o(`${"#".repeat(f)} `);break}case"ul":case"ol":s.push({tag:b,ordered:b==="ol",index:1});break;case"li":{const f=[...s].reverse().find(w=>w.tag==="ul"||w.tag==="ol");s.push({tag:"li"}),f?.ordered?o(`${f.index??1}. `):o("- ");break}case"strong":case"b":s.push({tag:b}),o("**");break;case"em":case"i":s.push({tag:b}),o("*");break;case"del":case"s":s.push({tag:b}),o("~~");break;case"code":{const f=s[s.length-1]?.tag!=="pre";s.push({tag:"code",inline:f}),f&&o("`");break}case"pre":{const f=u.match(cn)?.[1]??c[m+1]?.match(cn)?.[1]??"";s.push({tag:"pre"}),o(`
|
|
45
|
+
\`\`\`${f}
|
|
46
|
+
`);break}case"a":{const f=u.match(zl)?.[1]??"";s.push({tag:"a",href:f}),f&&o("[");break}case"img":{const f=u.match(Hl)?.[1]??"",w=u.match(Wl)?.[1]??"";f&&o(``);break}case"br":o(`
|
|
47
|
+
`);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(Kl,`
|
|
48
|
+
`).replace(Gl,`
|
|
49
|
+
|
|
50
|
+
`).trim()}function ua(e,s,n){const a=e.clipboardData?.getData("text/html");if(!a)return;const r=Vl(a);if(!r)return;e.preventDefault();const i=e.currentTarget,l=i.selectionStart??i.value.length,o=i.selectionEnd??l;n(i.value.slice(0,l)+r+i.value.slice(o)),requestAnimationFrame(()=>{const c=s.current;if(!c)return;const m=l+r.length;c.setSelectionRange(m,m)})}const ma=({open:e,refusal:s,projectLabel:n,onClose:a,onConfirm:r,secondaryLabel:i,onSecondary:l})=>{const[o,c]=d.useState(!1),[m,u]=d.useState(null),h=d.useRef(!1),b=d.useRef(null);d.useEffect(()=>{e&&(c(!1),u(null),h.current=!1)},[e]);const f=async()=>{if(!h.current){h.current=!0,c(!0),u(null);try{await r(),a()}catch(v){u({copy:na(v),gone:sa(v)})}finally{h.current=!1,c(!1)}}},w=s?.names??[];return t.jsx(lt,{open:e,onClose:a,title:"Mark done with open milestones?",dataTourTag:"project-done-anyway-dialog",maxWidth:"xs",dialogProps:{closeDisabled:o,onEscapeKeyDown:v=>{o&&v.preventDefault()},onInteractOutside:v=>{o&&v.preventDefault()},onOpenAutoFocus:v=>{v.preventDefault(),b.current?.focus()}},actions:t.jsxs("div",{className:"flex w-full min-w-0 flex-wrap justify-end gap-2",children:[t.jsx(Ue,{ref:b,onClick:a,disabled:o,children:"Cancel"}),!m?.gone&&t.jsx(Ue,{onClick:l,disabled:o,children:i}),m?.gone?t.jsx(jt,{"data-project-force-close":"",onClick:a,children:"Close"}):t.jsxs(jt,{"data-project-force-done":"","aria-disabled":o,className:"aria-disabled:pointer-events-none aria-disabled:bg-sunken aria-disabled:text-ink-disabled",onClick:()=>void f(),children:[o?t.jsx(ke,{size:"xs"}):t.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0"}),"Mark done anyway"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink break-words",children:n?`${n} moves to Done and its milestones stay open.`:"The project moves to Done and its milestones stay open."}),t.jsx("p",{className:"text-body-sm text-ink break-words",children:s?qi(s):""}),w.length>bt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(bn,{summary:`Show all ${w.length} open milestones`,children:t.jsx("ul",{"data-project-open-milestones":"",className:"flex flex-col gap-1 py-1 text-body-sm text-ink-muted",children:w.map((v,g)=>t.jsx("li",{className:"break-words",children:v},`${g}-${v}`))})})}),t.jsx("p",{role:"alert",className:"min-h-[1lh] text-body-sm text-danger break-words",children:m?.copy??""})]})})},fa=({status:e})=>{const s=Z(e);return t.jsxs(pe,{variant:s.variant,children:[ti(e)&&t.jsx(ms,{"aria-hidden":!0}),s.label]})};function ue(e,s){return{name:s,begin:`Edit ${e}`,accept:`Save ${e}`,cancel:`Discard the ${e} edit`,busy:`Saving the ${e}`,saved:`${s} saved`,retry:`Retry saving the ${e}`}}const $t=({field:e,fieldRef:s,fieldProps:n,editing:a,label:r,bare:i=!1,display:l,editor:o,slot:c,feedback:m,controlsIdle:u="affordance",hug:h=!1,feedbackExtra:b,className:f,controlsClassName:w})=>t.jsxs("div",{ref:s,...n,"data-project-field":e,className:$(!i&&ks,"min-w-0",r!==void 0&&"flex items-start gap-3",f),children:[r!==void 0&&t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:r}),t.jsxs("div",{className:$("flex min-w-0 flex-col gap-1",h&&"items-start",r!==void 0&&"flex-1"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("div",{className:$("min-w-0",h?"w-fit":"flex-1",!a&&"cursor-text"),onDoubleClick:a?void 0:c.begin,children:a?o:l}),t.jsx(as,{api:c,idle:u,className:$("shrink-0",w)})]}),t.jsx("div",{className:$("min-h-[1lh] text-meta",h&&"max-w-96"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx(rs,{api:m}),b]})})]})]}),Ae=({field:e,value:s,display:n,commitFields:a,validate:r,labels:i,commit:l,placeholder:o,mono:c=!1,ramp:m="text-body-sm",label:u,bare:h=!1,autoBegin:b=!1,maxLength:f,onRetire:w,className:v,controlsClassName:g})=>{const[x,j]=d.useState(b);d.useEffect(()=>{x&&s!==""&&(j(!1),w?.("filled"))},[x,s,w]);const y=ft({value:s,commit:async E=>{await l(a(E))},equals:(E,O)=>E.trim()===O.trim(),validate:r,labels:i,selectAllOnBegin:!0,beginOnMount:b,errorCopy:Qe,onSettle:E=>{E==="cancelled"&&(j(!1),w?.("cancelled"))}});return!x&&s===""?null:t.jsx($t,{field:e,fieldRef:y.fieldRef,fieldProps:y.fieldProps,editing:y.editing,label:u,bare:h,display:n,slot:y,feedback:y,className:v,controlsClassName:g,editor:t.jsx(ne,{ref:y.editorRef,...y.editorAria,value:y.draft,readOnly:y.phase==="saving",maxLength:f,placeholder:o,"aria-label":i.name,onChange:E=>y.setDraft(E.target.value),spellCheck:!1,autoComplete:"off",className:$("h-8",c?"font-mono text-mono-sm":m)})})},Ql=({project:e,commit:s})=>{const n=e.title??"",[a,r]=d.useState(!1),i=d.useRef(null),l=o=>{r(!1),o==="cancelled"&&setTimeout(()=>i.current?.focus(),0)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:$(ks,"flex min-w-0 flex-col gap-0.5"),children:[n?t.jsx(Ae,{field:"title",value:n,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:n}),commitFields:o=>({title:o.trim()}),validate:o=>Xt(o),labels:ue("title","Title"),commit:s,maxLength:kt,placeholder:"A short name for the workstream",ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(Ae,{field:"key",value:e.name,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:e.name}),commitFields:o=>({name:o.trim()}),validate:o=>Yt(o.trim()),labels:ue("key","Key"),commit:s,maxLength:Gs,placeholder:"project-key",ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!n&&(a?t.jsx(Ae,{field:"title",value:"",display:null,commitFields:o=>({title:o.trim()}),validate:o=>Xt(o),labels:ue("title","Title"),commit:s,maxLength:kt,placeholder:e.name,ramp:"text-body-sm",bare:!0,autoBegin:!0,onRetire:l}):t.jsx("button",{ref:i,type:"button","data-project-add-title":"",onClick:()=>r(!0),className:$("w-fit cursor-pointer text-meta text-ink-dim","opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","hover:text-ink"),children:"Add a title"}))]}),n&&t.jsx(Ae,{field:"key",value:e.name,display:t.jsx("span",{className:"font-mono text-mono-sm text-ink-muted",children:e.name}),commitFields:o=>({name:o.trim()}),validate:o=>Yt(o.trim()),labels:ue("key","Key"),commit:s,maxLength:Gs,placeholder:"project-key",mono:!0})]})},Xl=({project:e,commit:s})=>{const[n,a]=d.useState(!1),r=Ke(),i=fe(r.data,"projects_force_done"),[l,o]=d.useState(null),[c,m]=d.useState(null),u=d.useRef(!1),h=d.useRef(!1),b=d.useRef(null),f=ft({value:e.status,commit:async g=>{const x=u.current;u.current=!1,o(null);try{const j=await s({status:g},x?{forceDone:!0}:void 0);x&&ye(Kn(j,l?.count??0,Z(g).label)),b.current?.resolve()}catch(j){throw o(aa(j)),b.current?.reject(j),j}finally{b.current=null}},labels:ue("status","Status"),keyboardCommit:!1,errorCopy:Qe,onBegin:()=>a(!0)}),w=i&&f.phase==="error"&&l!==null&&l.coded;d.useEffect(()=>{if(!h.current||f.phase!=="idle"&&f.phase!=="saved")return;h.current=!1;const g=document.querySelector("[data-project-milestones]");g&&(g.scrollIntoView({block:"start"}),g.querySelector("[data-project-milestones-heading]")?.focus({preventScroll:!0}))},[f.phase]);const v=()=>new Promise((g,x)=>{if(f.phase!=="error"||f.conflict!==null){x(new Error(""));return}if(!f.dirty){g();return}u.current=!0,b.current={resolve:g,reject:x},f.accept(f.draft,!0)});return t.jsx($t,{field:"status",fieldRef:f.fieldRef,fieldProps:f.fieldProps,editing:f.editing,display:t.jsx(fa,{status:e.status}),slot:f,feedback:f,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[w&&t.jsx(U,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>m(l),children:"Mark done anyway…"}),t.jsx(ma,{open:c!==null,refusal:c,projectLabel:G(e),onClose:()=>m(null),onConfirm:v,secondaryLabel:"Review milestones",onSecondary:()=>{m(null),h.current=!0,f.cancel()}})]}),editor:t.jsxs(Be,{open:n,onOpenChange:a,value:f.draft,onValueChange:g=>{a(!1),f.accept(g)},children:[t.jsx(Ye,{ref:f.editorRef,...f.editorAria,"aria-label":"Status","data-project-status":"",className:"h-7 w-fit min-w-36",children:t.jsx(ze,{})}),t.jsx(He,{children:$n.map(g=>t.jsx(Te,{value:g.value,"data-project-status-option":g.value,children:g.label},g.value))})]})})},Jl=({project:e,commit:s})=>{const[n,a]=d.useState(!1),r=d.useRef(null),i=d.useRef(null),l=ft({value:e.description,commit:async m=>{await s({description:m.trim()})},equals:(m,u)=>m.trim()===u.trim(),validate:m=>ea(m),multiline:!0,labels:ue("description","Description"),errorCopy:Qe,editorRef:r,onSettle:m=>{m==="cancelled"&&!e.description.trim()&&setTimeout(()=>i.current?.focus(),0)}});d.useEffect(()=>{if(n||!l.editing)return;const m=setTimeout(()=>r.current?.focus(),0);return()=>clearTimeout(m)},[n,l.editing]);const c=(l.editing?l.draft:l.displayValue).length>qe;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:$(ks,"min-w-0"),children:l.editing?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Description mode"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(m=>t.jsx("button",{type:"button","data-project-description-mode":m,"aria-pressed":n===(m==="preview"),onClick:()=>a(m==="preview"),className:$("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink",n===(m==="preview")&&"bg-surface text-ink"),children:m==="write"?"Write":"Preview"},m))})]}),t.jsx(as,{api:{...l,acceptBlocked:c}})]}),n?t.jsx("div",{"data-project-description-preview":"",className:"h-40 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:l.draft.trim()?t.jsx(ot,{className:"text-body-sm",children:l.draft}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Nothing to preview yet."})}):t.jsx(Nn,{ref:r,...l.editorAria,"data-project-description":"",value:l.draft,readOnly:l.phase==="saving",rows:8,placeholder:"Markdown — headings, lists, code.","aria-label":l.labels.name,onChange:m=>l.setDraft(m.target.value),onPaste:m=>ua(m,r,u=>l.setDraft(u)),className:"h-40 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(rs,{api:l}),t.jsxs("p",{className:$("shrink-0 text-meta tabular-nums",c?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",qe]})]})]}):t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[(e.description??"").trim()?t.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[t.jsx("div",{className:"min-w-0 flex-1 cursor-text",onDoubleClick:l.begin,children:t.jsx(ot,{className:"text-body",children:e.description??""})}),t.jsx(as,{api:l})]}):t.jsx("button",{ref:i,type:"button","data-project-add-description":"",onClick:l.begin,className:"w-fit cursor-pointer text-body-sm text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink",children:"Add description"}),t.jsx("div",{className:"min-h-[1lh] text-meta",children:t.jsx(rs,{api:l})})]})})},Zl=({project:e,commit:s,autoBegin:n=!1,onRetire:a})=>t.jsx(Ae,{field:"owner",value:e.owner??"",label:"Owner",display:t.jsx("span",{className:"text-body-sm text-ink",children:e.owner}),commitFields:r=>({owner:r.trim()}),validate:r=>Nt(r,"owner"),labels:ue("owner","Owner"),commit:s,maxLength:wt,placeholder:"atlas",autoBegin:n,onRetire:a}),ec=({project:e,commit:s,label:n=null,autoBegin:a=!1,onRetire:r})=>t.jsx(Ae,{field:"team",value:e.team??"",label:"Team",display:t.jsx("span",{className:"text-body-sm text-ink",children:n??e.team}),commitFields:i=>({team:i.trim()}),validate:i=>Nt(i,"team"),labels:ue("team","Team"),commit:s,maxLength:wt,placeholder:"platform",autoBegin:a,onRetire:r}),dn=({project:e,commit:s,which:n,nowMs:a,autoBegin:r=!1,onRetire:i})=>{const l=n==="start"?e.start_date??"":e.target_date??"",o=typeof navigator>"u"?void 0:navigator.language,c=_e(l,o,new Date(a)),m=n==="start"?"Start":"Target";return t.jsx(Ae,{field:n==="start"?"start-date":"target-date",value:l,label:m,display:t.jsx("span",{className:"text-body-sm text-ink",children:c}),commitFields:u=>n==="start"?{start_date:u}:{target_date:u},validate:u=>{const h=Jt(u);return h||(n==="start"?Zt(u,e.target_date??""):Zt(e.start_date??"",u))},labels:ue(`${m.toLowerCase()} date`,m),commit:s,placeholder:"YYYY-MM-DD",autoBegin:r,onRetire:i})},tc=({project:e,commit:s,autoBegin:n=!1,onRetire:a})=>{const r={estimate:e.estimate,unit:e.estimate_unit==="days"?"days":"points"},[i,l]=d.useState(n);d.useEffect(()=>{i&&e.estimate!==null&&(l(!1),a?.("filled"))},[i,e.estimate,a]);const o=ft({value:{number:e.estimate===null?"":String(e.estimate),unit:r.unit},equals:Fo,commit:async m=>{const u=Uo(r,m);u&&await s(u)},validate:m=>ta(m.number),labels:ue("estimate","Estimate"),selectAllOnBegin:!0,beginOnMount:n,errorCopy:Qe,onSettle:m=>{m==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const c=In(e.estimate,e.estimate_unit)||"—";return t.jsx($t,{field:"estimate",fieldRef:o.fieldRef,fieldProps:o.fieldProps,editing:o.editing,label:"Estimate",display:t.jsx("span",{className:"text-body-sm text-ink",children:c}),slot:o,feedback:o,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ne,{ref:o.editorRef,...o.editorAria,"data-project-estimate":"",value:o.draft.number,readOnly:o.phase==="saving",placeholder:"13",inputMode:"decimal","aria-label":o.labels.name,onChange:m=>o.setDraft({...o.draft,number:m.target.value}),className:"h-8 max-w-24"}),t.jsxs(Be,{value:o.draft.unit,onValueChange:m=>o.setDraft({...o.draft,unit:m}),children:[t.jsx(Ye,{"data-project-estimate-unit":"","aria-label":"Estimate unit","aria-invalid":o.editorAria["aria-invalid"],className:"h-8 w-fit min-w-28",children:t.jsx(ze,{})}),t.jsxs(He,{children:[t.jsx(Te,{value:"points",children:"Points"}),t.jsx(Te,{value:"days",children:"Days"})]})]})]}),o.draft.number.trim()===""&&r.estimate!==null&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Clearing an estimate is not supported yet — saving keeps its current value."})]})})},sc=({project:e,commit:s,autoBegin:n=!1,onRetire:a})=>{const[r,i]=d.useState(n);d.useEffect(()=>{r&&e.tags.length>0&&(i(!1),a?.("filled"))},[r,e.tags,a]);const l=ft({value:e.tags.join(", "),equals:(c,m)=>qo(it(c),m),commit:async c=>{const{tags:m}=es(c);await s({tags:m})},validate:c=>es(c).error,labels:ue("tags","Tags"),selectAllOnBegin:!0,beginOnMount:n,errorCopy:Qe,onSettle:c=>{c==="cancelled"&&(i(!1),a?.("cancelled"))}});if(!r&&e.tags.length===0)return null;const o=l.editing?it(l.draft):e.tags;return t.jsx($t,{field:"tags",fieldRef:l.fieldRef,fieldProps:l.fieldProps,editing:l.editing,label:"Tags",display:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(c=>t.jsx(pe,{variant:"outline",children:c},c))}),slot:l,feedback:l,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(ne,{ref:l.editorRef,...l.editorAria,"data-project-tags":"",value:l.draft,readOnly:l.phase==="saving",placeholder:"q4, payments","aria-label":l.labels.name,onChange:c=>l.setDraft(c.target.value),className:"h-8 max-w-72"}),t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:o.map(c=>t.jsx(pe,{variant:"outline",children:c},c))})]})})},nc="project-quick-send:no-target",ac=[],rc=({links:e,target:s,onTargetChange:n,onSend:a,focusTick:r})=>{const i=d.useRef(null),l=Ga(),{frontend:o,refresh:c}=Or(),[m,u]=d.useState(!1),h=Ke(),b=s??nc;d.useEffect(()=>{s&&c(s)},[s,c]),d.useEffect(()=>{r>0&&i.current?.focusInput()},[r]);const f=e.filter(g=>g.exists),v=(f.find(g=>g.session_id===s)??null)?.runtime?.busy===!0;return t.jsxs("div",{"data-tour-tag":"project-quick-send",className:"flex flex-col gap-2 rounded-md bg-surface 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(Be,{value:s??void 0,onValueChange:g=>n(g),children:[t.jsx(Ye,{"aria-label":"Select the session to message",className:"max-w-72",children:t.jsx(ze,{placeholder:"No session selected"})}),t.jsx(He,{children:f.map(g=>t.jsx(Te,{value:g.session_id,children:Ot(g)},g.session_id))})]}),m?t.jsx("span",{role:"status",className:"text-meta text-ink-muted",children:"Sending…"}):v?t.jsx("span",{className:"text-meta text-ink-muted",children:"The session is working — this message steers the running turn."}):null]}),t.jsx(Va,{ref:i,conversationId:b,messages:ac,isLoading:!1,ownGutter:!0,transcriptless:!0,autoFocus:!1,placeholderOverride:"Message the session — paste an image to attach it",cwd:o?.cwd,cwdReadOnlyReason:"Quick send follows the conversation's directory.",sessionStatus:o&&s?{frontend:o,costChannels:fe(h.data,"cost_channels")}:void 0,recordingProbe:l,hostNotice:s?void 0:{id:"project-quick-send-no-target",node:t.jsx("p",{className:"text-meta text-ink-muted",children:"Choose a session to send to."}),blocksInput:!0,placeholder:"Choose a session to send to."},onSendMessage:async(g,x)=>{if(!s)return!1;u(!0);try{return await a(s,g,v?"steer":"prompt",x)}finally{u(!1),i.current?.focusInput({preventScroll:!0})}}})]})},ic=({links:e,busy:s,onUnlink:n,onLink:a,onQuickSend:r,onStartSession:i})=>{const l=Et(),o=vt(x=>x.sessions),[c,m]=d.useState(!1),[u,h]=d.useState(null),[b,f]=d.useState(0),w=u&&e.some(x=>x.session_id===u&&x.exists)?u:Oi(e),v=d.useMemo(()=>{const x=new Set(e.map(j=>j.session_id));return o.filter(j=>!x.has(j.session_id)).map(j=>({id:j.session_id,name:j.title||j.session_id,description:j.cwd??void 0}))},[o,e]),g=x=>{vt.getState().openSession(x).then(j=>{j&&l(`/chat/${x}`)})};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(U,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Rr,{}),"New session"]}),t.jsxs(U,{variant:"secondary",size:"sm",disabled:s,onClick:()=>m(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Ur,{}),"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(x=>{const j=di(x),y=ui(x.subagents),E=mi(x.todos),O=x.title||x.session_id,_=x.exists;return t.jsxs("li",{className:$("flex items-center gap-2 rounded-sm px-2 py-2",_&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!_,onClick:()=>{_&&g(x.session_id)},className:$("flex min-w-0 flex-1 items-center gap-2 text-left",_?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{className:$("min-w-0 truncate text-body-sm",x.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:O})}),x.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),y&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:y}),E&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:E}),t.jsx(pe,{variant:j.variant,children:j.label}),_&&t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Message ${O}`,title:`Message ${O}`,onClick:()=>{h(x.session_id),f(T=>T+1)},children:t.jsx(Dr,{})}),t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${O}`,onClick:()=>n(x.session_id),children:t.jsx(Kr,{})})]},x.session_id)})}),e.some(x=>x.exists)&&t.jsx(rc,{links:e,target:w,onTargetChange:h,onSend:r,focusTick:b}),t.jsx(lt,{open:c,onClose:()=>m(!1),title:"Link a session",maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(Ue,{onClick:()=>m(!1),children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(ie,{children:"Session"}),t.jsx(Sn,{showLabel:!1,ariaLabel:"Search sessions",busyLabel:"Loading sessions",placeholder:"Search conversations",options:v,selected:null,onSelect:x=>{m(!1),a(x.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:"Conversations already linked to this project are not listed."})]})})]})},oc=({milestones:e,summary:s,busy:n,onToggle:a,onRemove:r,onAdd:i})=>{const[l,o]=d.useState(""),[c,m]=d.useState(""),u=!Pn.test(c.trim()),h=l.trim().length>0&&!u&&!n,b=()=>{h&&(i(l.trim(),c.trim()),o(""),m(""))};return t.jsxs("section",{"data-project-milestones":"",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",tabIndex:-1,"data-project-milestones-heading":"",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(f=>{const w=ni(f.status),v=f.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Tn,{checked:v,disabled:n,onCheckedChange:g=>a(f.name,g===!0),"aria-label":v?`Mark ${f.name} not complete`:`Mark ${f.name} complete`}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:f.name}),f.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:_e(f.target_date,typeof navigator>"u"?void 0:navigator.language)}),t.jsx(pe,{variant:w.variant,children:w.label}),t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:n,"aria-label":`Remove ${f.name}`,onClick:()=>r(f.name),children:t.jsx(Rt,{})})]},f.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(ie,{htmlFor:"project-milestone-name",children:"New milestone"}),t.jsx(ne,{id:"project-milestone-name",value:l,onChange:f=>o(f.target.value),placeholder:"beta cut",onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),b())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:"project-milestone-date",children:"Target date"}),t.jsx(ne,{id:"project-milestone-date",value:c,onChange:f=>m(f.target.value),placeholder:"YYYY-MM-DD","aria-invalid":u}),u&&t.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),t.jsxs(U,{variant:"secondary",disabled:!h,onClick:b,"data-tour-tag":"project-milestone-add",children:[t.jsx(at,{}),"Add"]})]})]})},lc=[{field:"owner",label:"Owner"},{field:"team",label:"Team"},{field:"start",label:"Start date"},{field:"target",label:"Target date"},{field:"estimate",label:"Estimate"},{field:"tags",label:"Tags"}],un=({label:e,children:s})=>t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:e}),t.jsx("dd",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s})]}),cc=({project:e,nowMs:s,commit:n,teamLabel:a=null})=>{const r=typeof navigator>"u"?void 0:navigator.language,i=new Date(s),[l,o]=d.useState(null),c=d.useRef(null),m=d.useRef(!1),u={owner:e.owner!==null,team:e.team!==null,start:e.start_date!==null,target:e.target_date!==null,estimate:e.estimate!==null,tags:e.tags.length>0},h=(T,M)=>{o(p=>p===T?null:p),M==="cancelled"&&!u[T]&&setTimeout(()=>c.current?.focus(),0)},b=lc.filter(({field:T})=>!u[T]&&l!==T),f=_e(e.completed_at,r,i),w=e.updated_at>0?dt(ct(e.updated_at,s)):"",v=e.updated_at>0?new Date(e.updated_at*1e3).toLocaleString(r):"",g=u.owner||l==="owner",x=u.team||l==="team",j=u.start||l==="start",y=u.target||l==="target",E=u.estimate||l==="estimate",O=u.tags||l==="tags",_=g||x||j||y||!!f||E||O||e.updated_at>0;return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Properties"}),b.length>0&&t.jsxs(yn,{children:[t.jsx(kn,{asChild:!0,children:t.jsxs("button",{ref:c,type:"button","data-project-add-field":"",className:$("flex shrink-0 cursor-pointer items-center gap-1 rounded-xs text-meta text-ink-dim","transition-colors duration-fast ease-out-quart hover:text-ink"),children:[t.jsx(at,{className:"size-3","aria-hidden":"true"}),"Add"]})}),t.jsx(wn,{align:"end",onCloseAutoFocus:T=>{m.current&&(m.current=!1,T.preventDefault())},children:b.map(({field:T,label:M})=>t.jsx(tt,{"data-project-add-option":T,onSelect:()=>{m.current=!0,o(T)},children:M},T))})]})]}),_?t.jsxs("dl",{className:"flex flex-col gap-2",children:[g&&t.jsx(Zl,{project:e,commit:n,autoBegin:l==="owner",onRetire:T=>h("owner",T)}),x&&t.jsx(ec,{project:e,commit:n,label:a,autoBegin:l==="team",onRetire:T=>h("team",T)}),j&&t.jsx(dn,{project:e,commit:n,which:"start",nowMs:s,autoBegin:l==="start",onRetire:T=>h("start",T)}),y&&t.jsx(dn,{project:e,commit:n,which:"target",nowMs:s,autoBegin:l==="target",onRetire:T=>h("target",T)}),f&&t.jsx(un,{label:"Completed",children:f}),E&&t.jsx(tc,{project:e,commit:n,autoBegin:l==="estimate",onRetire:T=>h("estimate",T)}),O&&t.jsx(sc,{project:e,commit:n,autoBegin:l==="tags",onRetire:T=>h("tags",T)}),e.updated_at>0&&t.jsx(un,{label:"Updated",children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:v,children:w})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No dates, estimate, tags, owner or team yet."})]})},dc=({project:e})=>{const s=Ke(),n=la(),{sending:a,cooling:r,cooldownRemainingMs:i}=al(e.id);if(!fe(s.data,"projects_request_update"))return null;const l=G(e),o=Vo(e.id);return t.jsxs(t.Fragment,{children:[t.jsx(ls,{content:r&&i!==null?St(l,i):Wo,children:t.jsxs(U,{variant:"secondary",className:"min-w-37","data-tour-tag":"project-request-update","aria-busy":a?!0:void 0,"aria-disabled":r?!0:void 0,"aria-describedby":r?o:void 0,onClick:()=>n(e),children:[a?t.jsx(ke,{size:"sm"}):r?t.jsx(ms,{}):t.jsx(Hr,{}),a?"Requesting…":r?"Requested":"Request update"]})}),r&&i!==null&&t.jsx("span",{id:o,className:"sr-only",children:St(l,i)})]})},ha="plain",pa=e=>`team:${e}`,xa=e=>`agent:${e}`;function uc(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function mc(e){return e.kind==="team"?pa(e.name):e.kind==="agent"?xa(e.name):ha}const mn={kind:"plain"},fc=({open:e,onClose:s,onStart:n,teamsEnabled:a,profilesEnabled:r})=>{const[i,l]=d.useState(mn),[o,c]=d.useState(null),[m,u]=d.useState(!1),h=Qa(e&&a),b=Xa(e&&r);d.useEffect(()=>{e&&(l(mn),c(null),u(!1))},[e]);const f=d.useMemo(()=>{const j=[{id:ha,name:"Nothing in particular",description:"A plain session; assign a team or agent later.",group:"Plain"}];for(const y of h.data??[])j.push({id:pa(y.name),name:As(y),keywords:y.name===As(y)?void 0:[y.name],description:`Team · manager: ${y.manager}`,group:"Teams"});for(const y of(b.data??[]).filter(E=>E.source!=="builtin"))j.push({id:xa(y.name),name:y.name,description:y.description||y.kind,group:"Agents"});return j},[h.data,b.data]),w=f.find(j=>j.id===mc(i))??f[0],v=!a||!r,g=h.isLoading||b.isLoading,x=async()=>{u(!0),c(null);try{await n(i),s()}catch(j){c(j instanceof Error&&j.message?j.message:"The session could not be started.")}finally{u(!1)}};return t.jsx(lt,{open:e,onClose:s,title:"Start a session",maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{onClick:s,disabled:m,children:"Cancel"}),t.jsxs(jt,{onClick:()=>void x(),disabled:m,children:[m&&t.jsx(ke,{size:"xs"}),"Start session"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Sn,{label:"Work with",placeholder:"Search teams and agents",options:f,selected:w,onSelect:j=>l(uc(j.id)),busy:g,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."}),v&&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})]})})},hc=({links:e})=>{const s=Ai(e),n=e.filter(a=>a.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:qs(s)})]}),n.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:n.map(a=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:a.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:Ot(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:qs(a.todos)})]},a.session_id))})]})},pc=/[/\\]/;function ga(e){if(e.name)return e.name;const s=e.path.split(pc);return s[s.length-1]||"Attachment"}const xc=({attachment:e})=>{const s=ga(e),n=Ri(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(nr,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),n&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:n}),t.jsx(ar,{filePath:e.path,"aria-label":`File actions for ${s}`})]})},gc=({attachment:e})=>{const s=ga(e),n=Ja(e.path,{mimeType:Za(e.name||e.path),sizeBytes:e.bytes});return n.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(er,{file:e.path,src:n.url,label:s,conversationId:""})}):n.status==="loading"?t.jsx(tr,{children:t.jsxs("span",{className:"sr-only",children:["Loading ",s]})}):t.jsx(sr,{name:s})},bc=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(gc,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(xc,{attachment:s},`${s.path}:${s.added_at}`))}),jc=({update:e,nowMs:s})=>{const n=typeof navigator>"u"?void 0:navigator.language,a=Ci(e,n,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[a.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:a.map((r,i)=>t.jsxs(d.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:r.text})]},r.key))}),e.text&&t.jsx(ot,{children:e.text}),e.attachments.length>0&&t.jsx(bc,{attachments:e.attachments})]})},vc=({updates:e,nowMs:s})=>{const n=typeof navigator>"u"?void 0:navigator.language,a=wi(e.length),r=Ei(e,n,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"}),a&&t.jsx("span",{className:"text-meta text-ink-muted",children:a})]}),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(jc,{update:l,nowMs:s},`${l.at}:${l.by}:${o}`))})]},i.key||"ungrouped"))})]})},yc="project_not_found",kc=({projectKey:e,nowMs:s})=>{const n=Et(),a=Ke(),r=jn(fe(a.data,"team_catalogue")),i=Rn(e,!0),l=Dn(),o=An(),c=Zr(),m=ei(),u=Xr(),h=Jr(),[b,f]=d.useState(!1),[w,v]=d.useState(!1),g=l.isPending||o.isPending||c.isPending||m.isPending||u.isPending||h.isPending;if(i.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(ke,{label:"Loading project"})});if(i.isError||!i.data){const p=i.error instanceof Ct&&(i.error.code===yc||i.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(zt,{variant:"danger",className:"w-full",children:p?"This project could not be found. It may have been deleted.":i.error instanceof Error&&i.error.message?i.error.message:"The project could not be read."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U,{variant:"secondary",onClick:()=>void i.refetch(),children:"Try again"}),t.jsxs(U,{variant:"secondary",onClick:()=>void n("/projects"),children:[t.jsx($s,{}),"All projects"]})]})]})}const{project:x,links:j}=i.data,y=G(x),E=(p,R)=>l.mutateAsync({key:x.id,fields:p,...R?.forceDone===!0?{forceDone:!0}:{}}),O=x.team?r(x.team):null,_=Di(x.milestones.filter(p=>p.completed_at!==null).length,x.milestones.length),T=async(p,R,D,P)=>{const Y=vt.getState(),L=ir(null,p,Y.drafts);if(!L)return!1;try{const{images:B,unreadable:W,overflow:V}=await or(P,R),oe=lr(W);if(oe)return le(oe),!1;const Q=cr(V);if(Q)return le(Q),!1;const X=dr(R,B);if(X)return le(X),!1;if(await ur(L,{text:R,attachments:P,images:B,mode:D,cwd:Y.cwd},p)===null)return le("That session already has a message going out. Try again in a moment."),!1;const N=j.find(C=>C.session_id===p);return ye(`Sent to ${N?Ot(N):p}`),!0}catch(B){return le(B instanceof Error&&B.message?B.message:"The message was not sent."),!1}},M=async p=>{const R=vt.getState(),D=p.kind==="plain"?void 0:{kind:p.kind,name:p.name},P=await R.createSession(R.cwd||"~",D);if(!P)throw new Error(R.error??"The session could not be started.");mr.getState().setCurrentInput(P,$i(x));let Y=null;try{await u.mutateAsync({key:x.id,sessionId:P})}catch(L){Y=L instanceof Error&&L.message?L.message:"the link was refused"}if(Y)le(`Session started, but linking it failed: ${Y}`);else{const L=D?` with ${Pi(D)}`:"";ye(`Session started${L} and linked to ${y}.`)}await Cn(n,P)};return t.jsx(kl,{children:t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col gap-8",children:[t.jsxs("header",{className:"flex flex-col gap-4",children:[t.jsxs("button",{type:"button",onClick:()=>void n("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx($s,{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-1 flex-wrap items-start gap-x-3 gap-y-2",children:[t.jsx(Ql,{project:x,commit:E}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(Xl,{project:x,commit:E}),x.progress_stale&&t.jsx(pe,{variant:"warning",children:yt})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(dc,{project:x}),t.jsxs(U,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-delete",children:[t.jsx(rr,{}),"Delete"]})]})]})]}),t.jsx(Jl,{project:x,commit:E}),t.jsx(cc,{project:x,nowMs:s,commit:E,teamLabel:O}),x.updates.length===0&&x.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:"Progress"}),t.jsx(ot,{className:"text-body",children:x.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:ii(x,s)})]}),t.jsx(oc,{milestones:x.milestones,summary:_,busy:g,onToggle:(p,R)=>{c.mutateAsync({key:x.id,name:p,completed:R}).catch(D=>{le(D instanceof Error&&D.message?D.message:"The milestone was not updated.")})},onRemove:p=>{m.mutateAsync({key:x.id,name:p}).catch(R=>{le(R instanceof Error&&R.message?R.message:"The milestone was not removed.")})},onAdd:(p,R)=>{c.mutateAsync({key:x.id,name:p,targetDate:R}).catch(D=>{le(D instanceof Error&&D.message?D.message:"The milestone was not added.")})}}),t.jsx(ic,{projectKey:x.id,links:j,busy:g,onStartSession:()=>v(!0),onQuickSend:T,onLink:p=>{u.mutateAsync({key:x.id,sessionId:p}).catch(R=>{le(R instanceof Error&&R.message?R.message:"The session was not linked.")})},onUnlink:p=>{h.mutateAsync({key:x.id,sessionId:p}).catch(R=>{le(R instanceof Error&&R.message?R.message:"The session was not unlinked.")})}}),t.jsx(hc,{links:j}),t.jsx(vc,{updates:x.updates,nowMs:s}),t.jsx(ca,{open:b,projectName:x.name,onClose:()=>f(!1),onConfirm:async p=>{await o.mutateAsync({key:x.id,confirmedName:p}),ye("Project deleted"),n("/projects")}}),t.jsx(fc,{open:w,onClose:()=>v(!1),onStart:M,teamsEnabled:fe(a.data,"team_catalogue"),profilesEnabled:fe(a.data,"profile_catalogue")})]})})},fn={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},wc=({open:e,onClose:s,onSubmit:n})=>{const[a,r]=d.useState(fn),[i,l]=d.useState({}),[o,c]=d.useState(null),m=d.useRef(null),[u,h]=d.useState(!1),[b,f]=d.useState(!1),[w,v]=d.useState(!1),g=d.useId(),x=d.useRef(null);d.useEffect(()=>{e&&(r({...fn,description:rn}),l({}),c(null),h(!1),f(!1),v(!1))},[e]),d.useEffect(()=>{o&&m.current?.scrollIntoView({block:"nearest"})},[o]);const j=(p,R)=>{r(D=>({...D,[p]:R}))},y=b?a.name:Dl(a.title),E=p=>ua(p,x,R=>j("description",R)),O=(p,R)=>{const D={},P=Yt(R);P&&(D.name=P);const Y=ea(p.description);Y&&(D.description=Y);const L=es(p.tags).error;L&&(D.tags=L);const B=Jt(p.startDate);B&&(D.startDate=B);const W=Jt(p.targetDate);if(W)D.targetDate=W;else if(!B){const X=Zt(p.startDate,p.targetDate);X&&(D.targetDate=X)}if(p.estimate.trim()){const X=ta(p.estimate);X&&(D.estimate=X)}const V=Xt(p.title);V&&(D.title=V);const oe=Nt(p.owner,"owner");oe&&(D.owner=oe);const Q=Nt(p.team,"team");return Q&&(D.team=Q),D},_=async()=>{const p=y.trim(),R=O(a,p);if(l(R),Object.keys(R).length>0)return;h(!0),c(null);const D=it(a.tags);try{const P={};a.title.trim()&&(P.title=a.title.trim()),a.owner.trim()&&(P.owner=a.owner.trim()),a.team.trim()&&(P.team=a.team.trim()),a.startDate&&(P.start_date=a.startDate),a.targetDate&&(P.target_date=a.targetDate),a.estimate&&(P.estimate=Number(a.estimate),P.estimate_unit=a.estimateUnit),await n({fields:{name:p,...a.description.trim()&&a.description.trim()!==rn?{description:a.description.trim()}:{},status:a.status,...D.length>0?{tags:D}:{}},...Object.keys(P).length>0?{followUp:P}:{}}),s()}catch(P){const Y=P instanceof Error&&P.message?P.message:"";c(mt(Y)||"The project was not saved.")}finally{h(!1)}},T="New project",M=a.description.length>qe;return t.jsx(lt,{open:e,onClose:s,title:T,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:u,onEscapeKeyDown:p=>{u&&p.preventDefault()},onInteractOutside:p=>{u&&p.preventDefault()}},dataTourTag:"project-create-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ue,{onClick:s,disabled:u,children:"Cancel"}),t.jsxs(jt,{"data-project-submit":"",onClick:()=>void _(),disabled:u,children:[u&&t.jsx(ke,{size:"xs"}),"Create project"]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:p=>{p.preventDefault(),_()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-title`,children:"Title"}),t.jsx(ne,{id:`${g}-title`,"data-project-title":"",value:a.title,onChange:p=>j("title",p.target.value),placeholder:"Payments migration",autoFocus:!0,className:"h-10 text-heading","aria-invalid":!!i.title}),i.title&&t.jsx("p",{className:"text-meta text-danger",children:i.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ie,{htmlFor:`${g}-key`,className:"shrink-0 text-meta text-ink-muted",children:"Key"}),t.jsx(ne,{id:`${g}-key`,"data-project-key":"",value:y,onChange:p=>{f(!0),j("name",p.target.value)},placeholder:"payments-migration","aria-invalid":!!i.name,className:"h-7 max-w-56 font-mono text-mono-sm"}),t.jsx("span",{className:"text-meta text-ink-muted",children:b?"Letters, digits, dot, underscore or dash; no spaces.":"Derived from the title until you edit it."})]}),i.name&&t.jsx("p",{className:"text-meta text-danger",children:i.name})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ie,{htmlFor:`${g}-description`,children:"Description"}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Description mode"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(p=>t.jsx("button",{type:"button","data-project-description-mode":p,"aria-pressed":w===(p==="preview"),onClick:()=>v(p==="preview"),className:$("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",w===(p==="preview")&&"bg-surface text-ink"),children:p==="write"?"Write":"Preview"},p))})]})]}),w?t.jsx("div",{"data-project-description-preview":"",className:"h-44 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:a.description.trim()?t.jsx(ot,{className:"text-body-sm",children:a.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Nothing to preview yet."})}):t.jsx(Nn,{ref:x,id:`${g}-description`,"data-project-description":"",value:a.description,onChange:p=>j("description",p.target.value),onPaste:E,rows:8,placeholder:"Markdown — headings, lists, code.","aria-invalid":M||!!i.description,className:"h-44 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.description?t.jsx("p",{className:"text-meta text-danger",children:i.description}):t.jsx("span",{}),t.jsxs("p",{className:$("text-meta tabular-nums",M?"text-danger":"text-ink-muted"),children:[a.description.length,"/",qe]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{children:"Status"}),t.jsxs(Be,{value:a.status,onValueChange:p=>j("status",p),children:[t.jsx(Ye,{"aria-label":"Status",children:t.jsx(ze,{})}),t.jsx(He,{children:$n.map(p=>t.jsx(Te,{value:p.value,children:p.label},p.value))})]}),a.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(ie,{htmlFor:`${g}-owner`,children:"Owner"}),t.jsx(ne,{id:`${g}-owner`,"data-project-owner":"",value:a.owner,onChange:p=>j("owner",p.target.value),placeholder:"atlas","aria-invalid":!!i.owner}),i.owner&&t.jsx("p",{className:"text-meta text-danger",children:i.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-team`,children:"Team"}),t.jsx(ne,{id:`${g}-team`,value:a.team,onChange:p=>j("team",p.target.value),placeholder:"platform","aria-invalid":!!i.team}),i.team&&t.jsx("p",{className:"text-meta text-danger",children:i.team})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-target`,children:"Target date"}),t.jsx(ne,{id:`${g}-target`,"data-project-target":"",value:a.targetDate,onChange:p=>j("targetDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.targetDate}),i.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:i.targetDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-start`,children:"Start date"}),t.jsx(ne,{id:`${g}-start`,value:a.startDate,onChange:p=>j("startDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.startDate}),i.startDate&&t.jsx("p",{className:"text-meta text-danger",children:i.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-estimate`,children:"Estimate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ne,{id:`${g}-estimate`,value:a.estimate,onChange:p=>j("estimate",p.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(Be,{value:a.estimateUnit,onValueChange:p=>j("estimateUnit",p),children:[t.jsx(Ye,{"aria-label":"Estimate unit",className:"max-w-32",children:t.jsx(ze,{})}),t.jsxs(He,{children:[t.jsx(Te,{value:"points",children:"Points"}),t.jsx(Te,{value:"days",children:"Days"})]})]})]}),i.estimate&&t.jsx("p",{className:"text-meta text-danger",children:i.estimate})]}),t.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[t.jsx(ie,{htmlFor:`${g}-tags`,children:"Tags"}),t.jsx(ne,{id:`${g}-tags`,value:a.tags,onChange:p=>j("tags",p.target.value),placeholder:"q4, payments","aria-invalid":!!i.tags}),i.tags?t.jsx("p",{className:"text-meta text-danger",children:i.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Comma-separated, up to 8. Lowercase letters, digits, underscore or dash."})]})]}),o&&t.jsx("p",{ref:m,className:"text-body-sm text-danger",children:o})]})})},ba=({children:e})=>{const s=d.useRef(null),[n,a]=d.useState(!1),r=()=>{const i=s.current;i&&a(i.scrollTop+i.clientHeight<i.scrollHeight-1)};return d.useEffect(r),t.jsx("div",{ref:s,onScroll:r,className:$("max-h-[min(70vh,32rem)] overflow-y-auto overscroll-contain",n&&"[mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]"),children:e})},Nc=({label:e,count:s,selected:n,onToggle:a})=>{const r=d.useId();return t.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-1 py-1 hover:bg-sunken",children:[t.jsx(Tn,{id:r,checked:n,onCheckedChange:()=>a()}),t.jsx(ie,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer truncate font-normal text-body-sm text-ink",children:e}),t.jsx("span",{className:"text-meta text-ink-dim tabular-nums",children:s})]})},Sc=({column:e,spec:s,onChange:n})=>{const a=d.useId(),r=s!==null&&s.key===e,i=r?s.direction:It(e),l=i==="asc"?"desc":"asc",o=()=>n({key:e,direction:r?l:It(e)}),c=s===null?"default":r?"sorted":"other";return t.jsxs("fieldset",{className:"m-0 flex flex-col gap-0.5 border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:`Sort by ${We(e)}`}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:c==="default",onChange:()=>n(null),className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:$("min-w-0 flex-1 truncate",c==="default"?"text-ink":"text-ink-muted"),children:ho})]}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:c==="sorted",onChange:o,onClick:()=>{c==="sorted"&&o()},onKeyDown:m=>{c==="sorted"&&(m.key!==" "&&m.key!=="Enter"||(m.preventDefault(),o()))},className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:$("min-w-0 flex-1 truncate",c==="sorted"?"text-ink":"text-ink-muted"),children:`Sort by ${We(e)}, ${bs(e,r?i:It(e))}`})]})]})},Tc=({facet:e,options:s,onToggle:n})=>t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2 last:border-b-0",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:nt[e]}),s.map(a=>t.jsx(Nc,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>n(e,a.value)},`${e}:${a.value??"none"}`))]}),ja=({projects:e,state:s,query:n,todayMs:a,onToggle:r,onClearAll:i,scope:l,sort:o})=>{const c=d.useMemo(()=>l===void 0?fo(e,s,a):l===null?[]:[Zn(l,e,s,a)],[l,e,s,a]),m=!rt(s)||n.trim()!=="";return t.jsxs("div",{className:"flex flex-col",children:[l===void 0&&t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"text-body-sm text-ink-muted",children:"Filters"}),m&&t.jsx(U,{variant:"link",size:"sm",onClick:i,children:"Clear all"})]}),o&&t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:`Sort by ${We(o.key)}`}),t.jsx(Sc,{column:o.key,spec:o.spec,onChange:o.onChange})]}),c.map(u=>t.jsx(Tc,{facet:u.facet,options:u.options,onToggle:r},u.facet))]})},_c=({team:e,count:s,headingId:n,className:a,...r})=>t.jsxs("div",{...r,className:$("flex h-8 cursor-default items-center gap-2 bg-surface px-3 text-meta",a),children:[t.jsx("h3",{id:n,className:"truncate text-ink",children:e??hs}),t.jsx("span",{className:"shrink-0 text-ink-muted","aria-label":li(s),children:s})]}),ve=[{key:"name",label:"Project",className:"min-w-0 flex-1",sort:"name",facet:null},{key:"status",label:"Status",className:"w-20 shrink-0",sort:"status",facet:"status"},{key:"target",label:"Target",className:"hidden w-32 shrink-0 @[40rem]:block",sort:"target",facet:"target"},{key:"estimate",label:"Estimate",className:"hidden w-16 shrink-0 @[40rem]:block",sort:"estimate",facet:"estimate"},{key:"milestones",label:"Milestones",className:"hidden w-20 shrink-0 @[34rem]:block",sort:"milestones",facet:"milestones"},{key:"live",label:"Live",className:"hidden w-14 shrink-0 @[34rem]:block",sort:"live",facet:"live"},{key:"progress",label:"Progress",className:"w-40 shrink-0",sort:"progress",facet:"progress"}];function Cc(e,s){const n=ct(e.progress_updated_at,s);return n?dt(n):"not reported"}const Ec=({direction:e})=>e==="asc"?t.jsx(En,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(vn,{size:10,className:"shrink-0","aria-hidden":"true"}),Rc=({projects:e,nowMs:s,onOpen:n,sort:a,onSortChange:r,searchPopulation:i,filters:l,query:o,todayMs:c,onToggleFilter:m,onClearFilters:u,teamLabelFor:h=b=>b})=>{const b=a?wo(e,a):e,f=ps(b,ut),w=d.useId(),v=O=>`${w}-team-${O}`,[g,x]=d.useState(0),j=d.useRef([]),y=(O,_)=>{const T=ve.length;for(let M=1;M<=T;M+=1){const p=(O+_*M+T*T)%T,R=j.current[p];if(R&&R.offsetParent!==null){x(p),R.focus();return}}},E=O=>_=>{_.key!=="ArrowLeft"&&_.key!=="ArrowRight"||(_.preventDefault(),y(O,_.key==="ArrowRight"?1:-1))};return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("table",{className:"block shrink-0","aria-label":"Project columns",children:t.jsx("thead",{className:"block",children:t.jsx("tr",{className:"flex items-center gap-3 px-9 py-2 text-meta text-ink-muted",children:ve.map((O,_)=>{const T=a!==null&&a.key===O.sort;return t.jsx("th",{scope:"col","aria-sort":T?a.direction==="desc"?"descending":"ascending":"none",className:$(O.className,"p-0 text-left font-normal"),children:t.jsxs(cs,{children:[t.jsx(ds,{asChild:!0,children:t.jsxs("button",{type:"button",ref:M=>{j.current[_]=M},tabIndex:_===g?0:-1,"data-project-column":O.key,onFocus:()=>x(_),onKeyDown:E(_),className:$("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",T?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:O.label}),T?t.jsx(Ec,{direction:a.direction}):t.jsx(fr,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(us,{align:"start","aria-label":`${O.label} column`,className:"w-72 p-0",children:t.jsx(ba,{children:t.jsx(ja,{projects:i,state:l,query:o,todayMs:c,onToggle:m,onClearAll:u,scope:O.facet,sort:{key:O.sort,spec:a,onChange:r}})})})]})},O.key)})})})}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:f.map((O,_)=>t.jsxs("li",{children:[t.jsx(_c,{team:O.team==null?null:h(O.team),count:O.items.length,headingId:v(_),className:"sticky top-0 z-10","data-project-team":O.team??""}),t.jsx("ul",{"aria-labelledby":v(_),className:"divide-y divide-hairline",children:O.items.map(T=>{const M=new Map(Fn(T,typeof navigator>"u"?void 0:navigator.language).map(D=>[D.key,D.text])),p=Ln(T.milestones_completed,T.milestones_total),R=fs(T.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>n(T),"data-project-name":T.name,className:$("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:$(ve[0].className,"truncate text-body-sm text-ink"),children:G(T)}),t.jsx("span",{className:ve[1].className,children:t.jsx(fa,{status:T.status})}),t.jsx("span",{className:$(ve[2].className,"truncate text-meta text-ink-muted"),children:M.get("target")??M.get("completed")??""}),t.jsx("span",{className:$(ve[3].className,"truncate text-meta text-ink-muted"),children:M.get("estimate")??""}),t.jsx("span",{className:$(ve[4].className,"truncate text-meta text-ink-muted"),children:p}),t.jsx("span",{className:$(ve[5].className,"truncate text-meta text-ink-muted"),children:R}),t.jsxs("span",{className:$(ve[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:Cc(T,s)}),T.progress_stale&&t.jsx(pe,{variant:"warning",children:yt})]})]})},T.id)})})]},O.team??""))})]})},_t=224,hn=36,Dc={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},Ac=({items:e,nowMs:s,onOpen:n,pendingDetails:a,failedDetails:r,onRetryDetails:i,teamLabelFor:l=o=>o})=>{const[o,c]=d.useState(null),[m,u]=d.useState(0),h=d.useRef(null),b=vs(s),f=d.useMemo(()=>To(e,b),[e,b]),w=d.useMemo(()=>_o(e),[e]),v=d.useMemo(()=>ps(w.dated,_=>ut(_.project)),[w]);d.useLayoutEffect(()=>{const _=h.current;if(!_)return;const T=()=>u(_.clientWidth);if(T(),typeof ResizeObserver>"u")return;const M=new ResizeObserver(T);return M.observe(_),()=>M.disconnect()},[]);const g=Math.max(m-_t-24,160),x=f?No(Ks(f.startMs,f.endMs),g):"month",j=o??x,y=_=>{const T=Se.indexOf(j),M=Se[T-_];M&&c(M)},E=js[j],O=f?Ks(f.startMs,f.endMs)*E:0;return t.jsxs("div",{ref:h,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-9 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"}.`:`${w.dated.length} dated · ${w.undated.length} without dates${a>0?` · loading milestones for ${a}…`:""}`}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&t.jsx(U,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}),t.jsx(U,{variant:"secondary",size:"icon","aria-label":"Zoom in",title:"Zoom in (finer)",disabled:!f||j===Se[0],onClick:()=>y(1),children:t.jsx(at,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Dc[j]}),t.jsx(U,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!f||j===Se[Se.length-1],onClick:()=>y(-1),children:t.jsx(Sr,{})})]})]}),f&&w.dated.length>0?t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 pb-6",children:t.jsxs("div",{className:"min-w-max",children:[t.jsx(Oc,{startMs:f.startMs,endMs:f.endMs,tier:j,pxPerDay:E,trackPx:O}),v.map(_=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":_.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:_t},children:[t.jsx("span",{className:"truncate text-ink",children:_.team==null?hs:l(_.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:_.items.length})]})}),_.items.map(T=>t.jsx($c,{item:T,spanStart:f.startMs,pxPerDay:E,trackPx:O,today:b,onOpen:()=>n(T)},T.project.id))]},_.team??""))]})}):null,w.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(bn,{defaultOpen:w.dated.length===0,triggerClassName:"text-ink hover:bg-row-hover hover:text-ink",chevronClassName:"text-ink-dim",rowClassName:"min-h-8 py-0",summary:t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-meta",children:[t.jsx(Fr,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Co(w.undated.length)})]}),children:[w.dated.length===0&&t.jsx("p",{className:"pb-1 text-meta text-ink-muted",children:"Set a start date, a target date or a milestone date and it will appear on the timeline."}),t.jsx("ul",{className:"flex max-h-24 flex-wrap gap-x-3 gap-y-1 overflow-y-auto",children:w.undated.map(_=>t.jsx("li",{children:t.jsx("button",{type:"button",className:"rounded-sm text-meta text-ink hover:bg-row-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",onClick:()=>n(_),children:G(_.project)})},_.project.id))})]})})]})},Oc=({startMs:e,endMs:s,tier:n,pxPerDay:a,trackPx:r})=>{const i=Io(e,s,n);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:_t}}),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:De(e,l.dayMs)*a},children:[t.jsx("span",{className:$("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))})]})},$c=({item:e,spanStart:s,pxPerDay:n,trackPx:a,today:r,onOpen:i})=>{const{project:l}=e,o=Eo(e),c=Ro(e),m=u=>new Date(u).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:_t,height:hn},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:G(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:hn},children:[o&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:De(s,o.fromMs)*n,width:(De(o.fromMs,o.toMs)+1)*n},title:`${_e(m(o.fromMs))} → ${_e(m(o.toMs))}`}),c.map(u=>t.jsx("span",{"data-milestone":u.status,className:$("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",u.status==="completed"&&"bg-success",u.status==="overdue"&&"bg-warning",u.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:De(s,u.dayMs)*n},title:`${u.name} · ${u.status} · ${_e(m(u.dayMs))}`},`${u.name}-${u.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:De(s,r)*n},"aria-hidden":"true"})]})]})},Pc=({projects:e,query:s,onQueryChange:n,filters:a,onFiltersChange:r,onClearAll:i,todayMs:l,resultText:o,countRevealClass:c="@[37rem]:inline",trailing:m,disabled:u=!1,searchFieldRef:h})=>{const[b,f]=d.useState(!1),w=d.useRef(!1),v=lo(a),g=_n(o??"",300),x=s.trim()!==""||!rt(a);return t.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-3",children:[t.jsxs("div",{className:"relative w-full min-w-0 max-w-[400px]",children:[t.jsx(hr,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),t.jsx(ne,{ref:h,inputSize:"sm",value:s,onChange:j=>n(j.target.value),onKeyDown:j=>{j.key==="Escape"&&(s?n(""):j.currentTarget.blur())},placeholder:"Search projects","aria-label":"Search projects",autoComplete:"off",spellCheck:!1,className:"pl-9"}),s?t.jsx(U,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>pr(h.current,n),"aria-label":"Clear search",children:t.jsx(Rt,{"aria-hidden":"true"})}):t.jsx("span",{className:"pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-ink-dim",children:t.jsx(xr,{shortcut:"/"})})]}),t.jsxs(cs,{open:b,onOpenChange:f,children:[t.jsx(ds,{asChild:!0,children:t.jsxs(U,{variant:"secondary",size:"sm",disabled:u,"data-project-filters-button":"",children:[t.jsx(Yr,{size:14,"aria-hidden":"true"}),"Filters",v>0&&t.jsx(pe,{variant:"neutral",children:v})]})}),t.jsx(us,{align:"end","aria-label":"Filters",className:"w-80 p-0",onCloseAutoFocus:j=>{w.current&&(w.current=!1,j.preventDefault())},children:t.jsx(ba,{children:t.jsx(ja,{projects:e,state:a,query:s,todayMs:l,onToggle:(j,y)=>r(Qn(a,j,y)),onClearAll:()=>{i(),w.current=!0,f(!1),h.current?.focus()}})})})]}),x&&o!==null&&t.jsx("span",{className:$("hidden whitespace-nowrap text-meta text-ink-dim",c),"data-project-count":"",children:o}),t.jsx("output",{className:"sr-only","aria-live":"polite",children:g}),m]})},Mc=({filters:e,sort:s,onFiltersChange:n,onSortChange:a,onClearAll:r,hideClearAll:i=!1,searchFieldRef:l})=>{const[o,c]=d.useState(null);d.useEffect(()=>{if(!o)return;let h=null;o.kind==="search"?h=l.current:(h=document.querySelector(`[data-project-chip="${o.index}"]`),h||(h=document.querySelector("[data-project-chip]")),h||(h=document.querySelector("[data-project-filters-button]"))),h&&(h.focus(),c(null))});const m=[];for(const h of Ve){const b=e[h];if(b.length===0)continue;const f=b.map(g=>Vn(h,g)),w=f[0],v=f.length>1?`${nt[h]} · ${w} +${f.length-1}`:`${nt[h]} · ${w}`;m.push({kind:"facet",facet:h,label:v,ariaLabel:`Remove filter: ${nt[h]} · ${f.join(", ")}`,clear:()=>n({...e,[h]:[]})})}if(s&&m.push({kind:"sort",spec:s,label:`Sort: ${We(s.key)}`,ariaLabel:`Remove sort: ${We(s.key)}, ${bs(s.key,s.direction)}`,clear:()=>a(null)}),m.length===0)return null;const u=(h,b)=>{b.clear();const f=m.length-1;c(f===0?{kind:"chip",index:0}:{kind:"chip",index:Math.min(h,f-1)})};return t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.map((h,b)=>t.jsx(pe,{asChild:!0,variant:"neutral",className:"gap-1 pr-1 text-ink",children:t.jsxs("button",{type:"button",className:"group","data-project-chip":b,"aria-label":h.ariaLabel,onClick:()=>u(b,h),children:[h.kind==="sort"&&(h.spec.direction==="asc"?t.jsx(En,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(vn,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:h.label}),t.jsx(Rt,{className:$("text-ink-dim transition-colors duration-fast ease-out-quart","group-hover:text-danger"),"aria-hidden":"true"})]})},h.kind==="facet"?h.facet:"sort")),!i&&t.jsx(U,{variant:"link",size:"sm",onClick:()=>{r(),c({kind:"search"})},children:"Clear all"})]})},va="projects-view",Ic=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function Lc(){try{const e=localStorage.getItem(va);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function Fc(e){try{localStorage.setItem(va,e)}catch{}}const qc=({value:e,onChange:s})=>t.jsx(Tr,{value:e,onValueChange:n=>s(n),children:t.jsx(_r,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:Ic.map(n=>t.jsx(Cr,{value:n.value,children:n.label},n.value))})}),Uc=["r1","r2","r3","r4","r5","r6"],Bc=4e3,pn={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."},Xc=({nowMs:e=Date.now()})=>{const{projectId:s}=gr(),n=Et(),a=Ke(),r=br(a.data,"projects",1),i=r==="enabled",l=fe(a.data,"projects",zi),o=jn(fe(a.data,"team_catalogue")),c=Gr(i),m=Qr(),u=Dn(),h=An(),[b,f]=d.useState(!1),[w,v]=d.useState(()=>Lc()),[g,x]=d.useState(()=>gi()),[j,y]=d.useState(null),[E,O]=d.useState(""),[_,T]=d.useState(Ys),[M,p]=d.useState(()=>go()),[R,D]=d.useState(""),P=d.useRef(""),Y=d.useRef(null),L=d.useRef(null),B=S=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),S!==""&&S===P.current?(D(""),Y.current=window.requestAnimationFrame(()=>{Y.current=null,D(S)})):D(S),P.current=S,L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{L.current=null,P.current="",D("")},Bc)},W=()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),L.current!==null&&(window.clearTimeout(L.current),L.current=null),P.current="",D("")},V=S=>{O(S),W()},oe=S=>{T(S),W()},Q=d.useRef(null),X=rl(),k=c.data??[],N=vs(e),C=no(E,i&&l),I=Gn(E),F=d.useMemo(()=>C.answer?to(k,C.answer.projects):null,[k,C.answer]),q=I!=="",ae=d.useMemo(()=>q?F??eo(k,I):k,[k,I,q,F]),Ce=F===null?"client":"backend",z=d.useMemo(()=>co(ae,_,N),[ae,_,N]),we=l&&q&&C.pending,xe=q||!rt(_),me=d.useMemo(()=>Is(k,g,e),[k,g,e]),J=d.useMemo(()=>Is(z,g,e),[z,g,e]),Ee=xi(g),re=w==="board"?J.length:z.length,Xe=!xe||!c.isSuccess?null:w==="board"?`${J.length} of ${me.length} in window`:`${z.length} of ${k.length} projects`,ee=c.isSuccess&&k.length>0,Ne=ee&&xe&&re===0&&!we,Pe=we&&re===0&&ee,[Pt,Je]=d.useState(!1);d.useEffect(()=>{if(!Pt)return;const S=document.querySelector('[data-tour-tag="projects-board-window"]');S&&(S.focus(),Je(!1))}),d.useEffect(()=>{if(!i||s)return;const S=H=>{const K=H.target;if(!K||K.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(K.tagName)||K.closest('[role="dialog"]'))return;const je=H.key==="/"&&!H.metaKey&&!H.ctrlKey&&!H.altKey,se=(H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="f";!je&&!se||(H.preventDefault(),Q.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i,s]);const Ze=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const S=Ze.current;S!==null&&(S.scrollTop=0)},[s]);const ht=Vr(w==="timeline"?k.map(S=>S.id):[],i),A=new Map(k.map((S,H)=>[S.id,ht[H]])),te=z.map(S=>({project:S,milestones:A.get(S.id)?.data?.project.milestones??[]})),et=w==="timeline"?z.filter(S=>A.get(S.id)?.isLoading).length:0,ge=w==="timeline"?z.filter(S=>A.get(S.id)?.isError).length:0,pt=()=>{for(const S of ht)S.isError&&S.refetch()},Me=S=>{p(S),bo(S),B(jo(S))},ya=(S,H)=>{T(K=>Qn(K,S,H)),W()},xt=()=>{const S=E.trim()!=="",H=!rt(_),K=M!==null;O(""),T(Ys),M!==null&&Me(null),B(vo({search:S,filters:H,sort:K}))},ws=()=>{x("all"),Ls("all"),Je(!0)},[be,Ns]=d.useState(null),Mt=d.useRef(!1),Ss=()=>{Mt.current=!1,Ns(null)},[ka,Ts]=d.useState([]),wa=fe(a.data,"projects_force_done"),Na=(S,H)=>{const K=S.id,je=Z(H).label;Ts(se=>se.includes(K)?se:[...se,K]),Bo({move:()=>u.mutateAsync({key:K,fields:{status:H}}),forceDoneOffered:wa,claimQuestion:()=>Mt.current?!1:(Mt.current=!0,!0)}).then(se=>{if(se.kind==="accepted"){ye(`Moved to ${je}`),c.refetch().then(()=>X(K));return}if(se.kind==="question"){Ns({project:S,status:H,refusal:se.refusal});return}le(se.copy,se.refusal?{action:{label:"View project",onClick:()=>void n(`/projects/${K}`)}}:void 0),X(K)}).finally(()=>{Ts(se=>se.filter(Sa=>Sa!==K))})};return i?s?t.jsx("div",{ref:Ze,className:"flex h-full min-h-0 flex-col overflow-y-auto overflow-x-hidden p-6 [scrollbar-gutter:stable_both-edges]",children:t.jsx(kc,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"@container flex shrink-0 flex-col gap-8 px-6 pt-6",children:[t.jsx(Os,{title:"Projects",icon:Ps,subtitle:"Workstreams you and your agents track across sessions.",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U,{variant:"secondary",size:"icon","aria-label":"Refresh projects",title:"Refresh projects",disabled:c.isFetching,onClick:()=>void c.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(Ar,{})}),t.jsxs(U,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"create-project-button",children:[t.jsx(at,{}),"New project"]})]})}),t.jsxs("div",{className:"flex shrink-0 flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3","data-project-search-row":"",children:[t.jsx(qc,{value:w,onChange:S=>{v(S),Fc(S)}}),t.jsx(Pc,{projects:ae,query:E,onQueryChange:V,filters:_,onFiltersChange:oe,onClearAll:xt,todayMs:N,resultText:Xe,countRevealClass:w==="board"?"@[47rem]:inline":void 0,disabled:c.isError,searchFieldRef:Q,trailing:w==="board"&&!(c.isSuccess&&c.data.length===0)?t.jsx(zo,{value:g,onChange:S=>{x(S),Ls(S)}}):null})]}),t.jsx(Mc,{filters:_,sort:M,onFiltersChange:oe,onSortChange:Me,onClearAll:xt,hideClearAll:Ne,searchFieldRef:Q}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:R})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[c.isLoading&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("output",{className:"px-9 py-2 text-meta text-ink-dim",children:"Loading projects…"}),Uc.map(S=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(Ie,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(Ie,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(Ie,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(Ie,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(Ie,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(Ie,{className:"h-4 w-40 shrink-0 bg-elevated"})]},S))]}),c.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx(zt,{variant:"danger",children:c.error instanceof Error&&c.error.message?c.error.message:"The projects could not be read."}),t.jsx(U,{variant:"secondary",size:"sm",onClick:()=>void c.refetch(),children:"Try again"})]}),c.isSuccess&&c.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(U,{variant:"primary",onClick:()=>f(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(at,{}),"New project"]})]}),Pe&&t.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:t.jsx("output",{className:"px-9 py-2 text-meta text-ink-dim",children:"Searching…"})}),ee&&Ne&&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:E.trim()?`No projects match "${E.trim()}".`:"No projects match."}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:E.trim()?Yi[Ce]:"Try removing a filter. Clearing the filters restores the list."}),t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(U,{variant:"secondary",onClick:()=>{xt(),Q.current?.focus()},children:"Clear all"}),w==="board"&&z.length>0&&t.jsx(U,{variant:"secondary",onClick:ws,children:"Show all time"})]})]}),ee&&!Ne&&!Pe&&w==="list"&&t.jsx(Rc,{projects:z,nowMs:e,onOpen:S=>void n(`/projects/${S.id}`),sort:M,onSortChange:Me,searchPopulation:ae,filters:_,query:E,todayMs:N,onToggleFilter:ya,onClearFilters:xt,teamLabelFor:o}),ee&&!Ne&&w==="board"&&J.length>0&&t.jsx(ol,{projects:J,nowMs:e,onOpen:S=>void n(`/projects/${S.id}`),onEdit:S=>void n(`/projects/${S.id}`),onDelete:y,onMove:Na,teamLabelFor:o,movingKeys:ka}),ee&&!Ne&&!Pe&&w==="board"&&J.length===0&&Ee!==null&&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:Ee}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Older projects are hidden by the window."}),t.jsx(U,{variant:"secondary",onClick:ws,children:"Show all time"})]}),ee&&!Ne&&!Pe&&w==="timeline"&&t.jsx(Ac,{items:te,nowMs:e,onOpen:S=>void n(`/projects/${S.project.id}`),pendingDetails:et,failedDetails:ge,onRetryDetails:pt,teamLabelFor:o})]}),t.jsx(ca,{open:j!==null,projectName:j?.name??"",onClose:()=>y(null),onConfirm:async S=>{j&&(await h.mutateAsync({key:j.id,confirmedName:S}),ye("Project deleted"),y(null))}}),t.jsx(ma,{open:be!==null,refusal:be?.refusal??null,projectLabel:be?G(be.project):"",onClose:()=>{be&&X(be.project.id),Ss()},onConfirm:async()=>{if(!be)return;const{project:S,status:H,refusal:K}=be,je=await u.mutateAsync({key:S.id,fields:{status:H},forceDone:!0});ye(Kn(je,K.count,Z(H).label)),c.refetch().then(()=>X(S.id))},secondaryLabel:"Open project",onSecondary:()=>{const S=be?.project.id;Ss(),S&&n(`/projects/${S}`)}}),t.jsx(wc,{open:b,onClose:()=>f(!1),onSubmit:async S=>{const H=await m.mutateAsync(S.fields),K=S.followUp?.title??S.fields.name;if(S.followUp)try{await u.mutateAsync({key:H.id,fields:S.followUp})}catch(je){const se=je instanceof Error&&je.message?je.message:"";le(`Project ${K} was created, but the extra fields were not saved: ${mt(se)||"the server refused them."} Open the project to set them in place.`);return}ye(`Project ${K} created`)}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Os,{title:"Projects",icon:Ps}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(ke,{label:"Checking the server's Projects support"})}):t.jsx(zt,{variant:"warning",children:pn[r]??pn.unknown})]})};export{Xc as ProjectsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as qt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-
|
|
1
|
+
import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as qt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-BbzxawE5.js";import{q as $t}from"./conversation-input-sync-D-zN-3c7.js";import"./index-DYPQY4Aq.js";import"./ui-preferences-store-B23VrKBG.js";import"./error-boundary-XLnRMwpt.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:m,5:b,10:y,12:T,13:q,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var qe=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function me(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(me,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
|
|
2
2
|
`+E.showPosition()+`
|
|
3
3
|
Expecting `+yt.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(w==Kt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Pt,{text:E.match,token:this.terminals_[w]||w,line:E.yylineno,loc:kt,expected:yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+w);switch(N[0]){case 1:u.push(w),A.push(E.yytext),e.push(E.yylloc),u.push(N[1]),w=null,Gt=E.yyleng,n=E.yytext,gt=E.yylineno,kt=E.yylloc;break;case 2:if(X=this.productions_[N[1]][1],st.$=A[A.length-X],st._$={first_line:e[e.length-(X||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(X||1)].first_column,last_column:e[e.length-1].last_column},qe&&(st._$.range=[e[e.length-(X||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(st,[n,Gt,gt,Y.yy,N[1],A,e].concat(Te)),typeof Ft<"u")return Ft;X&&(u=u.slice(0,-1*X*2),A=A.slice(0,-1*X),e=e.slice(0,-1*X)),u.push(this.productions_[N[1]][0]),A.push(st.$),e.push(st._$),Jt=ht[u[u.length-2]][u[u.length-1]],u.push(Jt);break;case 3:return!0}}return!0},"parse")},pe=function(){var M={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|