local-operator-ui 0.36.2 → 0.36.4

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 (95) hide show
  1. package/out/main/index.js +6155 -13
  2. package/out/preload/index.js +7 -0
  3. package/out/renderer/assets/{_basePickBy-CcO6nPxQ.js → _basePickBy-DQ6BzkJm.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-BH2uaUcG.js → _baseUniq-D4Pzw8OZ.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-B3JXwv1Q.js → agent-details-page-vUtr6XRL.js} +1 -1
  6. package/out/renderer/assets/{agent-hub-page-DKgp42Gz.js → agent-hub-page-DLfJB8ns.js} +1 -1
  7. package/out/renderer/assets/{agents-page-Bcgw5NaE.js → agents-page-B-PHMFxF.js} +3 -3
  8. package/out/renderer/assets/{arc-yBH7h1fW.js → arc-BvXLfjiv.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-CHBovRWu.js → architectureDiagram-IEHRJDOE-DGO7ixLg.js} +1 -1
  10. package/out/renderer/assets/{arrow-up-Di0VTM6O.js → arrow-up-D8Tgt51O.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-vW3btTHI.js → blockDiagram-JOT3LUYC-Bpj3zFYQ.js} +1 -1
  12. package/out/renderer/assets/{book-open-BklxnVnC.js → book-open-DeWHPw1t.js} +1 -1
  13. package/out/renderer/assets/browser-page-DAQis2Rt.js +1 -0
  14. package/out/renderer/assets/{browser-webauthn-prompt-BVQVtCyj.js → browser-webauthn-prompt-CLrsocAn.js} +1 -1
  15. package/out/renderer/assets/{c4Diagram-VJAJSXHY-B-omeKTH.js → c4Diagram-VJAJSXHY-tA5p19nS.js} +1 -1
  16. package/out/renderer/assets/channel-CG3c-hsB.js +1 -0
  17. package/out/renderer/assets/{chunk-4BMEZGHF-DbogYOtn.js → chunk-4BMEZGHF-CAtpoCnM.js} +1 -1
  18. package/out/renderer/assets/{chunk-A2AXSNBT-B99o2tMG.js → chunk-A2AXSNBT-CYHy7Mvk.js} +1 -1
  19. package/out/renderer/assets/{chunk-AEK57VVT-BHrb34eS.js → chunk-AEK57VVT-B2bXanTe.js} +1 -1
  20. package/out/renderer/assets/{chunk-D6G4REZN-COYEuoan.js → chunk-D6G4REZN-DfhdrNKB.js} +1 -1
  21. package/out/renderer/assets/{chunk-RZ5BOZE2-D3q2lYwW.js → chunk-RZ5BOZE2-BNdcLGHR.js} +1 -1
  22. package/out/renderer/assets/{chunk-XZIHB7SX-CvTfujhG.js → chunk-XZIHB7SX-Caa_mRlB.js} +1 -1
  23. package/out/renderer/assets/classDiagram-GIVACNV2-BGWu-T14.js +1 -0
  24. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BGWu-T14.js +1 -0
  25. package/out/renderer/assets/clone-UwOnPjS7.js +1 -0
  26. package/out/renderer/assets/{console-mirror-BThuJoo1.js → console-mirror-BnHVC7eO.js} +1 -1
  27. package/out/renderer/assets/{consoleCapture-B6L7nb-J.js → consoleCapture-BxykZlLx.js} +1 -1
  28. package/out/renderer/assets/{conversation-input-sync-Csq2qdm5.js → conversation-input-sync-CJiOSzCX.js} +250 -250
  29. package/out/renderer/assets/{dagre-OKDRZEBW-CvnmuVIi.js → dagre-OKDRZEBW-pq4RiyaY.js} +1 -1
  30. package/out/renderer/assets/{diagram-SSKATNLV-DUkL0seE.js → diagram-SSKATNLV-DnlzCGD2.js} +1 -1
  31. package/out/renderer/assets/{diagram-VNBRO52H-DYQJ-990.js → diagram-VNBRO52H-DbJ2RTVe.js} +1 -1
  32. package/out/renderer/assets/{erDiagram-Q7BY3M3F-CQWWLpWe.js → erDiagram-Q7BY3M3F-C56WVcbc.js} +1 -1
  33. package/out/renderer/assets/{error-boundary-D1EdrZoj.js → error-boundary-Tv9TlaZ8.js} +1 -1
  34. package/out/renderer/assets/{flowDiagram-4HSFHLVR-CHWTC3wr.js → flowDiagram-4HSFHLVR-CL1GRaaq.js} +1 -1
  35. package/out/renderer/assets/{ganttDiagram-APWFNJXF-CbYaNbcy.js → ganttDiagram-APWFNJXF-CES2U6dP.js} +1 -1
  36. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-Dz5fATwZ.js → gitGraphDiagram-7IBYFJ6S-CRyPEqXz.js} +1 -1
  37. package/out/renderer/assets/{graph-B4lGCZmF.js → graph-Dtsej9jG.js} +1 -1
  38. package/out/renderer/assets/{index-DhrqAKsM.js → index-BsV4LVu3.js} +1 -1
  39. package/out/renderer/assets/index-D0l2JJ6w.js +829 -0
  40. package/out/renderer/assets/{index-CcD0LA0Q.js → index-DAoplO_Z.js} +1 -1
  41. package/out/renderer/assets/index-hX_aZwq0.js +57 -0
  42. package/out/renderer/assets/index-vPvXCaIy.css +1 -0
  43. package/out/renderer/assets/{infoDiagram-PH2N3AL5-CosR91M9.js → infoDiagram-PH2N3AL5-BwRaN2ZH.js} +1 -1
  44. package/out/renderer/assets/{installer-JTz2AD89.js → installer-DjflOef5.js} +1 -1
  45. package/out/renderer/assets/{journeyDiagram-U35MCT3I-DTj6yC5Y.js → journeyDiagram-U35MCT3I-CwrSuzth.js} +1 -1
  46. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-fHLLpfWW.js → kanban-definition-NDS4AKOZ-CjW130n-.js} +1 -1
  47. package/out/renderer/assets/{layout-BUgJgJ17.js → layout-DnBx2qbk.js} +1 -1
  48. package/out/renderer/assets/{legacy-agents-page-CSbcJE7R.js → legacy-agents-page-BiAHAYWZ.js} +1 -1
  49. package/out/renderer/assets/library-page-BGmng_P-.js +162 -0
  50. package/out/renderer/assets/{mermaid.core-DXWoCulQ.js → mermaid.core-BHqZ2SZO.js} +5 -5
  51. package/out/renderer/assets/{mesh-page-CYwyEdW1.js → mesh-page-1yPLxWRO.js} +1 -1
  52. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-C_r984Dl.js → mindmap-definition-ALO5MXBD-Ca2VY79V.js} +1 -1
  53. package/out/renderer/assets/{mini-B2a0S_aA.js → mini-Dd3N58po.js} +1 -1
  54. package/out/renderer/assets/{notebook-pen-BeIeIauS.js → notebook-pen-CcH01r1l.js} +1 -1
  55. package/out/renderer/assets/{org-access-B4PFRWtx.js → org-access-WIuI99P6.js} +1 -1
  56. package/out/renderer/assets/{org-surface-gate-OZbS0xfm.js → org-surface-gate-BsP8aWCi.js} +1 -1
  57. package/out/renderer/assets/{page-header-3Jm521kq.js → page-header-ggruiR-O.js} +1 -1
  58. package/out/renderer/assets/{pieDiagram-IB7DONF6-pPG5qJ25.js → pieDiagram-IB7DONF6-C7lP9J7V.js} +1 -1
  59. package/out/renderer/assets/projects-page-BIRVv4yi.js +40 -0
  60. package/out/renderer/assets/{publication-validation-r9TKDPj_.js → publication-validation-C73bqNja.js} +1 -1
  61. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-LLUiR4wo.js → quadrantDiagram-7GDLP6J5-CPMEK8EO.js} +1 -1
  62. package/out/renderer/assets/{radar-MK3ICKWK-DfSMH1dj.js → radar-MK3ICKWK-sbfBaJo0.js} +1 -1
  63. package/out/renderer/assets/{radient-auth-buttons-CEuhoAow.js → radient-auth-buttons-C0ljZy4O.js} +1 -1
  64. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DhHfvb40.js → requirementDiagram-KVF5MWMF-S2rhrmTH.js} +1 -1
  65. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-DURUf6SV.js → sankeyDiagram-QLVOVGJD-sNpc3Wfn.js} +1 -1
  66. package/out/renderer/assets/{schedules-page-DiiamPZ_.js → schedules-page-DbZSRb3g.js} +1 -1
  67. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DTfgNRPc.js → sequenceDiagram-X6HHIX6F-Cv-47OeQ.js} +1 -1
  68. package/out/renderer/assets/{settings-page-C3aXNJLk.js → settings-page-DH9sXfEW.js} +1 -1
  69. package/out/renderer/assets/{smartart-Dx8zw2rK.js → smartart-C2eRO4WK.js} +1 -1
  70. package/out/renderer/assets/{stateDiagram-DGXRK772-Cp2owgQE.js → stateDiagram-DGXRK772-DIBWf8qm.js} +1 -1
  71. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DBPLNjJl.js +1 -0
  72. package/out/renderer/assets/{tags-input-chips-Dwb2Ojmj.js → tags-input-chips-B4_gHGYO.js} +1 -1
  73. package/out/renderer/assets/{timeline-definition-BDJGKUSR-112iCByD.js → timeline-definition-BDJGKUSR-CE8q2f33.js} +1 -1
  74. package/out/renderer/assets/ui-preferences-store-C6eXGzFs.js +1 -0
  75. package/out/renderer/assets/{use-download-agent-mutation-BGMZQ6m9.js → use-download-agent-mutation-LdjExo2g.js} +1 -1
  76. package/out/renderer/assets/{use-memberships-query-Bz3KIW6D.js → use-memberships-query-DcD9UeVY.js} +1 -1
  77. package/out/renderer/assets/{use-session-snapshot-C3LrO077.js → use-session-snapshot-Cqye2iDz.js} +1 -1
  78. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BfqNCG-d.js → xychartDiagram-VJFVF3MP-DlbgdRgT.js} +1 -1
  79. package/out/renderer/console-capture.html +5 -5
  80. package/out/renderer/index.html +7 -7
  81. package/out/renderer/installer.html +4 -4
  82. package/out/renderer/mini.html +7 -7
  83. package/package.json +2 -2
  84. package/out/renderer/assets/browser-page-dbyV2lDa.js +0 -1
  85. package/out/renderer/assets/channel-DseeJDH6.js +0 -1
  86. package/out/renderer/assets/classDiagram-GIVACNV2-D-Nl2hgf.js +0 -1
  87. package/out/renderer/assets/classDiagram-v2-COTLJTTW-D-Nl2hgf.js +0 -1
  88. package/out/renderer/assets/clone-DYXRTfEl.js +0 -1
  89. package/out/renderer/assets/index-BqKNVosC.js +0 -57
  90. package/out/renderer/assets/index-C6uEPUVY.js +0 -829
  91. package/out/renderer/assets/index-CU8sWhx0.css +0 -1
  92. package/out/renderer/assets/library-page-97CGidrj.js +0 -162
  93. package/out/renderer/assets/projects-page-UaamBIPv.js +0 -40
  94. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DD26TncZ.js +0 -1
  95. package/out/renderer/assets/ui-preferences-store-CfAtSgON.js +0 -1
@@ -0,0 +1,40 @@
1
+ import{r as d,t as n,d as Fe,j as t,c as M}from"./index-hX_aZwq0.js";import{cg as Tn,ch as Ht,ci as Rn,bU as xr,u as br,cj as Dn,ck as An,cl as On,cm as Pn,cn as Mn,co as Ln,cp as As,cq as Os,cr as In,cs as Fn,C as us,aK as qe,d as _e,bZ as qn,D as ds,ct as V,cu as yt,cv as Un,Z as Rt,cw as Ps,cx as Ms,cy as Ls,bI as Bn,aL as be,cz as $n,a as Ze,c as ye,aW as yr,aN as Dt,a3 as dt,aR as He,cA as zn,c0 as Gn,cc as Yn,cB as Hn,cd as Kn,aT as vr,aS as vt,bl as Wn,aB as Vn,ar as kt,bu as Qn,bA as Xn,bz as Jn,bx as Is,cf as Zn,c2 as kr,b$ as ea,c1 as ta,a4 as de,cC as sa,cD as ra,cE as na,cF as aa,cG as oa,cH as wr,aM as ia,aq as ca,al as la,am as ua,ao as da,ap as pa,as as ma,ay as fa,cI as _a,cJ as Nr,bE as ja,cK as ha,aA as ga,aO as xa,aX as ba}from"./conversation-input-sync-CJiOSzCX.js";import{c as At,u as F,F as Ke,m as Ot,G as We,H as Ve,J as Qe,K as Ae,a as G,r as ps,s as ms,S as Te,t as fs,x as Ee,a5 as ya,a6 as va,a7 as ka,ab as wa,ac as Na,w as Sa,B as ke,a1 as _s,ad as js,a3 as hs,I as ue,X as Pt,h as gs,T as Sr,L as pe,N as Cr,C as Er,A as Kt,O as Ca,Y as Ea,Z as Ta,_ as Ra,l as ze}from"./error-boundary-Tv9TlaZ8.js";import{P as Fs}from"./page-header-ggruiR-O.js";import{b5 as Tr,bp as Da,bd as Rr,bq as Aa,be as Oa,aR as Pa,a as it,A as qs,br as Us,bo as Ma}from"./index-D0l2JJ6w.js";import{h as La,j as Ia,k as Xe,l as Fa,m as Wt}from"./ui-preferences-store-C6eXGzFs.js";import{u as qa}from"./use-session-snapshot-Cqye2iDz.js";import{A as Dr}from"./arrow-up-D8Tgt51O.js";import"./console-mirror-BnHVC7eO.js";function Bs(e,s){return e.filter(r=>!s.includes(r))}function Ua(e,s,r){const a=e.slice(0);return a[s]=r,a}var Ba=class extends Tn{#r;#e;#n;#a;#t;#s;#o;#i;#c=[];constructor(e,s,r){super(),this.#r=e,this.#a=r,this.#n=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#p(e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,s){this.#n=e,this.#a=s,Ht.batch(()=>{const r=this.#t,a=this.#d(this.#n);this.#c=a,a.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions));const o=a.map(c=>c.observer),i=o.map(c=>c.getCurrentResult()),l=o.some((c,u)=>c!==r[u]);r.length===o.length&&!l||(this.#t=o,this.#e=i,this.hasListeners()&&(Bs(r,o).forEach(c=>{c.destroy()}),Bs(o,r).forEach(c=>{c.subscribe(u=>{this.#p(c,u)})}),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const r=this.#d(e),a=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions));return[a,o=>this.#u(o??a,s),()=>this.#l(a,r)]}#l(e,s){return s.map((r,a)=>{const o=e[a];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,i=>{s.forEach(l=>{l.observer.trackProp(i)})})})}#u(e,s){return s?((!this.#s||this.#e!==this.#i||s!==this.#o)&&(this.#o=s,this.#i=this.#e,this.#s=Rn(this.#s,s(e))),this.#s):e}#d(e){const s=new Map(this.#t.map(a=>[a.options.queryHash,a])),r=[];return e.forEach(a=>{const o=this.#r.defaultQueryOptions(a),i=s.get(o.queryHash);i?r.push({defaultedQueryOptions:o,observer:i}):r.push({defaultedQueryOptions:o,observer:new xr(this.#r,o)})}),r}#p(e,s){const r=this.#t.indexOf(e);r!==-1&&(this.#e=Ua(this.#e,r,s),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,s=this.#l(this.#e,this.#c),r=this.#u(s,this.#a?.combine);e!==r&&Ht.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function $a({queries:e,...s},r){const a=br(r),o=Dn(),i=An(),l=d.useMemo(()=>e.map(w=>{const g=a.defaultQueryOptions(w);return g._optimisticResults=o?"isRestoring":"optimistic",g}),[e,a,o]);l.forEach(w=>{On(w),Pn(w,i)}),Mn(i);const[c]=d.useState(()=>new Ba(a,l,s)),[u,m,p]=c.getOptimisticResult(l,s.combine),_=!o&&s.subscribed!==!1;d.useSyncExternalStore(d.useCallback(w=>_?c.subscribe(Ht.batchCalls(w)):Ln,[c,_]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(l,s)},[l,s,c]);const f=u.some((w,g)=>As(l[g],w))?u.flatMap((w,g)=>{const h=l[g];if(h){const v=new xr(a,h);if(As(h,w))return Os(h,v,i);In(w,o)&&Os(h,v,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const x=u.find((w,g)=>{const h=l[g];return h&&Fn({result:w,errorResetBoundary:i,throwOnError:h.throwOnError,query:a.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(x?.error)throw x.error;return m(p())}/**
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 za=[["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"}]],Ga=At("calendar-off",za);/**
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 Ya=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Ha=At("list-filter",Ya);/**
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 Ka=[["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"}]],Wa=At("message-square-more",Ka);/**
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 Va=[["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"}]],Qa=At("unlink",Va),Mt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Xa(e){return us({queryKey:Mt.list,enabled:e,queryFn:()=>_e({op:"projects.list"}).then(s=>s.projects),retry:ds,staleTime:1e4})}function Ja(e,s){return $a({queries:e.map(r=>({queryKey:Mt.detail(r),enabled:s&&!!r,queryFn:()=>_e({op:"projects.get",key:r}),retry:ds,staleTime:1e4}))})}function Ar(e,s){return us({queryKey:Mt.detail(e??""),enabled:s&&!!e,queryFn:()=>_e({op:"projects.get",key:e??""}),retry:ds,staleTime:1e4})}function Ue(){const e=br();return()=>{e.invalidateQueries({queryKey:Mt.list})}}function Za(){const e=Ue();return qe({mutationFn:s=>_e({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 Or(){const e=Ue();return qe({mutationFn:s=>_e({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:qn,onSuccess:()=>e()})}function Pr(){const e=Ue();return qe({mutationFn:s=>_e({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function eo(){const e=Ue();return qe({mutationFn:s=>_e({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function to(){const e=Ue();return qe({mutationFn:s=>_e({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function so(){const e=Ue();return qe({mutationFn:s=>_e({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 ro(){const e=Ue();return qe({mutationFn:s=>_e({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const Mr={planning:{get label(){return n("ui.projects.project_model.planning")},variant:"info"},active:{get label(){return n("ui.projects.project_model.active")},variant:"accent"},qa:{get label(){return n("ui.projects.project_model.qa")},variant:"attention"},validation:{get label(){return n("ui.projects.project_model.validation")},variant:"warning"},done:{get label(){return n("ui.projects.project_model.done")},variant:"success"},paused:{get label(){return n("ui.projects.project_model.paused")},variant:"neutral"},archived:{get label(){return n("ui.projects.project_model.archived")},variant:"outline"}},Ge=Object.keys(Mr);function ae(e){return Mr[e]??{label:e||n("ui.projects.project_model.unknown"),variant:"neutral"}}const Lr=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:ae(e).label}));function no(e){return e==="done"}const ao={completed:{get label(){return n("ui.projects.project_model.completed")},variant:"success"},overdue:{get label(){return n("ui.projects.project_model.overdue")},variant:"warning"},upcoming:{get label(){return n("ui.projects.project_model.upcoming")},variant:"neutral"}};function oo(e){return ao[e]??{label:String(e),variant:"neutral"}}Fe["ui.projects.project_model.stale"];const io=/^(\d{4})-(\d{2})-(\d{2})$/;function Oe(e,s,r=new Date){if(!e)return"";const a=io.exec(e);if(!a)return e;const o=new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));if(Number.isNaN(o.getTime()))return e;const i=yt(o,{month:"short",day:"numeric"},s);return o.getFullYear()===r.getFullYear()?i:yt(o,{month:"short",day:"numeric",year:"numeric"},s)}function pt(e,s){if(e==null)return"";const r=Math.max(0,Math.floor(s/1e3-e));return r<60?n("ui.projects.project_model.just_now"):r<3600?`${V(Math.floor(r/60),{useGrouping:!1})}m`:r<86400?`${V(Math.floor(r/3600),{useGrouping:!1})}h`:`${V(Math.floor(r/86400),{useGrouping:!1})}d`}function mt(e){return e===n("ui.projects.project_model.just_now")?n("ui.projects.project_model.just_now"):n("ui.projects.project_model.age_ago",{age:String(e)})}function co(e){return e?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(mt(e))}):n("ui.projects.project_model.no_progress")}const Ir=/^$|^\d{4}-\d{2}-\d{2}$/;function Fr(e){return e?e==="operator"?n("ui.projects.project_model.the_operator"):n("ui.projects.project_model.session_reportedby",{reportedBy:String(e)}):""}function lo(e,s){if(!e.progress)return n("ui.projects.project_model.not_reported_yet");const r=pt(e.progress_updated_at,s),a=Fr(e.progress_reported_by),o=[r?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(mt(r))}):"reported"];return a&&o.push(n("ui.projects.project_model.by_reporter",{reporter:String(a)})),o.join(" ")}function qr(e,s){if(e==null)return"";const r=V(e,{useGrouping:!1,maximumFractionDigits:20});return s==="points"?n("ui.projects.project_model.value_pt",{value:String(r)}):s==="days"?n("ui.projects.project_model.value_d",{value:String(r)}):r}function Ur(e,s){return s<=0?"":n("ui.projects.project_model.completed_total",{completed:V(e,{useGrouping:!1}),total:V(s,{useGrouping:!1})})}function xs(e){return e<=0?"":n("ui.projects.project_model.live_live",{live:e})}function uo(e){return e<=0?"":n("ui.projects.count.session",{count:e})}function po(e){return n("ui.projects.count.project",{count:e})}function mo(e){const s=uo(e.sessions);if(!s)return"";const r=xs(e.live_sessions);return r?n("ui.projects.project_model.count_live",{count:String(s),live:String(r)}):s}function fo(e){if(!e.exists)return{get label(){return n("ui.projects.project_model.missing")},variant:"outline"};if(e.archived)return{get label(){return n("ui.projects.project_model.archived")},variant:"neutral"};switch(e.runtime?.state){case"live":return{get label(){return n("ui.projects.project_model.live")},variant:"success"};case"wedged":return{get label(){return n("ui.projects.project_model.wedged")},variant:"warning"};case"stale":return{get label(){return n("ui.projects.project_model.stale")},variant:"warning"};case"stopped":return{get label(){return n("ui.projects.project_model.stopped")},variant:"neutral"};default:return{label:String(e.runtime?.state??n("ui.projects.project_model.unknown")),variant:"neutral"}}}function _o(e){return e?e.running>0?n("ui.projects.count.subagent_running",{count:e.running}):n("ui.projects.count.subagent",{count:e.settled}):""}function jo(e){return e?n("ui.projects.count.todo",{count:e.total}):""}function Br(e,s){const r=[],a=Oe(e.completed_at??e.target_date,s);a&&r.push({key:e.completed_at?"completed":"target",text:e.completed_at?n("ui.projects.project_model.completed_day",{day:String(a)}):n("ui.projects.project_model.due_day",{day:String(a)})});const o=qr(e.estimate,e.estimate_unit);o&&r.push({key:"estimate",text:o});const i=Ur(e.milestones_completed,e.milestones_total);i&&r.push({key:"milestones",text:n("ui.projects.project_model.milestones_milestones",{milestones:String(i)})});const l=xs(e.live_sessions);return l&&r.push({key:"live",text:l}),r}const Ye=864e5,ho=/^(\d{4})-(\d{2})-(\d{2})$/;function ve(e){if(!e)return null;const s=ho.exec(e);if(!s)return null;const r=Number(s[1]),a=Number(s[2]),o=Number(s[3]),i=Date.UTC(r,a-1,o),l=new Date(i);return l.getUTCFullYear()!==r||l.getUTCMonth()!==a-1||l.getUTCDate()!==o?null:i}const Vt=["planning","active","qa","validation","done"],Qt=["paused","archived"],Lt=[{value:"24h",get label(){return n("ui.projects.project_model.last_24_hours")},get phrase(){return n("ui.projects.project_model.the_last_24_hours")},seconds:86400},{value:"7d",get label(){return n("ui.projects.project_model.last_7_days")},get phrase(){return n("ui.projects.project_model.the_last_7_days")},seconds:604800},{value:"30d",get label(){return n("ui.projects.project_model.last_30_days")},get phrase(){return n("ui.projects.project_model.the_last_30_days")},seconds:2592e3},{value:"90d",get label(){return n("ui.projects.project_model.last_90_days")},get phrase(){return n("ui.projects.project_model.the_last_90_days")},seconds:7776e3},{value:"all",get label(){return n("ui.projects.project_model.all_time")},phrase:null,seconds:null}],$r="7d",go=Lt.find(e=>e.value===$r);function zr(e){return Lt.find(s=>s.value===e)??go}function xo(e){return Lt.some(s=>s.value===e)}function $s(e,s,r){const a=zr(s);return a.seconds===null?e:e.filter(o=>r/1e3-o.updated_at<=a.seconds)}function bo(e){const s=zr(e);return s.seconds===null?null:n("ui.projects.project_model.nothing_changed_in_phrase",{phrase:String(s.phrase)})}const Gr="projects-board-window";function yo(){try{const e=localStorage.getItem(Gr);if(e!==null&&xo(e))return e}catch{}return $r}function zs(e){try{localStorage.setItem(Gr,e)}catch{}}const Yr="projects-board-column-order";let Xt=null;function vo(){if(Xt)return[...Xt];try{const e=localStorage.getItem(Yr);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const r=[];for(const a of s){if(typeof a!="string"||a.length===0)return[];r.includes(a)||r.push(a)}return r}catch{return[]}}function ko(e){Xt=[...e];try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}function wo(e,s,r){const a=e.filter(i=>i!==s),o=Math.max(0,Math.min(r,a.length));return a.splice(o,0,s),a}function No(e,s=[]){const r=new Map;for(const c of e){const u=r.get(c.status)??[];u.push(c),r.set(c.status,u)}const a=Vt.map(c=>({status:c,projects:r.get(c)??[]}));for(const c of Qt){const u=r.get(c)??[];u.length>0&&a.push({status:c,projects:u})}for(const[c,u]of r)!Qt.includes(c)&&!Vt.includes(c)&&a.push({status:c,projects:u});if(s.length===0)return a;const o=new Map(s.map((c,u)=>[c,u])),i=a.filter(c=>o.has(c.status));i.sort((c,u)=>(o.get(c.status)??0)-(o.get(u.status)??0));const l=a.filter(c=>!o.has(c.status));return[...i,...l]}function Hr(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const r=ve(e.target_date);return r===null?!1:r<s}function ne(e){return e.title||e.name}Fe["ui.projects.project_model.no_team"];function ft(e){const s=e.team?.trim();if(s)return s;const r=e.owner?.trim();return r||null}function bs(e,s){const r=new Map,a=[];for(const i of e){const l=s(i);if(l===null){a.push(i);continue}const c=r.get(l);c?c.push(i):r.set(l,[i])}const o=[...r.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return a.length>0&&o.push({team:null,items:a}),o}function It(e){return e.title||e.session_id}function So(e){return[...e].reverse()}function Co(e){return e<=0?"":n("ui.projects.count.update",{count:e})}const Gs=e=>String(e).padStart(2,"0");function Jt(e){return`${e.getFullYear()}-${Gs(e.getMonth()+1)}-${Gs(e.getDate())}`}function Eo(e){const s=Date.parse(e);return Number.isNaN(s)?"":Jt(new Date(s))}function To(e,s,r=new Date){if(!e)return"";if(e===Jt(r))return n("ui.projects.project_model.today");const a=new Date(r.getFullYear(),r.getMonth(),r.getDate()-1);return e===Jt(a)?n("ui.projects.project_model.yesterday"):Oe(e,s,r)}function Ro(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":Un(new Date(r),{hour:"numeric",minute:"2-digit"},s)}function Do(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":mt(pt(r/1e3,s))}function Ao(e,s,r=Date.now()){const a=[],o=Fr(e.by);o&&a.push({key:"author",text:o});const i=Ro(e.at,s);i&&a.push({key:"time",text:i});const l=Do(e.at,r);return l&&a.push({key:"age",text:l}),a}function Oo(e,s,r=new Date){const a=[];for(const o of So(e)){const i=Eo(o.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(o);continue}a.push({key:i,label:To(i,s,r),entries:[o]})}return a}function Po(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 Mo(e,s){return s<=0?"":`${e} of ${s} complete`}function Lo(e){let s=0,r=0,a=!1;for(const o of e)o.todos&&(a=!0,s+=o.todos.open,r+=o.todos.total);return a?{open:s,total:r}:null}function Ys(e){return`${e.open} open of ${e.total}`}function Io(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function Fo(e){const s=ne(e),r=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${r}`,"Review the project details and continue or complete the work."].join(`
22
+ `)}function qo(e){return e?e.kind==="team"?n("ui.projects.project_model.team_name",{name:String(e.name)}):n("ui.projects.project_model.agent_name",{name:String(e.name)}):""}const Uo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Kr(e){const s=[];for(const r of e.matchAll(Uo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const bt=3;function ys(e){if(e.length<=bt+1)return e.length<=1?e.join(""):n("ui.projects.project_model.join_and_length_1",{join:String(e.slice(0,-1).join(", ")),length___1:String(e[e.length-1])});const s=e.length-bt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,bt).join(", ")),hidden:V(s,{useGrouping:!1})})}function vs(e){return n("ui.projects.count.milestones_are",{count:e})}const Hs="complete them, or pass force_done=true to close with them open",Bo="complete or remove the incomplete milestones, then mark it done",Wr=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function _t(e){const s=e.match(Wr);if(s){const r=Number(s[1]),a=Kr(s[2]),o=a.length>0?ys(a):s[2];return n("ui.projects.project_model.this_can_t_be_marked_done_yet_milestonesare_count_still_incomplet",{milestonesAre_count:String(vs(r)),clause:String(o)})}return e.includes(Hs)?e.replace(Hs,Bo):e}const $o="project_done_incomplete";function zo(e){const s=e.message.match(Wr),r=e.code===$o;if(!r&&!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,o=a&&a.length>0?a:s?Kr(s[2]):[];return{count:o.length>0?o.length:s?Number(s[1]):0,names:o,coded:r,message:e.message}}function Go(e){if(e.count>0){const s=ys(e.names);return n("ui.projects.project_model.count_still_open_clause_clause",{count:String(vs(e.count)),clause________clause:String(s?n("ui.projects.project_model.clause",{clause:String(s)}):"")})}return _t(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Yo(e){return e.count>0&&e.names.length>0?n("ui.projects.project_model.this_can_t_be_marked_done_yet_count_still_incomplete_names_comple",{count:String(vs(e.count)),names:String(ys(e.names))}):_t(e.message)||n("ui.projects.project_model.milestones_are_still_open_on_this_project_complete_or_remove_them")}function Vr(e,s,r){if(!e||e.forced_done!==!0)return n("ui.projects.project_model.moved_to_statuslabel",{statusLabel:String(r)});const a=typeof e.milestones_total=="number"&&typeof e.milestones_completed=="number"?e.milestones_total-e.milestones_completed:s,o=a>0?a:s;return n("ui.projects.count.moved_open",{status:r,open:o})}Fe["ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"];function Qr(e){return e.trim().slice(0,La)}const Ho={get client(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_and_teams_update_text_is")},get backend(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_teams_and_update_text_cle")}},Ko=2,Wo=4,Vo=3,Qo=2,Xo=1,Jo=3,Me={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},Zo=/[^\p{L}\p{N}]+/u,ei=/\s+/;function Ks(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Wo;if(r.startsWith(e))return Vo;const a=r.split(Zo).filter(Boolean),o=e.split(ei).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return Qo;const i=o.join("");return i.length>=Jo&&ti(i,r)?Xo:0}function ti(e,s){let r=0;for(const a of e){if(r=s.indexOf(a,r),r<0)return!1;r+=1}return!0}function si(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Me.title],[e.name,Me.name],[e.description,Me.description],[e.owner,Me.attribution],[e.team,Me.attribution],[e.status,Me.status]];let o=0;for(const[i,l]of a){if(!i)continue;const c=Ks(r,i)*l;c>o&&(o=c)}for(const i of e.tags){const l=Ks(r,i)*Me.tags;l>o&&(o=l)}return o}function ri(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=si(o,r);i>0&&a.push({project:o,score:i})}return a.sort((o,i)=>{if(o.score!==i.score)return i.score-o.score;if(o.project.updated_at!==i.project.updated_at)return i.project.updated_at-o.project.updated_at;const l=ne(o.project).localeCompare(ne(i.project),void 0,{sensitivity:"base"});if(l!==0)return l;const c=o.project.name.localeCompare(i.project.name,void 0,{sensitivity:"base"});return c!==0?c:o.project.id<i.project.id?-1:o.project.id>i.project.id?1:0}),a.map(o=>o.project)}function ni(e,s){if(s.length===0)return[];const r=new Map(e.map(o=>[o.id,o])),a=[];for(const o of s){const i=r.get(o.id);i!==void 0&&a.push(i)}return a}const ai=180;function oi(e,s){const r=Qr(e),a=Tr(r,ai),o=us({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>_e({op:"projects.search",q:a,limit:Ia}),retry:!1,staleTime:3e4}),i=a===r,l=i&&o.data&&o.data.query===r?o.data:null,c=i&&r.length>0&&!l&&o.isError;return{answer:l,pending:s&&r.length>0&&!l&&!c}}const et=["status","team","owner","tags","progress","target","estimate","milestones","live"],Ws={status:[],team:[],owner:[],tags:[],progress:[],target:[],estimate:[],milestones:[],live:[]},ot={get status(){return n("ui.projects.project_filters.status")},get team(){return n("ui.projects.project_filters.team")},get owner(){return n("ui.projects.project_filters.owner")},get tags(){return n("ui.projects.project_filters.tags")},get progress(){return n("ui.projects.project_filters.progress")},get target(){return n("ui.projects.project_filters.target_date")},get estimate(){return n("ui.projects.project_filters.estimate")},get milestones(){return n("ui.projects.project_filters.milestones")},get live(){return n("ui.projects.project_filters.live_sessions")}},ii=new Set(["status","progress","target","estimate","milestones","live"]),ci={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"]},li={get stale(){return n("ui.projects.project_filters.stale")},get"up-to-date"(){return n("ui.projects.project_filters.up_to_date")},get"not-reported"(){return n("ui.projects.project_filters.not_reported")},get none(){return n("ui.projects.project_filters.no_target_date")},get overdue(){return n("ui.projects.project_filters.overdue")},get"within-7"(){return n("ui.projects.project_filters.due_within_7_days")},get"within-30"(){return n("ui.projects.project_filters.due_within_30_days")},get points(){return n("ui.projects.project_filters.points")},get days(){return n("ui.projects.project_filters.days")},get incomplete(){return n("ui.projects.project_filters.incomplete")},get complete(){return n("ui.projects.project_filters.complete")},get"has-live"(){return n("ui.projects.project_filters.has_live_sessions")},get"no-live"(){return n("ui.projects.project_filters.no_live_sessions")}};function Xr(e,s){switch(e){case"status":return ae(s).label;case"team":return s===null?n("ui.projects.project_filters.no_team"):s;case"owner":return s===null?n("ui.projects.project_filters.no_owner"):s;case"tags":return s??"";case"estimate":if(s==="none")return n("ui.projects.project_filters.no_estimate");break;case"milestones":if(s==="none")return n("ui.projects.project_filters.none_set");break;case"target":if(s==="none")return n("ui.projects.project_filters.no_target_date");break}return li[s]??s??""}function ui(e,s){return e[s].length>0}function ct(e){return et.every(s=>!ui(e,s))}function di(e){return et.reduce((s,r)=>s+e[r].length,0)}function Jr(e,s,r){const a=e[s],o=a.includes(r)?a.filter(i=>i!==r):[...a,r];return{...e,[s]:o}}function Zr(e,s,r,a){switch(e){case"status":return s.status===r;case"team":return ft(s)===r;case"owner":return(s.owner?.trim()||null)===r;case"tags":return s.tags.includes(r??"");case"progress":return r==="stale"?s.progress_stale===!0:r==="up-to-date"?s.progress_stale===!1:s.progress_updated_at===null;case"target":{if(r==="none")return ve(s.target_date)===null;if(r==="overdue")return Hr(s,a);const o=ve(s.target_date);if(o===null)return!1;const i=(o-a)/Ye;return r==="within-7"?i>=0&&i<=7:i>=0&&i<=30}case"estimate":return r==="none"?s.estimate===null:s.estimate===null?!1:r==="points"?s.estimate_unit==="points":s.estimate_unit==="days";case"milestones":return r==="none"?s.milestones_total===0:s.milestones_total===0?!1:r==="complete"?s.milestones_completed>=s.milestones_total:s.milestones_completed<s.milestones_total;case"live":return r==="has-live"?s.live_sessions>0:s.live_sessions===0}}function en(e,s,r,a){const o=e[s];return o.length===0?!0:o.some(i=>Zr(s,r,i,a))}function pi(e,s,r){return ct(s)?e:e.filter(a=>et.every(o=>en(s,o,a,r)))}function mi(e,s,r,a){return s.filter(o=>et.every(i=>i===e||en(r,i,o,a)))}function fi(e,s,r){const a=r[e];switch(e){case"status":{const i=[...new Set(s.map(c=>c.status))].filter(c=>!Ge.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!Ge.includes(c)&&!i.includes(c));return[...Ge,...i,...l]}case"team":{const o=new Set;let i=!1;for(const c of s){const u=ft(c);u===null?i=!0:o.add(u)}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"owner":{const o=new Set;let i=!1;for(const c of s){const u=c.owner?.trim();u?o.add(u):i=!0}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"tags":{const o=new Set;for(const i of s)for(const l of i.tags)o.add(l);for(const i of a)o.add(i??"");return[...o].sort((i,l)=>i.localeCompare(l,void 0,{sensitivity:"base"}))}case"progress":case"target":case"estimate":case"milestones":case"live":return ci[e]}}function tn(e,s,r,a){const o=mi(e,s,r,a),i=ii.has(e),l=[];for(const c of fi(e,o,r)){const u=r[e].includes(c),m=o.reduce((p,_)=>p+(Zr(e,_,c,a)?1:0),0);!i&&m===0&&!u||l.push({value:c,label:Xr(e,c),count:m,selected:u})}return{facet:e,label:ot[e],options:l}}function _i(e,s,r){return et.map(a=>tn(a,e,s,r))}const Zt="projects-sort";Fe["ui.projects.project_sort.default_as_listed"];function ji(e){return hi.includes(e)}const hi=["name","status","target","estimate","milestones","live","progress"];function gi(){try{const e=localStorage.getItem(Zt);if(e===null)return null;const[s,r,...a]=e.split(":");if(a.length>0)return null;if(s&&ji(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function xi(e){try{e===null?localStorage.removeItem(Zt):localStorage.setItem(Zt,`${e.key}:${e.direction}`)}catch{}}function Je(e){switch(e){case"name":return n("ui.projects.project_sort.project");case"status":return n("ui.projects.project_sort.status");case"target":return n("ui.projects.project_sort.target");case"estimate":return n("ui.projects.project_sort.estimate");case"milestones":return n("ui.projects.project_sort.milestones");case"live":return n("ui.projects.project_sort.live");case"progress":return n("ui.projects.project_sort.progress")}}function Bt(e){return e==="target"||e==="progress"?"desc":"asc"}function ks(e,s){const r=s==="desc";switch(e){case"name":return r?n("ui.projects.project_sort.z_to_a"):n("ui.projects.project_sort.a_to_z");case"status":return r?n("ui.projects.project_sort.archived_first"):n("ui.projects.project_sort.planning_first");case"target":return r?n("ui.projects.project_sort.latest_first"):n("ui.projects.project_sort.soonest_first");case"estimate":return r?n("ui.projects.project_sort.days_first"):n("ui.projects.project_sort.points_first");case"milestones":return r?n("ui.projects.project_sort.most_complete_first"):n("ui.projects.project_sort.least_complete_first");case"live":return r?n("ui.projects.project_sort.most_first"):n("ui.projects.project_sort.fewest_first");case"progress":return r?n("ui.projects.project_sort.most_recent_first"):n("ui.projects.project_sort.most_stale_first")}}function bi(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(Je(e.key)),direction:String(ks(e.key,e.direction))})}function yi(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 r=s.length===1?n("ui.projects.project_sort.parts_0_cleared",{parts_0:String(s[0])}):n("ui.projects.project_sort.join_and_length_1_cleared",{join:String(s.slice(0,-1).join(", ")),length___1:String(s[s.length-1])});return r.charAt(0).toUpperCase()+r.slice(1)}function Vs(e,s){switch(e){case"name":return 0;case"status":return Ge.includes(s.status)?0:1;case"target":return es(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 es(e){return ve(e.completed_at??e.target_date)}function Qs(e){return e==="points"?0:e==="days"?1:2}function vi(e,s,r){switch(e){case"name":return ne(s).localeCompare(ne(r),void 0,{sensitivity:"base"});case"status":return Ge.indexOf(s.status)-Ge.indexOf(r.status);case"target":{const a=es(s)??0,o=es(r)??0;return a-o}case"estimate":{const a=Qs(s.estimate_unit)-Qs(r.estimate_unit);return a!==0?a:(s.estimate??0)-(r.estimate??0)}case"milestones":return s.milestones_completed*r.milestones_total-r.milestones_completed*s.milestones_total;case"live":return s.live_sessions-r.live_sessions;case"progress":return(s.progress_updated_at??0)-(r.progress_updated_at??0)}}function Xs(e,s){if(e.updated_at!==s.updated_at)return s.updated_at-e.updated_at;const r=ne(e).localeCompare(ne(s),void 0,{sensitivity:"base"});if(r!==0)return r;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 ki(e,s,r){const a=Vs(r.key,e),o=Vs(r.key,s);if(a!==o)return a-o;if(a===1)return Xs(e,s);const i=vi(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:Xs(e,s)}function wi(e,s){return[...e].sort((r,a)=>ki(r,a,s))}const De=["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 Le(e,s){return Math.round((s-e)/Ye)}function Js(e,s){return Le(e,s)+1}function Ni(e,s){for(const r of De)if(e*ws[r]<=s)return r;return De[De.length-1]}function Si(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ci(e,s){const r=[s];for(const a of e){for(const o of[a.project.start_date,a.project.target_date,a.project.completed_at]){const i=ve(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=ve(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Ei(e){const s=[],r=[];for(const a of e)(Si(a)?s:r).push(a);return{dated:s,undated:r}}function Ti(e){return n("ui.projects.count.undated",{count:e})}function Ri(e){const{project:s}=e,r=ve(s.start_date),a=ve(s.target_date),o=ve(s.completed_at),i=s.status==="done"&&o!==null?o:a,l=r??i,c=i??r;return l===null||c===null?null:{fromMs:Math.min(l,c),toMs:Math.max(l,c)}}function Di(e){const s=[];for(const r of e.milestones){const a=ve(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const $t=e=>yt(new Date(e),{month:"short",timeZone:"UTC"});function he(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Ai(e){const{year:s,month:r}=he(e);return Date.UTC(s,r-1,1)}function Oi(e){const{year:s,month:r}=he(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function Pi(e){const{year:s,month:r}=he(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Mi(e){const{year:s,month:r}=he(e),a=Math.floor((r-1)/3);return a===3?Date.UTC(s+1,0,1):Date.UTC(s,a*3+3,1)}function Li(e){const{weekday:s}=he(e);return e-(s+6)%7*Ye}const Ii=26;function Fi(e,s,r){const a=[],o=(p,_,b)=>{p<e||p>s||a.push({dayMs:p,label:_,major:b})};if(r==="day"){let p=!1;for(let _=e;_<=s;_+=Ye){const{day:b}=he(_);b===1?(o(_,$t(_),!0),p=!0):p?(o(_,"",!1),p=!1):o(_,V(b,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let p=Li(e);p<=s;p+=7*Ye){if(p<e)continue;const{day:_,month:b}=he(p);he(p-7*Ye).month!==b?o(p,yt(new Date(p),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(p,V(_,{useGrouping:!1}),!1)}return a}const i=r==="month"?Ai:Pi,l=r==="month"?Oi:Mi,c=p=>{const{year:_,month:b}=he(p);if(r==="month")return b===1&&_!==he(e).year?`${$t(p)} '${V(_%100,{minimumIntegerDigits:2,useGrouping:!1})}`:$t(p);const f=Math.floor((b-1)/3)+1;return f===1&&_!==he(e).year?`Q1 '${String(_%100).padStart(2,"0")}`:`Q${f}`};o(e,c(i(e)),!0);const u=Math.ceil(Ii/ws[r]);let m=e;for(let p=l(i(e));p<=s;p=l(p))Le(m,p)<u||(o(p,c(p),!0),m=p);return a}function lt(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}const wt=80,Nt=80,Zs=64,er=8;function ts(e){return e.trim().length>wt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:wt}):null}function sn(e){return e.length>Xe?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:Xe}):null}function St(e,s){return e.trim().length>Nt?n("ui.projects.project_edit_model.teams_are_at_most_value2_characters",{teams:String(s==="owner"?n("ui.projects.project_edit_model.owners"):n("ui.projects.project_edit_model.teams")),value2:Nt}):null}function ss(e){return Ir.test(e)?null:n("ui.projects.project_edit_model.dates_are_yyyy_mm_dd_or_empty")}function rs(e,s){return e&&s&&s<e?n("ui.projects.project_edit_model.the_target_date_is_before_the_start_date"):null}function rn(e){const s=e.trim();if(s==="")return null;const r=Number(s);return!Number.isFinite(r)||!(r>0)||r>1e3?n("ui.projects.project_edit_model.estimates_are_greater_than_0_and_at_most_1000"):null}function ns(e){const s=lt(e);if(s.length>er)return{tags:s,error:n("ui.projects.project_edit_model.up_to_project_tags_max_tags",{PROJECT_TAGS_MAX:er})};for(const r of s){const a=Fa(r);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const qi="project_name_exists";function tr(e){return e.code===qi?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):_t(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Ui(e,s){if(e.unit!==s.unit)return!1;const r=e.number.trim(),a=s.number.trim();return a===""?!0:r===""?!1:Number(r)===Number(a)}function Bi(e,s){const r=lt(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function $i(e,s){const r={},a=s.number.trim();if(a!==""){const o=Number(a);(e.estimate===null||e.estimate!==o)&&(r.estimate=o)}return s.unit!==e.unit&&(r.estimate_unit=s.unit),Object.keys(r).length>0?r:null}function tt(e){return e instanceof Rt?tr({code:e.code,message:e.message}):tr({message:e instanceof Error?e.message:""})}function nn(e){return e instanceof Rt&&(e.code==="project_not_found"||e.status===404)}function an(e){return!(e instanceof Error)||!e.message?n("ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"):nn(e)?n("ui.projects.project_refusals.this_project_could_not_be_found_it_may_have_been_deleted"):tt(e)}function on(e){if(!(e instanceof Error))return null;const s=e instanceof Rt?e:null;return zo({code:s?.code??null,message:e.message,detail:s?.detail})}async function zi(e){try{return await e.move(),{kind:"accepted"}}catch(s){const r=on(s);return r?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:r}:{kind:"spoken",copy:r?Yo(r):an(s),refusal:r}}}Fe["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Gi=({value:e,onChange:s})=>(F(),t.jsxs(Ke,{value:e,onValueChange:r=>s(r),children:[t.jsx(Ot,{content:e==="all"?null:n("ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"),side:"bottom",disableHoverableContent:!0,children:t.jsx(We,{"aria-label":n("ui.projects.board_window_select.projects_updated_within"),className:M("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(Ve,{})})}),t.jsx(Qe,{children:Lt.map(r=>t.jsx(Ae,{value:r.value,children:r.label},r.value))})]})),as=6e4,os=6e3;Fe["ui.projects.request_update.requesting_updates"];const Yi=400;Fe["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Hi="linked but not yet in use — it becomes a recipient after the first message",sr=e=>`project-request-update-${e}`,Ki=e=>`project-request-cooldown-${e}`,Wi=e=>`project-request-update-cooldown-${e}`,zt=e=>e.length===1?e[0]:e.length===2?n("ui.projects.request_update.names_0_and_names_1",{names_0:String(e[0]),names_1:String(e[1])}):n("ui.projects.request_update.names_0_names_1_and_length_2_more",{names_0:String(e[0]),names_1:String(e[1]),length___2:V(e.length-2,{useGrouping:!1})}),rr=(e,s)=>e.sessions.filter(r=>r.outcome===s).map(r=>It({session_id:r.session_id,title:r.title})),Vi=e=>e.outcome==="failed"&&e.detail===Hi;function Ct(e,s){const r=Math.max(1,Math.ceil(s/1e3)),a=Math.max(0,Math.ceil(as/1e3)-r);return n("ui.projects.request_update.update_already_requested_ago_s_ago_on_display_try_again_in_left_s",{ago:V(a,{useGrouping:!1}),display:String(e),left:V(r,{useGrouping:!1})})}function Qi(e){const s=ne({title:e.project.title,name:e.project.key}),{delivered:r,unconfirmed:a,failed:o,total:i}=e.counts;if(e.state==="empty")return{variant:"info",title:n("ui.projects.request_update.no_linked_sessions_to_ask_link_a_session_to_display_first",{display:String(s)}),duration:os};if(e.state==="cooldown")return{variant:"info",title:Ct(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:os};if(e.state!=="sent")return null;const l=rr(e,"failed"),c=rr(e,"unconfirmed");if(r>=1&&o===0&&a===0)return{variant:"success",title:n("ui.projects.request_update.delivered",{delivered:r,display:s})};if(r>=1){let u=n("ui.projects.request_update.requested_updates_from_delivered_of_total_sessions_on_display",{delivered:V(r,{useGrouping:!1}),total:i,display:String(s)});return o>0&&(u+=n("ui.projects.request_update.value1_could_not_be_reached",{value1:String(zt(l))})),a>0&&(u+=n("ui.projects.request_update.delivery_to_value1_could_not_be_confirmed",{value1:String(zt(c))})),{variant:"warning",title:u,duration:Number.POSITIVE_INFINITY}}if(o===0)return{variant:"warning",title:n("ui.projects.request_update.could_not_confirm_delivery_on_display_the_requests_may_still_reac",{display:String(s)}),duration:Number.POSITIVE_INFINITY};if(a===0){const u=e.sessions.every(Vi);let m;return u?m=n("ui.projects.request_update.never_started",{total:i}):m=n("ui.projects.request_update.could_not_reach_any_of_the_total_linked_sessions_on_display",{total:i,display:String(s)}),{variant:"error",title:m,duration:Number.POSITIVE_INFINITY}}return{variant:"warning",title:n("ui.projects.request_update.could_not_reach_failed_of_the_total_linked_sessions_on_display_de",{failed:V(o,{useGrouping:!1}),total:i,display:String(s),value4:String(zt(c))}),duration:Number.POSITIVE_INFINITY}}const at=new Map,Ss=new Set,Gt=new Map,is=new Set;let cn=0;const Et=()=>{cn+=1;for(const e of is)e()},Xi=e=>(is.add(e),()=>{is.delete(e)}),nr=()=>cn,ln=e=>Ss.has(e),un=e=>at.get(e);function Ji(e){Ss.add(e),Et()}function Zi(e){Ss.delete(e),Et()}function ar(e,s,r){const a=Date.now();if(r<=a)return;const o=at.get(e);if(o&&o.untilMs>=r)return;at.set(e,{startedMs:s,untilMs:r});const i=Gt.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Gt.delete(e);const c=at.get(e);c&&c.untilMs<=Date.now()&&(at.delete(e),Et())},r-a);l.unref?.(),Gt.set(e,l),Et()}const ec=e=>/[.!?…]$/.test(e)?e:`${e}.`;function tc(e,s){const r=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;ar(e,r-(as-a),r+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&ar(e,r,r+as)}async function sc(e){const s=e.id;if(ln(s)){Ps(n("ui.projects.request_update.requesting_updates"),{id:sr(s)});return}const r=Date.now(),a=un(s);if(a&&a.untilMs>r){Ms(Ct(ne(e),a.untilMs-r),{id:Ki(s),duration:os});return}Ji(s);const o=sr(s);let i=!1;const l=setTimeout(()=>{i=!0,Ps(n("ui.projects.request_update.requesting_updates"),{id:o})},Yi);try{const c=await _e({op:"projects.request_update",key:s});tc(s,c);const u=Qi(c);if(u){const m={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":be(u.title,m);break;case"warning":Bn(u.title,m);break;case"error":Ls(u.title,m);break;default:Ms(u.title,m)}}else i&&$n(o)}catch(c){const u=c instanceof Error&&c.message.trim()!==""?c.message.trim():null;Ls(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(ec(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),Zi(s)}}function dn(){return d.useCallback(e=>{sc(e)},[])}function rc(e){d.useSyncExternalStore(Xi,nr,nr);const s=ln(e),r=un(e),a=r!==void 0?r.untilMs-Date.now():0,o=a>0;return{sending:s,cooling:o,cooldownRemainingMs:o?a:null}}const or={get active(){return n("ui.projects.project_board.in_flight")},get paused(){return n("ui.projects.project_board.on_hold")},get done(){return n("ui.projects.project_board.finished")}};function nc(){const[e,s]=d.useState(null);return d.useEffect(()=>{if(!e)return;const r=document.querySelector(`[data-project-menu="${e}"]`);r&&(r.focus(),s(null))}),d.useCallback(r=>s(r),[])}const ac=4,ir="board-column-move-hint",oc=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{F();const[u,m]=d.useState(vo),p=No(e,u),_=bs(e,ft),[b,f]=d.useState(null),[x,w]=d.useState(""),g=d.useRef(null),h=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{const y=g.current,k=h.current;if(!y||!k)return;const O=k.firstElementChild;let L=-1;const U=()=>{const z=k.offsetWidth-k.clientWidth;z!==L&&(L=z,y.style.paddingRight=z>0?`${z}px`:"")};let H=-1;const Q=()=>{const z=k.scrollLeft;Math.abs(y.scrollLeft-z)>.5&&(y.scrollLeft=z),H=z},$=()=>{Math.abs(y.scrollLeft-H)<=.5||(Math.abs(k.scrollLeft-y.scrollLeft)>.5&&(k.scrollLeft=y.scrollLeft),H=y.scrollLeft)},je=z=>{const se=z.deltaMode===1?16:z.deltaMode===2?k.clientWidth:1,xe=z.deltaMode===1?16:z.deltaMode===2?k.clientHeight:1;Math.abs(z.deltaX)>Math.abs(z.deltaY)?k.scrollLeft+=z.deltaX*se:k.scrollTop+=z.deltaY*xe,z.preventDefault()};U(),Q(),y.addEventListener("wheel",je,{passive:!1}),y.addEventListener("scroll",$,{passive:!0}),k.addEventListener("scroll",Q,{passive:!0});const ie=new ResizeObserver(()=>{U(),Q()});return ie.observe(k),O&&ie.observe(O),window.addEventListener("resize",U),()=>{y.removeEventListener("wheel",je),y.removeEventListener("scroll",$),k.removeEventListener("scroll",Q),ie.disconnect(),window.removeEventListener("resize",U)}},[]);const T=d.useRef(null),N=d.useRef(null),q=d.useRef(null),C=new Set(l),E=(y,k)=>{const O=wo(p.map(L=>L.status),y,k);m(O),ko(O),w(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(ae(y).label),indexOf_status____1:String(O.indexOf(y)+1),length:V(O.length,{useGrouping:!1})}))},P=(y,k)=>{const O=g.current;if(!O)return 0;let L=0;const U=O.querySelectorAll("[data-board-column]");for(const H of U){if(H.dataset.boardColumn===k)continue;const Q=H.getBoundingClientRect();y>(Q.left+Q.right)/2&&(L+=1)}return L},j=(y,k)=>{const O=p.filter(H=>H.status!==y),L=O[k-1]?.status,U=O[k]?.status;return L&&U?n("ui.projects.project_board.between_label_and_label_2",{label:String(ae(L).label),label_2:String(ae(U).label)}):U?n("ui.projects.project_board.before_label",{label:String(ae(U).label)}):L?n("ui.projects.project_board.after_label",{label:String(ae(L).label)}):n("ui.projects.project_board.in_place")},D=(y,k)=>{const O=P(y,k.status);O!==k.over&&(k.over=O,f({status:k.status,over:O}),w(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(ae(k.status).label),status__over:String(j(k.status,O))})))},R=()=>{N.current!==null&&(cancelAnimationFrame(N.current),N.current=null)},I=32,K=12,B=()=>{N.current=null;const y=q.current,k=h.current,O=T.current;if(!y?.armed||!k||O===null)return;const L=k.getBoundingClientRect(),U=k.scrollWidth-k.clientWidth;let H=0;if(O-L.left<I&&k.scrollLeft>0?H=-1:L.right-O<I&&k.scrollLeft<U&&(H=1),H!==0){const Q=k.scrollLeft;if(k.scrollLeft=Q+H*K,k.scrollLeft!==Q){const $=g.current;$&&($.scrollLeft=k.scrollLeft),D(O,y)}}else D(O,y);ee(y.status,y.over),N.current=requestAnimationFrame(B)};d.useEffect(()=>()=>{N.current!==null&&cancelAnimationFrame(N.current)},[]);const Y=(y,k)=>{if(y.button===0){try{y.currentTarget.setPointerCapture(y.pointerId)}catch{}q.current={pointerId:y.pointerId,status:k,startX:y.clientX,startY:y.clientY,armed:!1,over:p.findIndex(O=>O.status===k)},T.current=y.clientX}},X=y=>{const k=q.current;if(!(!k||y.pointerId!==k.pointerId)){if(T.current=y.clientX,!k.armed){if(Math.hypot(y.clientX-k.startX,y.clientY-k.startY)<ac)return;k.armed=!0,f({status:k.status,over:k.over}),w(n("ui.projects.project_board.moving_label_column",{label:String(ae(k.status).label)})),N.current===null&&(N.current=requestAnimationFrame(B))}D(y.clientX,k)}},Z=y=>{const k=q.current;if(q.current=null,R(),f(null),!k?.armed)return;if(!y){w(n("ui.projects.project_board.move_cancelled"));return}const O=p.findIndex(L=>L.status===k.status);if(k.over===O){w("");return}E(k.status,k.over)},me=y=>{const k=q.current;!k||y.pointerId!==k.pointerId||Z(!0)},oe=()=>{Z(!1)};d.useEffect(()=>{if(!b)return;const y=k=>{k.key==="Escape"&&Z(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[b!==null]);const ee=d.useCallback((y,k)=>{const O=g.current,L=h.current,U=v.current;if(!O||!L||!U)return;const H=L.getBoundingClientRect(),Q=[];for(const re of O.querySelectorAll("[data-board-column]"))re.dataset.boardColumn!==y&&Q.push(re.getBoundingClientRect());const $=6,je=k>=Q.length?(Q[Q.length-1]?.right??H.left)+$:(Q[k]?.left??H.right)-$,ie=L.scrollLeft,z=2,se=je-H.left+ie,xe=ie+1,fe=ie+L.clientWidth-z-1,Pe=Math.round(Math.min(Math.max(se,xe),Math.max(xe,fe)));U.style.left=`${Pe}px`},[]);d.useLayoutEffect(()=>{b&&ee(b.status,b.over)},[b,ee]);const te=(y,k)=>{if(y.key==="Enter"||y.key===" "){y.preventDefault(),w(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(y.key!=="ArrowLeft"&&y.key!=="ArrowRight")return;y.preventDefault();const O=p.map(H=>H.status),L=O.indexOf(k),U=y.key==="ArrowLeft"?L-1:L+1;if(U<0||U>=O.length){w(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(ae(k).label),the_last_column:String(U<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}E(k,U)};return t.jsxs("div",{className:M("[container-type:size] flex min-h-0 flex-1 flex-col",b&&"cursor-grabbing select-none"),"data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children:x}),t.jsx("span",{id:ir,className:"sr-only",children:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column")}),t.jsx("div",{ref:g,"data-board-header-viewport":"",className:"h-11 shrink-0 overflow-hidden",children:t.jsx("div",{"data-board-column-row":"",className:"flex h-11 w-max gap-3 px-6",children:p.map(y=>{const k=ae(y.status);return t.jsxs("header",{"data-board-column":y.status,"data-board-column-handle":y.status,onPointerDown:O=>Y(O,y.status),onPointerMove:X,onPointerUp:me,onPointerCancel:oe,className:M("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===y.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(G,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":y.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(k.label)}),"aria-describedby":ir,title:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"),className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:O=>te(O,y.status),children:t.jsx(Da,{"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:k.label}),or[y.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:or[y.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:y.projects.length})]},y.status)})})}),t.jsxs("div",{ref:h,"data-board-strip":"",className:"relative min-h-0 flex-1 overflow-auto px-6 pb-9",children:[b&&t.jsx("div",{ref:v,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsx("div",{className:"flex w-max flex-col",children:_.map(y=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":y.team??"",className:"sticky top-0 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:y.team==null?n("ui.projects.project_model.no_team"):c(y.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:y.items.length})]})}),t.jsx("div",{"data-glass-lane":"",className:"flex gap-3 rounded-md bg-sunken py-2",children:p.map(k=>{const O=y.items.filter(L=>L.status===k.status);return t.jsx("div",{"data-board-cell":k.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:O.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:O.map(L=>t.jsx("li",{children:t.jsx(ic,{project:L,nowMs:s,busy:C.has(L.id),onOpen:()=>r(L),onEdit:()=>a(L),onDelete:()=>o(L),onMove:U=>i(L,U)})},L.id))})},k.status)})})]},y.team??""))})]})]})},ic=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=F(),u=Br(e,c),m=Ze(),p=dn(),_=ye(m.data,"projects_request_update"),b=ne(e),f=d.useRef(null),[x,w]=d.useState(!1);d.useEffect(()=>{const N=f.current;if(!N)return;const q=()=>{N.isConnected&&w(N.scrollWidth-N.clientWidth>.5)},C=requestAnimationFrame(q),E=new ResizeObserver(q);return E.observe(N),document.fonts?.ready.then(q).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[b,x]);const g=Hr(e,Ns(s)),h=pt(e.progress_updated_at,s),v=()=>{const N=window.getSelection();N&&!N.isCollapsed||a()},T=N=>{N.key!=="Enter"&&N.key!==" "||N.target===N.currentTarget&&(N.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":n("ui.projects.project_board.open_displayname",{displayName:String(b)}),onClick:v,onKeyDown:T,"data-glass-block":"",className:M("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(Ot,{content:x?b:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:f,"data-project-title":e.name,tabIndex:x?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(ps,{children:[t.jsx(ms,{"data-project-menu":e.id,"aria-label":n("ui.projects.project_board.actions_for_displayname",{displayName:String(b)}),disabled:r,onClick:N=>N.stopPropagation(),className:M("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Te,{size:"xs"}):t.jsx(yr,{className:"size-4"})}),t.jsxs(fs,{align:"end",onClick:N=>N.stopPropagation(),children:[t.jsx(Ee,{onSelect:a,children:n("ui.projects.project_board.open")}),t.jsxs(ya,{children:[t.jsx(va,{children:n("ui.projects.project_board.set_status")}),t.jsx(ka,{children:t.jsx(wa,{value:e.status,onValueChange:l,children:[...Vt,...Qt].map(N=>t.jsx(Na,{value:N,children:ae(N).label},N))})})]}),_&&t.jsx(Ee,{onSelect:()=>p(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Sa,{}),t.jsx(Ee,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(Ee,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(N=>N.key!=="live").map(N=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:N.text},N.key)),g&&t.jsx(ke,{variant:"warning",children:n("ui.projects.project_board.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:co(h)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!h)&&t.jsx("span",{"aria-label":n("ui.projects.project_model.stale"),title:n("ui.projects.project_model.stale"),className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(cc,{project:e})]})]})]})},cc=({project:e})=>{F();const[s,r]=d.useState(!1),a=Dt(),o=Ar(e.id,s),i=o.data?.links??[],l=mo(e),c=ne(e);return t.jsxs(_s,{open:s,onOpenChange:r,children:[t.jsx(js,{"data-project-sessions":e.id,"aria-label":n("ui.projects.project_board.sessions_linked_to_displayname",{displayName:String(c)}),onClick:u=>u.stopPropagation(),className:M("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(hs,{align:"end",className:"w-64 p-2 outline-none",onClick:u=>u.stopPropagation(),children:o.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.loading_linked_sessions")}):o.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:o.error instanceof Error&&o.error.message?o.error.message:n("ui.projects.project_board.the_linked_sessions_could_not_be_read")}),t.jsx(G,{variant:"secondary",size:"sm",onClick:()=>void o.refetch(),children:n("ui.projects.project_board.try_again")})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.no_sessions_linked_yet")}):t.jsx("ul",{className:"flex flex-col",children:i.map(u=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!u.exists,onClick:()=>{u.exists&&(r(!1),Rr(a,u.session_id))},className:M("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",u.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:u.title||u.session_id})})},u.session_id))})})]})},pn=({open:e,projectName:s,onClose:r,onConfirm:a})=>{F();const[o,i]=d.useState(""),[l,c]=d.useState(null),[u,m]=d.useState(!1),p=d.useId();d.useEffect(()=>{e&&(i(""),c(null),m(!1))},[e]);const _=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),c(null);try{await a(o.trim()),r()}catch(f){c(f instanceof Error&&f.message?f.message:n("ui.projects.project_delete_dialog.the_project_was_not_deleted"))}finally{m(!1)}};return t.jsx(dt,{open:e,onClose:r,title:n("ui.projects.project_delete_dialog.delete_this_project"),dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(He,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(zn,{onClick:()=>void b(),disabled:!_||u,children:[u&&t.jsx(Te,{size:"xs"}),n("ui.projects.project_delete_dialog.delete_project")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.projects.project_delete_dialog.this_deletes_the_project_and_its_milestones_the_sessions_linked_t")}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[n("ui.projects.project_delete_dialog.type")," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ",n("ui.projects.project_delete_dialog.to_confirm")]}),t.jsx(ue,{id:`${p}-confirm`,value:o,onChange:f=>i(f.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!_,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function lc(e){return e==="editing"||e==="saving"||e==="error"}function uc(e,s,r=Object.is){return!r(e,s)}function dc(e,s){if(e.key==="Escape")return e.defaultPrevented===!0?null:"revert";if(e.key!=="Enter"||!s.keyboardCommit)return null;const r=e.metaKey===!0||e.ctrlKey===!0;return s.multiline?r?"accept":null:s.onEditor?"accept":null}function pc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function mc(e){const{phase:s,base:r,draft:a,fresh:o,equals:i}=e;return s==="saving"||s==="saved"||i(r,o)?"none":s==="idle"||i(r,a)||i(o,a)?"adopt":"conflict"}function cr(e,s,r=Object.is){return!r(e,s)}const Cs="group/inline-edit",Yt="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",fc="relative before:absolute before:-inset-1.5 before:content-['']",_c="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",jc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",cs=({api:e,idle:s="affordance",className:r})=>{const{phase:a,labels:o}=e,i=a==="editing"||a==="saving"||a==="error",l=pc(a,e.dirty),c=e.acceptBlocked===!0;return t.jsx("span",{"data-inline-edit-slot":a,className:M("inline-flex shrink-0 items-center gap-0.5",r),children:l?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","data-inline-edit-control":"cancel","aria-label":a==="saving"?o.busy:o.cancel,title:a==="saving"?o.busy:o.cancel,"aria-disabled":a==="saving"||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||a!=="saving"&&e.cancel()},className:M(Yt,_c,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(Pt,{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(Te,{size:"xs"})}):t.jsx("button",{type:"button","data-inline-edit-control":"accept","aria-label":a==="error"?o.retry??o.accept:o.accept,title:a==="error"?o.retry??o.accept:o.accept,"aria-disabled":c||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||c||e.accept()},className:M(Yt,jc,c&&"cursor-default text-ink-disabled"),children:t.jsx(gs,{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":o.begin,title:o.begin,onClick:u=>{u.detail>1||e.begin()},className:M(Yt,fc,"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(Gn,{className:"size-3","aria-hidden":"true"})}):null})},ls=({api:e,className:s})=>{F();const{phase:r,error:a,conflict:o}=e;return r==="saved"?t.jsx("p",{"data-inline-edit-feedback":"saved",className:M("text-meta text-success",s),children:e.labels.saved}):!a&&!o?null:t.jsxs("div",{id:e.feedbackId,"data-inline-edit-feedback":a&&o?"error+conflict":a?"error":"conflict",role:"alert",className:M("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&&o===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:n("ui.common.actions.retry")}),o!==null&&t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-warning",children:n("ui.common.editing.conflict")}),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:n("ui.common.editing.keep_mine")}),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:n("ui.common.editing.use_theirs")})]})]})},mn=d.createContext(null),hc=50,gc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),hc)}}),[]);return t.jsxs(mn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},xc=1200;function bc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function jt(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=xc,labels:c}=e,u=d.useRef(e.equals??Object.is);u.current=e.equals??Object.is;const m=d.useRef(e.commit);m.current=e.commit;const p=d.useRef(e.validate);p.current=e.validate;const _=d.useRef(e.errorCopy);_.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const f=d.useRef(e.onBegin);f.current=e.onBegin;const x=d.useRef(c);x.current=c;const[w,g]=d.useState(i?"editing":"idle"),[h,v]=d.useState(s),[T,N]=d.useState(s),[q,C]=d.useState(null),[E,P]=d.useState(null),j=d.useRef(w),D=d.useRef(h),R=d.useRef(T),I=d.useRef(q),K=d.useRef(s);K.current=s;const B=d.useCallback(A=>{j.current=A,g(A)},[]),Y=d.useCallback(A=>{D.current=A,v(A)},[]),X=d.useCallback(A=>{R.current=A,N(A)},[]),Z=d.useCallback(A=>{I.current=A,C(A)},[]),me=d.useRef(null),oe=d.useRef(null),ee=d.useRef(null),te=e.editorRef??ee,y=d.useRef(te);y.current=te;const k=`${d.useId()}-inline-edit`,O=d.useContext(mn),L=d.useRef(null),U=L.current,Q=U!==null&&(e.equals??Object.is)(s,U.previous)&&!(e.equals??Object.is)(s,U.saved)&&U!==null?U.saved:s,$=d.useRef(Q);$.current=Q,d.useEffect(()=>{const A=L.current;if(A===null)return;const ce=u.current;(ce(s,A.saved)||!ce(s,A.previous))&&(L.current=null)},[s]);const je=d.useRef(i);d.useEffect(()=>{if(w!=="editing"||!je.current)return;je.current=!1;const A=y.current.current;A&&(A.focus(),o&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[w,o]);const ie=d.useRef(!1);d.useEffect(()=>{ie.current&&(w!=="idle"&&w!=="saved"||(ie.current=!1,oe.current?.focus()))});const z=d.useRef(null),se=d.useCallback(()=>{z.current!==null&&(clearTimeout(z.current),z.current=null)},[]);d.useEffect(()=>()=>se(),[se]);const xe=d.useRef(w);d.useEffect(()=>{const A=xe.current;if(xe.current=w,A==="saving"&&w==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&w==="idle"&&b.current?.("cancelled")},[w]),d.useEffect(()=>{const A=mc({phase:j.current,base:R.current,draft:D.current,fresh:$.current,equals:u.current});A==="adopt"?(u.current(R.current,$.current)||X($.current),u.current($.current,D.current)||Y($.current)):A==="conflict"&&(I.current===null||!u.current(I.current,$.current))&&Z($.current)},[s,w,X,Y,Z]);const fe=d.useCallback(A=>{Z(null),P(null),Y(R.current),B("idle"),A&&(ie.current=!0)},[Z,Y,B]),Pe=d.useCallback(()=>{j.current!=="saving"&&(j.current==="idle"||j.current==="saved"||(se(),fe(!0)))},[se,fe]),re=d.useCallback((A,ce=!0)=>{const nt=j.current;if(nt==="saving"||nt==="saved"||I.current!==null)return;const we=A!==void 0?A:D.current;if(!cr(R.current,we,u.current)){fe(ce&&nt!=="idle");return}const gt=p.current?.(we)??null;if(gt!==null){B("error"),P(gt);return}Y(we),P(null),B("saving"),m.current(we).then(()=>{j.current==="saving"&&(L.current={saved:we,previous:R.current},X(we),Y(we),ce&&(ie.current=!0),B("saved"),se(),z.current=setTimeout(()=>{z.current=null,j.current==="saved"&&B("idle")},l),O?.current?.(x.current.saved))},$e=>{j.current==="saving"&&(B("error"),P(_.current?_.current($e):bc($e)))})},[O,se,fe,l,X,Y,B]),Re=d.useCallback(()=>{j.current==="editing"||j.current==="saving"||(se(),je.current=!0,Y($.current),X($.current),Z(null),P(null),B("editing"),f.current?.())},[se,X,Z,Y,B]),Be=d.useCallback(()=>{const A=I.current;A!==null&&(Z(null),X(A),re())},[re,X,Z]),qt=d.useCallback(()=>{const A=I.current;A!==null&&(X(A),fe(!0))},[fe,X]),st=d.useCallback(A=>{const ce=dc(A,{multiline:r,keyboardCommit:a,onEditor:A.target===y.current.current});if(ce==="revert"){A.preventDefault(),Pe();return}ce==="accept"&&(A.preventDefault(),re())},[re,Pe,a,r]),rt=d.useCallback(A=>{if(j.current!=="editing")return;const ce=A.relatedTarget;if(!(ce!==null&&me.current?.contains(ce))&&!(ce instanceof Element&&ce.closest("[data-radix-popper-content-wrapper]")!==null)&&I.current===null){if(!cr(R.current,D.current,u.current)){fe(!1);return}re(void 0,!1)}},[re,fe]),ht=w==="saved"?h:Q;return{phase:w,dirty:uc(T,h,u.current),conflict:q,error:E,draft:h,setDraft:Y,displayValue:ht,editing:lc(w),begin:Re,accept:re,cancel:Pe,keepMine:Be,useTheirs:qt,handleKeyDown:st,handleBlur:rt,fieldProps:{onKeyDown:st,onBlur:rt,"aria-busy":w==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||q!==null?k:void 0},fieldRef:me,editorRef:te,slotRef:oe,feedbackId:k,labels:c}}const yc=/^(https?:|mailto:)/i,vc={a:({href:e,children:s})=>typeof e=="string"&&yc.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:Hn},ut=d.memo(({children:e,className:s})=>t.jsx("div",{className:M("lo-markdown",s),children:t.jsx(Yn,{remarkPlugins:[Kn],components:vc,children:e})})),lr=`## Summary
23
+
24
+ ## Goals
25
+
26
+ ## Notes`,kc=new RegExp("\\p{Mn}","gu"),wc=/[^a-z0-9._-]+/g,Nc=/[._-]{2,}/g,Sc=/^[^a-z0-9]+/,ur=/[^a-z0-9]+$/;function Cc(e){return e.normalize("NFKD").replace(kc,"").toLowerCase().replace(wc,"-").replace(Nc,"-").replace(Sc,"").replace(ur,"").slice(0,64).replace(ur,"")}const Ec=/&#x([0-9a-f]+);/gi,Tc=/&#(\d+);/g,Rc=/&nbsp;/g,Dc=/&lt;/g,Ac=/&gt;/g,Oc=/&quot;/g,Pc=/&#39;|&apos;/g,Mc=/&amp;/g,dr=e=>e.replace(Ec,(s,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(Tc,(s,r)=>String.fromCodePoint(Number.parseInt(r,10))).replace(Rc," ").replace(Dc,"<").replace(Ac,">").replace(Oc,'"').replace(Pc,"'").replace(Mc,"&"),Lc=/<[^>]*>|[^<]+/g,Ic=/^<\//,Fc=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,qc=/\s+/g,pr=/class="[^"]*language-([\w+-]+)/,Uc=/href="([^"]*)"/,Bc=/src="([^"]*)"/,$c=/alt="([^"]*)"/,zc=/[ \t]+\n/g,Gc=/\n{3,}/g;function Yc(e){const s=[],r=(...m)=>{for(let p=s.length-1;p>=0;p--)if(m.includes(s[p].tag)){const[_]=s.splice(p,1);return _}},a=[],o=()=>s.some(m=>m.tag==="pre"),i=()=>s.filter(m=>m.tag==="blockquote").length;let l=!0;const c=m=>{m&&(i()>0&&l&&!o()&&a.push("> ".repeat(i())),a.push(m),l=m.endsWith(`
27
+ `))},u=e.match(Lc)??[];for(let m=0;m<u.length;m++){const p=u[m];if(!p.startsWith("<")){c(o()?dr(p):dr(p).replace(qc," "));continue}const _=Ic.test(p),b=(p.match(Fc)?.[1]??"").toLowerCase();if(_){switch(b){case"p":case"div":c(`
28
+
29
+ `);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":r(b),c(`
30
+
31
+ `);break;case"li":{r("li"),c(`
32
+ `);const f=[...s].reverse().find(x=>x.tag==="ul"||x.tag==="ol");f?.ordered&&(f.index=(f.index??1)+1);break}case"ul":case"ol":r(b),c(`
33
+ `);break;case"strong":case"b":r("strong","b")&&c("**");break;case"em":case"i":r("em","i")&&c("*");break;case"del":case"s":r("del","s")&&c("~~");break;case"code":{r("code")?.inline&&c("`");break}case"pre":r("pre")&&c("\n```\n\n");break;case"a":{const f=r("a");f?.href&&c(`](${f.href})`);break}case"blockquote":r("blockquote")&&c(`
34
+ `);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}),c(`${"#".repeat(f)} `);break}case"ul":case"ol":s.push({tag:b,ordered:b==="ol",index:1});break;case"li":{const f=[...s].reverse().find(x=>x.tag==="ul"||x.tag==="ol");s.push({tag:"li"}),f?.ordered?c(`${f.index??1}. `):c("- ");break}case"strong":case"b":s.push({tag:b}),c("**");break;case"em":case"i":s.push({tag:b}),c("*");break;case"del":case"s":s.push({tag:b}),c("~~");break;case"code":{const f=s[s.length-1]?.tag!=="pre";s.push({tag:"code",inline:f}),f&&c("`");break}case"pre":{const f=p.match(pr)?.[1]??u[m+1]?.match(pr)?.[1]??"";s.push({tag:"pre"}),c(`
35
+ \`\`\`${f}
36
+ `);break}case"a":{const f=p.match(Uc)?.[1]??"";s.push({tag:"a",href:f}),f&&c("[");break}case"img":{const f=p.match(Bc)?.[1]??"",x=p.match($c)?.[1]??"";f&&c(`![${x}](${f})`);break}case"br":c(`
37
+ `);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(zc,`
38
+ `).replace(Gc,`
39
+
40
+ `).trim()}function fn(e,s,r){const a=e.clipboardData?.getData("text/html");if(!a)return;const o=Yc(a);if(!o)return;e.preventDefault();const i=e.currentTarget,l=i.selectionStart??i.value.length,c=i.selectionEnd??l;r(i.value.slice(0,l)+o+i.value.slice(c)),requestAnimationFrame(()=>{const u=s.current;if(!u)return;const m=l+o.length;u.setSelectionRange(m,m)})}const _n=({open:e,refusal:s,projectLabel:r,onClose:a,onConfirm:o,secondaryLabel:i,onSecondary:l})=>{F();const[c,u]=d.useState(!1),[m,p]=d.useState(null),_=d.useRef(!1),b=d.useRef(null);d.useEffect(()=>{e&&(u(!1),p(null),_.current=!1)},[e]);const f=async()=>{if(!_.current){_.current=!0,u(!0),p(null);try{await o(),a()}catch(w){p({copy:an(w),gone:nn(w)})}finally{_.current=!1,u(!1)}}},x=s?.names??[];return t.jsx(dt,{open:e,onClose:a,title:n("ui.projects.project_done_anyway_dialog.mark_done_with_open_milestones"),dataTourTag:"project-done-anyway-dialog",maxWidth:"xs",dialogProps:{closeDisabled:c,onEscapeKeyDown:w=>{c&&w.preventDefault()},onInteractOutside:w=>{c&&w.preventDefault()},onOpenAutoFocus:w=>{w.preventDefault(),b.current?.focus()}},actions:t.jsxs("div",{className:"flex w-full min-w-0 flex-wrap justify-end gap-2",children:[t.jsx(He,{ref:b,onClick:a,disabled:c,children:n("ui.projects.project_done_anyway_dialog.cancel")}),!m?.gone&&t.jsx(He,{onClick:l,disabled:c,children:i}),m?.gone?t.jsx(vt,{"data-project-force-close":"",onClick:a,children:n("ui.projects.project_done_anyway_dialog.close")}):t.jsxs(vt,{"data-project-force-done":"","aria-disabled":c,className:"aria-disabled:pointer-events-none aria-disabled:bg-sunken aria-disabled:text-ink-disabled",onClick:()=>void f(),children:[c?t.jsx(Te,{size:"xs"}):t.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0"}),n("ui.projects.project_done_anyway_dialog.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:r?n("ui.projects.project_done_anyway_dialog.projectlabel_moves_to_done_and_its_milestones_stay_open",{projectLabel:String(r)}):n("ui.projects.project_done_anyway_dialog.the_project_moves_to_done_and_its_milestones_stay_open")}),t.jsx("p",{className:"text-body-sm text-ink break-words",children:s?Go(s):""}),x.length>bt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(vr,{summary:n("ui.projects.project_done_anyway_dialog.show_all_length_open_milestones",{length:x.length}),children:t.jsx("ul",{"data-project-open-milestones":"",className:"flex flex-col gap-1 py-1 text-body-sm text-ink-muted",children:x.map((w,g)=>t.jsx("li",{className:"break-words",children:w},`${g}-${w}`))})})}),t.jsx("p",{role:"alert",className:"min-h-[1lh] text-body-sm text-danger break-words",children:m?.copy??""})]})})},jn=({status:e})=>{const s=ae(e);return t.jsxs(ke,{variant:s.variant,children:[no(e)&&t.jsx(gs,{"aria-hidden":!0}),s.label]})},Hc="project-key",Kc="project-key";function ge(e,s){return{name:s,begin:n("ui.projects.project_editors.edit_field",{field:String(e)}),accept:n("ui.projects.project_editors.save_field",{field:String(e)}),cancel:n("ui.projects.project_editors.discard_the_field_edit",{field:String(e)}),busy:n("ui.projects.project_editors.saving_the_field",{field:String(e)}),saved:n("ui.projects.project_editors.display_saved",{display:String(s)}),retry:n("ui.projects.project_editors.retry_saving_the_field",{field:String(e)})}}const Ft=({field:e,fieldRef:s,fieldProps:r,editing:a,label:o,bare:i=!1,display:l,editor:c,slot:u,feedback:m,controlsIdle:p="affordance",hug:_=!1,feedbackExtra:b,className:f,controlsClassName:x})=>t.jsxs("div",{ref:s,...r,"data-project-field":e,className:M(!i&&Cs,"min-w-0",o!==void 0&&"flex items-start gap-3",f),children:[o!==void 0&&t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:o}),t.jsxs("div",{className:M("flex min-w-0 flex-col gap-1",_&&"items-start",o!==void 0&&"flex-1"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("div",{className:M("min-w-0",_?"w-fit":"flex-1",!a&&"cursor-text"),onDoubleClick:a?void 0:u.begin,children:a?c:l}),t.jsx(cs,{api:u,idle:p,className:M("shrink-0",x)})]}),t.jsx("div",{className:M("min-h-[1lh] text-meta",_&&"max-w-96"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx(ls,{api:m}),b]})})]})]}),Ie=({field:e,value:s,display:r,commitFields:a,validate:o,labels:i,commit:l,placeholder:c,mono:u=!1,ramp:m="text-body-sm",label:p,bare:_=!1,autoBegin:b=!1,maxLength:f,onRetire:x,className:w,controlsClassName:g})=>{const[h,v]=d.useState(b);d.useEffect(()=>{h&&s!==""&&(v(!1),x?.("filled"))},[h,s,x]);const T=jt({value:s,commit:async N=>{await l(a(N))},equals:(N,q)=>N.trim()===q.trim(),validate:o,labels:i,selectAllOnBegin:!0,beginOnMount:b,errorCopy:tt,onSettle:N=>{N==="cancelled"&&(v(!1),x?.("cancelled"))}});return!h&&s===""?null:t.jsx(Ft,{field:e,fieldRef:T.fieldRef,fieldProps:T.fieldProps,editing:T.editing,label:p,bare:_,display:r,slot:T,feedback:T,className:w,controlsClassName:g,editor:t.jsx(ue,{ref:T.editorRef,...T.editorAria,value:T.draft,readOnly:T.phase==="saving",maxLength:f,placeholder:c,"aria-label":i.name,onChange:N=>T.setDraft(N.target.value),spellCheck:!1,autoComplete:"off",className:M("h-8",u?"font-mono text-mono-sm":m)})})},Wc=({project:e,commit:s})=>{F();const r=e.title??"",[a,o]=d.useState(!1),i=d.useRef(null),l=c=>{o(!1),c==="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:M(Cs,"flex min-w-0 flex-col gap-0.5"),children:[r?t.jsx(Ie,{field:"title",value:r,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:r}),commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:ge("title",n("ui.projects.project_editors.title")),commit:s,maxLength:wt,placeholder:n("ui.projects.project_editors.a_short_name_for_the_workstream"),ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(Ie,{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:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:ge("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Hc,ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!r&&(a?t.jsx(Ie,{field:"title",value:"",display:null,commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:ge("title",n("ui.projects.project_editors.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:()=>o(!0),className:M("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:n("ui.projects.project_editors.add_a_title")}))]}),r&&t.jsx(Ie,{field:"key",value:e.name,display:t.jsx("span",{className:"font-mono text-mono-sm text-ink-muted",children:e.name}),commitFields:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:ge("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Kc,mono:!0})]})},Vc=({project:e,commit:s})=>{F();const[r,a]=d.useState(!1),o=Ze(),i=ye(o.data,"projects_force_done"),[l,c]=d.useState(null),[u,m]=d.useState(null),p=d.useRef(!1),_=d.useRef(!1),b=d.useRef(null),f=jt({value:e.status,commit:async g=>{const h=p.current;p.current=!1,c(null);try{const v=await s({status:g},h?{forceDone:!0}:void 0);h&&be(Vr(v,l?.count??0,ae(g).label)),b.current?.resolve()}catch(v){throw c(on(v)),b.current?.reject(v),v}finally{b.current=null}},labels:ge("status",n("ui.projects.project_editors.status")),keyboardCommit:!1,errorCopy:tt,onBegin:()=>a(!0)}),x=i&&f.phase==="error"&&l!==null&&l.coded;d.useEffect(()=>{if(!_.current||f.phase!=="idle"&&f.phase!=="saved")return;_.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 w=()=>new Promise((g,h)=>{if(f.phase!=="error"||f.conflict!==null){h(new Error(""));return}if(!f.dirty){g();return}p.current=!0,b.current={resolve:g,reject:h},f.accept(f.draft,!0)});return t.jsx(Ft,{field:"status",fieldRef:f.fieldRef,fieldProps:f.fieldProps,editing:f.editing,display:t.jsx(jn,{status:e.status}),slot:f,feedback:f,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[x&&t.jsx(G,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>m(l),children:n("ui.projects.project_editors.mark_done_anyway")}),t.jsx(_n,{open:u!==null,refusal:u,projectLabel:ne(e),onClose:()=>m(null),onConfirm:w,secondaryLabel:n("ui.projects.project_editors.review_milestones"),onSecondary:()=>{m(null),_.current=!0,f.cancel()}})]}),editor:t.jsxs(Ke,{open:r,onOpenChange:a,value:f.draft,onValueChange:g=>{a(!1),f.accept(g)},children:[t.jsx(We,{ref:f.editorRef,...f.editorAria,"aria-label":n("ui.projects.project_editors.status"),"data-project-status":"",className:"h-7 w-fit min-w-36",children:t.jsx(Ve,{})}),t.jsx(Qe,{children:Lr.map(g=>t.jsx(Ae,{value:g.value,"data-project-status-option":g.value,children:g.label},g.value))})]})})},Qc=({project:e,commit:s})=>{F();const[r,a]=d.useState(!1),o=d.useRef(null),i=d.useRef(null),l=jt({value:e.description,commit:async m=>{await s({description:m.trim()})},equals:(m,p)=>m.trim()===p.trim(),validate:m=>sn(m),multiline:!0,labels:ge("description",n("ui.projects.project_editors.description")),errorCopy:tt,editorRef:o,onSettle:m=>{m==="cancelled"&&!e.description.trim()&&setTimeout(()=>i.current?.focus(),0)}});d.useEffect(()=>{if(r||!l.editing)return;const m=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(m)},[r,l.editing]);const u=(l.editing?l.draft:l.displayValue).length>Xe;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:M(Cs,"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:n("ui.projects.project_editors.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":r===(m==="preview"),onClick:()=>a(m==="preview"),className:M("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink",r===(m==="preview")&&"bg-surface text-ink"),children:m==="write"?n("ui.projects.project_editors.write"):n("ui.projects.project_editors.preview")},m))})]}),t.jsx(cs,{api:{...l,acceptBlocked:u}})]}),r?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(ut,{className:"text-body-sm",children:l.draft}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_editors.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:o,...l.editorAria,"data-project-description":"",value:l.draft,readOnly:l.phase==="saving",rows:8,placeholder:n("ui.projects.project_editors.markdown_headings_lists_code"),"aria-label":l.labels.name,onChange:m=>l.setDraft(m.target.value),onPaste:m=>fn(m,o,p=>l.setDraft(p)),className:"h-40 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ls,{api:l}),t.jsxs("p",{className:M("shrink-0 text-meta tabular-nums",u?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",Xe]})]})]}):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(ut,{className:"text-body",children:e.description??""})}),t.jsx(cs,{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:n("ui.projects.project_editors.add_description")}),t.jsx("div",{className:"min-h-[1lh] text-meta",children:t.jsx(ls,{api:l})})]})})},Xc=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>(F(),t.jsx(Ie,{field:"owner",value:e.owner??"",label:n("ui.projects.project_editors.owner"),display:t.jsx("span",{className:"text-body-sm text-ink",children:e.owner}),commitFields:o=>({owner:o.trim()}),validate:o=>St(o,"owner"),labels:ge("owner",n("ui.projects.project_editors.owner")),commit:s,maxLength:Nt,placeholder:n("ui.projects.examples.owner"),autoBegin:r,onRetire:a})),Jc=({project:e,commit:s,label:r=null,autoBegin:a=!1,onRetire:o})=>(F(),t.jsx(Ie,{field:"team",value:e.team??"",label:n("ui.projects.project_editors.team"),display:t.jsx("span",{className:"text-body-sm text-ink",children:r??e.team}),commitFields:i=>({team:i.trim()}),validate:i=>St(i,"team"),labels:ge("team",n("ui.projects.project_editors.team")),commit:s,maxLength:Nt,placeholder:n("ui.projects.examples.team"),autoBegin:a,onRetire:o})),mr=({project:e,commit:s,which:r,nowMs:a,autoBegin:o=!1,onRetire:i})=>{const l=r==="start"?e.start_date??"":e.target_date??"",c=F(),u=Oe(l,c,new Date(a)),m=r==="start"?n("ui.projects.project_editors.start"):n("ui.projects.project_editors.target");return t.jsx(Ie,{field:r==="start"?"start-date":"target-date",value:l,label:m,display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),commitFields:p=>r==="start"?{start_date:p}:{target_date:p},validate:p=>{const _=ss(p);return _||(r==="start"?rs(p,e.target_date??""):rs(e.start_date??"",p))},labels:ge(n("ui.projects.project_editors.tolowercase_date",{toLowerCase:String(m.toLowerCase())}),m),commit:s,placeholder:"YYYY-MM-DD",autoBegin:o,onRetire:i})},Zc=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{F();const o={estimate:e.estimate,unit:e.estimate_unit==="days"?"days":"points"},[i,l]=d.useState(r);d.useEffect(()=>{i&&e.estimate!==null&&(l(!1),a?.("filled"))},[i,e.estimate,a]);const c=jt({value:{number:e.estimate===null?"":String(e.estimate),unit:o.unit},equals:Ui,commit:async m=>{const p=$i(o,m);p&&await s(p)},validate:m=>rn(m.number),labels:ge("estimate",n("ui.projects.project_editors.estimate")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:tt,onSettle:m=>{m==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const u=qr(e.estimate,e.estimate_unit)||"—";return t.jsx(Ft,{field:"estimate",fieldRef:c.fieldRef,fieldProps:c.fieldProps,editing:c.editing,label:n("ui.projects.project_editors.estimate"),display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),slot:c,feedback:c,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ue,{ref:c.editorRef,...c.editorAria,"data-project-estimate":"",value:c.draft.number,readOnly:c.phase==="saving",placeholder:"13",inputMode:"decimal","aria-label":c.labels.name,onChange:m=>c.setDraft({...c.draft,number:m.target.value}),className:"h-8 max-w-24"}),t.jsxs(Ke,{value:c.draft.unit,onValueChange:m=>c.setDraft({...c.draft,unit:m}),children:[t.jsx(We,{"data-project-estimate-unit":"","aria-label":n("ui.projects.project_editors.estimate_unit"),"aria-invalid":c.editorAria["aria-invalid"],className:"h-8 w-fit min-w-28",children:t.jsx(Ve,{})}),t.jsxs(Qe,{children:[t.jsx(Ae,{value:"points",children:n("ui.projects.project_editors.points")}),t.jsx(Ae,{value:"days",children:n("ui.projects.project_editors.days")})]})]})]}),c.draft.number.trim()===""&&o.estimate!==null&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_editors.clearing_an_estimate_is_not_supported_yet_saving_keeps_its_curren")})]})})},el=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{F();const[o,i]=d.useState(r);d.useEffect(()=>{o&&e.tags.length>0&&(i(!1),a?.("filled"))},[o,e.tags,a]);const l=jt({value:e.tags.join(", "),equals:(u,m)=>Bi(lt(u),m),commit:async u=>{const{tags:m}=ns(u);await s({tags:m})},validate:u=>ns(u).error,labels:ge("tags",n("ui.projects.project_editors.tags")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:tt,onSettle:u=>{u==="cancelled"&&(i(!1),a?.("cancelled"))}});if(!o&&e.tags.length===0)return null;const c=l.editing?lt(l.draft):e.tags;return t.jsx(Ft,{field:"tags",fieldRef:l.fieldRef,fieldProps:l.fieldProps,editing:l.editing,label:n("ui.projects.project_editors.tags"),display:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(u=>t.jsx(ke,{variant:"outline",children:u},u))}),slot:l,feedback:l,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(ue,{ref:l.editorRef,...l.editorAria,"data-project-tags":"",value:l.draft,readOnly:l.phase==="saving",placeholder:n("ui.projects.project_editors.q4_payments"),"aria-label":l.labels.name,onChange:u=>l.setDraft(u.target.value),className:"h-8 max-w-72"}),t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:c.map(u=>t.jsx(ke,{variant:"outline",children:u},u))})]})})},tl="project-quick-send:no-target",sl=[],rl=({links:e,target:s,onTargetChange:r,onSend:a,focusTick:o})=>{F();const i=d.useRef(null),l=Wn(),{frontend:c,refresh:u}=qa(),[m,p]=d.useState(!1),_=Ze(),b=s??tl;d.useEffect(()=>{s&&u(s)},[s,u]),d.useEffect(()=>{o>0&&i.current?.focusInput()},[o]);const f=e.filter(g=>g.exists),w=(f.find(g=>g.session_id===s)??null)?.runtime?.busy===!0;return t.jsxs("div",{"data-tour-tag":"project-quick-send","data-glass-block":"",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:n("ui.projects.project_quick_send.send_to")}),t.jsxs(Ke,{value:s??void 0,onValueChange:g=>r(g),children:[t.jsx(We,{"aria-label":n("ui.projects.project_quick_send.select_the_session_to_message"),className:"max-w-72",children:t.jsx(Ve,{placeholder:n("ui.projects.project_quick_send.no_session_selected")})}),t.jsx(Qe,{children:f.map(g=>t.jsx(Ae,{value:g.session_id,children:It(g)},g.session_id))})]}),m?t.jsx("span",{role:"status",className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.sending")}):w?t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.the_session_is_working_this_message_steers_the_running_turn")}):null]}),t.jsx(Vn,{ref:i,conversationId:b,messages:sl,isLoading:!1,ownGutter:!0,transcriptless:!0,autoFocus:!1,placeholderOverride:n("ui.projects.project_quick_send.message_the_session_paste_an_image_to_attach_it"),cwd:c?.cwd,cwdReadOnlyReason:n("ui.projects.project_quick_send.quick_send_follows_the_conversation_s_directory"),sessionStatus:c&&s?{frontend:c,costChannels:ye(_.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:n("ui.projects.project_quick_send.choose_a_session_to_send_to")}),blocksInput:!0,get placeholder(){return n("ui.projects.project_quick_send.choose_a_session_to_send_to")}},onSendMessage:async(g,h)=>{if(!s)return!1;p(!0);try{return await a(s,g,w?"steer":"prompt",h)}finally{p(!1),i.current?.focusInput({preventScroll:!0})}}})]})},nl=({links:e,busy:s,onUnlink:r,onLink:a,onQuickSend:o,onStartSession:i})=>{F();const l=Dt(),c=kt(h=>h.sessions),[u,m]=d.useState(!1),[p,_]=d.useState(null),[b,f]=d.useState(0),x=p&&e.some(h=>h.session_id===p&&h.exists)?p:Io(e),w=d.useMemo(()=>{const h=new Set(e.map(v=>v.session_id));return c.filter(v=>!h.has(v.session_id)).map(v=>({id:v.session_id,name:v.title||v.session_id,description:v.cwd??void 0}))},[c,e]),g=h=>{kt.getState().openSession(h).then(v=>{v&&l(`/chat/${h}`)})};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:n("ui.projects.project_links.linked_sessions")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(G,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Aa,{}),n("ui.projects.project_links.new_session")]}),t.jsxs(G,{variant:"secondary",size:"sm",disabled:s,onClick:()=>m(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Oa,{}),n("ui.projects.project_links.link_session")]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_links.no_sessions_linked_yet_link_the_conversations_that_are_working_on")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(h=>{const v=fo(h),T=_o(h.subagents),N=jo(h.todos),q=h.title||h.session_id,C=h.exists;return t.jsxs("li",{"data-glass-block-row":"",className:M("flex items-center gap-2 rounded-sm px-2 py-2",C&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!C,onClick:()=>{C&&g(h.session_id)},className:M("flex min-w-0 flex-1 items-center gap-2 text-left",C?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{"data-glass-block-row-label":"",className:M("min-w-0 truncate text-body-sm",h.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:q})}),h.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_links.busy")}),T&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:T}),N&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:N}),t.jsx(ke,{variant:v.variant,children:v.label}),C&&t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.message_title",{title:String(q)}),title:n("ui.projects.project_links.message_title",{title:String(q)}),onClick:()=>{_(h.session_id),f(E=>E+1)},children:t.jsx(Pa,{})}),t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.unlink_title",{title:String(q)}),onClick:()=>r(h.session_id),children:t.jsx(Qa,{})})]},h.session_id)})}),e.some(h=>h.exists)&&t.jsx(rl,{links:e,target:x,onTargetChange:_,onSend:o,focusTick:b}),t.jsx(dt,{open:u,onClose:()=>m(!1),title:n("ui.projects.project_links.link_a_session"),maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(He,{onClick:()=>m(!1),children:n("ui.projects.project_links.close")}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(pe,{children:n("ui.projects.project_links.session")}),t.jsx(Cr,{showLabel:!1,ariaLabel:n("ui.projects.project_links.search_sessions"),busyLabel:n("ui.projects.project_links.loading_sessions"),placeholder:n("ui.projects.project_links.search_conversations"),options:w,selected:null,onSelect:h=>{m(!1),a(h.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_links.conversations_already_linked_to_this_project_are_not_listed")})]})})]})},al=({milestones:e,summary:s,busy:r,onToggle:a,onRemove:o,onAdd:i})=>{const[l,c]=d.useState(""),[u,m]=d.useState(""),p=F(),_=!Ir.test(u.trim()),b=l.trim().length>0&&!_&&!r,f=()=>{b&&(i(l.trim(),u.trim()),c(""),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:n("ui.projects.project_milestones.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:n("ui.projects.project_milestones.no_milestones_yet_add_one_below_to_mark_the_dates_this_project_is")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(x=>{const w=oo(x.status),g=x.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Er,{checked:g,disabled:r,onCheckedChange:h=>a(x.name,h===!0),"aria-label":g?n("ui.projects.project_milestones.mark_name_not_complete",{name:String(x.name)}):n("ui.projects.project_milestones.mark_name_complete",{name:String(x.name)})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:x.name}),x.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:Oe(x.target_date,p)}),t.jsx(ke,{variant:w.variant,children:w.label}),t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:r,"aria-label":n("ui.projects.project_milestones.remove_name",{name:String(x.name)}),onClick:()=>o(x.name),children:t.jsx(Pt,{})})]},x.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(pe,{htmlFor:"project-milestone-name",children:n("ui.projects.project_milestones.new_milestone")}),t.jsx(ue,{id:"project-milestone-name",value:l,onChange:x=>c(x.target.value),placeholder:n("ui.projects.project_milestones.beta_cut"),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),f())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"project-milestone-date",children:n("ui.projects.project_milestones.target_date")}),t.jsx(ue,{id:"project-milestone-date",value:u,onChange:x=>m(x.target.value),placeholder:"YYYY-MM-DD","aria-invalid":_}),_&&t.jsx("p",{className:"text-meta text-danger",children:n("ui.projects.project_milestones.dates_are_yyyy_mm_dd_or_empty")})]}),t.jsxs(G,{variant:"secondary",disabled:!b,onClick:f,"data-tour-tag":"project-milestone-add",children:[t.jsx(it,{}),n("ui.projects.project_milestones.add")]})]})]})},ol=[{field:"owner",get label(){return n("ui.projects.project_properties.owner")}},{field:"team",get label(){return n("ui.projects.project_properties.team")}},{field:"start",get label(){return n("ui.projects.project_properties.start_date")}},{field:"target",get label(){return n("ui.projects.project_properties.target_date")}},{field:"estimate",get label(){return n("ui.projects.project_properties.estimate")}},{field:"tags",get label(){return n("ui.projects.project_properties.tags")}}],fr=({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})]}),il=({project:e,nowMs:s,commit:r,teamLabel:a=null})=>{const o=F(),i=new Date(s),[l,c]=d.useState(null),u=d.useRef(null),m=d.useRef(!1),p={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},_=(E,P)=>{c(j=>j===E?null:j),P==="cancelled"&&!p[E]&&setTimeout(()=>u.current?.focus(),0)},b=ol.filter(({field:E})=>!p[E]&&l!==E),f=Oe(e.completed_at,o,i),x=e.updated_at>0?mt(pt(e.updated_at,s)):"",w=e.updated_at>0?Qn(new Date(e.updated_at*1e3),{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},o):"",g=p.owner||l==="owner",h=p.team||l==="team",v=p.start||l==="start",T=p.target||l==="target",N=p.estimate||l==="estimate",q=p.tags||l==="tags",C=g||h||v||T||!!f||N||q||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:n("ui.projects.project_properties.properties")}),b.length>0&&t.jsxs(ps,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs("button",{ref:u,type:"button","data-project-add-field":"",className:M("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(it,{className:"size-3","aria-hidden":"true"}),n("ui.projects.project_properties.add")]})}),t.jsx(fs,{align:"end",onCloseAutoFocus:E=>{m.current&&(m.current=!1,E.preventDefault())},children:b.map(({field:E,label:P})=>t.jsx(Ee,{"data-project-add-option":E,onSelect:()=>{m.current=!0,c(E)},children:P},E))})]})]}),C?t.jsxs("dl",{className:"flex flex-col gap-2",children:[g&&t.jsx(Xc,{project:e,commit:r,autoBegin:l==="owner",onRetire:E=>_("owner",E)}),h&&t.jsx(Jc,{project:e,commit:r,label:a,autoBegin:l==="team",onRetire:E=>_("team",E)}),v&&t.jsx(mr,{project:e,commit:r,which:"start",nowMs:s,autoBegin:l==="start",onRetire:E=>_("start",E)}),T&&t.jsx(mr,{project:e,commit:r,which:"target",nowMs:s,autoBegin:l==="target",onRetire:E=>_("target",E)}),f&&t.jsx(fr,{label:n("ui.projects.project_properties.completed"),children:f}),N&&t.jsx(Zc,{project:e,commit:r,autoBegin:l==="estimate",onRetire:E=>_("estimate",E)}),q&&t.jsx(el,{project:e,commit:r,autoBegin:l==="tags",onRetire:E=>_("tags",E)}),e.updated_at>0&&t.jsx(fr,{label:n("ui.projects.project_properties.updated"),children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:w,children:x})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_properties.no_dates_estimate_tags_owner_or_team_yet")})]})},cl=({project:e})=>{F();const s=Ze(),r=dn(),{sending:a,cooling:o,cooldownRemainingMs:i}=rc(e.id);if(!ye(s.data,"projects_request_update"))return null;const l=ne(e),c=Wi(e.id);return t.jsxs(t.Fragment,{children:[t.jsx(Ot,{content:o&&i!==null?Ct(l,i):n("ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"),children:t.jsxs(G,{variant:"secondary",className:"min-w-37","data-tour-tag":"project-request-update","aria-busy":a?!0:void 0,"aria-disabled":o?!0:void 0,"aria-describedby":o?c:void 0,onClick:()=>r(e),children:[a?t.jsx(Te,{size:"sm"}):o?t.jsx(gs,{}):t.jsx(Wa,{}),a?n("ui.projects.project_request_update_button.requesting"):o?n("ui.projects.project_request_update_button.requested"):n("ui.projects.project_request_update_button.request_update")]})}),o&&i!==null&&t.jsx("span",{id:c,className:"sr-only",children:Ct(l,i)})]})},hn="plain",gn=e=>`team:${e}`,xn=e=>`agent:${e}`;function ll(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function ul(e){return e.kind==="team"?gn(e.name):e.kind==="agent"?xn(e.name):hn}const _r={kind:"plain"},dl=({open:e,onClose:s,onStart:r,teamsEnabled:a,profilesEnabled:o})=>{F();const[i,l]=d.useState(_r),[c,u]=d.useState(null),[m,p]=d.useState(!1),_=Xn(e&&a),b=Jn(e&&o);d.useEffect(()=>{e&&(l(_r),u(null),p(!1))},[e]);const f=d.useMemo(()=>{const v=[{id:hn,get name(){return n("ui.projects.project_start_session.nothing_in_particular")},get description(){return n("ui.projects.project_start_session.a_plain_session_assign_a_team_or_agent_later")},get group(){return n("ui.projects.project_start_session.plain")}}];for(const T of _.data??[])v.push({id:gn(T.name),name:Is(T),keywords:T.name===Is(T)?void 0:[T.name],description:n("ui.projects.project_start_session.team_manager_manager",{manager:String(T.manager)}),get group(){return n("ui.projects.project_start_session.teams")}});for(const T of(b.data??[]).filter(N=>N.source!=="builtin"))v.push({id:xn(T.name),name:T.name,description:T.description||T.kind,get group(){return n("ui.projects.project_start_session.agents")}});return v},[_.data,b.data]),x=f.find(v=>v.id===ul(i))??f[0],w=!a||!o,g=_.isLoading||b.isLoading,h=async()=>{p(!0),u(null);try{await r(i),s()}catch(v){u(v instanceof Error&&v.message?v.message:n("ui.projects.project_start_session.the_session_could_not_be_started"))}finally{p(!1)}};return t.jsx(dt,{open:e,onClose:s,title:n("ui.projects.project_start_session.start_a_session"),maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(He,{onClick:s,disabled:m,children:n("ui.projects.project_start_session.cancel")}),t.jsxs(vt,{onClick:()=>void h(),disabled:m,children:[m&&t.jsx(Te,{size:"xs"}),n("ui.projects.project_start_session.start_session")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Cr,{label:n("ui.projects.project_start_session.work_with"),placeholder:n("ui.projects.project_start_session.search_teams_and_agents"),options:f,selected:x,onSelect:v=>l(ll(v.id)),busy:g,busyLabel:n("ui.projects.project_start_session.loading_teams_and_agents")}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.the_session_starts_now_links_itself_to_this_project_and_opens_wit")}),w&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.this_server_does_not_offer_the_team_or_agent_catalogues_yet_so_on")}),c&&t.jsx("p",{className:"text-body-sm text-danger",children:c})]})})},pl=({links:e})=>{F();const s=Lo(e),r=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:n("ui.projects.project_todos.to_dos")}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:Ys(s)})]}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_todos.no_to_do_snapshots_from_the_linked_sessions_yet_a_session_publish")}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:r.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:It(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:Ys(a.todos)})]},a.session_id))})]})},ml=({filePath:e,tooltip:s="File actions",icon:r,"aria-label":a="File actions",onShowInCanvas:o})=>{const i=async()=>{if(e)try{await navigator.clipboard.writeText(e),be("File path copied to clipboard")}catch(c){console.error("Failed to copy file path: ",c),de("Failed to copy file path")}},l=()=>{e&&window.api.openFile(e)};return t.jsxs(ps,{children:[t.jsx(Ot,{content:s,children:t.jsx(ms,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"icon-sm","aria-label":a,onClick:c=>c.stopPropagation(),children:r??t.jsx(yr,{"aria-hidden":"true"})})})}),t.jsxs(fs,{align:"end",className:"min-w-45",onClick:c=>c.stopPropagation(),children:[o&&t.jsxs(Ee,{onSelect:o,children:[t.jsx(Zn,{"aria-hidden":"true"}),t.jsx("span",{children:"Show in canvas"})]}),t.jsxs(Ee,{onSelect:l,children:[t.jsx(kr,{"aria-hidden":"true"}),t.jsx("span",{children:"Open file"})]}),t.jsxs(Ee,{onSelect:()=>window.api.showItemInFolder(e),children:[t.jsx(ea,{"aria-hidden":"true"}),t.jsx("span",{children:"Open folder"})]}),t.jsxs(Ee,{onSelect:i,children:[t.jsx(ta,{"aria-hidden":"true"}),t.jsx("span",{children:"Copy file path"})]})]})]})},fl=/[/\\]/;function bn(e){if(e.name)return e.name;const s=e.path.split(fl);return s[s.length-1]||n("ui.projects.project_updates.attachment")}const _l=({attachment:e})=>{F();const s=bn(e),r=Po(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:n("ui.projects.project_updates.open_name",{name:String(s)}),children:[t.jsx(kr,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),r&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:r}),t.jsx(ml,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(s)})})]})},jl=({attachment:e})=>{F();const s=bn(e),r=sa(e.path,{mimeType:ra(e.name||e.path),sizeBytes:e.bytes});return r.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(na,{file:e.path,src:r.url,label:s,conversationId:""})}):r.status==="loading"?t.jsx(aa,{children:t.jsxs("span",{className:"sr-only",children:[n("ui.projects.project_updates.loading"),s]})}):t.jsx(oa,{name:s})},hl=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(jl,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(_l,{attachment:s},`${s.path}:${s.added_at}`))}),gl=({update:e,nowMs:s})=>{const r=F(),a=Ao(e,r,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((o,i)=>t.jsxs(d.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:o.text})]},o.key))}),e.text&&t.jsx(ut,{children:e.text}),e.attachments.length>0&&t.jsx(hl,{attachments:e.attachments})]})},xl=({updates:e,nowMs:s})=>{const r=F(),a=Co(e.length),o=Oo(e,r,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:n("ui.projects.project_updates.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:n("ui.projects.project_updates.no_updates_yet_progress_reported_by_you_or_by_the_sessions_workin")}):t.jsx("div",{className:"flex flex-col gap-4",children:o.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,c)=>t.jsx(gl,{update:l,nowMs:s},`${l.at}:${l.by}:${c}`))})]},i.key||"ungrouped"))})]})},bl="project_not_found",yl=({projectKey:e,nowMs:s})=>{F();const r=Dt(),a=Ze(),o=wr(ye(a.data,"team_catalogue")),i=Ar(e,!0),l=Or(),c=Pr(),u=so(),m=ro(),p=eo(),_=to(),[b,f]=d.useState(!1),[x,w]=d.useState(!1),g=l.isPending||c.isPending||u.isPending||m.isPending||p.isPending||_.isPending;if(i.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Te,{label:n("ui.projects.project_detail.loading_project")})});if(i.isError||!i.data){const j=i.error instanceof Rt&&(i.error.code===bl||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(Kt,{variant:"danger",className:"w-full",children:j?n("ui.projects.project_detail.this_project_could_not_be_found_it_may_have_been_deleted"):i.error instanceof Error&&i.error.message?i.error.message:n("ui.projects.project_detail.the_project_could_not_be_read")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{variant:"secondary",onClick:()=>void i.refetch(),children:n("ui.projects.project_detail.try_again")}),t.jsxs(G,{variant:"secondary",onClick:()=>void r("/projects"),children:[t.jsx(qs,{}),n("ui.projects.project_detail.all_projects")]})]})]})}const{project:h,links:v}=i.data,T=ne(h),N=(j,D)=>l.mutateAsync({key:h.id,fields:j,...D?.forceDone===!0?{forceDone:!0}:{}}),q=h.team?o(h.team):null,C=Mo(h.milestones.filter(j=>j.completed_at!==null).length,h.milestones.length),E=async(j,D,R,I)=>{const K=kt.getState(),B=ca(null,j,K.drafts);if(!B)return!1;try{const{images:Y,unreadable:X,overflow:Z}=await la(I,D),me=ua(X);if(me)return de(me),!1;const oe=da(Z);if(oe)return de(oe),!1;const ee=pa(D,Y);if(ee)return de(ee),!1;if(await ma(B,{text:D,attachments:I,images:Y,mode:R,cwd:K.cwd},j)===null)return de(n("ui.projects.project_detail.that_session_already_has_a_message_going_out_try_again_in_a_momen")),!1;const y=v.find(k=>k.session_id===j);return be(n("ui.projects.project_detail.sent_to_value1",{value1:String(y?It(y):j)})),!0}catch(Y){return de(Y instanceof Error&&Y.message?Y.message:n("ui.projects.project_detail.the_message_was_not_sent")),!1}},P=async j=>{const D=kt.getState(),R=j.kind==="plain"?void 0:{kind:j.kind,name:j.name},I=await D.createSession(D.cwd||"~",R);if(!I)throw new Error(D.error??n("ui.projects.project_detail.the_session_could_not_be_started"));fa.getState().setCurrentInput(I,Fo(h));let K=null;try{await p.mutateAsync({key:h.id,sessionId:I})}catch(B){K=B instanceof Error&&B.message?B.message:n("ui.projects.project_detail.the_link_was_refused")}if(K)de(n("ui.projects.project_detail.session_started_but_linking_it_failed_linkfailure",{linkFailure:String(K)}));else{const B=R?n("ui.projects.project_detail.with_value1",{value1:String(qo(R))}):"";be(n("ui.projects.project_detail.session_started_withtarget_and_linked_to_displayname",{withTarget:String(B),displayName:String(T)}))}await Rr(r,I)};return t.jsx(gc,{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 r("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(qs,{className:"size-4"}),n("ui.projects.project_detail.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(Wc,{project:h,commit:N}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(Vc,{project:h,commit:N}),h.progress_stale&&t.jsx(ke,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(cl,{project:h}),t.jsxs(G,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-delete",children:[t.jsx(ia,{}),n("ui.projects.project_detail.delete")]})]})]})]}),t.jsx(Qc,{project:h,commit:N}),t.jsx(il,{project:h,nowMs:s,commit:N,teamLabel:q}),h.updates.length===0&&h.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:n("ui.projects.project_detail.progress")}),t.jsx(ut,{className:"text-body",children:h.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:lo(h,s)})]}),t.jsx(al,{milestones:h.milestones,summary:C,busy:g,onToggle:(j,D)=>{u.mutateAsync({key:h.id,name:j,completed:D}).catch(R=>{de(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_updated"))})},onRemove:j=>{m.mutateAsync({key:h.id,name:j}).catch(D=>{de(D instanceof Error&&D.message?D.message:n("ui.projects.project_detail.the_milestone_was_not_removed"))})},onAdd:(j,D)=>{u.mutateAsync({key:h.id,name:j,targetDate:D}).catch(R=>{de(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_added"))})}}),t.jsx(nl,{projectKey:h.id,links:v,busy:g,onStartSession:()=>w(!0),onQuickSend:E,onLink:j=>{p.mutateAsync({key:h.id,sessionId:j}).catch(D=>{de(D instanceof Error&&D.message?D.message:n("ui.projects.project_detail.the_session_was_not_linked"))})},onUnlink:j=>{_.mutateAsync({key:h.id,sessionId:j}).catch(D=>{de(D instanceof Error&&D.message?D.message:n("ui.projects.project_detail.the_session_was_not_unlinked"))})}}),t.jsx(pl,{links:v}),t.jsx(xl,{updates:h.updates,nowMs:s}),t.jsx(pn,{open:b,projectName:h.name,onClose:()=>f(!1),onConfirm:async j=>{await c.mutateAsync({key:h.id,confirmedName:j}),be(n("ui.projects.project_detail.project_deleted")),r("/projects")}}),t.jsx(dl,{open:x,onClose:()=>w(!1),onStart:P,teamsEnabled:ye(a.data,"team_catalogue"),profilesEnabled:ye(a.data,"profile_catalogue")})]})})},vl="payments-migration",jr={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},kl=({open:e,onClose:s,onSubmit:r})=>{F();const[a,o]=d.useState(jr),[i,l]=d.useState({}),[c,u]=d.useState(null),m=d.useRef(null),[p,_]=d.useState(!1),[b,f]=d.useState(!1),[x,w]=d.useState(!1),g=d.useId(),h=d.useRef(null);d.useEffect(()=>{e&&(o({...jr,description:lr}),l({}),u(null),_(!1),f(!1),w(!1))},[e]),d.useEffect(()=>{c&&m.current?.scrollIntoView({block:"nearest"})},[c]);const v=(j,D)=>{o(R=>({...R,[j]:D}))},T=b?a.name:Cc(a.title),N=j=>fn(j,h,D=>v("description",D)),q=(j,D)=>{const R={},I=Wt(D);I&&(R.name=I);const K=sn(j.description);K&&(R.description=K);const B=ns(j.tags).error;B&&(R.tags=B);const Y=ss(j.startDate);Y&&(R.startDate=Y);const X=ss(j.targetDate);if(X)R.targetDate=X;else if(!Y){const ee=rs(j.startDate,j.targetDate);ee&&(R.targetDate=ee)}if(j.estimate.trim()){const ee=rn(j.estimate);ee&&(R.estimate=ee)}const Z=ts(j.title);Z&&(R.title=Z);const me=St(j.owner,"owner");me&&(R.owner=me);const oe=St(j.team,"team");return oe&&(R.team=oe),R},C=async()=>{const j=T.trim(),D=q(a,j);if(l(D),Object.keys(D).length>0)return;_(!0),u(null);const R=lt(a.tags);try{const I={};a.title.trim()&&(I.title=a.title.trim()),a.owner.trim()&&(I.owner=a.owner.trim()),a.team.trim()&&(I.team=a.team.trim()),a.startDate&&(I.start_date=a.startDate),a.targetDate&&(I.target_date=a.targetDate),a.estimate&&(I.estimate=Number(a.estimate),I.estimate_unit=a.estimateUnit),await r({fields:{name:j,...a.description.trim()&&a.description.trim()!==lr?{description:a.description.trim()}:{},status:a.status,...R.length>0?{tags:R}:{}},...Object.keys(I).length>0?{followUp:I}:{}}),s()}catch(I){const K=I instanceof Error&&I.message?I.message:"";u(_t(K)||n("ui.projects.project_form_dialog.the_project_was_not_saved"))}finally{_(!1)}},E=n("ui.projects.project_form_dialog.new_project"),P=a.description.length>Xe;return t.jsx(dt,{open:e,onClose:s,title:E,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:p,onEscapeKeyDown:j=>{p&&j.preventDefault()},onInteractOutside:j=>{p&&j.preventDefault()}},dataTourTag:"project-create-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(He,{onClick:s,disabled:p,children:n("ui.projects.project_form_dialog.cancel")}),t.jsxs(vt,{"data-project-submit":"",onClick:()=>void C(),disabled:p,children:[p&&t.jsx(Te,{size:"xs"}),n("ui.projects.project_form_dialog.create_project")]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:j=>{j.preventDefault(),C()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:`${g}-title`,children:n("ui.projects.project_form_dialog.title")}),t.jsx(ue,{id:`${g}-title`,"data-project-title":"",value:a.title,onChange:j=>v("title",j.target.value),placeholder:n("ui.projects.project_form_dialog.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(pe,{htmlFor:`${g}-key`,className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.key")}),t.jsx(ue,{id:`${g}-key`,"data-project-key":"",value:T,onChange:j=>{f(!0),v("name",j.target.value)},placeholder:vl,"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?n("ui.projects.project_form_dialog.letters_digits_dot_underscore_or_dash_no_spaces"):n("ui.projects.project_form_dialog.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(pe,{htmlFor:`${g}-description`,children:n("ui.projects.project_form_dialog.description")}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_form_dialog.description_mode")}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(j=>t.jsx("button",{type:"button","data-project-description-mode":j,"aria-pressed":x===(j==="preview"),onClick:()=>w(j==="preview"),className:M("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",x===(j==="preview")&&"bg-surface text-ink"),children:j==="write"?n("ui.projects.project_form_dialog.write"):n("ui.projects.project_form_dialog.preview")},j))})]})]}),x?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(ut,{className:"text-body-sm",children:a.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_form_dialog.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:h,id:`${g}-description`,"data-project-description":"",value:a.description,onChange:j=>v("description",j.target.value),onPaste:N,rows:8,placeholder:n("ui.projects.project_form_dialog.markdown_headings_lists_code"),"aria-invalid":P||!!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:M("text-meta tabular-nums",P?"text-danger":"text-ink-muted"),children:[a.description.length,"/",Xe]})]})]}),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(pe,{children:n("ui.projects.project_form_dialog.status")}),t.jsxs(Ke,{value:a.status,onValueChange:j=>v("status",j),children:[t.jsx(We,{"aria-label":n("ui.projects.project_form_dialog.status"),children:t.jsx(Ve,{})}),t.jsx(Qe,{children:Lr.map(j=>t.jsx(Ae,{value:j.value,children:j.label},j.value))})]}),a.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.moving_a_project_to_done_stamps_today_as_its_completion_date")})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:`${g}-owner`,children:n("ui.projects.project_form_dialog.owner")}),t.jsx(ue,{id:`${g}-owner`,"data-project-owner":"",value:a.owner,onChange:j=>v("owner",j.target.value),placeholder:n("ui.projects.examples.owner"),"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(pe,{htmlFor:`${g}-team`,children:n("ui.projects.project_form_dialog.team")}),t.jsx(ue,{id:`${g}-team`,value:a.team,onChange:j=>v("team",j.target.value),placeholder:n("ui.projects.examples.team"),"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(pe,{htmlFor:`${g}-target`,children:n("ui.projects.project_form_dialog.target_date")}),t.jsx(ue,{id:`${g}-target`,"data-project-target":"",value:a.targetDate,onChange:j=>v("targetDate",j.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(pe,{htmlFor:`${g}-start`,children:n("ui.projects.project_form_dialog.start_date")}),t.jsx(ue,{id:`${g}-start`,value:a.startDate,onChange:j=>v("startDate",j.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(pe,{htmlFor:`${g}-estimate`,children:n("ui.projects.project_form_dialog.estimate")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ue,{id:`${g}-estimate`,value:a.estimate,onChange:j=>v("estimate",j.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(Ke,{value:a.estimateUnit,onValueChange:j=>v("estimateUnit",j),children:[t.jsx(We,{"aria-label":n("ui.projects.project_form_dialog.estimate_unit"),className:"max-w-32",children:t.jsx(Ve,{})}),t.jsxs(Qe,{children:[t.jsx(Ae,{value:"points",children:n("ui.projects.project_form_dialog.points")}),t.jsx(Ae,{value:"days",children:n("ui.projects.project_form_dialog.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(pe,{htmlFor:`${g}-tags`,children:n("ui.projects.project_form_dialog.tags")}),t.jsx(ue,{id:`${g}-tags`,value:a.tags,onChange:j=>v("tags",j.target.value),placeholder:n("ui.projects.project_form_dialog.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:n("ui.projects.project_form_dialog.comma_separated_up_to_8_lowercase_letters_digits_underscore_or_da")})]})]}),c&&t.jsx("p",{ref:m,className:"text-body-sm text-danger",children:c})]})})},yn=({children:e})=>{const s=d.useRef(null),[r,a]=d.useState(!1),o=()=>{const i=s.current;i&&a(i.scrollTop+i.clientHeight<i.scrollHeight-1)};return d.useEffect(o),t.jsx("div",{ref:s,onScroll:o,className:M("max-h-[min(70vh,32rem)] overflow-y-auto overscroll-contain",r&&"[mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]"),children:e})},wl=({label:e,count:s,selected:r,onToggle:a})=>{const o=d.useId();return t.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-1 py-1 hover:bg-sunken",children:[t.jsx(Er,{id:o,checked:r,onCheckedChange:()=>a()}),t.jsx(pe,{htmlFor:o,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})]})},Nl=({column:e,spec:s,onChange:r})=>{F();const a=d.useId(),o=s!==null&&s.key===e,i=o?s.direction:Bt(e),l=i==="asc"?"desc":"asc",c=()=>r({key:e,direction:o?l:Bt(e)}),u=s===null?"default":o?"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:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column",{sortColumnLabel_column:String(Je(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:u==="default",onChange:()=>r(null),className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="default"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_sort.default_as_listed")})]}),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:u==="sorted",onChange:c,onClick:()=>{u==="sorted"&&c()},onKeyDown:m=>{u==="sorted"&&(m.key!==" "&&m.key!=="Enter"||(m.preventDefault(),c()))},className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="sorted"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column_value2",{sortColumnLabel_column:String(Je(e)),value2:String(ks(e,o?i:Bt(e)))})})]})]})},Sl=({facet:e,options:s,onToggle:r})=>(F(),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:ot[e]}),s.map(a=>t.jsx(wl,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>r(e,a.value)},`${e}:${a.value??"none"}`))]})),vn=({projects:e,state:s,query:r,todayMs:a,onToggle:o,onClearAll:i,scope:l,sort:c})=>{F();const u=l===void 0?_i(e,s,a):l===null?[]:[tn(l,e,s,a)],m=!ct(s)||r.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:n("ui.projects.project_filters_panel.filters")}),m&&t.jsx(G,{variant:"link",size:"sm",onClick:i,children:n("ui.projects.project_filters_panel.clear_all")})]}),c&&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:n("ui.projects.project_filters_panel.sort_by_key",{key:String(Je(c.key))})}),t.jsx(Nl,{column:c.key,spec:c.spec,onChange:c.onChange})]}),u.map(p=>t.jsx(Sl,{facet:p.facet,options:p.options,onToggle:o},p.facet))]})},Cl=({team:e,count:s,headingId:r,className:a,...o})=>(F(),t.jsxs("div",{...o,"data-glass-well":"",className:M("flex h-8 cursor-default items-center gap-2 bg-surface px-3 text-meta",a),children:[t.jsx("h3",{id:r,className:"truncate text-ink",children:e??n("ui.projects.project_model.no_team")}),t.jsx("span",{className:"shrink-0 text-ink-muted","aria-label":po(s),children:s})]})),Ce=[{key:"name",get label(){return n("ui.projects.project_list.project")},className:"min-w-0 flex-1",sort:"name",facet:null},{key:"status",get label(){return n("ui.projects.project_list.status")},className:"w-20 shrink-0",sort:"status",facet:"status"},{key:"target",get label(){return n("ui.projects.project_list.target")},className:"hidden w-32 shrink-0 @[40rem]:block",sort:"target",facet:"target"},{key:"estimate",get label(){return n("ui.projects.project_list.estimate")},className:"hidden w-16 shrink-0 @[40rem]:block",sort:"estimate",facet:"estimate"},{key:"milestones",get label(){return n("ui.projects.project_list.milestones")},className:"hidden w-20 shrink-0 @[34rem]:block",sort:"milestones",facet:"milestones"},{key:"live",get label(){return n("ui.projects.project_list.live")},className:"hidden w-14 shrink-0 @[34rem]:block",sort:"live",facet:"live"},{key:"progress",get label(){return n("ui.projects.project_list.progress")},className:"w-40 shrink-0",sort:"progress",facet:"progress"}];function El(e,s){const r=pt(e.progress_updated_at,s);return r?mt(r):n("ui.projects.project_list.not_reported")}const Tl=({direction:e})=>e==="asc"?t.jsx(Dr,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"shrink-0","aria-hidden":"true"}),Rl=({projects:e,nowMs:s,onOpen:r,sort:a,onSortChange:o,searchPopulation:i,filters:l,query:c,todayMs:u,onToggleFilter:m,onClearFilters:p,teamLabelFor:_=b=>b})=>{const b=F(),f=a?wi(e,a):e,x=bs(f,ft),w=d.useId(),g=C=>`${w}-team-${C}`,[h,v]=d.useState(0),T=d.useRef([]),N=(C,E)=>{const P=Ce.length;for(let j=1;j<=P;j+=1){const D=(C+E*j+P*P)%P,R=T.current[D];if(R&&R.offsetParent!==null){v(D),R.focus();return}}},q=C=>E=>{E.key!=="ArrowLeft"&&E.key!=="ArrowRight"||(E.preventDefault(),N(C,E.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":n("ui.projects.project_list.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:Ce.map((C,E)=>{const P=a!==null&&a.key===C.sort;return t.jsx("th",{scope:"col","aria-sort":P?a.direction==="desc"?"descending":"ascending":"none",className:M(C.className,"p-0 text-left font-normal"),children:t.jsxs(_s,{children:[t.jsx(js,{asChild:!0,children:t.jsxs("button",{type:"button",ref:j=>{T.current[E]=j},tabIndex:E===h?0:-1,"data-project-column":C.key,onFocus:()=>v(E),onKeyDown:q(E),className:M("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",P?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:C.label}),P?t.jsx(Tl,{direction:a.direction}):t.jsx(_a,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(hs,{align:"start","aria-label":n("ui.projects.project_list.label_column",{label:String(C.label)}),className:"w-72 p-0",children:t.jsx(yn,{children:t.jsx(vn,{projects:i,state:l,query:c,todayMs:u,onToggle:m,onClearAll:p,scope:C.facet,sort:{key:C.sort,spec:a,onChange:o}})})})]})},C.key)})})})}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:x.map((C,E)=>t.jsxs("li",{children:[t.jsx(Cl,{team:C.team==null?null:_(C.team),count:C.items.length,headingId:g(E),className:"sticky top-0 z-10","data-project-team":C.team??""}),t.jsx("ul",{"aria-labelledby":g(E),className:"divide-y divide-hairline",children:C.items.map(P=>{const j=new Map(Br(P,b).map(I=>[I.key,I.text])),D=Ur(P.milestones_completed,P.milestones_total),R=xs(P.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>r(P),"data-project-name":P.name,className:M("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-row-hover"),children:[t.jsx("span",{className:M(Ce[0].className,"truncate text-body-sm text-ink"),children:ne(P)}),t.jsx("span",{className:Ce[1].className,children:t.jsx(jn,{status:P.status})}),t.jsx("span",{className:M(Ce[2].className,"truncate text-meta text-ink-muted"),children:j.get("target")??j.get("completed")??""}),t.jsx("span",{className:M(Ce[3].className,"truncate text-meta text-ink-muted"),children:j.get("estimate")??""}),t.jsx("span",{className:M(Ce[4].className,"truncate text-meta text-ink-muted"),children:D}),t.jsx("span",{className:M(Ce[5].className,"truncate text-meta text-ink-muted"),children:R}),t.jsxs("span",{className:M(Ce[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:El(P,s)}),P.progress_stale&&t.jsx(ke,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]})},P.id)})})]},C.team??""))})]})},Tt=224,hr=36,Dl={get day(){return n("ui.projects.project_timeline.days")},get week(){return n("ui.projects.project_timeline.weeks")},get month(){return n("ui.projects.project_timeline.months")},get quarter(){return n("ui.projects.project_timeline.quarters")}},Al=({items:e,nowMs:s,onOpen:r,pendingDetails:a,failedDetails:o,onRetryDetails:i,teamLabelFor:l=c=>c})=>{F();const[c,u]=d.useState(null),[m,p]=d.useState(0),_=d.useRef(null),b=Ns(s),f=d.useMemo(()=>Ci(e,b),[e,b]),x=d.useMemo(()=>Ei(e),[e]),w=d.useMemo(()=>bs(x.dated,C=>ft(C.project)),[x]);d.useLayoutEffect(()=>{const C=_.current;if(!C)return;const E=()=>p(C.clientWidth);if(E(),typeof ResizeObserver>"u")return;const P=new ResizeObserver(E);return P.observe(C),()=>P.disconnect()},[]);const g=Math.max(m-Tt-24,160),h=f?Ni(Js(f.startMs,f.endMs),g):"month",v=c??h,T=C=>{const E=De.indexOf(v),P=De[E-C];P&&u(P)},N=ws[v],q=f?Js(f.startMs,f.endMs)*N:0;return t.jsxs("div",{ref:_,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:o>0?n("ui.projects.timeline.read_failed",{count:o}):n("ui.projects.project_timeline.length_dated_length_2_without_dates_value3",{length:V(x.dated.length,{useGrouping:!1}),length_2:V(x.undated.length,{useGrouping:!1}),value3:String(a>0?n("ui.projects.project_timeline.loading_milestones_for_pendingdetails",{pendingDetails:V(a,{useGrouping:!1})}):"")})}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[o>0&&t.jsx(G,{variant:"secondary",size:"sm",onClick:i,children:n("ui.projects.project_timeline.try_again")}),t.jsx(G,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_in"),title:n("ui.projects.project_timeline.zoom_in_finer"),disabled:!f||v===De[0],onClick:()=>T(1),children:t.jsx(it,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Dl[v]}),t.jsx(G,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_out"),title:n("ui.projects.project_timeline.zoom_out_coarser"),disabled:!f||v===De[De.length-1],onClick:()=>T(-1),children:t.jsx(Ca,{})})]})]}),f&&x.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(Ol,{startMs:f.startMs,endMs:f.endMs,tier:v,pxPerDay:N,trackPx:q}),w.map(C=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":C.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:Tt},children:[t.jsx("span",{className:"truncate text-ink",children:C.team==null?n("ui.projects.project_model.no_team"):l(C.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:C.items.length})]})}),C.items.map(E=>t.jsx(Pl,{item:E,spanStart:f.startMs,pxPerDay:N,trackPx:q,today:b,onOpen:()=>r(E)},E.project.id))]},C.team??""))]})}):null,x.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(vr,{defaultOpen:x.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(Ga,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Ti(x.undated.length)})]}),children:[x.dated.length===0&&t.jsx("p",{className:"pb-1 text-meta text-ink-muted",children:n("ui.projects.project_timeline.set_a_start_date_a_target_date_or_a_milestone_date_and_it_will_ap")}),t.jsx("ul",{className:"flex max-h-24 flex-wrap gap-x-3 gap-y-1 overflow-y-auto",children:x.undated.map(C=>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:()=>r(C),children:ne(C.project)})},C.project.id))})]})})]})},Ol=({startMs:e,endMs:s,tier:r,pxPerDay:a,trackPx:o})=>{const i=Fi(e,s,r);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:Tt}}),t.jsx("span",{className:"relative block h-6",style:{width:o},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:Le(e,l.dayMs)*a},children:[t.jsx("span",{className:M("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))})]})},Pl=({item:e,spanStart:s,pxPerDay:r,trackPx:a,today:o,onOpen:i})=>{const{project:l}=e,c=Ri(e),u=Di(e),m=p=>new Date(p).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-row-hover",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:Tt,height:hr},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:ne(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:hr},children:[c&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:Le(s,c.fromMs)*r,width:(Le(c.fromMs,c.toMs)+1)*r},title:`${Oe(m(c.fromMs))} → ${Oe(m(c.toMs))}`}),u.map(p=>t.jsx("span",{"data-milestone":p.status,className:M("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",p.status==="completed"&&"bg-success",p.status==="overdue"&&"bg-warning",p.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:Le(s,p.dayMs)*r},title:`${p.name} · ${p.status} · ${Oe(m(p.dayMs))}`},`${p.name}-${p.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:Le(s,o)*r},"aria-hidden":"true"})]})]})},Ml=({projects:e,query:s,onQueryChange:r,filters:a,onFiltersChange:o,onClearAll:i,todayMs:l,resultText:c,countRevealClass:u="@[37rem]:inline",trailing:m,disabled:p=!1,searchFieldRef:_})=>{F();const[b,f]=d.useState(!1),x=d.useRef(!1),w=di(a),g=Tr(c??"",300),h=s.trim()!==""||!ct(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(ja,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),t.jsx(ue,{ref:_,inputSize:"sm",value:s,onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Escape"&&(s?r(""):v.currentTarget.blur())},placeholder:n("ui.projects.projects_toolbar.search_projects"),"aria-label":n("ui.projects.projects_toolbar.search_projects"),autoComplete:"off",spellCheck:!1,className:"pl-9"}),s?t.jsx(G,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>ha(_.current,r),"aria-label":n("ui.projects.projects_toolbar.clear_search"),children:t.jsx(Pt,{"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(ga,{shortcut:"/"})})]}),t.jsxs(_s,{open:b,onOpenChange:f,children:[t.jsx(js,{asChild:!0,children:t.jsxs(G,{variant:"secondary",size:"sm",disabled:p,"data-project-filters-button":"",children:[t.jsx(Ha,{size:14,"aria-hidden":"true"}),n("ui.projects.projects_toolbar.filters"),w>0&&t.jsx(ke,{variant:"neutral",children:w})]})}),t.jsx(hs,{align:"end","aria-label":n("ui.projects.projects_toolbar.filters"),className:"w-80 p-0",onCloseAutoFocus:v=>{x.current&&(x.current=!1,v.preventDefault())},children:t.jsx(yn,{children:t.jsx(vn,{projects:e,state:a,query:s,todayMs:l,onToggle:(v,T)=>o(Jr(a,v,T)),onClearAll:()=>{i(),x.current=!0,f(!1),_.current?.focus()}})})})]}),h&&c!==null&&t.jsx("span",{className:M("hidden whitespace-nowrap text-meta text-ink-dim",u),"data-project-count":"",children:c}),t.jsx("output",{className:"sr-only","aria-live":"polite",children:g}),m]})},Ll=({filters:e,sort:s,onFiltersChange:r,onSortChange:a,onClearAll:o,hideClearAll:i=!1,searchFieldRef:l})=>{F();const[c,u]=d.useState(null);d.useEffect(()=>{if(!c)return;let _=null;c.kind==="search"?_=l.current:(_=document.querySelector(`[data-project-chip="${c.index}"]`),_||(_=document.querySelector("[data-project-chip]")),_||(_=document.querySelector("[data-project-filters-button]"))),_&&(_.focus(),u(null))});const m=[];for(const _ of et){const b=e[_];if(b.length===0)continue;const f=b.map(g=>Xr(_,g)),x=f[0],w=f.length>1?n("ui.projects.projects_toolbar.facet_labels_facet_first_length_1",{FACET_LABELS_facet:String(ot[_]),first:String(x),length___1:V(f.length-1,{useGrouping:!1})}):n("ui.projects.projects_toolbar.facet_labels_facet_first",{FACET_LABELS_facet:String(ot[_]),first:String(x)});m.push({kind:"facet",facet:_,label:w,ariaLabel:n("ui.projects.projects_toolbar.remove_filter_facet_labels_facet_join",{FACET_LABELS_facet:String(ot[_]),join:String(f.join(", "))}),clear:()=>r({...e,[_]:[]})})}if(s&&m.push({kind:"sort",spec:s,label:n("ui.projects.projects_toolbar.sort_key",{key:String(Je(s.key))}),ariaLabel:n("ui.projects.projects_toolbar.remove_sort_key_direction",{key:String(Je(s.key)),direction:String(ks(s.key,s.direction))}),clear:()=>a(null)}),m.length===0)return null;const p=(_,b)=>{b.clear();const f=m.length-1;u(f===0?{kind:"chip",index:0}:{kind:"chip",index:Math.min(_,f-1)})};return t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.map((_,b)=>t.jsx(ke,{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":_.ariaLabel,onClick:()=>p(b,_),children:[_.kind==="sort"&&(_.spec.direction==="asc"?t.jsx(Dr,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:_.label}),t.jsx(Pt,{className:M("text-ink-dim transition-colors duration-fast ease-out-quart","group-hover:text-danger"),"aria-hidden":"true"})]})},_.kind==="facet"?_.facet:"sort")),!i&&t.jsx(G,{variant:"link",size:"sm",onClick:()=>{o(),u({kind:"search"})},children:n("ui.projects.projects_toolbar.clear_all")})]})},kn="projects-view",Il=[{value:"list",get label(){return n("ui.projects.projects_view_switcher.list")}},{value:"board",get label(){return n("ui.projects.projects_view_switcher.board")}},{value:"timeline",get label(){return n("ui.projects.projects_view_switcher.timeline")}}];function Fl(){try{const e=localStorage.getItem(kn);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function ql(e){try{localStorage.setItem(kn,e)}catch{}}const Ul=({value:e,onChange:s})=>(F(),t.jsx(Ea,{value:e,onValueChange:r=>s(r),children:t.jsx(Ta,{"aria-label":n("ui.projects.projects_view_switcher.project_view"),"data-tour-tag":"projects-view-switcher",children:Il.map(r=>t.jsx(Ra,{value:r.value,children:r.label},r.value))})})),Bl=["r1","r2","r3","r4","r5","r6"],$l=4e3,gr={get unpaired(){return n("ui.projects.projects_page.this_app_is_not_paired_with_the_local_operator_server_so_projects")},get"below-version"(){return n("ui.projects.projects_page.the_local_operator_server_is_older_than_this_app_expects_so_proje")},get unknown(){return n("ui.projects.projects_page.the_server_s_capabilities_could_not_be_read_so_projects_are_unava")}},Jl=({nowMs:e=Date.now()})=>{F();const{projectId:s}=xa(),r=Dt(),a=Ze(),o=ba(a.data,"projects",1),i=o==="enabled",l=ye(a.data,"projects",Ko),c=wr(ye(a.data,"team_catalogue")),u=Xa(i),m=Za(),p=Or(),_=Pr(),[b,f]=d.useState(!1),[x,w]=d.useState(()=>Fl()),[g,h]=d.useState(()=>yo()),[v,T]=d.useState(null),[N,q]=d.useState(""),[C,E]=d.useState(Ws),[P,j]=d.useState(()=>gi()),[D,R]=d.useState(""),I=d.useRef(""),K=d.useRef(null),B=d.useRef(null),Y=S=>{K.current!==null&&(window.cancelAnimationFrame(K.current),K.current=null),S!==""&&S===I.current?(R(""),K.current=window.requestAnimationFrame(()=>{K.current=null,R(S)})):R(S),I.current=S,B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,I.current="",R("")},$l)},X=()=>{K.current!==null&&(window.cancelAnimationFrame(K.current),K.current=null),B.current!==null&&(window.clearTimeout(B.current),B.current=null),I.current="",R("")},Z=S=>{q(S),X()},me=S=>{E(S),X()},oe=d.useRef(null),ee=nc(),te=u.data??[],y=Ns(e),k=oi(N,i&&l),O=Qr(N),L=d.useMemo(()=>k.answer?ni(te,k.answer.projects):null,[te,k.answer]),U=O!=="",H=d.useMemo(()=>U?L??ri(te,O):te,[te,O,U,L]),Q=L===null?"client":"backend",$=d.useMemo(()=>pi(H,C,y),[H,C,y]),je=l&&U&&k.pending,ie=U||!ct(C),z=d.useMemo(()=>$s(te,g,e),[te,g,e]),se=d.useMemo(()=>$s($,g,e),[$,g,e]),xe=bo(g),fe=x==="board"?se.length:$.length,Pe=!ie||!u.isSuccess?null:x==="board"?n("ui.projects.projects_page.length_of_length_2_in_window",{length:V(se.length,{useGrouping:!1}),length_2:V(z.length,{useGrouping:!1})}):n("ui.projects.projects_page.length_of_length_2_projects",{length:V($.length,{useGrouping:!1}),length_2:te.length}),re=u.isSuccess&&te.length>0,Re=re&&ie&&fe===0&&!je,Be=je&&fe===0&&re,[qt,st]=d.useState(!1);d.useEffect(()=>{if(!qt)return;const S=document.querySelector('[data-tour-tag="projects-board-window"]');S&&(S.focus(),st(!1))}),d.useEffect(()=>{if(!i||s)return;const S=W=>{const J=W.target;if(!J||J.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(J.tagName)||J.closest('[role="dialog"]'))return;const Se=W.key==="/"&&!W.metaKey&&!W.ctrlKey&&!W.altKey,le=(W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="f";!Se&&!le||(W.preventDefault(),oe.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i,s]);const rt=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const S=rt.current;S!==null&&(S.scrollTop=0)},[s]);const ht=Ja(x==="timeline"?te.map(S=>S.id):[],i),A=new Map(te.map((S,W)=>[S.id,ht[W]])),ce=$.map(S=>({project:S,milestones:A.get(S.id)?.data?.project.milestones??[]})),nt=x==="timeline"?$.filter(S=>A.get(S.id)?.isLoading).length:0,we=x==="timeline"?$.filter(S=>A.get(S.id)?.isError).length:0,gt=()=>{for(const S of ht)S.isError&&S.refetch()},$e=S=>{j(S),xi(S),Y(bi(S))},wn=(S,W)=>{E(J=>Jr(J,S,W)),X()},xt=()=>{const S=N.trim()!=="",W=!ct(C),J=P!==null;q(""),E(Ws),P!==null&&$e(null),Y(yi({search:S,filters:W,sort:J}))},Es=()=>{h("all"),zs("all"),st(!0)},[Ne,Ts]=d.useState(null),Ut=d.useRef(!1),Rs=()=>{Ut.current=!1,Ts(null)},[Nn,Ds]=d.useState([]),Sn=ye(a.data,"projects_force_done"),Cn=(S,W)=>{const J=S.id,Se=ae(W).label;Ds(le=>le.includes(J)?le:[...le,J]),zi({move:()=>p.mutateAsync({key:J,fields:{status:W}}),forceDoneOffered:Sn,claimQuestion:()=>Ut.current?!1:(Ut.current=!0,!0)}).then(le=>{if(le.kind==="accepted"){be(n("ui.projects.projects_page.moved_to_label",{label:String(Se)})),u.refetch().then(()=>ee(J));return}if(le.kind==="question"){Ts({project:S,status:W,refusal:le.refusal});return}de(le.copy,le.refusal?{action:{get label(){return n("ui.projects.projects_page.view_project")},onClick:()=>void r(`/projects/${J}`)}}:void 0),ee(J)}).finally(()=>{Ds(le=>le.filter(En=>En!==J))})};return i?s?t.jsx("div",{ref:rt,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(yl,{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(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us,subtitle:n("ui.projects.projects_page.workstreams_you_and_your_agents_track_across_sessions"),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{variant:"secondary",size:"icon","aria-label":n("ui.projects.projects_page.refresh_projects"),title:n("ui.projects.projects_page.refresh_projects"),disabled:u.isFetching,onClick:()=>void u.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(Ma,{})}),t.jsxs(G,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"create-project-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.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(Ul,{value:x,onChange:S=>{w(S),ql(S)}}),t.jsx(Ml,{projects:H,query:N,onQueryChange:Z,filters:C,onFiltersChange:me,onClearAll:xt,todayMs:y,resultText:Pe,countRevealClass:x==="board"?"@[47rem]:inline":void 0,disabled:u.isError,searchFieldRef:oe,trailing:x==="board"&&!(u.isSuccess&&u.data.length===0)?t.jsx(Gi,{value:g,onChange:S=>{h(S),zs(S)}}):null})]}),t.jsx(Ll,{filters:C,sort:P,onFiltersChange:me,onSortChange:$e,onClearAll:xt,hideClearAll:Re,searchFieldRef:oe}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:D})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[u.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:n("ui.projects.projects_page.loading_projects")}),Bl.map(S=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(ze,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(ze,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ze,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(ze,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(ze,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ze,{className:"h-4 w-40 shrink-0 bg-elevated"})]},S))]}),u.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx(Kt,{variant:"danger",children:u.error instanceof Error&&u.error.message?u.error.message:n("ui.projects.projects_page.the_projects_could_not_be_read")}),t.jsx(G,{variant:"secondary",size:"sm",onClick:()=>void u.refetch(),children:n("ui.projects.projects_page.try_again")})]}),u.isSuccess&&u.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:n("ui.projects.projects_page.no_projects_yet")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.create_one_here_or_ask_an_agent_to_create_one_and_link_this_sessi")}),t.jsxs(G,{variant:"primary",onClick:()=>f(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.new_project")]})]}),Be&&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:n("ui.projects.projects_page.searching")})}),re&&Re&&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:N.trim()?n("ui.projects.projects_page.no_projects_match_trim",{trim:String(N.trim())}):n("ui.projects.projects_page.no_projects_match")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:N.trim()?Ho[Q]:n("ui.projects.projects_page.try_removing_a_filter_clearing_the_filters_restores_the_list")}),t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(G,{variant:"secondary",onClick:()=>{xt(),oe.current?.focus()},children:n("ui.projects.projects_page.clear_all")}),x==="board"&&$.length>0&&t.jsx(G,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]})]}),re&&!Re&&!Be&&x==="list"&&t.jsx(Rl,{projects:$,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),sort:P,onSortChange:$e,searchPopulation:H,filters:C,query:N,todayMs:y,onToggleFilter:wn,onClearFilters:xt,teamLabelFor:c}),re&&!Re&&x==="board"&&se.length>0&&t.jsx(oc,{projects:se,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),onEdit:S=>void r(`/projects/${S.id}`),onDelete:T,onMove:Cn,teamLabelFor:c,movingKeys:Nn}),re&&!Re&&!Be&&x==="board"&&se.length===0&&xe!==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:xe}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.older_projects_are_hidden_by_the_window")}),t.jsx(G,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]}),re&&!Re&&!Be&&x==="timeline"&&t.jsx(Al,{items:ce,nowMs:e,onOpen:S=>void r(`/projects/${S.project.id}`),pendingDetails:nt,failedDetails:we,onRetryDetails:gt,teamLabelFor:c})]}),t.jsx(pn,{open:v!==null,projectName:v?.name??"",onClose:()=>T(null),onConfirm:async S=>{v&&(await _.mutateAsync({key:v.id,confirmedName:S}),be(n("ui.projects.projects_page.project_deleted")),T(null))}}),t.jsx(_n,{open:Ne!==null,refusal:Ne?.refusal??null,projectLabel:Ne?ne(Ne.project):"",onClose:()=>{Ne&&ee(Ne.project.id),Rs()},onConfirm:async()=>{if(!Ne)return;const{project:S,status:W,refusal:J}=Ne,Se=await p.mutateAsync({key:S.id,fields:{status:W},forceDone:!0});be(Vr(Se,J.count,ae(W).label)),u.refetch().then(()=>ee(S.id))},secondaryLabel:n("ui.projects.projects_page.open_project"),onSecondary:()=>{const S=Ne?.project.id;Rs(),S&&r(`/projects/${S}`)}}),t.jsx(kl,{open:b,onClose:()=>f(!1),onSubmit:async S=>{const W=await m.mutateAsync(S.fields),J=S.followUp?.title??S.fields.name;if(S.followUp)try{await p.mutateAsync({key:W.id,fields:S.followUp})}catch(Se){const le=Se instanceof Error&&Se.message?Se.message:"";de(n("ui.projects.projects_page.project_label_was_created_but_the_extra_fields_were_not_saved_val",{label:String(J),value2:String(_t(le)||n("ui.projects.projects_page.the_server_refused_them"))}));return}be(n("ui.projects.projects_page.project_label_created",{label:String(J)}))}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Te,{label:n("ui.projects.projects_page.checking_the_server_s_projects_support")})}):t.jsx(Kt,{variant:"warning",children:gr[o]??gr.unknown})]})};export{Jl as ProjectsPage};
@@ -1 +1 @@
1
- import{_ as y,$ as w,a0 as f,a1 as T,a2 as v,C as $,D as A}from"./conversation-input-sync-Csq2qdm5.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-CfAtSgON.js";import{l as S,a as E}from"./use-memberships-query-Bz3KIW6D.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
+ import{_ as y,$ as w,a0 as f,a1 as T,a2 as v,C as $,D as A}from"./conversation-input-sync-CJiOSzCX.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-C6eXGzFs.js";import{l as S,a as E}from"./use-memberships-query-DcD9UeVY.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-DXWoCulQ.js";import{v as $t}from"./conversation-input-sync-Csq2qdm5.js";import"./index-BqKNVosC.js";import"./ui-preferences-store-CfAtSgON.js";import"./error-boundary-D1EdrZoj.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-BHqZ2SZO.js";import{v as $t}from"./conversation-input-sync-CJiOSzCX.js";import"./index-hX_aZwq0.js";import"./ui-preferences-store-C6eXGzFs.js";import"./error-boundary-Tv9TlaZ8.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()+`