local-operator-ui 0.35.1 → 0.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +578 -12
- package/out/renderer/assets/{_basePickBy-C724Y6y1.js → _basePickBy-NBZVf3x_.js} +1 -1
- package/out/renderer/assets/{_baseUniq-CTHBzlaK.js → _baseUniq-BpOXfy9b.js} +1 -1
- package/out/renderer/assets/{agent-details-page-C6VzLw1m.js → agent-details-page-CI5V0mco.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-C4o6Aqru.js → agent-hub-page-C7UV5Z02.js} +1 -1
- package/out/renderer/assets/{agents-page-FP1_RvOY.js → agents-page-BHUCzpZE.js} +3 -3
- package/out/renderer/assets/{arc-Cv2GJOa_.js → arc-DTlm2-sN.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BZyhfzWz.js → architectureDiagram-IEHRJDOE-uA5hYBWO.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DtHvlbei.js → blockDiagram-JOT3LUYC-Awo08lrR.js} +1 -1
- package/out/renderer/assets/{book-open-C65LfbfB.js → book-open-DBUibLWP.js} +1 -1
- package/out/renderer/assets/browser-page-DuKCLrh5.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CjbHvbI7.js → browser-webauthn-prompt-egKdqzbk.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-DKV5t3tX.js → c4Diagram-VJAJSXHY-DAHoIxNf.js} +1 -1
- package/out/renderer/assets/channel-BZ9uCAQo.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-D1J0hVNB.js → chunk-4BMEZGHF-QvFtu74J.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-msLg_v_T.js → chunk-A2AXSNBT-EcRDJZN6.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-Dk25anb1.js → chunk-AEK57VVT-CKf_yBAg.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DhfHQLiP.js → chunk-D6G4REZN-CoixV4aq.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-D83jc5YN.js → chunk-RZ5BOZE2-CtEEDTp-.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DCYwl-3m.js → chunk-XZIHB7SX-BOgT03N8.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-D6kkk-4_.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-D6kkk-4_.js +1 -0
- package/out/renderer/assets/clone-BgCd73kI.js +1 -0
- package/out/renderer/assets/{console-mirror-M7tcIGks.js → console-mirror-D7dfGxrD.js} +1 -1
- package/out/renderer/assets/{consoleCapture-DN8X9Ugb.js → consoleCapture-DczATgZh.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-CO6CiDf8.js → conversation-input-sync-GlFEQKuo.js} +257 -256
- package/out/renderer/assets/{dagre-OKDRZEBW-D8jHPlQ1.js → dagre-OKDRZEBW-CijtV3o0.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DBWQdBIr.js → diagram-SSKATNLV-Dxx1RpmY.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DT_32LVX.js → diagram-VNBRO52H-DZg2hjvO.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-B-GEywmS.js → erDiagram-Q7BY3M3F-CjvMMGLo.js} +1 -1
- package/out/renderer/assets/{error-boundary-Ba0RLAEb.js → error-boundary-CLT6U8jT.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DWqU7r-A.js → flowDiagram-4HSFHLVR-EjagIE01.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-DGenG4u6.js → ganttDiagram-APWFNJXF-OfsWfUyW.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BPA8urey.js → gitGraphDiagram-7IBYFJ6S-nYTyKs0s.js} +1 -1
- package/out/renderer/assets/{graph-GUG88wOs.js → graph-BnL8m22f.js} +1 -1
- package/out/renderer/assets/{index-FR873jzR.js → index-C866kR_k.js} +1 -1
- package/out/renderer/assets/{index-DstdCAdq.css → index-CGcU9-Py.css} +1 -1
- package/out/renderer/assets/{index-DYdfRls6.js → index-CO7sxKWb.js} +1 -1
- package/out/renderer/assets/{index-BadTTC0t.js → index-Cj2bZws8.js} +11 -11
- package/out/renderer/assets/{index-DZH3HC4h.js → index-p3NO0LL-.js} +9 -9
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-BcZyO1LQ.js → infoDiagram-PH2N3AL5-LE2dCnxc.js} +1 -1
- package/out/renderer/assets/{installer-DArqAYep.js → installer-Wpfa8xHM.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-Mo89YhbY.js → journeyDiagram-U35MCT3I-BhpegMd0.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-ZnBrWmw4.js → kanban-definition-NDS4AKOZ-OoMW68Bt.js} +1 -1
- package/out/renderer/assets/{layout-PAHQYOvY.js → layout-BdaXfJXz.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-Czc5Wbjr.js → legacy-agents-page-lVj0d18U.js} +1 -1
- package/out/renderer/assets/{mermaid.core-C9gG5Wli.js → mermaid.core-DmdT5IgP.js} +5 -5
- package/out/renderer/assets/{mesh-page-BxR50_4c.js → mesh-page-D0-4HVNk.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-CCb-zon0.js → mindmap-definition-ALO5MXBD-BCXX8n68.js} +1 -1
- package/out/renderer/assets/{mini-DqIb7MPh.js → mini-DsJCW_H3.js} +1 -1
- package/out/renderer/assets/{notebook-pen-D8RjZqVC.js → notebook-pen-CAZF-xgd.js} +1 -1
- package/out/renderer/assets/{org-access-BK8MV-Og.js → org-access-DCQGHh2Y.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-BG7zY2lU.js → org-surface-gate-Cq3kOR7u.js} +1 -1
- package/out/renderer/assets/{page-header-Ch4j7oI6.js → page-header-CQ6qN4O4.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-BXTvjCLw.js → pieDiagram-IB7DONF6-BRK1MBQO.js} +1 -1
- package/out/renderer/assets/{projects-page-si3RlRLo.js → projects-page-DpAhuoA7.js} +2 -2
- package/out/renderer/assets/{publication-validation-CxIO7FGl.js → publication-validation-CZn6wbD0.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BMU76de4.js → quadrantDiagram-7GDLP6J5-CtQwUI4m.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-C1pTiS7q.js → radar-MK3ICKWK-o9_lRR0v.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-DrefDDYq.js → radient-auth-buttons-BWhD8ldO.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DsVqu3pR.js → requirementDiagram-KVF5MWMF-aEEiUjHx.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-CprOe8fX.js → sankeyDiagram-QLVOVGJD-CtjAQQYG.js} +1 -1
- package/out/renderer/assets/{schedules-page-CzOtqfGC.js → schedules-page-C4-FWwsb.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DZ5TPMR1.js → sequenceDiagram-X6HHIX6F-QOpgwrwA.js} +1 -1
- package/out/renderer/assets/{settings-page-7uhG4VZK.js → settings-page-BJZ7ozTY.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-_sPBuqdd.js → stateDiagram-DGXRK772-D99A_n2H.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D0CTAsLQ.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-DWABwm6j.js → timeline-definition-BDJGKUSR-C_Op_i7D.js} +1 -1
- package/out/renderer/assets/{ui-preferences-store-wu8ubztI.js → ui-preferences-store-Dz1Kg_SA.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-ZIDdnF_f.js → use-download-agent-mutation-PP3ZbZ7V.js} +1 -1
- package/out/renderer/assets/{use-memberships-query-BZiimzLs.js → use-memberships-query-TOFQHH-q.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-BiWZ99PX.js → use-session-snapshot-BOMni_bJ.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BBSAaYhx.js → xychartDiagram-VJFVF3MP-Bq2H6JYU.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +1 -1
- package/out/renderer/assets/browser-page-Cgwj8_cP.js +0 -1
- package/out/renderer/assets/channel-Bzt6SfZF.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BAnolaTk.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BAnolaTk.js +0 -1
- package/out/renderer/assets/clone-QOUemT9c.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-B-4nbbOf.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,t as n,d as Le,j as t,c as M}from"./index-
|
|
1
|
+
import{r as d,t as n,d as Le,j as t,c as M}from"./index-Cj2bZws8.js";import{bU as Tn,bV as Ht,bW as Rn,bX as xr,u as br,bY as Dn,bZ as An,b_ as On,b$ as Pn,c0 as Mn,c1 as In,c2 as As,c3 as Os,c4 as Ln,c5 as Fn,C as us,aK as Fe,d as pe,c6 as qn,D as ds,c7 as V,c8 as vt,c9 as Un,Z as Dt,ca as Ps,cb as Ms,cc as Is,bI as Bn,aL as je,cd as $n,a as Je,c as he,aW as yr,aN as At,a3 as dt,aR as Ye,ce as zn,cf as Gn,cg as Yn,ch as Hn,ci as Kn,aT as vr,aS as kt,bl as Wn,aB as Vn,ar as wt,bu as Qn,bA as Xn,bz as Jn,bx as Ls,cj as Zn,ck as kr,cl as ea,cm as ta,a4 as le,cn as sa,co as ra,cp as na,cq as aa,cr as oa,cs 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 _a,ct as fa,cu as Nr,bE as ja,cv as ha,aA as ga,aO as xa,aX as ba}from"./conversation-input-sync-GlFEQKuo.js";import{c as pt,u as L,F as He,l as Ot,G as Ke,H as We,J as Ve,K as Re,B as z,q as ps,r as ms,S as Se,s as _s,w as Ne,a5 as ya,a6 as va,a7 as ka,a8 as wa,a9 as Na,v as Sa,z as xe,a1 as fs,aa as js,a3 as hs,I as oe,X as Pt,g as gs,T as Sr,L as ue,N as Cr,C as Er,A as Kt,O as Ca,Y as Ea,Z as Ta,_ as Ra,k as $e}from"./error-boundary-CLT6U8jT.js";import{P as Fs}from"./page-header-CQ6qN4O4.js";import{b5 as Tr,bb as Da,bc as Rr,bd as Aa,be as Oa,aR as Pa,aH as it,A as qs,bf as Us,bg as Ma}from"./index-p3NO0LL-.js";import{h as Ia,j as La,k as Qe,l as Fa,m as Wt}from"./ui-preferences-store-Dz1Kg_SA.js";import{u as qa}from"./use-session-snapshot-BOMni_bJ.js";import"./console-mirror-D7dfGxrD.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(v=>{const g=a.defaultQueryOptions(v);return g._optimisticResults=o?"isRestoring":"optimistic",g}),[e,a,o]);l.forEach(v=>{On(v),Pn(v,i)}),Mn(i);const[c]=d.useState(()=>new Ba(a,l,s)),[u,m,p]=c.getOptimisticResult(l,s.combine),f=!o&&s.subscribed!==!1;d.useSyncExternalStore(d.useCallback(v=>f?c.subscribe(Ht.batchCalls(v)):In,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(l,s)},[l,s,c]);const _=u.some((v,g)=>As(l[g],v))?u.flatMap((v,g)=>{const h=l[g];if(h){const y=new xr(a,h);if(As(h,v))return Os(h,y,i);Ln(v,o)&&Os(h,y,i)}return[]}):[];if(_.length>0)throw Promise.all(_);const x=u.find((v,g)=>{const h=l[g];return h&&Fn({result:v,errorResetBoundary:i,throwOnError:h.throwOnError,query:a.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(x?.error)throw x.error;return m(p())}/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -24,7 +24,7 @@ import{r as d,t as n,d as Le,j as t,c as M}from"./index-BadTTC0t.js";import{bU a
|
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
26
|
*/const Qa=[["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"}]],Xa=pt("unlink",Qa),Mt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Ja(e){return us({queryKey:Mt.list,enabled:e,queryFn:()=>pe({op:"projects.list"}).then(s=>s.projects),retry:ds,staleTime:1e4})}function Za(e,s){return $a({queries:e.map(r=>({queryKey:Mt.detail(r),enabled:s&&!!r,queryFn:()=>pe({op:"projects.get",key:r}),retry:ds,staleTime:1e4}))})}function Ar(e,s){return us({queryKey:Mt.detail(e??""),enabled:s&&!!e,queryFn:()=>pe({op:"projects.get",key:e??""}),retry:ds,staleTime:1e4})}function qe(){const e=br();return()=>{e.invalidateQueries({queryKey:Mt.list})}}function eo(){const e=qe();return Fe({mutationFn:s=>pe({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=qe();return Fe({mutationFn:s=>pe({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:qn,onSuccess:()=>e()})}function Pr(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function to(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function so(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ro(){const e=qe();return Fe({mutationFn:s=>pe({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 no(){const e=qe();return Fe({mutationFn:s=>pe({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"}},ze=Object.keys(Mr);function se(e){return Mr[e]??{label:e||n("ui.projects.project_model.unknown"),variant:"neutral"}}const Ir=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:se(e).label}));function ao(e){return e==="done"}const oo={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 io(e){return oo[e]??{label:String(e),variant:"neutral"}}Le["ui.projects.project_model.stale"];const co=/^(\d{4})-(\d{2})-(\d{2})$/;function De(e,s,r=new Date){if(!e)return"";const a=co.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=vt(o,{month:"short",day:"numeric"},s);return o.getFullYear()===r.getFullYear()?i:vt(o,{month:"short",day:"numeric",year:"numeric"},s)}function mt(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 _t(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 lo(e){return e?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(_t(e))}):n("ui.projects.project_model.no_progress")}const Lr=/^$|^\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 uo(e,s){if(!e.progress)return n("ui.projects.project_model.not_reported_yet");const r=mt(e.progress_updated_at,s),a=Fr(e.progress_reported_by),o=[r?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(_t(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 po(e){return e<=0?"":n("ui.projects.count.session",{count:e})}function mo(e){return n("ui.projects.count.project",{count:e})}function _o(e){const s=po(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 jo(e){return e?e.running>0?n("ui.projects.count.subagent_running",{count:e.running}):n("ui.projects.count.subagent",{count:e.settled}):""}function ho(e){return e?n("ui.projects.count.todo",{count:e.total}):""}function Br(e,s){const r=[],a=De(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 Ge=864e5,go=/^(\d{4})-(\d{2})-(\d{2})$/;function ge(e){if(!e)return null;const s=go.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"],It=[{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",xo=It.find(e=>e.value===$r);function zr(e){return It.find(s=>s.value===e)??xo}function bo(e){return It.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 yo(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 vo(){try{const e=localStorage.getItem(Gr);if(e!==null&&bo(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 ko(){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 wo(e){Xt=[...e];try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}function No(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 So(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=ge(e.target_date);return r===null?!1:r<s}function X(e){return e.title||e.name}Le["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 Lt(e){return e.title||e.session_id}function Co(e){return[...e].reverse()}function Eo(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 To(e){const s=Date.parse(e);return Number.isNaN(s)?"":Jt(new Date(s))}function Ro(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"):De(e,s,r)}function Do(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":Un(new Date(r),{hour:"numeric",minute:"2-digit"},s)}function Ao(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":_t(mt(r/1e3,s))}function Oo(e,s,r=Date.now()){const a=[],o=Fr(e.by);o&&a.push({key:"author",text:o});const i=Do(e.at,s);i&&a.push({key:"time",text:i});const l=Ao(e.at,r);return l&&a.push({key:"age",text:l}),a}function Po(e,s,r=new Date){const a=[];for(const o of Co(e)){const i=To(o.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(o);continue}a.push({key:i,label:Ro(i,s,r),entries:[o]})}return a}function Mo(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 Io(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 Fo(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function qo(e){const s=X(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(`
|
|
27
|
-
`)}function Uo(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 Bo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Kr(e){const s=[];for(const r of e.matchAll(Bo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const yt=3;function ys(e){if(e.length<=yt+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-yt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,yt).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",$o="complete or remove the incomplete milestones, then mark it done",Wr=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function jt(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,$o):e}const zo="project_done_incomplete";function Go(e){const s=e.message.match(Wr),r=e.code===zo;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 Yo(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 jt(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Ho(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))}):jt(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})}Le["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,Ia)}const Ko={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")}},Wo=2,Vo=4,Qo=3,Xo=2,Jo=1,Zo=3,Pe={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},ei=/[^\p{L}\p{N}]+/u,ti=/\s+/;function Ks(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Vo;if(r.startsWith(e))return Qo;const a=r.split(ei).filter(Boolean),o=e.split(ti).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return Xo;const i=o.join("");return i.length>=Zo&&si(i,r)?Jo:0}function si(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 ri(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Pe.title],[e.name,Pe.name],[e.description,Pe.description],[e.owner,Pe.attribution],[e.team,Pe.attribution],[e.status,Pe.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)*Pe.tags;l>o&&(o=l)}return o}function ni(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=ri(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=X(o.project).localeCompare(X(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 ai(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 oi=180;function ii(e,s){const r=Qr(e),a=Tr(r,oi),o=us({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>pe({op:"projects.search",q:a,limit:La}),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 Ze=["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")}},ci=new Set(["status","progress","target","estimate","milestones","live"]),li={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"]},ui={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 se(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 ui[s]??s??""}function di(e,s){return e[s].length>0}function ct(e){return Ze.every(s=>!di(e,s))}function pi(e){return Ze.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 ge(s.target_date)===null;if(r==="overdue")return Hr(s,a);const o=ge(s.target_date);if(o===null)return!1;const i=(o-a)/Ge;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 mi(e,s,r){return ct(s)?e:e.filter(a=>Ze.every(o=>en(s,o,a,r)))}function _i(e,s,r,a){return s.filter(o=>Ze.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=>!ze.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!ze.includes(c)&&!i.includes(c));return[...ze,...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 li[e]}}function tn(e,s,r,a){const o=_i(e,s,r,a),i=ci.has(e),l=[];for(const c of fi(e,o,r)){const u=r[e].includes(c),m=o.reduce((p,f)=>p+(Zr(e,f,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 ji(e,s,r){return Ze.map(a=>tn(a,e,s,r))}const Zt="projects-sort";Le["ui.projects.project_sort.default_as_listed"];function hi(e){return gi.includes(e)}const gi=["name","status","target","estimate","milestones","live","progress"];function xi(){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&&hi(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function bi(e){try{e===null?localStorage.removeItem(Zt):localStorage.setItem(Zt,`${e.key}:${e.direction}`)}catch{}}function Xe(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 yi(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(Xe(e.key)),direction:String(ks(e.key,e.direction))})}function vi(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 ze.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 ge(e.completed_at??e.target_date)}function Qs(e){return e==="points"?0:e==="days"?1:2}function ki(e,s,r){switch(e){case"name":return X(s).localeCompare(X(r),void 0,{sensitivity:"base"});case"status":return ze.indexOf(s.status)-ze.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=X(e).localeCompare(X(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 wi(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=ki(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:Xs(e,s)}function Ni(e,s){return[...e].sort((r,a)=>wi(r,a,s))}const Te=["day","week","month","quarter"],ws={day:24,week:9,month:3,quarter:1};function Ns(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Me(e,s){return Math.round((s-e)/Ge)}function Js(e,s){return Me(e,s)+1}function Si(e,s){for(const r of Te)if(e*ws[r]<=s)return r;return Te[Te.length-1]}function Ci(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ei(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=ge(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=ge(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Ti(e){const s=[],r=[];for(const a of e)(Ci(a)?s:r).push(a);return{dated:s,undated:r}}function Ri(e){return n("ui.projects.count.undated",{count:e})}function Di(e){const{project:s}=e,r=ge(s.start_date),a=ge(s.target_date),o=ge(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 Ai(e){const s=[];for(const r of e.milestones){const a=ge(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const $t=e=>vt(new Date(e),{month:"short",timeZone:"UTC"});function me(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Oi(e){const{year:s,month:r}=me(e);return Date.UTC(s,r-1,1)}function Pi(e){const{year:s,month:r}=me(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function Mi(e){const{year:s,month:r}=me(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Ii(e){const{year:s,month:r}=me(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}=me(e);return e-(s+6)%7*Ge}const Fi=26;function qi(e,s,r){const a=[],o=(p,f,b)=>{p<e||p>s||a.push({dayMs:p,label:f,major:b})};if(r==="day"){let p=!1;for(let f=e;f<=s;f+=Ge){const{day:b}=me(f);b===1?(o(f,$t(f),!0),p=!0):p?(o(f,"",!1),p=!1):o(f,V(b,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let p=Li(e);p<=s;p+=7*Ge){if(p<e)continue;const{day:f,month:b}=me(p);me(p-7*Ge).month!==b?o(p,vt(new Date(p),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(p,V(f,{useGrouping:!1}),!1)}return a}const i=r==="month"?Oi:Mi,l=r==="month"?Pi:Ii,c=p=>{const{year:f,month:b}=me(p);if(r==="month")return b===1&&f!==me(e).year?`${$t(p)} '${V(f%100,{minimumIntegerDigits:2,useGrouping:!1})}`:$t(p);const _=Math.floor((b-1)/3)+1;return _===1&&f!==me(e).year?`Q1 '${String(f%100).padStart(2,"0")}`:`Q${_}`};o(e,c(i(e)),!0);const u=Math.ceil(Fi/ws[r]);let m=e;for(let p=l(i(e));p<=s;p=l(p))Me(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 Nt=80,St=80,Zs=64,er=8;function ts(e){return e.trim().length>Nt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:Nt}):null}function sn(e){return e.length>Qe?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:Qe}):null}function Ct(e,s){return e.trim().length>St?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:St}):null}function ss(e){return Lr.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 Ui="project_name_exists";function tr(e){return e.code===Ui?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):jt(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Bi(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 $i(e,s){const r=lt(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function zi(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 et(e){return e instanceof Dt?tr({code:e.code,message:e.message}):tr({message:e instanceof Error?e.message:""})}function nn(e){return e instanceof Dt&&(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"):et(e)}function on(e){if(!(e instanceof Error))return null;const s=e instanceof Dt?e:null;return Go({code:s?.code??null,message:e.message,detail:s?.detail})}async function Gi(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?Ho(r):an(s),refusal:r}}}Le["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Yi=({value:e,onChange:s})=>(L(),t.jsxs(He,{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(Ke,{"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(We,{})})}),t.jsx(Ve,{children:It.map(r=>t.jsx(Re,{value:r.value,children:r.label},r.value))})]})),as=6e4,os=6e3;Le["ui.projects.request_update.requesting_updates"];const Hi=400;Le["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Ki="linked but not yet in use — it becomes a recipient after the first message",sr=e=>`project-request-update-${e}`,Wi=e=>`project-request-cooldown-${e}`,Vi=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=>Lt({session_id:r.session_id,title:r.title})),Qi=e=>e.outcome==="failed"&&e.detail===Ki;function Et(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 Xi(e){const s=X({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:Et(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(Qi);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 Tt=()=>{cn+=1;for(const e of is)e()},Ji=e=>(is.add(e),()=>{is.delete(e)}),nr=()=>cn,ln=e=>Ss.has(e),un=e=>at.get(e);function Zi(e){Ss.add(e),Tt()}function ec(e){Ss.delete(e),Tt()}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),Tt())},r-a);l.unref?.(),Gt.set(e,l),Tt()}const tc=e=>/[.!?…]$/.test(e)?e:`${e}.`;function sc(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 rc(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(Et(X(e),a.untilMs-r),{id:Wi(s),duration:os});return}Zi(s);const o=sr(s);let i=!1;const l=setTimeout(()=>{i=!0,Ps(n("ui.projects.request_update.requesting_updates"),{id:o})},Hi);try{const c=await pe({op:"projects.request_update",key:s});sc(s,c);const u=Xi(c);if(u){const m={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":je(u.title,m);break;case"warning":Bn(u.title,m);break;case"error":Is(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;Is(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(tc(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),ec(s)}}function dn(){return d.useCallback(e=>{rc(e)},[])}function nc(e){d.useSyncExternalStore(Ji,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 ac(){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 oc=4,ir="board-column-move-hint",ic=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{L();const[u,m]=d.useState(ko),p=So(e,u),f=bs(e,ft),[b,_]=d.useState(null),[x,v]=d.useState(""),g=d.useRef(null),h=d.useRef(null),y=d.useRef(null),T=d.useRef(null),w=d.useRef(null),U=new Set(l),C=(k,N)=>{const D=No(p.map(F=>F.status),k,N);m(D),wo(D),v(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(se(k).label),indexOf_status____1:String(D.indexOf(k)+1),length:V(D.length,{useGrouping:!1})}))},E=(k,N)=>{const D=g.current;if(!D)return 0;let F=0;const B=D.querySelectorAll("[data-board-column]");for(const $ of B){if($.dataset.boardColumn===N)continue;const ie=$.getBoundingClientRect();k>(ie.left+ie.right)/2&&(F+=1)}return F},P=(k,N)=>{const D=p.filter($=>$.status!==k),F=D[N-1]?.status,B=D[N]?.status;return F&&B?n("ui.projects.project_board.between_label_and_label_2",{label:String(se(F).label),label_2:String(se(B).label)}):B?n("ui.projects.project_board.before_label",{label:String(se(B).label)}):F?n("ui.projects.project_board.after_label",{label:String(se(F).label)}):n("ui.projects.project_board.in_place")},j=(k,N)=>{const D=E(k,N.status);D!==N.over&&(N.over=D,_({status:N.status,over:D}),v(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(se(N.status).label),status__over:String(P(N.status,D))})))},O=()=>{T.current!==null&&(cancelAnimationFrame(T.current),T.current=null)},R=32,I=12,Y=()=>{T.current=null;const k=w.current,N=g.current,D=y.current;if(!k?.armed||!N||D===null)return;const F=N.getBoundingClientRect(),B=N.scrollWidth-N.clientWidth;let $=0;if(D-F.left<R&&N.scrollLeft>0?$=-1:F.right-D<R&&N.scrollLeft<B&&($=1),$!==0){const ie=N.scrollLeft;N.scrollLeft=ie+$*I,N.scrollLeft!==ie&&j(D,k)}else j(D,k);Z(k.status,k.over),T.current=requestAnimationFrame(Y)};d.useEffect(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);const q=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}w.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:p.findIndex(D=>D.status===N)},y.current=k.clientX}},G=k=>{const N=w.current;if(!(!N||k.pointerId!==N.pointerId)){if(y.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<oc)return;N.armed=!0,_({status:N.status,over:N.over}),v(n("ui.projects.project_board.moving_label_column",{label:String(se(N.status).label)})),T.current===null&&(T.current=requestAnimationFrame(Y))}j(k.clientX,N)}},W=k=>{const N=w.current;if(w.current=null,O(),_(null),!N?.armed)return;if(!k){v(n("ui.projects.project_board.move_cancelled"));return}const D=p.findIndex(F=>F.status===N.status);if(N.over===D){v("");return}C(N.status,N.over)},J=k=>{const N=w.current;!N||k.pointerId!==N.pointerId||W(!0)},de=()=>{W(!1)};d.useEffect(()=>{if(!b)return;const k=N=>{N.key==="Escape"&&W(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[b!==null]);const Z=d.useCallback((k,N)=>{const D=g.current,F=h.current;if(!D||!F)return;const B=D.getBoundingClientRect(),$=[];for(const ce of D.querySelectorAll("[data-board-column]"))ce.dataset.boardColumn!==k&&$.push(ce.getBoundingClientRect());const ie=6,Ae=N>=$.length?($[$.length-1]?.right??B.left)+ie:($[N]?.left??B.right)-ie,H=D.scrollLeft,Ce=2,be=Ae-B.left+H,fe=H+1,te=H+B.width-Ce-1,Oe=Math.round(Math.min(Math.max(be,fe),Math.max(fe,te)));F.style.left=`${Oe}px`},[]);d.useLayoutEffect(()=>{b&&Z(b.status,b.over)},[b,Z]);const ee=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const D=p.map($=>$.status),F=D.indexOf(N),B=k.key==="ArrowLeft"?F-1:F+1;if(B<0||B>=D.length){v(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(se(N).label),the_last_column:String(B<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}C(N,B)};return t.jsxs("div",{className:"[container-type:size] flex min-h-0 flex-1 flex-col","data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children: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.jsxs("div",{ref:g,"data-board-strip":"",className:M("relative flex min-h-0 flex-1 items-start overflow-auto px-6 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:h,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsxs("div",{className:"flex w-max flex-col",children:[t.jsx("div",{className:"sticky top-0 z-30 flex gap-3",children:p.map(k=>{const N=se(k.status);return t.jsxs("header",{"data-board-column":k.status,"data-board-column-handle":k.status,onPointerDown:D=>q(D,k.status),onPointerMove:G,onPointerUp:J,onPointerCancel:de,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===k.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(z,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":k.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(N.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:D=>ee(D,k.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:N.label}),or[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:or[k.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:k.projects.length})]},k.status)})}),f.map(k=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":k.team??"",className:"sticky top-11 z-20 flex h-8 items-center bg-canvas px-3 text-meta",children:t.jsxs("span",{className:"sticky left-3 flex min-w-0 max-w-[calc(100cqw-2.25rem)] items-center gap-2",children:[t.jsx("span",{className:"truncate text-ink",children:k.team==null?n("ui.projects.project_model.no_team"):c(k.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:k.items.length})]})}),t.jsx("div",{"data-glass-well":"clear",className:"flex gap-3 rounded-md bg-sunken py-2",children:p.map(N=>{const D=k.items.filter(F=>F.status===N.status);return t.jsx("div",{"data-board-cell":N.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:D.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:D.map(F=>t.jsx("li",{children:t.jsx(cc,{project:F,nowMs:s,busy:U.has(F.id),onOpen:()=>r(F),onEdit:()=>a(F),onDelete:()=>o(F),onMove:B=>i(F,B)})},F.id))})},N.status)})})]},k.team??""))]})]})]})},cc=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=L(),u=Br(e,c),m=Je(),p=dn(),f=he(m.data,"projects_request_update"),b=X(e),_=d.useRef(null),[x,v]=d.useState(!1);d.useEffect(()=>{const w=_.current;if(!w)return;const U=()=>{w.isConnected&&v(w.scrollWidth-w.clientWidth>.5)},C=requestAnimationFrame(U),E=new ResizeObserver(U);return E.observe(w),document.fonts?.ready.then(U).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[b,x]);const g=Hr(e,Ns(s)),h=mt(e.progress_updated_at,s),y=()=>{const w=window.getSelection();w&&!w.isCollapsed||a()},T=w=>{w.key!=="Enter"&&w.key!==" "||w.target===w.currentTarget&&(w.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":n("ui.projects.project_board.open_displayname",{displayName:String(b)}),onClick:y,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:_,"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:w=>w.stopPropagation(),className:M("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Se,{size:"xs"}):t.jsx(yr,{className:"size-4"})}),t.jsxs(_s,{align:"end",onClick:w=>w.stopPropagation(),children:[t.jsx(Ne,{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(w=>t.jsx(Na,{value:w,children:se(w).label},w))})})]}),f&&t.jsx(Ne,{onSelect:()=>p(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Sa,{}),t.jsx(Ne,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(Ne,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(w=>w.key!=="live").map(w=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:w.text},w.key)),g&&t.jsx(xe,{variant:"warning",children: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:lo(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(lc,{project:e})]})]})]})},lc=({project:e})=>{L();const[s,r]=d.useState(!1),a=At(),o=Ar(e.id,s),i=o.data?.links??[],l=_o(e),c=X(e);return t.jsxs(fs,{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(z,{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})=>{L();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 f=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),c(null);try{await a(o.trim()),r()}catch(_){c(_ instanceof Error&&_.message?_.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(Ye,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(zn,{onClick:()=>void b(),disabled:!f||u,children:[u&&t.jsx(Se,{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(oe,{id:`${p}-confirm`,value:o,onChange:_=>i(_.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!f,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function uc(e){return e==="editing"||e==="saving"||e==="error"}function dc(e,s,r=Object.is){return!r(e,s)}function pc(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 mc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function _c(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-['']",jc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",hc="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=mc(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,jc,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(Se,{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,hc,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})=>{L();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),gc=50,xc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),gc)}}),[]);return t.jsxs(mn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},bc=1200;function yc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function ht(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=bc,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 f=d.useRef(e.errorCopy);f.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const _=d.useRef(e.onBegin);_.current=e.onBegin;const x=d.useRef(c);x.current=c;const[v,g]=d.useState(i?"editing":"idle"),[h,y]=d.useState(s),[T,w]=d.useState(s),[U,C]=d.useState(null),[E,P]=d.useState(null),j=d.useRef(v),O=d.useRef(h),R=d.useRef(T),I=d.useRef(U),Y=d.useRef(s);Y.current=s;const q=d.useCallback(A=>{j.current=A,g(A)},[]),G=d.useCallback(A=>{O.current=A,y(A)},[]),W=d.useCallback(A=>{R.current=A,w(A)},[]),J=d.useCallback(A=>{I.current=A,C(A)},[]),de=d.useRef(null),Z=d.useRef(null),ee=d.useRef(null),k=e.editorRef??ee,N=d.useRef(k);N.current=k;const D=`${d.useId()}-inline-edit`,F=d.useContext(mn),B=d.useRef(null),$=B.current,Ae=$!==null&&(e.equals??Object.is)(s,$.previous)&&!(e.equals??Object.is)(s,$.saved)&&$!==null?$.saved:s,H=d.useRef(Ae);H.current=Ae,d.useEffect(()=>{const A=B.current;if(A===null)return;const ne=u.current;(ne(s,A.saved)||!ne(s,A.previous))&&(B.current=null)},[s]);const Ce=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!Ce.current)return;Ce.current=!1;const A=N.current.current;A&&(A.focus(),o&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[v,o]);const be=d.useRef(!1);d.useEffect(()=>{be.current&&(v!=="idle"&&v!=="saved"||(be.current=!1,Z.current?.focus()))});const fe=d.useRef(null),te=d.useCallback(()=>{fe.current!==null&&(clearTimeout(fe.current),fe.current=null)},[]);d.useEffect(()=>()=>te(),[te]);const Oe=d.useRef(v);d.useEffect(()=>{const A=Oe.current;if(Oe.current=v,A==="saving"&&v==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const A=_c({phase:j.current,base:R.current,draft:O.current,fresh:H.current,equals:u.current});A==="adopt"?(u.current(R.current,H.current)||W(H.current),u.current(H.current,O.current)||G(H.current)):A==="conflict"&&(I.current===null||!u.current(I.current,H.current))&&J(H.current)},[s,v,W,G,J]);const ce=d.useCallback(A=>{J(null),P(null),G(R.current),q("idle"),A&&(be.current=!0)},[J,G,q]),tt=d.useCallback(()=>{j.current!=="saving"&&(j.current==="idle"||j.current==="saved"||(te(),ce(!0)))},[te,ce]),re=d.useCallback((A,ne=!0)=>{const nt=j.current;if(nt==="saving"||nt==="saved"||I.current!==null)return;const ye=A!==void 0?A:O.current;if(!cr(R.current,ye,u.current)){ce(ne&&nt!=="idle");return}const xt=p.current?.(ye)??null;if(xt!==null){q("error"),P(xt);return}G(ye),P(null),q("saving"),m.current(ye).then(()=>{j.current==="saving"&&(B.current={saved:ye,previous:R.current},W(ye),G(ye),ne&&(be.current=!0),q("saved"),te(),fe.current=setTimeout(()=>{fe.current=null,j.current==="saved"&&q("idle")},l),F?.current?.(x.current.saved))},Be=>{j.current==="saving"&&(q("error"),P(f.current?f.current(Be):yc(Be)))})},[F,te,ce,l,W,G,q]),Ee=d.useCallback(()=>{j.current==="editing"||j.current==="saving"||(te(),Ce.current=!0,G(H.current),W(H.current),J(null),P(null),q("editing"),_.current?.())},[te,W,J,G,q]),Ue=d.useCallback(()=>{const A=I.current;A!==null&&(J(null),W(A),re())},[re,W,J]),qt=d.useCallback(()=>{const A=I.current;A!==null&&(W(A),ce(!0))},[ce,W]),st=d.useCallback(A=>{const ne=pc(A,{multiline:r,keyboardCommit:a,onEditor:A.target===N.current.current});if(ne==="revert"){A.preventDefault(),tt();return}ne==="accept"&&(A.preventDefault(),re())},[re,tt,a,r]),rt=d.useCallback(A=>{if(j.current!=="editing")return;const ne=A.relatedTarget;if(!(ne!==null&&de.current?.contains(ne))&&!(ne instanceof Element&&ne.closest("[data-radix-popper-content-wrapper]")!==null)&&I.current===null){if(!cr(R.current,O.current,u.current)){ce(!1);return}re(void 0,!1)}},[re,ce]),gt=v==="saved"?h:Ae;return{phase:v,dirty:dc(T,h,u.current),conflict:U,error:E,draft:h,setDraft:G,displayValue:gt,editing:uc(v),begin:Ee,accept:re,cancel:tt,keepMine:Ue,useTheirs:qt,handleKeyDown:st,handleBlur:rt,fieldProps:{onKeyDown:st,onBlur:rt,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||U!==null?D:void 0},fieldRef:de,editorRef:k,slotRef:Z,feedbackId:D,labels:c}}const vc=/^(https?:|mailto:)/i,kc={a:({href:e,children:s})=>typeof e=="string"&&vc.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:kc,children:e})})),lr=`## Summary
|
|
27
|
+
`)}function Uo(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 Bo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Kr(e){const s=[];for(const r of e.matchAll(Bo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const yt=3;function ys(e){if(e.length<=yt+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-yt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,yt).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",$o="complete or remove the incomplete milestones, then mark it done",Wr=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function jt(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,$o):e}const zo="project_done_incomplete";function Go(e){const s=e.message.match(Wr),r=e.code===zo;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 Yo(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 jt(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Ho(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))}):jt(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})}Le["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,Ia)}const Ko={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")}},Wo=2,Vo=4,Qo=3,Xo=2,Jo=1,Zo=3,Pe={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},ei=/[^\p{L}\p{N}]+/u,ti=/\s+/;function Ks(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Vo;if(r.startsWith(e))return Qo;const a=r.split(ei).filter(Boolean),o=e.split(ti).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return Xo;const i=o.join("");return i.length>=Zo&&si(i,r)?Jo:0}function si(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 ri(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Pe.title],[e.name,Pe.name],[e.description,Pe.description],[e.owner,Pe.attribution],[e.team,Pe.attribution],[e.status,Pe.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)*Pe.tags;l>o&&(o=l)}return o}function ni(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=ri(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=X(o.project).localeCompare(X(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 ai(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 oi=180;function ii(e,s){const r=Qr(e),a=Tr(r,oi),o=us({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>pe({op:"projects.search",q:a,limit:La}),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 Ze=["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")}},ci=new Set(["status","progress","target","estimate","milestones","live"]),li={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"]},ui={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 se(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 ui[s]??s??""}function di(e,s){return e[s].length>0}function ct(e){return Ze.every(s=>!di(e,s))}function pi(e){return Ze.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 ge(s.target_date)===null;if(r==="overdue")return Hr(s,a);const o=ge(s.target_date);if(o===null)return!1;const i=(o-a)/Ge;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 mi(e,s,r){return ct(s)?e:e.filter(a=>Ze.every(o=>en(s,o,a,r)))}function _i(e,s,r,a){return s.filter(o=>Ze.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=>!ze.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!ze.includes(c)&&!i.includes(c));return[...ze,...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 li[e]}}function tn(e,s,r,a){const o=_i(e,s,r,a),i=ci.has(e),l=[];for(const c of fi(e,o,r)){const u=r[e].includes(c),m=o.reduce((p,f)=>p+(Zr(e,f,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 ji(e,s,r){return Ze.map(a=>tn(a,e,s,r))}const Zt="projects-sort";Le["ui.projects.project_sort.default_as_listed"];function hi(e){return gi.includes(e)}const gi=["name","status","target","estimate","milestones","live","progress"];function xi(){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&&hi(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function bi(e){try{e===null?localStorage.removeItem(Zt):localStorage.setItem(Zt,`${e.key}:${e.direction}`)}catch{}}function Xe(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 yi(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(Xe(e.key)),direction:String(ks(e.key,e.direction))})}function vi(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 ze.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 ge(e.completed_at??e.target_date)}function Qs(e){return e==="points"?0:e==="days"?1:2}function ki(e,s,r){switch(e){case"name":return X(s).localeCompare(X(r),void 0,{sensitivity:"base"});case"status":return ze.indexOf(s.status)-ze.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=X(e).localeCompare(X(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 wi(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=ki(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:Xs(e,s)}function Ni(e,s){return[...e].sort((r,a)=>wi(r,a,s))}const Te=["day","week","month","quarter"],ws={day:24,week:9,month:3,quarter:1};function Ns(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Me(e,s){return Math.round((s-e)/Ge)}function Js(e,s){return Me(e,s)+1}function Si(e,s){for(const r of Te)if(e*ws[r]<=s)return r;return Te[Te.length-1]}function Ci(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ei(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=ge(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=ge(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Ti(e){const s=[],r=[];for(const a of e)(Ci(a)?s:r).push(a);return{dated:s,undated:r}}function Ri(e){return n("ui.projects.count.undated",{count:e})}function Di(e){const{project:s}=e,r=ge(s.start_date),a=ge(s.target_date),o=ge(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 Ai(e){const s=[];for(const r of e.milestones){const a=ge(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const $t=e=>vt(new Date(e),{month:"short",timeZone:"UTC"});function me(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Oi(e){const{year:s,month:r}=me(e);return Date.UTC(s,r-1,1)}function Pi(e){const{year:s,month:r}=me(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function Mi(e){const{year:s,month:r}=me(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Ii(e){const{year:s,month:r}=me(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}=me(e);return e-(s+6)%7*Ge}const Fi=26;function qi(e,s,r){const a=[],o=(p,f,b)=>{p<e||p>s||a.push({dayMs:p,label:f,major:b})};if(r==="day"){let p=!1;for(let f=e;f<=s;f+=Ge){const{day:b}=me(f);b===1?(o(f,$t(f),!0),p=!0):p?(o(f,"",!1),p=!1):o(f,V(b,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let p=Li(e);p<=s;p+=7*Ge){if(p<e)continue;const{day:f,month:b}=me(p);me(p-7*Ge).month!==b?o(p,vt(new Date(p),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(p,V(f,{useGrouping:!1}),!1)}return a}const i=r==="month"?Oi:Mi,l=r==="month"?Pi:Ii,c=p=>{const{year:f,month:b}=me(p);if(r==="month")return b===1&&f!==me(e).year?`${$t(p)} '${V(f%100,{minimumIntegerDigits:2,useGrouping:!1})}`:$t(p);const _=Math.floor((b-1)/3)+1;return _===1&&f!==me(e).year?`Q1 '${String(f%100).padStart(2,"0")}`:`Q${_}`};o(e,c(i(e)),!0);const u=Math.ceil(Fi/ws[r]);let m=e;for(let p=l(i(e));p<=s;p=l(p))Me(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 Nt=80,St=80,Zs=64,er=8;function ts(e){return e.trim().length>Nt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:Nt}):null}function sn(e){return e.length>Qe?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:Qe}):null}function Ct(e,s){return e.trim().length>St?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:St}):null}function ss(e){return Lr.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 Ui="project_name_exists";function tr(e){return e.code===Ui?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):jt(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Bi(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 $i(e,s){const r=lt(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function zi(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 et(e){return e instanceof Dt?tr({code:e.code,message:e.message}):tr({message:e instanceof Error?e.message:""})}function nn(e){return e instanceof Dt&&(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"):et(e)}function on(e){if(!(e instanceof Error))return null;const s=e instanceof Dt?e:null;return Go({code:s?.code??null,message:e.message,detail:s?.detail})}async function Gi(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?Ho(r):an(s),refusal:r}}}Le["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Yi=({value:e,onChange:s})=>(L(),t.jsxs(He,{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(Ke,{"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(We,{})})}),t.jsx(Ve,{children:It.map(r=>t.jsx(Re,{value:r.value,children:r.label},r.value))})]})),as=6e4,os=6e3;Le["ui.projects.request_update.requesting_updates"];const Hi=400;Le["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Ki="linked but not yet in use — it becomes a recipient after the first message",sr=e=>`project-request-update-${e}`,Wi=e=>`project-request-cooldown-${e}`,Vi=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=>Lt({session_id:r.session_id,title:r.title})),Qi=e=>e.outcome==="failed"&&e.detail===Ki;function Et(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 Xi(e){const s=X({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:Et(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(Qi);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 Tt=()=>{cn+=1;for(const e of is)e()},Ji=e=>(is.add(e),()=>{is.delete(e)}),nr=()=>cn,ln=e=>Ss.has(e),un=e=>at.get(e);function Zi(e){Ss.add(e),Tt()}function ec(e){Ss.delete(e),Tt()}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),Tt())},r-a);l.unref?.(),Gt.set(e,l),Tt()}const tc=e=>/[.!?…]$/.test(e)?e:`${e}.`;function sc(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 rc(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(Et(X(e),a.untilMs-r),{id:Wi(s),duration:os});return}Zi(s);const o=sr(s);let i=!1;const l=setTimeout(()=>{i=!0,Ps(n("ui.projects.request_update.requesting_updates"),{id:o})},Hi);try{const c=await pe({op:"projects.request_update",key:s});sc(s,c);const u=Xi(c);if(u){const m={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":je(u.title,m);break;case"warning":Bn(u.title,m);break;case"error":Is(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;Is(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(tc(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),ec(s)}}function dn(){return d.useCallback(e=>{rc(e)},[])}function nc(e){d.useSyncExternalStore(Ji,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 ac(){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 oc=4,ir="board-column-move-hint",ic=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{L();const[u,m]=d.useState(ko),p=So(e,u),f=bs(e,ft),[b,_]=d.useState(null),[x,v]=d.useState(""),g=d.useRef(null),h=d.useRef(null),y=d.useRef(null),T=d.useRef(null),w=d.useRef(null),U=new Set(l),C=(k,N)=>{const D=No(p.map(F=>F.status),k,N);m(D),wo(D),v(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(se(k).label),indexOf_status____1:String(D.indexOf(k)+1),length:V(D.length,{useGrouping:!1})}))},E=(k,N)=>{const D=g.current;if(!D)return 0;let F=0;const B=D.querySelectorAll("[data-board-column]");for(const $ of B){if($.dataset.boardColumn===N)continue;const ie=$.getBoundingClientRect();k>(ie.left+ie.right)/2&&(F+=1)}return F},P=(k,N)=>{const D=p.filter($=>$.status!==k),F=D[N-1]?.status,B=D[N]?.status;return F&&B?n("ui.projects.project_board.between_label_and_label_2",{label:String(se(F).label),label_2:String(se(B).label)}):B?n("ui.projects.project_board.before_label",{label:String(se(B).label)}):F?n("ui.projects.project_board.after_label",{label:String(se(F).label)}):n("ui.projects.project_board.in_place")},j=(k,N)=>{const D=E(k,N.status);D!==N.over&&(N.over=D,_({status:N.status,over:D}),v(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(se(N.status).label),status__over:String(P(N.status,D))})))},O=()=>{T.current!==null&&(cancelAnimationFrame(T.current),T.current=null)},R=32,I=12,Y=()=>{T.current=null;const k=w.current,N=g.current,D=y.current;if(!k?.armed||!N||D===null)return;const F=N.getBoundingClientRect(),B=N.scrollWidth-N.clientWidth;let $=0;if(D-F.left<R&&N.scrollLeft>0?$=-1:F.right-D<R&&N.scrollLeft<B&&($=1),$!==0){const ie=N.scrollLeft;N.scrollLeft=ie+$*I,N.scrollLeft!==ie&&j(D,k)}else j(D,k);Z(k.status,k.over),T.current=requestAnimationFrame(Y)};d.useEffect(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);const q=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}w.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:p.findIndex(D=>D.status===N)},y.current=k.clientX}},G=k=>{const N=w.current;if(!(!N||k.pointerId!==N.pointerId)){if(y.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<oc)return;N.armed=!0,_({status:N.status,over:N.over}),v(n("ui.projects.project_board.moving_label_column",{label:String(se(N.status).label)})),T.current===null&&(T.current=requestAnimationFrame(Y))}j(k.clientX,N)}},W=k=>{const N=w.current;if(w.current=null,O(),_(null),!N?.armed)return;if(!k){v(n("ui.projects.project_board.move_cancelled"));return}const D=p.findIndex(F=>F.status===N.status);if(N.over===D){v("");return}C(N.status,N.over)},J=k=>{const N=w.current;!N||k.pointerId!==N.pointerId||W(!0)},de=()=>{W(!1)};d.useEffect(()=>{if(!b)return;const k=N=>{N.key==="Escape"&&W(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[b!==null]);const Z=d.useCallback((k,N)=>{const D=g.current,F=h.current;if(!D||!F)return;const B=D.getBoundingClientRect(),$=[];for(const ce of D.querySelectorAll("[data-board-column]"))ce.dataset.boardColumn!==k&&$.push(ce.getBoundingClientRect());const ie=6,Ae=N>=$.length?($[$.length-1]?.right??B.left)+ie:($[N]?.left??B.right)-ie,H=D.scrollLeft,Ce=2,be=Ae-B.left+H,fe=H+1,te=H+B.width-Ce-1,Oe=Math.round(Math.min(Math.max(be,fe),Math.max(fe,te)));F.style.left=`${Oe}px`},[]);d.useLayoutEffect(()=>{b&&Z(b.status,b.over)},[b,Z]);const ee=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const D=p.map($=>$.status),F=D.indexOf(N),B=k.key==="ArrowLeft"?F-1:F+1;if(B<0||B>=D.length){v(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(se(N).label),the_last_column:String(B<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}C(N,B)};return t.jsxs("div",{className:"[container-type:size] flex min-h-0 flex-1 flex-col","data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children: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.jsxs("div",{ref:g,"data-board-strip":"",className:M("relative flex min-h-0 flex-1 items-start overflow-auto px-6 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:h,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsxs("div",{className:"flex w-max flex-col",children:[t.jsx("div",{className:"sticky top-0 z-30 flex gap-3",children:p.map(k=>{const N=se(k.status);return t.jsxs("header",{"data-board-column":k.status,"data-glass-lane":"","data-board-column-handle":k.status,onPointerDown:D=>q(D,k.status),onPointerMove:G,onPointerUp:J,onPointerCancel:de,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===k.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(z,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":k.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(N.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:D=>ee(D,k.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:N.label}),or[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:or[k.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:k.projects.length})]},k.status)})}),f.map(k=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":k.team??"",className:"sticky top-11 z-20 flex h-8 items-center bg-canvas px-3 text-meta",children:t.jsxs("span",{className:"sticky left-3 flex min-w-0 max-w-[calc(100cqw-2.25rem)] items-center gap-2",children:[t.jsx("span",{className:"truncate text-ink",children:k.team==null?n("ui.projects.project_model.no_team"):c(k.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:k.items.length})]})}),t.jsx("div",{"data-glass-lane":"",className:"flex gap-3 rounded-md bg-sunken py-2",children:p.map(N=>{const D=k.items.filter(F=>F.status===N.status);return t.jsx("div",{"data-board-cell":N.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:D.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:D.map(F=>t.jsx("li",{children:t.jsx(cc,{project:F,nowMs:s,busy:U.has(F.id),onOpen:()=>r(F),onEdit:()=>a(F),onDelete:()=>o(F),onMove:B=>i(F,B)})},F.id))})},N.status)})})]},k.team??""))]})]})]})},cc=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=L(),u=Br(e,c),m=Je(),p=dn(),f=he(m.data,"projects_request_update"),b=X(e),_=d.useRef(null),[x,v]=d.useState(!1);d.useEffect(()=>{const w=_.current;if(!w)return;const U=()=>{w.isConnected&&v(w.scrollWidth-w.clientWidth>.5)},C=requestAnimationFrame(U),E=new ResizeObserver(U);return E.observe(w),document.fonts?.ready.then(U).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[b,x]);const g=Hr(e,Ns(s)),h=mt(e.progress_updated_at,s),y=()=>{const w=window.getSelection();w&&!w.isCollapsed||a()},T=w=>{w.key!=="Enter"&&w.key!==" "||w.target===w.currentTarget&&(w.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":n("ui.projects.project_board.open_displayname",{displayName:String(b)}),onClick:y,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:_,"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:w=>w.stopPropagation(),className:M("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Se,{size:"xs"}):t.jsx(yr,{className:"size-4"})}),t.jsxs(_s,{align:"end",onClick:w=>w.stopPropagation(),children:[t.jsx(Ne,{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(w=>t.jsx(Na,{value:w,children:se(w).label},w))})})]}),f&&t.jsx(Ne,{onSelect:()=>p(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Sa,{}),t.jsx(Ne,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(Ne,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(w=>w.key!=="live").map(w=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:w.text},w.key)),g&&t.jsx(xe,{variant:"warning",children: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:lo(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(lc,{project:e})]})]})]})},lc=({project:e})=>{L();const[s,r]=d.useState(!1),a=At(),o=Ar(e.id,s),i=o.data?.links??[],l=_o(e),c=X(e);return t.jsxs(fs,{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(z,{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})=>{L();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 f=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),c(null);try{await a(o.trim()),r()}catch(_){c(_ instanceof Error&&_.message?_.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(Ye,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(zn,{onClick:()=>void b(),disabled:!f||u,children:[u&&t.jsx(Se,{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(oe,{id:`${p}-confirm`,value:o,onChange:_=>i(_.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!f,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function uc(e){return e==="editing"||e==="saving"||e==="error"}function dc(e,s,r=Object.is){return!r(e,s)}function pc(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 mc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function _c(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-['']",jc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",hc="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=mc(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,jc,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(Se,{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,hc,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})=>{L();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),gc=50,xc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),gc)}}),[]);return t.jsxs(mn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},bc=1200;function yc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function ht(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=bc,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 f=d.useRef(e.errorCopy);f.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const _=d.useRef(e.onBegin);_.current=e.onBegin;const x=d.useRef(c);x.current=c;const[v,g]=d.useState(i?"editing":"idle"),[h,y]=d.useState(s),[T,w]=d.useState(s),[U,C]=d.useState(null),[E,P]=d.useState(null),j=d.useRef(v),O=d.useRef(h),R=d.useRef(T),I=d.useRef(U),Y=d.useRef(s);Y.current=s;const q=d.useCallback(A=>{j.current=A,g(A)},[]),G=d.useCallback(A=>{O.current=A,y(A)},[]),W=d.useCallback(A=>{R.current=A,w(A)},[]),J=d.useCallback(A=>{I.current=A,C(A)},[]),de=d.useRef(null),Z=d.useRef(null),ee=d.useRef(null),k=e.editorRef??ee,N=d.useRef(k);N.current=k;const D=`${d.useId()}-inline-edit`,F=d.useContext(mn),B=d.useRef(null),$=B.current,Ae=$!==null&&(e.equals??Object.is)(s,$.previous)&&!(e.equals??Object.is)(s,$.saved)&&$!==null?$.saved:s,H=d.useRef(Ae);H.current=Ae,d.useEffect(()=>{const A=B.current;if(A===null)return;const ne=u.current;(ne(s,A.saved)||!ne(s,A.previous))&&(B.current=null)},[s]);const Ce=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!Ce.current)return;Ce.current=!1;const A=N.current.current;A&&(A.focus(),o&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[v,o]);const be=d.useRef(!1);d.useEffect(()=>{be.current&&(v!=="idle"&&v!=="saved"||(be.current=!1,Z.current?.focus()))});const fe=d.useRef(null),te=d.useCallback(()=>{fe.current!==null&&(clearTimeout(fe.current),fe.current=null)},[]);d.useEffect(()=>()=>te(),[te]);const Oe=d.useRef(v);d.useEffect(()=>{const A=Oe.current;if(Oe.current=v,A==="saving"&&v==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const A=_c({phase:j.current,base:R.current,draft:O.current,fresh:H.current,equals:u.current});A==="adopt"?(u.current(R.current,H.current)||W(H.current),u.current(H.current,O.current)||G(H.current)):A==="conflict"&&(I.current===null||!u.current(I.current,H.current))&&J(H.current)},[s,v,W,G,J]);const ce=d.useCallback(A=>{J(null),P(null),G(R.current),q("idle"),A&&(be.current=!0)},[J,G,q]),tt=d.useCallback(()=>{j.current!=="saving"&&(j.current==="idle"||j.current==="saved"||(te(),ce(!0)))},[te,ce]),re=d.useCallback((A,ne=!0)=>{const nt=j.current;if(nt==="saving"||nt==="saved"||I.current!==null)return;const ye=A!==void 0?A:O.current;if(!cr(R.current,ye,u.current)){ce(ne&&nt!=="idle");return}const xt=p.current?.(ye)??null;if(xt!==null){q("error"),P(xt);return}G(ye),P(null),q("saving"),m.current(ye).then(()=>{j.current==="saving"&&(B.current={saved:ye,previous:R.current},W(ye),G(ye),ne&&(be.current=!0),q("saved"),te(),fe.current=setTimeout(()=>{fe.current=null,j.current==="saved"&&q("idle")},l),F?.current?.(x.current.saved))},Be=>{j.current==="saving"&&(q("error"),P(f.current?f.current(Be):yc(Be)))})},[F,te,ce,l,W,G,q]),Ee=d.useCallback(()=>{j.current==="editing"||j.current==="saving"||(te(),Ce.current=!0,G(H.current),W(H.current),J(null),P(null),q("editing"),_.current?.())},[te,W,J,G,q]),Ue=d.useCallback(()=>{const A=I.current;A!==null&&(J(null),W(A),re())},[re,W,J]),qt=d.useCallback(()=>{const A=I.current;A!==null&&(W(A),ce(!0))},[ce,W]),st=d.useCallback(A=>{const ne=pc(A,{multiline:r,keyboardCommit:a,onEditor:A.target===N.current.current});if(ne==="revert"){A.preventDefault(),tt();return}ne==="accept"&&(A.preventDefault(),re())},[re,tt,a,r]),rt=d.useCallback(A=>{if(j.current!=="editing")return;const ne=A.relatedTarget;if(!(ne!==null&&de.current?.contains(ne))&&!(ne instanceof Element&&ne.closest("[data-radix-popper-content-wrapper]")!==null)&&I.current===null){if(!cr(R.current,O.current,u.current)){ce(!1);return}re(void 0,!1)}},[re,ce]),gt=v==="saved"?h:Ae;return{phase:v,dirty:dc(T,h,u.current),conflict:U,error:E,draft:h,setDraft:G,displayValue:gt,editing:uc(v),begin:Ee,accept:re,cancel:tt,keepMine:Ue,useTheirs:qt,handleKeyDown:st,handleBlur:rt,fieldProps:{onKeyDown:st,onBlur:rt,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||U!==null?D:void 0},fieldRef:de,editorRef:k,slotRef:Z,feedbackId:D,labels:c}}const vc=/^(https?:|mailto:)/i,kc={a:({href:e,children:s})=>typeof e=="string"&&vc.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:kc,children:e})})),lr=`## Summary
|
|
28
28
|
|
|
29
29
|
## Goals
|
|
30
30
|
|
|
@@ -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-CO6CiDf8.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-wu8ubztI.js";import{l as S,a as E}from"./use-memberships-query-BZiimzLs.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-GlFEQKuo.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-Dz1Kg_SA.js";import{l as S,a as E}from"./use-memberships-query-TOFQHH-q.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-
|
|
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-DmdT5IgP.js";import{v as $t}from"./conversation-input-sync-GlFEQKuo.js";import"./index-Cj2bZws8.js";import"./ui-preferences-store-Dz1Kg_SA.js";import"./error-boundary-CLT6U8jT.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()+`
|