@whoz-oss/coday-client 0.249.15 → 0.249.17
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-CDlpxL7C.js → chunk-1C8FfjAR.js} +1 -1
- package/browser/{chunk-C61o-KhY.js → chunk-2Go-OM7t.js} +1 -1
- package/browser/{chunk-0DLazttZ.js → chunk-7SmTiVF_.js} +1 -1
- package/browser/{chunk-BTaLhUa1.js → chunk-B5wj-AWl.js} +1 -1
- package/browser/{chunk-C857K-GW.js → chunk-BNJpFR5J.js} +1 -1
- package/browser/{chunk-B8Hj5zSc.js → chunk-BO_Hh7E9.js} +1 -1
- package/browser/{chunk-DZo4BkAy.js → chunk-BQ15qZFz.js} +1 -1
- package/browser/{chunk-C1jgW_vt.js → chunk-BS_qtnJa.js} +1 -1
- package/browser/{chunk-B4IOFZod.js → chunk-BT8nWWPc.js} +1 -1
- package/browser/{chunk-B5JJGvDV.js → chunk-BU7wmUzy.js} +1 -1
- package/browser/{chunk-pvYR1_Ao.js → chunk-BWdAFY49.js} +1 -1
- package/browser/{chunk-Dax4e1JZ.js → chunk-Bc7OrHjR.js} +1 -1
- package/browser/{chunk-CPtlVKZn.js → chunk-BkZgPVhu.js} +1 -1
- package/browser/{chunk-C_Myq1m3.js → chunk-BqyfQo5r.js} +1 -1
- package/browser/{chunk-CtA5aepT.js → chunk-BuUqIQZe.js} +1 -1
- package/browser/{chunk-DGZZZMSy.js → chunk-Bx6U7hp8.js} +1 -1
- package/browser/{chunk-DcNhcvYJ.js → chunk-Byflz_yZ.js} +1 -1
- package/browser/{chunk-DR7eHENE.js → chunk-C-Omuw0k.js} +1 -1
- package/browser/{chunk-COV5Dgin.js → chunk-C6N4Xim3.js} +1 -1
- package/browser/{chunk-BCdZ0s7K.js → chunk-CBKxLIx3.js} +1 -1
- package/browser/{chunk-CjOZDsNf.js → chunk-CDiCP0cs.js} +3 -3
- package/browser/{chunk-C7O0lv-N.js → chunk-CFAzj-K1.js} +1 -1
- package/browser/{chunk-CgzkgcLp.js → chunk-CGaNqBLr.js} +1 -1
- package/browser/{chunk-BEWBmv_p.js → chunk-CL89mvBt.js} +1 -1
- package/browser/{chunk-BjmMhl9l.js → chunk-CRxfSRf8.js} +1 -1
- package/browser/{chunk-5rdVZHKH.js → chunk-Ca08FpV3.js} +1 -1
- package/browser/chunk-CePUnppu.js +1 -0
- package/browser/{chunk-B4glcPfc.js → chunk-CfZSDspr.js} +1 -1
- package/browser/{chunk-DpTWpgRi.js → chunk-Cpwt3qJr.js} +1 -1
- package/browser/{chunk-B638hYBH.js → chunk-Cr9SQ4Nl.js} +1 -1
- package/browser/{chunk-14xVulKm.js → chunk-Craeqqq-.js} +1 -1
- package/browser/{chunk-CEIj_SQC.js → chunk-CweOwCOY.js} +1 -1
- package/browser/{chunk-BCqgdXa2.js → chunk-D-9o3uam.js} +1 -1
- package/browser/{chunk-ILoui0Go.js → chunk-D-Y7a6aq.js} +1 -1
- package/browser/{chunk-CX_ZpPnR.js → chunk-D0WPRxvI.js} +1 -1
- package/browser/{chunk-B9bfwdrZ.js → chunk-D6im9idH.js} +1 -1
- package/browser/{chunk-Djxe1buY.js → chunk-DDLM6Cth.js} +1 -1
- package/browser/{chunk-BFyba197.js → chunk-DGF8f8rP.js} +1 -1
- package/browser/{chunk-CALvfg9j.js → chunk-DOwIRP9H.js} +1 -1
- package/browser/{chunk-Hwi8LgHH.js → chunk-DXAivyZi.js} +1 -1
- package/browser/chunk-DXKXt8mt.js +1 -0
- package/browser/{chunk-BQJyTdNB.js → chunk-DZANBioo.js} +1 -1
- package/browser/{chunk-Djnp-vUI.js → chunk-DdIe-Q8z.js} +1 -1
- package/browser/{chunk-D21FPLZ4.js → chunk-Dg-7WJin.js} +1 -1
- package/browser/{chunk-BfZyIX9-.js → chunk-DhHp86i1.js} +1 -1
- package/browser/{chunk-SFXE5Xl_.js → chunk-DhogzxpT.js} +1 -1
- package/browser/{chunk-4W78grSG.js → chunk-DlHlRrm5.js} +1 -1
- package/browser/{chunk-BJDByX7-.js → chunk-Dx3RUcFR.js} +1 -1
- package/browser/{chunk-D1TRN0MX.js → chunk-DxV9RsfD.js} +1 -1
- package/browser/{chunk-BgYxYYFj.js → chunk-DyOpupcY.js} +1 -1
- package/browser/{chunk-B86dntDV.js → chunk-J9jbGr5V.js} +1 -1
- package/browser/{chunk-vZ6JA8WO.js → chunk-L8gDvVhI.js} +1 -1
- package/browser/{chunk-BbLMzp9k.js → chunk-MYEQTQOG.js} +1 -1
- package/browser/{chunk-CRfYIzzY.js → chunk-OfW8ypwW.js} +1 -1
- package/browser/{chunk-RmWeivJM.js → chunk-PZm2mGLF.js} +1 -1
- package/browser/{chunk-6SsfFSoG.js → chunk-YTDAsLsc.js} +1 -1
- package/browser/{chunk-_rnm3CUz.js → chunk-YvUhHp6t.js} +1 -1
- package/browser/{chunk-B1LoEamJ.js → chunk-Zmd4R9cO.js} +1 -1
- package/browser/{chunk-FNh4E199.js → chunk-aJ44yjwO.js} +1 -1
- package/browser/{chunk-EaXjSZ08.js → chunk-fMW6C3Ap.js} +1 -1
- package/browser/{chunk-CxSXBi5z.js → chunk-gEgtSVjj.js} +1 -1
- package/browser/{chunk-BiIYygHc.js → chunk-lbDJ4ttg.js} +1 -1
- package/browser/{chunk-SmTJ8TRR.js → chunk-rEBsHfWZ.js} +1 -1
- package/browser/{chunk-DOgkeupI.js → chunk-w8cyoPom.js} +1 -1
- package/browser/{chunk-Bs4lUz4W.js → chunk-wQH6b0eH.js} +1 -1
- package/browser/{chunk-B_SIbEE4.js → chunk-y7hKHMfT.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-VYETRYCE.js → main-FZBZNLDT.js} +4 -4
- package/package.json +1 -1
- package/browser/chunk-BSTCpwsr.js +0 -1
- package/browser/chunk-DtIFBPXN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-J9jbGr5V.js';import {c}from'./chunk-Dx3RUcFR.js';import {g,ao as V$1,G,w as we,H as Hi,m as mT,Q as By,a7 as ga,S as ha,b as U,A as Aw,v as vs,l as Ag,k as fl,af as Dg,T as TC,r as Tg,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-FZBZNLDT.js';import {W as Wn,S as Se}from'./chunk-DdIe-Q8z.js';import'./chunk-Bc7OrHjR.js';import'./chunk-MYEQTQOG.js';function V(i,e){if(i&1){let t=dC();vs(0,"agentos-scheduled-prompt-item",4),Ag("enableRequested",function(n){If(t);let s=mC(2);return wf(s.enablePrompt(n))})("disableRequested",function(n){If(t);let s=mC(2);return wf(s.disablePrompt(n))})("deleteRequested",function(n){If(t);let s=mC(2);return wf(s.deletePrompt(n))}),fl();}if(i&2){let t=mC().$implicit,o=mC();Tg("definition",e)("namespaceId",o.namespaceId)("readOnly",o.isPlatformPrompt(t.id));}}function k(i,e){if(i&1&&eC(0,V,1,3,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=mC();tC((t=n.resolvePrompt(o.id))?0:-1,t);}}var O="platform",B="namespace",M=class i{route=g(V$1);router=g(G);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;platformPrompts=Hi([]);namespacePrompts=Hi([]);promptItems=mT(()=>[...this.platformPrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:O,groupLabel:"Platform (read-only)",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})),...this.namespacePrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:B,groupLabel:"Namespace",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]}))]);constructor(){By({platform:this.state.listPlatform().pipe(ga(()=>ha([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe(({platform:e,namespace:t})=>{this.platformPrompts.set(e),this.namespacePrompts.set(t);});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}enablePrompt(e){this.state.enable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}disablePrompt(e){this.state.disable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(U(this.destroyRef)).subscribe(()=>this.namespacePrompts.update(o=>o.filter(n=>n.id!==t)));}resolvePrompt(e){return this.platformPrompts().find(t=>t.id===e)??this.namespacePrompts().find(t=>t.id===e)??null}isPlatformPrompt(e){return this.platformPrompts().some(t=>t.id===e)}patchNamespacePrompt(e){this.namespacePrompts.update(t=>t.map(o=>o.id===e.id?e:o));}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-scheduled-prompt-list"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Scheduled Prompts","emptyMessage","No scheduled prompts yet. Create one to get started.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","namespaceId","readOnly"],[3,"enableRequested","disableRequested","deleteRequested","definition","namespaceId","readOnly"]],template:function(t,o){if(t&1&&(vs(0,"ds-entity-list",1),Ag("createRequested",function(){return o.openCreateForm()}),vs(1,"ds-icon-button",2),Ag("action",function(){return o.goBack()}),fl()(),Dg(2,k,1,1,"ng-template",null,0,fT)),t&2){let n=TC(3);Tg("items",o.promptItems())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,R,Se],encapsulation:2})};export{M as ScheduledPromptListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-
|
|
1
|
+
import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-FZBZNLDT.js';var f=class s{http=g(dy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?ha(t):this.http.get(`/api/projects/${e}/agents`).pipe(Od(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-DxV9RsfD.js';import {v}from'./chunk-Dg-7WJin.js';import {g,G,w as we,aI as Tr,bR as ma,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-FZBZNLDT.js';import'./chunk-CDiCP0cs.js';import {W as Wn}from'./chunk-DdIe-Q8z.js';import'./chunk-Bc7OrHjR.js';import'./chunk-MYEQTQOG.js';import'./chunk-DXKXt8mt.js';import'./chunk-CFAzj-K1.js';var M=()=>[];function V(i,t){if(i&1){let e=dC();vs(0,"agentos-auth-setting-item",4),Ag("editRequested",function(n){If(e);let p=mC(2);return wf(p.onEdit(n))})("deleteRequested",function(n){If(e);let p=mC(2);return wf(p.onDelete(n))}),fl();}i&2&&Tg("config",t)("showBadge",false);}function F(i,t){if(i&1&&eC(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=mC();tC((e=n.resolveSetting(o.id))?0:-1,e);}}var k=class i{router=g(G);destroyRef=g(we);state=g(v);refresh$=new Tr(void 0);settings$=this.refresh$.pipe(ma(()=>this.state.loadPlatformSettings()));settingItems$=this.settings$.pipe(ue(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe(t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.state.delete(t.id,"platform").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:6,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,o){if(e&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return o.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return o.goBack()}),WC(3,"\u2190 Admin"),fl()(),Dg(4,F,1,1,"ng-template",null,0,fT)),e&2){let n=TC(5);Tg("items",uT(1,3,o.settingItems$)??rT(5,M))("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,Nb],encapsulation:2})};export{k as PlatformAuthSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-DXKXt8mt.js';import {u}from'./chunk-CDiCP0cs.js';import {g as g$1,dd as $,aI as Tr,aD as Ly,bR as ma,a7 as ga,S as ha,u as ue,cD as Rd,bT as Od,a as P,Y as x}from'./main-FZBZNLDT.js';var g="none",N="me",O=class p{nsController=g$1($);userState=g$1(u);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let r=this.loadPlatformProviders().pipe(ga(()=>ha([])));return e?Ly([r,this.loadNamespaceProviders(e).pipe(ga(()=>ha([]))),this.loadUserProviders(e).pipe(ga(()=>ha([]))),this.loadUserProviders("global").pipe(ga(()=>ha([])))]).pipe(ue(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ly([r,this.loadNamespaceProviders("").pipe(ga(()=>ha([]))),this.loadUserProviders("global").pipe(ga(()=>ha([])))]).pipe(ue(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Rd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):ha([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Od(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Od(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=P({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Od(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Od(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=x({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-BJDByX7-.js';import {g,ao as V,G,w as we$1,d8 as M,d9 as he$1,da as fe$1,H as Hi,db as ge$1,F,bQ as bd,m as mT,Q as By,b as U,a7 as ga,S as ha,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a5 as yl,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-VYETRYCE.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-BbLMzp9k.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),fl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),fl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),fl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),fl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),fl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),fl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),fl(),oC(3,ge,2,2,"option",23,se),fl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),fl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),fl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),fl(),vs(2,"span",48),WC(3),fl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),fl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),fl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),fl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),fl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),fl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),fl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),fl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),fl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.submit())}),vs(1,"div",8)(2,"label",9),WC(3," Name "),vs(4,"span",10),WC(5,"*"),fl()(),bg(6,"input",11),HI(),eC(7,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),fl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),fl(),bg(13,"input",15),HI(),fl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),fl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),fl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),fl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),fl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),fl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),fl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),fl(),HI(),fl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),fl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),fl()(),eC(52,Pe,2,0,"span",12),fl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),fl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),fl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),fl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),fl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),fl(),HI(),fl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),fl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),fl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),fl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),fl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),fl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>ha([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,pe,2,0,"p",5)(9,Fe,86,26,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),yl(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-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-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
1
|
+
import {c}from'./chunk-Dx3RUcFR.js';import {g,ao as V,G,w as we$1,d8 as M,d9 as he$1,da as fe$1,H as Hi,db as ge$1,F,bQ as bd,m as mT,Q as By,b as U,a7 as ga,S as ha,z as z$1,a as P,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a5 as yl,t as tC,a9 as dC,o as bg,a3 as HI,q as oC,ac as mC,r as Tg,y as Hg,a6 as $I,x as iC,a8 as Zg,aa as If,ab as wf,bj as yh}from'./main-FZBZNLDT.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-MYEQTQOG.js';var A=(n,t)=>t.value,se=(n,t)=>t.id;function pe(n,t){n&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ue(n,t){n&1&&(vs(0,"span",12),WC(1," Name is required. "),fl());}function fe(n,t){if(n&1&&(vs(0,"p",40),WC(1),fl(),vs(2,"span",13),WC(3,"Agent Config cannot be changed after creation."),fl()),n&2){let e=mC(2);XE(),Zg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(vs(0,"a",41),WC(1,"Add an agent config"),fl(),WC(2," first. ")),n&2){let e=mC(3);Tg("href","/agentos/"+e.namespaceId+"/agent-configs/new",yh);}}function he(n,t){if(n&1&&(vs(0,"p",13),WC(1," No agent configs available in this scope yet. "),eC(2,_e,3,1),fl()),n&2){let e=mC(2);XE(2),tC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.id),XE(),Zg(e.name);}}function Ce(n,t){n&1&&(vs(0,"span",12),WC(1,"Agent Config is required."),fl());}function ve(n,t){if(n&1&&(vs(0,"select",42)(1,"option",43),WC(2,"Select an agent config\u2026"),fl(),oC(3,ge,2,2,"option",23,se),fl(),HI(),eC(5,Ce,2,0,"span",12),vs(6,"span",13),WC(7,"Immutable after creation."),fl()),n&2){let e=mC(2);Tg("formControl",e.agentConfigIdControl),$I(),XE(3),iC(e.availableAgentConfigs()),XE(2),tC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function ye(n,t){n&1&&(vs(0,"span",12),WC(1,"Opening message is required."),fl());}function be(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function xe(n,t){if(n&1){let e=dC();vs(0,"label",46)(1,"input",47),Ag("change",function(){let h=If(e).$implicit,P=mC(3);return wf(P.toggleDay(h.value))}),fl(),vs(2,"span",48),WC(3),fl()();}if(n&2){let e=t.$implicit,l=mC(3);XE(),Tg("checked",l.isDaySelected(e.value)),XE(2),Zg(e.label);}}function Se(n,t){if(n&1&&(vs(0,"div",8)(1,"span",44),WC(2,"Days of week"),fl(),vs(3,"div",45),oC(4,xe,4,2,"label",46,A),fl(),vs(6,"span",13),WC(7,"Leave empty to run every day of the week."),fl()()),n&2){let e=mC(2);XE(4),iC(e.dayOptions);}}function Pe(n,t){n&1&&(vs(0,"span",12),WC(1,"Valid time is required (HH:mm)."),fl());}function Ee(n,t){n&1&&(vs(0,"span",12),WC(1,"Start date is required."),fl());}function Me(n,t){if(n&1&&(vs(0,"option",23),WC(1),fl()),n&2){let e=t.$implicit;Tg("value",e.value),XE(),Zg(e.label);}}function Oe(n,t){n&1&&(vs(0,"span",12),WC(1,"End date is required."),fl());}function De(n,t){if(n&1&&(vs(0,"div",8)(1,"label",49),WC(2," End date "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",50),HI(),eC(6,Oe,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),Tg("formControl",e.endDateControl),$I(),XE(),tC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(vs(0,"span",12),WC(1,"Must be at least 1."),fl());}function we(n,t){if(n&1&&(vs(0,"div",8)(1,"label",51),WC(2," Number of occurrences "),vs(3,"span",10),WC(4,"*"),fl()(),bg(5,"input",52),HI(),eC(6,Te,2,0,"span",12),fl()),n&2){let e=mC(2);XE(5),Hg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),Tg("formControl",e.occurrenceCountControl),$I(),XE(),tC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){if(n&1&&(vs(0,"p",36),WC(1),fl()),n&2){let e=mC(2);XE(),Zg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let h=mC();return wf(h.submit())}),vs(1,"div",8)(2,"label",9),WC(3," Name "),vs(4,"span",10),WC(5,"*"),fl()(),bg(6,"input",11),HI(),eC(7,ue,2,0,"span",12),vs(8,"span",13),WC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),fl()(),vs(10,"div",8)(11,"label",14),WC(12,"Description"),fl(),bg(13,"input",15),HI(),fl(),vs(14,"div",8)(15,"label",16),WC(16," Agent Config "),vs(17,"span",10),WC(18,"*"),fl()(),eC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),fl(),vs(22,"div",8)(23,"label",17),WC(24," Opening message "),vs(25,"span",10),WC(26,"*"),fl()(),bg(27,"textarea",18),HI(),eC(28,ye,2,0,"span",12),vs(29,"span",13),WC(30," The message sent to the agent when the scheduled prompt fires. "),fl()(),vs(31,"fieldset",19)(32,"legend",20),WC(33,"Recurrence"),fl(),vs(34,"div",8)(35,"label",21),WC(36," Unit "),vs(37,"span",10),WC(38,"*"),fl()(),vs(39,"select",22),oC(40,be,2,2,"option",23,A),fl(),HI(),fl(),eC(42,Se,8,0,"div",8),vs(43,"div",8)(44,"label",24),WC(45," Time (UTC) "),vs(46,"span",10),WC(47,"*"),fl()(),vs(48,"div",25),bg(49,"input",26),HI(),vs(50,"span",27),WC(51,"UTC"),fl()(),eC(52,Pe,2,0,"span",12),fl()(),vs(53,"fieldset",19)(54,"legend",20),WC(55,"Planning"),fl(),vs(56,"div",8)(57,"label",28),WC(58," Start date "),vs(59,"span",10),WC(60,"*"),fl()(),bg(61,"input",29),HI(),eC(62,Ee,2,0,"span",12),fl(),vs(63,"div",8)(64,"label",30),WC(65," Ends "),vs(66,"span",10),WC(67,"*"),fl()(),vs(68,"select",31),oC(69,Me,2,2,"option",23,A),fl(),HI(),fl(),eC(71,De,7,4,"div",8),eC(72,we,7,4,"div",8),fl(),vs(73,"div",8)(74,"label",32),bg(75,"input",33),HI(),vs(76,"span",34),WC(77,"Enabled"),fl()(),vs(78,"p",35),WC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),fl()(),eC(80,ke,2,1,"p",36),vs(81,"div",37)(82,"button",38),WC(83),fl(),vs(84,"button",39),Ag("click",function(){If(e);let h=mC();return wf(h.cancel())}),WC(85,"Cancel"),fl()()();}if(n&2){let e=mC();Tg("formGroup",e.form),XE(6),Hg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),Tg("formControl",e.nameControl),$I(),XE(),tC(e.nameControl.invalid&&e.nameControl.touched?7:-1),XE(6),Tg("formControl",e.descriptionControl),$I(),XE(6),tC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),XE(8),Hg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),Tg("formControl",e.promptContentControl),$I(),XE(),tC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),XE(11),Tg("formControl",e.unitControl),$I(),XE(),iC(e.schedulerUnits),XE(2),tC(e.showDayFilter()?42:-1),XE(7),Tg("formControl",e.timeUtcControl),$I(),XE(3),tC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),XE(9),Hg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),Tg("formControl",e.startDateControl),$I(),XE(),tC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),XE(6),Tg("formControl",e.endTypeControl),$I(),XE(),iC(e.endTypes),XE(2),tC(e.showEndDate()?71:-1),XE(),tC(e.showOccurrenceCount()?72:-1),XE(3),Tg("formControl",e.enabledControl),$I(),XE(5),tC(e.errorMessage()?80:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var me=class n{route=g(V);router=g(G);destroyRef=g(we$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(fe$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(he$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true})},{validators:[Ne,Ie]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);errorMessage=Hi(null);SchedulerUnit=fe$1;SchedulerEndType=he$1;schedulerUnits=[{value:fe$1.WEEK,label:"Week(s)"},{value:fe$1.MONTH,label:"Month(s)"}];endTypes=[{value:he$1.NEVER,label:"Never"},{value:he$1.ON_DATE,label:"On date"},{value:he$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ge$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(bd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(bd(this.endTypeControl.value)));showDayFilter=mT(()=>this.unitSignal()===fe$1.WEEK);showEndDate=mT(()=>this.endTypeSignal()===he$1.ON_DATE);showOccurrenceCount=mT(()=>this.endTypeSignal()===he$1.OCCURRENCES);agentConfigs=Hi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ve());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),By({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>ha([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled);}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(h=>h!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===he$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===he$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:P=>{this.isSubmitting.set(false),P.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):P.status===400?this.errorMessage.set(P.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return l.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,pe,2,0,"p",5)(9,Fe,86,26,"form",6),fl()),e&2&&(XE(5),yl(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),XE(2),yl(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),XE(),tC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-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-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ne(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===he$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ie(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===he$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ve(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{me as ScheduledPromptFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Q as Qe,Y as Ye$1,E as Et$1,y as yt$3}from'./chunk-
|
|
1
|
+
import {Q as Qe,Y as Ye$1,E as Et$1,y as yt$3}from'./chunk-DDLM6Cth.js';import {an as ce,al as yt$1,g,O as Ot$1,F,u as ue,H as Hi,m as mT,R as Re,P,K as c,G,L,U,ap as Vy,A as Aw,i as hr,j as Gn,bz as vC,n as eC,v as vs,l as Ag,W as WC,k as fl,bA as DC,o as bg,t as tC,X as XE,y as Hg,r as Tg,C as Cg,bj as yh,a8 as Zg,D as Fg,I as IC,E as wC,aK as Do,aL as qn,aN as wt$1,ca as mB,N,h as he,w as we$1,cc as Hf,z as z$1,a as P$1,b as U$1,cd as Sb,Q as By,q as oC,x as iC,aw as pl,bn as nC,ax as hl,b5 as Sg,b$ as Ng,ad as Vg,a9 as dC,aa as If,ac as mC,ab as wf,ai as Jg,aj as KC,a3 as HI,ak as Xg,a6 as $I,af as Dg,ag as fT,a5 as yl,aF as me$1,ae as Ot$2,ce as W$1,Y as x,T as TC,cf as iT,cg as Mg,b3 as oT}from'./main-FZBZNLDT.js';import {W}from'./chunk-Bx6U7hp8.js';import {T as Tn$1,c as ce$1}from'./chunk-lbDJ4ttg.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-Bc7OrHjR.js';import {t as ti,Y as Ye,Z as Zn,c as cn$1,y as yt$2,w as wt,X as Xt$1}from'./chunk-MYEQTQOG.js';var bt=(()=>{class n{static \u0275fac=function(i){return new(i||n)};static \u0275mod=Do({type:n});static \u0275inj=qn({imports:[wt$1]})}return n})();var Ot=(n,t)=>({subThreads:n,depth:t}),Tt=n=>({subThreads:n,depth:1}),xt=(n,t)=>t.id,kt=(n,t)=>t.label;function Et(n,t){if(n&1){let e=dC();vs(0,"mat-icon",10),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(3);return wf(f.toggleSubThreads(o,s.id))}),WC(1),fl();}if(n&2){let e=mC().$implicit,i=mC(3);XE(),Zg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Dt(n,t){n&1&&Mg(0);}function Nt(n,t){if(n&1&&Dg(0,Dt,1,0,"ng-container",11),n&2){let e=mC().$implicit,i=mC().depth;mC();let o=TC(1);Tg("ngTemplateOutlet",o)("ngTemplateOutletContext",iT(2,Ot,e.subThreads,i+1));}}function jt(n,t){if(n&1){let e=dC();vs(0,"div",5)(1,"a",6),Ag("click",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())})("keydown.enter",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())})("keydown.space",function(o){let s=If(e).$implicit;return mC(3).selectThread(s.id),wf(o.preventDefault())}),eC(2,Et,2,1,"mat-icon",7),vs(3,"span",8),WC(4),fl(),vs(5,"span",9),WC(6),fl()()(),eC(7,Nt,1,5,"ng-container");}if(n&2){let e=t.$implicit,i=mC().depth,o=mC(2);Vg("--sub-depth",i),Hg("current",e.id===o.currentThread()?.id),XE(2),tC(e.subThreads?.length?2:-1),XE(2),Zg(e.delegatedAgentName||"Agent"),XE(2),Zg(e.delegatedTask||e.name),XE(),tC(o.isParentExpanded(e.id)&&e.subThreads?.length?7:-1);}}function Vt(n,t){if(n&1&&oC(0,jt,8,8,null,null,xt),n&2){let e=t.subThreads;iC(e);}}function Ft(n,t){n&1&&(vs(0,"div",4),bg(1,"span",12),vs(2,"span",13),WC(3,"Loading threads..."),fl()());}function It(n,t){if(n&1&&(vs(0,"div",27),WC(1),fl()),n&2){let e=mC(6);XE(),Zg(e.renameErrorMessage);}}function zt(n,t){if(n&1){let e=dC();vs(0,"div",18)(1,"input",26),Jg("ngModelChange",function(o){If(e);let s=mC(5);return KC(s.editingThreadName,o)||(s.editingThreadName=o),wf(o)}),Ag("keydown",function(o){If(e);let s=mC(5);return wf(s.onEditKeydown(o))})("blur",function(){If(e);let o=mC(5);return wf(o.onEditBlur())})("click",function(o){return o.stopPropagation()}),fl(),HI(),eC(2,It,2,1,"div",27),fl();}if(n&2){let e=mC(5);XE(),Xg("ngModel",e.editingThreadName),Tg("disabled",e.isRenamingThread),$I(),XE(),tC(e.renameErrorMessage?2:-1);}}function At(n,t){if(n&1){let e=dC();vs(0,"mat-icon",10),Ag("click",function(o){If(e);let s=mC(2).$implicit,f=mC(4);return wf(f.toggleSubThreads(o,s.id))}),WC(1),fl();}if(n&2){let e=mC(2).$implicit,i=mC(4);XE(),Zg(i.isParentExpanded(e.id)?"expand_more":"chevron_right");}}function Lt(n,t){if(n&1&&(vs(0,"span",29),WC(1),fl()),n&2){let e=mC(2).$implicit;XE(),Zg(e.name);}}function Rt(n,t){n&1&&(bg(0,"mat-spinner",31),vs(1,"span",32),WC(2,"Generating name..."),fl()),n&2&&Tg("diameter",16);}function $t(n,t){n&1&&(vs(0,"mat-icon",30),WC(1,"group"),fl());}function Bt(n,t){if(n&1){let e=dC();vs(0,"a",28),Ag("click",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())})("keydown.enter",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())})("keydown.space",function(o){If(e);let s=mC().$implicit;return mC(4).selectThread(s.id),wf(o.preventDefault())}),eC(1,At,2,1,"mat-icon",7),eC(2,Lt,2,1,"span",29)(3,Rt,3,1),eC(4,$t,2,0,"mat-icon",30),fl();}if(n&2){let e=mC().$implicit,i=mC(4);Tg("matTooltip",e.name?e.name+`
|
|
2
2
|
|
|
3
3
|
`+(e.summary||""):e.summary||"")("matTooltipDisabled",!e.summary),XE(),tC(e.subThreads?.length?1:-1),XE(),tC(e.name?2:3),XE(2),tC(i.isSharedThread(e)?4:-1);}}function Ut(n,t){if(n&1){let e=dC();vs(0,"button",33),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.startEditingThreadName(o,s))}),vs(1,"mat-icon"),WC(2,"edit"),fl()();}}function Xt(n,t){if(n&1){let e=dC();vs(0,"button",34),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.markActive(o,s))}),vs(1,"mat-icon"),WC(2,"replay"),fl()();}}function Qt(n,t){if(n&1){let e=dC();vs(0,"button",35),Ag("click",function(o){If(e);let s=mC().$implicit,f=mC(4);return wf(f.markDone(o,s))}),vs(1,"mat-icon"),WC(2,"check_circle_outline"),fl()();}}function Gt(n,t){n&1&&Mg(0);}function Ht(n,t){if(n&1&&Dg(0,Gt,1,0,"ng-container",11),n&2){let e=mC().$implicit;mC(3);let i=TC(1);Tg("ngTemplateOutlet",i)("ngTemplateOutletContext",oT(2,Tt,e.subThreads));}}function qt(n,t){if(n&1){let e=dC();vs(0,"div",17),eC(1,zt,3,3,"div",18)(2,Bt,5,5,"a",19),vs(3,"div",20),eC(4,Ut,3,0,"button",21),eC(5,Xt,3,0,"button",22)(6,Qt,3,0,"button",23),vs(7,"button",24),Ag("click",function(o){let s=If(e).$implicit,f=mC(4);return wf(f.toggleStar(o,s))}),vs(8,"mat-icon"),WC(9),fl()(),vs(10,"button",25),Ag("click",function(o){let s=If(e).$implicit,f=mC(4);return wf(f.deleteThread(o,s))}),vs(11,"mat-icon"),WC(12,"delete"),fl()()()(),eC(13,Ht,1,4,"ng-container");}if(n&2){let e=t.$implicit,i=mC(4);Hg("current",e.id===i.currentThread()?.id),XE(),tC(i.editingThreadId===e.id?1:2),XE(3),tC(i.editingThreadId!==e.id&&e.name?4:-1),XE(),tC(e.closedByUser?5:6),XE(2),Hg("starred",i.isStarred(e)),Tg("title",i.isStarred(e)?"Unstar thread":"Star thread"),XE(2),Zg(i.isStarred(e)?"star":"star_outline"),XE(4),tC(i.isParentExpanded(e.id)&&e.subThreads?.length?13:-1);}}function Wt(n,t){if(n&1&&(vs(0,"div",14)(1,"div",16),WC(2),fl(),oC(3,qt,14,10,null,null,xt),fl()),n&2){let e=t.$implicit;XE(2),Zg(e.label),XE(),iC(e.threads);}}function Jt(n,t){n&1&&(vs(0,"div",15),WC(1,"No existing threads"),fl());}function Yt(n,t){if(n&1&&(vs(0,"div",15),WC(1),fl()),n&2){let e=mC(3);XE(),yl('No threads matching "',e.searchQuery(),'"');}}function Zt(n,t){if(n&1&&(oC(0,Wt,5,1,"div",14,kt),eC(2,Jt,2,0,"div",15)(3,Yt,2,1,"div",15)),n&2){let e=mC(2);iC(e.getGroupedThreads()),XE(2),tC(!e.threads()?.length&&!e.searchQuery()?2:e.searchQuery()&&e.getGroupedThreads().length===0?3:-1);}}function Kt(n,t){if(n&1&&(Dg(0,Vt,2,0,"ng-template",null,0,fT),vs(2,"div",3),eC(3,Ft,4,0,"div",4)(4,Zt,4,1),fl()),n&2){let e=mC();XE(3),tC(e.isLoadingThreadList()?3:4);}}function en(n,t){n&1&&(vs(0,"span",36),WC(1,"No project selected"),fl());}function tn(n,t){n&1&&(vs(0,"span",36),WC(1,"Loading..."),fl());}function nn(n,t){if(n&1&&(vs(0,"div",2),eC(1,en,2,0,"span",36)(2,tn,2,0,"span",36),fl()),n&2){let e=mC();XE(),tC(e.currentProject()?.name?2:1);}}var we=class n{projects=null;searchMode=false;searchQuery=mB("");searchModeChange=new yt$1;threadSelected=new yt$1;projectStateService=g(P);threadStateService=g(U);threadApiService=g(N);userService=g(he);router=g(G);destroyRef=g(we$1);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(){Hf(()=>{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 T=h.parentThreadId;A.has(T)||A.set(T,[]),A.get(T).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(T=>T.name.toLowerCase().includes(h)||T.summary&&T.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 T=new Date(h.modifiedDate);T.setHours(0,0,0,0);let j=Ae.getTime()-T.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((T,j)=>T.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=Aw({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&&(vs(0,"div",1),Ag("click",function(s){return s.stopPropagation()})("keydown",function(s){return s.stopPropagation()}),eC(1,Kt,5,1)(2,nn,3,1,"div",2),fl()),e&2&&(XE(),tC(i.currentProject()?.name?1:2));},dependencies:[Sb,ti,Ye,Zn,Xt$1,cn$1,yt$2,wt,hr,Gn,Tn$1,ce$1,Et$1,yt$3,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=dC();vs(0,"button",12),Ag("click",function(){If(e);let o=mC().$implicit,s=mC();return wf(s.start(o.name))}),vs(1,"mat-icon"),WC(2,"play_arrow"),fl()();}if(n&2){let e=mC().$implicit;Tg("disabled",e.isLoading);}}function sn(n,t){if(n&1){let e=dC();vs(0,"button",13),Ag("click",function(){If(e);let o=mC().$implicit,s=mC();return wf(s.stop(o.name))}),vs(1,"mat-icon"),WC(2,"stop"),fl()();}if(n&2){let e=mC().$implicit;Tg("disabled",e.isLoading);}}function cn(n,t){if(n&1&&(vs(0,"a",8)(1,"mat-icon",14),WC(2,"open_in_new"),fl()()),n&2){let e=mC().$implicit;Tg("href",e.url,yh)("title",e.url);}}function ln(n,t){if(n&1&&(vs(0,"div",15),WC(1),fl()),n&2){let e=mC(),i=e.$implicit,o=e.$index;Vg("order",o*2),XE(),Zg(i.errorMessage);}}function dn(n,t){if(n&1){let e=dC();vs(0,"button",21),Ag("click",function(){If(e);let o=mC(3);return wf(o.onManualRefresh())}),vs(1,"mat-icon"),WC(2,"refresh"),fl()();}}function mn(n,t){if(n&1&&(vs(0,"div",16)(1,"div",17)(2,"span",18),WC(3),fl(),eC(4,dn,3,0,"button",19),fl(),vs(5,"pre",20,0),WC(7),fl()()),n&2){let e=mC(),i=e.$implicit,o=e.$index,s=mC();Vg("order",o*2+1),XE(3),yl("",i.name," logs"),XE(),tC(i.status==="running"?4:-1),XE(3),Zg(s.logs()||"(empty)");}}function pn(n,t){if(n&1){let e=dC();vs(0,"div",2)(1,"span",3),WC(2),fl(),vs(3,"div",4),eC(4,an,3,1,"button",5)(5,sn,3,1,"button",6),vs(6,"span",7),WC(7),fl(),eC(8,cn,3,2,"a",8),vs(9,"button",9),Ag("click",function(){let o=If(e).$implicit,s=mC();return wf(s.toggleLogs(o.name))}),vs(10,"mat-icon"),WC(11),fl()()()(),eC(12,ln,2,3,"div",10),eC(13,mn,8,5,"div",11);}if(n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("order",i*2),XE(2),Zg(e.name),XE(2),tC(e.status==="stopped"?4:5),XE(2),Hg("running",e.status==="running"),XE(),yl(" ",e.status==="running"?"Running":"Stopped"," "),XE(),tC(e.url?8:-1),XE(),Tg("title",o.logsOpenFor()===e.name?"Hide logs":"Show logs"),XE(2),Zg(o.logsOpenFor()===e.name?"expand_less":"terminal"),XE(),tC(e.errorMessage?12:-1),XE(),tC(o.logsOpenFor()===e.name?13:-1);}}var Oe=class n{destroyRef=g(we$1);projectApi=g(c);projectName=mB.required();entryStates=Hi([]);hasPreview=mT(()=>this.entryStates().length>0);logsOpenFor=Hi(null);logs=Hi("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){Hf(()=>{let t=this.projectName();t&&this.onProjectChanged(t);},{}),Hf(()=>{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));By(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=Aw({type:n,selectors:[["app-preview-panel"]],viewQuery:function(e,i){if(e&1&&Fg(on,5),e&2){let o;IC(o=wC())&&(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&&(vs(0,"div",1),oC(1,pn,14,12,null,null,rn),fl()),e&2&&(XE(),iC(i.entryStates()));},dependencies:[hr,Gn,yt$2,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 Te=class n{eventStream=g(me$1);threadState=g(U);ratio=Hi(0);inputTokens=Hi(0);contextWindow=Hi(0);price=Hi(0);iterations=Hi(0);cacheReadTokens=Hi(0);visible=Hi(false);level=mT(()=>{let t=this.ratio();return t<.6?"ok":t<.85?"warning":"danger"});constructor(){this.eventStream.events$.pipe(Ot$2(t=>t instanceof W$1),Ot$2(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(Ot$2(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&&Sg(0,"div",12),n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px")("--rise",e.rise+"px"),Hg("invisible",i>=o.aboveBubbleCount());}}function _n(n,t){if(n&1&&Sg(0,"div",13),n&2){let e=t.$implicit;Vg("--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&&Sg(0,"div",14),n&2){let e=t.$implicit,i=t.$index,o=mC();Vg("--delay",e.delay+"s")("--left",e.left+"%")("--dur",e.dur+"s")("--size",e.size+"px"),Hg("invisible",i>=o.insideBubbleCount());}}var yt=30,Pt=27,hn=40;function O(n,t,e,i=0){return i+(n*137+t*31)%e}var ke=class n{gaugeState=g(Te);sidenavOpen=mB(false);aboveBubbles=Array.from({length:yt},(t,e)=>({delay:O(e,1,30)/10,left:O(e,2,82,5),dur:2.5+O(e,3,20)/10,size:1.5+O(e,4,40)/10,rise:150+O(e,5,150)}));insideBubbles=Array.from({length:Pt},(t,e)=>({delay:O(e,6,20)/10,left:O(e,7,80,5),dur:1.2+O(e,8,15)/10,size:2+O(e,9,35)/10}));foamBubbles=Array.from({length:hn},(t,e)=>({delay:O(e,10,25)/10,left:O(e,11,85,3),dur:1.5+O(e,12,10)/10,size:(3+O(e,13,80)/10)*.75,top:O(e,14,4)+8}));displayRatio=mT(()=>Math.min(100,this.gaugeState.ratio()*100));liquidColor=mT(()=>{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=mT(()=>Math.round(this.gaugeState.ratio()*yt));insideBubbleCount=mT(()=>{let t=this.gaugeState.ratio();return t<.5?0:t<.65?5:t<.8?13:t<.9?20:Pt});foamActive=mT(()=>this.gaugeState.ratio()>=.5);overflowing=mT(()=>this.gaugeState.ratio()>=.9);tooltipText=mT(()=>{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=Aw({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&&(pl(0,"div",0)(1,"div",1)(2,"div",2),oC(3,gn,1,12,"div",3,nC),hl(),pl(5,"div",4),oC(6,_n,1,10,"div",5,nC),hl(),pl(8,"div",6),Sg(9,"div",7),pl(10,"div",8)(11,"div",9)(12,"div",10),oC(13,un,1,10,"div",11,nC),hl()()()()()()),e&2&&(Hg("hidden",i.sidenavOpen()),Ng("title",i.tooltipText()),XE(),Vg("--tube-color",i.liquidColor()),XE(2),iC(i.aboveBubbles),XE(2),Vg("bottom",i.displayRatio()+"%"),Hg("active",i.foamActive()),XE(),iC(i.foamBubbles),XE(5),Vg("height",i.displayRatio(),"%"),XE(2),iC(i.insideBubbles));},styles:['[_nghost-%COMP%]{position:fixed;left:calc(1rem + 10px);z-index:1500;display:block;top:calc(3.5rem + 80px)}.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:#333;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:#333}.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)}}:root:not([data-theme=dark])[_nghost-%COMP%] .tube[_ngcontent-%COMP%], :root:not([data-theme=dark]) [_nghost-%COMP%] .tube[_ngcontent-%COMP%]{background-color:#ddd}:root:not([data-theme=dark])[_nghost-%COMP%] .tube[_ngcontent-%COMP%]:after, :root:not([data-theme=dark]) [_nghost-%COMP%] .tube[_ngcontent-%COMP%]:after{background:#ddd}@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=dC();vs(0,"button",28),Ag("click",function(){If(e);let o=mC();return wf(o.toggle())}),vs(1,"mat-icon"),WC(2,"menu"),fl()(),vs(3,"button",29),Ag("click",function(){If(e);let o=mC();return wf(o.createNewThread())}),vs(4,"mat-icon",10),WC(5,"play_circle"),fl()();}if(n&2){let e=mC();XE(3),Tg("disabled",!e.selectedProjectName());}}function Cn(n,t){if(n&1){let e=dC();vs(0,"div",12)(1,"a",30),Ag("click",function(o){return If(e),mC().openMissionControl(),wf(o.preventDefault())}),vs(2,"mat-icon"),WC(3,"rocket_launch"),fl(),vs(4,"span",31),WC(5,"Task Control"),fl()()();}}function xn(n,t){if(n&1){let e=dC();vs(0,"div",15)(1,"mat-icon",32),WC(2,"search"),fl(),vs(3,"input",33,0),Jg("ngModelChange",function(o){If(e);let s=mC();return KC(s.threadSearchQuery,o)||(s.threadSearchQuery=o),wf(o)}),Ag("input",function(){If(e);let o=mC();return wf(o.onThreadSearchInput())}),fl(),HI(),vs(5,"button",34),Ag("click",function(){If(e);let o=mC();return wf(o.closeThreadSearch())}),vs(6,"mat-icon"),WC(7,"close"),fl()()();}if(n&2){let e=mC();XE(3),Xg("ngModel",e.threadSearchQuery),$I();}}function yn(n,t){if(n&1){let e=dC();vs(0,"div",16)(1,"mat-icon",23),WC(2,"forum"),fl(),vs(3,"span",24),WC(4,"Threads"),fl(),vs(5,"button",35),Ag("click",function(o){If(e);let s=mC();return wf(s.toggleThreadSearch(o))}),vs(6,"mat-icon"),WC(7,"search"),fl()()();}}function Pn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function Sn(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"hub"),fl());}function Mn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function wn(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"tune"),fl());}function On(n,t){n&1&&(vs(0,"div",37)(1,"div",41),bg(2,"app-options-panel",42),fl()());}function Tn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(3).openProjectConfig(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"settings_applications"),fl(),vs(4,"span",24),WC(5,"Project Configuration"),fl()()();}}function kn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"settings_applications"),fl(),vs(4,"span",24),WC(5,"Project config (No project)"),fl()()());}function En(n,t){if(n&1&&eC(0,Tn,6,0,"div",36)(1,kn,6,0,"div",36),n&2){let e=mC(2);tC(e.selectedProjectName()?0:1);}}function Dn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openAgents(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"smart_toy"),fl(),vs(4,"span",24),WC(5,"Agents"),fl()()();}}function Nn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"smart_toy"),fl(),vs(4,"span",24),WC(5,"Agents (No project)"),fl()()());}function jn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openPrompts(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"description"),fl(),vs(4,"span",24),WC(5,"Prompts"),fl()()();}}function Vn(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"description"),fl(),vs(4,"span",24),WC(5,"Prompts (No project)"),fl()()());}function Fn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).openSchedulers(),o.preventDefault(),wf(o.stopPropagation())}),vs(2,"mat-icon",23),WC(3,"schedule"),fl(),vs(4,"span",24),WC(5,"Schedulers"),fl()()();}}function In(n,t){n&1&&(vs(0,"div",36)(1,"a",43)(2,"mat-icon",23),WC(3,"schedule"),fl(),vs(4,"span",24),WC(5,"Schedulers (No project)"),fl()()());}function zn(n,t){n&1&&(vs(0,"mat-icon",22),WC(1,"keyboard_arrow_up"),fl());}function An(n,t){n&1&&(vs(0,"mat-icon",23),WC(1,"rocket_launch"),fl());}function Ln(n,t){if(n&1&&(vs(0,"div",37),bg(1,"app-preview-panel",44),fl()),n&2){let e=mC(3);XE(),Tg("projectName",e.selectedProjectName());}}function Rn(n,t){if(n&1){let e=dC();vs(0,"div",36)(1,"a",21),Ag("click",function(o){return If(e),mC(2).toggleSection("preview"),o.preventDefault(),wf(o.stopPropagation())}),eC(2,zn,2,0,"mat-icon",22)(3,An,2,0,"mat-icon",23),vs(4,"span",24),WC(5,"Preview Server"),fl()(),eC(6,Ln,2,1,"div",37),fl();}if(n&2){let e=mC(2);Hg("expanded",e.expandedSections.preview),XE(),Hg("active",e.expandedSections.preview),XE(),tC(e.expandedSections.preview?2:3),XE(4),tC(e.expandedSections.preview?6:-1);}}function $n(n,t){if(n&1){let e=dC();vs(0,"div",25)(1,"div",36)(2,"a",21),Ag("click",function(o){return If(e),mC().toggleSection("config"),wf(o.preventDefault())}),eC(3,Mn,2,0,"mat-icon",22)(4,wn,2,0,"mat-icon",23),vs(5,"span",24),WC(6,"Preferences"),fl()(),eC(7,On,3,0,"div",37),fl(),vs(8,"div",36)(9,"a",21),Ag("click",function(o){return If(e),mC().openTokenUsage(),o.preventDefault(),wf(o.stopPropagation())}),vs(10,"mat-icon",23),WC(11,"data_usage"),fl(),vs(12,"span",24),WC(13,"Token Usage"),fl()()(),vs(14,"div",36)(15,"a",21),Ag("click",function(o){return If(e),mC().openUserConfig(),o.preventDefault(),wf(o.stopPropagation())}),vs(16,"mat-icon",23),WC(17,"manage_accounts"),fl(),vs(18,"span",24),WC(19,"User Configuration"),fl()()(),eC(20,En,2,1),eC(21,Dn,6,0,"div",36)(22,Nn,6,0,"div",36),eC(23,jn,6,0,"div",36)(24,Vn,6,0,"div",36),eC(25,Fn,6,0,"div",36)(26,In,6,0,"div",36),eC(27,Rn,7,6,"div",38),vs(28,"div",36)(29,"a",39),bg(30,"img",40),vs(31,"span",24),WC(32,"Contribute on GitHub"),fl()()()();}if(n&2){let e=mC();XE(),Hg("expanded",e.expandedSections.config),XE(),Hg("active",e.expandedSections.config),XE(),tC(e.expandedSections.config?3:4),XE(4),tC(e.expandedSections.config?7:-1),XE(13),tC(e.isAdmin?20:-1),XE(),tC(e.selectedProjectName()?21:22),XE(2),tC(e.selectedProjectName()?23:24),XE(2),tC(e.selectedProjectName()?25:26),XE(2),tC(e.hasPreviewConfig()?27:-1),XE(3),Cg("src","CODAY-Logo.png",yh);}}function Bn(n,t){if(n&1){let e=dC();vs(0,"div",27)(1,"mat-icon",45),WC(2,"warning"),fl(),vs(3,"span",46),WC(4),fl(),vs(5,"button",47),Ag("click",function(){If(e);let o=mC();return wf(o.configErrorMessage="")}),vs(6,"mat-icon"),WC(7,"close"),fl()()();}if(n&2){let e=mC();XE(4),Zg(e.configErrorMessage);}}var St=class n{destroy$=new ce;sidenavStateChange=new yt$1;drawerOpen=false;breakpointObserver=g(Ot$1);isDesktop=F(this.breakpointObserver.observe("(min-width: 1400px)").pipe(ue(t=>t.matches)),{initialValue:false});userOpenPreference=Hi(true);isOpen=mT(()=>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(ue(t=>t?.name)));isProjectVolatile=F(this.projectStateService.selectedProject$.pipe(ue(t=>t?.config?.volatile||false)));forcedProject=F(this.projectStateService.forcedProject$);hasPreviewConfig=F(this.projectStateService.selectedProject$.pipe(ue(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(Vy(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(Vy(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(Qe,{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(Vy(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(Vy(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(Qe,{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(Vy(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=Aw({type:n,selectors:[["app-sidenav"]],viewQuery:function(e,i){if(e&1&&Fg(fn,5),e&2){let o;IC(o=wC())&&(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&&(vC(),eC(0,vn,6,1),vs(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),Ag("closed",function(){return i.close()}),vs(3,"div",3)(4,"button",4),Ag("click",function(){return i.close()}),vs(5,"mat-icon"),WC(6,"chevron_left"),fl()(),vs(7,"img",5),Ag("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()}),fl(),vs(8,"div",6)(9,"h2",7),WC(10),fl()()(),vs(11,"div",8)(12,"a",9),Ag("click",function(s){return i.createNewThread(),s.preventDefault()}),vs(13,"mat-icon",10),WC(14,"play_circle"),fl(),vs(15,"span",11),WC(16,"Start a new thread"),fl()()(),eC(17,Cn,6,0,"div",12),vs(18,"div",13)(19,"div",14),eC(20,xn,8,1,"div",15)(21,yn,8,0,"div",16),vs(22,"div",17)(23,"app-thread-selector",18),Ag("searchModeChange",function(s){return i.onThreadSearchModeChange(s)})("threadSelected",function(){return i.onThreadSelectedOnMobile()}),fl()()()(),vs(24,"div",19)(25,"div",20)(26,"a",21),Ag("click",function(s){return i.toggleSection("settings"),s.preventDefault()}),eC(27,Pn,2,0,"mat-icon",22)(28,Sn,2,0,"mat-icon",23),vs(29,"span",24),WC(30,"Control Center"),fl()(),eC(31,$n,33,12,"div",25),fl()()(),vs(32,"mat-sidenav-content"),DC(33),fl()(),bg(34,"app-context-gauge",26),eC(35,Bn,8,1,"div",27)),e&2&&(tC(!i.isOpen()&&!i.drawerOpen?0:-1),XE(),Hg("sidenav-open",i.isOpen()),Tg("hasBackdrop",false),XE(),Tg("opened",i.isOpen())("disableClose",true),XE(5),Cg("src","CODAY-Logo.png",yh),XE(3),Zg(i.selectedProjectName()),XE(7),tC(i.selectedProjectName()?17:-1),XE(3),tC(i.isThreadSearchActive?20:21),XE(3),Tg("searchMode",i.isThreadSearchActive)("searchQuery",i.threadSearchQuery),XE(),Hg("is-admin",i.isAdmin),XE(),Hg("expanded",i.expandedSections.settings),XE(),Hg("active",i.expandedSections.settings),XE(),tC(i.expandedSections.settings?27:28),XE(4),tC(i.expandedSections.settings?31:-1),XE(),Hg("sidenav-closed-offset",!i.isOpen()),XE(2),Tg("sidenavOpen",i.isOpen()),XE(),tC(i.configErrorMessage?35:-1));},dependencies:[ti,Ye,Zn,cn$1,ui,me,fi,Yt$1,yt$2,wt,hr,Gn,He,bt,Ye$1,we,Oe,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 {K as Kn,Z as Zn,S as Se}from'./chunk-
|
|
1
|
+
import {K as Kn,Z as Zn,S as Se}from'./chunk-DdIe-Q8z.js';import {ca as mB,cb as gB,H as Hi,m as mT,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,C as Cg,a5 as yl,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-FZBZNLDT.js';function I(t,d){if(t&1&&(vs(0,"span",4),WC(1),fl()),t&2){let e=mC();Cg("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),XE(),yl(" ",e.badge().label," ");}}function E(t,d){if(t&1&&(vs(0,"span",6),WC(1),fl()),t&2){let e=mC();XE(),Zg(e.config().baseUrl);}}function R(t,d){if(t&1){let e=dC();vs(0,"span",8),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",9),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",10),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteCancelled())}),fl();}}function k(t,d){if(t&1){let e=dC();vs(0,"ds-kebab-menu",13),Ag("itemSelected",function(l){If(e);let A=mC(2);return wf(A.onMenuAction(l))}),fl();}if(t&2){let e=mC(2);Tg("items",e.menuItems());}}function q(t,d){if(t&1){let e=dC();vs(0,"ds-icon-button",11),Ag("action",function(){If(e);let l=mC();return wf(l.onDuplicate())}),fl(),eC(1,k,1,1,"ds-kebab-menu",12);}if(t&2){let e=mC();XE(),tC(e.readOnly()?-1:1);}}var B=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration de niveau plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),S=class t{config=mB.required();scope=mB.required();readOnly=mB(false);showBadge=mB(true);editRequested=gB();deleteRequested=gB();duplicateRequested=gB();pendingDelete=Hi(false);badge=mT(()=>B[this.scope()]);menuItems=mT(()=>[{key:"edit",label:"Edit provider",icon:"edit"},{key:"delete",label:"Delete provider",icon:"delete",variant:"danger"}]);onMenuAction(d){switch(d){case "edit":this.editRequested.emit(this.config());break;case "delete":this.pendingDelete.set(true);break}}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Aw({type:t,selectors:[["agentos-ai-provider-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:5,consts:[["role","listitem","dsBlueprint","",1,"ai-provider-item"],[1,"ai-provider-item__body"],[1,"ai-provider-item__heading"],[1,"ai-provider-item__name"],[1,"ai-provider-item__badge"],[1,"ai-provider-item__type"],[1,"ai-provider-item__url"],[1,"ai-provider-item__actions"],[1,"ai-provider-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this provider",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),WC(4),fl(),eC(5,I,2,3,"span",4),fl(),vs(6,"span",5),WC(7),fl(),eC(8,E,2,1,"span",6),fl(),vs(9,"div",7),eC(10,R,4,0)(11,q,2,1),fl()()),e&2&&(XE(4),Zg(o.config().name),XE(),tC(o.showBadge()?5:-1),XE(2),Zg(o.config().apiType),XE(),tC(o.config().baseUrl?8:-1),XE(2),tC(o.pendingDelete()?10:11));},dependencies:[Kn,Zn,Se],styles:[".ai-provider-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.ai-provider-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-provider-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.ai-provider-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.ai-provider-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;border-radius:0;padding:.1rem .4rem;line-height:1.2;white-space:nowrap}.ai-provider-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent}.ai-provider-item__badge[data-variant=info][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-info) 40%,transparent);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.ai-provider-item__badge[data-variant=warning][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-warning) 40%,transparent);color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent)}.ai-provider-item__type[_ngcontent-%COMP%], .ai-provider-item__url[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover .ai-provider-item__actions[_ngcontent-%COMP%], .ai-provider-item[_ngcontent-%COMP%]:focus-within .ai-provider-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-provider-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {y}from'./chunk-
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {y}from'./chunk-CweOwCOY.js';import {v}from'./chunk-BkZgPVhu.js';import {g,ao as V,G,w as we,H as Hi,u as ue,b as U$1,bR as ma,S as ha,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,W as WC,X as XE,a8 as Zg,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-FZBZNLDT.js';import {O}from'./chunk-YvUhHp6t.js';import'./chunk-CDiCP0cs.js';import {W as Wn,S as Se}from'./chunk-DdIe-Q8z.js';import'./chunk-Bc7OrHjR.js';import'./chunk-MYEQTQOG.js';import'./chunk-DXKXt8mt.js';import'./chunk-CFAzj-K1.js';var z=()=>[];function W(o,e){if(o&1&&(vs(0,"p",3),WC(1),fl()),o&2){let t=mC().$implicit;XE(),Zg(t.name);}}function U(o,e){if(o&1){let t=dC();vs(0,"agentos-integration-config-item",5),Ag("editRequested",function(){let i=If(t),r=mC(2);return wf(r.onEdit(i))})("deleteRequested",function(){let i=If(t),r=mC(2);return wf(r.onDelete(i))})("duplicateRequested",function(){let i=If(t),r=mC(2);return wf(r.onDuplicate(i))}),fl();}if(o&2){let t=e,n=mC(2);Tg("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin());}}function X(o,e){if(o&1&&eC(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=mC();tC(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t);}}var k=Object.freeze({platform:"Configurations plateforme",namespace:"Configurations du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class o{route=g(V);router=g(G);destroyRef=g(we);state=g(y);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Hi(false);listItems$=this.state.vm$.pipe(ue(e=>this.toListItems(e)));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(ue(e=>e.get("namespaceId")??""),ma(e=>e?this.namespaceRole.isAdminOfNamespace$(e):ha(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe(e=>{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,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}onEdit(e){let t=e.config.id??"";this.router.navigate(["/agentos",this.namespaceId,"integrations",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(`[IntegrationsAllScopes] Delete failed for ${e.scope}:${t}:`,n);}});}onDuplicate(e){if(!e.config.id)return;let n=(e.scope==="namespace"||e.scope==="platform")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n,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:"Aucune configuration",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.integrationType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:6,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"integrations-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return n.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return n.goBack()}),fl()(),Dg(3,X,2,1,"ng-template",null,0,fT)),t&2){let i=TC(4);Tg("items",uT(1,3,n.listItems$)??rT(5,z))("showCreate",true)("itemTemplate",i);}},dependencies:[Wn,O,Se,Nb],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"]})};export{j as IntegrationsAllScopesComponent};
|