@whoz-oss/coday-client 3.18.0 → 3.19.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.
- package/browser/{chunk-DOHvMo5p.js → chunk-2H_m7V_L.js} +1 -1
- package/browser/{chunk-Buu9Jf-V.js → chunk-3m_nS8Y5.js} +1 -1
- package/browser/{chunk-Cjk-zAXy.js → chunk-4tOVGgPj.js} +1 -1
- package/browser/{chunk-BVmICoo4.js → chunk-82BMsVX3.js} +1 -1
- package/browser/{chunk-CakkML6n.js → chunk-B3NyUUXq.js} +1 -1
- package/browser/chunk-B55TXBfo.js +1 -0
- package/browser/{chunk-py_Q_oQH.js → chunk-B9NYLAhC.js} +1 -1
- package/browser/{chunk-CgNkwpQ7.js → chunk-BEaYQhbI.js} +1 -1
- package/browser/chunk-BI4kHPfc.js +1 -0
- package/browser/{chunk-DMyGIjcZ.js → chunk-BID9NaLj.js} +1 -1
- package/browser/{chunk-CxpHnwnx.js → chunk-BOpm3F5F.js} +1 -1
- package/browser/{chunk-DoqL_RuM.js → chunk-BWLCegs8.js} +1 -1
- package/browser/{chunk-CJEW8Ogd.js → chunk-BWZcAdUl.js} +1 -1
- package/browser/{chunk-BEdQqXxw.js → chunk-BXsNw_60.js} +1 -1
- package/browser/chunk-BZ-rNYX5.js +1 -0
- package/browser/{chunk-DMUiJ7oP.js → chunk-B_5qWQZJ.js} +1 -1
- package/browser/{chunk-BGTRsbsl.js → chunk-BcHHkjC4.js} +1 -1
- package/browser/{chunk-zvR-rokl.js → chunk-BhD8uvAV.js} +1 -1
- package/browser/{chunk-IYMfBoNU.js → chunk-Bha8h69K.js} +1 -1
- package/browser/{chunk-FMHkoXwM.js → chunk-BhdMedPO.js} +1 -1
- package/browser/{chunk-CR817PBg.js → chunk-BiwhEkuA.js} +1 -1
- package/browser/{chunk-4uEZjTft.js → chunk-Bkwb10Tz.js} +1 -1
- package/browser/{chunk-BXCHG0wB.js → chunk-BlO8XEX7.js} +1 -1
- package/browser/{chunk-D6nkbOg1.js → chunk-BmiWFhjp.js} +1 -1
- package/browser/{chunk-W5DNK5PC.js → chunk-BnDz6aYG.js} +1 -1
- package/browser/{chunk-ClCDsg8D.js → chunk-BqH7Wffn.js} +1 -1
- package/browser/{chunk-B_Sx6nwb.js → chunk-BrZnGAfk.js} +1 -1
- package/browser/{chunk-BbPMe8u2.js → chunk-Bu2KbiEO.js} +1 -1
- package/browser/{chunk-WSA7xa0h.js → chunk-C3kED08r.js} +1 -1
- package/browser/{chunk-Bb_J3EoX.js → chunk-C4bnTLvT.js} +1 -1
- package/browser/{chunk-CqJ7rGVY.js → chunk-C5I2MlRU.js} +1 -1
- package/browser/{chunk-DVTNoWCQ.js → chunk-C9j9HPDY.js} +1 -1
- package/browser/{chunk-DJjbZAaS.js → chunk-CEeAV-bb.js} +1 -1
- package/browser/{chunk-CJAdjOmi.js → chunk-CNQEET68.js} +1 -1
- package/browser/{chunk--yaU4Sri.js → chunk-CNfTQeDy.js} +1 -1
- package/browser/{chunk-D1ZnLng-.js → chunk-CR2xcumM.js} +1 -1
- package/browser/{chunk-BfE6wTUj.js → chunk-CUeRU4T-.js} +1 -1
- package/browser/{chunk-B17Inq8D.js → chunk-Cno6SC-J.js} +1 -1
- package/browser/{chunk-CXgj_KJY.js → chunk-CorOD5-V.js} +1 -1
- package/browser/{chunk-DKQvH1hP.js → chunk-CvEqqOCm.js} +1 -1
- package/browser/{chunk-D4dmZgr6.js → chunk-Cwpn9dPE.js} +1 -1
- package/browser/{chunk-DmaEv05C.js → chunk-Cx3RQESQ.js} +1 -1
- package/browser/{chunk-D26Y186i.js → chunk-CxKynLjd.js} +1 -1
- package/browser/{chunk-B13_C_P9.js → chunk-D8Bz7q-C.js} +1 -1
- package/browser/{chunk-t87lD8bQ.js → chunk-DAyHNJOx.js} +1 -1
- package/browser/{chunk-D8nXP3jN.js → chunk-DBfSV0o-.js} +1 -1
- package/browser/{chunk-D2zGvbD2.js → chunk-DEAo8Gsm.js} +1 -1
- package/browser/{chunk-D30bRRTP.js → chunk-DHF4GvxN.js} +1 -1
- package/browser/{chunk-BJld3zB5.js → chunk-DIhIuMRR.js} +4 -4
- package/browser/{chunk-CM1_Z4h5.js → chunk-DK7la0Zv.js} +1 -1
- package/browser/{chunk-CP3b1EMm.js → chunk-DKUyWR_o.js} +1 -1
- package/browser/{chunk-B1vuv-dv.js → chunk-DP1Oiy0T.js} +1 -1
- package/browser/{chunk-Bnj9Hkqy.js → chunk-DSgmn8Nl.js} +1 -1
- package/browser/{chunk-D92adUD_.js → chunk-DVVwrDwV.js} +1 -1
- package/browser/{chunk-BqWEyotW.js → chunk-DWlwteaE.js} +1 -1
- package/browser/{chunk-HHPhxe9B.js → chunk-DXAodgYO.js} +1 -1
- package/browser/{chunk-Qpb04pBJ.js → chunk-Ddy7zzYX.js} +1 -1
- package/browser/{chunk-DFjZf9oL.js → chunk-DrITgtaw.js} +1 -1
- package/browser/{chunk-CfPmQ0Fw.js → chunk-Drt7fOvo.js} +1 -1
- package/browser/{chunk-PQu4_Hy2.js → chunk-Dw8nvU1v.js} +1 -1
- package/browser/{chunk-o2LY9dfG.js → chunk-HERnQhug.js} +1 -1
- package/browser/{chunk-CmyT-Z4A.js → chunk-RlCcRMQy.js} +1 -1
- package/browser/{chunk-4v7WiOTx.js → chunk-iwYQP1W9.js} +1 -1
- package/browser/{chunk-DV_7IOl_.js → chunk-kXODoW4J.js} +1 -1
- package/browser/{chunk-Fr6-w83-.js → chunk-nbZfjdVD.js} +1 -1
- package/browser/{chunk-BHiaH1Jm.js → chunk-t5r49PeM.js} +1 -1
- package/browser/{chunk-vL7dLM7S.js → chunk-vG5Um99w.js} +1 -1
- package/browser/{chunk-DDu5Ufv3.js → chunk-vse5stCO.js} +1 -1
- package/browser/{chunk-B-UKlpjJ.js → chunk-wricEDWB.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-YYHD6X7H.js → main-K6RKSHKK.js} +13 -13
- package/package.json +1 -1
- package/browser/chunk-DaoWXYMw.js +0 -1
- package/browser/chunk-lX2E6ugr.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-BOpm3F5F.js';import {g,ao as V$1,G as G$1,C as Ce,dm as B,df as $,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,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-K6RKSHKK.js';import {W as Wn,S as Se}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';var K=()=>[];function U(n,o){if(n&1){let i=vC();Cs(0,"agentos-ai-model-item",4),kg("deleteRequested",function(a){Cf(i);let t=CC(2);return Tf(t.deleteModel(a))})("editRequested",function(a){Cf(i);let t=CC(2);return Tf(t.editModel(a))}),hl();}if(n&2){let i=CC().$implicit,e=CC();_g("model",o)("namespaceId",e.namespaceId)("readOnly",e.isPlatformModel(i.id));}}function j(n,o){if(n&1&&aC(0,U,1,3,"agentos-ai-model-item",3),n&2){let i,e=o.$implicit,a=CC();cC((i=a.resolveModel(e.id))?0:-1,i);}}var G="__platform__",J="Platform (read-only)",V=class n{route=g(V$1);router=g(G$1);destroyRef=g(Ce);aiModelController=g(B);aiProviderController=g($);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Wi(true);data$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),$y({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(va(()=>br([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}))));modelItems$=this.data$.pipe(re(({namespace:o,platform:i,providers:e})=>{let a=new Map(e.map(t=>[t.id??"",t.name]));return [...i.map(t=>({id:t.id??"",name:t.alias??t.apiModelName,description:t.apiModelName,groupKey:G,groupLabel:J})),...o.map(t=>({id:t.id??"",name:t.alias??t.apiModelName,description:t.apiModelName,groupKey:t.aiProviderId,groupLabel:a.get(t.aiProviderId)??t.aiProviderId}))]}));namespaceModelsById=new Map;platformModelsById=new Map;constructor(){this.data$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:o,platform:i})=>{this.namespaceModelsById=new Map(o.map(e=>[e.id??"",e])),this.platformModelsById=new Map(i.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,"ai-models","new"]);}editModel(o){this.router.navigate(["/agentos",this.namespaceId,"ai-models",o.id,"edit"]);}deleteModel(o){this.aiModelController.deleteAiModel(o.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveModel(o){return this.namespaceModelsById.get(o)??this.platformModelsById.get(o)??null}isPlatformModel(o){return this.platformModelsById.has(o)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=jw({type:n,selectors:[["agentos-namespace-ai-models"]],decls:5,vars:7,consts:[["aiModelItemTpl",""],["title","AI models","emptyMessage","No AI models configured yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model","namespaceId","readOnly"],[3,"deleteRequested","editRequested","model","namespaceId","readOnly"]],template:function(i,e){if(i&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return e.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return e.goBack()}),hl()(),wg(3,j,1,1,"ng-template",null,0,ET)),i&2){let a=AC(4);_g("items",yT(1,4,e.modelItems$)??dT(6,K))("loading",e.isLoading())("showCreate",true)("itemTemplate",a);}},dependencies:[Wn,I,Se,Lb],encapsulation:2})};export{V as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,ao as V,G,d5 as N,C as Ce,W as Wi,b as U$1,z as z$1,a as P,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a8 as Kg,u as cC,a9 as vC,M as Mg,a3 as ZI,ac as CC,_ as _g,a6 as QI,a5 as Dl,aa as Cf,ab as Tf}from'./main-
|
|
1
|
+
import {g,ao as V,G,d5 as N,C as Ce,W as Wi,b as U$1,z as z$1,a as P,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a8 as Kg,u as cC,a9 as vC,M as Mg,a3 as ZI,ac as CC,_ as _g,a6 as QI,a5 as Dl,aa as Cf,ab as Tf}from'./main-K6RKSHKK.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Y as Ye,f as fn,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-BhdMedPO.js';function U(l,r){l&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function H(l,r){if(l&1){let e=vC();Cs(0,"form",7),kg("ngSubmit",function(){Cf(e);let u=CC();return Tf(u.submit())}),Cs(1,"div",8)(2,"label",9),JC(3,"Name "),Cs(4,"span",10),JC(5,"*"),hl()(),Mg(6,"input",11),ZI(),hl(),Cs(7,"div",8)(8,"label",12),JC(9,"Description"),hl(),Mg(10,"textarea",13),ZI(),hl(),Cs(11,"div",8)(12,"label",14),JC(13,"External ID"),hl(),Mg(14,"input",15),ZI(),hl(),Cs(15,"div",8)(16,"label",16),JC(17,"Default agent"),hl(),Mg(18,"input",17),ZI(),hl(),Cs(19,"div",8)(20,"label",18),JC(21,"Config path"),hl(),Mg(22,"input",19),ZI(),hl(),Cs(23,"div",8)(24,"label",20),JC(25,"Run cost threshold"),hl(),Mg(26,"input",21),ZI(),Cs(27,"span",22),JC(28,"Leave empty to inherit the platform default."),hl()(),Cs(29,"div",23)(30,"button",24),JC(31),hl(),Cs(32,"button",25),kg("click",function(){Cf(e);let u=CC();return Tf(u.cancel())}),JC(33,"Cancel"),hl()()();}if(l&2){let e=CC();_g("formGroup",e.form),sI(6),_g("formControl",e.nameControl),QI(),sI(4),_g("formControl",e.descriptionControl),QI(),sI(4),_g("formControl",e.externalIdControl),QI(),sI(4),_g("formControl",e.defaultAgentNameControl),QI(),sI(4),_g("formControl",e.configPathControl),QI(),sI(4),_g("formControl",e.runCostThresholdControl),QI(),sI(4),_g("disabled",e.nameControl.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var q=class l{route=g(V);router=g(G);namespaceController=g(N);destroyRef=g(Ce);form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t("",{nonNullable:true}),configPath:new _t("",{nonNullable:true}),externalId:new _t("",{nonNullable:true}),defaultAgentName:new _t("",{nonNullable:true}),runCostThreshold:new _t(null)});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);existingNamespace=null;ngOnInit(){let r=this.route.snapshot.paramMap.get("namespaceId");r&&(this.isEditMode.set(true),this.loadNamespace(r));}loadNamespace(r){this.isLoading.set(true),this.namespaceController.getByIdNamespace(r).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.nameControl.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let r=z$1(P({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",r):this.namespaceController.createNamespace(r)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=jw({type:l,selectors:[["agentos-namespace-form"]],decls:10,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],["type","button","title","Back to namespaces",1,"namespace-form__back",3,"click"],[1,"namespace-form__back-icon"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-run-cost-threshold",1,"namespace-form__label"],["id","ns-run-cost-threshold","type","number","min","0","step","0.01","placeholder","Optional maximum cost per run (e.g. 0.50)",1,"namespace-form__input",3,"formControl"],[1,"namespace-form__hint"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,p){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return p.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Namespaces "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,U,2,0,"p",5)(9,H,34,9,"form",6),hl()),e&2&&(sI(7),Kg(p.isEditMode()?"Edit namespace":"New namespace"),sI(),cC(p.isLoading()?8:9));},dependencies:[ni,Jn,Ye,fn,Zn,Xn,$t,Cn,En],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{q as NamespaceFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Z as Ze,Y as Ye$1,E as Et$1,y as yt$2}from'./chunk-
|
|
1
|
+
import {Z as Ze,Y as Ye$1,E as Et$1,y as yt$2}from'./chunk-BWZcAdUl.js';import {an as ue,al as vt,g,O as Ot$1,F,r as re,W as Wi,T as TT,R as Re,P,H as c,G,L,U,ap as zy,j as jw,h as hr,i as Gn,bA as bC,o as aC,k as Cs,n as kg,J as JC,m as hl,bB as SC,M as Mg,u as cC,t as sI,w as zg,_ as _g,S as Sg,bk as Dh,a8 as Kg,x as jg,y as MC,N as NC,aL as wo,aM as Zn$1,aO as wt$1,cb as JB,E as N,p as pe,C as Ce,cd as $f,z as z$1,a as P$1,b as U$1,ce as kb,$ as $y,q as dC,v as fC,aw as gl,bo as uC,ax as ml,b6 as Ng,c0 as Rg,ad as $g,a9 as vC,aa as Cf,ac as CC,ab as Tf,ai as rm,aj as iT,a3 as ZI,ak as nm,a6 as QI,af as wg,ag as ET,a5 as Dl,aG as fe,ae as kt$1,cf as _,K as x,A as AC,cg as pT,ch as Ag,b4 as fT}from'./main-K6RKSHKK.js';import {W}from'./chunk-BWLCegs8.js';import {T as Tn$1,c as ce}from'./chunk-CorOD5-V.js';import {u as ui,a as me,f as fi,Y as Yt$1,H as He,V as Ve,n as ne}from'./chunk-BEaYQhbI.js';import {t as ti,Y as Ye,Z as Zn,c as cn$1,y as yt$1,w as wt,X as Xt$1}from'./chunk-BhdMedPO.js';var bt=(()=>{class n{static \u0275fac=function(i){return new(i||n)};static \u0275mod=wo({type:n});static \u0275inj=Zn$1({imports:[wt$1]})}return n})();var Tt=(n,t)=>({subThreads:n,depth:t}),Ot=n=>({subThreads:n,depth:1}),xt=(n,t)=>t.id,kt=(n,t)=>t.label;function Et(n,t){if(n&1){let e=vC();Cs(0,"mat-icon",10),kg("click",function(o){Cf(e);let s=CC().$implicit,f=CC(3);return Tf(f.toggleSubThreads(o,s.id))}),JC(1),hl();}if(n&2){let e=CC().$implicit,i=CC(3);sI(),Kg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Dt(n,t){n&1&&Ag(0);}function Nt(n,t){if(n&1&&wg(0,Dt,1,0,"ng-container",11),n&2){let e=CC().$implicit,i=CC().depth;CC();let o=AC(1);_g("ngTemplateOutlet",o)("ngTemplateOutletContext",pT(2,Tt,e.subThreads,i+1));}}function jt(n,t){if(n&1){let e=vC();Cs(0,"div",5)(1,"a",6),kg("click",function(o){let s=Cf(e).$implicit;return CC(3).selectThread(s.id),Tf(o.preventDefault())})("keydown.enter",function(o){let s=Cf(e).$implicit;return CC(3).selectThread(s.id),Tf(o.preventDefault())})("keydown.space",function(o){let s=Cf(e).$implicit;return CC(3).selectThread(s.id),Tf(o.preventDefault())}),aC(2,Et,2,1,"mat-icon",7),Cs(3,"span",8),JC(4),hl(),Cs(5,"span",9),JC(6),hl()()(),aC(7,Nt,1,5,"ng-container");}if(n&2){let e=t.$implicit,i=CC().depth,o=CC(2);$g("--sub-depth",i),zg("current",e.id===o.currentThread()?.id),sI(2),cC(e.subThreads?.length?2:-1),sI(2),Kg(e.delegatedAgentName||"Agent"),sI(2),Kg(e.delegatedTask||e.name),sI(),cC(o.isParentExpanded(e.id)&&e.subThreads?.length?7:-1);}}function Vt(n,t){if(n&1&&dC(0,jt,8,8,null,null,xt),n&2){let e=t.subThreads;fC(e);}}function Ft(n,t){n&1&&(Cs(0,"div",4),Mg(1,"span",12),Cs(2,"span",13),JC(3,"Loading threads..."),hl()());}function It(n,t){if(n&1&&(Cs(0,"div",27),JC(1),hl()),n&2){let e=CC(6);sI(),Kg(e.renameErrorMessage);}}function zt(n,t){if(n&1){let e=vC();Cs(0,"div",18)(1,"input",26),rm("ngModelChange",function(o){Cf(e);let s=CC(5);return iT(s.editingThreadName,o)||(s.editingThreadName=o),Tf(o)}),kg("keydown",function(o){Cf(e);let s=CC(5);return Tf(s.onEditKeydown(o))})("blur",function(){Cf(e);let o=CC(5);return Tf(o.onEditBlur())})("click",function(o){return o.stopPropagation()}),hl(),ZI(),aC(2,It,2,1,"div",27),hl();}if(n&2){let e=CC(5);sI(),nm("ngModel",e.editingThreadName),_g("disabled",e.isRenamingThread),QI(),sI(),cC(e.renameErrorMessage?2:-1);}}function At(n,t){if(n&1){let e=vC();Cs(0,"mat-icon",10),kg("click",function(o){Cf(e);let s=CC(2).$implicit,f=CC(4);return Tf(f.toggleSubThreads(o,s.id))}),JC(1),hl();}if(n&2){let e=CC(2).$implicit,i=CC(4);sI(),Kg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Lt(n,t){if(n&1&&(Cs(0,"span",29),JC(1),hl()),n&2){let e=CC(2).$implicit;sI(),Kg(e.name);}}function Rt(n,t){n&1&&(Mg(0,"mat-spinner",31),Cs(1,"span",32),JC(2,"Generating name..."),hl()),n&2&&_g("diameter",16);}function $t(n,t){n&1&&(Cs(0,"mat-icon",30),JC(1,"group"),hl());}function Bt(n,t){if(n&1){let e=vC();Cs(0,"a",28),kg("click",function(o){Cf(e);let s=CC().$implicit;return CC(4).selectThread(s.id),Tf(o.preventDefault())})("keydown.enter",function(o){Cf(e);let s=CC().$implicit;return CC(4).selectThread(s.id),Tf(o.preventDefault())})("keydown.space",function(o){Cf(e);let s=CC().$implicit;return CC(4).selectThread(s.id),Tf(o.preventDefault())}),aC(1,At,2,1,"mat-icon",7),aC(2,Lt,2,1,"span",29)(3,Rt,3,1),aC(4,$t,2,0,"mat-icon",30),hl();}if(n&2){let e=CC().$implicit,i=CC(4);_g("matTooltip",e.name?e.name+`
|
|
2
2
|
|
|
3
3
|
`+(e.summary||""):e.summary||"")("matTooltipDisabled",!e.summary),sI(),cC(e.subThreads?.length?1:-1),sI(),cC(e.name?2:3),sI(2),cC(i.isSharedThread(e)?4:-1);}}function Ut(n,t){if(n&1){let e=vC();Cs(0,"button",33),kg("click",function(o){Cf(e);let s=CC().$implicit,f=CC(4);return Tf(f.startEditingThreadName(o,s))}),Cs(1,"mat-icon"),JC(2,"edit"),hl()();}}function Xt(n,t){if(n&1){let e=vC();Cs(0,"button",34),kg("click",function(o){Cf(e);let s=CC().$implicit,f=CC(4);return Tf(f.markActive(o,s))}),Cs(1,"mat-icon"),JC(2,"replay"),hl()();}}function Qt(n,t){if(n&1){let e=vC();Cs(0,"button",35),kg("click",function(o){Cf(e);let s=CC().$implicit,f=CC(4);return Tf(f.markDone(o,s))}),Cs(1,"mat-icon"),JC(2,"check_circle_outline"),hl()();}}function Gt(n,t){n&1&&Ag(0);}function Ht(n,t){if(n&1&&wg(0,Gt,1,0,"ng-container",11),n&2){let e=CC().$implicit;CC(3);let i=AC(1);_g("ngTemplateOutlet",i)("ngTemplateOutletContext",fT(2,Ot,e.subThreads));}}function qt(n,t){if(n&1){let e=vC();Cs(0,"div",17),aC(1,zt,3,3,"div",18)(2,Bt,5,5,"a",19),Cs(3,"div",20),aC(4,Ut,3,0,"button",21),aC(5,Xt,3,0,"button",22)(6,Qt,3,0,"button",23),Cs(7,"button",24),kg("click",function(o){let s=Cf(e).$implicit,f=CC(4);return Tf(f.toggleStar(o,s))}),Cs(8,"mat-icon"),JC(9),hl()(),Cs(10,"button",25),kg("click",function(o){let s=Cf(e).$implicit,f=CC(4);return Tf(f.deleteThread(o,s))}),Cs(11,"mat-icon"),JC(12,"delete"),hl()()()(),aC(13,Ht,1,4,"ng-container");}if(n&2){let e=t.$implicit,i=CC(4);zg("current",e.id===i.currentThread()?.id),sI(),cC(i.editingThreadId===e.id?1:2),sI(3),cC(i.editingThreadId!==e.id&&e.name?4:-1),sI(),cC(e.closedByUser?5:6),sI(2),zg("starred",i.isStarred(e)),_g("title",i.isStarred(e)?"Unstar thread":"Star thread"),sI(2),Kg(i.isStarred(e)?"star":"star_outline"),sI(4),cC(i.isParentExpanded(e.id)&&e.subThreads?.length?13:-1);}}function Wt(n,t){if(n&1&&(Cs(0,"div",14)(1,"div",16),JC(2),hl(),dC(3,qt,14,10,null,null,xt),hl()),n&2){let e=t.$implicit;sI(2),Kg(e.label),sI(),fC(e.threads);}}function Jt(n,t){n&1&&(Cs(0,"div",15),JC(1,"No existing threads"),hl());}function Yt(n,t){if(n&1&&(Cs(0,"div",15),JC(1),hl()),n&2){let e=CC(3);sI(),Dl('No threads matching "',e.searchQuery(),'"');}}function Zt(n,t){if(n&1&&(dC(0,Wt,5,1,"div",14,kt),aC(2,Jt,2,0,"div",15)(3,Yt,2,1,"div",15)),n&2){let e=CC(2);fC(e.getGroupedThreads()),sI(2),cC(!e.threads()?.length&&!e.searchQuery()?2:e.searchQuery()&&e.getGroupedThreads().length===0?3:-1);}}function Kt(n,t){if(n&1&&(wg(0,Vt,2,0,"ng-template",null,0,ET),Cs(2,"div",3),aC(3,Ft,4,0,"div",4)(4,Zt,4,1),hl()),n&2){let e=CC();sI(3),cC(e.isLoadingThreadList()?3:4);}}function en(n,t){n&1&&(Cs(0,"span",36),JC(1,"No project selected"),hl());}function tn(n,t){n&1&&(Cs(0,"span",36),JC(1,"Loading..."),hl());}function nn(n,t){if(n&1&&(Cs(0,"div",2),aC(1,en,2,0,"span",36)(2,tn,2,0,"span",36),hl()),n&2){let e=CC();sI(),cC(e.currentProject()?.name?2:1);}}var we=class n{projects=null;searchMode=false;searchQuery=JB("");searchModeChange=new vt;threadSelected=new vt;projectStateService=g(P);threadStateService=g(U);threadApiService=g(N);userService=g(pe);router=g(G);destroyRef=g(Ce);currentThread=F(this.threadStateService.selectedThread$);currentProject=F(this.projectStateService.selectedProject$);threads=F(this.threadStateService.threadList$);isLoadingThreadList=F(this.threadStateService.isLoadingThreadList$);username=F(this.userService.username$);isTouchDevice="ontouchstart"in window||navigator.maxTouchPoints>0;editingThreadId=null;editingThreadName="";isRenamingThread=false;renameErrorMessage="";expandedParents=new Set;constructor(){$f(()=>{let t=this.currentThread()?.id,e=this.threads();if(!t||!e?.length)return;let i=new Map;for(let s of e)s.parentThreadId&&i.set(s.id,s.parentThreadId);let o=t;for(;o;){let s=i.get(o);s&&this.expandedParents.add(s),o=s;}});}ngOnInit(){this.userService.fetchCurrentUser().subscribe({error:t=>{console.error("[THREAD-SELECTOR] Failed to load current user:",t);}});}selectThread(t){this.threadStateService.selectThread(t),this.threadSelected.emit(),this.router.navigate(["project",this.currentProject()?.name,"thread",t]);}getGroupedThreads(){let t=this.threads();if(!t?.length)return [];let e=new Set(t.map(h=>h.id)),i=t.filter(h=>!h.parentThreadId),o=t.filter(h=>!!h.parentThreadId),s=o.filter(h=>!e.has(h.parentThreadId)),f=o.filter(h=>e.has(h.parentThreadId)),A=new Map;for(let h of f){let O=h.parentThreadId;A.has(O)||A.set(O,[]),A.get(O).push(h);}let J=h=>(A.get(h)||[]).sort((j,I)=>j.modifiedDate>I.modifiedDate?-1:1).map(j=>z$1(P$1({},j),{subThreads:J(j.id)})),L=[...i,...s];if(this.searchQuery()&&this.searchQuery().trim()){let h=this.searchQuery().toLowerCase().trim();L=L.filter(O=>O.name.toLowerCase().includes(h)||O.summary&&O.summary.toLowerCase().includes(h));}if(!L.length)return [];let R=this.username();if(!R)return [];let Ie=L.map(h=>z$1(P$1({},h),{subThreads:J(h.id)})),ze=Ie.filter(h=>h.starring&&h.starring.includes(R)),Mt=Ie.filter(h=>!h.starring||!h.starring.includes(R)),Y=new Map,Ae=new Date;Ae.setHours(0,0,0,0);for(let h of Mt){let O=new Date(h.modifiedDate);O.setHours(0,0,0,0);let j=Ae.getTime()-O.getTime(),I=Math.floor(j/(1e3*60*60*24)),D;I===0?D="Today":I===1?D="Yesterday":I<7?D="This Week":I<30?D="This Month":I<90?D="Last 3 Months":D="Older",Y.has(D)||Y.set(D,[]),Y.get(D).push(h);}let Ee=[];if(ze.length>0){let h=[...ze].sort((O,j)=>O.modifiedDate>j.modifiedDate?-1:1);Ee.push({label:"Starred",threads:h});}return ["Today","Yesterday","This Week","This Month","Last 3 Months","Older"].filter(h=>Y.has(h)).forEach(h=>{Ee.push({label:h,threads:Y.get(h)});}),Ee}isParentExpanded(t){return this.expandedParents.has(t)}toggleSubThreads(t,e){t.stopPropagation(),this.expandedParents.has(e)?this.expandedParents.delete(e):this.expandedParents.add(e);}isSubThread(t){return !!t.parentThreadId}isSharedThread(t){return t.users&&t.users.length>1}isStarred(t){let e=this.username();return !!e&&t.starring&&t.starring.includes(e)}toggleStar(t,e){t.stopPropagation();let i=this.username();if(!i)return;let o=e.starring&&e.starring.includes(i),s=o?this.threadApiService.unstarThread(e.id):this.threadApiService.starThread(e.id);this.threadStateService.updateStarLocal(e.id,!o,i),s.pipe(U$1(this.destroyRef)).subscribe({next:()=>{},error:f=>{console.error("Error toggling star:",f),this.threadStateService.refreshThreadList();}});}markDone(t,e){t.stopPropagation(),this.threadStateService.markDone(e.id);}markActive(t,e){t.stopPropagation(),this.threadStateService.markActive(e.id);}deleteThread(t,e){t.stopPropagation();let i=this.currentProject()?.name;!i||!confirm(`Are you sure you want to delete the thread "${e.name}"?`)||this.threadApiService.deleteThread(e.id).subscribe({next:()=>{this.currentThread()?.id===e.id&&(this.threadStateService.clearSelection(),this.router.navigate(["project",i])),this.threadStateService.refreshThreadList();},error:s=>{console.error("Error deleting thread:",s),alert("Failed to delete thread. Please try again.");}});}formatDate(t){try{let e=new Date(t),o=new Date().getTime()-e.getTime(),s=Math.floor(o/(1e3*60*60*24));return s===0?"Today":s===1?"Yesterday":s<7?`${s} days ago`:e.toLocaleDateString("en-EN",{day:"numeric",month:"short"})}catch(e){return "No date"}}startEditingThreadName(t,e){t.stopPropagation(),this.editingThreadId=e.id,this.editingThreadName=e.name||"",this.renameErrorMessage="",setTimeout(()=>{let i=document.querySelector(".thread-name-input");i&&(i.focus(),i.select());},0);}cancelEditingThreadName(){this.editingThreadId=null,this.editingThreadName="",this.renameErrorMessage="";}saveThreadName(t){if(t&&t.stopPropagation(),!this.editingThreadId)return;let e=this.editingThreadName.trim();if(!e){this.renameErrorMessage="Thread name cannot be empty";return}if(e.length>200){this.renameErrorMessage="Thread name is too long (max 200 characters)";return}let i=this.editingThreadId;this.isRenamingThread=true,this.renameErrorMessage="",this.threadStateService.renameThread(i,e).subscribe({next:()=>{console.log("[THREAD-SELECTOR] Thread renamed successfully"),this.cancelEditingThreadName(),this.isRenamingThread=false;},error:o=>{console.error("[THREAD-SELECTOR] Error renaming thread:",o),this.renameErrorMessage=o.message||"Failed to rename thread",this.isRenamingThread=false;}});}onEditKeydown(t){t.key==="Enter"?(t.preventDefault(),t.stopPropagation(),this.saveThreadName()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.cancelEditingThreadName());}onEditBlur(){setTimeout(()=>{this.editingThreadId&&!this.isRenamingThread&&this.saveThreadName();},200);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-thread-selector"]],inputs:{searchMode:"searchMode",searchQuery:[1,"searchQuery"]},outputs:{searchModeChange:"searchModeChange",threadSelected:"threadSelected"},decls:3,vars:1,consts:[["subThreadTemplate",""],["tabindex","0","role","application","aria-label","Thread selector",1,"thread-selector",3,"click","keydown"],[1,"thread-disabled"],["role","menu","aria-label","Thread selection",1,"thread-list"],[1,"thread-loading"],[1,"thread-item-wrapper","sub-thread"],["role","menuitem","tabindex","0",1,"thread-item","sub-thread-item",3,"click","keydown.enter","keydown.space"],[1,"sub-thread-toggle"],[1,"sub-thread-agent"],[1,"sub-thread-task"],[1,"sub-thread-toggle",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"loading-spinner"],[1,"loading-text"],[1,"thread-group"],[1,"thread-empty"],[1,"thread-group-header"],[1,"thread-item-wrapper"],[1,"thread-name-edit-wrapper"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"matTooltip","matTooltipDisabled"],[1,"action-buttons"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button"],["mat-icon-button","","title","Mark as active","type","button",1,"action-button","mark-active-button"],["mat-icon-button","","title","Mark as done","type","button",1,"action-button","mark-done-button"],["mat-icon-button","","type","button",1,"action-button","star-button",3,"click","title"],["mat-icon-button","","title","Delete thread","type","button",1,"action-button","delete-button",3,"click"],["type","text","maxlength","200",1,"thread-name-input",3,"ngModelChange","keydown","blur","click","ngModel","disabled"],[1,"rename-error"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"click","keydown.enter","keydown.space","matTooltip","matTooltipDisabled"],[1,"thread-name"],["matTooltip","Shared thread",1,"shared-indicator"],[1,"thread-name-spinner",3,"diameter"],[1,"thread-name","thread-name-generating"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button",3,"click"],["mat-icon-button","","title","Mark as active","type","button",1,"action-button","mark-active-button",3,"click"],["mat-icon-button","","title","Mark as done","type","button",1,"action-button","mark-done-button",3,"click"],[1,"disabled-text"]],template:function(e,i){e&1&&(Cs(0,"div",1),kg("click",function(s){return s.stopPropagation()})("keydown",function(s){return s.stopPropagation()}),aC(1,Kt,5,1)(2,nn,3,1,"div",2),hl()),e&2&&(sI(),cC(i.currentProject()?.name?1:2));},dependencies:[kb,ti,Ye,Zn,Xt$1,cn$1,yt$1,wt,hr,Gn,Tn$1,ce,Et$1,yt$2,Ve,ne],styles:[".thread-selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.thread-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:0;max-height:none;overflow:visible}.thread-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:.5rem}.thread-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.thread-group-header[_ngcontent-%COMP%]{padding:.5rem 1rem .25rem;font-size:.75rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.5px;position:sticky;top:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);z-index:1}.thread-item-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;position:relative;width:100%;border-radius:0;min-width:0;gap:.25rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%]{display:flex}.thread-item-wrapper.current[_ngcontent-%COMP%]{background:var(--color-primary-light)}.thread-item-wrapper.current[_ngcontent-%COMP%] .thread-item[_ngcontent-%COMP%]{color:var(--color-primary-text);font-weight:600}.thread-item[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0;padding:.75rem 1rem;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);text-align:left;justify-content:flex-start}.thread-item.new-thread-item[_ngcontent-%COMP%]{margin-bottom:.25rem}.thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.action-buttons[_ngcontent-%COMP%]{display:none;align-items:center;gap:.25rem;flex-shrink:0;margin-right:.5rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%], .thread-item-wrapper.current[_ngcontent-%COMP%] .action-buttons[_ngcontent-%COMP%]{display:flex}.action-button[_ngcontent-%COMP%]{flex-shrink:0;border-radius:4px!important;width:28px!important;height:28px!important;padding:0!important}.action-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{border-radius:4px!important}.action-button[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)!important}.action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%]:hover{background-color:var(--color-primary-hover)!important}.action-button.edit-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.action-button.star-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{transition:color .2s ease}.action-button.star-button.starred[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.star-button[_ngcontent-%COMP%]:not(.starred):hover mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.delete-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#ef4444}.action-button.mark-done-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#22c55e}.action-button.mark-active-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.875rem;font-weight:400;padding:0 1rem;min-width:0}.thread-link[_ngcontent-%COMP%]:hover:not(.new-thread-link){color:var(--color-primary-hover, var(--color-primary));text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.thread-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.thread-link.new-thread-link[_ngcontent-%COMP%]{margin-bottom:.5rem;font-weight:600;font-size:.95rem}.thread-link.new-thread-link[_ngcontent-%COMP%] .thread-name[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0 center}50%{background-position:100% center}to{background-position:0 center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.thread-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}.thread-name.thread-name-generating[_ngcontent-%COMP%]{color:var(--color-text-muted);font-style:italic}.thread-name-edit-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;padding:0 .5rem}.thread-name-input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-bg-secondary);color:var(--color-text-primary);font-size:.9rem;font-family:inherit}.thread-name-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 2px #3b82f61a}.thread-name-input[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.rename-error[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:.25rem;padding-left:.5rem}.thread-name-spinner[_ngcontent-%COMP%]{flex-shrink:0;margin-right:.5rem}.thread-name-spinner[_ngcontent-%COMP%] .mat-mdc-progress-spinner circle{stroke:var(--color-primary)!important}.current-indicator[_ngcontent-%COMP%]{color:var(--color-success);font-weight:700;flex-shrink:0;font-size:1rem}.thread-separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border);margin:.25rem 0}.thread-empty[_ngcontent-%COMP%]{padding:1.5rem 1rem;text-align:center;color:var(--color-text-muted);font-size:.8rem;font-style:italic}.thread-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem 1rem;gap:.75rem}.thread-loading[_ngcontent-%COMP%] .loading-spinner[_ngcontent-%COMP%]{width:24px;height:24px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.thread-loading[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--color-text-muted);font-size:.8rem}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.thread-disabled[_ngcontent-%COMP%]{padding:1.5rem 1rem}.thread-disabled[_ngcontent-%COMP%] .disabled-text[_ngcontent-%COMP%]{display:block;color:var(--color-text-muted);font-size:.85rem;font-style:italic;text-align:center}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%]{padding-left:calc(.2rem + var(--sub-depth, 1) * 1.5rem);border-left:2px solid var(--color-primary, #3b82f6);margin-left:.75rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]{padding:.35rem .5rem .35rem 0;gap:.2rem;font-size:.8rem;color:var(--color-text-secondary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-agent[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary);white-space:nowrap;flex-shrink:0;font-size:.8rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-task[_ngcontent-%COMP%]{color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.75rem}.sub-thread-toggle[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;flex-shrink:0;cursor:pointer;color:var(--color-text-secondary);margin-right:.25rem}.sub-thread-toggle[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.shared-indicator[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;color:var(--color-text-secondary);flex-shrink:0;margin-left:.25rem}@media(max-width:768px){.thread-item[_ngcontent-%COMP%]{padding:.6rem .8rem}.thread-name[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};var on=["logsContent"],rn=(n,t)=>t.name;function an(n,t){if(n&1){let e=vC();Cs(0,"button",12),kg("click",function(){Cf(e);let o=CC().$implicit,s=CC();return Tf(s.start(o.name))}),Cs(1,"mat-icon"),JC(2,"play_arrow"),hl()();}if(n&2){let e=CC().$implicit;_g("disabled",e.isLoading);}}function sn(n,t){if(n&1){let e=vC();Cs(0,"button",13),kg("click",function(){Cf(e);let o=CC().$implicit,s=CC();return Tf(s.stop(o.name))}),Cs(1,"mat-icon"),JC(2,"stop"),hl()();}if(n&2){let e=CC().$implicit;_g("disabled",e.isLoading);}}function cn(n,t){if(n&1&&(Cs(0,"a",8)(1,"mat-icon",14),JC(2,"open_in_new"),hl()()),n&2){let e=CC().$implicit;_g("href",e.url,Dh)("title",e.url);}}function ln(n,t){if(n&1&&(Cs(0,"div",15),JC(1),hl()),n&2){let e=CC(),i=e.$implicit,o=e.$index;$g("order",o*2),sI(),Kg(i.errorMessage);}}function dn(n,t){if(n&1){let e=vC();Cs(0,"button",21),kg("click",function(){Cf(e);let o=CC(3);return Tf(o.onManualRefresh())}),Cs(1,"mat-icon"),JC(2,"refresh"),hl()();}}function mn(n,t){if(n&1&&(Cs(0,"div",16)(1,"div",17)(2,"span",18),JC(3),hl(),aC(4,dn,3,0,"button",19),hl(),Cs(5,"pre",20,0),JC(7),hl()()),n&2){let e=CC(),i=e.$implicit,o=e.$index,s=CC();$g("order",o*2+1),sI(3),Dl("",i.name," logs"),sI(),cC(i.status==="running"?4:-1),sI(3),Kg(s.logs()||"(empty)");}}function pn(n,t){if(n&1){let e=vC();Cs(0,"div",2)(1,"span",3),JC(2),hl(),Cs(3,"div",4),aC(4,an,3,1,"button",5)(5,sn,3,1,"button",6),Cs(6,"span",7),JC(7),hl(),aC(8,cn,3,2,"a",8),Cs(9,"button",9),kg("click",function(){let o=Cf(e).$implicit,s=CC();return Tf(s.toggleLogs(o.name))}),Cs(10,"mat-icon"),JC(11),hl()()()(),aC(12,ln,2,3,"div",10),aC(13,mn,8,5,"div",11);}if(n&2){let e=t.$implicit,i=t.$index,o=CC();$g("order",i*2),sI(2),Kg(e.name),sI(2),cC(e.status==="stopped"?4:5),sI(2),zg("running",e.status==="running"),sI(),Dl(" ",e.status==="running"?"Running":"Stopped"," "),sI(),cC(e.url?8:-1),sI(),_g("title",o.logsOpenFor()===e.name?"Hide logs":"Show logs"),sI(2),Kg(o.logsOpenFor()===e.name?"expand_less":"terminal"),sI(),cC(e.errorMessage?12:-1),sI(),cC(o.logsOpenFor()===e.name?13:-1);}}var Te=class n{destroyRef=g(Ce);projectApi=g(c);projectName=JB.required();entryStates=Wi([]);hasPreview=TT(()=>this.entryStates().length>0);logsOpenFor=Wi(null);logs=Wi("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){$f(()=>{let t=this.projectName();t&&this.onProjectChanged(t);},{}),$f(()=>{console.log("entry states",this.entryStates());});}ngOnDestroy(){this.stopLogPolling();}onProjectChanged(t){this.stopLogPolling(),this.entryStates.set([]),this.logsOpenFor.set(null),this.logs.set(""),this.projectApi.getPreviewEntries(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let i=e.entries;if(i.length===0)return;let o=i.map(f=>({name:f.name,command:f.command,url:f.url,status:"stopped",isLoading:false,errorMessage:""}));this.entryStates.set(o);let s=i.map(f=>this.projectApi.getPreviewStatus(t,f.name));$y(s).pipe(U$1(this.destroyRef)).subscribe({next:f=>{this.entryStates.update(A=>A.map((J,L)=>{let R=f[L];return R?z$1(P$1({},J),{status:R.status}):J}));},error:()=>{}});},error:()=>{}});}start(t){this.updateEntry(t,{isLoading:true,errorMessage:""}),this.projectApi.startPreview(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.updateEntry(t,{status:e.status,isLoading:false});},error:e=>{this.updateEntry(t,{errorMessage:e?.error?.error??"Failed to start preview",isLoading:false});}});}stop(t){this.updateEntry(t,{isLoading:true,errorMessage:""}),this.projectApi.stopPreview(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:()=>{this.updateEntry(t,{status:"stopped",isLoading:false}),this.logsOpenFor()===t&&this.stopLogPolling();},error:e=>{this.updateEntry(t,{errorMessage:e?.error?.error??"Failed to stop preview",isLoading:false});}});}toggleLogs(t){this.logsOpenFor()===t?(this.logsOpenFor.set(null),this.logs.set(""),this.stopLogPolling()):(this.logsOpenFor.set(t),this.refreshLogs(),this.startLogPolling());}onManualRefresh(){this.refreshLogs(),this.logsPollTimer&&this.resetLogsTimeout();}refreshLogs(){let t=this.logsOpenFor();t&&this.projectApi.getPreviewLogs(this.projectName(),t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.logs.set(e.logs),this.scrollLogsToBottom();},error:()=>this.logs.set("(failed to load logs)")});}updateEntry(t,e){this.entryStates.update(i=>i.map(o=>o.name===t?P$1(P$1({},o),e):o));}startLogPolling(){this.stopLogPolling(),this.logsPollTimer=setInterval(()=>{this.logsOpenFor()?this.refreshLogs():this.stopLogPolling();},n.LOGS_POLL_MS),this.resetLogsTimeout();}stopLogPolling(){this.logsPollTimer&&(clearInterval(this.logsPollTimer),this.logsPollTimer=null),this.logsTimeoutTimer&&(clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=null);}resetLogsTimeout(){this.logsTimeoutTimer&&clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=setTimeout(()=>{this.stopLogPolling();},n.LOGS_TIMEOUT_MS);}scrollLogsToBottom(){setTimeout(()=>{let t=this.logsContent?.nativeElement;t&&(t.scrollTop=t.scrollHeight);});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-preview-panel"]],viewQuery:function(e,i){if(e&1&&jg(on,5),e&2){let o;MC(o=NC())&&(i.logsContent=o.first);}},inputs:{projectName:[1,"projectName"]},decls:3,vars:0,consts:[["logsContent",""],[1,"preview-panel"],[1,"entry-row"],[1,"entry-name"],[1,"entry-actions"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"disabled"],[1,"status-pill"],["target","_blank","rel","noopener noreferrer",1,"preview-url",3,"href","title"],["mat-icon-button","","type","button",1,"entry-btn","logs",3,"click","title"],[1,"preview-error",3,"order"],[1,"logs-container",3,"order"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"click","disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"click","disabled"],[1,"link-icon"],[1,"preview-error"],[1,"logs-container"],[1,"logs-header"],[1,"logs-title"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn"],[1,"logs-content"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn",3,"click"]],template:function(e,i){e&1&&(Cs(0,"div",1),dC(1,pn,14,12,null,null,rn),hl()),e&2&&(sI(),fC(i.entryStates()));},dependencies:[hr,Gn,yt$1,wt],styles:["[_nghost-%COMP%]{display:block}.preview-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:.25rem 0}.entry-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;padding:.125rem .5rem;min-height:36px}.entry-name[_ngcontent-%COMP%]{font-size:.82rem;font-weight:500;color:var(--on-surface, #e0e0e0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}.entry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.entry-btn[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;flex-shrink:0}.entry-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px}.entry-btn.start[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.entry-btn.stop[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#e53935}.entry-btn.logs[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px;color:var(--color-text-secondary)}.entry-btn[disabled][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.status-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:12px;font-size:.68rem;font-weight:600;letter-spacing:.02em;flex-shrink:0;min-width:52px;text-align:center;background:var(--color-bg-hover);color:var(--color-text-secondary);border:1px solid var(--color-border)}.status-pill.running[_ngcontent-%COMP%]{background:#22c55e26;color:#16a34a;border-color:#22c55e66}.preview-url[_ngcontent-%COMP%]{display:inline-flex;align-items:center;text-decoration:none;color:var(--color-primary);flex-shrink:0}.preview-url[_ngcontent-%COMP%]:hover{text-decoration:underline}.preview-url[_ngcontent-%COMP%] .link-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.preview-error[_ngcontent-%COMP%]{font-size:.75rem;color:#c00;padding:0 .75rem}.logs-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:.125rem .5rem .25rem;background:var(--color-bg-hover);border-radius:8px;overflow:hidden;border:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.25rem .75rem;border-bottom:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%] .logs-title[_ngcontent-%COMP%]{flex:1;font-size:.72rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.logs-content[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;font-family:Courier New,Courier,monospace;font-size:.72rem;line-height:1.5;color:var(--color-text);white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-text-secondary);border-radius:3px}"],changeDetection:1})};var Oe=class n{eventStream=g(fe);threadState=g(U);ratio=Wi(0);inputTokens=Wi(0);contextWindow=Wi(0);price=Wi(0);iterations=Wi(0);cacheReadTokens=Wi(0);visible=Wi(false);level=TT(()=>{let t=this.ratio();return t<.6?"ok":t<.85?"warning":"danger"});constructor(){this.eventStream.events$.pipe(kt$1(t=>t instanceof _),kt$1(t=>!t.threadId||t.threadId===this.threadState.getSelectedThreadId())).subscribe(t=>{this.inputTokens.set(t.inputTokens),this.contextWindow.set(t.contextWindow),this.price.set(t.price),this.iterations.set(t.iterations),this.cacheReadTokens.set(t.cacheReadTokens),this.ratio.set(t.contextWindow>0?t.inputTokens/t.contextWindow:0),this.visible.set(true);}),this.eventStream.connectionStatus$.pipe(kt$1(t=>!t.connected)).subscribe(()=>{this.visible.set(false),this.ratio.set(0),this.inputTokens.set(0),this.contextWindow.set(0),this.price.set(0),this.iterations.set(0),this.cacheReadTokens.set(0);});}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};function gn(n,t){if(n&1&&Ng(0,"div",12),n&2){let e=t.$implicit,i=t.$index,o=CC();$g("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px")("--rise",e.rise+"px"),zg("invisible",i>=o.aboveBubbleCount());}}function _n(n,t){if(n&1&&Ng(0,"div",13),n&2){let e=t.$implicit;$g("--delay",e.delay+"s")("--size",e.size+"px")("--left",e.left+"%")("--dur",e.dur+"s")("--top",e.top+"px");}}function un(n,t){if(n&1&&Ng(0,"div",14),n&2){let e=t.$implicit,i=t.$index,o=CC();$g("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px"),zg("invisible",i>=o.insideBubbleCount());}}var yt=30,Pt=27,hn=40;function T(n,t,e,i=0){return i+(n*137+t*31)%e}var ke=class n{gaugeState=g(Oe);sidenavOpen=JB(false);aboveBubbles=Array.from({length:yt},(t,e)=>({delay:T(e,1,30)/10,left:T(e,2,82,5),dur:2.5+T(e,3,20)/10,size:1.5+T(e,4,40)/10,rise:150+T(e,5,150)}));insideBubbles=Array.from({length:Pt},(t,e)=>({delay:T(e,6,20)/10,left:T(e,7,80,5),dur:1.2+T(e,8,15)/10,size:2+T(e,9,35)/10}));foamBubbles=Array.from({length:hn},(t,e)=>({delay:T(e,10,25)/10,left:T(e,11,85,3),dur:1.5+T(e,12,10)/10,size:(3+T(e,13,80)/10)*.75,top:T(e,14,4)+8}));displayRatio=TT(()=>Math.min(100,this.gaugeState.ratio()*100));liquidColor=TT(()=>{let t=this.gaugeState.ratio();return t<=.5?`rgb(${Math.round(t*2*255)}, 255, 0)`:`rgb(255, ${Math.round((1-(t-.5)*2)*255)}, 0)`});aboveBubbleCount=TT(()=>Math.round(this.gaugeState.ratio()*yt));insideBubbleCount=TT(()=>{let t=this.gaugeState.ratio();return t<.5?0:t<.65?5:t<.8?13:t<.9?20:Pt});foamActive=TT(()=>this.gaugeState.ratio()>=.5);overflowing=TT(()=>this.gaugeState.ratio()>=.9);tooltipText=TT(()=>{let t=Math.round(this.gaugeState.ratio()*100),e=this.gaugeState.price().toFixed(4);return [`${this.gaugeState.inputTokens().toLocaleString()} / ${this.gaugeState.contextWindow().toLocaleString()} tokens (${t}%)`,`Cost: $${e}`,`Iterations: ${this.gaugeState.iterations()}`,`Cache read: ${this.gaugeState.cacheReadTokens().toLocaleString()}`].join(`
|
|
4
4
|
`)});static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-context-gauge"]],inputs:{sidenavOpen:[1,"sidenavOpen"]},decls:15,vars:11,consts:[[1,"tube-host",3,"title"],[1,"tube"],[1,"bubbles-above"],[1,"bubble-color",3,"invisible","--delay","--left","--dur","--size","--rise"],[1,"foam"],[1,"foam-bubble",3,"--delay","--size","--left","--dur","--top"],[1,"body"],[1,"shine"],[1,"liquid"],[1,"percentage"],[1,"bubbles-inside"],[1,"bubble-dark",3,"invisible","--delay","--left","--dur","--size"],[1,"bubble-color"],[1,"foam-bubble"],[1,"bubble-dark"]],template:function(e,i){e&1&&(gl(0,"div",0)(1,"div",1)(2,"div",2),dC(3,gn,1,12,"div",3,uC),ml(),gl(5,"div",4),dC(6,_n,1,10,"div",5,uC),ml(),gl(8,"div",6),Ng(9,"div",7),gl(10,"div",8)(11,"div",9)(12,"div",10),dC(13,un,1,10,"div",11,uC),ml()()()()()()),e&2&&(zg("hidden",i.sidenavOpen()),Rg("title",i.tooltipText()),sI(),$g("--tube-color",i.liquidColor()),sI(2),fC(i.aboveBubbles),sI(2),$g("bottom",i.displayRatio()+"%"),zg("active",i.foamActive()),sI(),fC(i.foamBubbles),sI(5),$g("height",i.displayRatio(),"%"),sI(2),fC(i.insideBubbles));},styles:['[_nghost-%COMP%]{position:fixed;left:calc(1rem + 10px);z-index:1500;display:block;top:calc(3.5rem + 80px);--gauge-glass: #dddddd}[data-theme$=dark][_nghost-%COMP%], [data-theme$=dark] [_nghost-%COMP%]{--gauge-glass: #333333}.tube-host[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;align-items:center}.tube-host.hidden[_ngcontent-%COMP%]{visibility:hidden}.tube[_ngcontent-%COMP%]{position:relative;height:100px;width:24px;border:none;border-radius:0 0 50rem 50rem;background-color:var(--gauge-glass, #333333);cursor:default;overflow:visible}.tube[_ngcontent-%COMP%]:after{content:"";position:absolute;left:-3px;top:0;width:calc(100% + 6px);height:4px;border-radius:50rem;background:var(--gauge-glass, #333333)}.body[_ngcontent-%COMP%]{position:absolute;border-radius:inherit;height:100%;width:100%;bottom:0;overflow:hidden;z-index:5}.shine[_ngcontent-%COMP%]{position:absolute;left:20%;top:0;width:10%;height:100%;z-index:90;opacity:.2;pointer-events:none}.shine[_ngcontent-%COMP%]:before, .shine[_ngcontent-%COMP%]:after{content:"";position:absolute;background-color:#fff;border-radius:50rem;top:10%;height:40%;width:100%}.shine[_ngcontent-%COMP%]:after{height:15%;top:60%}@keyframes _ngcontent-%COMP%_liquid-spin{0%{transform:translate(-50%) rotate(0)}to{transform:translate(-50%) rotate(360deg)}}.liquid[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;bottom:0}.percentage[_ngcontent-%COMP%]{position:absolute;height:0%;width:100%;bottom:0;left:0;z-index:80;transition:height .9s cubic-bezier(.4,0,.2,1);overflow:visible}.percentage[_ngcontent-%COMP%]:before, .percentage[_ngcontent-%COMP%]:after{position:absolute;content:"";width:100px;height:100px;border-radius:40px;animation:_ngcontent-%COMP%_liquid-spin 4s infinite linear;transform:translate(-50%);left:50%;top:0;background:var(--tube-color, #34c759);transition:background .5s ease}.percentage[_ngcontent-%COMP%]:after{opacity:.4;animation-direction:reverse;border-radius:30px}@keyframes _ngcontent-%COMP%_bubble-rise-inside{0%{bottom:2%;opacity:0;transform:scale(.5)}15%{opacity:.7}85%{opacity:.4}to{bottom:96%;opacity:0;transform:scale(1.1)}}.bubbles-inside[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;width:100%;height:100%;z-index:10;pointer-events:none}.bubbles-inside[_ngcontent-%COMP%] .bubble-dark[_ngcontent-%COMP%]{position:absolute;border-radius:50%;background:var(--color-bg, rgba(20, 20, 20, .55));width:var(--size, 3px);height:var(--size, 3px);opacity:0;bottom:2%;left:var(--left, 30%);animation:_ngcontent-%COMP%_bubble-rise-inside var(--dur, 1.5s) infinite ease-in;animation-delay:var(--delay, 0s)}.bubbles-inside[_ngcontent-%COMP%] .bubble-dark.invisible[_ngcontent-%COMP%]{animation:none;opacity:0}@keyframes _ngcontent-%COMP%_bubble-rise-above{0%{bottom:0;opacity:0;transform:scale(.4)}10%{opacity:.9}70%{opacity:.8}90%{opacity:.3}to{bottom:var(--rise, 80px);opacity:0;transform:scale(1.2)}}.bubbles-above[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;width:100%;height:100%;z-index:20;pointer-events:none;overflow:visible}.bubbles-above[_ngcontent-%COMP%] .bubble-color[_ngcontent-%COMP%]{position:absolute;border-radius:50%;background:var(--tube-color, #34c759);opacity:0;bottom:0;left:var(--left, 30%);width:var(--size, 3px);height:var(--size, 3px);animation:_ngcontent-%COMP%_bubble-rise-above var(--dur, 1.5s) infinite ease-in;animation-delay:var(--delay, 0s)}.bubbles-above[_ngcontent-%COMP%] .bubble-color.invisible[_ngcontent-%COMP%]{animation:none;opacity:0}.foam[_ngcontent-%COMP%]{position:absolute;bottom:0;left:-1px;width:100%;height:14px;z-index:100;pointer-events:none;overflow:visible;transition:bottom .9s cubic-bezier(.4,0,.2,1)}.foam[_ngcontent-%COMP%] .foam-bubble[_ngcontent-%COMP%]{position:absolute;top:var(--top, 0px);left:var(--left, 50%);width:var(--size, 4px);height:var(--size, 4px);border-radius:50%;background:#fff0;animation:none}.foam.active[_ngcontent-%COMP%] .foam-bubble[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_foam-pulse var(--dur, 1.5s) ease-in-out infinite;animation-delay:var(--delay, 0s)}@keyframes _ngcontent-%COMP%_foam-pulse{0%{background:#fff0;transform:scale(.5)}30%{background:#ffffff73;transform:scale(1)}60%{background:#ffffff40;transform:scale(1.1)}to{background:#fff0;transform:scale(.6)}}@media(max-width:768px){[_nghost-%COMP%]{top:calc(3.25rem + 80px);left:calc(.75rem + 10px)}.tube[_ngcontent-%COMP%]{height:75px;width:20px}}']})};var fn=["threadSearchInput"],bn=["*"];function vn(n,t){if(n&1){let e=vC();Cs(0,"button",28),kg("click",function(){Cf(e);let o=CC();return Tf(o.toggle())}),Cs(1,"mat-icon"),JC(2,"menu"),hl()(),Cs(3,"button",29),kg("click",function(){Cf(e);let o=CC();return Tf(o.createNewThread())}),Cs(4,"mat-icon",10),JC(5,"play_circle"),hl()();}if(n&2){let e=CC();sI(3),_g("disabled",!e.selectedProjectName());}}function Cn(n,t){if(n&1){let e=vC();Cs(0,"div",12)(1,"a",30),kg("click",function(o){return Cf(e),CC().openMissionControl(),Tf(o.preventDefault())}),Cs(2,"mat-icon"),JC(3,"rocket_launch"),hl(),Cs(4,"span",31),JC(5,"Task Control"),hl()()();}}function xn(n,t){if(n&1){let e=vC();Cs(0,"div",15)(1,"mat-icon",32),JC(2,"search"),hl(),Cs(3,"input",33,0),rm("ngModelChange",function(o){Cf(e);let s=CC();return iT(s.threadSearchQuery,o)||(s.threadSearchQuery=o),Tf(o)}),kg("input",function(){Cf(e);let o=CC();return Tf(o.onThreadSearchInput())}),hl(),ZI(),Cs(5,"button",34),kg("click",function(){Cf(e);let o=CC();return Tf(o.closeThreadSearch())}),Cs(6,"mat-icon"),JC(7,"close"),hl()()();}if(n&2){let e=CC();sI(3),nm("ngModel",e.threadSearchQuery),QI();}}function yn(n,t){if(n&1){let e=vC();Cs(0,"div",16)(1,"mat-icon",23),JC(2,"forum"),hl(),Cs(3,"span",24),JC(4,"Threads"),hl(),Cs(5,"button",35),kg("click",function(o){Cf(e);let s=CC();return Tf(s.toggleThreadSearch(o))}),Cs(6,"mat-icon"),JC(7,"search"),hl()()();}}function Pn(n,t){n&1&&(Cs(0,"mat-icon",22),JC(1,"keyboard_arrow_up"),hl());}function Sn(n,t){n&1&&(Cs(0,"mat-icon",23),JC(1,"hub"),hl());}function Mn(n,t){n&1&&(Cs(0,"mat-icon",22),JC(1,"keyboard_arrow_up"),hl());}function wn(n,t){n&1&&(Cs(0,"mat-icon",23),JC(1,"tune"),hl());}function Tn(n,t){n&1&&(Cs(0,"div",37)(1,"div",41),Mg(2,"app-options-panel",42),hl()());}function On(n,t){if(n&1){let e=vC();Cs(0,"div",36)(1,"a",21),kg("click",function(o){return Cf(e),CC(3).openProjectConfig(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(2,"mat-icon",23),JC(3,"settings_applications"),hl(),Cs(4,"span",24),JC(5,"Project Configuration"),hl()()();}}function kn(n,t){n&1&&(Cs(0,"div",36)(1,"a",43)(2,"mat-icon",23),JC(3,"settings_applications"),hl(),Cs(4,"span",24),JC(5,"Project config (No project)"),hl()()());}function En(n,t){if(n&1&&aC(0,On,6,0,"div",36)(1,kn,6,0,"div",36),n&2){let e=CC(2);cC(e.selectedProjectName()?0:1);}}function Dn(n,t){if(n&1){let e=vC();Cs(0,"div",36)(1,"a",21),kg("click",function(o){return Cf(e),CC(2).openAgents(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(2,"mat-icon",23),JC(3,"smart_toy"),hl(),Cs(4,"span",24),JC(5,"Agents"),hl()()();}}function Nn(n,t){n&1&&(Cs(0,"div",36)(1,"a",43)(2,"mat-icon",23),JC(3,"smart_toy"),hl(),Cs(4,"span",24),JC(5,"Agents (No project)"),hl()()());}function jn(n,t){if(n&1){let e=vC();Cs(0,"div",36)(1,"a",21),kg("click",function(o){return Cf(e),CC(2).openPrompts(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(2,"mat-icon",23),JC(3,"description"),hl(),Cs(4,"span",24),JC(5,"Prompts"),hl()()();}}function Vn(n,t){n&1&&(Cs(0,"div",36)(1,"a",43)(2,"mat-icon",23),JC(3,"description"),hl(),Cs(4,"span",24),JC(5,"Prompts (No project)"),hl()()());}function Fn(n,t){if(n&1){let e=vC();Cs(0,"div",36)(1,"a",21),kg("click",function(o){return Cf(e),CC(2).openSchedulers(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(2,"mat-icon",23),JC(3,"schedule"),hl(),Cs(4,"span",24),JC(5,"Schedulers"),hl()()();}}function In(n,t){n&1&&(Cs(0,"div",36)(1,"a",43)(2,"mat-icon",23),JC(3,"schedule"),hl(),Cs(4,"span",24),JC(5,"Schedulers (No project)"),hl()()());}function zn(n,t){n&1&&(Cs(0,"mat-icon",22),JC(1,"keyboard_arrow_up"),hl());}function An(n,t){n&1&&(Cs(0,"mat-icon",23),JC(1,"rocket_launch"),hl());}function Ln(n,t){if(n&1&&(Cs(0,"div",37),Mg(1,"app-preview-panel",44),hl()),n&2){let e=CC(3);sI(),_g("projectName",e.selectedProjectName());}}function Rn(n,t){if(n&1){let e=vC();Cs(0,"div",36)(1,"a",21),kg("click",function(o){return Cf(e),CC(2).toggleSection("preview"),o.preventDefault(),Tf(o.stopPropagation())}),aC(2,zn,2,0,"mat-icon",22)(3,An,2,0,"mat-icon",23),Cs(4,"span",24),JC(5,"Preview Server"),hl()(),aC(6,Ln,2,1,"div",37),hl();}if(n&2){let e=CC(2);zg("expanded",e.expandedSections.preview),sI(),zg("active",e.expandedSections.preview),sI(),cC(e.expandedSections.preview?2:3),sI(4),cC(e.expandedSections.preview?6:-1);}}function $n(n,t){if(n&1){let e=vC();Cs(0,"div",25)(1,"div",36)(2,"a",21),kg("click",function(o){return Cf(e),CC().toggleSection("config"),Tf(o.preventDefault())}),aC(3,Mn,2,0,"mat-icon",22)(4,wn,2,0,"mat-icon",23),Cs(5,"span",24),JC(6,"Preferences"),hl()(),aC(7,Tn,3,0,"div",37),hl(),Cs(8,"div",36)(9,"a",21),kg("click",function(o){return Cf(e),CC().openTokenUsage(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(10,"mat-icon",23),JC(11,"data_usage"),hl(),Cs(12,"span",24),JC(13,"Token Usage"),hl()()(),Cs(14,"div",36)(15,"a",21),kg("click",function(o){return Cf(e),CC().openUserConfig(),o.preventDefault(),Tf(o.stopPropagation())}),Cs(16,"mat-icon",23),JC(17,"manage_accounts"),hl(),Cs(18,"span",24),JC(19,"User Configuration"),hl()()(),aC(20,En,2,1),aC(21,Dn,6,0,"div",36)(22,Nn,6,0,"div",36),aC(23,jn,6,0,"div",36)(24,Vn,6,0,"div",36),aC(25,Fn,6,0,"div",36)(26,In,6,0,"div",36),aC(27,Rn,7,6,"div",38),Cs(28,"div",36)(29,"a",39),Mg(30,"img",40),Cs(31,"span",24),JC(32,"Contribute on GitHub"),hl()()()();}if(n&2){let e=CC();sI(),zg("expanded",e.expandedSections.config),sI(),zg("active",e.expandedSections.config),sI(),cC(e.expandedSections.config?3:4),sI(4),cC(e.expandedSections.config?7:-1),sI(13),cC(e.isAdmin?20:-1),sI(),cC(e.selectedProjectName()?21:22),sI(2),cC(e.selectedProjectName()?23:24),sI(2),cC(e.selectedProjectName()?25:26),sI(2),cC(e.hasPreviewConfig()?27:-1),sI(3),Sg("src","CODAY-Logo.png",Dh);}}function Bn(n,t){if(n&1){let e=vC();Cs(0,"div",27)(1,"mat-icon",45),JC(2,"warning"),hl(),Cs(3,"span",46),JC(4),hl(),Cs(5,"button",47),kg("click",function(){Cf(e);let o=CC();return Tf(o.configErrorMessage="")}),Cs(6,"mat-icon"),JC(7,"close"),hl()()();}if(n&2){let e=CC();sI(4),Kg(e.configErrorMessage);}}var St=class n{destroy$=new ue;sidenavStateChange=new vt;drawerOpen=false;breakpointObserver=g(Ot$1);isDesktop=F(this.breakpointObserver.observe("(min-width: 1400px)").pipe(re(t=>t.matches)),{initialValue:false});userOpenPreference=Wi(true);isOpen=TT(()=>this.userOpenPreference());isAdmin=false;configErrorMessage="";expandedSections={config:false,preview:false,settings:false};isThreadSearchActive=false;threadSearchQuery="";threadSearchInput;dialog=g(Re);configApi=g(W);projectStateService=g(P);projectApi=g(c);router=g(G);preferences=g(L);threadStateService=g(U);projects=F(this.projectStateService.projectList$);selectedProject=F(this.projectStateService.selectedProject$);selectedProjectName=F(this.projectStateService.selectedProject$.pipe(re(t=>t?.name)));isProjectVolatile=F(this.projectStateService.selectedProject$.pipe(re(t=>t?.config?.volatile||false)));forcedProject=F(this.projectStateService.forcedProject$);hasPreviewConfig=F(this.projectStateService.selectedProject$.pipe(re(t=>{let e=t?.config?.preview;return Array.isArray(e)&&!!e.length})),{initialValue:false});ngOnInit(){let t=window.innerWidth>=1024,e=this.preferences.getPreference("sidenavOpen",t);this.userOpenPreference.set(e??t),this.configApi.getUserConfig().pipe(zy(this.destroy$)).subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false,console.log("[SIDENAV] User admin status:",this.isAdmin);},error:i=>{console.error("[SIDENAV] Error loading user config for roles:",i),this.isAdmin=false;}});}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}toggle(){let t=!this.userOpenPreference();this.userOpenPreference.set(t),this.saveSidenavState(t),this.sidenavStateChange.emit(t);}close(){this.userOpenPreference()&&(this.userOpenPreference.set(false),this.saveSidenavState(false),this.sidenavStateChange.emit(false));}saveSidenavState(t){this.preferences.setPreference("sidenavOpen",t);}openTokenUsage(){this.configErrorMessage="",this.router.navigate(["/token-usage"]);}openUserConfig(){console.log("[SIDENAV] openUserConfig called"),this.configErrorMessage="",this.configApi.getUserConfig().pipe(zy(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(Ze,{data:{configType:"user",initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(i=>{i&&this.saveUserConfig(i);});},error:t=>{console.error("[SIDENAV] Error loading user config:",t),this.configErrorMessage=t?.error?.error||"Failed to load user configuration";}});}saveUserConfig(t){this.configApi.updateUserConfig(t).pipe(zy(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] User config saved successfully");},error:e=>{console.error("[SIDENAV] Error saving user config:",e),this.configErrorMessage=e?.error?.error||"Failed to save user configuration";}});}openProjectConfig(){let t=this.selectedProjectName();if(!t){console.error("[SIDENAV] No project selected"),this.configErrorMessage="No project selected. Please select a project first.";return}this.configErrorMessage="",this.projectApi.getProjectConfig(t).pipe(zy(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(Ze,{data:{configType:"project",projectName:t,initialContent:JSON.stringify(e,null,2)}}).afterClosed().subscribe(o=>{o&&this.saveProjectConfig(t,o);});},error:e=>{console.error("[SIDENAV] Error loading project config:",e),this.configErrorMessage=e?.error?.error||"Failed to load project configuration";}});}saveProjectConfig(t,e){this.projectApi.updateProjectConfig(t,e).pipe(zy(this.destroy$)).subscribe({next:i=>{console.log("[SIDENAV] Project config saved successfully");},error:i=>{console.error("[SIDENAV] Error saving project config:",i),this.configErrorMessage=i?.error?.error||"Failed to save project configuration";}});}requireProjectSelection(t){return this.selectedProjectName()?true:(console.error(`[SIDENAV] No project selected, cannot ${t}`),this.configErrorMessage="Please select a project first",false)}openAgents(){if(!this.requireProjectSelection("open agents"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"agents"]);}openPrompts(){if(!this.requireProjectSelection("open prompts"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"prompts"]);}openSchedulers(){if(!this.requireProjectSelection("open schedulers"))return;let t=this.selectedProjectName();this.router.navigate(["project",t,"schedulers"]);}toggleSection(t){let e=this.expandedSections[t];t==="settings"?this.expandedSections[t]=!e:(["config","preview"].forEach(o=>{this.expandedSections[o]=false;}),this.expandedSections[t]=!e);}navigateToHome(){console.log("[SIDENAV] Navigating to home (project selection)"),this.projectStateService.clearSelection(),this.router.navigate(["/"]);}openMissionControl(){let t=this.selectedProjectName();t&&(this.router.navigate(["project",t,"tasks"]),this.close());}createNewThread(){let t=this.selectedProjectName();if(!t){console.error("[SIDENAV] No project selected, cannot create new thread"),this.configErrorMessage="Please select a project first";return}console.log("[SIDENAV] Navigating to welcome view for new thread"),this.threadStateService.clearSelection(),this.router.navigate(["project",t]);}onThreadSelectedOnMobile(){this.isDesktop()||this.close();}toggleThreadSearch(t){t.stopPropagation(),this.isThreadSearchActive=true,this.threadSearchQuery="",setTimeout(()=>{this.threadSearchInput?.nativeElement.focus();},0);}closeThreadSearch(){this.isThreadSearchActive=false,this.threadSearchQuery="";}onThreadSearchInput(){}onThreadSearchModeChange(t){t||this.closeThreadSearch();}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["app-sidenav"]],viewQuery:function(e,i){if(e&1&&jg(fn,5),e&2){let o;MC(o=NC())&&(i.threadSearchInput=o.first);}},inputs:{drawerOpen:"drawerOpen"},outputs:{sidenavStateChange:"sidenavStateChange"},ngContentSelectors:bn,decls:36,vars:24,consts:[["threadSearchInput",""],[1,"sidenav-container",3,"hasBackdrop"],["mode","push","position","start",1,"app-sidenav",3,"closed","opened","disableClose"],[1,"sidenav-header"],["mat-icon-button","","title","Close menu",3,"click"],["alt","coday","title","Go to project selection","role","button","tabindex","0",1,"sidenav-logo","clickable",3,"click","keydown.enter","keydown.space"],[1,"header-title-section"],[1,"sidenav-title"],[1,"new-thread-section"],["role","button","tabindex","0",1,"new-thread-link",3,"click"],["fontSet","material-icons-outlined"],[1,"new-thread-text"],[1,"mission-control-section"],[1,"sidenav-sections"],[1,"section-container","expanded"],[1,"search-header"],[1,"section-toggle","active","threads-header"],[1,"section-content","threads"],[1,"sidenav-thread-selector",3,"searchModeChange","threadSelected","searchMode","searchQuery"],[1,"sidenav-nav"],[1,"section-container","settings-group"],["role","button","tabindex","0",1,"section-toggle",3,"click"],[1,"arrow-icon","expanded"],[1,"section-icon"],[1,"section-label"],[1,"section-content","settings-content"],[3,"sidenavOpen"],["role","alert",1,"error-notification"],["mat-icon-button","","title","Menu","type","button",1,"sidenav-toggle-btn",3,"click"],["mat-icon-button","","title","Start a new thread","type","button",1,"sidenav-new-thread-btn",3,"click","disabled"],["role","button","tabindex","0",1,"mission-control-link",3,"click"],[1,"mission-control-text"],[1,"search-icon"],["type","text","placeholder","Search threads...",1,"search-input",3,"ngModelChange","input","ngModel"],["mat-icon-button","","title","Close search","type","button",1,"close-search-btn",3,"click"],["mat-icon-button","","title","Search threads","type","button",1,"search-button",3,"click"],[1,"section-container"],[1,"section-content"],[1,"section-container",3,"expanded"],["href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer","title","Contribute on GitHub",1,"section-toggle","contribute-btn"],["alt","Coday",1,"contribute-logo"],[1,"preference-item"],[1,"inline-panel"],["role","button","tabindex","-1","aria-disabled","true",1,"section-toggle","disabled"],[3,"projectName"],[1,"error-icon"],[1,"error-text"],["mat-icon-button","","aria-label","Close error message",1,"error-close",3,"click"]],template:function(e,i){e&1&&(bC(),aC(0,vn,6,1),Cs(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),kg("closed",function(){return i.close()}),Cs(3,"div",3)(4,"button",4),kg("click",function(){return i.close()}),Cs(5,"mat-icon"),JC(6,"chevron_left"),hl()(),Cs(7,"img",5),kg("click",function(s){return i.navigateToHome(),s.stopPropagation()})("keydown.enter",function(s){return i.navigateToHome(),s.preventDefault(),s.stopPropagation()})("keydown.space",function(s){return i.navigateToHome(),s.preventDefault(),s.stopPropagation()}),hl(),Cs(8,"div",6)(9,"h2",7),JC(10),hl()()(),Cs(11,"div",8)(12,"a",9),kg("click",function(s){return i.createNewThread(),s.preventDefault()}),Cs(13,"mat-icon",10),JC(14,"play_circle"),hl(),Cs(15,"span",11),JC(16,"Start a new thread"),hl()()(),aC(17,Cn,6,0,"div",12),Cs(18,"div",13)(19,"div",14),aC(20,xn,8,1,"div",15)(21,yn,8,0,"div",16),Cs(22,"div",17)(23,"app-thread-selector",18),kg("searchModeChange",function(s){return i.onThreadSearchModeChange(s)})("threadSelected",function(){return i.onThreadSelectedOnMobile()}),hl()()()(),Cs(24,"div",19)(25,"div",20)(26,"a",21),kg("click",function(s){return i.toggleSection("settings"),s.preventDefault()}),aC(27,Pn,2,0,"mat-icon",22)(28,Sn,2,0,"mat-icon",23),Cs(29,"span",24),JC(30,"Control Center"),hl()(),aC(31,$n,33,12,"div",25),hl()()(),Cs(32,"mat-sidenav-content"),SC(33),hl()(),Mg(34,"app-context-gauge",26),aC(35,Bn,8,1,"div",27)),e&2&&(cC(!i.isOpen()&&!i.drawerOpen?0:-1),sI(),zg("sidenav-open",i.isOpen()),_g("hasBackdrop",false),sI(),_g("opened",i.isOpen())("disableClose",true),sI(5),Sg("src","CODAY-Logo.png",Dh),sI(3),Kg(i.selectedProjectName()),sI(7),cC(i.selectedProjectName()?17:-1),sI(3),cC(i.isThreadSearchActive?20:21),sI(3),_g("searchMode",i.isThreadSearchActive)("searchQuery",i.threadSearchQuery),sI(),zg("is-admin",i.isAdmin),sI(),zg("expanded",i.expandedSections.settings),sI(),zg("active",i.expandedSections.settings),sI(),cC(i.expandedSections.settings?27:28),sI(4),cC(i.expandedSections.settings?31:-1),sI(),zg("sidenav-closed-offset",!i.isOpen()),sI(2),_g("sidenavOpen",i.isOpen()),sI(),cC(i.configErrorMessage?35:-1));},dependencies:[ti,Ye,Zn,cn$1,ui,me,fi,Yt$1,yt$1,wt,hr,Gn,He,bt,Ye$1,we,Te,ke],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.sidenav-container[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;height:100dvh;z-index:1400;transition:width;display:flex}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{position:relative!important;transition:width;width:25%;min-width:320px;height:100dvh!important;flex-shrink:0}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]:not(.mat-drawer-opened){width:0!important;min-width:0;overflow:hidden!important;visibility:hidden!important}.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{width:100%;margin:0!important}@media(min-width:1024px){.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{min-width:0}}[_nghost-%COMP%] .mat-drawer-backdrop{pointer-events:auto}[_nghost-%COMP%] .mat-drawer-content{pointer-events:auto!important;background:transparent!important;overflow:visible!important}[_nghost-%COMP%] .mat-drawer-inner-container{overflow:hidden!important;height:100dvh!important;display:flex!important;flex-direction:column!important}.sidenav-new-thread-btn[_ngcontent-%COMP%], .sidenav-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;z-index:1500!important;width:40px!important;height:40px!important;border-radius:50%!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;border:1px solid var(--glass-border)!important;box-shadow:var(--glass-shadow)!important}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:1rem!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.5rem + 40px)!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]:disabled{opacity:.5!important}.sidenav-logo-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:1rem!important;left:1rem!important;z-index:1500!important;width:56px!important;height:56px!important;border-radius:50%!important;border:1px solid var(--glass-border)!important;padding:4px!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;box-shadow:var(--glass-shadow)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;cursor:pointer!important;pointer-events:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;text-decoration:none!important}.sidenav-logo-btn[_ngcontent-%COMP%]:hover{transform:scale(1.08) translateY(-2px)!important;box-shadow:0 16px 48px #0003!important;border-color:var(--color-primary)!important}.sidenav-logo-btn[_ngcontent-%COMP%]:active{transform:scale(.96)!important}.sidenav-logo-btn[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:2px}.app-sidenav[_ngcontent-%COMP%]{width:480px;height:100dvh!important;min-height:0!important;position:relative;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);overflow:hidden!important;display:flex;flex-direction:column}.sidenav-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1.5rem 1rem .5rem;flex-shrink:0}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:4px;flex-shrink:0;transition:all .2s ease}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]{cursor:pointer}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:hover{transform:scale(1.1);filter:drop-shadow(0 4px 12px rgba(0,0,0,.15))}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:active{transform:scale(.95)}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;min-width:0}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%] .sidenav-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mission-control-section[_ngcontent-%COMP%]{padding:.25rem 1rem .5rem;flex-shrink:0}.mission-control-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;font-size:.875rem;font-weight:500;color:var(--color-text-secondary);padding:0}.mission-control-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-text-secondary);transition:color .2s ease}.mission-control-link[_ngcontent-%COMP%]:hover{color:var(--color-primary);transform:translate(3px)}.mission-control-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.mission-control-link[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px;border-radius:4px}.new-thread-section[_ngcontent-%COMP%]{padding:1rem 1rem .5rem;flex-shrink:0}.new-thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.95rem;font-weight:600;padding:0}.new-thread-link[_ngcontent-%COMP%] .new-thread-text[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:focus{transform:scale(1.1)}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.sidenav-sections[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:100px;overflow:hidden}.sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container.expanded[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%] > app-thread-selector[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;flex:1!important;min-height:0!important;overflow:hidden!important}.sidenav-nav[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;overflow:hidden;max-height:70%;border-top:1px solid var(--color-border)}.sidenav-nav[_ngcontent-%COMP%] > .settings-group[_ngcontent-%COMP%] > .section-toggle.active[_ngcontent-%COMP%]{border-top:none}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-toggle[_ngcontent-%COMP%]{flex-shrink:0}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{padding:0;border-bottom:1px solid var(--color-border);overflow:visible}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%] .section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{max-height:40vh;overflow-y:auto;overflow-x:hidden}.contribute-btn[_ngcontent-%COMP%] .contribute-logo[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:2px;flex-shrink:0}.section-container[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{border-bottom:none}.section-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;width:100%;padding:.5rem 1rem;height:50px;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);flex-shrink:0}.section-toggle.active[_ngcontent-%COMP%]{border-top:1px solid var(--color-border)}.section-toggle.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.section-toggle[_ngcontent-%COMP%] .arrow-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);transition:transform .2s ease;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{flex:1;font-size:.9rem;color:var(--color-text);text-align:left}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%]{margin-left:auto;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-toggle[_ngcontent-%COMP%]:hover:not(.disabled){background:var(--color-bg-hover)}.section-toggle[_ngcontent-%COMP%]:active:not(.disabled){transform:scale(.98)}.section-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.search-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;height:50px;background:var(--color-bg-hover);border-top:1px solid var(--color-border);transition:all .2s ease}.search-header[_ngcontent-%COMP%] .search-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:var(--color-text);font-size:.9rem;padding:0;min-width:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-muted)}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%]{flex-shrink:0}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-content[_ngcontent-%COMP%]{padding:.5rem 0 0;animation:_ngcontent-%COMP%_slideDown .2s ease;border-bottom:1px solid var(--color-border);display:flex;flex-direction:column}.section-content.threads[_ngcontent-%COMP%]{padding:0;border-bottom:none;flex:1!important;min-height:0!important;overflow:hidden!important}.section-content.threads[_ngcontent-%COMP%] app-thread-selector[_ngcontent-%COMP%]{flex:1!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}@keyframes _ngcontent-%COMP%_slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.preference-item[_ngcontent-%COMP%]{padding-bottom:1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border)}.preference-item[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:0 1rem}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.preference-item[_ngcontent-%COMP%] .preference-content[_ngcontent-%COMP%]{padding:0 1rem}.error-notification[_ngcontent-%COMP%]{position:fixed;top:5rem;left:50%;transform:translate(-50%);z-index:2000;display:flex;align-items:center;gap:.75rem;background:#ff3b3026;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid rgba(255,59,48,.3);border-radius:16px;padding:1rem 1.5rem;box-shadow:var(--glass-shadow);animation:_ngcontent-%COMP%_errorSlideDown .3s cubic-bezier(.4,0,.2,1)}.error-notification[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:1.2rem;flex-shrink:0;color:#c00}.error-notification[_ngcontent-%COMP%] .error-text[_ngcontent-%COMP%]{flex:1;color:#c00;font-size:.9rem;font-weight:500}@keyframes _ngcontent-%COMP%_errorSlideDown{0%{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%)}}@media(max-width:480px){.app-sidenav[_ngcontent-%COMP%]{width:320px}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:.75rem!important;left:.75rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.25rem + 40px)!important;left:.75rem!important}.error-notification[_ngcontent-%COMP%]{left:1rem;right:1rem;transform:none;max-width:calc(100vw - 2rem)}}body.dark[_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .app-sidenav[_ngcontent-%COMP%]{background:#242830f2;border-right-color:#b4c8ff17}body.dark[_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .sidenav-header[_ngcontent-%COMP%]{background:#242830b3}"],changeDetection:1})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-DHF4GvxN.js';import {v}from'./chunk-kXODoW4J.js';import {R}from'./chunk-BiwhEkuA.js';import {g,ao as V,G,C as Ce,W as Wi,r as re,b as U$1,bS as Da,I as br,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,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,J as JC,t as sI,a8 as Kg,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-K6RKSHKK.js';import'./chunk-DIhIuMRR.js';import {W as Wn,S as Se}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';import'./chunk-B55TXBfo.js';import'./chunk-Bkwb10Tz.js';var W=()=>[];function z(s,e){if(s&1&&(Cs(0,"p",3),JC(1),hl()),s&2){let t=CC().$implicit;sI(),Kg(t.name);}}function U(s,e){if(s&1){let t=vC();Cs(0,"agentos-auth-setting-item",5),kg("editRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onEdit(i))})("deleteRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onDelete(i))})("duplicateRequested",function(){let i=Cf(t),r=CC(2);return Tf(r.onDuplicate(i))}),hl();}if(s&2){let t=e,n=CC(2);_g("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin());}}function X(s,e){if(s&1&&aC(0,z,2,1,"p",3)(1,U,1,3,"agentos-auth-setting-item",4),s&2){let t,n=e.$implicit,i=CC();cC(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t);}}var k=Object.freeze({platform:"Platform (read-only)",namespace:"Auth Settings du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class s{route=g(V);router=g(G);destroyRef=g(Ce);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Wi(false);listItems$=this.state.vm$.pipe(re(e=>this.toListItems(e)));isLoading=Wi(true);resolved=new Map;ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(re(e=>e.get("namespaceId")??""),Da(e=>e?this.namespaceRole.isAdminOfNamespace$(e):br(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe(e=>{this.isLoading.set(false);let t=new Map;e.platform.forEach(n=>{n.id&&t.set(this.itemKey("platform",n.id),{config:n,scope:"platform"});}),e.namespace.forEach(n=>{n.id&&t.set(this.itemKey("namespace",n.id),{config:n,scope:"namespace"});}),e.userOnNs.forEach(n=>{n.id&&t.set(this.itemKey("userOnNs",n.id),{config:n,scope:"userOnNs"});}),e.userGlobal.forEach(n=>{n.id&&t.set(this.itemKey("userGlobal",n.id),{config:n,scope:"userGlobal"});}),this.resolved=t;});}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return `${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}onEdit(e){let t=e.config.id;t&&this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t,"edit"],{queryParams:{scope:e.scope}});}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(U$1(this.destroyRef)).subscribe({error:n=>{console.error(`[AuthSettingsAllScopes] Delete failed for ${e.scope}:${t}:`,n);}});}onDuplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucun Auth Setting",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.authType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=jw({type:s,selectors:[["agentos-auth-settings-all-scopes"]],decls:5,vars:7,consts:[["authSettingItemTpl",""],["title","Auth Settings","emptyMessage","No auth settings available.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"auth-settings-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return n.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return n.goBack()}),hl()(),wg(3,X,2,1,"ng-template",null,0,ET)),t&2){let i=AC(4);_g("items",yT(1,4,n.listItems$)??dT(6,W))("loading",n.isLoading())("showCreate",true)("itemTemplate",i);}},dependencies:[Wn,O,Se,Lb],encapsulation:2})};export{j as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-82BMsVX3.js';import {g,ao as V$1,G as G$1,C as Ce,da as M,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-K6RKSHKK.js';import {W as Wn}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';var U=()=>[];function V(i,t){if(i&1){let n=vC();Cs(0,"agentos-agent-config-item",4),kg("deleteRequested",function(o){Cf(n);let F=CC(2);return Tf(F.deleteConfig(o))}),hl();}if(i&2){let n=CC().$implicit,e=CC();_g("config",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformConfig(n.id));}}function j(i,t){if(i&1&&aC(0,V,1,3,"agentos-agent-config-item",3),i&2){let n,e=t.$implicit,o=CC();cC((n=o.resolveConfig(e.id))?0:-1,n);}}var G="namespace",K="platform",q=class i{route=g(V$1);router=g(G$1);destroyRef=g(Ce);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Wi(true);allConfigs$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),$y({namespace:this.agentConfigController.listByParentAgentConfig(this.namespaceId),platform:this.agentConfigController.listPlatformAgentsAgentConfig().pipe(va(()=>br([])))}))));configItems$=this.allConfigs$.pipe(re(({namespace:t,platform:n})=>[...n.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Platform (read-only)"})),...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Namespace"}))]));namespaceConfigsById=new Map;platformConfigsById=new Map;constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:t,platform:n})=>{this.namespaceConfigsById=new Map(t.map(e=>[e.id??"",e])),this.platformConfigsById=new Map(n.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,"agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.namespaceConfigsById.get(t)??this.platformConfigsById.get(t)??null}isPlatformConfig(t){return this.platformConfigsById.has(t)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-namespace-agent-configs"]],decls:6,vars:7,consts:[["agentConfigItemTpl",""],["title","Agent Configs","emptyMessage","No agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-agent-configs__back",3,"click"],[3,"config","namespaceId","readOnly"],[3,"deleteRequested","config","namespaceId","readOnly"]],template:function(n,e){if(n&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)),n&2){let o=AC(5);_g("items",yT(1,4,e.configItems$)??dT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",o);}},dependencies:[Wn,O,Lb],styles:[".namespace-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{q as NamespaceAgentConfigsComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f}from'./chunk-DMUiJ7oP.js';import {G as Ge,z as z$2,Q as Qe,E as Et,y as yt$2}from'./chunk-CJEW8Ogd.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-4uEZjTft.js';import {al as vt$1,an as ue,g,ay as O,F,L,az as Xt,U,E as N,p as pe$1,G,ap as zy,ae as kt,aA as an,av as dt$1,j as jw,h as hr$1,aB as fr$1,aC as bu,k as Cs,n as kg,o as aC,m as hl,t as sI,_ as _g,u as cC,x as jg,y as MC,N as NC,P as P$1,aD as Hy,K as x,a9 as vC,ai as rm,aa as Cf,aj as iT,ab as Tf,a3 as ZI,w as zg,ak as nm,a6 as QI,D as DE,W as Wi$1,aE as W,B as gy,I as br$1,aF as R,r as re,a7 as va,aG as fe,T as TT,z as z$1,a as P$2,aH as z,b as U$1,aI as RS,q as dC,v as fC,aJ as Tr$1,aK as Lb,am as Ym,i as Gn$1,J as JC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G$1,aQ as $a,aR as Ps,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as Bs,a_ as rb,ac as CC,a$ as sT,b0 as Xg,a5 as Dl,M as Mg,ah as dT,b1 as On,b2 as Hb,b3 as Ob,b4 as fT,b5 as lT,aw as gl,b6 as Ng,ax as ml,l as le,b7 as u,b8 as B,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Kg,bf as gT,bg as yT,S as Sg,bh as Gy,e as pr$1,bi as vT,bj as gE,bk as Dh}from'./main-YYHD6X7H.js';import {s}from'./chunk-D26Y186i.js';import {d}from'./chunk-CmyT-Z4A.js';import {S as Se$1,P as Pn}from'./chunk-B13_C_P9.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-CgNkwpQ7.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-FMHkoXwM.js';var ot=class i{sanitizer=g(RS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(gy);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(Cs(0,"div",3),Mg(1,"span",8),JC(2," Recording... Click mic to stop "),hl());}function Mi(i,e){i&1&&(Cs(0,"div",3),Mg(1,"span",9),JC(2," Transcribing... "),hl());}function Ei(i,e){if(i&1&&(Cs(0,"span",14),JC(1),hl()),i&2){let t=CC().$implicit,n=CC(2);sI(),Kg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=vC();Cs(0,"div",11),kg("click",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectedAutocompleteIndex=o)}),Cs(1,"div",12),Mg(2,"span",13),gT(3,"highlight"),aC(4,Ei,2,1,"span",14),hl(),Mg(5,"div",15),gT(6,"highlight"),hl();}if(i&2){let t=e.$implicit,n=e.$index,o=CC(2);zg("selected",n===o.selectedAutocompleteIndex),Sg("aria-selected",n===o.selectedAutocompleteIndex),sI(2),_g("innerHTML",vT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),gE),sI(2),cC(o.hasParameterFormat(t)?4:-1),sI(),_g("innerHTML",vT(6,9,t.description,o.getAutocompleteQuery()),gE);}}function Pi(i,e){if(i&1&&(Cs(0,"div",4),dC(1,Oi,7,12,"div",10,Ti),hl()),i&2){let t=CC();sI(),fC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",18),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.onStopClick())}),hl();}}function Ii(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",19),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.sendMessage())}),hl();}if(i&2){let t=CC(2);zg("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),_g("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",21),kg("action",function(){Cf(t);let o=CC(3);return Tf(o.triggerFileUpload())}),hl(),Cs(1,"input",22,1),kg("change",function(o){Cf(t);let r=CC(3);return Tf(r.onFileInputChange(o))}),hl();}if(i&2){let t=CC(3);_g("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=vC();aC(0,Di,3,1),Cs(1,"ds-icon-button",20),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.toggleRecording())}),hl();}if(i&2){let t=CC(2);cC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),sI(),zg("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),_g("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(Cs(0,"div",7),aC(1,ki,1,0,"ds-icon-button",16),aC(2,Ii,1,6,"ds-icon-button",17),aC(3,Ai,2,6),hl()),i&2){let t=CC();sI(),cC(t.isThinking?1:-1),sI(),cC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),sI(),cC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return dt$1(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return dt$1(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
1
|
+
import {f}from'./chunk-B_5qWQZJ.js';import {G as Ge,z as z$2,Q as Qe,E as Et,y as yt$2}from'./chunk-BWZcAdUl.js';import {U as Ue$1,x as x$1,i as is}from'./chunk-Bkwb10Tz.js';import {al as vt$1,an as ue,g,ay as O,F,L,az as Xt,U,E as N,p as pe$1,G,ap as zy,ae as kt,aA as an,av as dt$1,j as jw,h as hr$1,aB as fr$1,aC as bu,k as Cs,n as kg,o as aC,m as hl,t as sI,_ as _g,u as cC,x as jg,y as MC,N as NC,P as P$1,aD as Hy,K as x,a9 as vC,ai as rm,aa as Cf,aj as iT,ab as Tf,a3 as ZI,w as zg,ak as nm,a6 as QI,D as DE,W as Wi$1,aE as W,B as gy,I as br$1,aF as R,r as re,a7 as va,aG as fe,T as TT,z as z$1,a as P$2,aH as z,b as U$1,aI as RS,q as dC,v as fC,aJ as Tr$1,aK as Lb,am as Ym,i as Gn$1,J as JC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G$1,aQ as $a,aR as Ps,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as Bs,a_ as rb,ac as CC,a$ as sT,b0 as Xg,a5 as Dl,M as Mg,ah as dT,b1 as On,b2 as Hb,b3 as Ob,b4 as fT,b5 as lT,aw as gl,b6 as Ng,ax as ml,l as le,b7 as u,b8 as B,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Kg,bf as gT,bg as yT,S as Sg,bh as Gy,e as pr$1,bi as vT,bj as gE,bk as Dh}from'./main-K6RKSHKK.js';import {s}from'./chunk-CxKynLjd.js';import {d}from'./chunk-RlCcRMQy.js';import {S as Se$1,P as Pn}from'./chunk-D8Bz7q-C.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-BEaYQhbI.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-BhdMedPO.js';var ot=class i{sanitizer=g(RS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(gy);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,P$2({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(Cs(0,"div",3),Mg(1,"span",8),JC(2," Recording... Click mic to stop "),hl());}function Mi(i,e){i&1&&(Cs(0,"div",3),Mg(1,"span",9),JC(2," Transcribing... "),hl());}function Ei(i,e){if(i&1&&(Cs(0,"span",14),JC(1),hl()),i&2){let t=CC().$implicit,n=CC(2);sI(),Kg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=vC();Cs(0,"div",11),kg("click",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=Cf(t).$index,r=CC(2);return Tf(r.selectedAutocompleteIndex=o)}),Cs(1,"div",12),Mg(2,"span",13),gT(3,"highlight"),aC(4,Ei,2,1,"span",14),hl(),Mg(5,"div",15),gT(6,"highlight"),hl();}if(i&2){let t=e.$implicit,n=e.$index,o=CC(2);zg("selected",n===o.selectedAutocompleteIndex),Sg("aria-selected",n===o.selectedAutocompleteIndex),sI(2),_g("innerHTML",vT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),gE),sI(2),cC(o.hasParameterFormat(t)?4:-1),sI(),_g("innerHTML",vT(6,9,t.description,o.getAutocompleteQuery()),gE);}}function Pi(i,e){if(i&1&&(Cs(0,"div",4),dC(1,Oi,7,12,"div",10,Ti),hl()),i&2){let t=CC();sI(),fC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",18),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.onStopClick())}),hl();}}function Ii(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",19),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.sendMessage())}),hl();}if(i&2){let t=CC(2);zg("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),_g("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=vC();Cs(0,"ds-icon-button",21),kg("action",function(){Cf(t);let o=CC(3);return Tf(o.triggerFileUpload())}),hl(),Cs(1,"input",22,1),kg("change",function(o){Cf(t);let r=CC(3);return Tf(r.onFileInputChange(o))}),hl();}if(i&2){let t=CC(3);_g("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=vC();aC(0,Di,3,1),Cs(1,"ds-icon-button",20),kg("action",function(){Cf(t);let o=CC(2);return Tf(o.toggleRecording())}),hl();}if(i&2){let t=CC(2);cC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),sI(),zg("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),_g("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(Cs(0,"div",7),aC(1,ki,1,0,"ds-icon-button",16),aC(2,Ii,1,6,"ds-icon-button",17),aC(3,Ai,2,6),hl()),i&2){let t=CC();sI(),cC(t.isThinking?1:-1),sI(),cC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),sI(),cC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return dt$1(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return dt$1(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
2
2
|
|
|
3
3
|
`),this.sessionHadTranscript=false),this.pendingLineBreaksTimeout=null;},500);}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null);}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t);}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...");},2e3);}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking...";}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite="";}));}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus();},50);}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e));}));}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n);},0)),setTimeout(()=>this.adjustTextareaHeight(),10);}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available");}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete();}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete();}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete();}}hideAutocomplete(){this.autocompleteVisible=false,this.autocompleteItems=[],this.selectedAutocompleteIndex=0;}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else {this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2);}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else {let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}},0);}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem();}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});},0);}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=jw({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&jg(yi,7)(wi,5),t&2){let o;MC(o=NC())&&(n.messageInput=o.first),MC(o=NC())&&(n.fileInput=o.first);}},hostBindings:function(t,n){t&1&&kg("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},DE);},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[bu],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=vC();Cs(0,"div",2),aC(1,Si,3,0,"div",3),aC(2,Mi,3,0,"div",3),aC(3,Pi,3,0,"div",4),Cs(4,"div",5)(5,"textarea",6,0),rm("ngModelChange",function(d){return Cf(o),iT(n.message,d)||(n.message=d),Tf(d)}),kg("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return Cf(o),n.isFocused=true,Tf(n.textareaFocused.emit())})("blur",function(){return n.isFocused=false}),hl(),ZI(),aC(7,Fi,4,3,"div",7),hl()();}t&2&&(sI(),cC(!n.isVoiceMessageMode&&n.isRecording?1:-1),sI(),cC(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),sI(),cC(n.autocompleteVisible?3:-1),sI(),zg("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),sI(),nm("ngModel",n.message),_g("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),QI(),sI(2),cC(n.isSessionInitializing?-1:7));},dependencies:[ti$1,Ye,Zn$1,cn,Se$1,ot],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}'],changeDetection:1})};var Ce=class i{unreadCountSubject=new Tr$1(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized");}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t);}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"));}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset");}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var at=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=false;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(Ce);project=g(P$1);constructor(){this.initializeTitleUpdates();}initializeTitleUpdates(){Hy([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t);});}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n);}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=true,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=false,this.forceUpdateTitle();},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle();}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=false,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle();}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var st=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e;}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e;}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null;}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ri=(i,e)=>e.label;function Hi(i,e){if(i&1){let t=vC();Cs(0,"button",2),kg("click",function(o){let r=Cf(t).$implicit,d=CC();return Tf(d.executeAction(r,o))}),Cs(1,"mat-icon"),JC(2),hl()();}if(i&2){let t=e.$implicit;Sg("title",t.tooltip||t.label),sI(),Sg("aria-label",t.label),sI(),Kg(t.icon);}}var ct=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action();}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=jw({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(Cs(0,"div",0),dC(1,Hi,3,3,"button",1,Ri),hl()),t&2&&(sI(),fC(n.actions));},dependencies:[Ym,Gn$1,wt$1],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"],changeDetection:1})};var Z=class i{renderer;constructor(){this.renderer=new Ue$1,this.configureRenderer();}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>');}return o};}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return false;if(e.startsWith("//"))return true;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return false}}escapeHtml(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return dt$1(this,null,function*(){let t=yield x$1.parse(e,{renderer:this.renderer,breaks:true,gfm:true});return is.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Vi=i=>({"user-message-wrapper":i});function Li(i,e){if(i&1&&(Cs(0,"div",4)(1,"div",8),JC(2),hl()()),i&2){let t=CC(2);sI(2),Dl(" ",t.message.speaker," ");}}function zi(i,e){if(i&1&&(Cs(0,"time",6),JC(1),hl()),i&2){let t=CC(2);sI(),Kg(t.formattedTimestamp);}}function Ni(i,e){if(i&1&&(Cs(0,"div",7),Mg(1,"app-message-context-menu",9),hl()),i&2){let t=CC(2);sI(),_g("actions",t.actions);}}function $i(i,e){if(i&1&&(aC(0,Li,3,1,"div",4),Mg(1,"div",5),aC(2,zi,2,1,"time",6),aC(3,Ni,2,1,"div",7)),i&2){let t=CC();cC(t.shouldShowSpeaker?0:-1),sI(),_g("innerHTML",t.renderedContent,gE),sI(),cC(t.formattedTimestamp?2:-1),sI(),cC(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1);}}function ji(i,e){if(i&1&&Mg(0,"span",12),i&2){let t=CC(3);_g("innerHTML",t.renderedContent,gE);}}function Ui(i,e){if(i&1&&(Cs(0,"span",13),JC(1),hl()),i&2){let t=CC(3);sI(),Kg(t.collapsedErrorText);}}function Bi(i,e){i&1&&JC(0," Show less \u25B2 ");}function Wi(i,e){i&1&&JC(0," Show more \u25BC ");}function qi(i,e){if(i&1){let t=vC();Cs(0,"div",10),aC(1,ji,1,1,"span",12)(2,Ui,2,1,"span",13),Cs(3,"button",14),kg("click",function(){Cf(t);let o=CC(2);return Tf(o.toggleErrorExpanded())}),aC(4,Bi,1,0)(5,Wi,1,0),hl()();}if(i&2){let t=CC(2);sI(),cC(t.isErrorExpanded()?1:2),sI(3),cC(t.isErrorExpanded()?4:5);}}function Yi(i,e){i&1&&JC(0," \u25B2 ");}function Gi(i,e){i&1&&JC(0," \u25BC ");}function Qi(i,e){if(i&1&&(Cs(0,"a",17),JC(1,"view"),hl()),i&2){let t=CC(3);_g("href",t.eventLink,Dh);}}function Xi(i,e){if(i&1&&(Cs(0,"pre",18),JC(1),hl()),i&2){let t=CC(3);sI(),Kg(t.message.fullContent);}}function Ki(i,e){if(i&1){let t=vC();Cs(0,"div",15),Mg(1,"span",12),Cs(2,"button",16),kg("click",function(){Cf(t);let o=CC(2);return Tf(o.toggleTechnicalExpanded())}),aC(3,Yi,1,0)(4,Gi,1,0),hl(),aC(5,Qi,2,1,"a",17),hl(),aC(6,Xi,2,1,"pre",18);}if(i&2){let t=CC(2);sI(),_g("innerHTML",t.renderedContent,gE),sI(2),cC(t.isTechnicalExpanded()?3:4),sI(2),cC(t.eventLink?5:-1),sI(),cC(t.isTechnicalExpanded()?6:-1);}}function Ji(i,e){if(i&1&&(Cs(0,"a",17),JC(1,"view"),hl()),i&2){let t=CC(3);_g("href",t.eventLink,Dh);}}function Zi(i,e){if(i&1&&(Cs(0,"div",11),Mg(1,"span",12),aC(2,Ji,2,1,"a",17),hl()),i&2){let t=CC(2);sI(),_g("innerHTML",t.renderedContent,gE),sI(),cC(t.eventLink?2:-1);}}function eo(i,e){if(i&1&&aC(0,qi,6,2,"div",10)(1,Ki,7,4)(2,Zi,3,2,"div",11),i&2){let t=CC();cC(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2);}}function to(i,e){if(i&1&&(Cs(0,"div",2),Mg(1,"app-message-context-menu",9),hl()),i&2){let t=CC();sI(),_g("actions",t.actions);}}function no(i,e){if(i&1&&(Cs(0,"div",3),Mg(1,"app-message-context-menu",9),hl()),i&2){let t=CC();sI(),_g("actions",t.actions);}}var ve=class i{destroy$=new ue;message;canDelete=true;isOtherUser=false;containingThreadId;copyRequested=new vt$1;deleteRequested=new vt$1;renderedContent="";shouldHideTechnical=false;shouldHideWarning=false;isErrorExpanded=Wi$1(false);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=Wi$1(false);sanitizer=g(RS);notificationService=g(s);preferencesService=g(L);projectState=g(P$1);threadState=g(U);markdownService=g(Z);get messageClasses(){return {[this.message.role]:true,[this.message.type]:true,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return dt$1(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(zy(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e;}),this.preferencesService.hideWarningMessages$.pipe(zy(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e;}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages();})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=g(Hb);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?false:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
|
|
4
4
|
`)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e);}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e);}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-CvEqqOCm.js';import {N as N$1}from'./chunk-vG5Um99w.js';import {g,G,C as Ce,d9 as U,aJ as Tr,W as Wi,bS as Da,r as re,b as U$1,j as jw,aK as Lb,k as Cs,bf as gT,n as kg,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-K6RKSHKK.js';import'./chunk-DIhIuMRR.js';import {W as Wn,S as Se}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';import'./chunk-B55TXBfo.js';import'./chunk-Bkwb10Tz.js';var F=()=>[];function N(i,t){if(i&1){let e=vC();Cs(0,"agentos-integration-config-item",4),kg("editRequested",function(n){Cf(e);let f=CC(2);return Tf(f.onEdit(n))})("deleteRequested",function(n){Cf(e);let f=CC(2);return Tf(f.deleteConfig(n))}),hl();}i&2&&_g("config",t);}function j(i,t){if(i&1&&aC(0,N,1,1,"agentos-integration-config-item",3),i&2){let e,o=t.$implicit,n=CC();cC((e=n.resolveConfig(o.id))?0:-1,e);}}var V=class i{router=g(G);destroyRef=g(Ce);state=g(N$1);integrationConfigController=g(U);refresh$=new Tr(void 0);isLoading=Wi(true);configs$=this.refresh$.pipe(Da(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())));configItems$=this.configs$.pipe(re(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.integrationType}))));configsById=new Map;constructor(){this.configs$.pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.configsById=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","integration-configs","new"]);}deleteConfig(t){this.integrationConfigController.deleteIntegrationConfig(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}onEdit(t){this.router.navigate(["/agentos","admin","integration-configs",t.id??"","edit"]);}resolveConfig(t){return this.configsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-platform-integration-configs"]],decls:5,vars:7,consts:[["integrationConfigItemTpl",""],["title","Platform Integration Configs","emptyMessage","No platform integration configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","platform",3,"config"],["scope","platform",3,"editRequested","deleteRequested","config"]],template:function(e,o){if(e&1&&(Cs(0,"ds-entity-list",1),gT(1,"async"),kg("createRequested",function(){return o.openCreateForm()}),Cs(2,"ds-icon-button",2),kg("action",function(){return o.goBack()}),hl()(),wg(3,j,1,1,"ng-template",null,0,ET)),e&2){let n=AC(4);_g("items",yT(1,4,o.configItems$)??dT(6,F))("loading",o.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,Se,Lb],styles:[".platform-integration-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-integration-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{V as PlatformIntegrationConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-vse5stCO.js';import {c}from'./chunk-C9j9HPDY.js';import {g,G,C as Ce,W as Wi,T as TT,b as U,j as jw,k as Cs,n as kg,m as hl,af as wg,A as AC,_ as _g,o as aC,ac as CC,u as cC,a9 as vC,aa as Cf,ab as Tf,ag as ET}from'./main-K6RKSHKK.js';import {W as Wn,S as Se}from'./chunk-D8Bz7q-C.js';import'./chunk-BEaYQhbI.js';import'./chunk-BhdMedPO.js';function M(i,e){if(i&1){let t=vC();Cs(0,"agentos-scheduled-prompt-item",4),kg("enableRequested",function(n){Cf(t);let r=CC(2);return Tf(r.enablePrompt(n))})("disableRequested",function(n){Cf(t);let r=CC(2);return Tf(r.disablePrompt(n))})("deleteRequested",function(n){Cf(t);let r=CC(2);return Tf(r.deletePrompt(n))}),hl();}i&2&&_g("definition",e)("platformMode",true);}function L(i,e){if(i&1&&aC(0,M,1,2,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=CC();cC((t=n.resolvePrompt(o.id))?0:-1,t);}}var D=class i{router=g(G);destroyRef=g(Ce);state=g(c);prompts=Wi([]);isLoading=Wi(true);promptItems=TT(()=>this.prompts().map(e=>({id:e.id??"",name:e.name,description:e.description,badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})));constructor(){this.state.listPlatform().pipe(U(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}enablePrompt(e){this.state.enable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchPrompt(t));}disablePrompt(e){this.state.disable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchPrompt(t));}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(U(this.destroyRef)).subscribe(()=>this.prompts.update(o=>o.filter(n=>n.id!==t)));}resolvePrompt(e){return this.prompts().find(t=>t.id===e)??null}patchPrompt(e){this.prompts.update(t=>t.map(o=>o.id===e.id?e:o));}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-platform-scheduled-prompts"]],decls:4,vars:4,consts:[["scheduledPromptItemTpl",""],["title","Platform Scheduled Prompts","emptyMessage","No platform scheduled prompts defined yet. Add one above.","cardMinWidth","420px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","platformMode"],[3,"enableRequested","disableRequested","deleteRequested","definition","platformMode"]],template:function(t,o){if(t&1&&(Cs(0,"ds-entity-list",1),kg("createRequested",function(){return o.openCreateForm()}),Cs(1,"ds-icon-button",2),kg("action",function(){return o.goBack()}),hl()(),wg(2,L,1,1,"ng-template",null,0,ET)),t&2){let n=AC(3);_g("items",o.promptItems())("loading",o.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,R,Se],encapsulation:2})};export{D as PlatformScheduledPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,
|
|
1
|
+
import {g,dk as re,K as x}from'./main-K6RKSHKK.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};
|