local-operator-ui 0.34.43 → 0.34.45

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.
Files changed (113) hide show
  1. package/out/main/index.js +948 -66
  2. package/out/preload/index.js +234 -18
  3. package/out/renderer/assets/{_basePickBy-CooCYmcM.js → _basePickBy-AOIZJtmP.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-4qtqmZW_.js → _baseUniq-6rYoQPQm.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-DNEAnxOm.js → agent-details-page-B9MNIwUW.js} +2 -2
  6. package/out/renderer/assets/agent-hub-page-Bj3VsEfD.js +11 -0
  7. package/out/renderer/assets/agents-page-y_fPy8cB.js +7 -0
  8. package/out/renderer/assets/arc-DEIVtaqP.js +1 -0
  9. package/out/renderer/assets/architectureDiagram-IEHRJDOE-C6lgf3ft.js +36 -0
  10. package/out/renderer/assets/{blockDiagram-JOT3LUYC-DCrmg4AS.js → blockDiagram-JOT3LUYC-rUXOYgBS.js} +6 -6
  11. package/out/renderer/assets/{book-open-C9onOH1C.js → book-open-BWUyDXVa.js} +1 -1
  12. package/out/renderer/assets/browser-page-BENwHsVf.js +1 -0
  13. package/out/renderer/assets/browser-webauthn-prompt-BlawzvV4.js +1 -0
  14. package/out/renderer/assets/{c4Diagram-VJAJSXHY-JN7qYmAl.js → c4Diagram-VJAJSXHY-B5DZCCX3.js} +1 -1
  15. package/out/renderer/assets/channel-vM9rusk9.js +1 -0
  16. package/out/renderer/assets/{chunk-4BMEZGHF-D-g_YScr.js → chunk-4BMEZGHF-LYO-H6gm.js} +1 -1
  17. package/out/renderer/assets/{chunk-A2AXSNBT-B1PwQjty.js → chunk-A2AXSNBT-C-eXpCGB.js} +1 -1
  18. package/out/renderer/assets/{chunk-AEK57VVT-D0YdN5Ie.js → chunk-AEK57VVT-CkjgDW9B.js} +1 -1
  19. package/out/renderer/assets/{chunk-D6G4REZN-BdxlZ78D.js → chunk-D6G4REZN-hAERljt9.js} +1 -1
  20. package/out/renderer/assets/{chunk-RZ5BOZE2-DpgIrz96.js → chunk-RZ5BOZE2-D1aP9fPZ.js} +1 -1
  21. package/out/renderer/assets/{chunk-XZIHB7SX-CkrN_GSN.js → chunk-XZIHB7SX-Chv37Bqx.js} +1 -1
  22. package/out/renderer/assets/classDiagram-GIVACNV2-BCqIuRq4.js +1 -0
  23. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BCqIuRq4.js +1 -0
  24. package/out/renderer/assets/clone-Bj8HwBLn.js +1 -0
  25. package/out/renderer/assets/{console-mirror-D1YYJxrt.js → console-mirror-DF_IQ1r-.js} +14 -14
  26. package/out/renderer/assets/consoleCapture-CAbvxCQS.js +1 -0
  27. package/out/renderer/assets/{conversation-input-sync-Czj2IfIc.js → conversation-input-sync-BdhFw-JY.js} +259 -261
  28. package/out/renderer/assets/dagre-OKDRZEBW-ClDfyejg.js +4 -0
  29. package/out/renderer/assets/diagram-SSKATNLV-BECmfn9C.js +43 -0
  30. package/out/renderer/assets/diagram-VNBRO52H-82BMsx_Z.js +24 -0
  31. package/out/renderer/assets/{erDiagram-Q7BY3M3F-BkfNqIb2.js → erDiagram-Q7BY3M3F-BiCriqsZ.js} +1 -1
  32. package/out/renderer/assets/{error-boundary-YxH9ow-2.js → error-boundary-B4K6A3dS.js} +2 -2
  33. package/out/renderer/assets/{flowDiagram-4HSFHLVR-bHw80L96.js → flowDiagram-4HSFHLVR-D4PQMO6X.js} +1 -1
  34. package/out/renderer/assets/ganttDiagram-APWFNJXF-Rts_QpVD.js +257 -0
  35. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-B1rxvfyh.js +65 -0
  36. package/out/renderer/assets/{graph-JbWlVICO.js → graph-DxQCKx-L.js} +1 -1
  37. package/out/renderer/assets/index-BJ-AJLyd.js +804 -0
  38. package/out/renderer/assets/index-BhsV-ipc.js +1 -0
  39. package/out/renderer/assets/index-C7mMgpwT.css +1 -0
  40. package/out/renderer/assets/index-XFXAg7sM.js +7 -0
  41. package/out/renderer/assets/infoDiagram-PH2N3AL5-CDvWuX2O.js +2 -0
  42. package/out/renderer/assets/{installer-BzSW3GXd.js → installer-B4Bd2pBF.js} +1 -1
  43. package/out/renderer/assets/{journeyDiagram-U35MCT3I-ClvPQIft.js → journeyDiagram-U35MCT3I-CnefKX-i.js} +1 -1
  44. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BZbzppxG.js → kanban-definition-NDS4AKOZ-Kd7aNO4_.js} +1 -1
  45. package/out/renderer/assets/{layout-5OTy0Dif.js → layout-CMQ0zdhs.js} +1 -1
  46. package/out/renderer/assets/legacy-agents-page-PBvD5xd9.js +33 -0
  47. package/out/renderer/assets/{mermaid.core-CPsHLTy1.js → mermaid.core-x5Fva3t5.js} +5 -5
  48. package/out/renderer/assets/mesh-page-IOGN512j.js +1 -0
  49. package/out/renderer/assets/messages-D3mGACg6.js +3 -0
  50. package/out/renderer/assets/mindmap-definition-ALO5MXBD-DJwQ3wYh.js +95 -0
  51. package/out/renderer/assets/mini-DHQCkYmb.js +1 -0
  52. package/out/renderer/assets/{notebook-pen-rCh1XFso.js → notebook-pen-CKFoYavJ.js} +1 -1
  53. package/out/renderer/assets/org-access-_jPzS_wW.js +1 -0
  54. package/out/renderer/assets/org-surface-gate-D29XdDTt.js +1 -0
  55. package/out/renderer/assets/{page-header-DWR3DkBt.js → page-header-D90TvAM5.js} +1 -1
  56. package/out/renderer/assets/pieDiagram-IB7DONF6-CW-ezwOn.js +30 -0
  57. package/out/renderer/assets/projects-page-DGLblpIY.js +45 -0
  58. package/out/renderer/assets/publication-validation-ZquLmMLD.js +1 -0
  59. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-COMknoKb.js → quadrantDiagram-7GDLP6J5-cgwnEsXh.js} +1 -1
  60. package/out/renderer/assets/{radar-MK3ICKWK-h-3tH5Fw.js → radar-MK3ICKWK-DvOkOeQ6.js} +1 -1
  61. package/out/renderer/assets/radient-auth-buttons-y3JK-yD8.js +1 -0
  62. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-C2csabhY.js → requirementDiagram-KVF5MWMF-DOMWjtoO.js} +1 -1
  63. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-CE3E7VO5.js +10 -0
  64. package/out/renderer/assets/{schedules-page-C_fL3_DU.js → schedules-page-ETT8R0wn.js} +1 -1
  65. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-D_5OYksN.js → sequenceDiagram-X6HHIX6F-C4EGcl7U.js} +1 -1
  66. package/out/renderer/assets/{settings-page-C_2pijSy.js → settings-page-BZDF6UIV.js} +1 -1
  67. package/out/renderer/assets/stateDiagram-DGXRK772-wBbKaUQh.js +1 -0
  68. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Bh0k2Dz3.js +1 -0
  69. package/out/renderer/assets/{timeline-definition-BDJGKUSR-CTAa43OS.js → timeline-definition-BDJGKUSR-CgTCOxCY.js} +1 -1
  70. package/out/renderer/assets/{use-download-agent-mutation-93lATclk.js → use-download-agent-mutation-DkI3E5yA.js} +4 -4
  71. package/out/renderer/assets/use-memberships-query-Hv-eprVl.js +1 -0
  72. package/out/renderer/assets/{use-session-snapshot-Cn-frFuJ.js → use-session-snapshot-CfEF5TPK.js} +1 -1
  73. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CSWyqHv5.js → xychartDiagram-VJFVF3MP-G2SxM5sQ.js} +1 -1
  74. package/out/renderer/console-capture.html +5 -5
  75. package/out/renderer/index.html +7 -7
  76. package/out/renderer/installer.html +4 -4
  77. package/out/renderer/mini.html +7 -7
  78. package/package.json +2 -2
  79. package/out/renderer/assets/agent-hub-page-C9Lp-DQZ.js +0 -11
  80. package/out/renderer/assets/agents-page-Cn2QkYzI.js +0 -7
  81. package/out/renderer/assets/arc-BTZBmnfj.js +0 -1
  82. package/out/renderer/assets/architectureDiagram-IEHRJDOE-xLXBjFAy.js +0 -36
  83. package/out/renderer/assets/browser-page-Cr3cC55-.js +0 -1
  84. package/out/renderer/assets/browser-webauthn-prompt-BU3XDjzy.js +0 -1
  85. package/out/renderer/assets/channel-C3j8uhMm.js +0 -1
  86. package/out/renderer/assets/classDiagram-GIVACNV2-Sk9b2cas.js +0 -1
  87. package/out/renderer/assets/classDiagram-v2-COTLJTTW-Sk9b2cas.js +0 -1
  88. package/out/renderer/assets/clone-B7BAmXPE.js +0 -1
  89. package/out/renderer/assets/consoleCapture-B-w56zDU.js +0 -1
  90. package/out/renderer/assets/dagre-OKDRZEBW-DVw8A4dj.js +0 -4
  91. package/out/renderer/assets/diagram-SSKATNLV-75BQIb2A.js +0 -43
  92. package/out/renderer/assets/diagram-VNBRO52H-D2ed5_os.js +0 -24
  93. package/out/renderer/assets/ganttDiagram-APWFNJXF-BjiLalpp.js +0 -257
  94. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-DkxhVuU4.js +0 -65
  95. package/out/renderer/assets/index-B7VSZn2a.css +0 -1
  96. package/out/renderer/assets/index-CLXO1J74.js +0 -804
  97. package/out/renderer/assets/index-CW9XM5hB.js +0 -7
  98. package/out/renderer/assets/index-XGDziVI7.js +0 -1
  99. package/out/renderer/assets/infoDiagram-PH2N3AL5-CRisEpP0.js +0 -2
  100. package/out/renderer/assets/legacy-agents-page-fdBM_HQS.js +0 -33
  101. package/out/renderer/assets/mesh-page-Dr6wDE2I.js +0 -1
  102. package/out/renderer/assets/mindmap-definition-ALO5MXBD-CYQ1DQzG.js +0 -95
  103. package/out/renderer/assets/mini-CwJ9fFou.js +0 -1
  104. package/out/renderer/assets/org-surface-gate-CuI0Cbf6.js +0 -1
  105. package/out/renderer/assets/pieDiagram-IB7DONF6-BrQ8agdZ.js +0 -30
  106. package/out/renderer/assets/projects-page-Dla4rRB1.js +0 -50
  107. package/out/renderer/assets/radient-auth-buttons-VPVTWG7f.js +0 -1
  108. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-Cr4lHcZY.js +0 -10
  109. package/out/renderer/assets/stateDiagram-DGXRK772-B2o8DoKk.js +0 -1
  110. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BDfq2d80.js +0 -1
  111. package/out/renderer/assets/ui-preferences-store-lljzccwU.js +0 -1
  112. package/out/renderer/assets/use-memberships-query-DEoRqhiV.js +0 -1
  113. /package/out/renderer/assets/{index-CzjIMcYW.js → index-B-uibf5k.js} +0 -0
@@ -0,0 +1,45 @@
1
+ import{r as d,j as t,c as $}from"./index-B-uibf5k.js";import{bQ as Ea,bR as Yt,bS as Ra,bT as yn,u as vn,bU as Da,bV as Aa,bW as Oa,bX as $a,bY as Pa,bZ as Ma,b_ as Ds,b$ as As,c0 as Ia,c1 as La,C as ls,aH as $e,d as ce,c2 as Fa,D as cs,c3 as qa,c4 as Ua,_ as Et,c5 as Os,c6 as $s,c7 as Ps,bD as Ba,aI as fe,c8 as za,Z as Pe,a as Ve,c as he,aT as kn,aK as Rt,aF as lt,aO as Be,c9 as Ya,ca as Ha,cb as Wa,cc as Ka,cd as Ga,aQ as wn,aP as yt,bi as Va,aA as Qa,aq as vt,bv as Ja,bu as Xa,bs as Ms,ce as Za,cf as Nn,cg as er,ch as tr,aG as ie,ci as sr,cj as nr,ck as ar,cl as rr,cm as ir,cn as Sn,aJ as or,ap as lr,ak as cr,al as dr,an as ur,ao as mr,ar as fr,ax as hr,co as pr,cp as Tn,bz as xr,cq as gr,az as br,aL as jr,aU as yr}from"./conversation-input-sync-BdhFw-JY.js";import{P as Is}from"./page-header-D90TvAM5.js";import{c as ct,z as ze,l as Dt,F as Ye,G as He,H as We,J as _e,B as U,q as ds,r as us,S as we,s as ms,v as ke,a4 as vr,a5 as kr,a6 as wr,a7 as Nr,a8 as Sr,u as Tr,y as xe,a0 as fs,a9 as hs,a2 as ps,I as ne,X as At,g as xs,T as _n,L as oe,M as Cn,C as En,A as Ht,N as _r,W as Cr,Y as Er,Z as Rr,k as Fe}from"./error-boundary-B4K6A3dS.js";import{aZ as Rn,b3 as Dr,b4 as Dn,b5 as Ar,b6 as Or,aJ as $r,az as at,A as Ls,b7 as Fs,b8 as Pr}from"./index-BJ-AJLyd.js";import{h as Mr,j as Ir,k as Ke,l as Lr,m as Wt}from"./messages-D3mGACg6.js";import{u as Fr}from"./use-session-snapshot-CfEF5TPK.js";import"./console-mirror-DF_IQ1r-.js";function qs(e,s){return e.filter(n=>!s.includes(n))}function qr(e,s,n){const a=e.slice(0);return a[s]=n,a}var Ur=class extends Ea{#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,Yt.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()&&(qs(n,r).forEach(o=>{o.destroy()}),qs(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=Ra(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 yn(this.#n,r)})}),n}#m(e,s){const n=this.#t.indexOf(e);n!==-1&&(this.#e=qr(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&&Yt.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function Br({queries:e,...s},n){const a=vn(n),r=Da(),i=Aa(),l=d.useMemo(()=>e.map(v=>{const g=a.defaultQueryOptions(v);return g._optimisticResults=r?"isRestoring":"optimistic",g}),[e,a,r]);l.forEach(v=>{Oa(v),$a(v,i)}),Pa(i);const[o]=d.useState(()=>new Ur(a,l,s)),[c,m,u]=o.getOptimisticResult(l,s.combine),h=!r&&s.subscribed!==!1;d.useSyncExternalStore(d.useCallback(v=>h?o.subscribe(Yt.batchCalls(v)):Ma,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),d.useEffect(()=>{o.setQueries(l,s)},[l,s,o]);const f=c.some((v,g)=>Ds(l[g],v))?c.flatMap((v,g)=>{const x=l[g];if(x){const y=new yn(a,x);if(Ds(x,v))return As(x,y,i);Ia(v,r)&&As(x,y,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const j=c.find((v,g)=>{const x=l[g];return x&&La({result:v,errorResetBoundary:i,throwOnError:x.throwOnError,query:a.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(j?.error)throw j.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 zr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],An=ct("arrow-up",zr);/**
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 Yr=[["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"}]],Hr=ct("calendar-off",Yr);/**
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 Wr=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Kr=ct("list-filter",Wr);/**
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 Gr=[["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"}]],Vr=ct("message-square-more",Gr);/**
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 Qr=[["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"}]],Jr=ct("unlink",Qr),Ot={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Xr(e){return ls({queryKey:Ot.list,enabled:e,queryFn:()=>ce({op:"projects.list"}).then(s=>s.projects),retry:cs,staleTime:1e4})}function Zr(e,s){return Br({queries:e.map(n=>({queryKey:Ot.detail(n),enabled:s&&!!n,queryFn:()=>ce({op:"projects.get",key:n}),retry:cs,staleTime:1e4}))})}function On(e,s){return ls({queryKey:Ot.detail(e??""),enabled:s&&!!e,queryFn:()=>ce({op:"projects.get",key:e??""}),retry:cs,staleTime:1e4})}function Me(){const e=vn();return()=>{e.invalidateQueries({queryKey:Ot.list})}}function ei(){const e=Me();return $e({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 $n(){const e=Me();return $e({mutationFn:s=>ce({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:Fa,onSuccess:()=>e()})}function Pn(){const e=Me();return $e({mutationFn:s=>ce({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function ti(){const e=Me();return $e({mutationFn:s=>ce({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function si(){const e=Me();return $e({mutationFn:s=>ce({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ni(){const e=Me();return $e({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 ai(){const e=Me();return $e({mutationFn:s=>ce({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const Mn={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"}},qe=Object.keys(Mn);function Z(e){return Mn[e]??{label:e||"Unknown",variant:"neutral"}}const In=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:Z(e).label}));function ri(e){return e==="done"}const ii={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function oi(e){return ii[e]??{label:String(e),variant:"neutral"}}const kt="Stale",li=/^(\d{4})-(\d{2})-(\d{2})$/;function Ce(e,s,n=new Date){if(!e)return"";const a=li.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=qa(r,{month:"short",day:"numeric"},s);return r.getFullYear()===n.getFullYear()?i:`${i}, ${r.getFullYear()}`}function dt(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 ut(e){return e==="just now"?"just now":`${e} ago`}function ci(e){return e?`reported ${ut(e)}`:"no progress"}const Ln=/^$|^\d{4}-\d{2}-\d{2}$/;function Fn(e){return e?e==="operator"?"the operator":`session ${e}`:""}function di(e,s){if(!e.progress)return"not reported yet";const n=dt(e.progress_updated_at,s),a=Fn(e.progress_reported_by),r=[n?`reported ${ut(n)}`:"reported"];return a&&r.push(`by ${a}`),r.join(" ")}function qn(e,s){if(e==null)return"";const n=String(e);return s==="points"?`${n} pt`:s==="days"?`${n}d`:n}function Un(e,s){return s<=0?"":`${e}/${s}`}function gs(e){return e<=0?"":`${e} live`}function ui(e){return e<=0?"":e===1?"1 session":`${e} sessions`}function mi(e){return e===1?"1 project":`${e} projects`}function fi(e){const s=ui(e.sessions);if(!s)return"";const n=gs(e.live_sessions);return n?`${s} · ${n}`:s}function hi(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 pi(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 xi(e){return e?e.total===1?"1 todo":`${e.total} todos`:""}function Bn(e,s){const n=[],a=Ce(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=qn(e.estimate,e.estimate_unit);r&&n.push({key:"estimate",text:r});const i=Un(e.milestones_completed,e.milestones_total);i&&n.push({key:"milestones",text:`milestones ${i}`});const l=gs(e.live_sessions);return l&&n.push({key:"live",text:l}),n}const Ue=864e5,gi=/^(\d{4})-(\d{2})-(\d{2})$/;function pe(e){if(!e)return null;const s=gi.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 Kt=["planning","active","qa","validation","done"],Gt=["paused","archived"],$t=[{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}],zn="7d",bi=$t.find(e=>e.value===zn);function Yn(e){return $t.find(s=>s.value===e)??bi}function ji(e){return $t.some(s=>s.value===e)}function Us(e,s,n){const a=Yn(s);return a.seconds===null?e:e.filter(r=>n/1e3-r.updated_at<=a.seconds)}function yi(e){const s=Yn(e);return s.seconds===null?null:`Nothing changed in ${s.phrase}.`}const Hn="projects-board-window";function vi(){try{const e=localStorage.getItem(Hn);if(e!==null&&ji(e))return e}catch{}return zn}function Bs(e){try{localStorage.setItem(Hn,e)}catch{}}const Wn="projects-board-column-order";let Vt=null;function ki(){if(Vt)return[...Vt];try{const e=localStorage.getItem(Wn);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 wi(e){Vt=[...e];try{localStorage.setItem(Wn,JSON.stringify(e))}catch{}}function Ni(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 Si(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=Kt.map(o=>({status:o,projects:n.get(o)??[]}));for(const o of Gt){const c=n.get(o)??[];c.length>0&&a.push({status:o,projects:c})}for(const[o,c]of n)!Gt.includes(o)&&!Kt.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 Kn(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const n=pe(e.target_date);return n===null?!1:n<s}function G(e){return e.title||e.name}const bs="No team";function mt(e){const s=e.team?.trim();if(s)return s;const n=e.owner?.trim();return n||null}function js(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 Pt(e){return e.title||e.session_id}function Ti(e){return[...e].reverse()}function _i(e){return e<=0?"":e===1?"1 update":`${e} updates`}const zs=e=>String(e).padStart(2,"0");function Qt(e){return`${e.getFullYear()}-${zs(e.getMonth()+1)}-${zs(e.getDate())}`}function Ci(e){const s=Date.parse(e);return Number.isNaN(s)?"":Qt(new Date(s))}function Ei(e,s,n=new Date){if(!e)return"";if(e===Qt(n))return"Today";const a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);return e===Qt(a)?"Yesterday":Ce(e,s,n)}function Ri(e,s){const n=Date.parse(e);return Number.isNaN(n)?"":Ua(new Date(n),{hour:"numeric",minute:"2-digit"},s)}function Di(e,s){const n=Date.parse(e);return Number.isNaN(n)?"":ut(dt(n/1e3,s))}function Ai(e,s,n=Date.now()){const a=[],r=Fn(e.by);r&&a.push({key:"author",text:r});const i=Ri(e.at,s);i&&a.push({key:"time",text:i});const l=Di(e.at,n);return l&&a.push({key:"age",text:l}),a}function Oi(e,s,n=new Date){const a=[];for(const r of Ti(e)){const i=Ci(r.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(r);continue}a.push({key:i,label:Ei(i,s,n),entries:[r]})}return a}function $i(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 Pi(e,s){return s<=0?"":`${e} of ${s} complete`}function Mi(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 Ys(e){return`${e.open} open of ${e.total}`}function Ii(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function Li(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(`
27
+ `)}function Fi(e){return e?e.kind==="team"?`team ${e.name}`:`agent ${e.name}`:""}const qi=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Gn(e){const s=[];for(const n of e.matchAll(qi))s.push((n[1]??n[2]??"").replace(/\\(.)/g,"$1"));return s}const jt=3;function ys(e){if(e.length<=jt+1)return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;const s=e.length-jt;return`${e.slice(0,jt).join(", ")} and ${s} more`}function vs(e){return`${e} milestone${e===1?" is":"s are"}`}const Hs="complete them, or pass force_done=true to close with them open",Ui="complete or remove the incomplete milestones, then mark it done",Vn=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function ft(e){const s=e.match(Vn);if(s){const n=Number(s[1]),a=Gn(s[2]),r=a.length>0?ys(a):s[2];return`This can't be marked done yet: ${vs(n)} still incomplete (${r}). Complete or remove the incomplete milestones, then mark it done.`}return e.includes(Hs)?e.replace(Hs,Ui):e}const Bi="project_done_incomplete";function zi(e){const s=e.message.match(Vn),n=e.code===Bi;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?Gn(s[2]):[];return{count:r.length>0?r.length:s?Number(s[1]):0,names:r,coded:n,message:e.message}}function Yi(e){if(e.count>0){const s=ys(e.names);return`${vs(e.count)} still open${s?` (${s})`:""}.`}return ft(e.message)||"Some milestones are still open."}function Hi(e){return e.count>0&&e.names.length>0?`This can't be marked done yet: ${vs(e.count)} still incomplete (${ys(e.names)}). Complete or remove the incomplete milestones, then mark it done.`:ft(e.message)||"Milestones are still open on this project. Complete or remove them, then mark it done."}function Qn(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 Wi="The project was not moved. Try again, or open it to change its status.";function Jn(e){return e.trim().slice(0,Mr)}const Ki={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."},Gi=2,Vi=4,Qi=3,Ji=2,Xi=1,Zi=3,De={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},eo=/[^\p{L}\p{N}]+/u,to=/\s+/;function Ws(e,s){const n=s.trim().toLowerCase();if(!n)return 0;if(n===e)return Vi;if(n.startsWith(e))return Qi;const a=n.split(eo).filter(Boolean),r=e.split(to).filter(Boolean);if(r.length>0&&r.every(l=>a.some(o=>o.startsWith(l))))return Ji;const i=r.join("");return i.length>=Zi&&so(i,n)?Xi:0}function so(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 no(e,s){const n=s.trim().toLowerCase();if(!n)return 0;const a=[[e.title,De.title],[e.name,De.name],[e.description,De.description],[e.owner,De.attribution],[e.team,De.attribution],[e.status,De.status]];let r=0;for(const[i,l]of a){if(!i)continue;const o=Ws(n,i)*l;o>r&&(r=o)}for(const i of e.tags){const l=Ws(n,i)*De.tags;l>r&&(r=l)}return r}function ao(e,s){const n=s.trim();if(!n)return e;const a=[];for(const r of e){const i=no(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 ro(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 io=180;function oo(e,s){const n=Jn(e),a=Rn(n,io),r=ls({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>ce({op:"projects.search",q:a,limit:Ir}),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 Qe=["status","team","owner","tags","progress","target","estimate","milestones","live"],Ks={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"},lo=new Set(["status","progress","target","estimate","milestones","live"]),co={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"]},uo={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 Xn(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 uo[s]??s??""}function mo(e,s){return e[s].length>0}function rt(e){return Qe.every(s=>!mo(e,s))}function fo(e){return Qe.reduce((s,n)=>s+e[n].length,0)}function Zn(e,s,n){const a=e[s],r=a.includes(n)?a.filter(i=>i!==n):[...a,n];return{...e,[s]:r}}function ea(e,s,n,a){switch(e){case"status":return s.status===n;case"team":return mt(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 pe(s.target_date)===null;if(n==="overdue")return Kn(s,a);const r=pe(s.target_date);if(r===null)return!1;const i=(r-a)/Ue;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 ta(e,s,n,a){const r=e[s];return r.length===0?!0:r.some(i=>ea(s,n,i,a))}function ho(e,s,n){return rt(s)?e:e.filter(a=>Qe.every(r=>ta(s,r,a,n)))}function po(e,s,n,a){return s.filter(r=>Qe.every(i=>i===e||ta(n,i,r,a)))}function xo(e,s,n){const a=n[e];switch(e){case"status":{const i=[...new Set(s.map(o=>o.status))].filter(o=>!qe.includes(o)).sort((o,c)=>o.localeCompare(c,void 0,{sensitivity:"base"})),l=a.filter(o=>typeof o=="string"&&!qe.includes(o)&&!i.includes(o));return[...qe,...i,...l]}case"team":{const r=new Set;let i=!1;for(const o of s){const c=mt(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 co[e]}}function sa(e,s,n,a){const r=po(e,s,n,a),i=lo.has(e),l=[];for(const o of xo(e,r,n)){const c=n[e].includes(o),m=r.reduce((u,h)=>u+(ea(e,h,o,a)?1:0),0);!i&&m===0&&!c||l.push({value:o,label:Xn(e,o),count:m,selected:c})}return{facet:e,label:nt[e],options:l}}function go(e,s,n){return Qe.map(a=>sa(a,e,s,n))}const Jt="projects-sort",bo="Default (as listed)";function jo(e){return yo.includes(e)}const yo=["name","status","target","estimate","milestones","live","progress"];function vo(){try{const e=localStorage.getItem(Jt);if(e===null)return null;const[s,n,...a]=e.split(":");if(a.length>0)return null;if(s&&jo(s)&&(n==="asc"||n==="desc"))return{key:s,direction:n}}catch{}return null}function ko(e){try{e===null?localStorage.removeItem(Jt):localStorage.setItem(Jt,`${e.key}:${e.direction}`)}catch{}}function Ge(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 Ft(e){return e==="target"||e==="progress"?"desc":"asc"}function ks(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 wo(e){return e===null?"Sort cleared.":`Sorted by ${Ge(e.key)}, ${ks(e.key,e.direction)}.`}function No(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 Gs(e,s){switch(e){case"name":return 0;case"status":return qe.includes(s.status)?0:1;case"target":return Xt(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 Xt(e){return pe(e.completed_at??e.target_date)}function Vs(e){return e==="points"?0:e==="days"?1:2}function So(e,s,n){switch(e){case"name":return G(s).localeCompare(G(n),void 0,{sensitivity:"base"});case"status":return qe.indexOf(s.status)-qe.indexOf(n.status);case"target":{const a=Xt(s)??0,r=Xt(n)??0;return a-r}case"estimate":{const a=Vs(s.estimate_unit)-Vs(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 Qs(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 To(e,s,n){const a=Gs(n.key,e),r=Gs(n.key,s);if(a!==r)return a-r;if(a===1)return Qs(e,s);const i=So(n.key,e,s);return i!==0?n.direction==="desc"?-i:i:Qs(e,s)}function _o(e,s){return[...e].sort((n,a)=>To(n,a,s))}const Te=["day","week","month","quarter"],ws={day:24,week:9,month:3,quarter:1};function Ns(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Ae(e,s){return Math.round((s-e)/Ue)}function Js(e,s){return Ae(e,s)+1}function Co(e,s){for(const n of Te)if(e*ws[n]<=s)return n;return Te[Te.length-1]}function Eo(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(n=>!!n.target_date)}function Ro(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=pe(r);i!==null&&n.push(i)}for(const r of a.milestones){const i=pe(r.target_date);i!==null&&n.push(i)}}return n.length===1?null:{startMs:Math.min(...n),endMs:Math.max(...n)}}function Do(e){const s=[],n=[];for(const a of e)(Eo(a)?s:n).push(a);return{dated:s,undated:n}}function Ao(e){return`${e} project${e===1?"":"s"} without dates`}function Oo(e){const{project:s}=e,n=pe(s.start_date),a=pe(s.target_date),r=pe(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 $o(e){const s=[];for(const n of e.milestones){const a=pe(n.target_date);a!==null&&s.push({name:n.name,dayMs:a,status:n.status})}return s}const bt=["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 Po(e){const{year:s,month:n}=de(e);return Date.UTC(s,n-1,1)}function Mo(e){const{year:s,month:n}=de(e);return n===12?Date.UTC(s+1,0,1):Date.UTC(s,n,1)}function Io(e){const{year:s,month:n}=de(e);return Date.UTC(s,Math.floor((n-1)/3)*3,1)}function Lo(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 Fo(e){const{weekday:s}=de(e);return e-(s+6)%7*Ue}const qo=26;function Uo(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+=Ue){const{day:b,month:f}=de(h);b===1?(r(h,bt[f-1],!0),u=!0):u?(r(h,"",!1),u=!1):r(h,String(b),!1)}return a}if(n==="week"){for(let u=Fo(e);u<=s;u+=7*Ue){if(u<e)continue;const{day:h,month:b}=de(u);de(u-7*Ue).month!==b?r(u,`${bt[b-1]} ${h}`,!0):r(u,String(h),!1)}return a}const i=n==="month"?Po:Io,l=n==="month"?Mo:Lo,o=u=>{const{year:h,month:b}=de(u);if(n==="month")return b===1&&h!==de(e).year?`${bt[0]} '${String(h%100).padStart(2,"0")}`:bt[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(qo/ws[n]);let m=e;for(let u=l(i(e));u<=s;u=l(u))Ae(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 wt=80,Nt=80,Xs=64,Zs=8;function Zt(e){return e.trim().length>wt?`Titles are at most ${wt} characters.`:null}function na(e){return e.length>Ke?`Keep the description within ${Ke} characters.`:null}function St(e,s){return e.trim().length>Nt?`${s==="owner"?"Owners":"Teams"} are at most ${Nt} characters.`:null}function es(e){return Ln.test(e)?null:"Dates are YYYY-MM-DD, or empty."}function ts(e,s){return e&&s&&s<e?"The target date is before the start date.":null}function aa(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 ss(e){const s=it(e);if(s.length>Zs)return{tags:s,error:`Up to ${Zs} tags.`};for(const n of s){const a=Lr(n);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const Bo="project_name_exists";function en(e){return e.code===Bo?"A project with this key already exists.":ft(e.message)||"The project was not saved."}function zo(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 Yo(e,s){const n=it(s);return n.length!==e.length?!1:n.every((a,r)=>a===e[r])}function Ho(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 Je(e){return e instanceof Et?en({code:e.code,message:e.message}):en({message:e instanceof Error?e.message:""})}function ra(e){return e instanceof Et&&(e.code==="project_not_found"||e.status===404)}function ia(e){return!(e instanceof Error)||!e.message?Wi:ra(e)?"This project could not be found. It may have been deleted.":Je(e)}function oa(e){if(!(e instanceof Error))return null;const s=e instanceof Et?e:null;return zi({code:s?.code??null,message:e.message,detail:s?.detail})}async function Wo(e){try{return await e.move(),{kind:"accepted"}}catch(s){const n=oa(s);return n?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:n}:{kind:"spoken",copy:n?Hi(n):ia(s),refusal:n}}}const Ko="Shows projects last updated within this window; older ones are hidden.",Go=({value:e,onChange:s})=>t.jsxs(ze,{value:e,onValueChange:n=>s(n),children:[t.jsx(Dt,{content:e==="all"?null:Ko,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(He,{})})}),t.jsx(We,{children:$t.map(n=>t.jsx(_e,{value:n.value,children:n.label},n.value))})]}),ns=6e4,as=6e3,tn="Requesting updates…",Vo=400,Qo="Ask the sessions linked to this project to post a progress update",Jo="linked but not yet in use — it becomes a recipient after the first message",sn=e=>`project-request-update-${e}`,Xo=e=>`project-request-cooldown-${e}`,Zo=e=>`project-request-update-cooldown-${e}`,qt=e=>e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e[0]}, ${e[1]} and ${e.length-2} more`,nn=(e,s)=>e.sessions.filter(n=>n.outcome===s).map(n=>Pt({session_id:n.session_id,title:n.title})),el=e=>e.outcome==="failed"&&e.detail===Jo;function Tt(e,s){const n=Math.max(1,Math.ceil(s/1e3));return`Update already requested ${Math.max(0,Math.ceil(ns/1e3)-n)} s ago on ${e}. Try again in ${n} s.`}function tl(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:as};if(e.state==="cooldown")return{variant:"info",title:Tt(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:as};if(e.state!=="sent")return null;const l=nn(e,"failed"),o=nn(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+=` ${qt(l)} could not be reached.`),a>0&&(c+=` Delivery to ${qt(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(el);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 ${qt(o)} could not be confirmed.`,duration:Number.POSITIVE_INFINITY}}const st=new Map,Ss=new Set,Ut=new Map,rs=new Set;let la=0;const _t=()=>{la+=1;for(const e of rs)e()},sl=e=>(rs.add(e),()=>{rs.delete(e)}),an=()=>la,ca=e=>Ss.has(e),da=e=>st.get(e);function nl(e){Ss.add(e),_t()}function al(e){Ss.delete(e),_t()}function rn(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=Ut.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Ut.delete(e);const o=st.get(e);o&&o.untilMs<=Date.now()&&(st.delete(e),_t())},n-a);l.unref?.(),Ut.set(e,l),_t()}const rl=e=>/[.!?…]$/.test(e)?e:`${e}.`;function il(e,s){const n=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;rn(e,n-(ns-a),n+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&rn(e,n,n+ns)}async function ol(e){const s=e.id;if(ca(s)){Os(tn,{id:sn(s)});return}const n=Date.now(),a=da(s);if(a&&a.untilMs>n){$s(Tt(G(e),a.untilMs-n),{id:Xo(s),duration:as});return}nl(s);const r=sn(s);let i=!1;const l=setTimeout(()=>{i=!0,Os(tn,{id:r})},Vo);try{const o=await ce({op:"projects.request_update",key:s});il(s,o);const c=tl(o);if(c){const m={id:r,...c.duration!==void 0?{duration:c.duration}:{}};switch(c.variant){case"success":fe(c.title,m);break;case"warning":Ba(c.title,m);break;case"error":Ps(c.title,m);break;default:$s(c.title,m)}}else i&&za(r)}catch(o){const c=o instanceof Error&&o.message.trim()!==""?o.message.trim():null;Ps(c?`Could not request updates: ${rl(c)}`:"The request could not be confirmed.",{id:r,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),al(s)}}function ua(){return d.useCallback(e=>{ol(e)},[])}function ll(e){d.useSyncExternalStore(sl,an,an);const s=ca(e),n=da(e),a=n!==void 0?n.untilMs-Date.now():0,r=a>0;return{sending:s,cooling:r,cooldownRemainingMs:r?a:null}}const on={active:"In flight",paused:"On hold",done:"Finished"};function cl(){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 dl=4,Bt="Drag the header, or press the arrow keys, to move this column.",ln="board-column-move-hint",ul=({projects:e,nowMs:s,onOpen:n,onEdit:a,onDelete:r,onMove:i,movingKeys:l=[],teamLabelFor:o=c=>c})=>{const[c,m]=d.useState(ki),u=Si(e,c),h=js(e,mt),[b,f]=d.useState(null),[j,v]=d.useState(""),g=d.useRef(null),x=d.useRef(null),y=d.useRef(null),C=d.useRef(null),w=d.useRef(null),L=new Set(l),T=(k,N)=>{const R=Ni(u.map(M=>M.status),k,N);m(R),wi(R),v(`Moved ${Z(k).label} column to position ${R.indexOf(k)+1} of ${R.length}.`)},_=(k,N)=>{const R=g.current;if(!R)return 0;let M=0;const F=R.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&&(M+=1)}return M},O=(k,N)=>{const R=u.filter(q=>q.status!==k),M=R[N-1]?.status,F=R[N]?.status;return M&&F?`between ${Z(M).label} and ${Z(F).label}`:F?`before ${Z(F).label}`:M?`after ${Z(M).label}`:"in place"},p=(k,N)=>{const R=_(k,N.status);R!==N.over&&(N.over=R,f({status:N.status,over:R}),v(`Moving ${Z(N.status).label} column; it will drop ${O(N.status,R)}.`))},A=()=>{C.current!==null&&(cancelAnimationFrame(C.current),C.current=null)},E=32,P=12,z=()=>{C.current=null;const k=w.current,N=g.current,R=y.current;if(!k?.armed||!N||R===null)return;const M=N.getBoundingClientRect(),F=N.scrollWidth-N.clientWidth;let q=0;if(R-M.left<E&&N.scrollLeft>0?q=-1:M.right-R<E&&N.scrollLeft<F&&(q=1),q!==0){const ae=N.scrollLeft;N.scrollLeft=ae+q*P,N.scrollLeft!==ae&&p(R,k)}else p(R,k);Q(k.status,k.over),C.current=requestAnimationFrame(z)};d.useEffect(()=>()=>{C.current!==null&&cancelAnimationFrame(C.current)},[]);const I=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}w.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:u.findIndex(R=>R.status===N)},y.current=k.clientX}},B=k=>{const N=w.current;if(!(!N||k.pointerId!==N.pointerId)){if(y.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<dl)return;N.armed=!0,f({status:N.status,over:N.over}),v(`Moving ${Z(N.status).label} column.`),C.current===null&&(C.current=requestAnimationFrame(z))}p(k.clientX,N)}},W=k=>{const N=w.current;if(w.current=null,A(),f(null),!N?.armed)return;if(!k){v("Move cancelled.");return}const R=u.findIndex(M=>M.status===N.status);if(N.over===R){v("");return}T(N.status,N.over)},V=k=>{const N=w.current;!N||k.pointerId!==N.pointerId||W(!0)},le=()=>{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 R=g.current,M=x.current;if(!R||!M)return;const F=R.getBoundingClientRect(),q=[];for(const re of R.querySelectorAll("[data-board-column]"))re.dataset.boardColumn!==k&&q.push(re.getBoundingClientRect());const ae=6,Ee=N>=q.length?(q[q.length-1]?.right??F.left)+ae:(q[N]?.left??F.right)-ae,Y=R.scrollLeft,Ne=2,ge=Ee-F.left+Y,me=Y+1,X=Y+F.width-Ne-1,Re=Math.round(Math.min(Math.max(ge,me),Math.max(me,X)));M.style.left=`${Re}px`},[]);d.useLayoutEffect(()=>{b&&Q(b.status,b.over)},[b,Q]);const J=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(Bt);return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const R=u.map(q=>q.status),M=R.indexOf(N),F=k.key==="ArrowLeft"?M-1:M+1;if(F<0||F>=R.length){v(`${Z(N).label} column is already ${F<0?"the first column":"the last column"}.`);return}T(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:j}),t.jsx("span",{id:ln,className:"sr-only",children:Bt}),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:R=>I(R,k.status),onPointerMove:B,onPointerUp:V,onPointerCancel:le,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":ln,title:Bt,className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:R=>J(R,k.status),children:t.jsx(Dr,{"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}),on[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:on[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?bs: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 R=k.items.filter(M=>M.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:R.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:R.map(M=>t.jsx("li",{children:t.jsx(ml,{project:M,nowMs:s,busy:L.has(M.id),onOpen:()=>n(M),onEdit:()=>a(M),onDelete:()=>r(M),onMove:F=>i(M,F)})},M.id))})},N.status)})})]},k.team??""))]})]})]})},ml=({project:e,nowMs:s,busy:n,onOpen:a,onEdit:r,onDelete:i,onMove:l})=>{const o=Pe(),c=Bn(e,o),m=Ve(),u=ua(),h=he(m.data,"projects_request_update"),b=G(e),f=d.useRef(null),[j,v]=d.useState(!1);d.useEffect(()=>{const w=f.current;if(!w)return;const L=()=>{w.isConnected&&v(w.scrollWidth-w.clientWidth>.5)},T=requestAnimationFrame(L),_=new ResizeObserver(L);return _.observe(w),document.fonts?.ready.then(L).catch(()=>{}),()=>{cancelAnimationFrame(T),_.disconnect()}},[b,j]);const g=Kn(e,Ns(s)),x=dt(e.progress_updated_at,s),y=()=>{const w=window.getSelection();w&&!w.isCollapsed||a()},C=w=>{w.key!=="Enter"&&w.key!==" "||w.target===w.currentTarget&&(w.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":`Open ${b}`,onClick:y,onKeyDown:C,className:$("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",g&&"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(Dt,{content:j?b:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:f,"data-project-title":e.name,tabIndex:j?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:b})}),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(ds,{children:[t.jsx(us,{"data-project-menu":e.id,"aria-label":`Actions for ${b}`,disabled:n,onClick:w=>w.stopPropagation(),className:$("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:n?t.jsx(we,{size:"xs"}):t.jsx(kn,{className:"size-4"})}),t.jsxs(ms,{align:"end",onClick:w=>w.stopPropagation(),children:[t.jsx(ke,{onSelect:a,children:"Open"}),t.jsxs(vr,{children:[t.jsx(kr,{children:"Set status"}),t.jsx(wr,{children:t.jsx(Nr,{value:e.status,onValueChange:l,children:[...Kt,...Gt].map(w=>t.jsx(Sr,{value:w,children:Z(w).label},w))})})]}),h&&t.jsx(ke,{onSelect:()=>u(e),children:"Request update"}),t.jsx(Tr,{}),t.jsx(ke,{onSelect:r,children:"Edit"}),t.jsx(ke,{onSelect:i,children:"Delete"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c.filter(w=>w.key!=="live").map(w=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:w.text},w.key)),g&&t.jsx(xe,{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:ci(x)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!x)&&t.jsx("span",{"aria-label":kt,title:kt,className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(fl,{project:e})]})]})]})},fl=({project:e})=>{const[s,n]=d.useState(!1),a=Rt(),r=On(e.id,s),i=r.data?.links??[],l=fi(e),o=G(e);return t.jsxs(fs,{open:s,onOpenChange:n,children:[t.jsx(hs,{"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(ps,{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),Dn(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))})})]})},ma=({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(Be,{onClick:n,disabled:c,children:"Cancel"}),t.jsxs(Ya,{onClick:()=>void b(),disabled:!h||c,children:[c&&t.jsx(we,{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 hl(e){return e==="editing"||e==="saving"||e==="error"}function pl(e,s,n=Object.is){return!n(e,s)}function xl(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 gl(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function bl(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 cn(e,s,n=Object.is){return!n(e,s)}const Ts="group/inline-edit",zt="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",jl="relative before:absolute before:-inset-1.5 before:content-['']",yl="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",vl="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",is=({api:e,idle:s="affordance",className:n})=>{const{phase:a,labels:r}=e,i=a==="editing"||a==="saving"||a==="error",l=gl(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:$(zt,yl,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(At,{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(we,{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:$(zt,vl,o&&"cursor-default text-ink-disabled"),children:t.jsx(xs,{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:$(zt,jl,"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(Ha,{className:"size-3","aria-hidden":"true"})}):null})},kl="This changed while you were editing",wl="Keep mine",Nl="Use theirs",os=({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:kl}),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:wl}),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:Nl})]})]})},fa=d.createContext(null),Sl=50,Tl=({children:e})=>{const[s,n]=d.useState(""),a=d.useMemo(()=>({current:r=>{n(""),window.setTimeout(()=>n(r),Sl)}}),[]);return t.jsxs(fa.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},_l=1200;function Cl(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function ht(e){const{value:s,multiline:n=!1,keyboardCommit:a=!0,selectAllOnBegin:r=!1,beginOnMount:i=!1,savedDwellMs:l=_l,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 j=d.useRef(o);j.current=o;const[v,g]=d.useState(i?"editing":"idle"),[x,y]=d.useState(s),[C,w]=d.useState(s),[L,T]=d.useState(null),[_,O]=d.useState(null),p=d.useRef(v),A=d.useRef(x),E=d.useRef(C),P=d.useRef(L),z=d.useRef(s);z.current=s;const I=d.useCallback(D=>{p.current=D,g(D)},[]),B=d.useCallback(D=>{A.current=D,y(D)},[]),W=d.useCallback(D=>{E.current=D,w(D)},[]),V=d.useCallback(D=>{P.current=D,T(D)},[]),le=d.useRef(null),Q=d.useRef(null),J=d.useRef(null),k=e.editorRef??J,N=d.useRef(k);N.current=k;const R=`${d.useId()}-inline-edit`,M=d.useContext(fa),F=d.useRef(null),q=F.current,Ee=q!==null&&(e.equals??Object.is)(s,q.previous)&&!(e.equals??Object.is)(s,q.saved)&&q!==null?q.saved:s,Y=d.useRef(Ee);Y.current=Ee,d.useEffect(()=>{const D=F.current;if(D===null)return;const te=c.current;(te(s,D.saved)||!te(s,D.previous))&&(F.current=null)},[s]);const Ne=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!Ne.current)return;Ne.current=!1;const D=N.current.current;D&&(D.focus(),r&&(D instanceof HTMLInputElement||D instanceof HTMLTextAreaElement)&&D.select())},[v,r]);const ge=d.useRef(!1);d.useEffect(()=>{ge.current&&(v!=="idle"&&v!=="saved"||(ge.current=!1,Q.current?.focus()))});const me=d.useRef(null),X=d.useCallback(()=>{me.current!==null&&(clearTimeout(me.current),me.current=null)},[]);d.useEffect(()=>()=>X(),[X]);const Re=d.useRef(v);d.useEffect(()=>{const D=Re.current;if(Re.current=v,D==="saving"&&v==="saved"){b.current?.("saved");return}(D==="editing"||D==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const D=bl({phase:p.current,base:E.current,draft:A.current,fresh:Y.current,equals:c.current});D==="adopt"?(c.current(E.current,Y.current)||W(Y.current),c.current(Y.current,A.current)||B(Y.current)):D==="conflict"&&(P.current===null||!c.current(P.current,Y.current))&&V(Y.current)},[s,v,W,B,V]);const re=d.useCallback(D=>{V(null),O(null),B(E.current),I("idle"),D&&(ge.current=!0)},[V,B,I]),Xe=d.useCallback(()=>{p.current!=="saving"&&(p.current==="idle"||p.current==="saved"||(X(),re(!0)))},[X,re]),ee=d.useCallback((D,te=!0)=>{const tt=p.current;if(tt==="saving"||tt==="saved"||P.current!==null)return;const be=D!==void 0?D:A.current;if(!cn(E.current,be,c.current)){re(te&&tt!=="idle");return}const xt=u.current?.(be)??null;if(xt!==null){I("error"),O(xt);return}B(be),O(null),I("saving"),m.current(be).then(()=>{p.current==="saving"&&(F.current={saved:be,previous:E.current},W(be),B(be),te&&(ge.current=!0),I("saved"),X(),me.current=setTimeout(()=>{me.current=null,p.current==="saved"&&I("idle")},l),M?.current?.(j.current.saved))},Le=>{p.current==="saving"&&(I("error"),O(h.current?h.current(Le):Cl(Le)))})},[M,X,re,l,W,B,I]),Se=d.useCallback(()=>{p.current==="editing"||p.current==="saving"||(X(),Ne.current=!0,B(Y.current),W(Y.current),V(null),O(null),I("editing"),f.current?.())},[X,W,V,B,I]),Ie=d.useCallback(()=>{const D=P.current;D!==null&&(V(null),W(D),ee())},[ee,W,V]),It=d.useCallback(()=>{const D=P.current;D!==null&&(W(D),re(!0))},[re,W]),Ze=d.useCallback(D=>{const te=xl(D,{multiline:n,keyboardCommit:a,onEditor:D.target===N.current.current});if(te==="revert"){D.preventDefault(),Xe();return}te==="accept"&&(D.preventDefault(),ee())},[ee,Xe,a,n]),et=d.useCallback(D=>{if(p.current!=="editing")return;const te=D.relatedTarget;if(!(te!==null&&le.current?.contains(te))&&!(te instanceof Element&&te.closest("[data-radix-popper-content-wrapper]")!==null)&&P.current===null){if(!cn(E.current,A.current,c.current)){re(!1);return}ee(void 0,!1)}},[ee,re]),pt=v==="saved"?x:Ee;return{phase:v,dirty:pl(C,x,c.current),conflict:L,error:_,draft:x,setDraft:B,displayValue:pt,editing:hl(v),begin:Se,accept:ee,cancel:Xe,keepMine:Ie,useTheirs:It,handleKeyDown:Ze,handleBlur:et,fieldProps:{onKeyDown:Ze,onBlur:et,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":_!==null?!0:void 0,"aria-describedby":_!==null||L!==null?R:void 0},fieldRef:le,editorRef:k,slotRef:Q,feedbackId:R,labels:o}}const El=/^(https?:|mailto:)/i,Rl={a:({href:e,children:s})=>typeof e=="string"&&El.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:Ka},ot=d.memo(({children:e,className:s})=>t.jsx("div",{className:$("lo-markdown",s),children:t.jsx(Wa,{remarkPlugins:[Ga],components:Rl,children:e})})),dn=`## Summary
28
+
29
+ ## Goals
30
+
31
+ ## Notes`,Dl=new RegExp("\\p{Mn}","gu"),Al=/[^a-z0-9._-]+/g,Ol=/[._-]{2,}/g,$l=/^[^a-z0-9]+/,un=/[^a-z0-9]+$/;function Pl(e){return e.normalize("NFKD").replace(Dl,"").toLowerCase().replace(Al,"-").replace(Ol,"-").replace($l,"").replace(un,"").slice(0,64).replace(un,"")}const Ml=/&#x([0-9a-f]+);/gi,Il=/&#(\d+);/g,Ll=/&nbsp;/g,Fl=/&lt;/g,ql=/&gt;/g,Ul=/&quot;/g,Bl=/&#39;|&apos;/g,zl=/&amp;/g,mn=e=>e.replace(Ml,(s,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(Il,(s,n)=>String.fromCodePoint(Number.parseInt(n,10))).replace(Ll," ").replace(Fl,"<").replace(ql,">").replace(Ul,'"').replace(Bl,"'").replace(zl,"&"),Yl=/<[^>]*>|[^<]+/g,Hl=/^<\//,Wl=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,Kl=/\s+/g,fn=/class="[^"]*language-([\w+-]+)/,Gl=/href="([^"]*)"/,Vl=/src="([^"]*)"/,Ql=/alt="([^"]*)"/,Jl=/[ \t]+\n/g,Xl=/\n{3,}/g;function Zl(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(`
32
+ `))},c=e.match(Yl)??[];for(let m=0;m<c.length;m++){const u=c[m];if(!u.startsWith("<")){o(r()?mn(u):mn(u).replace(Kl," "));continue}const h=Hl.test(u),b=(u.match(Wl)?.[1]??"").toLowerCase();if(h){switch(b){case"p":case"div":o(`
33
+
34
+ `);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":n(b),o(`
35
+
36
+ `);break;case"li":{n("li"),o(`
37
+ `);const f=[...s].reverse().find(j=>j.tag==="ul"||j.tag==="ol");f?.ordered&&(f.index=(f.index??1)+1);break}case"ul":case"ol":n(b),o(`
38
+ `);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(`
39
+ `);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(j=>j.tag==="ul"||j.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(fn)?.[1]??c[m+1]?.match(fn)?.[1]??"";s.push({tag:"pre"}),o(`
40
+ \`\`\`${f}
41
+ `);break}case"a":{const f=u.match(Gl)?.[1]??"";s.push({tag:"a",href:f}),f&&o("[");break}case"img":{const f=u.match(Vl)?.[1]??"",j=u.match(Ql)?.[1]??"";f&&o(`![${j}](${f})`);break}case"br":o(`
42
+ `);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(Jl,`
43
+ `).replace(Xl,`
44
+
45
+ `).trim()}function ha(e,s,n){const a=e.clipboardData?.getData("text/html");if(!a)return;const r=Zl(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 pa=({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:ia(v),gone:ra(v)})}finally{h.current=!1,c(!1)}}},j=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(Be,{ref:b,onClick:a,disabled:o,children:"Cancel"}),!m?.gone&&t.jsx(Be,{onClick:l,disabled:o,children:i}),m?.gone?t.jsx(yt,{"data-project-force-close":"",onClick:a,children:"Close"}):t.jsxs(yt,{"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(we,{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?Yi(s):""}),j.length>jt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(wn,{summary:`Show all ${j.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:j.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??""})]})})},xa=({status:e})=>{const s=Z(e);return t.jsxs(xe,{variant:s.variant,children:[ri(e)&&t.jsx(xs,{"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 Mt=({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:j})=>t.jsxs("div",{ref:s,...n,"data-project-field":e,className:$(!i&&Ts,"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(is,{api:c,idle:u,className:$("shrink-0",j)})]}),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(os,{api:m}),b]})})]})]}),Oe=({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:j,className:v,controlsClassName:g})=>{const[x,y]=d.useState(b);d.useEffect(()=>{x&&s!==""&&(y(!1),j?.("filled"))},[x,s,j]);const C=ht({value:s,commit:async w=>{await l(a(w))},equals:(w,L)=>w.trim()===L.trim(),validate:r,labels:i,selectAllOnBegin:!0,beginOnMount:b,errorCopy:Je,onSettle:w=>{w==="cancelled"&&(y(!1),j?.("cancelled"))}});return!x&&s===""?null:t.jsx(Mt,{field:e,fieldRef:C.fieldRef,fieldProps:C.fieldProps,editing:C.editing,label:u,bare:h,display:n,slot:C,feedback:C,className:v,controlsClassName:g,editor:t.jsx(ne,{ref:C.editorRef,...C.editorAria,value:C.draft,readOnly:C.phase==="saving",maxLength:f,placeholder:o,"aria-label":i.name,onChange:w=>C.setDraft(w.target.value),spellCheck:!1,autoComplete:"off",className:$("h-8",c?"font-mono text-mono-sm":m)})})},ec=({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:$(Ts,"flex min-w-0 flex-col gap-0.5"),children:[n?t.jsx(Oe,{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=>Zt(o),labels:ue("title","Title"),commit:s,maxLength:wt,placeholder:"A short name for the workstream",ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(Oe,{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=>Wt(o.trim()),labels:ue("key","Key"),commit:s,maxLength:Xs,placeholder:"project-key",ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!n&&(a?t.jsx(Oe,{field:"title",value:"",display:null,commitFields:o=>({title:o.trim()}),validate:o=>Zt(o),labels:ue("title","Title"),commit:s,maxLength:wt,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(Oe,{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=>Wt(o.trim()),labels:ue("key","Key"),commit:s,maxLength:Xs,placeholder:"project-key",mono:!0})]})},tc=({project:e,commit:s})=>{const[n,a]=d.useState(!1),r=Ve(),i=he(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=ht({value:e.status,commit:async g=>{const x=u.current;u.current=!1,o(null);try{const y=await s({status:g},x?{forceDone:!0}:void 0);x&&fe(Qn(y,l?.count??0,Z(g).label)),b.current?.resolve()}catch(y){throw o(oa(y)),b.current?.reject(y),y}finally{b.current=null}},labels:ue("status","Status"),keyboardCommit:!1,errorCopy:Je,onBegin:()=>a(!0)}),j=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(Mt,{field:"status",fieldRef:f.fieldRef,fieldProps:f.fieldProps,editing:f.editing,display:t.jsx(xa,{status:e.status}),slot:f,feedback:f,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[j&&t.jsx(U,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>m(l),children:"Mark done anyway…"}),t.jsx(pa,{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(ze,{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(He,{})}),t.jsx(We,{children:In.map(g=>t.jsx(_e,{value:g.value,"data-project-status-option":g.value,children:g.label},g.value))})]})})},sc=({project:e,commit:s})=>{const[n,a]=d.useState(!1),r=d.useRef(null),i=d.useRef(null),l=ht({value:e.description,commit:async m=>{await s({description:m.trim()})},equals:(m,u)=>m.trim()===u.trim(),validate:m=>na(m),multiline:!0,labels:ue("description","Description"),errorCopy:Je,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>Ke;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:$(Ts,"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(is,{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(_n,{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=>ha(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(os,{api:l}),t.jsxs("p",{className:$("shrink-0 text-meta tabular-nums",c?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",Ke]})]})]}):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(is,{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(os,{api:l})})]})})},nc=({project:e,commit:s,autoBegin:n=!1,onRetire:a})=>t.jsx(Oe,{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=>St(r,"owner"),labels:ue("owner","Owner"),commit:s,maxLength:Nt,placeholder:"atlas",autoBegin:n,onRetire:a}),ac=({project:e,commit:s,label:n=null,autoBegin:a=!1,onRetire:r})=>t.jsx(Oe,{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=>St(i,"team"),labels:ue("team","Team"),commit:s,maxLength:Nt,placeholder:"platform",autoBegin:a,onRetire:r}),hn=({project:e,commit:s,which:n,nowMs:a,autoBegin:r=!1,onRetire:i})=>{const l=n==="start"?e.start_date??"":e.target_date??"",o=Pe(),c=Ce(l,o,new Date(a)),m=n==="start"?"Start":"Target";return t.jsx(Oe,{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=es(u);return h||(n==="start"?ts(u,e.target_date??""):ts(e.start_date??"",u))},labels:ue(`${m.toLowerCase()} date`,m),commit:s,placeholder:"YYYY-MM-DD",autoBegin:r,onRetire:i})},rc=({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=ht({value:{number:e.estimate===null?"":String(e.estimate),unit:r.unit},equals:zo,commit:async m=>{const u=Ho(r,m);u&&await s(u)},validate:m=>aa(m.number),labels:ue("estimate","Estimate"),selectAllOnBegin:!0,beginOnMount:n,errorCopy:Je,onSettle:m=>{m==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const c=qn(e.estimate,e.estimate_unit)||"—";return t.jsx(Mt,{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(ze,{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(He,{})}),t.jsxs(We,{children:[t.jsx(_e,{value:"points",children:"Points"}),t.jsx(_e,{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."})]})})},ic=({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=ht({value:e.tags.join(", "),equals:(c,m)=>Yo(it(c),m),commit:async c=>{const{tags:m}=ss(c);await s({tags:m})},validate:c=>ss(c).error,labels:ue("tags","Tags"),selectAllOnBegin:!0,beginOnMount:n,errorCopy:Je,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(Mt,{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(xe,{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(xe,{variant:"outline",children:c},c))})]})})},oc="project-quick-send:no-target",lc=[],cc=({links:e,target:s,onTargetChange:n,onSend:a,focusTick:r})=>{const i=d.useRef(null),l=Va(),{frontend:o,refresh:c}=Fr(),[m,u]=d.useState(!1),h=Ve(),b=s??oc;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(ze,{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(He,{placeholder:"No session selected"})}),t.jsx(We,{children:f.map(g=>t.jsx(_e,{value:g.session_id,children:Pt(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(Qa,{ref:i,conversationId:b,messages:lc,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:he(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})}}})]})},dc=({links:e,busy:s,onUnlink:n,onLink:a,onQuickSend:r,onStartSession:i})=>{const l=Rt(),o=vt(x=>x.sessions),[c,m]=d.useState(!1),[u,h]=d.useState(null),[b,f]=d.useState(0),j=u&&e.some(x=>x.session_id===u&&x.exists)?u:Ii(e),v=d.useMemo(()=>{const x=new Set(e.map(y=>y.session_id));return o.filter(y=>!x.has(y.session_id)).map(y=>({id:y.session_id,name:y.title||y.session_id,description:y.cwd??void 0}))},[o,e]),g=x=>{vt.getState().openSession(x).then(y=>{y&&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(Ar,{}),"New session"]}),t.jsxs(U,{variant:"secondary",size:"sm",disabled:s,onClick:()=>m(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Or,{}),"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 y=hi(x),C=pi(x.subagents),w=xi(x.todos),L=x.title||x.session_id,T=x.exists;return t.jsxs("li",{className:$("flex items-center gap-2 rounded-sm px-2 py-2",T&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!T,onClick:()=>{T&&g(x.session_id)},className:$("flex min-w-0 flex-1 items-center gap-2 text-left",T?"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:L})}),x.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),C&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:C}),w&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:w}),t.jsx(xe,{variant:y.variant,children:y.label}),T&&t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Message ${L}`,title:`Message ${L}`,onClick:()=>{h(x.session_id),f(_=>_+1)},children:t.jsx($r,{})}),t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${L}`,onClick:()=>n(x.session_id),children:t.jsx(Jr,{})})]},x.session_id)})}),e.some(x=>x.exists)&&t.jsx(cc,{links:e,target:j,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(Be,{onClick:()=>m(!1),children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(oe,{children:"Session"}),t.jsx(Cn,{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."})]})})]})},uc=({milestones:e,summary:s,busy:n,onToggle:a,onRemove:r,onAdd:i})=>{const[l,o]=d.useState(""),[c,m]=d.useState(""),u=Pe(),h=!Ln.test(c.trim()),b=l.trim().length>0&&!h&&!n,f=()=>{b&&(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(j=>{const v=oi(j.status),g=j.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(En,{checked:g,disabled:n,onCheckedChange:x=>a(j.name,x===!0),"aria-label":g?`Mark ${j.name} not complete`:`Mark ${j.name} complete`}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:j.name}),j.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:Ce(j.target_date,u)}),t.jsx(xe,{variant:v.variant,children:v.label}),t.jsx(U,{variant:"ghost",size:"icon-sm",disabled:n,"aria-label":`Remove ${j.name}`,onClick:()=>r(j.name),children:t.jsx(At,{})})]},j.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(oe,{htmlFor:"project-milestone-name",children:"New milestone"}),t.jsx(ne,{id:"project-milestone-name",value:l,onChange:j=>o(j.target.value),placeholder:"beta cut",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(oe,{htmlFor:"project-milestone-date",children:"Target date"}),t.jsx(ne,{id:"project-milestone-date",value:c,onChange:j=>m(j.target.value),placeholder:"YYYY-MM-DD","aria-invalid":h}),h&&t.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),t.jsxs(U,{variant:"secondary",disabled:!b,onClick:f,"data-tour-tag":"project-milestone-add",children:[t.jsx(at,{}),"Add"]})]})]})},mc=[{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"}],pn=({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})]}),fc=({project:e,nowMs:s,commit:n,teamLabel:a=null})=>{const r=Pe(),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=(_,O)=>{o(p=>p===_?null:p),O==="cancelled"&&!u[_]&&setTimeout(()=>c.current?.focus(),0)},b=mc.filter(({field:_})=>!u[_]&&l!==_),f=Ce(e.completed_at,r,i),j=e.updated_at>0?ut(dt(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",y=u.start||l==="start",C=u.target||l==="target",w=u.estimate||l==="estimate",L=u.tags||l==="tags",T=g||x||y||C||!!f||w||L||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(ds,{children:[t.jsx(us,{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(ms,{align:"end",onCloseAutoFocus:_=>{m.current&&(m.current=!1,_.preventDefault())},children:b.map(({field:_,label:O})=>t.jsx(ke,{"data-project-add-option":_,onSelect:()=>{m.current=!0,o(_)},children:O},_))})]})]}),T?t.jsxs("dl",{className:"flex flex-col gap-2",children:[g&&t.jsx(nc,{project:e,commit:n,autoBegin:l==="owner",onRetire:_=>h("owner",_)}),x&&t.jsx(ac,{project:e,commit:n,label:a,autoBegin:l==="team",onRetire:_=>h("team",_)}),y&&t.jsx(hn,{project:e,commit:n,which:"start",nowMs:s,autoBegin:l==="start",onRetire:_=>h("start",_)}),C&&t.jsx(hn,{project:e,commit:n,which:"target",nowMs:s,autoBegin:l==="target",onRetire:_=>h("target",_)}),f&&t.jsx(pn,{label:"Completed",children:f}),w&&t.jsx(rc,{project:e,commit:n,autoBegin:l==="estimate",onRetire:_=>h("estimate",_)}),L&&t.jsx(ic,{project:e,commit:n,autoBegin:l==="tags",onRetire:_=>h("tags",_)}),e.updated_at>0&&t.jsx(pn,{label:"Updated",children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:v,children:j})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No dates, estimate, tags, owner or team yet."})]})},hc=({project:e})=>{const s=Ve(),n=ua(),{sending:a,cooling:r,cooldownRemainingMs:i}=ll(e.id);if(!he(s.data,"projects_request_update"))return null;const l=G(e),o=Zo(e.id);return t.jsxs(t.Fragment,{children:[t.jsx(Dt,{content:r&&i!==null?Tt(l,i):Qo,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(we,{size:"sm"}):r?t.jsx(xs,{}):t.jsx(Vr,{}),a?"Requesting…":r?"Requested":"Request update"]})}),r&&i!==null&&t.jsx("span",{id:o,className:"sr-only",children:Tt(l,i)})]})},ga="plain",ba=e=>`team:${e}`,ja=e=>`agent:${e}`;function pc(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function xc(e){return e.kind==="team"?ba(e.name):e.kind==="agent"?ja(e.name):ga}const xn={kind:"plain"},gc=({open:e,onClose:s,onStart:n,teamsEnabled:a,profilesEnabled:r})=>{const[i,l]=d.useState(xn),[o,c]=d.useState(null),[m,u]=d.useState(!1),h=Ja(e&&a),b=Xa(e&&r);d.useEffect(()=>{e&&(l(xn),c(null),u(!1))},[e]);const f=d.useMemo(()=>{const y=[{id:ga,name:"Nothing in particular",description:"A plain session; assign a team or agent later.",group:"Plain"}];for(const C of h.data??[])y.push({id:ba(C.name),name:Ms(C),keywords:C.name===Ms(C)?void 0:[C.name],description:`Team · manager: ${C.manager}`,group:"Teams"});for(const C of(b.data??[]).filter(w=>w.source!=="builtin"))y.push({id:ja(C.name),name:C.name,description:C.description||C.kind,group:"Agents"});return y},[h.data,b.data]),j=f.find(y=>y.id===xc(i))??f[0],v=!a||!r,g=h.isLoading||b.isLoading,x=async()=>{u(!0),c(null);try{await n(i),s()}catch(y){c(y instanceof Error&&y.message?y.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(Be,{onClick:s,disabled:m,children:"Cancel"}),t.jsxs(yt,{onClick:()=>void x(),disabled:m,children:[m&&t.jsx(we,{size:"xs"}),"Start session"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Cn,{label:"Work with",placeholder:"Search teams and agents",options:f,selected:j,onSelect:y=>l(pc(y.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})]})})},bc=({links:e})=>{const s=Mi(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:Ys(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:Pt(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:Ys(a.todos)})]},a.session_id))})]})},jc=({filePath:e,tooltip:s="File actions",icon:n,"aria-label":a="File actions",onShowInCanvas:r})=>{const i=async()=>{if(e)try{await navigator.clipboard.writeText(e),fe("File path copied to clipboard")}catch(o){console.error("Failed to copy file path: ",o),ie("Failed to copy file path")}},l=()=>{e&&window.api.openFile(e)};return t.jsxs(ds,{children:[t.jsx(Dt,{content:s,children:t.jsx(us,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon-sm","aria-label":a,onClick:o=>o.stopPropagation(),children:n??t.jsx(kn,{"aria-hidden":"true"})})})}),t.jsxs(ms,{align:"end",className:"min-w-45",onClick:o=>o.stopPropagation(),children:[r&&t.jsxs(ke,{onSelect:r,children:[t.jsx(Za,{"aria-hidden":"true"}),t.jsx("span",{children:"Show in canvas"})]}),t.jsxs(ke,{onSelect:l,children:[t.jsx(Nn,{"aria-hidden":"true"}),t.jsx("span",{children:"Open file"})]}),t.jsxs(ke,{onSelect:()=>window.api.showItemInFolder(e),children:[t.jsx(er,{"aria-hidden":"true"}),t.jsx("span",{children:"Open folder"})]}),t.jsxs(ke,{onSelect:i,children:[t.jsx(tr,{"aria-hidden":"true"}),t.jsx("span",{children:"Copy file path"})]})]})]})},yc=/[/\\]/;function ya(e){if(e.name)return e.name;const s=e.path.split(yc);return s[s.length-1]||"Attachment"}const vc=({attachment:e})=>{const s=ya(e),n=$i(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(Nn,{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(jc,{filePath:e.path,"aria-label":`File actions for ${s}`})]})},kc=({attachment:e})=>{const s=ya(e),n=sr(e.path,{mimeType:nr(e.name||e.path),sizeBytes:e.bytes});return n.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(ar,{file:e.path,src:n.url,label:s,conversationId:""})}):n.status==="loading"?t.jsx(rr,{children:t.jsxs("span",{className:"sr-only",children:["Loading ",s]})}):t.jsx(ir,{name:s})},wc=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(kc,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(vc,{attachment:s},`${s.path}:${s.added_at}`))}),Nc=({update:e,nowMs:s})=>{const n=Pe(),a=Ai(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(wc,{attachments:e.attachments})]})},Sc=({updates:e,nowMs:s})=>{const n=Pe(),a=_i(e.length),r=Oi(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(Nc,{update:l,nowMs:s},`${l.at}:${l.by}:${o}`))})]},i.key||"ungrouped"))})]})},Tc="project_not_found",_c=({projectKey:e,nowMs:s})=>{const n=Rt(),a=Ve(),r=Sn(he(a.data,"team_catalogue")),i=On(e,!0),l=$n(),o=Pn(),c=ni(),m=ai(),u=ti(),h=si(),[b,f]=d.useState(!1),[j,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(we,{label:"Loading project"})});if(i.isError||!i.data){const p=i.error instanceof Et&&(i.error.code===Tc||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(Ht,{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(Ls,{}),"All projects"]})]})]})}const{project:x,links:y}=i.data,C=G(x),w=(p,A)=>l.mutateAsync({key:x.id,fields:p,...A?.forceDone===!0?{forceDone:!0}:{}}),L=x.team?r(x.team):null,T=Pi(x.milestones.filter(p=>p.completed_at!==null).length,x.milestones.length),_=async(p,A,E,P)=>{const z=vt.getState(),I=lr(null,p,z.drafts);if(!I)return!1;try{const{images:B,unreadable:W,overflow:V}=await cr(P,A),le=dr(W);if(le)return ie(le),!1;const Q=ur(V);if(Q)return ie(Q),!1;const J=mr(A,B);if(J)return ie(J),!1;if(await fr(I,{text:A,attachments:P,images:B,mode:E,cwd:z.cwd},p)===null)return ie("That session already has a message going out. Try again in a moment."),!1;const N=y.find(R=>R.session_id===p);return fe(`Sent to ${N?Pt(N):p}`),!0}catch(B){return ie(B instanceof Error&&B.message?B.message:"The message was not sent."),!1}},O=async p=>{const A=vt.getState(),E=p.kind==="plain"?void 0:{kind:p.kind,name:p.name},P=await A.createSession(A.cwd||"~",E);if(!P)throw new Error(A.error??"The session could not be started.");hr.getState().setCurrentInput(P,Li(x));let z=null;try{await u.mutateAsync({key:x.id,sessionId:P})}catch(I){z=I instanceof Error&&I.message?I.message:"the link was refused"}if(z)ie(`Session started, but linking it failed: ${z}`);else{const I=E?` with ${Fi(E)}`:"";fe(`Session started${I} and linked to ${C}.`)}await Dn(n,P)};return t.jsx(Tl,{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(Ls,{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(ec,{project:x,commit:w}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(tc,{project:x,commit:w}),x.progress_stale&&t.jsx(xe,{variant:"warning",children:kt})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(hc,{project:x}),t.jsxs(U,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-delete",children:[t.jsx(or,{}),"Delete"]})]})]})]}),t.jsx(sc,{project:x,commit:w}),t.jsx(fc,{project:x,nowMs:s,commit:w,teamLabel:L}),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:di(x,s)})]}),t.jsx(uc,{milestones:x.milestones,summary:T,busy:g,onToggle:(p,A)=>{c.mutateAsync({key:x.id,name:p,completed:A}).catch(E=>{ie(E instanceof Error&&E.message?E.message:"The milestone was not updated.")})},onRemove:p=>{m.mutateAsync({key:x.id,name:p}).catch(A=>{ie(A instanceof Error&&A.message?A.message:"The milestone was not removed.")})},onAdd:(p,A)=>{c.mutateAsync({key:x.id,name:p,targetDate:A}).catch(E=>{ie(E instanceof Error&&E.message?E.message:"The milestone was not added.")})}}),t.jsx(dc,{projectKey:x.id,links:y,busy:g,onStartSession:()=>v(!0),onQuickSend:_,onLink:p=>{u.mutateAsync({key:x.id,sessionId:p}).catch(A=>{ie(A instanceof Error&&A.message?A.message:"The session was not linked.")})},onUnlink:p=>{h.mutateAsync({key:x.id,sessionId:p}).catch(A=>{ie(A instanceof Error&&A.message?A.message:"The session was not unlinked.")})}}),t.jsx(bc,{links:y}),t.jsx(Sc,{updates:x.updates,nowMs:s}),t.jsx(ma,{open:b,projectName:x.name,onClose:()=>f(!1),onConfirm:async p=>{await o.mutateAsync({key:x.id,confirmedName:p}),fe("Project deleted"),n("/projects")}}),t.jsx(gc,{open:j,onClose:()=>v(!1),onStart:O,teamsEnabled:he(a.data,"team_catalogue"),profilesEnabled:he(a.data,"profile_catalogue")})]})})},gn={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},Cc=({open:e,onClose:s,onSubmit:n})=>{const[a,r]=d.useState(gn),[i,l]=d.useState({}),[o,c]=d.useState(null),m=d.useRef(null),[u,h]=d.useState(!1),[b,f]=d.useState(!1),[j,v]=d.useState(!1),g=d.useId(),x=d.useRef(null);d.useEffect(()=>{e&&(r({...gn,description:dn}),l({}),c(null),h(!1),f(!1),v(!1))},[e]),d.useEffect(()=>{o&&m.current?.scrollIntoView({block:"nearest"})},[o]);const y=(p,A)=>{r(E=>({...E,[p]:A}))},C=b?a.name:Pl(a.title),w=p=>ha(p,x,A=>y("description",A)),L=(p,A)=>{const E={},P=Wt(A);P&&(E.name=P);const z=na(p.description);z&&(E.description=z);const I=ss(p.tags).error;I&&(E.tags=I);const B=es(p.startDate);B&&(E.startDate=B);const W=es(p.targetDate);if(W)E.targetDate=W;else if(!B){const J=ts(p.startDate,p.targetDate);J&&(E.targetDate=J)}if(p.estimate.trim()){const J=aa(p.estimate);J&&(E.estimate=J)}const V=Zt(p.title);V&&(E.title=V);const le=St(p.owner,"owner");le&&(E.owner=le);const Q=St(p.team,"team");return Q&&(E.team=Q),E},T=async()=>{const p=C.trim(),A=L(a,p);if(l(A),Object.keys(A).length>0)return;h(!0),c(null);const E=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()!==dn?{description:a.description.trim()}:{},status:a.status,...E.length>0?{tags:E}:{}},...Object.keys(P).length>0?{followUp:P}:{}}),s()}catch(P){const z=P instanceof Error&&P.message?P.message:"";c(ft(z)||"The project was not saved.")}finally{h(!1)}},_="New project",O=a.description.length>Ke;return t.jsx(lt,{open:e,onClose:s,title:_,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(Be,{onClick:s,disabled:u,children:"Cancel"}),t.jsxs(yt,{"data-project-submit":"",onClick:()=>void T(),disabled:u,children:[u&&t.jsx(we,{size:"xs"}),"Create project"]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:p=>{p.preventDefault(),T()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(oe,{htmlFor:`${g}-title`,children:"Title"}),t.jsx(ne,{id:`${g}-title`,"data-project-title":"",value:a.title,onChange:p=>y("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(oe,{htmlFor:`${g}-key`,className:"shrink-0 text-meta text-ink-muted",children:"Key"}),t.jsx(ne,{id:`${g}-key`,"data-project-key":"",value:C,onChange:p=>{f(!0),y("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(oe,{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":j===(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",j===(p==="preview")&&"bg-surface text-ink"),children:p==="write"?"Write":"Preview"},p))})]})]}),j?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(_n,{ref:x,id:`${g}-description`,"data-project-description":"",value:a.description,onChange:p=>y("description",p.target.value),onPaste:w,rows:8,placeholder:"Markdown — headings, lists, code.","aria-invalid":O||!!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",O?"text-danger":"text-ink-muted"),children:[a.description.length,"/",Ke]})]})]}),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(oe,{children:"Status"}),t.jsxs(ze,{value:a.status,onValueChange:p=>y("status",p),children:[t.jsx(Ye,{"aria-label":"Status",children:t.jsx(He,{})}),t.jsx(We,{children:In.map(p=>t.jsx(_e,{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(oe,{htmlFor:`${g}-owner`,children:"Owner"}),t.jsx(ne,{id:`${g}-owner`,"data-project-owner":"",value:a.owner,onChange:p=>y("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(oe,{htmlFor:`${g}-team`,children:"Team"}),t.jsx(ne,{id:`${g}-team`,value:a.team,onChange:p=>y("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(oe,{htmlFor:`${g}-target`,children:"Target date"}),t.jsx(ne,{id:`${g}-target`,"data-project-target":"",value:a.targetDate,onChange:p=>y("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(oe,{htmlFor:`${g}-start`,children:"Start date"}),t.jsx(ne,{id:`${g}-start`,value:a.startDate,onChange:p=>y("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(oe,{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=>y("estimate",p.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(ze,{value:a.estimateUnit,onValueChange:p=>y("estimateUnit",p),children:[t.jsx(Ye,{"aria-label":"Estimate unit",className:"max-w-32",children:t.jsx(He,{})}),t.jsxs(We,{children:[t.jsx(_e,{value:"points",children:"Points"}),t.jsx(_e,{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(oe,{htmlFor:`${g}-tags`,children:"Tags"}),t.jsx(ne,{id:`${g}-tags`,value:a.tags,onChange:p=>y("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})]})})},va=({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})},Ec=({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(En,{id:r,checked:n,onCheckedChange:()=>a()}),t.jsx(oe,{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})]})},Rc=({column:e,spec:s,onChange:n})=>{const a=d.useId(),r=s!==null&&s.key===e,i=r?s.direction:Ft(e),l=i==="asc"?"desc":"asc",o=()=>n({key:e,direction:r?l:Ft(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 ${Ge(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:bo})]}),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 ${Ge(e)}, ${ks(e,r?i:Ft(e))}`})]})]})},Dc=({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(Ec,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>n(e,a.value)},`${e}:${a.value??"none"}`))]}),ka=({projects:e,state:s,query:n,todayMs:a,onToggle:r,onClearAll:i,scope:l,sort:o})=>{const c=d.useMemo(()=>l===void 0?go(e,s,a):l===null?[]:[sa(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 ${Ge(o.key)}`}),t.jsx(Rc,{column:o.key,spec:o.spec,onChange:o.onChange})]}),c.map(u=>t.jsx(Dc,{facet:u.facet,options:u.options,onToggle:r},u.facet))]})},Ac=({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??bs}),t.jsx("span",{className:"shrink-0 text-ink-muted","aria-label":mi(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 Oc(e,s){const n=dt(e.progress_updated_at,s);return n?ut(n):"not reported"}const $c=({direction:e})=>e==="asc"?t.jsx(An,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(Tn,{size:10,className:"shrink-0","aria-hidden":"true"}),Pc=({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=Pe(),f=a?_o(e,a):e,j=js(f,mt),v=d.useId(),g=T=>`${v}-team-${T}`,[x,y]=d.useState(0),C=d.useRef([]),w=(T,_)=>{const O=ve.length;for(let p=1;p<=O;p+=1){const A=(T+_*p+O*O)%O,E=C.current[A];if(E&&E.offsetParent!==null){y(A),E.focus();return}}},L=T=>_=>{_.key!=="ArrowLeft"&&_.key!=="ArrowRight"||(_.preventDefault(),w(T,_.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((T,_)=>{const O=a!==null&&a.key===T.sort;return t.jsx("th",{scope:"col","aria-sort":O?a.direction==="desc"?"descending":"ascending":"none",className:$(T.className,"p-0 text-left font-normal"),children:t.jsxs(fs,{children:[t.jsx(hs,{asChild:!0,children:t.jsxs("button",{type:"button",ref:p=>{C.current[_]=p},tabIndex:_===x?0:-1,"data-project-column":T.key,onFocus:()=>y(_),onKeyDown:L(_),className:$("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",O?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:T.label}),O?t.jsx($c,{direction:a.direction}):t.jsx(pr,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(ps,{align:"start","aria-label":`${T.label} column`,className:"w-72 p-0",children:t.jsx(va,{children:t.jsx(ka,{projects:i,state:l,query:o,todayMs:c,onToggle:m,onClearAll:u,scope:T.facet,sort:{key:T.sort,spec:a,onChange:r}})})})]})},T.key)})})})}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:j.map((T,_)=>t.jsxs("li",{children:[t.jsx(Ac,{team:T.team==null?null:h(T.team),count:T.items.length,headingId:g(_),className:"sticky top-0 z-10","data-project-team":T.team??""}),t.jsx("ul",{"aria-labelledby":g(_),className:"divide-y divide-hairline",children:T.items.map(O=>{const p=new Map(Bn(O,b).map(P=>[P.key,P.text])),A=Un(O.milestones_completed,O.milestones_total),E=gs(O.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>n(O),"data-project-name":O.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(O)}),t.jsx("span",{className:ve[1].className,children:t.jsx(xa,{status:O.status})}),t.jsx("span",{className:$(ve[2].className,"truncate text-meta text-ink-muted"),children:p.get("target")??p.get("completed")??""}),t.jsx("span",{className:$(ve[3].className,"truncate text-meta text-ink-muted"),children:p.get("estimate")??""}),t.jsx("span",{className:$(ve[4].className,"truncate text-meta text-ink-muted"),children:A}),t.jsx("span",{className:$(ve[5].className,"truncate text-meta text-ink-muted"),children:E}),t.jsxs("span",{className:$(ve[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:Oc(O,s)}),O.progress_stale&&t.jsx(xe,{variant:"warning",children:kt})]})]})},O.id)})})]},T.team??""))})]})},Ct=224,bn=36,Mc={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},Ic=({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=Ns(s),f=d.useMemo(()=>Ro(e,b),[e,b]),j=d.useMemo(()=>Do(e),[e]),v=d.useMemo(()=>js(j.dated,T=>mt(T.project)),[j]);d.useLayoutEffect(()=>{const T=h.current;if(!T)return;const _=()=>u(T.clientWidth);if(_(),typeof ResizeObserver>"u")return;const O=new ResizeObserver(_);return O.observe(T),()=>O.disconnect()},[]);const g=Math.max(m-Ct-24,160),x=f?Co(Js(f.startMs,f.endMs),g):"month",y=o??x,C=T=>{const _=Te.indexOf(y),O=Te[_-T];O&&c(O)},w=ws[y],L=f?Js(f.startMs,f.endMs)*w: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"}.`:`${j.dated.length} dated · ${j.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||y===Te[0],onClick:()=>C(1),children:t.jsx(at,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Mc[y]}),t.jsx(U,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!f||y===Te[Te.length-1],onClick:()=>C(-1),children:t.jsx(_r,{})})]})]}),f&&j.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(Lc,{startMs:f.startMs,endMs:f.endMs,tier:y,pxPerDay:w,trackPx:L}),v.map(T=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":T.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:Ct},children:[t.jsx("span",{className:"truncate text-ink",children:T.team==null?bs:l(T.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:T.items.length})]})}),T.items.map(_=>t.jsx(Fc,{item:_,spanStart:f.startMs,pxPerDay:w,trackPx:L,today:b,onOpen:()=>n(_)},_.project.id))]},T.team??""))]})}):null,j.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(wn,{defaultOpen:j.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(Hr,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Ao(j.undated.length)})]}),children:[j.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:j.undated.map(T=>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(T),children:G(T.project)})},T.project.id))})]})})]})},Lc=({startMs:e,endMs:s,tier:n,pxPerDay:a,trackPx:r})=>{const i=Uo(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:Ct}}),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:Ae(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))})]})},Fc=({item:e,spanStart:s,pxPerDay:n,trackPx:a,today:r,onOpen:i})=>{const{project:l}=e,o=Oo(e),c=$o(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:Ct,height:bn},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:G(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:bn},children:[o&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:Ae(s,o.fromMs)*n,width:(Ae(o.fromMs,o.toMs)+1)*n},title:`${Ce(m(o.fromMs))} → ${Ce(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:Ae(s,u.dayMs)*n},title:`${u.name} · ${u.status} · ${Ce(m(u.dayMs))}`},`${u.name}-${u.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:Ae(s,r)*n},"aria-hidden":"true"})]})]})},qc=({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),j=d.useRef(!1),v=fo(a),g=Rn(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(xr,{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:y=>n(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(s?n(""):y.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:()=>gr(h.current,n),"aria-label":"Clear search",children:t.jsx(At,{"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(br,{shortcut:"/"})})]}),t.jsxs(fs,{open:b,onOpenChange:f,children:[t.jsx(hs,{asChild:!0,children:t.jsxs(U,{variant:"secondary",size:"sm",disabled:u,"data-project-filters-button":"",children:[t.jsx(Kr,{size:14,"aria-hidden":"true"}),"Filters",v>0&&t.jsx(xe,{variant:"neutral",children:v})]})}),t.jsx(ps,{align:"end","aria-label":"Filters",className:"w-80 p-0",onCloseAutoFocus:y=>{j.current&&(j.current=!1,y.preventDefault())},children:t.jsx(va,{children:t.jsx(ka,{projects:e,state:a,query:s,todayMs:l,onToggle:(y,C)=>r(Zn(a,y,C)),onClearAll:()=>{i(),j.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]})},Uc=({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 Qe){const b=e[h];if(b.length===0)continue;const f=b.map(g=>Xn(h,g)),j=f[0],v=f.length>1?`${nt[h]} · ${j} +${f.length-1}`:`${nt[h]} · ${j}`;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: ${Ge(s.key)}`,ariaLabel:`Remove sort: ${Ge(s.key)}, ${ks(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(xe,{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(An,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(Tn,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:h.label}),t.jsx(At,{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"})]})},wa="projects-view",Bc=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function zc(){try{const e=localStorage.getItem(wa);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function Yc(e){try{localStorage.setItem(wa,e)}catch{}}const Hc=({value:e,onChange:s})=>t.jsx(Cr,{value:e,onValueChange:n=>s(n),children:t.jsx(Er,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:Bc.map(n=>t.jsx(Rr,{value:n.value,children:n.label},n.value))})}),Wc=["r1","r2","r3","r4","r5","r6"],Kc=4e3,jn={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."},sd=({nowMs:e=Date.now()})=>{const{projectId:s}=jr(),n=Rt(),a=Ve(),r=yr(a.data,"projects",1),i=r==="enabled",l=he(a.data,"projects",Gi),o=Sn(he(a.data,"team_catalogue")),c=Xr(i),m=ei(),u=$n(),h=Pn(),[b,f]=d.useState(!1),[j,v]=d.useState(()=>zc()),[g,x]=d.useState(()=>vi()),[y,C]=d.useState(null),[w,L]=d.useState(""),[T,_]=d.useState(Ks),[O,p]=d.useState(()=>vo()),[A,E]=d.useState(""),P=d.useRef(""),z=d.useRef(null),I=d.useRef(null),B=S=>{z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),S!==""&&S===P.current?(E(""),z.current=window.requestAnimationFrame(()=>{z.current=null,E(S)})):E(S),P.current=S,I.current!==null&&window.clearTimeout(I.current),I.current=window.setTimeout(()=>{I.current=null,P.current="",E("")},Kc)},W=()=>{z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),I.current!==null&&(window.clearTimeout(I.current),I.current=null),P.current="",E("")},V=S=>{L(S),W()},le=S=>{_(S),W()},Q=d.useRef(null),J=cl(),k=c.data??[],N=Ns(e),R=oo(w,i&&l),M=Jn(w),F=d.useMemo(()=>R.answer?ro(k,R.answer.projects):null,[k,R.answer]),q=M!=="",ae=d.useMemo(()=>q?F??ao(k,M):k,[k,M,q,F]),Ee=F===null?"client":"backend",Y=d.useMemo(()=>ho(ae,T,N),[ae,T,N]),Ne=l&&q&&R.pending,ge=q||!rt(T),me=d.useMemo(()=>Us(k,g,e),[k,g,e]),X=d.useMemo(()=>Us(Y,g,e),[Y,g,e]),Re=yi(g),re=j==="board"?X.length:Y.length,Xe=!ge||!c.isSuccess?null:j==="board"?`${X.length} of ${me.length} in window`:`${Y.length} of ${k.length} projects`,ee=c.isSuccess&&k.length>0,Se=ee&&ge&&re===0&&!Ne,Ie=Ne&&re===0&&ee,[It,Ze]=d.useState(!1);d.useEffect(()=>{if(!It)return;const S=document.querySelector('[data-tour-tag="projects-board-window"]');S&&(S.focus(),Ze(!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 ye=H.key==="/"&&!H.metaKey&&!H.ctrlKey&&!H.altKey,se=(H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="f";!ye&&!se||(H.preventDefault(),Q.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i,s]);const et=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const S=et.current;S!==null&&(S.scrollTop=0)},[s]);const pt=Zr(j==="timeline"?k.map(S=>S.id):[],i),D=new Map(k.map((S,H)=>[S.id,pt[H]])),te=Y.map(S=>({project:S,milestones:D.get(S.id)?.data?.project.milestones??[]})),tt=j==="timeline"?Y.filter(S=>D.get(S.id)?.isLoading).length:0,be=j==="timeline"?Y.filter(S=>D.get(S.id)?.isError).length:0,xt=()=>{for(const S of pt)S.isError&&S.refetch()},Le=S=>{p(S),ko(S),B(wo(S))},Na=(S,H)=>{_(K=>Zn(K,S,H)),W()},gt=()=>{const S=w.trim()!=="",H=!rt(T),K=O!==null;L(""),_(Ks),O!==null&&Le(null),B(No({search:S,filters:H,sort:K}))},_s=()=>{x("all"),Bs("all"),Ze(!0)},[je,Cs]=d.useState(null),Lt=d.useRef(!1),Es=()=>{Lt.current=!1,Cs(null)},[Sa,Rs]=d.useState([]),Ta=he(a.data,"projects_force_done"),_a=(S,H)=>{const K=S.id,ye=Z(H).label;Rs(se=>se.includes(K)?se:[...se,K]),Wo({move:()=>u.mutateAsync({key:K,fields:{status:H}}),forceDoneOffered:Ta,claimQuestion:()=>Lt.current?!1:(Lt.current=!0,!0)}).then(se=>{if(se.kind==="accepted"){fe(`Moved to ${ye}`),c.refetch().then(()=>J(K));return}if(se.kind==="question"){Cs({project:S,status:H,refusal:se.refusal});return}ie(se.copy,se.refusal?{action:{label:"View project",onClick:()=>void n(`/projects/${K}`)}}:void 0),J(K)}).finally(()=>{Rs(se=>se.filter(Ca=>Ca!==K))})};return i?s?t.jsx("div",{ref:et,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(_c,{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(Is,{title:"Projects",icon:Fs,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(Pr,{})}),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(Hc,{value:j,onChange:S=>{v(S),Yc(S)}}),t.jsx(qc,{projects:ae,query:w,onQueryChange:V,filters:T,onFiltersChange:le,onClearAll:gt,todayMs:N,resultText:Xe,countRevealClass:j==="board"?"@[47rem]:inline":void 0,disabled:c.isError,searchFieldRef:Q,trailing:j==="board"&&!(c.isSuccess&&c.data.length===0)?t.jsx(Go,{value:g,onChange:S=>{x(S),Bs(S)}}):null})]}),t.jsx(Uc,{filters:T,sort:O,onFiltersChange:le,onSortChange:Le,onClearAll:gt,hideClearAll:Se,searchFieldRef:Q}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:A})]})]}),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…"}),Wc.map(S=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(Fe,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(Fe,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(Fe,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(Fe,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(Fe,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(Fe,{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(Ht,{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"]})]}),Ie&&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&&Se&&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:w.trim()?`No projects match "${w.trim()}".`:"No projects match."}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:w.trim()?Ki[Ee]:"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:()=>{gt(),Q.current?.focus()},children:"Clear all"}),j==="board"&&Y.length>0&&t.jsx(U,{variant:"secondary",onClick:_s,children:"Show all time"})]})]}),ee&&!Se&&!Ie&&j==="list"&&t.jsx(Pc,{projects:Y,nowMs:e,onOpen:S=>void n(`/projects/${S.id}`),sort:O,onSortChange:Le,searchPopulation:ae,filters:T,query:w,todayMs:N,onToggleFilter:Na,onClearFilters:gt,teamLabelFor:o}),ee&&!Se&&j==="board"&&X.length>0&&t.jsx(ul,{projects:X,nowMs:e,onOpen:S=>void n(`/projects/${S.id}`),onEdit:S=>void n(`/projects/${S.id}`),onDelete:C,onMove:_a,teamLabelFor:o,movingKeys:Sa}),ee&&!Se&&!Ie&&j==="board"&&X.length===0&&Re!==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:Re}),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:_s,children:"Show all time"})]}),ee&&!Se&&!Ie&&j==="timeline"&&t.jsx(Ic,{items:te,nowMs:e,onOpen:S=>void n(`/projects/${S.project.id}`),pendingDetails:tt,failedDetails:be,onRetryDetails:xt,teamLabelFor:o})]}),t.jsx(ma,{open:y!==null,projectName:y?.name??"",onClose:()=>C(null),onConfirm:async S=>{y&&(await h.mutateAsync({key:y.id,confirmedName:S}),fe("Project deleted"),C(null))}}),t.jsx(pa,{open:je!==null,refusal:je?.refusal??null,projectLabel:je?G(je.project):"",onClose:()=>{je&&J(je.project.id),Es()},onConfirm:async()=>{if(!je)return;const{project:S,status:H,refusal:K}=je,ye=await u.mutateAsync({key:S.id,fields:{status:H},forceDone:!0});fe(Qn(ye,K.count,Z(H).label)),c.refetch().then(()=>J(S.id))},secondaryLabel:"Open project",onSecondary:()=>{const S=je?.project.id;Es(),S&&n(`/projects/${S}`)}}),t.jsx(Cc,{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(ye){const se=ye instanceof Error&&ye.message?ye.message:"";ie(`Project ${K} was created, but the extra fields were not saved: ${ft(se)||"the server refused them."} Open the project to set them in place.`);return}fe(`Project ${K} created`)}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Is,{title:"Projects",icon:Fs}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(we,{label:"Checking the server's Projects support"})}):t.jsx(Ht,{variant:"warning",children:jn[r]??jn.unknown})]})};export{sd as ProjectsPage};
@@ -0,0 +1 @@
1
+ import{$ as y,a0 as w,a1 as f,a2 as T,a3 as v,C as $,D as A}from"./conversation-input-sync-BdhFw-JY.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./messages-D3mGACg6.js";import{l as S,a as E}from"./use-memberships-query-Hv-eprVl.js";const p={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},O=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.other_harmful}function C(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${s}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${s}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:z(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:i,field:u}=C(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:O(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const k=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,B=new Set([404,410]),D=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],q=e=>{const n=e.toLowerCase();return D.some(t=>n.includes(t))||T(e)},x=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=k.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:q(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?x(n,t):y(F,n),X={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},j="download_count",g={all:["public-agents"],list:e=>[...g.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},h={all:["org-agents"],list:(e,n)=>[...h.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),J=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),V=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,J as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,V as u};
@@ -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-CPsHLTy1.js";import{q as $t}from"./conversation-input-sync-Czj2IfIc.js";import"./index-CzjIMcYW.js";import"./ui-preferences-store-lljzccwU.js";import"./error-boundary-YxH9ow-2.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)+`:
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-x5Fva3t5.js";import{v as $t}from"./conversation-input-sync-BdhFw-JY.js";import"./index-B-uibf5k.js";import"./messages-D3mGACg6.js";import"./error-boundary-B4K6A3dS.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()+`