@whoz-oss/coday-client 3.17.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/browser/chunk--yaU4Sri.js +1 -0
  2. package/browser/{chunk-ClSDInQq.js → chunk-4uEZjTft.js} +1 -1
  3. package/browser/chunk-4v7WiOTx.js +1 -0
  4. package/browser/chunk-B-UKlpjJ.js +1 -0
  5. package/browser/chunk-B13_C_P9.js +675 -0
  6. package/browser/chunk-B17Inq8D.js +2 -0
  7. package/browser/chunk-B1vuv-dv.js +1 -0
  8. package/browser/{chunk-DqC8XT4v.js → chunk-BEdQqXxw.js} +1 -1
  9. package/browser/{chunk-DMtXGu5h.js → chunk-BGTRsbsl.js} +1 -1
  10. package/browser/{chunk-DHb3-uKf.js → chunk-BHiaH1Jm.js} +1 -1
  11. package/browser/chunk-BJld3zB5.js +9 -0
  12. package/browser/{chunk-BPfJALqU.js → chunk-BVmICoo4.js} +1 -1
  13. package/browser/chunk-BXCHG0wB.js +1 -0
  14. package/browser/{chunk-LVItL87L.js → chunk-B_Sx6nwb.js} +1 -1
  15. package/browser/{chunk-D202v_ff.js → chunk-BbPMe8u2.js} +1 -1
  16. package/browser/{chunk-Bu5Xq3QT.js → chunk-Bb_J3EoX.js} +1 -1
  17. package/browser/{chunk-BkN5jb4J.js → chunk-BfE6wTUj.js} +1 -1
  18. package/browser/chunk-Bnj9Hkqy.js +276 -0
  19. package/browser/chunk-BqWEyotW.js +55 -0
  20. package/browser/{chunk-BXkvjekT.js → chunk-Buu9Jf-V.js} +2 -2
  21. package/browser/{chunk-Brx_KbnM.js → chunk-CJAdjOmi.js} +1 -1
  22. package/browser/{chunk-DjoW6kqa.js → chunk-CJEW8Ogd.js} +5 -5
  23. package/browser/chunk-CM1_Z4h5.js +1 -0
  24. package/browser/{chunk-Bgd8Jkga.js → chunk-CP3b1EMm.js} +1 -1
  25. package/browser/chunk-CR817PBg.js +1 -0
  26. package/browser/{chunk-bfpuueWC.js → chunk-CXgj_KJY.js} +3 -3
  27. package/browser/{chunk-CxUcyBb9.js → chunk-CakkML6n.js} +1 -1
  28. package/browser/{chunk-mrKeqPKc.js → chunk-CfPmQ0Fw.js} +1 -1
  29. package/browser/chunk-CgNkwpQ7.js +508 -0
  30. package/browser/chunk-Cjk-zAXy.js +1 -0
  31. package/browser/chunk-ClCDsg8D.js +5 -0
  32. package/browser/{chunk-CKhGzoqa.js → chunk-CmyT-Z4A.js} +1 -1
  33. package/browser/{chunk-EBW8PloQ.js → chunk-CqJ7rGVY.js} +1 -1
  34. package/browser/{chunk-Ci9l-k84.js → chunk-CxpHnwnx.js} +1 -1
  35. package/browser/{chunk-DFQuWS_F.js → chunk-D1ZnLng-.js} +1 -1
  36. package/browser/{chunk-DO3lSvop.js → chunk-D26Y186i.js} +1 -1
  37. package/browser/chunk-D2zGvbD2.js +190 -0
  38. package/browser/{chunk-DKllQ3Ve.js → chunk-D30bRRTP.js} +1 -1
  39. package/browser/{chunk-DQtoh8wv.js → chunk-D4dmZgr6.js} +1 -1
  40. package/browser/{chunk-b6g-uBR5.js → chunk-D6nkbOg1.js} +1 -1
  41. package/browser/chunk-D8nXP3jN.js +2 -0
  42. package/browser/{chunk-CUz5MHdA.js → chunk-D92adUD_.js} +1 -1
  43. package/browser/{chunk-BtEXE3Xz.js → chunk-DDu5Ufv3.js} +1 -1
  44. package/browser/{chunk-C5WD0UQE.js → chunk-DFjZf9oL.js} +3 -3
  45. package/browser/{chunk-B626-rya.js → chunk-DJjbZAaS.js} +1 -1
  46. package/browser/{chunk-B1OTuTxt.js → chunk-DKQvH1hP.js} +1 -1
  47. package/browser/{chunk-BHvLB-pV.js → chunk-DMUiJ7oP.js} +1 -1
  48. package/browser/chunk-DMyGIjcZ.js +1 -0
  49. package/browser/chunk-DOHvMo5p.js +1 -0
  50. package/browser/{chunk-ClEmA_ih.js → chunk-DVTNoWCQ.js} +1 -1
  51. package/browser/chunk-DV_7IOl_.js +1 -0
  52. package/browser/chunk-DaoWXYMw.js +1 -0
  53. package/browser/{chunk-B7kKWG4P.js → chunk-DmaEv05C.js} +1 -1
  54. package/browser/{chunk-CpZK7G-Q.js → chunk-DoqL_RuM.js} +2 -2
  55. package/browser/chunk-FMHkoXwM.js +37 -0
  56. package/browser/{chunk-CXTwGKdl.js → chunk-Fr6-w83-.js} +1 -1
  57. package/browser/{chunk-DxrynR3o.js → chunk-HHPhxe9B.js} +1 -1
  58. package/browser/{chunk-DpHEu7EG.js → chunk-IYMfBoNU.js} +1 -1
  59. package/browser/chunk-PQu4_Hy2.js +2 -0
  60. package/browser/chunk-Qpb04pBJ.js +1 -0
  61. package/browser/{chunk-BVAD9f9s.js → chunk-W5DNK5PC.js} +1 -1
  62. package/browser/{chunk-B6BZBDSv.js → chunk-WSA7xa0h.js} +5 -5
  63. package/browser/{chunk-D-jBfPIO.js → chunk-lX2E6ugr.js} +1 -1
  64. package/browser/{chunk-C2VdQfMJ.js → chunk-o2LY9dfG.js} +1 -1
  65. package/browser/{chunk-CI760KmO.js → chunk-py_Q_oQH.js} +1 -1
  66. package/browser/{chunk-DCwEaE_b.js → chunk-t87lD8bQ.js} +1 -1
  67. package/browser/{chunk-B3-4EW3s.js → chunk-vL7dLM7S.js} +1 -1
  68. package/browser/{chunk-CI7wYBKk.js → chunk-zvR-rokl.js} +1 -1
  69. package/browser/index.html +1 -1
  70. package/browser/main-YYHD6X7H.js +1811 -0
  71. package/package.json +1 -1
  72. package/browser/chunk-0njD_aMa.js +0 -2
  73. package/browser/chunk-6WIaUDav.js +0 -1
  74. package/browser/chunk-B7yga-a4.js +0 -1
  75. package/browser/chunk-BAWubWk8.js +0 -1
  76. package/browser/chunk-BDaTUrH4.js +0 -1
  77. package/browser/chunk-BJ5G7Y-a.js +0 -276
  78. package/browser/chunk-BTX631I3.js +0 -5
  79. package/browser/chunk-BYyTBqh4.js +0 -37
  80. package/browser/chunk-B_49KV6W.js +0 -1
  81. package/browser/chunk-BaO2vi_O.js +0 -675
  82. package/browser/chunk-BcT0wYqu.js +0 -2
  83. package/browser/chunk-BdJzYh5V.js +0 -190
  84. package/browser/chunk-BwDJA6_r.js +0 -55
  85. package/browser/chunk-C49BBPGm.js +0 -1
  86. package/browser/chunk-CNAj5Eon.js +0 -1
  87. package/browser/chunk-DMRb150M.js +0 -2
  88. package/browser/chunk-DjMtxVWg.js +0 -508
  89. package/browser/chunk-DqioJb1X.js +0 -1
  90. package/browser/chunk-DrzvCb86.js +0 -1
  91. package/browser/chunk-DwFGK2iu.js +0 -1
  92. package/browser/chunk-DxvmpOv5.js +0 -1
  93. package/browser/chunk-P8B5rz7L.js +0 -1
  94. package/browser/chunk-R-GmZrHu.js +0 -9
  95. package/browser/main-LBRSRTYI.js +0 -1811
@@ -1,4 +1,4 @@
1
- import {A,b as bt,k as kt}from'./chunk-CI760KmO.js';import {z as z$2}from'./chunk-DMRb150M.js';import {_ as _i}from'./chunk-B6BZBDSv.js';import {f as f$1}from'./chunk-BHvLB-pV.js';import {Y as Ye,E as Et$1,y as yt$1,Z as Ze}from'./chunk-DjoW6kqa.js';import'./chunk-ClSDInQq.js';import {g,w as we,R as Re,G,p as pe,L,P,U,O as Ot$1,F,u as ue,E as ET,a as Gi,z as z$1,b as P$1,c as U$1,l as le,f,d as b,e as O,V,h as Fw,i as hr,j as pr,k as Gn$1,s as si,m as ws,Q as QC,n as hl,o as Rg,q as oC,S as Sg,r as cC,M as MC,t as nI,v as bg,x as iC,y as uC,A as Ug,T as Tg,B as gE,C as Pg,D as bC,H as SC,I as fy,N,J as c,K as qy,W as Vy,X as br,Y as x,Z as z$3,_ as Ue,$ as zt$2,a0 as jt,a1 as Vt$1,a2 as Nt$1,a3 as GI,a4 as aC,a5 as Dl,a6 as qI,a7 as va,a8 as Yg,a9 as gC,aa as wf,ab as Cf,ac as EC,ad as Hg}from'./main-LBRSRTYI.js';import'./chunk-DO3lSvop.js';import {x as xe,k as kt$1,C as Ct,z as ze}from'./chunk-BwDJA6_r.js';import {P as Pt$1,L as Lt$1}from'./chunk-BdJzYh5V.js';import {v as ve,n as ne}from'./chunk-BXkvjekT.js';import'./chunk-CKhGzoqa.js';import {W,k as ke$1,s as se}from'./chunk-CpZK7G-Q.js';import {c as ce,n as nt,O as Ot$2,z as zt$1,T as Tn$1,S as Sn$1,a as ae}from'./chunk-bfpuueWC.js';import {I as In$1,D as De,B as Be,E as En$1,F as Fn$1}from'./chunk-BaO2vi_O.js';import {V as Ve,n as ne$1,H as He,N as Ne}from'./chunk-DjMtxVWg.js';import {y as yt,w as wt$1,t as ti,Y as Ye$1,f as fn$1,Z as Zn,$ as $t$1,c as cn$1}from'./chunk-BYyTBqh4.js';var Ot=(a,t)=>t.name;function Et(a,t){if(a&1&&(ws(0,"mat-option",11),QC(1),hl()),a&2){let e=t.$implicit;bg("value",e),nI(),Yg(e);}}function Nt(a,t){a&1&&Sg(0,"mat-spinner",13);}function It(a,t){if(a&1&&(ws(0,"span",20),QC(1),hl()),a&2){let e=EC().$implicit;nI(),Yg(e.description);}}function At(a,t){if(a&1&&(ws(0,"mat-option",11)(1,"span",19),QC(2),hl(),oC(3,It,2,1,"span",20),hl()),a&2){let e=t.$implicit;bg("value",e.name),nI(2),Yg(e.name),nI(),iC(e.description?3:-1);}}function Vt(a,t){if(a&1&&(ws(0,"mat-option",11),QC(1),hl()),a&2){let e=t.$implicit;bg("value",e),nI(),Yg(e);}}function Ft(a,t){if(a&1){let e=gC();ws(0,"div",25)(1,"mat-form-field",8)(2,"mat-label"),QC(3,"Name"),hl(),ws(4,"input",26),Rg("input",function(i){wf(e);let l=EC(2);return Cf(l.issueNumber.set(i.target.value))}),hl()(),ws(5,"mat-form-field",27)(6,"mat-label"),QC(7,"Type"),hl(),ws(8,"mat-select",28),Rg("selectionChange",function(i){wf(e);let l=EC(2);return Cf(l.branchType.set(i.value))}),cC(9,Vt,2,2,"mat-option",11,aC),hl()()();}if(a&2){let e=EC(2);nI(4),bg("value",e.issueNumber()),nI(4),bg("value",e.branchType()),nI(),uC(e.branchTypes);}}function Gt(a,t){a&1&&Sg(0,"mat-spinner",13);}function Rt(a,t){if(a&1&&(ws(0,"mat-option",11),QC(1),hl()),a&2){let e=t.$implicit;bg("value",e),nI(),Yg(e);}}function qt(a,t){if(a&1){let e=gC();ws(0,"mat-form-field",8)(1,"mat-label"),QC(2,"Source branch"),hl(),ws(3,"input",29,4),Rg("input",function(i){wf(e);let l=EC(2);return Cf(l.onBranchSearchInput(i.target.value))})("focus",function(){wf(e);let i=MC(4),l=EC(2);return Cf(l.openPanel(i))}),hl(),oC(5,Gt,1,0,"mat-spinner",13),ws(6,"mat-autocomplete",10,5),Rg("optionSelected",function(i){wf(e);let l=EC(2);return Cf(l.selectBranch(i.option.value))}),cC(8,Rt,2,2,"mat-option",11,aC),hl()();}if(a&2){let e=MC(7),n=EC(2);nI(3),bg("value",n.branchSearch())("matAutocomplete",e)("disabled",n.isLoadingBranches()),nI(2),iC(n.isLoadingBranches()?5:-1),nI(3),uC(n.filteredBranches());}}function $t(a,t){if(a&1){let e=gC();ws(0,"div",21)(1,"button",22),Rg("click",function(){wf(e);let i=EC();return Cf(i.onModeChange("local"))}),ws(2,"mat-icon"),QC(3,"folder_open"),hl(),ws(4,"span",23),QC(5,"Local"),hl(),ws(6,"span",24),QC(7,"Work directly on the current branch"),hl()(),ws(8,"button",22),Rg("click",function(){wf(e);let i=EC();return Cf(i.onModeChange("worktree"))}),ws(9,"mat-icon"),QC(10,"account_tree"),hl(),ws(11,"span",23),QC(12,"Worktree"),hl(),ws(13,"span",24),QC(14,"Create an isolated worktree from a branch"),hl()()(),oC(15,Ft,11,2,"div",25),oC(16,qt,10,4,"mat-form-field",8);}if(a&2){let e=EC();nI(),Ug("active",e.mode()==="local"),nI(7),Ug("active",e.mode()==="worktree"),nI(7),iC(e.isWorktree()?15:-1),nI(),iC(e.isWorktree()?16:-1);}}function Lt(a,t){a&1&&Sg(0,"mat-spinner",18);}function zt(a,t){a&1&&(ws(0,"mat-icon"),QC(1,"rocket_launch"),hl());}function Bt(a,t){a&1&&(ws(0,"mat-icon"),QC(1,"open_in_new"),hl());}var ke=class a{projectApi=g(c);agentApi=g(f$1);dialogRef=g(z$3);projectState=g(P);forcedProject=F(this.projectState.forcedProject$,{initialValue:null});selectedProject=Gi("");projectSearch=Gi("");selectedAgent=Gi("");agentSearch=Gi("");mode=Gi("local");selectedBranch=Gi("");branchSearch=Gi("");issueNumber=Gi("");branchType=Gi("feature");task=Gi("");hasGit=Gi(false);branchTypes=["feature","fix","refactor","chore","docs","build"];projects=Gi([]);agents=Gi([]);branches=Gi([]);filteredProjects=ET(()=>{let t=this.projectSearch().toLowerCase();return t?this.projects().filter(e=>e.toLowerCase().includes(t)):this.projects()});filteredAgents=ET(()=>{let t=this.agentSearch().toLowerCase();return t?this.agents().filter(e=>e.name.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)):this.agents()});filteredBranches=ET(()=>{let t=this.branchSearch().toLowerCase();return t?this.branches().filter(e=>e.toLowerCase().includes(t)):this.branches()});isLoadingAgents=Gi(false);isLoadingBranches=Gi(false);isSubmitting=Gi(false);isWorktree=ET(()=>this.mode()==="worktree"&&this.hasGit());isValid=ET(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(i=>i.name===this.selectedAgent()),n=t&&e&&!!this.task().trim();return this.isWorktree()?n&&!!this.selectedBranch()&&!!this.issueNumber().trim()&&!!this.branchType():n});canNavigate=ET(()=>this.projects().includes(this.selectedProject()));openPanel(t){t.openPanel();}onProjectSearchInput(t){this.projectSearch.set(t),this.selectedProject()&&t!==this.selectedProject()&&(this.selectedProject.set(""),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]));}selectProject(t){this.selectedProject.set(t),this.projectSearch.set(t),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]),this.branches.set([]),this.selectedBranch.set(""),this.branchSearch.set(""),this.hasGit.set(false),this.mode.set("local"),this.isLoadingAgents.set(true),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(false);},error:()=>{this.isLoadingAgents.set(false);}}),this.projectApi.getGitBranches(t).subscribe({next:({branches:e})=>{this.hasGit.set(e.length>0);},error:()=>{this.hasGit.set(false);}});}onAgentSearchInput(t){this.agentSearch.set(t),this.selectedAgent()&&t!==this.selectedAgent()&&this.selectedAgent.set("");}selectAgent(t){this.selectedAgent.set(t),this.agentSearch.set(t);}onBranchSearchInput(t){this.branchSearch.set(t),this.selectedBranch()&&t!==this.selectedBranch()&&this.selectedBranch.set("");}selectBranch(t){this.selectedBranch.set(t),this.branchSearch.set(t);}ngOnInit(){this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(n=>n.name);this.projects.set(e),e.length===1&&e[0]&&this.selectProject(e[0]);}});}onProjectChange(t){this.selectProject(t);}onModeChange(t){this.mode.set(t),t==="worktree"&&this.selectedProject()&&this.branches().length===0&&this.loadBranches();}loadBranches(){this.isLoadingBranches.set(true),this.projectApi.getGitBranches(this.selectedProject()).subscribe({next:({branches:t})=>{this.branches.set(t),this.isLoadingBranches.set(false);},error:()=>{this.isLoadingBranches.set(false);}});}submit(){if(!this.isSubmitting()){if(this.isValid()){this.isSubmitting.set(true);let t=this.isWorktree()&&this.issueNumber().trim()?`${this.issueNumber().trim()} ${this.task().trim()}`:this.task().trim();this.projectApi.createTask(this.selectedProject(),this.selectedAgent(),t,this.isWorktree()?"worktree":"local",this.isWorktree()?this.selectedBranch():void 0,this.isWorktree()?this.issueNumber().trim():void 0,this.isWorktree()?this.branchType():void 0).subscribe({next:({threadId:e,projectId:n})=>{this.dialogRef.close({threadId:e,projectId:n});},error:()=>{this.isSubmitting.set(false);}});return}if(this.canNavigate()){this.dialogRef.close({projectId:this.selectedProject(),navigate:true});return}}}cancel(){this.dialogRef.close(null);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=Fw({type:a,selectors:[["app-new-task-dialog"]],decls:37,vars:12,consts:[["projectTrigger","matAutocompleteTrigger"],["projectAuto",""],["agentTrigger","matAutocompleteTrigger"],["agentAuto",""],["branchTrigger","matAutocompleteTrigger"],["branchAuto",""],["mat-dialog-title",""],[1,"ntd-content"],["appearance","outline",1,"ntd-field"],["matInput","","placeholder","Search project...",3,"input","focus","value","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matInput","","placeholder","Search agent...",3,"input","focus","value","matAutocomplete","disabled"],["matSuffix","","diameter","16"],["matInput","","placeholder","Describe what the agent should accomplish...","rows","4",3,"input","value"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",1,"ntd-launch-btn",3,"click","disabled"],["diameter","16"],[1,"ntd-agent-name"],[1,"ntd-agent-desc"],[1,"ntd-radio-group"],["type","button",1,"ntd-mode-btn",3,"click"],[1,"ntd-radio-label"],[1,"ntd-radio-hint"],[1,"ntd-row"],["matInput","","type","text","placeholder","Name",3,"input","value"],["appearance","outline",1,"ntd-field","ntd-field--small"],[3,"selectionChange","value"],["matInput","","placeholder","Search branch...",3,"input","focus","value","matAutocomplete","disabled"]],template:function(e,n){if(e&1){let i=gC();ws(0,"h2",6)(1,"mat-icon"),QC(2,"rocket_launch"),hl(),QC(3,` New Task
2
- `),hl(),ws(4,"mat-dialog-content",7)(5,"mat-form-field",8)(6,"mat-label"),QC(7,"Project"),hl(),ws(8,"input",9,0),Rg("input",function(p){return n.onProjectSearchInput(p.target.value)})("focus",function(){wf(i);let p=MC(9);return Cf(n.openPanel(p))}),hl(),ws(10,"mat-autocomplete",10,1),Rg("optionSelected",function(p){return n.selectProject(p.option.value)}),cC(12,Et,2,2,"mat-option",11,aC),hl()(),ws(14,"mat-form-field",8)(15,"mat-label"),QC(16,"Agent"),hl(),ws(17,"input",12,2),Rg("input",function(p){return n.onAgentSearchInput(p.target.value)})("focus",function(){wf(i);let p=MC(18);return Cf(n.openPanel(p))}),hl(),oC(19,Nt,1,0,"mat-spinner",13),ws(20,"mat-autocomplete",10,3),Rg("optionSelected",function(p){return n.selectAgent(p.option.value)}),cC(22,At,4,3,"mat-option",11,Ot),hl()(),oC(24,$t,17,6),ws(25,"mat-form-field",8)(26,"mat-label"),QC(27,"Task"),hl(),ws(28,"textarea",14),Rg("input",function(p){return n.task.set(p.target.value)}),hl()()(),ws(29,"mat-dialog-actions",15)(30,"button",16),Rg("click",function(){return n.cancel()}),QC(31,"Cancel"),hl(),ws(32,"button",17),Rg("click",function(){return n.submit()}),oC(33,Lt,1,0,"mat-spinner",18)(34,zt,2,0,"mat-icon")(35,Bt,2,0,"mat-icon"),QC(36),hl()();}if(e&2){let i=MC(11),l=MC(21);nI(8),bg("value",n.projectSearch())("matAutocomplete",i),nI(4),uC(n.filteredProjects()),nI(5),bg("value",n.agentSearch())("matAutocomplete",l)("disabled",!n.selectedProject()||n.isLoadingAgents()),nI(2),iC(n.isLoadingAgents()?19:-1),nI(3),uC(n.filteredAgents()),nI(2),iC(n.hasGit()&&!n.forcedProject()?24:-1),nI(4),bg("value",n.task()),nI(2),bg("disabled",n.isSubmitting()),nI(2),bg("disabled",!n.canNavigate()||n.isSubmitting()),nI(),iC(n.isSubmitting()?33:n.isValid()?34:35),nI(3),Dl(" ",n.isValid()?"Launch":"Open"," ");}},dependencies:[ti,zt$2,jt,Vt$1,Nt$1,hr,pr,ce,nt,ae,zt$1,Tn$1,Sn$1,kt$1,Ct,Fn$1,ze,Pt$1,Lt$1,Et$1,yt$1,yt,wt$1],styles:["h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:0}.ntd-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;padding-top:20px!important}.ntd-field[_ngcontent-%COMP%]{width:100%}.ntd-row[_ngcontent-%COMP%]{display:flex;gap:.75rem}.ntd-row[_ngcontent-%COMP%] .ntd-field--small[_ngcontent-%COMP%]{width:130px;flex-shrink:0}.ntd-radio-group[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding:.25rem 0 .75rem}.ntd-mode-btn[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;padding:.75rem;border:1px solid var(--color-border);border-radius:8px;background:transparent;color:var(--color-text);cursor:pointer;transition:border-color .15s,background .15s}.ntd-mode-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem;margin-bottom:.1rem}.ntd-mode-btn.active[_ngcontent-%COMP%]{border-color:var(--color-primary);background:color-mix(in srgb,var(--color-primary) 10%,transparent)}.ntd-mode-btn[_ngcontent-%COMP%]:hover:not(.active){border-color:var(--color-text-secondary)}.ntd-radio-label[_ngcontent-%COMP%]{font-weight:600;font-size:.9rem}.ntd-radio-hint[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);line-height:1.3;text-align:left}.ntd-agent-name[_ngcontent-%COMP%]{font-weight:500;display:block}.ntd-agent-desc[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:380px}.ntd-launch-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse)}.ntd-launch-btn[_ngcontent-%COMP%]:disabled{background:var(--color-border);color:var(--color-text-secondary);opacity:.6;cursor:not-allowed}"],changeDetection:1})};var Qt=(a,t)=>t.name,Ut=(a,t)=>t.value;function Ht(a,t){if(a&1&&(ws(0,"mat-option",8),QC(1),hl()),a&2){let e=t.$implicit;bg("value",e),nI(),Yg(e);}}function Jt(a,t){a&1&&Sg(0,"mat-spinner",9);}function Xt(a,t){if(a&1&&(ws(0,"mat-option",8),QC(1),hl()),a&2){let e=t.$implicit;bg("value",e.name),nI(),Yg(e.name);}}function Kt(a,t){if(a&1){let e=gC();ws(0,"button",37),Rg("click",function(){let i=wf(e).$implicit,l=EC();return Cf(l.toggleDay(i.value))}),QC(1),hl();}if(a&2){let e=t.$implicit,n=EC();Ug("selected",n.isDaySelected(e.value)),nI(),Dl(" ",e.label," ");}}function Yt(a,t){if(a&1){let e=gC();ws(0,"mat-form-field",4)(1,"mat-label"),QC(2,"Number of runs"),hl(),ws(3,"input",17),Rg("ngModelChange",function(i){wf(e);let l=EC();return Cf(l.endOccurrences.set(i))}),hl(),GI(),hl();}if(a&2){let e=EC();nI(3),bg("ngModel",e.endOccurrences()),qI();}}function Zt(a,t){if(a&1){let e=gC();ws(0,"mat-form-field",4)(1,"mat-label"),QC(2,"End date"),hl(),ws(3,"input",38),Rg("ngModelChange",function(i){wf(e);let l=EC();return Cf(l.endTimestamp.set(i))}),hl(),GI(),hl();}if(a&2){let e=EC();nI(3),bg("ngModel",e.endTimestamp())("min",e.startTimestamp()),qI();}}function en(a,t){if(a&1&&(ws(0,"div",32)(1,"mat-icon"),QC(2,"error"),hl(),ws(3,"span"),QC(4),hl()()),a&2){let e=EC();nI(4),Yg(e.errorMessage());}}function tn(a,t){a&1&&Sg(0,"mat-spinner",36);}function nn(a,t){a&1&&(ws(0,"mat-icon"),QC(1,"schedule"),hl());}var z=class a{projectApi=g(c);agentApi=g(f$1);schedulerApi=g(xe);dialogRef=g(z$3);dialogData=g(Ue,{optional:true});isEditMode=this.dialogData?.mode==="edit";projects=Gi([]);agents=Gi([]);name=Gi("");selectedProject=Gi("");selectedAgent=Gi("");instruction=Gi("");intervalValue=Gi(1);intervalUnit=Gi("d");startTimestamp=Gi("");daysOfWeek=Gi([]);endConditionType=Gi("none");endOccurrences=Gi(10);endTimestamp=Gi("");enabled=Gi(true);isLoadingAgents=Gi(false);isSaving=Gi(false);errorMessage=Gi("");daysOfWeekOptions=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}];filteredProjects=ET(()=>{let t=this.selectedProject().toLowerCase();return this.projects().filter(e=>e.toLowerCase().includes(t))});filteredAgents=ET(()=>{let t=this.selectedAgent().toLowerCase();return this.agents().filter(e=>e.name.toLowerCase().includes(t))});isValid=ET(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(l=>l.name===this.selectedAgent()),n=this.instruction().trim().length>0,i=this.intervalValue()>=1;return t&&e&&n&&i});ngOnInit(){if(this.isEditMode&&this.dialogData?.scheduler){let t=this.dialogData.scheduler;this.name.set(t.name),this.selectedAgent.set(t.agentName??""),this.instruction.set(t.instruction??""),this.enabled.set(t.enabled);let e=t.schedule.interval.match(/^(\d+)(min|h|d|M)$/);e&&e[1]&&e[2]&&(this.intervalValue.set(parseInt(e[1],10)),this.intervalUnit.set(e[2])),t.schedule.startTimestamp&&this.startTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.startTimestamp))),this.daysOfWeek.set(t.schedule.daysOfWeek??[]),t.schedule.endCondition&&(this.endConditionType.set(t.schedule.endCondition.type),t.schedule.endCondition.type==="occurrences"?this.endOccurrences.set(t.schedule.endCondition.value):t.schedule.endCondition.type==="endTimestamp"&&this.endTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.endCondition.value))));}else this.startTimestamp.set(this.toDatetimeLocal(new Date));this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));this.projects.set(e);let n=this.dialogData?.projectName;this.isEditMode&&n?this.onProjectSelected(n):e.length===1&&e[0]&&this.onProjectSelected(e[0]);}});}onProjectSelected(t){this.selectedProject.set(t),this.isEditMode||(this.agents.set([]),this.selectedAgent.set("")),this.projects().includes(t)&&(this.isLoadingAgents.set(true),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(false),!this.isEditMode&&e.length===1&&e[0]&&this.selectedAgent.set(e[0].name);},error:()=>this.isLoadingAgents.set(false)}));}toggleDay(t){let e=this.daysOfWeek();e.indexOf(t)>-1?this.daysOfWeek.set(e.filter(i=>i!==t)):this.daysOfWeek.set([...e,t].sort());}isDaySelected(t){return this.daysOfWeek().includes(t)}toDatetimeLocal(t){let e=n=>String(n).padStart(2,"0");return `${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}submit(){if(!this.isValid()||this.isSaving())return;this.errorMessage.set(""),this.isSaving.set(true);let t=this.startTimestamp(),e={startTimestamp:t?new Date(t).toISOString():new Date().toISOString(),interval:`${this.intervalValue()}${this.intervalUnit()}`},n=this.daysOfWeek();n.length>0&&(e.daysOfWeek=n);let i=this.endConditionType();i==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences()}:i==="endTimestamp"&&this.endTimestamp()&&(e.endCondition={type:"endTimestamp",value:new Date(this.endTimestamp()).toISOString()});let l=this.instruction().trim(),p=l.length>40?l.slice(0,40)+"\u2026":l,L=this.name().trim()||`${this.selectedAgent()} \u2014 ${p}`;this.isEditMode&&this.dialogData?.scheduler&&this.dialogData.projectName?this.schedulerApi.updateSchedulerForProject(this.dialogData.projectName,this.dialogData.scheduler.id,{name:L,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(false),this.dialogRef.close(true);},error:oe=>{this.errorMessage.set(oe?.error?.error||"Failed to update scheduler"),this.isSaving.set(false);}}):this.schedulerApi.createSchedulerForProject(this.selectedProject(),{name:L,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(false),this.dialogRef.close(true);},error:oe=>{this.errorMessage.set(oe?.error?.error||"Failed to create scheduler"),this.isSaving.set(false);}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=Fw({type:a,selectors:[["app-quick-scheduler-dialog"]],decls:84,vars:20,consts:[["projectAuto","matAutocomplete"],["agentAuto","matAutocomplete"],["mat-dialog-title",""],[1,"qsd-form"],["appearance","outline",1,"full-width"],["matInput","","placeholder","Optional \u2014 auto-generated if empty",3,"ngModelChange","ngModel"],["matInput","","placeholder","Select a project",3,"ngModelChange","focus","ngModel","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matSuffix","","diameter","18"],["matInput","","placeholder","Select an agent",3,"ngModelChange","focus","ngModel","matAutocomplete","disabled"],["matInput","","placeholder","e.g. Review open PRs and summarize what needs attention","rows","3",3,"ngModelChange","ngModel"],[1,"qsd-divider"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"qsd-interval"],[1,"qsd-label"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],[3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"qsd-days"],[1,"qsd-day-chips"],["type","button",1,"day-chip",3,"selected"],[1,"qsd-hint"],[1,"qsd-end"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"qsd-error"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",3,"click","disabled"],["diameter","18"],["type","button",1,"day-chip",3,"click"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel","min"]],template:function(e,n){if(e&1&&(ws(0,"h2",2)(1,"mat-icon"),QC(2,"schedule"),hl(),QC(3),hl(),ws(4,"mat-dialog-content")(5,"div",3)(6,"mat-form-field",4)(7,"mat-label"),QC(8,"Name"),hl(),ws(9,"input",5),Rg("ngModelChange",function(l){return n.name.set(l)}),hl(),GI(),hl(),ws(10,"mat-form-field",4)(11,"mat-label"),QC(12,"Project"),hl(),ws(13,"input",6),Rg("ngModelChange",function(l){return n.onProjectSelected(l)})("focus",function(){return n.selectedProject.set(n.selectedProject())}),hl(),GI(),ws(14,"mat-autocomplete",7,0),Rg("optionSelected",function(l){return n.onProjectSelected(l.option.value)}),cC(16,Ht,2,2,"mat-option",8,aC),hl()(),ws(18,"mat-form-field",4)(19,"mat-label"),QC(20,"Agent"),hl(),oC(21,Jt,1,0,"mat-spinner",9),ws(22,"input",10),Rg("ngModelChange",function(l){return n.selectedAgent.set(l)})("focus",function(){return n.selectedAgent.set(n.selectedAgent())}),hl(),GI(),ws(23,"mat-autocomplete",7,1),Rg("optionSelected",function(l){return n.selectedAgent.set(l.option.value)}),cC(25,Xt,2,2,"mat-option",8,Qt),hl()(),ws(27,"mat-form-field",4)(28,"mat-label"),QC(29,"What should the agent do?"),hl(),ws(30,"textarea",11),Rg("ngModelChange",function(l){return n.instruction.set(l)}),hl(),GI(),hl(),ws(31,"div",12)(32,"span"),QC(33,"Scheduling"),hl()(),ws(34,"mat-form-field",4)(35,"mat-label"),QC(36,"Starts on"),hl(),ws(37,"input",13),Rg("ngModelChange",function(l){return n.startTimestamp.set(l)}),hl(),GI(),hl(),ws(38,"div",14)(39,"span",15),QC(40,"Every"),hl(),ws(41,"mat-form-field",16)(42,"input",17),Rg("ngModelChange",function(l){return n.intervalValue.set(l)}),hl(),GI(),hl(),ws(43,"mat-form-field",18)(44,"mat-select",19),Rg("ngModelChange",function(l){return n.intervalUnit.set(l)}),ws(45,"mat-option",20),QC(46,"minutes"),hl(),ws(47,"mat-option",21),QC(48,"hours"),hl(),ws(49,"mat-option",22),QC(50,"days"),hl(),ws(51,"mat-option",23),QC(52,"months"),hl()(),GI(),hl()(),ws(53,"div",24)(54,"span",15),QC(55,"Days"),hl(),ws(56,"div",25),cC(57,Kt,2,3,"button",26,Ut),hl(),ws(59,"span",27),QC(60,"Leave empty for every day"),hl()(),ws(61,"div",28)(62,"mat-form-field",4)(63,"mat-label"),QC(64,"Ends on"),hl(),ws(65,"mat-select",19),Rg("ngModelChange",function(l){return n.endConditionType.set(l)}),ws(66,"mat-option",29),QC(67,"Never"),hl(),ws(68,"mat-option",30),QC(69,"After N runs"),hl(),ws(70,"mat-option",31),QC(71,"On a date"),hl()(),GI(),hl(),oC(72,Yt,4,1,"mat-form-field",4),oC(73,Zt,4,2,"mat-form-field",4),hl(),ws(74,"mat-checkbox",19),Rg("ngModelChange",function(l){return n.enabled.set(l)}),QC(75,"Enable immediately"),hl(),GI(),oC(76,en,5,1,"div",32),hl()(),ws(77,"mat-dialog-actions",33)(78,"button",34),Rg("click",function(){return n.cancel()}),QC(79,"Cancel"),hl(),ws(80,"button",35),Rg("click",function(){return n.submit()}),oC(81,tn,1,0,"mat-spinner",36)(82,nn,2,0,"mat-icon"),QC(83," Schedule "),hl()()),e&2){let i=MC(15),l=MC(24);nI(3),Dl(" ",n.isEditMode?"Edit scheduled task":"New scheduled task",`
3
- `),nI(6),bg("ngModel",n.name()),qI(),nI(4),bg("ngModel",n.selectedProject())("matAutocomplete",i),qI(),nI(3),uC(n.filteredProjects()),nI(5),iC(n.isLoadingAgents()?21:-1),nI(),bg("ngModel",n.selectedAgent())("matAutocomplete",l)("disabled",!n.projects().includes(n.selectedProject())),qI(),nI(3),uC(n.filteredAgents()),nI(5),bg("ngModel",n.instruction()),qI(),nI(7),bg("ngModel",n.startTimestamp()),qI(),nI(5),bg("ngModel",n.intervalValue()),qI(),nI(2),bg("ngModel",n.intervalUnit()),qI(),nI(13),uC(n.daysOfWeekOptions),nI(8),bg("ngModel",n.endConditionType()),qI(),nI(7),iC(n.endConditionType()==="occurrences"?72:-1),nI(),iC(n.endConditionType()==="endTimestamp"?73:-1),nI(),bg("ngModel",n.enabled()),qI(),nI(2),iC(n.errorMessage()?76:-1),nI(2),bg("disabled",n.isSaving()),nI(2),bg("disabled",!n.isValid()||n.isSaving()),nI(),iC(n.isSaving()?81:82);}},dependencies:[ti,Ye$1,fn$1,Zn,$t$1,cn$1,zt$2,jt,Vt$1,Nt$1,hr,pr,ce,nt,ae,zt$1,Tn$1,Sn$1,kt$1,Ct,Fn$1,ze,Pt$1,Lt$1,ve,ne,Et$1,yt$1,yt,wt$1],styles:['[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding-top:4px}.full-width[_ngcontent-%COMP%]{width:100%}.qsd-interval[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-interval[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-interval[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%]{width:80px}.qsd-interval[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.qsd-days[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.qsd-days[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-days[_ngcontent-%COMP%] .qsd-hint[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);opacity:.7;width:100%;margin-top:-4px;padding-left:36px}.qsd-day-chips[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.day-chip[_ngcontent-%COMP%]{padding:4px 10px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:12px;cursor:pointer;transition:background .15s,color .15s}.day-chip.selected[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.day-chip[_ngcontent-%COMP%]:hover:not(.selected){background:var(--mat-sys-surface-variant)}.qsd-divider[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:4px 0}.qsd-divider[_ngcontent-%COMP%]:before, .qsd-divider[_ngcontent-%COMP%]:after{content:"";flex:1;height:1px;background:var(--mat-sys-outline-variant)}.qsd-divider[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);text-transform:uppercase;letter-spacing:.5px}.qsd-end[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.qsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);font-size:14px}.qsd-error[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}mat-dialog-actions[_ngcontent-%COMP%] button[mat-flat-button][_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px}']})};var rn=(a,t)=>t.id;function an(a,t){if(a&1){let e=gC();ws(0,"button",9),Rg("click",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.setProject(i))}),QC(1),hl();}if(a&2){let e=t.$implicit,n=EC(2);Ug("active",n.activeProject()===e),nI(),Dl(" ",e," ");}}function ln(a,t){if(a&1){let e=gC();ws(0,"nav",2)(1,"button",9),Rg("click",function(){wf(e);let i=EC();return Cf(i.setProject(null))}),QC(2," All projects "),hl(),cC(3,an,2,3,"button",10,aC),hl();}if(a&2){let e=EC();nI(),Ug("active",e.activeProject()===null),nI(2),uC(e.projects());}}function sn(a,t){a&1&&(ws(0,"div",3),Sg(1,"mat-spinner",11),hl());}function cn(a,t){if(a&1&&(ws(0,"div",4)(1,"mat-icon"),QC(2,"error"),hl(),QC(3),hl()),a&2){let e=EC();nI(3),Dl(" ",e.errorMessage()," ");}}function dn(a,t){if(a&1){let e=gC();ws(0,"div",5)(1,"mat-icon"),QC(2,"schedule"),hl(),ws(3,"p"),QC(4,"No scheduled tasks yet."),hl(),ws(5,"button",12),Rg("click",function(){wf(e);let i=EC();return Cf(i.openCreate())}),ws(6,"mat-icon"),QC(7,"add"),hl(),QC(8," Create one "),hl()();}}function pn(a,t){if(a&1&&(ws(0,"span",17),QC(1),hl()),a&2){let e=EC().$implicit;nI(),Yg(e.projectName);}}function mn(a,t){if(a&1){let e=gC();ws(0,"li",14)(1,"div",15)(2,"span",16),QC(3),hl(),oC(4,pn,2,1,"span",17),ws(5,"span",18),QC(6),hl()(),ws(7,"div",19)(8,"span",20),QC(9),hl(),ws(10,"span",21),QC(11),hl()(),ws(12,"div",22)(13,"mat-slide-toggle",23),Rg("change",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.toggleEnabled(i))}),hl(),ws(14,"button",24),Rg("click",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.runNow(i))}),ws(15,"mat-icon"),QC(16,"play_arrow"),hl()(),ws(17,"button",25),Rg("click",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.edit(i))}),ws(18,"mat-icon"),QC(19,"edit"),hl()(),ws(20,"button",26),Rg("click",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.delete(i))}),ws(21,"mat-icon"),QC(22,"delete"),hl()()()();}if(a&2){let e=t.$implicit,n=EC(2);Ug("disabled",!e.enabled),nI(3),Yg(e.name),nI(),iC(n.projects().length>1?4:-1),nI(2),Yg(n.getSource(e)),nI(3),Yg(n.formatInterval(e.schedule.interval)),nI(),Ug("due",!e.nextRun),nI(),Yg(n.formatNextRun(e.nextRun)),nI(2),bg("checked",e.enabled);}}function un(a,t){if(a&1&&(ws(0,"ul",6),cC(1,mn,23,10,"li",13,rn),hl()),a&2){let e=EC();nI(),uC(e.filteredSchedulers());}}var Me=class a{projectApi=g(c);schedulerApi=g(xe);dialog=g(Re);dialogRef=g(z$3);allSchedulers=Gi([]);isLoading=Gi(true);errorMessage=Gi("");activeProject=Gi(null);projects=Gi([]);filteredSchedulers=ET(()=>{let t=this.activeProject(),e=this.allSchedulers();return t?e.filter(n=>n.projectName===t):e});ngOnInit(){this.load();}load(){this.isLoading.set(true),this.errorMessage.set(""),this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));if(this.projects.set(e),e.length===0){this.isLoading.set(false);return}let n=e.map(i=>this.schedulerApi.listSchedulersForProject(i).pipe(va(()=>br([]))));Vy(n).subscribe({next:i=>{let l=[];i.forEach((p,L)=>{p.forEach(oe=>l.push(z$1(P$1({},oe),{projectName:e[L]})));}),this.allSchedulers.set(l),this.isLoading.set(false);},error:()=>{this.errorMessage.set("Failed to load schedulers"),this.isLoading.set(false);}});},error:()=>{this.errorMessage.set("Failed to load projects"),this.isLoading.set(false);}});}setProject(t){this.activeProject.set(t);}formatInterval(t){let e=/^(\d+)(min|h|d|M)$/.exec(t);if(!e)return t;let[,n,i]=e;return `Every ${n}${{min:"min",h:"h",d:"d",M:"mo"}[i??""]??i}`}formatNextRun(t){if(!t)return "Expired";let e=new Date(t),n=new Date,i=e.getTime()-n.getTime();if(i<0)return "Due";let l=Math.floor(i/6e4);if(l<60)return `in ${l}m`;let p=Math.floor(l/60);return p<24?`in ${p}h`:`in ${Math.floor(p/24)}d`}getSource(t){if(t.agentName&&t.instruction){let e=t.instruction.length>35?t.instruction.slice(0,35)+"\u2026":t.instruction;return `${t.agentName}: ${e}`}return t.promptId??""}toggleEnabled(t){(t.enabled?this.schedulerApi.disableSchedulerForProject(t.projectName,t.id):this.schedulerApi.enableSchedulerForProject(t.projectName,t.id)).subscribe({next:()=>{this.allSchedulers.update(n=>n.map(i=>i.id===t.id?z$1(P$1({},i),{enabled:!i.enabled}):i));},error:()=>this.errorMessage.set("Failed to toggle scheduler")});}runNow(t){this.schedulerApi.runSchedulerNowForProject(t.projectName,t.id).subscribe({error:()=>this.errorMessage.set("Failed to run scheduler")});}edit(t){let e={mode:"edit",projectName:t.projectName,scheduler:{id:t.id,name:t.name,agentName:t.agentName,instruction:t.instruction,enabled:t.enabled,schedule:t.schedule}};this.dialog.open(z,{width:"480px",data:e}).afterClosed().subscribe(i=>{i&&this.load();});}delete(t){this.schedulerApi.deleteSchedulerForProject(t.projectName,t.id).subscribe({next:()=>{this.allSchedulers.update(e=>e.filter(n=>n.id!==t.id));},error:()=>this.errorMessage.set("Failed to delete scheduler")});}openCreate(){this.dialogRef.close(),this.dialog.open(z,{width:"480px"});}close(){this.dialogRef.close();}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=Fw({type:a,selectors:[["app-global-schedulers-dialog"]],decls:19,vars:3,consts:[["mat-dialog-title",""],[1,"gsd-count"],[1,"gsd-project-filters"],[1,"gsd-loading"],[1,"gsd-error"],[1,"gsd-empty"],[1,"gsd-list"],["align","end"],["mat-button","",3,"click"],[1,"proj-chip",3,"click"],[1,"proj-chip",3,"active"],["diameter","32"],["mat-flat-button","",3,"click"],[1,"gsd-item",3,"disabled"],[1,"gsd-item"],[1,"gsd-item-main"],[1,"gsd-item-name"],[1,"gsd-item-project"],[1,"gsd-item-source"],[1,"gsd-item-meta"],[1,"gsd-interval"],[1,"gsd-next"],[1,"gsd-item-actions"],["matTooltip","Enable / Disable",3,"change","checked"],["mat-icon-button","","matTooltip","Run now",3,"click"],["mat-icon-button","","matTooltip","Edit",3,"click"],["mat-icon-button","","matTooltip","Delete",1,"delete-btn",3,"click"]],template:function(e,n){e&1&&(ws(0,"h2",0)(1,"mat-icon"),QC(2,"schedule"),hl(),QC(3," Scheduled tasks "),ws(4,"span",1),QC(5),hl()(),ws(6,"mat-dialog-content"),oC(7,ln,5,2,"nav",2),oC(8,sn,2,0,"div",3)(9,cn,4,1,"div",4)(10,dn,9,0,"div",5)(11,un,3,0,"ul",6),hl(),ws(12,"mat-dialog-actions",7)(13,"button",8),Rg("click",function(){return n.openCreate()}),ws(14,"mat-icon"),QC(15,"add"),hl(),QC(16," New scheduler "),hl(),ws(17,"button",8),Rg("click",function(){return n.close()}),QC(18,"Close"),hl()()),e&2&&(nI(5),Yg(n.filteredSchedulers().length),nI(2),iC(n.projects().length>1?7:-1),nI(),iC(n.isLoading()?8:n.errorMessage()?9:n.filteredSchedulers().length===0?10:11));},dependencies:[ti,zt$2,jt,Vt$1,Nt$1,hr,pr,Gn$1,yt,wt$1,Et$1,yt$1,Pt$1,Ve,ne$1,ke$1,se],styles:["[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}h2[mat-dialog-title][_ngcontent-%COMP%] .gsd-count[_ngcontent-%COMP%]{font-size:13px;font-weight:400;color:var(--mat-sys-on-surface-variant);margin-left:2px}.gsd-project-filters[_ngcontent-%COMP%]{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.proj-chip[_ngcontent-%COMP%]{padding:4px 12px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:13px;cursor:pointer;transition:background .15s,color .15s}.proj-chip.active[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.proj-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--mat-sys-surface-variant)}.gsd-loading[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:32px 0;color:var(--mat-sys-on-surface-variant)}.gsd-loading[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:40px;width:40px;height:40px;opacity:.4}.gsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);padding:16px 0}.gsd-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.gsd-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:8px;background:var(--mat-sys-surface-container);transition:opacity .2s}.gsd-item.disabled[_ngcontent-%COMP%]{opacity:.5}.gsd-item-main[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.gsd-item-name[_ngcontent-%COMP%]{font-weight:500;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-project[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-primary);font-weight:500}.gsd-item-source[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-meta[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-end;gap:2px;white-space:nowrap}.gsd-interval[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant)}.gsd-next[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-on-surface-variant)}.gsd-next.due[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.gsd-item-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--mat-sys-error);opacity:.7;transition:opacity .15s}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{opacity:1}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}"]})};var Se=class a{http=g(fy);threadApi=g(N);projectApi=g(c);isLoading=Gi(false);tasks=Gi([]);refresh(){this.isLoading.set(true),this.threadApi.listAllThreads().pipe(qy(15e3)).subscribe({next:t=>{let e=t.filter(n=>!n.parentThreadId).map(n=>({id:n.id,name:n.name,summary:n.summary,modifiedDate:n.modifiedDate,starring:n.starring??[],users:n.users??[],isActive:false,status:this.deriveStatus(n),projectId:n.projectId,worktreeProject:n.worktreeProject}));this.tasks.set(this.sorted(e)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}applyStatusEvent(t,e){let n=e==="invite"?"waiting-you":"in-progress";this.tasks.update(i=>this.sorted(i.map(l=>l.id===t?z$1(P$1({},l),{status:n}):l)));}closeTask(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/missions/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to close task:",n),this.refresh();}});}stopThread(t,e){this.http.post(`/api/projects/${t}/threads/${e}/stop`,{}).subscribe({error:n=>console.error("[GLOBAL-TC] Failed to stop thread:",n)});}deleteThread(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/threads/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to delete thread:",n),this.refresh();}});}toggleStar(t,e,n){let i=`/api/projects/${t}/threads/${e}/star`;(n?this.http.delete(i):this.http.post(i,{})).subscribe({next:()=>this.refresh(),error:p=>console.error("[GLOBAL-TC] Failed to toggle star:",p)});}markTaskDone(t,e){this.http.post(`/api/projects/${t}/threads/${e}/done`,{}).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as done:",n)});}markTasksBatchDone(t){if(t.length===0)return;let e=new Map;for(let{id:l,projectId:p}of t){let L=e.get(p)??[];L.push(l),e.set(p,L);}let n=new Set(t.map(l=>l.id));this.tasks.update(l=>this.sorted(l.map(p=>n.has(p.id)?z$1(P$1({},p),{status:"done"}):p)));let i=[...e.entries()].map(([l,p])=>this.projectApi.markThreadsBatchDone(l,p));Vy(i.length>0?i:[br(null)]).subscribe({next:()=>this.refresh(),error:l=>{console.error("[GLOBAL-TC] Failed to batch-mark tasks as done:",l),this.refresh();}});}markTaskActive(t,e){this.http.delete(`/api/projects/${t}/threads/${e}/done`).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as active:",n)});}deriveStatus(t){return t.closedByUser?"done":t.pendingInvite?"waiting-you":Date.now()-new Date(t.modifiedDate).getTime()<bt?"in-progress":"paused"}sorted(t){return [...t].sort((e,n)=>{let i=kt[e.status]-kt[n.status];return i!==0?i:e.modifiedDate>n.modifiedDate?-1:1})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var Te=class a{configApi=g(W);dialog=g(Re);openUserConfigEditor(){this.configApi.getUserConfig().subscribe({next:t=>{this.dialog.open(Ze,{data:{configType:"user",initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(n=>{n&&this.configApi.updateUserConfig(n).subscribe({error:i=>console.error("[CONFIG-STATE] Error saving user config:",i)});});},error:t=>console.error("[CONFIG-STATE] Error loading user config:",t)});}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var gn=["layoutContainer"],hn=(a,t)=>t.key,_n=(a,t)=>t.name,fn=(a,t)=>t.status,Pt=(a,t)=>t.id;function bn(a,t){if(a&1){let e=gC();ws(0,"button",32),Rg("click",function(){wf(e);let i=EC();return Cf(i.clearSearch())}),ws(1,"mat-icon"),QC(2,"close"),hl()();}}function vn(a,t){if(a&1){let e=gC();ws(0,"button",33),Rg("click",function(){let i=wf(e).$implicit,l=EC(2);return Cf(l.setProject(i.name))}),QC(1),ws(2,"span",34),QC(3),hl()();}if(a&2){let e=t.$implicit,n=EC(2);Ug("active",n.activeProject()===e.name),nI(),Dl(" ",e.name," "),nI(2),Yg(e.count);}}function Cn(a,t){if(a&1){let e=gC();ws(0,"nav",22)(1,"button",33),Rg("click",function(){wf(e);let i=EC();return Cf(i.setProject(null))}),QC(2," All projects "),ws(3,"span",34),QC(4),hl()(),cC(5,vn,4,4,"button",35,_n),hl();}if(a&2){let e=EC();nI(),Ug("active",e.activeProject()===null),nI(3),Yg(e.allTasks().length),nI(),uC(e.projectSummaries());}}function yn(a,t){if(a&1&&(ws(0,"span",37),QC(1),hl()),a&2){let e=EC().$implicit,n=EC();nI(),Yg(n.filterCounts()[e.key]);}}function xn(a,t){if(a&1){let e=gC();ws(0,"button",36),Rg("click",function(){let i=wf(e).$implicit,l=EC();return Cf(l.setFilter(i.key))}),ws(1,"mat-icon",26),QC(2),hl(),ws(3,"span"),QC(4),hl(),oC(5,yn,2,1,"span",37),hl();}if(a&2){let e=t.$implicit,n=EC();Ug("active",n.activeFilter()===e.key),Tg("aria-selected",n.activeFilter()===e.key),nI(2),Yg(e.icon),nI(2),Yg(e.label),nI(),iC(n.filterCounts()[e.key]>0?5:-1);}}function kn(a,t){a&1&&(ws(0,"div",29),Sg(1,"mat-spinner",38),ws(2,"p"),QC(3,"Loading tasks from all projects\u2026"),hl()());}function Mn(a,t){a&1&&(ws(0,"div",30)(1,"mat-icon",39),QC(2,"hub"),hl(),ws(3,"p"),QC(4,"No tasks found."),hl()());}function Sn(a,t){if(a&1){let e=gC();ws(0,"button",51),Rg("click",function(){wf(e);let i=EC(5);return Cf(i.markSelectedPausedDone())}),ws(1,"mat-icon"),QC(2,"check_circle_outline"),hl(),QC(3),hl();}if(a&2){let e=EC(5);bg("matTooltip","Mark "+e.selectedPausedCount()+" task(s) as done"),nI(3),Dl(" Mark done (",e.selectedPausedCount(),") ");}}function Tn(a,t){if(a&1){let e=gC();ws(0,"mat-checkbox",48),Rg("change",function(){wf(e);let i=EC(4);return Cf(i.toggleSelectAllPaused())}),hl(),oC(1,Sn,4,2,"button",49),ws(2,"button",50),Rg("click",function(){wf(e);let i=EC(4);return Cf(i.toggleSelectMode())}),ws(3,"mat-icon"),QC(4,"close"),hl()();}if(a&2){let e=EC(4);bg("checked",e.allPausedSelected())("indeterminate",e.somePausedSelected()&&!e.allPausedSelected()),nI(),iC(e.selectedPausedCount()>0?1:-1);}}function wn(a,t){if(a&1){let e=gC();ws(0,"button",52),Rg("click",function(){wf(e);let i=EC(4);return Cf(i.toggleSelectMode())}),ws(1,"mat-icon"),QC(2,"checklist"),hl(),QC(3," Select "),hl();}}function Pn(a,t){if(a&1&&(ws(0,"div",41)(1,"h3",42)(2,"mat-icon",44),QC(3),hl(),QC(4),ws(5,"span",45),QC(6),hl()(),ws(7,"div",46),oC(8,Tn,5,3)(9,wn,4,0,"button",47),hl()()),a&2){let e=EC().$implicit,n=EC(2);nI(3),Yg(e.icon),nI(),Dl(" ",e.label," "),nI(2),Yg(e.tasks.length),nI(2),iC(n.isSelectMode()?8:9);}}function Dn(a,t){if(a&1&&(ws(0,"h3",42)(1,"mat-icon",44),QC(2),hl(),QC(3),ws(4,"span",45),QC(5),hl()()),a&2){let e=EC().$implicit;nI(2),Yg(e.icon),nI(),Dl(" ",e.label," "),nI(2),Yg(e.tasks.length);}}function jn(a,t){if(a&1){let e=gC();ws(0,"app-task-card",53),Rg("stopRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=wf(e).$implicit,p=EC(3);return Cf(p.onPreviewRequested(i,l.projectId,l.name))})("selectionChanged",function(i){wf(e);let l=EC(3);return Cf(l.onPausedSelectionChanged(i.id,i.selected))}),hl();}if(a&2){let e=t.$implicit,n=EC().$implicit,i=EC(2);Ug("is-previewed",i.previewThreadId()===e.id),bg("task",e)("projectNameOverride",e.projectId)("showProject",true)("previewMode",i.previewActive())("selectable",n.status==="paused"&&i.isSelectMode())("selected",i.selectedPausedIds().has(e.id));}}function On(a,t){if(a&1&&(ws(0,"section",40),oC(1,Pn,10,4,"div",41)(2,Dn,6,3,"h3",42),ws(3,"div",31),cC(4,jn,1,8,"app-task-card",43,Pt),hl()()),a&2){let e=t.$implicit;nI(),iC(e.status==="paused"?1:2),nI(3),uC(e.tasks);}}function En(a,t){if(a&1&&cC(0,On,6,1,"section",40,fn),a&2){let e=EC();uC(e.taskGroups());}}function Nn(a,t){if(a&1){let e=gC();ws(0,"app-task-card",55),Rg("stopRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=wf(e).$implicit,p=EC(2);return Cf(p.onPreviewRequested(i,l.projectId,l.name))}),hl();}if(a&2){let e=t.$implicit,n=EC(2);Ug("is-previewed",n.previewThreadId()===e.id),bg("task",e)("projectNameOverride",e.projectId)("showProject",true)("previewMode",n.previewActive());}}function In(a,t){if(a&1&&(ws(0,"div",31),cC(1,Nn,1,6,"app-task-card",54,Pt),hl()),a&2){let e=EC();nI(),uC(e.displayedTasks());}}function An(a,t){if(a&1){let e=gC();ws(0,"div",56),Rg("mousedown",function(i){wf(e);let l=EC();return Cf(l.onResizerMousedown(i))}),hl(),ws(1,"div",57)(2,"header",58)(3,"span",59),QC(4),hl(),ws(5,"div",60)(6,"button",61),Rg("click",function(){wf(e);let i=EC();return Cf(i.navigateToThread())}),ws(7,"mat-icon"),QC(8,"open_in_new"),hl()(),ws(9,"button",62),Rg("click",function(){wf(e);let i=EC();return Cf(i.closePreview())}),ws(10,"mat-icon"),QC(11,"close"),hl()()()(),ws(12,"div",63),Sg(13,"app-thread",64),hl()();}if(a&2){let e=EC();nI(),Hg("width",e.previewPanelWidthPercent(),"%"),nI(3),Yg(e.previewTaskName()||"Task"),nI(9),bg("projectName",e.previewProjectId())("threadId",e.previewThreadId());}}var Vn=20,Fn=70,Gn=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{status:"in-progress",label:"In progress",icon:"pending"},{status:"paused",label:"Paused",icon:"pause_circle"},{status:"error",label:"Error",icon:"error"},{status:"done",label:"Done",icon:"check_circle"}],Rn=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],wt=class a{globalTaskService=g(Se);destroyRef=g(we);dialog=g(Re);router=g(G);configState=g(Te);userService=g(pe);preferences=g(L);projectState=g(P);threadState=g(U);breakpointObserver=g(Ot$1);username=F(this.userService.username$,{initialValue:null});isDesktop=F(this.breakpointObserver.observe("(min-width: 1280px)").pipe(ue(t=>t.matches)),{initialValue:false});previewEnabled=F(this.preferences.missionPreviewEnabled$,{initialValue:false});previewActive=ET(()=>this.previewEnabled()&&this.isDesktop());previewThreadId=Gi(null);previewProjectId=Gi(null);previewTaskName=Gi(null);previewPanelWidthPercent=Gi(this.preferences.getMissionPreviewPanelWidth());isDraggingResizer=false;dragStartX=0;dragStartWidth=0;containerWidth=0;layoutContainerRef;globalEventSource=null;filters=Rn;activeFilter=Gi("all");starredOnly=Gi(false);activeProject=Gi(null);searchQuery=Gi("");isLoading=this.globalTaskService.isLoading;allTasks=this.globalTaskService.tasks;isSelectMode=Gi(false);selectedPausedIds=Gi(new Set);pausedTasks=ET(()=>this.displayedTasks().filter(t=>t.status==="paused"));allPausedSelected=ET(()=>{let t=this.pausedTasks(),e=this.selectedPausedIds();return t.length>0&&t.every(n=>e.has(n.id))});somePausedSelected=ET(()=>{let t=this.selectedPausedIds();return this.pausedTasks().some(e=>t.has(e.id))});selectedPausedCount=ET(()=>{let t=this.selectedPausedIds();return this.pausedTasks().filter(e=>t.has(e.id)).length});projectSummaries=ET(()=>{let t=this.allTasks(),e=new Map;for(let n of t)e.set(n.projectId,(e.get(n.projectId)??0)+1);return [...e.entries()].map(([n,i])=>({name:n,count:i})).sort((n,i)=>n.name.localeCompare(i.name))});filteredTasks=ET(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(l=>l.projectId===e));let n=this.username();this.starredOnly()&&n&&(t=t.filter(l=>l.starring.includes(n)));let i=this.activeFilter();return i!=="all"&&(t=t.filter(l=>l.status===i)),t});filterCounts=ET(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(i=>i.projectId===e));let n=this.username();return this.starredOnly()&&n&&(t=t.filter(i=>i.starring.includes(n))),{all:t.length,"waiting-you":t.filter(i=>i.status==="waiting-you").length,"in-progress":t.filter(i=>i.status==="in-progress").length,done:t.filter(i=>i.status==="done").length,paused:t.filter(i=>i.status==="paused").length,error:t.filter(i=>i.status==="error").length}});displayedTasks=ET(()=>{let t=this.searchQuery().toLowerCase().trim(),e=this.sortedFilteredTasks();return t?e.filter(n=>(n.name||"").toLowerCase().includes(t)||(n.summary||"").toLowerCase().includes(t)):e});taskGroups=ET(()=>{let t=this.displayedTasks();return Gn.map(e=>z$1(P$1({},e),{tasks:t.filter(n=>n.status===e.status)})).filter(e=>e.tasks.length>0)});sortedFilteredTasks=ET(()=>{let t=this.filteredTasks(),e={"waiting-you":0,"in-progress":1,paused:2,error:3,done:4};return [...t].sort((n,i)=>(e[n.status]??99)-(e[i.status]??99))});constructor(){this.destroyRef.onDestroy(()=>this.disconnectGlobalSse());}ngOnInit(){this.globalTaskService.refresh(),this.connectGlobalSse(),this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[GTC] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}setProject(t){this.activeProject.set(t),this.activeFilter.set("all");}onSearchInput(t){this.searchQuery.set(t.target.value);}clearSearch(){this.searchQuery.set("");}refresh(){this.globalTaskService.refresh();}openPreferences(){this.dialog.open(Ye,{width:"400px"});}openTokenUsage(){this.router.navigate(["/token-usage"]);}openUserConfig(){this.configState.openUserConfigEditor();}openQuickSchedulerDialog(){this.dialog.open(z,{width:"480px",disableClose:false});}openGlobalSchedulersDialog(){this.dialog.open(Me,{width:"600px",maxHeight:"80vh"});}openNewTaskDialog(){this.dialog.open(ke,{width:"500px",disableClose:false}).afterClosed().subscribe(e=>{e&&(e.navigate?this.router.navigate(["project",e.projectId]):(setTimeout(()=>this.globalTaskService.refresh(),300),setTimeout(()=>this.globalTaskService.refresh(),1500)));});}onStopRequested(t,e){this.globalTaskService.stopThread(e,t);}onDeleteRequested(t,e){this.globalTaskService.deleteThread(e,t);}onStarToggled(t,e){let n=this.allTasks().find(p=>p.id===t);if(!n)return;let i=this.username(),l=!!i&&n.starring.includes(i);this.globalTaskService.toggleStar(e,t,l);}onCloseTaskRequested(t,e){let i=this.allTasks().find(p=>p.id===t)?.worktreeProject??e;this.dialog.open(z$2,{width:"420px",data:{title:"Close task",message:`This will stop the agent, delete the thread and remove the worktree project "${i}" from disk. This cannot be undone.`,confirmLabel:"Close task",cancelLabel:"Cancel"}}).afterClosed().subscribe(p=>{p&&this.globalTaskService.closeTask(e,t);});}onMarkDoneRequested(t,e){this.globalTaskService.markTaskDone(e,t);}onMarkActiveRequested(t,e){this.globalTaskService.markTaskActive(e,t);}toggleSelectMode(){let t=!this.isSelectMode();this.isSelectMode.set(t),t||this.selectedPausedIds.set(new Set);}onPausedSelectionChanged(t,e){this.selectedPausedIds.update(n=>{let i=new Set(n);return e?i.add(t):i.delete(t),i});}toggleSelectAllPaused(){let t=this.pausedTasks();this.allPausedSelected()?this.selectedPausedIds.set(new Set):this.selectedPausedIds.set(new Set(t.map(e=>e.id)));}markSelectedPausedDone(){let t=this.selectedPausedIds(),e=this.pausedTasks().filter(n=>t.has(n.id)).map(n=>({id:n.id,projectId:n.projectId}));e.length!==0&&(this.selectedPausedIds.set(new Set),this.isSelectMode.set(false),this.globalTaskService.markTasksBatchDone(e));}onPreviewRequested(t,e,n){this.previewThreadId()===t?(this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null)):(this.projectState.selectProject(e),this.threadState.selectThread(t),this.previewProjectId.set(e),this.previewThreadId.set(t),this.previewTaskName.set(n));}closePreview(){this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null);}navigateToThread(){let t=this.previewThreadId(),e=this.previewProjectId();!t||!e||this.router.navigate(["project",e,"thread",t]);}onResizerMousedown(t){t.preventDefault(),this.isDraggingResizer=true,this.dragStartX=t.clientX,this.dragStartWidth=this.previewPanelWidthPercent(),this.containerWidth=this.layoutContainerRef?.nativeElement.offsetWidth??window.innerWidth;}onDocumentMousemove(t){if(!this.isDraggingResizer)return;let n=(this.dragStartX-t.clientX)/this.containerWidth*100,i=Math.min(Fn,Math.max(Vn,this.dragStartWidth+n));this.previewPanelWidthPercent.set(i);}onDocumentMouseup(){this.isDraggingResizer&&(this.isDraggingResizer=false,this.preferences.setMissionPreviewPanelWidth(this.previewPanelWidthPercent()));}connectGlobalSse(t=5e3){this.disconnectGlobalSse();let e=new EventSource("/api/event-stream");this.globalEventSource=e,e.onmessage=n=>{try{let i=JSON.parse(n.data),l=le(i);if(!l)return;let p=l.threadId;if(!p)return;l instanceof f||l instanceof b?this.globalTaskService.applyStatusEvent(p,"invite"):l instanceof O?this.globalTaskService.applyStatusEvent(p,"thinking"):l instanceof V&&this.globalTaskService.refresh();}catch(i){}},e.onerror=()=>{e.readyState===EventSource.CLOSED&&(this.globalEventSource=null,setTimeout(()=>{this.globalEventSource||this.connectGlobalSse(Math.min(t*2,6e4));},t));};}disconnectGlobalSse(){this.globalEventSource&&(this.globalEventSource.close(),this.globalEventSource=null);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=Fw({type:a,selectors:[["app-global-task-control"]],viewQuery:function(e,n){if(e&1&&Pg(gn,5),e&2){let i;bC(i=SC())&&(n.layoutContainerRef=i.first);}},hostBindings:function(e,n){e&1&&Rg("mousemove",function(l){return n.onDocumentMousemove(l)},gE)("mouseup",function(){return n.onDocumentMouseup()},gE);},decls:85,vars:11,consts:[["layoutContainer",""],["schedulerMenu","matMenu"],["controlCenterMenu","matMenu"],[1,"gtc"],[1,"gtc-toolbar"],[1,"gtc-toolbar-left"],[1,"gtc-logo-icon"],[1,"gtc-title"],["appearance","fill","subscriptSizing","dynamic",1,"gtc-search"],["matPrefix",""],["matInput","","type","search","placeholder","Filter tasks\u2026","autocomplete","off",3,"input","keydown.escape","value"],["matSuffix","","mat-icon-button","","aria-label","Clear"],[1,"gtc-toolbar-actions"],["mat-icon-button","","matTooltip","Schedulers","aria-label","Schedulers",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-icon-button","","matTooltip","Control Center","aria-label","Control Center",3,"matMenuTriggerFor"],["mat-menu-item","","href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer"],["mat-icon-button","","matTooltip","Refresh all tasks","aria-label","Refresh tasks",3,"click","disabled"],["mat-stroked-button","","routerLink","/projects","aria-label","Manage projects","matTooltip","Manage projects"],[1,"btn-label"],["mat-flat-button","","aria-label","New task","matTooltip","New Task",1,"gtc-new-btn",3,"click"],[1,"gtc-filter-bar"],["aria-label","Filter by project",1,"gtc-project-filters"],["role","tablist","aria-label","Filter by status",1,"gtc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"gtc-body"],[1,"gtc-content"],[1,"gtc-loading"],[1,"gtc-empty"],[1,"gtc-grid"],["matSuffix","","mat-icon-button","","aria-label","Clear",3,"click"],[1,"project-chip",3,"click"],[1,"chip-count"],[1,"project-chip",3,"active"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","36"],[1,"empty-icon"],[1,"gtc-group"],[1,"gtc-group-header"],[1,"gtc-group-title"],[3,"task","projectNameOverride","showProject","previewMode","selectable","selected","is-previewed"],[1,"group-icon"],[1,"group-count"],[1,"gtc-group-actions"],["mat-stroked-button","","matTooltip","Select multiple tasks to mark as done","aria-label","Enter selection mode",1,"select-mode-btn"],["aria-label","Select all paused tasks",1,"select-all-checkbox",3,"change","checked","indeterminate"],["mat-flat-button","",1,"batch-done-btn",3,"matTooltip"],["mat-icon-button","","matTooltip","Cancel selection","aria-label","Cancel selection",1,"select-mode-cancel-btn",3,"click"],["mat-flat-button","",1,"batch-done-btn",3,"click","matTooltip"],["mat-stroked-button","","matTooltip","Select multiple tasks to mark as done","aria-label","Enter selection mode",1,"select-mode-btn",3,"click"],[3,"stopRequested","deleteRequested","starToggled","closeTaskRequested","markDoneRequested","markActiveRequested","previewRequested","selectionChanged","task","projectNameOverride","showProject","previewMode","selectable","selected"],[3,"task","projectNameOverride","showProject","previewMode","is-previewed"],[3,"stopRequested","deleteRequested","starToggled","closeTaskRequested","markDoneRequested","markActiveRequested","previewRequested","task","projectNameOverride","showProject","previewMode"],["matTooltip","Drag to resize","aria-hidden","true",1,"gtc-resizer",3,"mousedown"],[1,"gtc-preview-pane"],[1,"gtc-preview-header"],[1,"gtc-preview-title"],[1,"gtc-preview-actions"],["matTooltip","Open full view","aria-label","Open thread in full view","type","button",1,"preview-action-btn",3,"click"],["matTooltip","Close panel","aria-label","Close preview panel","type","button",1,"preview-action-btn",3,"click"],[1,"gtc-preview-body","thread-preview-host"],[3,"projectName","threadId"]],template:function(e,n){if(e&1&&(ws(0,"div",3,0)(2,"header",4)(3,"div",5)(4,"mat-icon",6),QC(5,"hub"),hl(),ws(6,"h1",7),QC(7,"Global Task Control"),hl()(),ws(8,"mat-form-field",8)(9,"mat-icon",9),QC(10,"search"),hl(),ws(11,"input",10),Rg("input",function(l){return n.onSearchInput(l)})("keydown.escape",function(){return n.clearSearch()}),hl(),oC(12,bn,3,0,"button",11),hl(),ws(13,"div",12)(14,"button",13)(15,"mat-icon"),QC(16,"schedule"),hl()(),ws(17,"mat-menu",null,1)(19,"button",14),Rg("click",function(){return n.openGlobalSchedulersDialog()}),ws(20,"mat-icon"),QC(21,"list"),hl(),ws(22,"span"),QC(23,"View schedulers"),hl()(),ws(24,"button",14),Rg("click",function(){return n.openQuickSchedulerDialog()}),ws(25,"mat-icon"),QC(26,"add"),hl(),ws(27,"span"),QC(28,"New scheduler"),hl()()(),ws(29,"button",15)(30,"mat-icon"),QC(31,"hub"),hl()(),ws(32,"mat-menu",null,2)(34,"button",14),Rg("click",function(){return n.openPreferences()}),ws(35,"mat-icon"),QC(36,"tune"),hl(),ws(37,"span"),QC(38,"Preferences"),hl()(),ws(39,"button",14),Rg("click",function(){return n.openTokenUsage()}),ws(40,"mat-icon"),QC(41,"data_usage"),hl(),ws(42,"span"),QC(43,"Token Usage"),hl()(),ws(44,"button",14),Rg("click",function(){return n.openUserConfig()}),ws(45,"mat-icon"),QC(46,"manage_accounts"),hl(),ws(47,"span"),QC(48,"User Configuration"),hl()(),Sg(49,"mat-divider"),ws(50,"a",16)(51,"mat-icon"),QC(52,"code"),hl(),ws(53,"span"),QC(54,"Contribute on GitHub"),hl()()(),ws(55,"button",17),Rg("click",function(){return n.refresh()}),ws(56,"mat-icon"),QC(57,"refresh"),hl()(),ws(58,"button",18)(59,"mat-icon"),QC(60,"settings"),hl(),ws(61,"span",19),QC(62,"Manage projects"),hl()(),ws(63,"button",20),Rg("click",function(){return n.openNewTaskDialog()}),ws(64,"mat-icon"),QC(65,"rocket_launch"),hl(),ws(66,"span",19),QC(67,"New Task"),hl()()()(),ws(68,"div",21),oC(69,Cn,7,3,"nav",22),ws(70,"nav",23),cC(71,xn,6,6,"button",24,hn),ws(73,"button",25),Rg("click",function(){return n.toggleStarredFilter()}),ws(74,"mat-icon",26),QC(75,"star"),hl(),ws(76,"span"),QC(77,"Starred"),hl()()()(),ws(78,"div",27)(79,"main",28),oC(80,kn,4,0,"div",29)(81,Mn,5,0,"div",30)(82,En,2,0)(83,In,3,0,"div",31),hl(),oC(84,An,14,5),hl()()),e&2){let i=MC(18),l=MC(33);nI(11),bg("value",n.searchQuery()),nI(),iC(n.searchQuery()?12:-1),nI(2),bg("matMenuTriggerFor",i),nI(15),bg("matMenuTriggerFor",l),nI(26),bg("disabled",n.isLoading()),nI(14),iC(n.projectSummaries().length>1?69:-1),nI(2),uC(n.filters),nI(2),Ug("active",n.starredOnly()),Tg("aria-checked",n.starredOnly()),nI(7),iC(n.isLoading()?80:n.displayedTasks().length===0?81:n.activeFilter()==="all"&&!n.searchQuery()?82:83),nI(4),iC(n.previewActive()&&n.previewThreadId()&&n.previewProjectId()?84:-1);}},dependencies:[A,_i,ve,ne,yt,wt$1,hr,pr,Gn$1,Ve,ne$1,Et$1,yt$1,In$1,De,Be,En$1,He,Ne,ce,nt,Ot$2,zt$1,Tn$1,Sn$1,si],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.gtc[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden}.gtc-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:0 .75rem;height:56px;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .1));box-sizing:border-box}.gtc-toolbar-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-logo-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem;color:var(--color-primary)}.gtc-title[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600;color:var(--color-text);white-space:nowrap}.gtc-search[_ngcontent-%COMP%]{margin-left:auto;flex:0 1 240px;min-width:80px;--mat-form-field-container-height: 36px;--mat-form-field-container-vertical-padding: 6px;font-size:.875rem;--mdc-filled-text-field-container-color: transparent;--mdc-filled-text-field-hover-container-color: transparent;--mdc-filled-text-field-focus-container-color: transparent;--mdc-filled-text-field-active-indicator-color: transparent;--mdc-filled-text-field-hover-active-indicator-color: transparent;--mdc-filled-text-field-focus-active-indicator-color: transparent;--mdc-filled-text-field-active-indicator-height: 0}.gtc-toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-new-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;height:36px;padding:0 1rem}.gtc-new-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}@media(max-width:600px){.gtc-toolbar[_ngcontent-%COMP%]{flex-wrap:wrap;height:auto;min-height:48px;padding:.5rem .75rem;gap:.375rem}.gtc-title[_ngcontent-%COMP%]{font-size:.875rem}.gtc-search[_ngcontent-%COMP%]{order:3;flex:1 1 100%;min-width:0;margin-left:0}.gtc-toolbar-actions[_ngcontent-%COMP%]{margin-left:auto}.btn-label[_ngcontent-%COMP%]{display:none}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]){--mdc-text-button-container-height: 36px;--mdc-filled-button-container-height: 36px;--mdc-outlined-button-container-height: 36px;min-width:36px;width:36px;height:36px;padding:0;border-radius:50%!important}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) .mat-mdc-button-touch-target[_ngcontent-%COMP%]{width:36px;height:36px}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) mat-icon[_ngcontent-%COMP%]{margin:0!important}}.gtc-filter-bar[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem;padding:.5rem .75rem;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .08))}.gtc-project-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.project-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;padding:.2rem .65rem;border-radius:100px;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:transparent;border:1px solid var(--color-border);cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.project-chip[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .3rem;font-size:.68rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.project-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.project-chip.active[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.project-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.gtc-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.3rem .75rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.gtc-body[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex:1;overflow:hidden;min-height:0}.gtc-content[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:1rem 1rem 2rem;min-width:0}.gtc-resizer[_ngcontent-%COMP%]{width:6px;flex-shrink:0;cursor:col-resize;background:transparent;border-left:1px solid var(--color-border);border-right:1px solid var(--color-border);transition:background .15s ease}.gtc-resizer[_ngcontent-%COMP%]:hover, .gtc-resizer[_ngcontent-%COMP%]:active{background:var(--color-primary);opacity:.4}.gtc-preview-pane[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;flex-shrink:0;min-width:280px;border-left:1px solid var(--color-border);background:var(--glass-bg)}.gtc-preview-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.625rem .75rem .625rem 1rem;border-bottom:1px solid var(--color-border);flex-shrink:0}.gtc-preview-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1}.gtc-preview-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;flex-shrink:0}.preview-action-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:6px;background:transparent;cursor:pointer;transition:background .15s ease}.preview-action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px;vertical-align:middle;color:var(--color-text-secondary)}.preview-action-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.preview-action-btn[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-text)}.gtc-preview-body[_ngcontent-%COMP%]{flex:1;overflow:hidden;display:flex;flex-direction:column;min-height:0}.gtc-preview-body[_ngcontent-%COMP%] app-thread[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;min-height:0} app-task-card.is-previewed .task-card{border-color:var(--color-primary);box-shadow:0 0 0 2px var(--color-primary)}.gtc-group[_ngcontent-%COMP%]{margin-bottom:1.25rem}.gtc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.gtc-group-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:.75rem;gap:.75rem}.gtc-group-header[_ngcontent-%COMP%] .gtc-group-title[_ngcontent-%COMP%]{margin-bottom:0}.gtc-group-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.select-all-checkbox[_ngcontent-%COMP%]{--mdc-checkbox-state-layer-size: 32px}.select-mode-btn[_ngcontent-%COMP%]{height:26px;font-size:.72rem;font-weight:600;padding:0 .625rem;border-radius:8px;color:var(--color-text-secondary);border-color:var(--color-border);line-height:26px}.select-mode-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem;margin-right:.2rem}.select-mode-btn[_ngcontent-%COMP%]:hover{color:var(--color-text);border-color:var(--color-text-secondary);background:var(--color-bg-hover)}.batch-done-btn[_ngcontent-%COMP%]{height:26px;font-size:.72rem;font-weight:600;padding:0 .625rem;border-radius:8px;background:var(--color-success, #34c759);color:#fff;line-height:26px}.batch-done-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem;margin-right:.2rem}.select-mode-cancel-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:inline-flex!important;align-items:center!important;justify-content:center!important;color:var(--color-text-secondary)}.select-mode-cancel-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;line-height:1}.select-mode-cancel-btn[_ngcontent-%COMP%]:hover{color:var(--color-text)}.gtc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.gtc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:.95rem;width:.95rem;height:.95rem}.gtc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.gtc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem}@media(max-width:600px){.gtc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.gtc-loading[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;padding:3rem;color:var(--color-text-secondary);text-align:center}.gtc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.9rem}.empty-icon[_ngcontent-%COMP%]{font-size:2.5rem;width:2.5rem;height:2.5rem;opacity:.3}"]})};
1
+ import {A,b as bt,k as kt}from'./chunk-py_Q_oQH.js';import {z as z$2}from'./chunk-B17Inq8D.js';import {_ as _i}from'./chunk-WSA7xa0h.js';import {f as f$1}from'./chunk-DMUiJ7oP.js';import {Y as Ye,E as Et$1,y as yt$1,Z as Ze}from'./chunk-CJEW8Ogd.js';import'./chunk-4uEZjTft.js';import {g,C as Ce,R as Re,G,p as pe,L,P,U,O as Ot$1,F,r as re,T as TT,W as Wi,z as z$1,a as P$1,b as U$1,l as le,f,c as b,d as O,V,j as jw,h as hr,e as pr,i as Gn$1,s as si,k as Cs,J as JC,m as hl,n as kg,o as aC,M as Mg,q as dC,A as AC,t as sI,_ as _g,u as cC,v as fC,w as zg,S as Sg,D as DE,x as jg,y as MC,N as NC,B as gy,E as N,H as c,Q as Qy,$ as $y,I as br,K as x,X as z$3,Y as Ue,Z as zt$2,a0 as jt,a1 as Vt$1,a2 as Nt$1,a3 as ZI,a4 as lC,a5 as Dl,a6 as QI,a7 as va,a8 as Kg,a9 as vC,aa as Cf,ab as Tf,ac as CC,ad as $g}from'./main-YYHD6X7H.js';import'./chunk-D26Y186i.js';import {x as xe,k as kt$1,C as Ct,z as ze}from'./chunk-BqWEyotW.js';import {P as Pt$1,L as Lt$1}from'./chunk-D2zGvbD2.js';import {v as ve,n as ne}from'./chunk-Buu9Jf-V.js';import'./chunk-CmyT-Z4A.js';import {W,k as ke$1,s as se}from'./chunk-DoqL_RuM.js';import {c as ce,n as nt,O as Ot$2,z as zt$1,T as Tn$1,S as Sn$1,a as ae}from'./chunk-CXgj_KJY.js';import {I as In$1,D as De,B as Be,E as En$1,F as Fn$1}from'./chunk-B13_C_P9.js';import {V as Ve,n as ne$1,H as He,N as Ne}from'./chunk-CgNkwpQ7.js';import {y as yt,w as wt$1,t as ti,Y as Ye$1,f as fn$1,Z as Zn,$ as $t$1,c as cn$1}from'./chunk-FMHkoXwM.js';var Ot=(a,t)=>t.name;function Et(a,t){if(a&1&&(Cs(0,"mat-option",11),JC(1),hl()),a&2){let e=t.$implicit;_g("value",e),sI(),Kg(e);}}function Nt(a,t){a&1&&Mg(0,"mat-spinner",13);}function It(a,t){if(a&1&&(Cs(0,"span",20),JC(1),hl()),a&2){let e=CC().$implicit;sI(),Kg(e.description);}}function At(a,t){if(a&1&&(Cs(0,"mat-option",11)(1,"span",19),JC(2),hl(),aC(3,It,2,1,"span",20),hl()),a&2){let e=t.$implicit;_g("value",e.name),sI(2),Kg(e.name),sI(),cC(e.description?3:-1);}}function Vt(a,t){if(a&1&&(Cs(0,"mat-option",11),JC(1),hl()),a&2){let e=t.$implicit;_g("value",e),sI(),Kg(e);}}function Ft(a,t){if(a&1){let e=vC();Cs(0,"div",25)(1,"mat-form-field",8)(2,"mat-label"),JC(3,"Name"),hl(),Cs(4,"input",26),kg("input",function(i){Cf(e);let l=CC(2);return Tf(l.issueNumber.set(i.target.value))}),hl()(),Cs(5,"mat-form-field",27)(6,"mat-label"),JC(7,"Type"),hl(),Cs(8,"mat-select",28),kg("selectionChange",function(i){Cf(e);let l=CC(2);return Tf(l.branchType.set(i.value))}),dC(9,Vt,2,2,"mat-option",11,lC),hl()()();}if(a&2){let e=CC(2);sI(4),_g("value",e.issueNumber()),sI(4),_g("value",e.branchType()),sI(),fC(e.branchTypes);}}function Gt(a,t){a&1&&Mg(0,"mat-spinner",13);}function Rt(a,t){if(a&1&&(Cs(0,"mat-option",11),JC(1),hl()),a&2){let e=t.$implicit;_g("value",e),sI(),Kg(e);}}function qt(a,t){if(a&1){let e=vC();Cs(0,"mat-form-field",8)(1,"mat-label"),JC(2,"Source branch"),hl(),Cs(3,"input",29,4),kg("input",function(i){Cf(e);let l=CC(2);return Tf(l.onBranchSearchInput(i.target.value))})("focus",function(){Cf(e);let i=AC(4),l=CC(2);return Tf(l.openPanel(i))}),hl(),aC(5,Gt,1,0,"mat-spinner",13),Cs(6,"mat-autocomplete",10,5),kg("optionSelected",function(i){Cf(e);let l=CC(2);return Tf(l.selectBranch(i.option.value))}),dC(8,Rt,2,2,"mat-option",11,lC),hl()();}if(a&2){let e=AC(7),n=CC(2);sI(3),_g("value",n.branchSearch())("matAutocomplete",e)("disabled",n.isLoadingBranches()),sI(2),cC(n.isLoadingBranches()?5:-1),sI(3),fC(n.filteredBranches());}}function $t(a,t){if(a&1){let e=vC();Cs(0,"div",21)(1,"button",22),kg("click",function(){Cf(e);let i=CC();return Tf(i.onModeChange("local"))}),Cs(2,"mat-icon"),JC(3,"folder_open"),hl(),Cs(4,"span",23),JC(5,"Local"),hl(),Cs(6,"span",24),JC(7,"Work directly on the current branch"),hl()(),Cs(8,"button",22),kg("click",function(){Cf(e);let i=CC();return Tf(i.onModeChange("worktree"))}),Cs(9,"mat-icon"),JC(10,"account_tree"),hl(),Cs(11,"span",23),JC(12,"Worktree"),hl(),Cs(13,"span",24),JC(14,"Create an isolated worktree from a branch"),hl()()(),aC(15,Ft,11,2,"div",25),aC(16,qt,10,4,"mat-form-field",8);}if(a&2){let e=CC();sI(),zg("active",e.mode()==="local"),sI(7),zg("active",e.mode()==="worktree"),sI(7),cC(e.isWorktree()?15:-1),sI(),cC(e.isWorktree()?16:-1);}}function Lt(a,t){a&1&&Mg(0,"mat-spinner",18);}function zt(a,t){a&1&&(Cs(0,"mat-icon"),JC(1,"rocket_launch"),hl());}function Bt(a,t){a&1&&(Cs(0,"mat-icon"),JC(1,"open_in_new"),hl());}var ke=class a{projectApi=g(c);agentApi=g(f$1);dialogRef=g(z$3);projectState=g(P);forcedProject=F(this.projectState.forcedProject$,{initialValue:null});selectedProject=Wi("");projectSearch=Wi("");selectedAgent=Wi("");agentSearch=Wi("");mode=Wi("local");selectedBranch=Wi("");branchSearch=Wi("");issueNumber=Wi("");branchType=Wi("feature");task=Wi("");hasGit=Wi(false);branchTypes=["feature","fix","refactor","chore","docs","build"];projects=Wi([]);agents=Wi([]);branches=Wi([]);filteredProjects=TT(()=>{let t=this.projectSearch().toLowerCase();return t?this.projects().filter(e=>e.toLowerCase().includes(t)):this.projects()});filteredAgents=TT(()=>{let t=this.agentSearch().toLowerCase();return t?this.agents().filter(e=>e.name.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)):this.agents()});filteredBranches=TT(()=>{let t=this.branchSearch().toLowerCase();return t?this.branches().filter(e=>e.toLowerCase().includes(t)):this.branches()});isLoadingAgents=Wi(false);isLoadingBranches=Wi(false);isSubmitting=Wi(false);isWorktree=TT(()=>this.mode()==="worktree"&&this.hasGit());isValid=TT(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(i=>i.name===this.selectedAgent()),n=t&&e&&!!this.task().trim();return this.isWorktree()?n&&!!this.selectedBranch()&&!!this.issueNumber().trim()&&!!this.branchType():n});canNavigate=TT(()=>this.projects().includes(this.selectedProject()));openPanel(t){t.openPanel();}onProjectSearchInput(t){this.projectSearch.set(t),this.selectedProject()&&t!==this.selectedProject()&&(this.selectedProject.set(""),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]));}selectProject(t){this.selectedProject.set(t),this.projectSearch.set(t),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]),this.branches.set([]),this.selectedBranch.set(""),this.branchSearch.set(""),this.hasGit.set(false),this.mode.set("local"),this.isLoadingAgents.set(true),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(false);},error:()=>{this.isLoadingAgents.set(false);}}),this.projectApi.getGitBranches(t).subscribe({next:({branches:e})=>{this.hasGit.set(e.length>0);},error:()=>{this.hasGit.set(false);}});}onAgentSearchInput(t){this.agentSearch.set(t),this.selectedAgent()&&t!==this.selectedAgent()&&this.selectedAgent.set("");}selectAgent(t){this.selectedAgent.set(t),this.agentSearch.set(t);}onBranchSearchInput(t){this.branchSearch.set(t),this.selectedBranch()&&t!==this.selectedBranch()&&this.selectedBranch.set("");}selectBranch(t){this.selectedBranch.set(t),this.branchSearch.set(t);}ngOnInit(){this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(n=>n.name);this.projects.set(e),e.length===1&&e[0]&&this.selectProject(e[0]);}});}onProjectChange(t){this.selectProject(t);}onModeChange(t){this.mode.set(t),t==="worktree"&&this.selectedProject()&&this.branches().length===0&&this.loadBranches();}loadBranches(){this.isLoadingBranches.set(true),this.projectApi.getGitBranches(this.selectedProject()).subscribe({next:({branches:t})=>{this.branches.set(t),this.isLoadingBranches.set(false);},error:()=>{this.isLoadingBranches.set(false);}});}submit(){if(!this.isSubmitting()){if(this.isValid()){this.isSubmitting.set(true);let t=this.isWorktree()&&this.issueNumber().trim()?`${this.issueNumber().trim()} ${this.task().trim()}`:this.task().trim();this.projectApi.createTask(this.selectedProject(),this.selectedAgent(),t,this.isWorktree()?"worktree":"local",this.isWorktree()?this.selectedBranch():void 0,this.isWorktree()?this.issueNumber().trim():void 0,this.isWorktree()?this.branchType():void 0).subscribe({next:({threadId:e,projectId:n})=>{this.dialogRef.close({threadId:e,projectId:n});},error:()=>{this.isSubmitting.set(false);}});return}if(this.canNavigate()){this.dialogRef.close({projectId:this.selectedProject(),navigate:true});return}}}cancel(){this.dialogRef.close(null);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["app-new-task-dialog"]],decls:37,vars:12,consts:[["projectTrigger","matAutocompleteTrigger"],["projectAuto",""],["agentTrigger","matAutocompleteTrigger"],["agentAuto",""],["branchTrigger","matAutocompleteTrigger"],["branchAuto",""],["mat-dialog-title",""],[1,"ntd-content"],["appearance","outline",1,"ntd-field"],["matInput","","placeholder","Search project...",3,"input","focus","value","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matInput","","placeholder","Search agent...",3,"input","focus","value","matAutocomplete","disabled"],["matSuffix","","diameter","16"],["matInput","","placeholder","Describe what the agent should accomplish...","rows","4",3,"input","value"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",1,"ntd-launch-btn",3,"click","disabled"],["diameter","16"],[1,"ntd-agent-name"],[1,"ntd-agent-desc"],[1,"ntd-radio-group"],["type","button",1,"ntd-mode-btn",3,"click"],[1,"ntd-radio-label"],[1,"ntd-radio-hint"],[1,"ntd-row"],["matInput","","type","text","placeholder","Name",3,"input","value"],["appearance","outline",1,"ntd-field","ntd-field--small"],[3,"selectionChange","value"],["matInput","","placeholder","Search branch...",3,"input","focus","value","matAutocomplete","disabled"]],template:function(e,n){if(e&1){let i=vC();Cs(0,"h2",6)(1,"mat-icon"),JC(2,"rocket_launch"),hl(),JC(3,` New Task
2
+ `),hl(),Cs(4,"mat-dialog-content",7)(5,"mat-form-field",8)(6,"mat-label"),JC(7,"Project"),hl(),Cs(8,"input",9,0),kg("input",function(p){return n.onProjectSearchInput(p.target.value)})("focus",function(){Cf(i);let p=AC(9);return Tf(n.openPanel(p))}),hl(),Cs(10,"mat-autocomplete",10,1),kg("optionSelected",function(p){return n.selectProject(p.option.value)}),dC(12,Et,2,2,"mat-option",11,lC),hl()(),Cs(14,"mat-form-field",8)(15,"mat-label"),JC(16,"Agent"),hl(),Cs(17,"input",12,2),kg("input",function(p){return n.onAgentSearchInput(p.target.value)})("focus",function(){Cf(i);let p=AC(18);return Tf(n.openPanel(p))}),hl(),aC(19,Nt,1,0,"mat-spinner",13),Cs(20,"mat-autocomplete",10,3),kg("optionSelected",function(p){return n.selectAgent(p.option.value)}),dC(22,At,4,3,"mat-option",11,Ot),hl()(),aC(24,$t,17,6),Cs(25,"mat-form-field",8)(26,"mat-label"),JC(27,"Task"),hl(),Cs(28,"textarea",14),kg("input",function(p){return n.task.set(p.target.value)}),hl()()(),Cs(29,"mat-dialog-actions",15)(30,"button",16),kg("click",function(){return n.cancel()}),JC(31,"Cancel"),hl(),Cs(32,"button",17),kg("click",function(){return n.submit()}),aC(33,Lt,1,0,"mat-spinner",18)(34,zt,2,0,"mat-icon")(35,Bt,2,0,"mat-icon"),JC(36),hl()();}if(e&2){let i=AC(11),l=AC(21);sI(8),_g("value",n.projectSearch())("matAutocomplete",i),sI(4),fC(n.filteredProjects()),sI(5),_g("value",n.agentSearch())("matAutocomplete",l)("disabled",!n.selectedProject()||n.isLoadingAgents()),sI(2),cC(n.isLoadingAgents()?19:-1),sI(3),fC(n.filteredAgents()),sI(2),cC(n.hasGit()&&!n.forcedProject()?24:-1),sI(4),_g("value",n.task()),sI(2),_g("disabled",n.isSubmitting()),sI(2),_g("disabled",!n.canNavigate()||n.isSubmitting()),sI(),cC(n.isSubmitting()?33:n.isValid()?34:35),sI(3),Dl(" ",n.isValid()?"Launch":"Open"," ");}},dependencies:[ti,zt$2,jt,Vt$1,Nt$1,hr,pr,ce,nt,ae,zt$1,Tn$1,Sn$1,kt$1,Ct,Fn$1,ze,Pt$1,Lt$1,Et$1,yt$1,yt,wt$1],styles:["h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:0}.ntd-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;padding-top:20px!important}.ntd-field[_ngcontent-%COMP%]{width:100%}.ntd-row[_ngcontent-%COMP%]{display:flex;gap:.75rem}.ntd-row[_ngcontent-%COMP%] .ntd-field--small[_ngcontent-%COMP%]{width:130px;flex-shrink:0}.ntd-radio-group[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding:.25rem 0 .75rem}.ntd-mode-btn[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;padding:.75rem;border:1px solid var(--color-border);border-radius:8px;background:transparent;color:var(--color-text);cursor:pointer;transition:border-color .15s,background .15s}.ntd-mode-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem;margin-bottom:.1rem}.ntd-mode-btn.active[_ngcontent-%COMP%]{border-color:var(--color-primary);background:color-mix(in srgb,var(--color-primary) 10%,transparent)}.ntd-mode-btn[_ngcontent-%COMP%]:hover:not(.active){border-color:var(--color-text-secondary)}.ntd-radio-label[_ngcontent-%COMP%]{font-weight:600;font-size:.9rem}.ntd-radio-hint[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);line-height:1.3;text-align:left}.ntd-agent-name[_ngcontent-%COMP%]{font-weight:500;display:block}.ntd-agent-desc[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:380px}.ntd-launch-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse)}.ntd-launch-btn[_ngcontent-%COMP%]:disabled{background:var(--color-border);color:var(--color-text-secondary);opacity:.6;cursor:not-allowed}"],changeDetection:1})};var Qt=(a,t)=>t.name,Ut=(a,t)=>t.value;function Ht(a,t){if(a&1&&(Cs(0,"mat-option",8),JC(1),hl()),a&2){let e=t.$implicit;_g("value",e),sI(),Kg(e);}}function Jt(a,t){a&1&&Mg(0,"mat-spinner",9);}function Xt(a,t){if(a&1&&(Cs(0,"mat-option",8),JC(1),hl()),a&2){let e=t.$implicit;_g("value",e.name),sI(),Kg(e.name);}}function Kt(a,t){if(a&1){let e=vC();Cs(0,"button",37),kg("click",function(){let i=Cf(e).$implicit,l=CC();return Tf(l.toggleDay(i.value))}),JC(1),hl();}if(a&2){let e=t.$implicit,n=CC();zg("selected",n.isDaySelected(e.value)),sI(),Dl(" ",e.label," ");}}function Yt(a,t){if(a&1){let e=vC();Cs(0,"mat-form-field",4)(1,"mat-label"),JC(2,"Number of runs"),hl(),Cs(3,"input",17),kg("ngModelChange",function(i){Cf(e);let l=CC();return Tf(l.endOccurrences.set(i))}),hl(),ZI(),hl();}if(a&2){let e=CC();sI(3),_g("ngModel",e.endOccurrences()),QI();}}function Zt(a,t){if(a&1){let e=vC();Cs(0,"mat-form-field",4)(1,"mat-label"),JC(2,"End date"),hl(),Cs(3,"input",38),kg("ngModelChange",function(i){Cf(e);let l=CC();return Tf(l.endTimestamp.set(i))}),hl(),ZI(),hl();}if(a&2){let e=CC();sI(3),_g("ngModel",e.endTimestamp())("min",e.startTimestamp()),QI();}}function en(a,t){if(a&1&&(Cs(0,"div",32)(1,"mat-icon"),JC(2,"error"),hl(),Cs(3,"span"),JC(4),hl()()),a&2){let e=CC();sI(4),Kg(e.errorMessage());}}function tn(a,t){a&1&&Mg(0,"mat-spinner",36);}function nn(a,t){a&1&&(Cs(0,"mat-icon"),JC(1,"schedule"),hl());}var z=class a{projectApi=g(c);agentApi=g(f$1);schedulerApi=g(xe);dialogRef=g(z$3);dialogData=g(Ue,{optional:true});isEditMode=this.dialogData?.mode==="edit";projects=Wi([]);agents=Wi([]);name=Wi("");selectedProject=Wi("");selectedAgent=Wi("");instruction=Wi("");intervalValue=Wi(1);intervalUnit=Wi("d");startTimestamp=Wi("");daysOfWeek=Wi([]);endConditionType=Wi("none");endOccurrences=Wi(10);endTimestamp=Wi("");enabled=Wi(true);isLoadingAgents=Wi(false);isSaving=Wi(false);errorMessage=Wi("");daysOfWeekOptions=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}];filteredProjects=TT(()=>{let t=this.selectedProject().toLowerCase();return this.projects().filter(e=>e.toLowerCase().includes(t))});filteredAgents=TT(()=>{let t=this.selectedAgent().toLowerCase();return this.agents().filter(e=>e.name.toLowerCase().includes(t))});isValid=TT(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(l=>l.name===this.selectedAgent()),n=this.instruction().trim().length>0,i=this.intervalValue()>=1;return t&&e&&n&&i});ngOnInit(){if(this.isEditMode&&this.dialogData?.scheduler){let t=this.dialogData.scheduler;this.name.set(t.name),this.selectedAgent.set(t.agentName??""),this.instruction.set(t.instruction??""),this.enabled.set(t.enabled);let e=t.schedule.interval.match(/^(\d+)(min|h|d|M)$/);e&&e[1]&&e[2]&&(this.intervalValue.set(parseInt(e[1],10)),this.intervalUnit.set(e[2])),t.schedule.startTimestamp&&this.startTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.startTimestamp))),this.daysOfWeek.set(t.schedule.daysOfWeek??[]),t.schedule.endCondition&&(this.endConditionType.set(t.schedule.endCondition.type),t.schedule.endCondition.type==="occurrences"?this.endOccurrences.set(t.schedule.endCondition.value):t.schedule.endCondition.type==="endTimestamp"&&this.endTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.endCondition.value))));}else this.startTimestamp.set(this.toDatetimeLocal(new Date));this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));this.projects.set(e);let n=this.dialogData?.projectName;this.isEditMode&&n?this.onProjectSelected(n):e.length===1&&e[0]&&this.onProjectSelected(e[0]);}});}onProjectSelected(t){this.selectedProject.set(t),this.isEditMode||(this.agents.set([]),this.selectedAgent.set("")),this.projects().includes(t)&&(this.isLoadingAgents.set(true),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(false),!this.isEditMode&&e.length===1&&e[0]&&this.selectedAgent.set(e[0].name);},error:()=>this.isLoadingAgents.set(false)}));}toggleDay(t){let e=this.daysOfWeek();e.indexOf(t)>-1?this.daysOfWeek.set(e.filter(i=>i!==t)):this.daysOfWeek.set([...e,t].sort());}isDaySelected(t){return this.daysOfWeek().includes(t)}toDatetimeLocal(t){let e=n=>String(n).padStart(2,"0");return `${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}submit(){if(!this.isValid()||this.isSaving())return;this.errorMessage.set(""),this.isSaving.set(true);let t=this.startTimestamp(),e={startTimestamp:t?new Date(t).toISOString():new Date().toISOString(),interval:`${this.intervalValue()}${this.intervalUnit()}`},n=this.daysOfWeek();n.length>0&&(e.daysOfWeek=n);let i=this.endConditionType();i==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences()}:i==="endTimestamp"&&this.endTimestamp()&&(e.endCondition={type:"endTimestamp",value:new Date(this.endTimestamp()).toISOString()});let l=this.instruction().trim(),p=l.length>40?l.slice(0,40)+"\u2026":l,L=this.name().trim()||`${this.selectedAgent()} \u2014 ${p}`;this.isEditMode&&this.dialogData?.scheduler&&this.dialogData.projectName?this.schedulerApi.updateSchedulerForProject(this.dialogData.projectName,this.dialogData.scheduler.id,{name:L,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(false),this.dialogRef.close(true);},error:oe=>{this.errorMessage.set(oe?.error?.error||"Failed to update scheduler"),this.isSaving.set(false);}}):this.schedulerApi.createSchedulerForProject(this.selectedProject(),{name:L,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(false),this.dialogRef.close(true);},error:oe=>{this.errorMessage.set(oe?.error?.error||"Failed to create scheduler"),this.isSaving.set(false);}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["app-quick-scheduler-dialog"]],decls:84,vars:20,consts:[["projectAuto","matAutocomplete"],["agentAuto","matAutocomplete"],["mat-dialog-title",""],[1,"qsd-form"],["appearance","outline",1,"full-width"],["matInput","","placeholder","Optional \u2014 auto-generated if empty",3,"ngModelChange","ngModel"],["matInput","","placeholder","Select a project",3,"ngModelChange","focus","ngModel","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matSuffix","","diameter","18"],["matInput","","placeholder","Select an agent",3,"ngModelChange","focus","ngModel","matAutocomplete","disabled"],["matInput","","placeholder","e.g. Review open PRs and summarize what needs attention","rows","3",3,"ngModelChange","ngModel"],[1,"qsd-divider"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"qsd-interval"],[1,"qsd-label"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],[3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"qsd-days"],[1,"qsd-day-chips"],["type","button",1,"day-chip",3,"selected"],[1,"qsd-hint"],[1,"qsd-end"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"qsd-error"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",3,"click","disabled"],["diameter","18"],["type","button",1,"day-chip",3,"click"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel","min"]],template:function(e,n){if(e&1&&(Cs(0,"h2",2)(1,"mat-icon"),JC(2,"schedule"),hl(),JC(3),hl(),Cs(4,"mat-dialog-content")(5,"div",3)(6,"mat-form-field",4)(7,"mat-label"),JC(8,"Name"),hl(),Cs(9,"input",5),kg("ngModelChange",function(l){return n.name.set(l)}),hl(),ZI(),hl(),Cs(10,"mat-form-field",4)(11,"mat-label"),JC(12,"Project"),hl(),Cs(13,"input",6),kg("ngModelChange",function(l){return n.onProjectSelected(l)})("focus",function(){return n.selectedProject.set(n.selectedProject())}),hl(),ZI(),Cs(14,"mat-autocomplete",7,0),kg("optionSelected",function(l){return n.onProjectSelected(l.option.value)}),dC(16,Ht,2,2,"mat-option",8,lC),hl()(),Cs(18,"mat-form-field",4)(19,"mat-label"),JC(20,"Agent"),hl(),aC(21,Jt,1,0,"mat-spinner",9),Cs(22,"input",10),kg("ngModelChange",function(l){return n.selectedAgent.set(l)})("focus",function(){return n.selectedAgent.set(n.selectedAgent())}),hl(),ZI(),Cs(23,"mat-autocomplete",7,1),kg("optionSelected",function(l){return n.selectedAgent.set(l.option.value)}),dC(25,Xt,2,2,"mat-option",8,Qt),hl()(),Cs(27,"mat-form-field",4)(28,"mat-label"),JC(29,"What should the agent do?"),hl(),Cs(30,"textarea",11),kg("ngModelChange",function(l){return n.instruction.set(l)}),hl(),ZI(),hl(),Cs(31,"div",12)(32,"span"),JC(33,"Scheduling"),hl()(),Cs(34,"mat-form-field",4)(35,"mat-label"),JC(36,"Starts on"),hl(),Cs(37,"input",13),kg("ngModelChange",function(l){return n.startTimestamp.set(l)}),hl(),ZI(),hl(),Cs(38,"div",14)(39,"span",15),JC(40,"Every"),hl(),Cs(41,"mat-form-field",16)(42,"input",17),kg("ngModelChange",function(l){return n.intervalValue.set(l)}),hl(),ZI(),hl(),Cs(43,"mat-form-field",18)(44,"mat-select",19),kg("ngModelChange",function(l){return n.intervalUnit.set(l)}),Cs(45,"mat-option",20),JC(46,"minutes"),hl(),Cs(47,"mat-option",21),JC(48,"hours"),hl(),Cs(49,"mat-option",22),JC(50,"days"),hl(),Cs(51,"mat-option",23),JC(52,"months"),hl()(),ZI(),hl()(),Cs(53,"div",24)(54,"span",15),JC(55,"Days"),hl(),Cs(56,"div",25),dC(57,Kt,2,3,"button",26,Ut),hl(),Cs(59,"span",27),JC(60,"Leave empty for every day"),hl()(),Cs(61,"div",28)(62,"mat-form-field",4)(63,"mat-label"),JC(64,"Ends on"),hl(),Cs(65,"mat-select",19),kg("ngModelChange",function(l){return n.endConditionType.set(l)}),Cs(66,"mat-option",29),JC(67,"Never"),hl(),Cs(68,"mat-option",30),JC(69,"After N runs"),hl(),Cs(70,"mat-option",31),JC(71,"On a date"),hl()(),ZI(),hl(),aC(72,Yt,4,1,"mat-form-field",4),aC(73,Zt,4,2,"mat-form-field",4),hl(),Cs(74,"mat-checkbox",19),kg("ngModelChange",function(l){return n.enabled.set(l)}),JC(75,"Enable immediately"),hl(),ZI(),aC(76,en,5,1,"div",32),hl()(),Cs(77,"mat-dialog-actions",33)(78,"button",34),kg("click",function(){return n.cancel()}),JC(79,"Cancel"),hl(),Cs(80,"button",35),kg("click",function(){return n.submit()}),aC(81,tn,1,0,"mat-spinner",36)(82,nn,2,0,"mat-icon"),JC(83," Schedule "),hl()()),e&2){let i=AC(15),l=AC(24);sI(3),Dl(" ",n.isEditMode?"Edit scheduled task":"New scheduled task",`
3
+ `),sI(6),_g("ngModel",n.name()),QI(),sI(4),_g("ngModel",n.selectedProject())("matAutocomplete",i),QI(),sI(3),fC(n.filteredProjects()),sI(5),cC(n.isLoadingAgents()?21:-1),sI(),_g("ngModel",n.selectedAgent())("matAutocomplete",l)("disabled",!n.projects().includes(n.selectedProject())),QI(),sI(3),fC(n.filteredAgents()),sI(5),_g("ngModel",n.instruction()),QI(),sI(7),_g("ngModel",n.startTimestamp()),QI(),sI(5),_g("ngModel",n.intervalValue()),QI(),sI(2),_g("ngModel",n.intervalUnit()),QI(),sI(13),fC(n.daysOfWeekOptions),sI(8),_g("ngModel",n.endConditionType()),QI(),sI(7),cC(n.endConditionType()==="occurrences"?72:-1),sI(),cC(n.endConditionType()==="endTimestamp"?73:-1),sI(),_g("ngModel",n.enabled()),QI(),sI(2),cC(n.errorMessage()?76:-1),sI(2),_g("disabled",n.isSaving()),sI(2),_g("disabled",!n.isValid()||n.isSaving()),sI(),cC(n.isSaving()?81:82);}},dependencies:[ti,Ye$1,fn$1,Zn,$t$1,cn$1,zt$2,jt,Vt$1,Nt$1,hr,pr,ce,nt,ae,zt$1,Tn$1,Sn$1,kt$1,Ct,Fn$1,ze,Pt$1,Lt$1,ve,ne,Et$1,yt$1,yt,wt$1],styles:['[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding-top:4px}.full-width[_ngcontent-%COMP%]{width:100%}.qsd-interval[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-interval[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-interval[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%]{width:80px}.qsd-interval[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.qsd-days[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.qsd-days[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-days[_ngcontent-%COMP%] .qsd-hint[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);opacity:.7;width:100%;margin-top:-4px;padding-left:36px}.qsd-day-chips[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.day-chip[_ngcontent-%COMP%]{padding:4px 10px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:12px;cursor:pointer;transition:background .15s,color .15s}.day-chip.selected[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.day-chip[_ngcontent-%COMP%]:hover:not(.selected){background:var(--mat-sys-surface-variant)}.qsd-divider[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:4px 0}.qsd-divider[_ngcontent-%COMP%]:before, .qsd-divider[_ngcontent-%COMP%]:after{content:"";flex:1;height:1px;background:var(--mat-sys-outline-variant)}.qsd-divider[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);text-transform:uppercase;letter-spacing:.5px}.qsd-end[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.qsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);font-size:14px}.qsd-error[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}mat-dialog-actions[_ngcontent-%COMP%] button[mat-flat-button][_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px}']})};var rn=(a,t)=>t.id;function an(a,t){if(a&1){let e=vC();Cs(0,"button",9),kg("click",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.setProject(i))}),JC(1),hl();}if(a&2){let e=t.$implicit,n=CC(2);zg("active",n.activeProject()===e),sI(),Dl(" ",e," ");}}function ln(a,t){if(a&1){let e=vC();Cs(0,"nav",2)(1,"button",9),kg("click",function(){Cf(e);let i=CC();return Tf(i.setProject(null))}),JC(2," All projects "),hl(),dC(3,an,2,3,"button",10,lC),hl();}if(a&2){let e=CC();sI(),zg("active",e.activeProject()===null),sI(2),fC(e.projects());}}function sn(a,t){a&1&&(Cs(0,"div",3),Mg(1,"mat-spinner",11),hl());}function cn(a,t){if(a&1&&(Cs(0,"div",4)(1,"mat-icon"),JC(2,"error"),hl(),JC(3),hl()),a&2){let e=CC();sI(3),Dl(" ",e.errorMessage()," ");}}function dn(a,t){if(a&1){let e=vC();Cs(0,"div",5)(1,"mat-icon"),JC(2,"schedule"),hl(),Cs(3,"p"),JC(4,"No scheduled tasks yet."),hl(),Cs(5,"button",12),kg("click",function(){Cf(e);let i=CC();return Tf(i.openCreate())}),Cs(6,"mat-icon"),JC(7,"add"),hl(),JC(8," Create one "),hl()();}}function pn(a,t){if(a&1&&(Cs(0,"span",17),JC(1),hl()),a&2){let e=CC().$implicit;sI(),Kg(e.projectName);}}function mn(a,t){if(a&1){let e=vC();Cs(0,"li",14)(1,"div",15)(2,"span",16),JC(3),hl(),aC(4,pn,2,1,"span",17),Cs(5,"span",18),JC(6),hl()(),Cs(7,"div",19)(8,"span",20),JC(9),hl(),Cs(10,"span",21),JC(11),hl()(),Cs(12,"div",22)(13,"mat-slide-toggle",23),kg("change",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.toggleEnabled(i))}),hl(),Cs(14,"button",24),kg("click",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.runNow(i))}),Cs(15,"mat-icon"),JC(16,"play_arrow"),hl()(),Cs(17,"button",25),kg("click",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.edit(i))}),Cs(18,"mat-icon"),JC(19,"edit"),hl()(),Cs(20,"button",26),kg("click",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.delete(i))}),Cs(21,"mat-icon"),JC(22,"delete"),hl()()()();}if(a&2){let e=t.$implicit,n=CC(2);zg("disabled",!e.enabled),sI(3),Kg(e.name),sI(),cC(n.projects().length>1?4:-1),sI(2),Kg(n.getSource(e)),sI(3),Kg(n.formatInterval(e.schedule.interval)),sI(),zg("due",!e.nextRun),sI(),Kg(n.formatNextRun(e.nextRun)),sI(2),_g("checked",e.enabled);}}function un(a,t){if(a&1&&(Cs(0,"ul",6),dC(1,mn,23,10,"li",13,rn),hl()),a&2){let e=CC();sI(),fC(e.filteredSchedulers());}}var Me=class a{projectApi=g(c);schedulerApi=g(xe);dialog=g(Re);dialogRef=g(z$3);allSchedulers=Wi([]);isLoading=Wi(true);errorMessage=Wi("");activeProject=Wi(null);projects=Wi([]);filteredSchedulers=TT(()=>{let t=this.activeProject(),e=this.allSchedulers();return t?e.filter(n=>n.projectName===t):e});ngOnInit(){this.load();}load(){this.isLoading.set(true),this.errorMessage.set(""),this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));if(this.projects.set(e),e.length===0){this.isLoading.set(false);return}let n=e.map(i=>this.schedulerApi.listSchedulersForProject(i).pipe(va(()=>br([]))));$y(n).subscribe({next:i=>{let l=[];i.forEach((p,L)=>{p.forEach(oe=>l.push(z$1(P$1({},oe),{projectName:e[L]})));}),this.allSchedulers.set(l),this.isLoading.set(false);},error:()=>{this.errorMessage.set("Failed to load schedulers"),this.isLoading.set(false);}});},error:()=>{this.errorMessage.set("Failed to load projects"),this.isLoading.set(false);}});}setProject(t){this.activeProject.set(t);}formatInterval(t){let e=/^(\d+)(min|h|d|M)$/.exec(t);if(!e)return t;let[,n,i]=e;return `Every ${n}${{min:"min",h:"h",d:"d",M:"mo"}[i??""]??i}`}formatNextRun(t){if(!t)return "Expired";let e=new Date(t),n=new Date,i=e.getTime()-n.getTime();if(i<0)return "Due";let l=Math.floor(i/6e4);if(l<60)return `in ${l}m`;let p=Math.floor(l/60);return p<24?`in ${p}h`:`in ${Math.floor(p/24)}d`}getSource(t){if(t.agentName&&t.instruction){let e=t.instruction.length>35?t.instruction.slice(0,35)+"\u2026":t.instruction;return `${t.agentName}: ${e}`}return t.promptId??""}toggleEnabled(t){(t.enabled?this.schedulerApi.disableSchedulerForProject(t.projectName,t.id):this.schedulerApi.enableSchedulerForProject(t.projectName,t.id)).subscribe({next:()=>{this.allSchedulers.update(n=>n.map(i=>i.id===t.id?z$1(P$1({},i),{enabled:!i.enabled}):i));},error:()=>this.errorMessage.set("Failed to toggle scheduler")});}runNow(t){this.schedulerApi.runSchedulerNowForProject(t.projectName,t.id).subscribe({error:()=>this.errorMessage.set("Failed to run scheduler")});}edit(t){let e={mode:"edit",projectName:t.projectName,scheduler:{id:t.id,name:t.name,agentName:t.agentName,instruction:t.instruction,enabled:t.enabled,schedule:t.schedule}};this.dialog.open(z,{width:"480px",data:e}).afterClosed().subscribe(i=>{i&&this.load();});}delete(t){this.schedulerApi.deleteSchedulerForProject(t.projectName,t.id).subscribe({next:()=>{this.allSchedulers.update(e=>e.filter(n=>n.id!==t.id));},error:()=>this.errorMessage.set("Failed to delete scheduler")});}openCreate(){this.dialogRef.close(),this.dialog.open(z,{width:"480px"});}close(){this.dialogRef.close();}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["app-global-schedulers-dialog"]],decls:19,vars:3,consts:[["mat-dialog-title",""],[1,"gsd-count"],[1,"gsd-project-filters"],[1,"gsd-loading"],[1,"gsd-error"],[1,"gsd-empty"],[1,"gsd-list"],["align","end"],["mat-button","",3,"click"],[1,"proj-chip",3,"click"],[1,"proj-chip",3,"active"],["diameter","32"],["mat-flat-button","",3,"click"],[1,"gsd-item",3,"disabled"],[1,"gsd-item"],[1,"gsd-item-main"],[1,"gsd-item-name"],[1,"gsd-item-project"],[1,"gsd-item-source"],[1,"gsd-item-meta"],[1,"gsd-interval"],[1,"gsd-next"],[1,"gsd-item-actions"],["matTooltip","Enable / Disable",3,"change","checked"],["mat-icon-button","","matTooltip","Run now",3,"click"],["mat-icon-button","","matTooltip","Edit",3,"click"],["mat-icon-button","","matTooltip","Delete",1,"delete-btn",3,"click"]],template:function(e,n){e&1&&(Cs(0,"h2",0)(1,"mat-icon"),JC(2,"schedule"),hl(),JC(3," Scheduled tasks "),Cs(4,"span",1),JC(5),hl()(),Cs(6,"mat-dialog-content"),aC(7,ln,5,2,"nav",2),aC(8,sn,2,0,"div",3)(9,cn,4,1,"div",4)(10,dn,9,0,"div",5)(11,un,3,0,"ul",6),hl(),Cs(12,"mat-dialog-actions",7)(13,"button",8),kg("click",function(){return n.openCreate()}),Cs(14,"mat-icon"),JC(15,"add"),hl(),JC(16," New scheduler "),hl(),Cs(17,"button",8),kg("click",function(){return n.close()}),JC(18,"Close"),hl()()),e&2&&(sI(5),Kg(n.filteredSchedulers().length),sI(2),cC(n.projects().length>1?7:-1),sI(),cC(n.isLoading()?8:n.errorMessage()?9:n.filteredSchedulers().length===0?10:11));},dependencies:[ti,zt$2,jt,Vt$1,Nt$1,hr,pr,Gn$1,yt,wt$1,Et$1,yt$1,Pt$1,Ve,ne$1,ke$1,se],styles:["[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}h2[mat-dialog-title][_ngcontent-%COMP%] .gsd-count[_ngcontent-%COMP%]{font-size:13px;font-weight:400;color:var(--mat-sys-on-surface-variant);margin-left:2px}.gsd-project-filters[_ngcontent-%COMP%]{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.proj-chip[_ngcontent-%COMP%]{padding:4px 12px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:13px;cursor:pointer;transition:background .15s,color .15s}.proj-chip.active[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.proj-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--mat-sys-surface-variant)}.gsd-loading[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:32px 0;color:var(--mat-sys-on-surface-variant)}.gsd-loading[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:40px;width:40px;height:40px;opacity:.4}.gsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);padding:16px 0}.gsd-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.gsd-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:8px;background:var(--mat-sys-surface-container);transition:opacity .2s}.gsd-item.disabled[_ngcontent-%COMP%]{opacity:.5}.gsd-item-main[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.gsd-item-name[_ngcontent-%COMP%]{font-weight:500;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-project[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-primary);font-weight:500}.gsd-item-source[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-meta[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-end;gap:2px;white-space:nowrap}.gsd-interval[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant)}.gsd-next[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-on-surface-variant)}.gsd-next.due[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.gsd-item-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--mat-sys-error);opacity:.7;transition:opacity .15s}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{opacity:1}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}"]})};var Se=class a{http=g(gy);threadApi=g(N);projectApi=g(c);isLoading=Wi(false);tasks=Wi([]);refresh(){this.isLoading.set(true),this.threadApi.listAllThreads().pipe(Qy(15e3)).subscribe({next:t=>{let e=t.filter(n=>!n.parentThreadId).map(n=>({id:n.id,name:n.name,summary:n.summary,modifiedDate:n.modifiedDate,starring:n.starring??[],users:n.users??[],isActive:false,status:this.deriveStatus(n),projectId:n.projectId,worktreeProject:n.worktreeProject}));this.tasks.set(this.sorted(e)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}applyStatusEvent(t,e){let n=e==="invite"?"waiting-you":"in-progress";this.tasks.update(i=>this.sorted(i.map(l=>l.id===t?z$1(P$1({},l),{status:n}):l)));}closeTask(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/missions/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to close task:",n),this.refresh();}});}stopThread(t,e){this.http.post(`/api/projects/${t}/threads/${e}/stop`,{}).subscribe({error:n=>console.error("[GLOBAL-TC] Failed to stop thread:",n)});}deleteThread(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/threads/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to delete thread:",n),this.refresh();}});}toggleStar(t,e,n){let i=`/api/projects/${t}/threads/${e}/star`;(n?this.http.delete(i):this.http.post(i,{})).subscribe({next:()=>this.refresh(),error:p=>console.error("[GLOBAL-TC] Failed to toggle star:",p)});}markTaskDone(t,e){this.http.post(`/api/projects/${t}/threads/${e}/done`,{}).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as done:",n)});}markTasksBatchDone(t){if(t.length===0)return;let e=new Map;for(let{id:l,projectId:p}of t){let L=e.get(p)??[];L.push(l),e.set(p,L);}let n=new Set(t.map(l=>l.id));this.tasks.update(l=>this.sorted(l.map(p=>n.has(p.id)?z$1(P$1({},p),{status:"done"}):p)));let i=[...e.entries()].map(([l,p])=>this.projectApi.markThreadsBatchDone(l,p));$y(i.length>0?i:[br(null)]).subscribe({next:()=>this.refresh(),error:l=>{console.error("[GLOBAL-TC] Failed to batch-mark tasks as done:",l),this.refresh();}});}markTaskActive(t,e){this.http.delete(`/api/projects/${t}/threads/${e}/done`).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as active:",n)});}deriveStatus(t){return t.closedByUser?"done":t.pendingInvite?"waiting-you":Date.now()-new Date(t.modifiedDate).getTime()<bt?"in-progress":"paused"}sorted(t){return [...t].sort((e,n)=>{let i=kt[e.status]-kt[n.status];return i!==0?i:e.modifiedDate>n.modifiedDate?-1:1})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var Te=class a{configApi=g(W);dialog=g(Re);openUserConfigEditor(){this.configApi.getUserConfig().subscribe({next:t=>{this.dialog.open(Ze,{data:{configType:"user",initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(n=>{n&&this.configApi.updateUserConfig(n).subscribe({error:i=>console.error("[CONFIG-STATE] Error saving user config:",i)});});},error:t=>console.error("[CONFIG-STATE] Error loading user config:",t)});}static \u0275fac=function(e){return new(e||a)};static \u0275prov=x({token:a,factory:a.\u0275fac,providedIn:"root"})};var gn=["layoutContainer"],hn=(a,t)=>t.key,_n=(a,t)=>t.name,fn=(a,t)=>t.status,Pt=(a,t)=>t.id;function bn(a,t){if(a&1){let e=vC();Cs(0,"button",32),kg("click",function(){Cf(e);let i=CC();return Tf(i.clearSearch())}),Cs(1,"mat-icon"),JC(2,"close"),hl()();}}function vn(a,t){if(a&1){let e=vC();Cs(0,"button",33),kg("click",function(){let i=Cf(e).$implicit,l=CC(2);return Tf(l.setProject(i.name))}),JC(1),Cs(2,"span",34),JC(3),hl()();}if(a&2){let e=t.$implicit,n=CC(2);zg("active",n.activeProject()===e.name),sI(),Dl(" ",e.name," "),sI(2),Kg(e.count);}}function Cn(a,t){if(a&1){let e=vC();Cs(0,"nav",22)(1,"button",33),kg("click",function(){Cf(e);let i=CC();return Tf(i.setProject(null))}),JC(2," All projects "),Cs(3,"span",34),JC(4),hl()(),dC(5,vn,4,4,"button",35,_n),hl();}if(a&2){let e=CC();sI(),zg("active",e.activeProject()===null),sI(3),Kg(e.allTasks().length),sI(),fC(e.projectSummaries());}}function yn(a,t){if(a&1&&(Cs(0,"span",37),JC(1),hl()),a&2){let e=CC().$implicit,n=CC();sI(),Kg(n.filterCounts()[e.key]);}}function xn(a,t){if(a&1){let e=vC();Cs(0,"button",36),kg("click",function(){let i=Cf(e).$implicit,l=CC();return Tf(l.setFilter(i.key))}),Cs(1,"mat-icon",26),JC(2),hl(),Cs(3,"span"),JC(4),hl(),aC(5,yn,2,1,"span",37),hl();}if(a&2){let e=t.$implicit,n=CC();zg("active",n.activeFilter()===e.key),Sg("aria-selected",n.activeFilter()===e.key),sI(2),Kg(e.icon),sI(2),Kg(e.label),sI(),cC(n.filterCounts()[e.key]>0?5:-1);}}function kn(a,t){a&1&&(Cs(0,"div",29),Mg(1,"mat-spinner",38),Cs(2,"p"),JC(3,"Loading tasks from all projects\u2026"),hl()());}function Mn(a,t){a&1&&(Cs(0,"div",30)(1,"mat-icon",39),JC(2,"hub"),hl(),Cs(3,"p"),JC(4,"No tasks found."),hl()());}function Sn(a,t){if(a&1){let e=vC();Cs(0,"button",51),kg("click",function(){Cf(e);let i=CC(5);return Tf(i.markSelectedPausedDone())}),Cs(1,"mat-icon"),JC(2,"check_circle_outline"),hl(),JC(3),hl();}if(a&2){let e=CC(5);_g("matTooltip","Mark "+e.selectedPausedCount()+" task(s) as done"),sI(3),Dl(" Mark done (",e.selectedPausedCount(),") ");}}function Tn(a,t){if(a&1){let e=vC();Cs(0,"mat-checkbox",48),kg("change",function(){Cf(e);let i=CC(4);return Tf(i.toggleSelectAllPaused())}),hl(),aC(1,Sn,4,2,"button",49),Cs(2,"button",50),kg("click",function(){Cf(e);let i=CC(4);return Tf(i.toggleSelectMode())}),Cs(3,"mat-icon"),JC(4,"close"),hl()();}if(a&2){let e=CC(4);_g("checked",e.allPausedSelected())("indeterminate",e.somePausedSelected()&&!e.allPausedSelected()),sI(),cC(e.selectedPausedCount()>0?1:-1);}}function wn(a,t){if(a&1){let e=vC();Cs(0,"button",52),kg("click",function(){Cf(e);let i=CC(4);return Tf(i.toggleSelectMode())}),Cs(1,"mat-icon"),JC(2,"checklist"),hl(),JC(3," Select "),hl();}}function Pn(a,t){if(a&1&&(Cs(0,"div",41)(1,"h3",42)(2,"mat-icon",44),JC(3),hl(),JC(4),Cs(5,"span",45),JC(6),hl()(),Cs(7,"div",46),aC(8,Tn,5,3)(9,wn,4,0,"button",47),hl()()),a&2){let e=CC().$implicit,n=CC(2);sI(3),Kg(e.icon),sI(),Dl(" ",e.label," "),sI(2),Kg(e.tasks.length),sI(2),cC(n.isSelectMode()?8:9);}}function Dn(a,t){if(a&1&&(Cs(0,"h3",42)(1,"mat-icon",44),JC(2),hl(),JC(3),Cs(4,"span",45),JC(5),hl()()),a&2){let e=CC().$implicit;sI(2),Kg(e.icon),sI(),Dl(" ",e.label," "),sI(2),Kg(e.tasks.length);}}function jn(a,t){if(a&1){let e=vC();Cs(0,"app-task-card",53),kg("stopRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=Cf(e).$implicit,p=CC(3);return Tf(p.onPreviewRequested(i,l.projectId,l.name))})("selectionChanged",function(i){Cf(e);let l=CC(3);return Tf(l.onPausedSelectionChanged(i.id,i.selected))}),hl();}if(a&2){let e=t.$implicit,n=CC().$implicit,i=CC(2);zg("is-previewed",i.previewThreadId()===e.id),_g("task",e)("projectNameOverride",e.projectId)("showProject",true)("previewMode",i.previewActive())("selectable",n.status==="paused"&&i.isSelectMode())("selected",i.selectedPausedIds().has(e.id));}}function On(a,t){if(a&1&&(Cs(0,"section",40),aC(1,Pn,10,4,"div",41)(2,Dn,6,3,"h3",42),Cs(3,"div",31),dC(4,jn,1,8,"app-task-card",43,Pt),hl()()),a&2){let e=t.$implicit;sI(),cC(e.status==="paused"?1:2),sI(3),fC(e.tasks);}}function En(a,t){if(a&1&&dC(0,On,6,1,"section",40,fn),a&2){let e=CC();fC(e.taskGroups());}}function Nn(a,t){if(a&1){let e=vC();Cs(0,"app-task-card",55),kg("stopRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=Cf(e).$implicit,p=CC(2);return Tf(p.onPreviewRequested(i,l.projectId,l.name))}),hl();}if(a&2){let e=t.$implicit,n=CC(2);zg("is-previewed",n.previewThreadId()===e.id),_g("task",e)("projectNameOverride",e.projectId)("showProject",true)("previewMode",n.previewActive());}}function In(a,t){if(a&1&&(Cs(0,"div",31),dC(1,Nn,1,6,"app-task-card",54,Pt),hl()),a&2){let e=CC();sI(),fC(e.displayedTasks());}}function An(a,t){if(a&1){let e=vC();Cs(0,"div",56),kg("mousedown",function(i){Cf(e);let l=CC();return Tf(l.onResizerMousedown(i))}),hl(),Cs(1,"div",57)(2,"header",58)(3,"span",59),JC(4),hl(),Cs(5,"div",60)(6,"button",61),kg("click",function(){Cf(e);let i=CC();return Tf(i.navigateToThread())}),Cs(7,"mat-icon"),JC(8,"open_in_new"),hl()(),Cs(9,"button",62),kg("click",function(){Cf(e);let i=CC();return Tf(i.closePreview())}),Cs(10,"mat-icon"),JC(11,"close"),hl()()()(),Cs(12,"div",63),Mg(13,"app-thread",64),hl()();}if(a&2){let e=CC();sI(),$g("width",e.previewPanelWidthPercent(),"%"),sI(3),Kg(e.previewTaskName()||"Task"),sI(9),_g("projectName",e.previewProjectId())("threadId",e.previewThreadId());}}var Vn=20,Fn=70,Gn=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{status:"in-progress",label:"In progress",icon:"pending"},{status:"paused",label:"Paused",icon:"pause_circle"},{status:"error",label:"Error",icon:"error"},{status:"done",label:"Done",icon:"check_circle"}],Rn=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],wt=class a{globalTaskService=g(Se);destroyRef=g(Ce);dialog=g(Re);router=g(G);configState=g(Te);userService=g(pe);preferences=g(L);projectState=g(P);threadState=g(U);breakpointObserver=g(Ot$1);username=F(this.userService.username$,{initialValue:null});isDesktop=F(this.breakpointObserver.observe("(min-width: 1280px)").pipe(re(t=>t.matches)),{initialValue:false});previewEnabled=F(this.preferences.missionPreviewEnabled$,{initialValue:false});previewActive=TT(()=>this.previewEnabled()&&this.isDesktop());previewThreadId=Wi(null);previewProjectId=Wi(null);previewTaskName=Wi(null);previewPanelWidthPercent=Wi(this.preferences.getMissionPreviewPanelWidth());isDraggingResizer=false;dragStartX=0;dragStartWidth=0;containerWidth=0;layoutContainerRef;globalEventSource=null;filters=Rn;activeFilter=Wi("all");starredOnly=Wi(false);activeProject=Wi(null);searchQuery=Wi("");isLoading=this.globalTaskService.isLoading;allTasks=this.globalTaskService.tasks;isSelectMode=Wi(false);selectedPausedIds=Wi(new Set);pausedTasks=TT(()=>this.displayedTasks().filter(t=>t.status==="paused"));allPausedSelected=TT(()=>{let t=this.pausedTasks(),e=this.selectedPausedIds();return t.length>0&&t.every(n=>e.has(n.id))});somePausedSelected=TT(()=>{let t=this.selectedPausedIds();return this.pausedTasks().some(e=>t.has(e.id))});selectedPausedCount=TT(()=>{let t=this.selectedPausedIds();return this.pausedTasks().filter(e=>t.has(e.id)).length});projectSummaries=TT(()=>{let t=this.allTasks(),e=new Map;for(let n of t)e.set(n.projectId,(e.get(n.projectId)??0)+1);return [...e.entries()].map(([n,i])=>({name:n,count:i})).sort((n,i)=>n.name.localeCompare(i.name))});filteredTasks=TT(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(l=>l.projectId===e));let n=this.username();this.starredOnly()&&n&&(t=t.filter(l=>l.starring.includes(n)));let i=this.activeFilter();return i!=="all"&&(t=t.filter(l=>l.status===i)),t});filterCounts=TT(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(i=>i.projectId===e));let n=this.username();return this.starredOnly()&&n&&(t=t.filter(i=>i.starring.includes(n))),{all:t.length,"waiting-you":t.filter(i=>i.status==="waiting-you").length,"in-progress":t.filter(i=>i.status==="in-progress").length,done:t.filter(i=>i.status==="done").length,paused:t.filter(i=>i.status==="paused").length,error:t.filter(i=>i.status==="error").length}});displayedTasks=TT(()=>{let t=this.searchQuery().toLowerCase().trim(),e=this.sortedFilteredTasks();return t?e.filter(n=>(n.name||"").toLowerCase().includes(t)||(n.summary||"").toLowerCase().includes(t)):e});taskGroups=TT(()=>{let t=this.displayedTasks();return Gn.map(e=>z$1(P$1({},e),{tasks:t.filter(n=>n.status===e.status)})).filter(e=>e.tasks.length>0)});sortedFilteredTasks=TT(()=>{let t=this.filteredTasks(),e={"waiting-you":0,"in-progress":1,paused:2,error:3,done:4};return [...t].sort((n,i)=>(e[n.status]??99)-(e[i.status]??99))});constructor(){this.destroyRef.onDestroy(()=>this.disconnectGlobalSse());}ngOnInit(){this.globalTaskService.refresh(),this.connectGlobalSse(),this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[GTC] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}setProject(t){this.activeProject.set(t),this.activeFilter.set("all");}onSearchInput(t){this.searchQuery.set(t.target.value);}clearSearch(){this.searchQuery.set("");}refresh(){this.globalTaskService.refresh();}openPreferences(){this.dialog.open(Ye,{width:"400px"});}openTokenUsage(){this.router.navigate(["/token-usage"]);}openUserConfig(){this.configState.openUserConfigEditor();}openQuickSchedulerDialog(){this.dialog.open(z,{width:"480px",disableClose:false});}openGlobalSchedulersDialog(){this.dialog.open(Me,{width:"600px",maxHeight:"80vh"});}openNewTaskDialog(){this.dialog.open(ke,{width:"500px",disableClose:false}).afterClosed().subscribe(e=>{e&&(e.navigate?this.router.navigate(["project",e.projectId]):(setTimeout(()=>this.globalTaskService.refresh(),300),setTimeout(()=>this.globalTaskService.refresh(),1500)));});}onStopRequested(t,e){this.globalTaskService.stopThread(e,t);}onDeleteRequested(t,e){this.globalTaskService.deleteThread(e,t);}onStarToggled(t,e){let n=this.allTasks().find(p=>p.id===t);if(!n)return;let i=this.username(),l=!!i&&n.starring.includes(i);this.globalTaskService.toggleStar(e,t,l);}onCloseTaskRequested(t,e){let i=this.allTasks().find(p=>p.id===t)?.worktreeProject??e;this.dialog.open(z$2,{width:"420px",data:{title:"Close task",message:`This will stop the agent, delete the thread and remove the worktree project "${i}" from disk. This cannot be undone.`,confirmLabel:"Close task",cancelLabel:"Cancel"}}).afterClosed().subscribe(p=>{p&&this.globalTaskService.closeTask(e,t);});}onMarkDoneRequested(t,e){this.globalTaskService.markTaskDone(e,t);}onMarkActiveRequested(t,e){this.globalTaskService.markTaskActive(e,t);}toggleSelectMode(){let t=!this.isSelectMode();this.isSelectMode.set(t),t||this.selectedPausedIds.set(new Set);}onPausedSelectionChanged(t,e){this.selectedPausedIds.update(n=>{let i=new Set(n);return e?i.add(t):i.delete(t),i});}toggleSelectAllPaused(){let t=this.pausedTasks();this.allPausedSelected()?this.selectedPausedIds.set(new Set):this.selectedPausedIds.set(new Set(t.map(e=>e.id)));}markSelectedPausedDone(){let t=this.selectedPausedIds(),e=this.pausedTasks().filter(n=>t.has(n.id)).map(n=>({id:n.id,projectId:n.projectId}));e.length!==0&&(this.selectedPausedIds.set(new Set),this.isSelectMode.set(false),this.globalTaskService.markTasksBatchDone(e));}onPreviewRequested(t,e,n){this.previewThreadId()===t?(this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null)):(this.projectState.selectProject(e),this.threadState.selectThread(t),this.previewProjectId.set(e),this.previewThreadId.set(t),this.previewTaskName.set(n));}closePreview(){this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null);}navigateToThread(){let t=this.previewThreadId(),e=this.previewProjectId();!t||!e||this.router.navigate(["project",e,"thread",t]);}onResizerMousedown(t){t.preventDefault(),this.isDraggingResizer=true,this.dragStartX=t.clientX,this.dragStartWidth=this.previewPanelWidthPercent(),this.containerWidth=this.layoutContainerRef?.nativeElement.offsetWidth??window.innerWidth;}onDocumentMousemove(t){if(!this.isDraggingResizer)return;let n=(this.dragStartX-t.clientX)/this.containerWidth*100,i=Math.min(Fn,Math.max(Vn,this.dragStartWidth+n));this.previewPanelWidthPercent.set(i);}onDocumentMouseup(){this.isDraggingResizer&&(this.isDraggingResizer=false,this.preferences.setMissionPreviewPanelWidth(this.previewPanelWidthPercent()));}connectGlobalSse(t=5e3){this.disconnectGlobalSse();let e=new EventSource("/api/event-stream");this.globalEventSource=e,e.onmessage=n=>{try{let i=JSON.parse(n.data),l=le(i);if(!l)return;let p=l.threadId;if(!p)return;l instanceof f||l instanceof b?this.globalTaskService.applyStatusEvent(p,"invite"):l instanceof O?this.globalTaskService.applyStatusEvent(p,"thinking"):l instanceof V&&this.globalTaskService.refresh();}catch(i){}},e.onerror=()=>{e.readyState===EventSource.CLOSED&&(this.globalEventSource=null,setTimeout(()=>{this.globalEventSource||this.connectGlobalSse(Math.min(t*2,6e4));},t));};}disconnectGlobalSse(){this.globalEventSource&&(this.globalEventSource.close(),this.globalEventSource=null);}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["app-global-task-control"]],viewQuery:function(e,n){if(e&1&&jg(gn,5),e&2){let i;MC(i=NC())&&(n.layoutContainerRef=i.first);}},hostBindings:function(e,n){e&1&&kg("mousemove",function(l){return n.onDocumentMousemove(l)},DE)("mouseup",function(){return n.onDocumentMouseup()},DE);},decls:85,vars:11,consts:[["layoutContainer",""],["schedulerMenu","matMenu"],["controlCenterMenu","matMenu"],[1,"gtc"],[1,"gtc-toolbar"],[1,"gtc-toolbar-left"],[1,"gtc-logo-icon"],[1,"gtc-title"],["appearance","fill","subscriptSizing","dynamic",1,"gtc-search"],["matPrefix",""],["matInput","","type","search","placeholder","Filter tasks\u2026","autocomplete","off",3,"input","keydown.escape","value"],["matSuffix","","mat-icon-button","","aria-label","Clear"],[1,"gtc-toolbar-actions"],["mat-icon-button","","matTooltip","Schedulers","aria-label","Schedulers",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-icon-button","","matTooltip","Control Center","aria-label","Control Center",3,"matMenuTriggerFor"],["mat-menu-item","","href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer"],["mat-icon-button","","matTooltip","Refresh all tasks","aria-label","Refresh tasks",3,"click","disabled"],["mat-stroked-button","","routerLink","/projects","aria-label","Manage projects","matTooltip","Manage projects"],[1,"btn-label"],["mat-flat-button","","aria-label","New task","matTooltip","New Task",1,"gtc-new-btn",3,"click"],[1,"gtc-filter-bar"],["aria-label","Filter by project",1,"gtc-project-filters"],["role","tablist","aria-label","Filter by status",1,"gtc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"gtc-body"],[1,"gtc-content"],[1,"gtc-loading"],[1,"gtc-empty"],[1,"gtc-grid"],["matSuffix","","mat-icon-button","","aria-label","Clear",3,"click"],[1,"project-chip",3,"click"],[1,"chip-count"],[1,"project-chip",3,"active"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","36"],[1,"empty-icon"],[1,"gtc-group"],[1,"gtc-group-header"],[1,"gtc-group-title"],[3,"task","projectNameOverride","showProject","previewMode","selectable","selected","is-previewed"],[1,"group-icon"],[1,"group-count"],[1,"gtc-group-actions"],["mat-stroked-button","","matTooltip","Select multiple tasks to mark as done","aria-label","Enter selection mode",1,"select-mode-btn"],["aria-label","Select all paused tasks",1,"select-all-checkbox",3,"change","checked","indeterminate"],["mat-flat-button","",1,"batch-done-btn",3,"matTooltip"],["mat-icon-button","","matTooltip","Cancel selection","aria-label","Cancel selection",1,"select-mode-cancel-btn",3,"click"],["mat-flat-button","",1,"batch-done-btn",3,"click","matTooltip"],["mat-stroked-button","","matTooltip","Select multiple tasks to mark as done","aria-label","Enter selection mode",1,"select-mode-btn",3,"click"],[3,"stopRequested","deleteRequested","starToggled","closeTaskRequested","markDoneRequested","markActiveRequested","previewRequested","selectionChanged","task","projectNameOverride","showProject","previewMode","selectable","selected"],[3,"task","projectNameOverride","showProject","previewMode","is-previewed"],[3,"stopRequested","deleteRequested","starToggled","closeTaskRequested","markDoneRequested","markActiveRequested","previewRequested","task","projectNameOverride","showProject","previewMode"],["matTooltip","Drag to resize","aria-hidden","true",1,"gtc-resizer",3,"mousedown"],[1,"gtc-preview-pane"],[1,"gtc-preview-header"],[1,"gtc-preview-title"],[1,"gtc-preview-actions"],["matTooltip","Open full view","aria-label","Open thread in full view","type","button",1,"preview-action-btn",3,"click"],["matTooltip","Close panel","aria-label","Close preview panel","type","button",1,"preview-action-btn",3,"click"],[1,"gtc-preview-body","thread-preview-host"],[3,"projectName","threadId"]],template:function(e,n){if(e&1&&(Cs(0,"div",3,0)(2,"header",4)(3,"div",5)(4,"mat-icon",6),JC(5,"hub"),hl(),Cs(6,"h1",7),JC(7,"Global Task Control"),hl()(),Cs(8,"mat-form-field",8)(9,"mat-icon",9),JC(10,"search"),hl(),Cs(11,"input",10),kg("input",function(l){return n.onSearchInput(l)})("keydown.escape",function(){return n.clearSearch()}),hl(),aC(12,bn,3,0,"button",11),hl(),Cs(13,"div",12)(14,"button",13)(15,"mat-icon"),JC(16,"schedule"),hl()(),Cs(17,"mat-menu",null,1)(19,"button",14),kg("click",function(){return n.openGlobalSchedulersDialog()}),Cs(20,"mat-icon"),JC(21,"list"),hl(),Cs(22,"span"),JC(23,"View schedulers"),hl()(),Cs(24,"button",14),kg("click",function(){return n.openQuickSchedulerDialog()}),Cs(25,"mat-icon"),JC(26,"add"),hl(),Cs(27,"span"),JC(28,"New scheduler"),hl()()(),Cs(29,"button",15)(30,"mat-icon"),JC(31,"hub"),hl()(),Cs(32,"mat-menu",null,2)(34,"button",14),kg("click",function(){return n.openPreferences()}),Cs(35,"mat-icon"),JC(36,"tune"),hl(),Cs(37,"span"),JC(38,"Preferences"),hl()(),Cs(39,"button",14),kg("click",function(){return n.openTokenUsage()}),Cs(40,"mat-icon"),JC(41,"data_usage"),hl(),Cs(42,"span"),JC(43,"Token Usage"),hl()(),Cs(44,"button",14),kg("click",function(){return n.openUserConfig()}),Cs(45,"mat-icon"),JC(46,"manage_accounts"),hl(),Cs(47,"span"),JC(48,"User Configuration"),hl()(),Mg(49,"mat-divider"),Cs(50,"a",16)(51,"mat-icon"),JC(52,"code"),hl(),Cs(53,"span"),JC(54,"Contribute on GitHub"),hl()()(),Cs(55,"button",17),kg("click",function(){return n.refresh()}),Cs(56,"mat-icon"),JC(57,"refresh"),hl()(),Cs(58,"button",18)(59,"mat-icon"),JC(60,"settings"),hl(),Cs(61,"span",19),JC(62,"Manage projects"),hl()(),Cs(63,"button",20),kg("click",function(){return n.openNewTaskDialog()}),Cs(64,"mat-icon"),JC(65,"rocket_launch"),hl(),Cs(66,"span",19),JC(67,"New Task"),hl()()()(),Cs(68,"div",21),aC(69,Cn,7,3,"nav",22),Cs(70,"nav",23),dC(71,xn,6,6,"button",24,hn),Cs(73,"button",25),kg("click",function(){return n.toggleStarredFilter()}),Cs(74,"mat-icon",26),JC(75,"star"),hl(),Cs(76,"span"),JC(77,"Starred"),hl()()()(),Cs(78,"div",27)(79,"main",28),aC(80,kn,4,0,"div",29)(81,Mn,5,0,"div",30)(82,En,2,0)(83,In,3,0,"div",31),hl(),aC(84,An,14,5),hl()()),e&2){let i=AC(18),l=AC(33);sI(11),_g("value",n.searchQuery()),sI(),cC(n.searchQuery()?12:-1),sI(2),_g("matMenuTriggerFor",i),sI(15),_g("matMenuTriggerFor",l),sI(26),_g("disabled",n.isLoading()),sI(14),cC(n.projectSummaries().length>1?69:-1),sI(2),fC(n.filters),sI(2),zg("active",n.starredOnly()),Sg("aria-checked",n.starredOnly()),sI(7),cC(n.isLoading()?80:n.displayedTasks().length===0?81:n.activeFilter()==="all"&&!n.searchQuery()?82:83),sI(4),cC(n.previewActive()&&n.previewThreadId()&&n.previewProjectId()?84:-1);}},dependencies:[A,_i,ve,ne,yt,wt$1,hr,pr,Gn$1,Ve,ne$1,Et$1,yt$1,In$1,De,Be,En$1,He,Ne,ce,nt,Ot$2,zt$1,Tn$1,Sn$1,si],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.gtc[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden}.gtc-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:0 .75rem;height:56px;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .1));box-sizing:border-box}.gtc-toolbar-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-logo-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem;color:var(--color-primary)}.gtc-title[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600;color:var(--color-text);white-space:nowrap}.gtc-search[_ngcontent-%COMP%]{margin-left:auto;flex:0 1 240px;min-width:80px;--mat-form-field-container-height: 36px;--mat-form-field-container-vertical-padding: 6px;font-size:.875rem;--mdc-filled-text-field-container-color: transparent;--mdc-filled-text-field-hover-container-color: transparent;--mdc-filled-text-field-focus-container-color: transparent;--mdc-filled-text-field-active-indicator-color: transparent;--mdc-filled-text-field-hover-active-indicator-color: transparent;--mdc-filled-text-field-focus-active-indicator-color: transparent;--mdc-filled-text-field-active-indicator-height: 0}.gtc-toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-new-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;height:36px;padding:0 1rem}.gtc-new-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}@media(max-width:600px){.gtc-toolbar[_ngcontent-%COMP%]{flex-wrap:wrap;height:auto;min-height:48px;padding:.5rem .75rem;gap:.375rem}.gtc-title[_ngcontent-%COMP%]{font-size:.875rem}.gtc-search[_ngcontent-%COMP%]{order:3;flex:1 1 100%;min-width:0;margin-left:0}.gtc-toolbar-actions[_ngcontent-%COMP%]{margin-left:auto}.btn-label[_ngcontent-%COMP%]{display:none}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]){--mdc-text-button-container-height: 36px;--mdc-filled-button-container-height: 36px;--mdc-outlined-button-container-height: 36px;min-width:36px;width:36px;height:36px;padding:0;border-radius:50%!important}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) .mat-mdc-button-touch-target[_ngcontent-%COMP%]{width:36px;height:36px}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) mat-icon[_ngcontent-%COMP%]{margin:0!important}}.gtc-filter-bar[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem;padding:.5rem .75rem;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .08))}.gtc-project-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.project-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;padding:.2rem .65rem;border-radius:100px;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:transparent;border:1px solid var(--color-border);cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.project-chip[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .3rem;font-size:.68rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.project-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.project-chip.active[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.project-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.gtc-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.3rem .75rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.gtc-body[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex:1;overflow:hidden;min-height:0}.gtc-content[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:1rem 1rem 2rem;min-width:0}.gtc-resizer[_ngcontent-%COMP%]{width:6px;flex-shrink:0;cursor:col-resize;background:transparent;border-left:1px solid var(--color-border);border-right:1px solid var(--color-border);transition:background .15s ease}.gtc-resizer[_ngcontent-%COMP%]:hover, .gtc-resizer[_ngcontent-%COMP%]:active{background:var(--color-primary);opacity:.4}.gtc-preview-pane[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;flex-shrink:0;min-width:280px;border-left:1px solid var(--color-border);background:var(--glass-bg)}.gtc-preview-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.625rem .75rem .625rem 1rem;border-bottom:1px solid var(--color-border);flex-shrink:0}.gtc-preview-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1}.gtc-preview-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;flex-shrink:0}.preview-action-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:6px;background:transparent;cursor:pointer;transition:background .15s ease}.preview-action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px;vertical-align:middle;color:var(--color-text-secondary)}.preview-action-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.preview-action-btn[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-text)}.gtc-preview-body[_ngcontent-%COMP%]{flex:1;overflow:hidden;display:flex;flex-direction:column;min-height:0}.gtc-preview-body[_ngcontent-%COMP%] app-thread[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;min-height:0} app-task-card.is-previewed .task-card{border-color:var(--color-primary);box-shadow:0 0 0 2px var(--color-primary)}.gtc-group[_ngcontent-%COMP%]{margin-bottom:1.25rem}.gtc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.gtc-group-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:.75rem;gap:.75rem}.gtc-group-header[_ngcontent-%COMP%] .gtc-group-title[_ngcontent-%COMP%]{margin-bottom:0}.gtc-group-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.select-all-checkbox[_ngcontent-%COMP%]{--mdc-checkbox-state-layer-size: 32px}.select-mode-btn[_ngcontent-%COMP%]{height:26px;font-size:.72rem;font-weight:600;padding:0 .625rem;border-radius:8px;color:var(--color-text-secondary);border-color:var(--color-border);line-height:26px}.select-mode-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem;margin-right:.2rem}.select-mode-btn[_ngcontent-%COMP%]:hover{color:var(--color-text);border-color:var(--color-text-secondary);background:var(--color-bg-hover)}.batch-done-btn[_ngcontent-%COMP%]{height:26px;font-size:.72rem;font-weight:600;padding:0 .625rem;border-radius:8px;background:var(--color-success, #34c759);color:#fff;line-height:26px}.batch-done-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem;margin-right:.2rem}.select-mode-cancel-btn[_ngcontent-%COMP%]{width:28px;height:28px;display:inline-flex!important;align-items:center!important;justify-content:center!important;color:var(--color-text-secondary)}.select-mode-cancel-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;line-height:1}.select-mode-cancel-btn[_ngcontent-%COMP%]:hover{color:var(--color-text)}.gtc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.gtc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:.95rem;width:.95rem;height:.95rem}.gtc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.gtc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem}@media(max-width:600px){.gtc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.gtc-loading[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;padding:3rem;color:var(--color-text-secondary);text-align:center}.gtc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.9rem}.empty-icon[_ngcontent-%COMP%]{font-size:2.5rem;width:2.5rem;height:2.5rem;opacity:.3}"]})};
4
4
  export{wt as GlobalTaskControlComponent};
@@ -1 +1 @@
1
- import {z}from'./chunk-DMRb150M.js';import {s}from'./chunk-DO3lSvop.js';import {g as g$1,G,P,R as Re,w as we,F,E as ET,z as z$1,b as P$1,ae as Ot,c as U,h as Fw,k as Gn,s as si,m as ws,o as Rg,S as Sg,n as hl,af as Eg,ag as mT,M as MC,t as nI,v as bg,a9 as gC,aa as wf,ac as EC,ab as Cf,Q as QC,ah as aT}from'./main-LBRSRTYI.js';import'./chunk-BXkvjekT.js';import {W as Wn,o as ot}from'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';import {y as yt,w as wt}from'./chunk-BYyTBqh4.js';var ee=()=>[];function te(u,t){if(u&1){let o=gC();ws(0,"div",5)(1,"ds-entity-card",6),Rg("selected",function(r){wf(o);let i=EC();return Cf(i.onItemSelected(r))}),hl(),ws(2,"button",7),Rg("click",function(r){let i=wf(o).$implicit,f=EC();return r.stopPropagation(),Cf(f.onDeleteRequested(i.id))}),ws(3,"mat-icon"),QC(4,"close"),hl()()();}if(u&2){let o=t.$implicit;nI(),bg("id",o.id)("name",o.name)("description",o.description)("badges",o.badges??aT(4,ee));}}var g="__",Y=class u{router=g$1(G);projectStateService=g$1(P);dialog=g$1(Re);destroyRef=g$1(we);notification=g$1(s);projects=F(this.projectStateService.projectList$);forcedProject=F(this.projectStateService.forcedProject$,{initialValue:null});isLoading=F(this.projectStateService.isLoading$,{initialValue:false});projectItems=ET(()=>{let t=this.projects();if(!t)return [];let o=t.filter(e=>!e.name.includes(g)),n=t.filter(e=>e.name.includes(g)),r=new Set(o.map(e=>e.name)),i=e=>e.split(g)[0]??null,f=new Set(n.map(e=>i(e.name)).filter(e=>e!==null&&r.has(e))),l=[],G=[...f].sort((e,a)=>e.localeCompare(a));for(let e of G){let a=o.find(s=>s.name===e);l.push(z$1(P$1({},this.toEntityListItem(a)),{groupKey:e,groupLabel:e}));let Z=n.filter(s=>i(s.name)===e).sort((s,C)=>s.name.localeCompare(C.name));for(let s of Z){let C=s.name.slice(e.length+g.length);l.push(z$1(P$1({},this.toEntityListItem(s)),{name:C,description:s.name,groupKey:e,groupLabel:e}));}}let H=[...o].filter(e=>!f.has(e.name)&&!e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of H)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__standalone__",groupLabel:"Projects"}));let Q=[...o].filter(e=>!f.has(e.name)&&e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of Q)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let X=n.filter(e=>{let a=i(e.name);return a!==null&&!r.has(a)}).sort((e,a)=>e.name.localeCompare(a.name));for(let e of X)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return l});showCreateButton=ET(()=>!this.forcedProject());constructor(){}onItemSelected(t){this.projectStateService.selectProject(t),this.router.navigate(["project",t]);}onCreateRequested(){this.router.navigate(["project","new"]);}onDeleteRequested(t){let o=t.includes(g);this.dialog.open(z,{width:"400px",panelClass:"confirm-dialog-panel",data:P$1({title:"Delete project",message:`This will remove the project "${t}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:true},o?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(Ot(r=>r?.confirmed===true),U(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(t,r.checkboxChecked).pipe(U(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${t}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(t)}`)&&this.router.navigate(["/"]);},error:i=>{console.error("[PROJECT-LIST] Failed to delete project:",i),this.notification.error(i?.error?.error??"Failed to delete project");}});});}toEntityListItem(t){return {id:t.name,name:t.name,badges:t.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(o){return new(o||u)};static \u0275cmp=Fw({type:u,selectors:[["app-project-selection"]],decls:6,vars:5,consts:[["projectCard",""],[1,"project-page-layout"],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","loading","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","routerLink","/","title","Back to tasks",1,"project-list__logo"],["src","CODAY-Logo.png","alt","Coday"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(o,n){if(o&1&&(ws(0,"div",1)(1,"ds-entity-list",2),Rg("itemSelected",function(i){return n.onItemSelected(i)})("createRequested",function(){return n.onCreateRequested()}),ws(2,"a",3),Sg(3,"img",4),hl()()(),Eg(4,te,5,5,"ng-template",null,0,mT)),o&2){let r=MC(5);nI(),bg("items",n.projectItems())("loading",n.isLoading())("itemTemplate",r)("showCreate",n.showCreateButton())("autoFocusSearch",true);}},dependencies:[Wn,ot,yt,wt,Gn,si],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.project-page-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.project-list__logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;border-radius:4px;opacity:.85;transition:opacity .15s ease;cursor:pointer}.project-list__logo[_ngcontent-%COMP%]:hover{opacity:1}.project-list__logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:contain;border-radius:4px}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"],changeDetection:1})};export{Y as ProjectListComponent};
1
+ import {z}from'./chunk-B17Inq8D.js';import {s}from'./chunk-D26Y186i.js';import {g as g$1,G,P,R as Re,C as Ce,F,T as TT,z as z$1,a as P$1,ae as kt,b as U,j as jw,i as Gn,s as si,k as Cs,n as kg,M as Mg,m as hl,af as wg,ag as ET,A as AC,t as sI,_ as _g,a9 as vC,aa as Cf,ac as CC,ab as Tf,J as JC,ah as dT}from'./main-YYHD6X7H.js';import'./chunk-Buu9Jf-V.js';import {W as Wn,o as ot}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import {y as yt,w as wt}from'./chunk-FMHkoXwM.js';var ee=()=>[];function te(u,t){if(u&1){let o=vC();Cs(0,"div",5)(1,"ds-entity-card",6),kg("selected",function(r){Cf(o);let i=CC();return Tf(i.onItemSelected(r))}),hl(),Cs(2,"button",7),kg("click",function(r){let i=Cf(o).$implicit,f=CC();return r.stopPropagation(),Tf(f.onDeleteRequested(i.id))}),Cs(3,"mat-icon"),JC(4,"close"),hl()()();}if(u&2){let o=t.$implicit;sI(),_g("id",o.id)("name",o.name)("description",o.description)("badges",o.badges??dT(4,ee));}}var g="__",Y=class u{router=g$1(G);projectStateService=g$1(P);dialog=g$1(Re);destroyRef=g$1(Ce);notification=g$1(s);projects=F(this.projectStateService.projectList$);forcedProject=F(this.projectStateService.forcedProject$,{initialValue:null});isLoading=F(this.projectStateService.isLoading$,{initialValue:false});projectItems=TT(()=>{let t=this.projects();if(!t)return [];let o=t.filter(e=>!e.name.includes(g)),n=t.filter(e=>e.name.includes(g)),r=new Set(o.map(e=>e.name)),i=e=>e.split(g)[0]??null,f=new Set(n.map(e=>i(e.name)).filter(e=>e!==null&&r.has(e))),l=[],G=[...f].sort((e,a)=>e.localeCompare(a));for(let e of G){let a=o.find(s=>s.name===e);l.push(z$1(P$1({},this.toEntityListItem(a)),{groupKey:e,groupLabel:e}));let Z=n.filter(s=>i(s.name)===e).sort((s,C)=>s.name.localeCompare(C.name));for(let s of Z){let C=s.name.slice(e.length+g.length);l.push(z$1(P$1({},this.toEntityListItem(s)),{name:C,description:s.name,groupKey:e,groupLabel:e}));}}let H=[...o].filter(e=>!f.has(e.name)&&!e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of H)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__standalone__",groupLabel:"Projects"}));let Q=[...o].filter(e=>!f.has(e.name)&&e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of Q)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let X=n.filter(e=>{let a=i(e.name);return a!==null&&!r.has(a)}).sort((e,a)=>e.name.localeCompare(a.name));for(let e of X)l.push(z$1(P$1({},this.toEntityListItem(e)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return l});showCreateButton=TT(()=>!this.forcedProject());constructor(){}onItemSelected(t){this.projectStateService.selectProject(t),this.router.navigate(["project",t]);}onCreateRequested(){this.router.navigate(["project","new"]);}onDeleteRequested(t){let o=t.includes(g);this.dialog.open(z,{width:"400px",panelClass:"confirm-dialog-panel",data:P$1({title:"Delete project",message:`This will remove the project "${t}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:true},o?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(kt(r=>r?.confirmed===true),U(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(t,r.checkboxChecked).pipe(U(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${t}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(t)}`)&&this.router.navigate(["/"]);},error:i=>{console.error("[PROJECT-LIST] Failed to delete project:",i),this.notification.error(i?.error?.error??"Failed to delete project");}});});}toEntityListItem(t){return {id:t.name,name:t.name,badges:t.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(o){return new(o||u)};static \u0275cmp=jw({type:u,selectors:[["app-project-selection"]],decls:6,vars:5,consts:[["projectCard",""],[1,"project-page-layout"],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","loading","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","routerLink","/","title","Back to tasks",1,"project-list__logo"],["src","CODAY-Logo.png","alt","Coday"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(o,n){if(o&1&&(Cs(0,"div",1)(1,"ds-entity-list",2),kg("itemSelected",function(i){return n.onItemSelected(i)})("createRequested",function(){return n.onCreateRequested()}),Cs(2,"a",3),Mg(3,"img",4),hl()()(),wg(4,te,5,5,"ng-template",null,0,ET)),o&2){let r=AC(5);sI(),_g("items",n.projectItems())("loading",n.isLoading())("itemTemplate",r)("showCreate",n.showCreateButton())("autoFocusSearch",true);}},dependencies:[Wn,ot,yt,wt,Gn,si],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.project-page-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.project-list__logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;border-radius:4px;opacity:.85;transition:opacity .15s ease;cursor:pointer}.project-list__logo[_ngcontent-%COMP%]:hover{opacity:1}.project-list__logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:contain;border-radius:4px}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"],changeDetection:1})};export{Y as ProjectListComponent};
@@ -1 +1 @@
1
- import {K as Kn,S as Se}from'./chunk-BaO2vi_O.js';import {cb as LB,cc as PB,a as Gi,E as ET,h as Fw,m as ws,Q as QC,n as hl,q as oC,t as nI,a8 as Yg,T as Tg,a5 as Dl,x as iC,a9 as gC,o as Rg,ac as EC,aa as wf,ab as Cf}from'./main-LBRSRTYI.js';function M(o,m){if(o&1){let e=gC();ws(0,"span",7),QC(1,"Delete?"),hl(),ws(2,"ds-icon-button",8),Rg("action",function(){wf(e);let a=EC();return Cf(a.onDeleteConfirmed())}),hl(),ws(3,"ds-icon-button",9),Rg("action",function(){wf(e);let a=EC();return Cf(a.onDeleteCancelled())}),hl();}}function S(o,m){if(o&1){let e=gC();ws(0,"ds-icon-button",11),Rg("action",function(){wf(e);let a=EC(2);return Cf(a.onEdit())}),hl(),ws(1,"ds-icon-button",12),Rg("action",function(){wf(e);let a=EC(2);return Cf(a.onDeleteArmed())}),hl();}}function P(o,m){if(o&1){let e=gC();ws(0,"ds-icon-button",10),Rg("action",function(){wf(e);let a=EC();return Cf(a.onDuplicate())}),hl(),oC(1,S,2,0);}if(o&2){let e=EC();nI(),iC(e.readOnly()?-1:1);}}var E=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration partag\xE9e plateforme",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),O=class o{config=LB.required();scope=LB.required();readOnly=LB(false);editRequested=PB();deleteRequested=PB();duplicateRequested=PB();pendingDelete=Gi(false);badge=ET(()=>E[this.scope()]);onEdit(){this.editRequested.emit(this.config());}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteArmed(){this.pendingDelete.set(true);}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Fw({type:o,selectors:[["agentos-integration-config-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:6,consts:[["role","listitem","dsBlueprint","",1,"integration-config-item"],[1,"integration-config-item__body"],[1,"integration-config-item__heading"],[1,"integration-config-item__name"],[1,"integration-config-item__badge"],[1,"integration-config-item__type"],[1,"integration-config-item__actions"],[1,"integration-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this configuration",3,"action"],["icon","edit","title","Edit integration",3,"action"],["icon","delete","variant","danger","title","Delete integration",3,"action"]],template:function(e,t){e&1&&(ws(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),QC(4),hl(),ws(5,"span",4),QC(6),hl()(),ws(7,"span",5),QC(8),hl()(),ws(9,"div",6),oC(10,M,4,0)(11,P,2,1),hl()()),e&2&&(nI(4),Yg(t.config().name),nI(),Tg("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),nI(),Dl(" ",t.badge().label," "),nI(2),Yg(t.config().integrationType),nI(2),iC(t.pendingDelete()?10:11));},dependencies:[Kn,Se],styles:[".integration-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.integration-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.integration-config-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.integration-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.integration-config-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.integration-config-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent}.integration-config-item__badge[data-variant=info][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-info) 40%,transparent);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.integration-config-item__badge[data-variant=warning][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-warning) 40%,transparent);color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent)}.integration-config-item__type[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.integration-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover .integration-config-item__actions[_ngcontent-%COMP%], .integration-config-item[_ngcontent-%COMP%]:focus-within .integration-config-item__actions[_ngcontent-%COMP%]{opacity:1}.integration-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{O};
1
+ import {K as Kn,S as Se}from'./chunk-B13_C_P9.js';import {cb as JB,cc as XB,W as Wi,T as TT,j as jw,k as Cs,J as JC,m as hl,o as aC,t as sI,a8 as Kg,S as Sg,a5 as Dl,u as cC,a9 as vC,n as kg,ac as CC,aa as Cf,ab as Tf}from'./main-YYHD6X7H.js';function M(o,m){if(o&1){let e=vC();Cs(0,"span",7),JC(1,"Delete?"),hl(),Cs(2,"ds-icon-button",8),kg("action",function(){Cf(e);let a=CC();return Tf(a.onDeleteConfirmed())}),hl(),Cs(3,"ds-icon-button",9),kg("action",function(){Cf(e);let a=CC();return Tf(a.onDeleteCancelled())}),hl();}}function S(o,m){if(o&1){let e=vC();Cs(0,"ds-icon-button",11),kg("action",function(){Cf(e);let a=CC(2);return Tf(a.onEdit())}),hl(),Cs(1,"ds-icon-button",12),kg("action",function(){Cf(e);let a=CC(2);return Tf(a.onDeleteArmed())}),hl();}}function P(o,m){if(o&1){let e=vC();Cs(0,"ds-icon-button",10),kg("action",function(){Cf(e);let a=CC();return Tf(a.onDuplicate())}),hl(),aC(1,S,2,0);}if(o&2){let e=CC();sI(),cC(e.readOnly()?-1:1);}}var E=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration partag\xE9e plateforme",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),O=class o{config=JB.required();scope=JB.required();readOnly=JB(false);editRequested=XB();deleteRequested=XB();duplicateRequested=XB();pendingDelete=Wi(false);badge=TT(()=>E[this.scope()]);onEdit(){this.editRequested.emit(this.config());}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteArmed(){this.pendingDelete.set(true);}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=jw({type:o,selectors:[["agentos-integration-config-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:6,consts:[["role","listitem","dsBlueprint","",1,"integration-config-item"],[1,"integration-config-item__body"],[1,"integration-config-item__heading"],[1,"integration-config-item__name"],[1,"integration-config-item__badge"],[1,"integration-config-item__type"],[1,"integration-config-item__actions"],[1,"integration-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this configuration",3,"action"],["icon","edit","title","Edit integration",3,"action"],["icon","delete","variant","danger","title","Delete integration",3,"action"]],template:function(e,t){e&1&&(Cs(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),JC(4),hl(),Cs(5,"span",4),JC(6),hl()(),Cs(7,"span",5),JC(8),hl()(),Cs(9,"div",6),aC(10,M,4,0)(11,P,2,1),hl()()),e&2&&(sI(4),Kg(t.config().name),sI(),Sg("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),sI(),Dl(" ",t.badge().label," "),sI(2),Kg(t.config().integrationType),sI(2),cC(t.pendingDelete()?10:11));},dependencies:[Kn,Se],styles:[".integration-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.integration-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.integration-config-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.integration-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.integration-config-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.integration-config-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent}.integration-config-item__badge[data-variant=info][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-info) 40%,transparent);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.integration-config-item__badge[data-variant=warning][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-warning) 40%,transparent);color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent)}.integration-config-item__type[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.integration-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover .integration-config-item__actions[_ngcontent-%COMP%], .integration-config-item[_ngcontent-%COMP%]:focus-within .integration-config-item__actions[_ngcontent-%COMP%]{opacity:1}.integration-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{O};
@@ -1 +1 @@
1
- import {g,I as fy,X as br,bU as kd,u as ue,Y as x}from'./main-LBRSRTYI.js';var f=class s{http=g(fy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?br(t):this.http.get(`/api/projects/${e}/agents`).pipe(kd(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
1
+ import {g,B as gy,I as br,bU as Fd,r as re,K as x}from'./main-YYHD6X7H.js';var f=class s{http=g(gy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?br(t):this.http.get(`/api/projects/${e}/agents`).pipe(Fd(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(re(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
@@ -0,0 +1 @@
1
+ import {O}from'./chunk-D30bRRTP.js';import {R}from'./chunk-CR817PBg.js';import {g,G,C as Ce,aJ as Tr,W as Wi,bS as Da,r as re,b as U,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,J as JC,m as hl,af as wg,A as AC,_ as _g,bg as yT,ah as dT,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-YYHD6X7H.js';import'./chunk-BJld3zB5.js';import {W as Wn}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import'./chunk-FMHkoXwM.js';import'./chunk-DaoWXYMw.js';import'./chunk-4uEZjTft.js';var k=()=>[];function V(i,t){if(i&1){let e=vC();Cs(0,"agentos-auth-setting-item",4),kg("editRequested",function(n){Cf(e);let p=CC(2);return Tf(p.onEdit(n))})("deleteRequested",function(n){Cf(e);let p=CC(2);return Tf(p.onDelete(n))}),hl();}i&2&&_g("config",t)("showBadge",false);}function F(i,t){if(i&1&&aC(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=CC();cC((e=n.resolveSetting(o.id))?0:-1,e);}}var M=class i{router=g(G);destroyRef=g(Ce);state=g(R);refresh$=new Tr(void 0);isLoading=Wi(true);settings$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())));settingItems$=this.settings$.pipe(re(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.state.delete(t.id,"platform").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:7,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,o){if(e&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return o.openCreateForm()}),Cs(2,"button",2),kg("click",function(){return o.goBack()}),JC(3,"\u2190 Admin"),hl()(),wg(4,F,1,1,"ng-template",null,0,ET)),e&2){let n=AC(5);_g("items",yT(1,4,o.settingItems$)??dT(6,k))("loading",o.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,Lb],encapsulation:2})};export{M as PlatformAuthSettingsComponent};
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-BJld3zB5.js';import {g,ao as V,dm as G,W as Wi,an as ue$1,cd as $f,j as jw,s as si,cF as $b,k as Cs,J as JC,m as hl,o as aC,t as sI,u as cC,bR as Sd,bS as Da,cB as on,$ as $y,a7 as va,a9 as vC,n as kg,ai as rm,a3 as ZI,ac as CC,ak as nm,a6 as QI,a8 as Kg,q as dC,v as fC,cg as pT,b4 as fT,bf as gT,bg as yT,b0 as Xg,bi as vT,aa as Cf,ab as Tf,aj as iT,a5 as Dl}from'./main-YYHD6X7H.js';import {t as ti,J as Jn,Y as Ye,Z as Zn,l as Xn,g as gt,c as cn,d as an}from'./chunk-FMHkoXwM.js';import'./chunk-4uEZjTft.js';import'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';var ne=e=>({title:"By agent",rows:e}),ie=e=>({title:"By model",rows:e}),ae=(e,o)=>[e,o],oe=(e,o)=>o.title,re=(e,o)=>o.key;function se(e,o){e&1&&(Cs(0,"p",2),JC(1,"Loading usage settings\u2026"),hl());}function le(e,o){if(e&1){let t=vC();Cs(0,"p",3),JC(1,"Could not load usage settings. Please try again."),hl(),Cs(2,"button",4),kg("click",function(){Cf(t);let s=CC();return Tf(s.configuration.retry())}),JC(3,"Retry usage settings"),hl();}}function me(e,o){e&1&&(Cs(0,"p",2),JC(1,"Usage tracking is disabled."),hl());}function de(e,o){e&1&&(Cs(0,"p",3),JC(1),hl()),e&2&&(sI(),Kg(o));}function ce(e,o){e&1&&(Cs(0,"p",2),JC(1,"Loading usage\u2026"),hl());}function pe(e,o){e&1&&(Cs(0,"p"),JC(1,"No recorded usage for this period."),hl());}function ge(e,o){if(e&1&&(Cs(0,"small"),JC(1),hl()),e&2){let t=CC().$implicit;sI(),Dl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function ue(e,o){if(e&1&&(Cs(0,"tr")(1,"th",11),JC(2),hl(),Cs(3,"td"),JC(4),gT(5,"number"),hl(),Cs(6,"td"),JC(7),gT(8,"number"),gT(9,"number"),hl(),Cs(10,"td"),JC(11),gT(12,"number"),gT(13,"number"),hl(),Cs(14,"td"),JC(15),gT(16,"number"),aC(17,ge,2,1,"small"),hl()()),e&2){let t=o.$implicit;sI(2),Kg(t.key),sI(2),Kg(yT(5,9,t.aggregate.totalTokens)),sI(3),Xg("",yT(8,11,t.aggregate.inputTokens)," / ",yT(9,13,t.aggregate.outputTokens)),sI(4),Xg(" ",yT(12,15,t.aggregate.cacheReadTokens)," / ",yT(13,17,t.aggregate.cacheWriteTokens)," "),sI(4),Xg(" ",t.aggregate.unknownCostCount>0?"At least ":"","",vT(16,19,t.aggregate.cost,"1.2-6")," "),sI(2),cC(t.aggregate.unknownCostCount>0?17:-1);}}function _e(e,o){if(e&1&&(Cs(0,"div",9)(1,"table")(2,"thead")(3,"tr")(4,"th",10),JC(5,"Name"),hl(),Cs(6,"th",10),JC(7,"Tokens"),hl(),Cs(8,"th",10),JC(9,"Input / output"),hl(),Cs(10,"th",10),JC(11,"Cache read / write"),hl(),Cs(12,"th",10),JC(13,"Estimated cost"),hl()()(),Cs(14,"tbody"),dC(15,ue,18,22,"tr",null,re),hl()()()),e&2){let t=CC().$implicit;sI(15),fC(t.rows);}}function Ce(e,o){if(e&1&&(Cs(0,"h2"),JC(1),hl(),aC(2,pe,2,0,"p")(3,_e,17,0,"div",9)),e&2){let t=o.$implicit;sI(),Kg(t.title),sI(),cC(t.rows.length===0?2:3);}}function fe(e,o){if(e&1&&(dC(0,Ce,4,2,null,null,oe),Cs(2,"p"),JC(3,"Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish."),hl()),e&2){let t=CC(2);fC(pT(4,ae,fT(0,ne,t.agents()),fT(2,ie,t.models())));}}function ye(e,o){if(e&1){let t=vC();Cs(0,"p"),JC(1,"Recorded LLM usage across this namespace. Costs are estimates in the platform currency."),hl(),Cs(2,"form",5),kg("ngSubmit",function(){Cf(t);let s=CC();return Tf(s.load())}),Cs(3,"label"),JC(4,"From (UTC)"),Cs(5,"input",6),rm("ngModelChange",function(s){Cf(t);let d=CC();return iT(d.from,s)||(d.from=s),Tf(s)}),hl(),ZI(),hl(),Cs(6,"label"),JC(7,"To (UTC)"),Cs(8,"input",7),rm("ngModelChange",function(s){Cf(t);let d=CC();return iT(d.to,s)||(d.to=s),Tf(s)}),hl(),ZI(),hl(),Cs(9,"button",8),JC(10,"Refresh"),hl()(),aC(11,de,2,1,"p",3),aC(12,ce,2,0,"p",2)(13,fe,4,7);}if(e&2){let t,r=CC();sI(5),nm("ngModel",r.from),QI(),sI(3),nm("ngModel",r.to),QI(),sI(3),cC((t=r.error())?11:-1,t),sI(),cC(r.loading()?12:r.error()?-1:13);}}var te=class e{route=g(V);api=g(G);configuration=g(c);namespaceId=this.route.snapshot.params.namespaceId;agents=Wi([]);models=Wi([]);error=Wi(null);loading=Wi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new ue$1;constructor(){$f(o=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Sd(void 0),Da(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),on):(this.loading.set(true),$y({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(va(d=>(this.loading.set(false),this.error.set(d.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),on))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});o(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=jw({type:e,selectors:[["agentos-namespace-usage"]],decls:9,vars:1,consts:[[1,"report"],["routerLink","/agentos/namespaces"],["role","status"],["role","alert"],["type","button",3,"click"],[1,"filters",3,"ngSubmit"],["type","date","name","from","required","",3,"ngModelChange","ngModel"],["type","date","name","to","required","",3,"ngModelChange","ngModel"],["type","submit"],[1,"table-wrap"],["scope","col"],["scope","row"]],template:function(t,r){t&1&&(Cs(0,"section",0)(1,"a",1),JC(2,"\u2190 Namespaces"),hl(),Cs(3,"h1"),JC(4,"Usage and costs"),hl(),aC(5,se,2,0,"p",2)(6,le,4,0)(7,me,2,0,"p",2)(8,ye,14,4),hl()),t&2&&(sI(5),cC(r.configuration.state()==="loading"?5:r.configuration.state()==="error"?6:r.configuration.state()==="disabled"?7:8));},dependencies:[ti,Jn,Ye,Zn,Xn,gt,cn,an,si,$b],styles:["[_nghost-%COMP%]{display:block}.report[_ngcontent-%COMP%]{max-width:1100px;margin:auto;padding:1.5rem;color:var(--color-text, inherit)}a[_ngcontent-%COMP%]{color:inherit}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:1rem;align-items:end;margin:1.5rem 0}label[_ngcontent-%COMP%]{display:grid;gap:.4rem}input[_ngcontent-%COMP%], button[_ngcontent-%COMP%]{font:inherit;color:inherit;background:transparent;border:1px solid var(--color-border, rgba(136, 136, 136, .5333333333));border-radius:.4rem;padding:.5rem .75rem}button[_ngcontent-%COMP%]{cursor:pointer}.table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table[_ngcontent-%COMP%]{border-collapse:collapse;width:100%}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{text-align:left;padding:.75rem;border-bottom:1px solid var(--color-border, rgba(136, 136, 136, .3333333333))}small[_ngcontent-%COMP%]{display:block;margin-top:.3rem}h2[_ngcontent-%COMP%]{margin-top:2rem}"]})};export{te as NamespaceUsageComponent};
@@ -1 +1 @@
1
- import {g,dj as ne,Y as x}from'./main-LBRSRTYI.js';var c=class r{api=g(ne);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
1
+ import {g,dj as re,K as x}from'./main-YYHD6X7H.js';var c=class r{api=g(re);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=x({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
@@ -0,0 +1 @@
1
+ import {l}from'./chunk-BJld3zB5.js';import {g,df as Z,dg as T,I as br,bS as Da,r as re,a7 as va,cE as kd,K as x}from'./main-YYHD6X7H.js';var v=class i{userState=g(l);membership=g(Z);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return br(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Da(a=>a?a.isAdmin?br(true):this.membership.getMembersNamespaceMembership(e).pipe(re(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),va(()=>br(false))):br(false)),kd({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
@@ -0,0 +1 @@
1
+ import {bS as Da,a7 as va,I as br,cE as kd}from'./main-YYHD6X7H.js';function i(t,o,p){return t.pipe(Da(()=>o().pipe(va(()=>br(p)))),kd({bufferSize:1,refCount:true}))}export{i};
@@ -1 +1 @@
1
- import {I}from'./chunk-DqC8XT4v.js';import {m}from'./chunk-R-GmZrHu.js';import {g,ao as V$1,G as G$1,w as we,aJ as Tr,a as Gi,bS as Da,W as Vy,a7 as va,X as br,u as ue,c as U$1,h as Fw,aK as Ob,m as ws,bf as dT,o as Rg,Q as QC,n as hl,af as Eg,M as MC,v as bg,bg as pT,ah as aT,q as oC,ac as EC,x as iC,a9 as gC,aa as wf,ab as Cf,ag as mT}from'./main-LBRSRTYI.js';import {W as Wn}from'./chunk-BaO2vi_O.js';import'./chunk-DjMtxVWg.js';import'./chunk-BYyTBqh4.js';import'./chunk-ClSDInQq.js';var U=()=>[];function V(r,t){if(r&1){let o=gC();ws(0,"agentos-prompt-item",4),Rg("deleteRequested",function(n){wf(o);let F=EC(2);return Cf(F.deletePrompt(n))}),hl();}if(r&2){let o=EC().$implicit,e=EC();bg("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function j(r,t){if(r&1&&oC(0,V,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=EC();iC((o=n.resolvePrompt(e.id))?0:-1,o);}}var G="platform",K="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);allPrompts$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),Vy({platform:this.promptState.listPlatform().pipe(va(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));promptItems$=this.allPrompts$.pipe(ue(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=Fw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:7,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(ws(0,"ds-entity-list",1),dT(1,"async"),Rg("createRequested",function(){return e.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return e.goBack()}),QC(3,"\u2190 Namespaces"),hl()(),Eg(4,j,1,1,"ng-template",null,0,mT)),o&2){let n=MC(5);bg("items",pT(1,4,e.promptItems$)??aT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Ob],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
1
+ import {I}from'./chunk-BEdQqXxw.js';import {m}from'./chunk-BJld3zB5.js';import {g,ao as V$1,G as G$1,C as Ce,aJ as Tr,W as Wi,bS as Da,$ as $y,a7 as va,I as br,r as re,b as U$1,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,J as JC,m as hl,af as wg,A as AC,_ as _g,bg as yT,ah as dT,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-YYHD6X7H.js';import {W as Wn}from'./chunk-B13_C_P9.js';import'./chunk-CgNkwpQ7.js';import'./chunk-FMHkoXwM.js';import'./chunk-4uEZjTft.js';var U=()=>[];function V(r,t){if(r&1){let o=vC();Cs(0,"agentos-prompt-item",4),kg("deleteRequested",function(n){Cf(o);let F=CC(2);return Tf(F.deletePrompt(n))}),hl();}if(r&2){let o=CC().$implicit,e=CC();_g("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function j(r,t){if(r&1&&aC(0,V,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=CC();cC((o=n.resolvePrompt(e.id))?0:-1,o);}}var G="platform",K="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(Ce);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Wi(true);allPrompts$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),$y({platform:this.promptState.listPlatform().pipe(va(()=>br([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));promptItems$=this.allPrompts$.pipe(re(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=jw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:7,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return e.openCreateForm()}),Cs(2,"button",2),kg("click",function(){return e.goBack()}),JC(3,"\u2190 Namespaces"),hl()(),wg(4,j,1,1,"ng-template",null,0,ET)),o&2){let n=AC(5);_g("items",yT(1,4,e.promptItems$)??dT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Lb],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};