@whoz-oss/coday-client 3.10.1 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-538NlE7s.js → chunk-2R-L-8TB.js} +1 -1
- package/browser/{chunk-BTvzcZ1s.js → chunk-B64oBHQ_.js} +1 -1
- package/browser/{chunk-CE3CVQYJ.js → chunk-B6GXI9z-.js} +1 -1
- package/browser/{chunk-C2fhkSx5.js → chunk-B9IQiMog.js} +1 -1
- package/browser/{chunk-LlG18Htx.js → chunk-BESIk8ll.js} +6 -6
- package/browser/{chunk-B5rsaW2b.js → chunk-BM9I1k6S.js} +1 -1
- package/browser/{chunk-C2rlLV-W.js → chunk-BOq6QumJ.js} +5 -5
- package/browser/{chunk-DhYK3aRa.js → chunk-BQ7Z34pK.js} +1 -1
- package/browser/{chunk-DxhQHX1Y.js → chunk-BR4Pl8xo.js} +1 -1
- package/browser/{chunk-CUmZcEGx.js → chunk-BSY9MBD-.js} +6 -6
- package/browser/{chunk-TngDHyxp.js → chunk-BUALjXbx.js} +1 -1
- package/browser/{chunk-BuSLhs6I.js → chunk-BUJvZgLu.js} +1 -1
- package/browser/{chunk-CFU4PT4-.js → chunk-BUpmxKd8.js} +1 -1
- package/browser/{chunk-DkFy_8tW.js → chunk-BWqySSd7.js} +1 -1
- package/browser/chunk-Bf1Bttqy.js +9 -0
- package/browser/chunk-Bsv9CCXL.js +1 -0
- package/browser/{chunk-BkVtgsRG.js → chunk-BxnUTBZC.js} +1 -1
- package/browser/{chunk-B8YsdH5W.js → chunk-Bz081WAa.js} +3 -3
- package/browser/{chunk-zmM38Yul.js → chunk-BzcZylVP.js} +3 -3
- package/browser/{chunk-CFQpQly7.js → chunk-CCFtehVS.js} +2 -2
- package/browser/{chunk-DbmrZGxd.js → chunk-CCQglZL5.js} +1 -1
- package/browser/{chunk-BA23pyYd.js → chunk-CGJJDRqH.js} +1 -1
- package/browser/{chunk-BM08gUt6.js → chunk-CJIcHr4L.js} +1 -1
- package/browser/{chunk-TxtSVoMY.js → chunk-CNRDeQvk.js} +1 -1
- package/browser/{chunk-CaZlpLSd.js → chunk-CS_CmKL0.js} +1 -1
- package/browser/{chunk-Dk3h998A.js → chunk-CSa65gP2.js} +1 -1
- package/browser/{chunk-1LsZyzCe.js → chunk-CZutweoy.js} +2 -2
- package/browser/{chunk-7IDkwdi0.js → chunk-CaAK8DtC.js} +1 -1
- package/browser/{chunk-CbXRaZ5e.js → chunk-CfO-PCnU.js} +1 -1
- package/browser/{chunk-CkfpO0Ui.js → chunk-CkXXby9d.js} +2 -2
- package/browser/{chunk-3cJY-y-K.js → chunk-CkwB4YzM.js} +1 -1
- package/browser/{chunk-Ct1RBakr.js → chunk-CnFhM0Nt.js} +1 -1
- package/browser/{chunk-CRoK_gKa.js → chunk-Co3aK_ug.js} +1 -1
- package/browser/chunk-Cqva3eF5.js +2 -0
- package/browser/{chunk-Dx68TWlI.js → chunk-Cqy-kSp8.js} +1 -1
- package/browser/{chunk-BsaBLbYE.js → chunk-D2wlWOWp.js} +1 -1
- package/browser/{chunk-DfnvTJ7R.js → chunk-DEr2MMdQ.js} +1 -1
- package/browser/{chunk-BJ4jWcd_.js → chunk-DGbegOkt.js} +1 -1
- package/browser/{chunk-C1xOKACR.js → chunk-DJtRPrJe.js} +1 -1
- package/browser/{chunk-DAOnyJ7c.js → chunk-DKfZ0J0-.js} +1 -1
- package/browser/{chunk-D73z8OGT.js → chunk-DMo8nEUq.js} +1 -1
- package/browser/{chunk-B1Tv2Ebu.js → chunk-DQj9SXnH.js} +1 -1
- package/browser/chunk-DfyXf4Lw.js +1 -0
- package/browser/{chunk-C2OedcEU.js → chunk-Di5brgj6.js} +1 -1
- package/browser/{chunk-CX02zIUT.js → chunk-DoW9c054.js} +1 -1
- package/browser/{chunk-DzZlI93U.js → chunk-Duz7aHYs.js} +2 -2
- package/browser/chunk-DzSHyN8O.js +1 -0
- package/browser/chunk-DzXp5mWz.js +1 -0
- package/browser/{chunk-O1wALPze.js → chunk-E-XRHTIB.js} +1 -1
- package/browser/{chunk-b_e1R_FV.js → chunk-GHUL_MFq.js} +1 -1
- package/browser/{chunk-BWbwxWKa.js → chunk-HHbcGqdi.js} +1 -1
- package/browser/{chunk-CgurnF00.js → chunk-Hhxvnnlp.js} +1 -1
- package/browser/{chunk-CJdqLI4x.js → chunk-LgALnta4.js} +2 -2
- package/browser/{chunk-Db48BeGH.js → chunk-Lt-5ZOWn.js} +1 -1
- package/browser/{chunk-CeTOubPL.js → chunk-MtaKFhdm.js} +1 -1
- package/browser/{chunk-_aUM9QLW.js → chunk-N-tYgqQC.js} +1 -1
- package/browser/{chunk-DDdQkLim.js → chunk-NLyO0ldw.js} +1 -1
- package/browser/{chunk-BGILLpeT.js → chunk-QDqqdtZx.js} +1 -1
- package/browser/{chunk-ZtJnIW3b.js → chunk-RPuzC8Su.js} +1 -1
- package/browser/{chunk-DqfT0kg4.js → chunk-UX95uV76.js} +1 -1
- package/browser/{chunk-CqkMIKRg.js → chunk-Wd2dgg4g.js} +4 -4
- package/browser/chunk-b9_We0yK.js +1 -0
- package/browser/{chunk-DB97l2cM.js → chunk-iUyWeEFy.js} +1 -1
- package/browser/{chunk-DngVvVw1.js → chunk-iamu8zs_.js} +1 -1
- package/browser/{chunk-CPUMKiuB.js → chunk-nRV2u7bW.js} +2 -2
- package/browser/{chunk-Bpth0xKt.js → chunk-rjkvu4Y6.js} +3 -3
- package/browser/index.html +1 -1
- package/browser/main-4SCUMPDY.js +1811 -0
- package/package.json +1 -1
- package/browser/chunk-B3QJ8PhL.js +0 -1
- package/browser/chunk-BDkp40LI.js +0 -9
- package/browser/chunk-BPt7wScV.js +0 -1
- package/browser/chunk-CQXNmLda.js +0 -1
- package/browser/chunk-CmUHL9Tg.js +0 -1
- package/browser/chunk-DAEEDI2g.js +0 -1
- package/browser/chunk-IM1UfDv7.js +0 -2
- package/browser/main-MX6O2FH4.js +0 -1811
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-Bsv9CCXL.js';import {l}from'./chunk-Bf1Bttqy.js';import {g as g$1,dd as $,aJ as Tr,aD as Ly,bS as va,a7 as ya,X as br,u as ue,cE as Rd,bU as Od,b as P,Y as x}from'./main-4SCUMPDY.js';var g="none",N="me",O=class p{nsController=g$1($);userState=g$1(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(va(([e])=>{let r=this.loadPlatformProviders().pipe(ya(()=>br([])));return e?Ly([r,this.loadNamespaceProviders(e).pipe(ya(()=>br([]))),this.loadUserProviders(e).pipe(ya(()=>br([]))),this.loadUserProviders("global").pipe(ya(()=>br([])))]).pipe(ue(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ly([r,this.loadNamespaceProviders("").pipe(ya(()=>br([]))),this.loadUserProviders("global").pipe(ya(()=>br([])))]).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):br([])}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 {S as St}from'./chunk-Bpth0xKt.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,A as Aw,aq as a,ar as S,as as F,at as c,v as vs,k as Ag,n as eC,j as fl,r as Tg,X as XE,t as tC,D as Fg,I as IC,E as wC,au as tv,ae as Ot,av as dt,Y as x,aw as pl,W as WC,ax as hl,a8 as Zg,a9 as dC,aa as If,ac as mC,ab as wf,o as bg}from'./main-MX6O2FH4.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-C2rlLV-W.js';import'./chunk-DAOnyJ7c.js';import {G as Ge}from'./chunk-CqkMIKRg.js';import'./chunk-BkVtgsRG.js';import'./chunk-B5rsaW2b.js';import'./chunk-BuSLhs6I.js';import'./chunk-CFQpQly7.js';import'./chunk-B8YsdH5W.js';import'./chunk-LlG18Htx.js';import'./chunk-CUmZcEGx.js';import'./chunk-CJdqLI4x.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(pl(0,"h1",0),WC(1),hl()),t&2&&(XE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;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;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),tv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=dC();vs(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=mC();return wf(r.onDrawerStateChange(n))}),fl();}if(o&2){let t=mC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=dC();vs(0,"div",5),bg(1,"app-welcome-message"),fl(),vs(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=mC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=mC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=mC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=mC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=mC();return wf(n.onChatFocusedOnMobile())}),fl()()()();}if(o&2){let t=mC();XE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;IC(n=wC())&&(i.inputSection=n.first),IC(n=wC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(vs(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),eC(2,ee,1,2,"app-thread",3)(3,te,7,5),fl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),XE(2),tC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
1
|
+
import {S as St}from'./chunk-rjkvu4Y6.js';import {an as ce,g,L,ao as V,G,N as N$1,ap as Vy,h as Rw,aq as a,ar as S,as as F,at as c,I as Is,A as Ag,t as tC,m as pl,T as Tg,J as JE,v as nC,D as Fg,E as wC,K as CC,au as nv,ae as Ot,av as dt,Y as x,aw as hl,q as qC,ax as gl,a8 as Zg,a9 as fC,aa as If,ac as yC,ab as wf,n as bg}from'./main-4SCUMPDY.js';import {a as at,s as st,r as rt,_ as _i}from'./chunk-BOq6QumJ.js';import'./chunk-DKfZ0J0-.js';import {G as Ge}from'./chunk-Wd2dgg4g.js';import'./chunk-BxnUTBZC.js';import'./chunk-BM9I1k6S.js';import'./chunk-BUJvZgLu.js';import'./chunk-CCFtehVS.js';import'./chunk-Bz081WAa.js';import'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import'./chunk-LgALnta4.js';var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation();}ngOnDestroy(){this.stopWelcomeRotation();}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex];},3e3);}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(hl(0,"h1",0),qC(1),gl()),t&2&&(JE(),Zg(i.currentWelcomeMessage));},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;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;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"],changeDetection:1})};var N=class o{destroy$=new ce;isSetup=false;codayService=g(Ge);preferencesService=g(L);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===true&&t===false)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled();}),this.preferencesService.browserNotificationEnabled$.pipe(Vy(this.destroy$),nv(),Ot(([e,t])=>e===false&&t===true)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled();}),this.isSetup=true;}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification());}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played");}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e);}}handleBrowserNotificationEnabled(){return dt(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(false);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1));}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(false);}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification");}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:false});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Confirmation notification sent");}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:false});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close();},console.log("[AGENT-NOTIFICATION] Task complete notification sent");}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=fC();Is(0,"app-thread",4),Ag("chatFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){If(t);let r=yC();return wf(r.onDrawerStateChange(n))}),pl();}if(o&2){let t=yC();Tg("projectName",t.projectName)("threadId",t.threadId);}}function te(o,e){if(o&1){let t=fC();Is(0,"div",5),bg(1,"app-welcome-message"),pl(),Is(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),Ag("messageSubmitted",function(n){If(t);let r=yC();return wf(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){If(t);let r=yC();return wf(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){If(t);let r=yC();return wf(r.onVoiceToggled(n))})("heightChanged",function(n){If(t);let r=yC();return wf(r.onInputHeightChanged(n))})("textareaFocused",function(){If(t);let n=yC();return wf(n.onChatFocusedOnMobile())}),pl()()()();}if(o&2){let t=yC();JE(6),Tg("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",true)("isThinking",false)("isStarting",t.isStartingFirstMessage);}}var K=class o{destroy$=new ce;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=false;isStartingFirstMessage=false;inputSectionHeight=80;codayService=g(Ge);titleService=g(at);preferencesService=g(L);route=g(V);router=g(G);threadApiService=g(N$1);agentNotificationService=g(N);firstMessageState=g(st);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)");}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(Vy(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView());});}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService);}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100);}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint);}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e);}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=true,this.isStartingFirstMessage=true,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id]);},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=false,this.isStartingFirstMessage=false,alert("Failed to create conversation: "+(t.message||"Unknown error"));}});}isDrawerOpen=false;onDrawerStateChange(e){this.isDrawerOpen=e;}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close();}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e;}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e);}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint);}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical");};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical");};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&Fg(Z,5)(St,5),t&2){let n;wC(n=CC())&&(i.inputSection=n.first),wC(n=CC())&&(i.sidenav=n.first);}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(Is(0,"app-sidenav",1)(1,"div",2),Ag("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),tC(2,ee,1,2,"app-thread",3)(3,te,7,5),pl()()),t&2&&(Tg("drawerOpen",i.isDrawerOpen),JE(2),nC(i.threadId?2:3));},dependencies:[rt,_i,T,St],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[a("slideIn",[S(":enter",[F({transform:"translateY(100%)",opacity:0}),c("300ms ease-out",F({transform:"translateY(0)",opacity:1}))]),S(":leave",[c("200ms ease-in",F({transform:"translateY(100%)",opacity:0}))])])]},changeDetection:1})};export{K as MainAppComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Z as Zn,S as Se}from'./chunk-
|
|
1
|
+
import {Z as Zn,S as Se}from'./chunk-BESIk8ll.js';import {cb as TB,cc as CB,z as zi,y as yT,h as Rw,I as Is,q as qC,m as pl,t as tC,J as JE,a8 as Zg,v as nC,ac as yC,C as Cg,a5 as vl,a9 as fC,A as Ag,T as Tg,aa as If,ab as wf}from'./main-4SCUMPDY.js';function k(t,r){if(t&1&&(Is(0,"span",4),qC(1),pl()),t&2){let e=yC();Cg("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),JE(),vl(" ",e.badge().label," ");}}function I(t,r){if(t&1){let e=fC();Is(0,"span",7),qC(1,"Delete?"),pl(),Is(2,"ds-icon-button",8),Ag("action",function(){If(e);let l=yC();return wf(l.onDeleteConfirmed())}),pl(),Is(3,"ds-icon-button",9),Ag("action",function(){If(e);let l=yC();return wf(l.onDeleteCancelled())}),pl();}}function P(t,r){if(t&1){let e=fC();Is(0,"ds-kebab-menu",12),Ag("itemSelected",function(l){If(e);let A=yC(2);return wf(A.onMenuAction(l))}),pl();}if(t&2){let e=yC(2);Tg("items",e.menuItems());}}function R(t,r){if(t&1){let e=fC();Is(0,"ds-icon-button",10),Ag("action",function(){If(e);let l=yC();return wf(l.onDuplicate())}),pl(),tC(1,P,1,1,"ds-kebab-menu",11);}if(t&2){let e=yC();JE(),nC(e.readOnly()?-1:1);}}var E=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration 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"}}),O=class t{config=TB.required();scope=TB.required();readOnly=TB(false);showBadge=TB(true);editRequested=CB();deleteRequested=CB();duplicateRequested=CB();pendingDelete=zi(false);badge=yT(()=>E[this.scope()]);menuItems=yT(()=>[{key:"edit",label:"Edit auth setting",icon:"edit"},{key:"delete",label:"Delete auth setting",icon:"delete",variant:"danger"}]);onMenuAction(r){switch(r){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=Rw({type:t,selectors:[["agentos-auth-setting-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:11,vars:4,consts:[["role","listitem",1,"auth-setting-item"],[1,"auth-setting-item__body"],[1,"auth-setting-item__heading"],[1,"auth-setting-item__name"],[1,"auth-setting-item__badge"],[1,"auth-setting-item__type"],[1,"auth-setting-item__actions"],[1,"auth-setting-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 auth setting",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(Is(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),qC(4),pl(),tC(5,k,2,3,"span",4),pl(),Is(6,"span",5),qC(7),pl()(),Is(8,"div",6),tC(9,I,4,0)(10,R,2,1),pl()()),e&2&&(JE(4),Zg(o.config().name),JE(),nC(o.showBadge()?5:-1),JE(2),Zg(o.config().authType),JE(2),nC(o.pendingDelete()?9:10));},dependencies:[Zn,Se],styles:[".auth-setting-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);transition:background .15s ease,border-color .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.auth-setting-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.auth-setting-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.auth-setting-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.auth-setting-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.auth-setting-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.auth-setting-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.auth-setting-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.auth-setting-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.auth-setting-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.auth-setting-item[_ngcontent-%COMP%]:hover .auth-setting-item__actions[_ngcontent-%COMP%], .auth-setting-item[_ngcontent-%COMP%]:focus-within .auth-setting-item__actions[_ngcontent-%COMP%]{opacity:1}.auth-setting-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"]})};export{O};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {x as xe}from'./chunk-CPUMKiuB.js';import {P as Pt$1,L as Lt}from'./chunk-DzZlI93U.js';import {v as ve,n as ne}from'./chunk-CkfpO0Ui.js';import {d}from'./chunk-BuSLhs6I.js';import {W,k as ke,s as se}from'./chunk-CFQpQly7.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-B8YsdH5W.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-LlG18Htx.js';import'./chunk-CUmZcEGx.js';import {g,bm as Sm,R as Re,H as Hi,m as mT,A as Aw,h as hr,i as Gn,v as vs,k as Ag,W as WC,j as fl,a3 as HI,n as eC,af as Dg,ag as fT,T as TC,X as XE,r as Tg,a6 as $I,t as tC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,e as pr,ai as Jg,aj as KC,q as oC,a8 as Zg,ak as Xg,x as iC,a5 as yl,ac as mC,a9 as dC,aa as If,ab as wf,bp as gl,bq as ml,ah as rT,b4 as oT,aL as Do,aM as qn,br as sn,aO as wt$1,bs as Cl,bt as Qn,aT as Ut$1,al as yt$2,aW as w,bu as Ve,aZ as ks,a_ as YT,b5 as nT,C as Cg,y as Hg,bv as kg,I as IC,E as wC,az as Qt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as am,bz as Oi,bA as vC,bB as DC,o as bg,D as Fg,bC as Ii,bo as nC}from'./main-MX6O2FH4.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-CJdqLI4x.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(vs(0,"div",2),bg(1,"mat-pseudo-checkbox",6),fl()),l&2){let e=mC();XE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ii(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Cl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=ks({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;IC(u=wC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",YT],value:"value",multiple:[2,"multiple","multiple",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",YT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",YT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[nT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Cl);_elementRef=g(Qt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Hi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Aw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;IC(o=wC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",YT],appearance:"appearance",checked:[2,"checked","checked",YT],disabled:[2,"disabled","disabled",YT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",YT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(vC(),vs(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),eC(2,Ft,2,1,"div",2),vs(3,"span",3),DC(4),fl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=TC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),XE(2),tC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),XE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
1
|
+
import {x as xe}from'./chunk-nRV2u7bW.js';import {P as Pt$1,L as Lt}from'./chunk-Duz7aHYs.js';import {v as ve,n as ne}from'./chunk-CkXXby9d.js';import {d}from'./chunk-BUJvZgLu.js';import {W,k as ke,s as se}from'./chunk-CCFtehVS.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-Bz081WAa.js';import {W as Wn,o as ot,i as it,I as In,D as De,B as Be,y as ya,E as En,F as Fn,g as gt$1,A as An}from'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import {g,bm as Sm,R as Re,z as zi,y as yT,h as Rw,i as hr,k as Gn,I as Is,A as Ag,q as qC,m as pl,a3 as UI,t as tC,af as Dg,ag as pT,r as bC,J as JE,T as Tg,a6 as zI,v as nC,Z as z,_ as Ue,am as Gm,$ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,j as pr,ai as Jg,aj as XC,o as iC,a8 as Zg,ak as Xg,x as sC,a5 as vl,ac as yC,a9 as fC,aa as If,ab as wf,bp as ml,bq as yl,ah as oT,b4 as iT,aL as Eo,aM as qn,br as sn,aO as wt$1,bs as Tl,bt as Qn,aT as Ut$1,al as yt$2,aW as w,bu as Ve,aZ as Ls,a_ as QT,b5 as rT,C as Cg,H as Hg,bv as kg,E as wC,K as CC,az as Kt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as am,bz as Oi,bA as DC,bB as EC,n as bg,D as Fg,bC as Ti,bo as rC}from'./main-4SCUMPDY.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-LgALnta4.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(Is(0,"div",2),bg(1,"mat-pseudo-checkbox",6),pl()),l&2){let e=yC();JE(),Tg("disabled",e.disabled);}}var yt=new w("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new w("MatButtonToggleGroup"),Dt={provide:D,useExisting:Ti(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Tl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new yt$2;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new yt$2;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=Ls({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&kg(o,X,5),t&2){let u;wC(u=CC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Ag("keydown",function(u){return n._keydown(u)}),t&2&&(Cg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Hg("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",QT],value:"value",multiple:[2,"multiple","multiple",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",QT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[rT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Tl);_elementRef=g(Kt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new yt$2;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new am("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=zi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=Rw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Fg(Pt,5),t&2){let o;wC(o=CC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Ag("focus",function(){return n.focus()}),t&2&&(Cg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Hg("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",QT],appearance:"appearance",checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(DC(),Is(0,"button",1,0),Ag("click",function(){return n._onButtonClick()}),tC(2,Ft,2,1,"div",2),Is(3,"span",3),EC(4),pl()(),bg(5,"span",4)(6,"span",5)),t&2){let o=bC(1);Tg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Cg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),JE(2),nC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),JE(4),Tg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
2
2
|
.mat-button-toggle-group {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-flex;
|
|
@@ -273,4 +273,4 @@ import {x as xe}from'./chunk-CPUMKiuB.js';import {P as Pt$1,L as Lt}from'./chunk
|
|
|
273
273
|
border-top-right-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
274
274
|
border-top-left-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));
|
|
275
275
|
}
|
|
276
|
-
`],encapsulation:2})}return l})(),Mt=(()=>{class l{static \u0275fac=function(t){return new(t||l)};static \u0275mod=Do({type:l});static \u0275inj=qn({imports:[sn,X,wt$1]})}return l})();var Wt=(l,a)=>a.id,Nt=(l,a)=>a.value;function Gt(l,a){l&1&&(vs(0,"mat-option",5),WC(1,"Loading prompts..."),fl());}function zt(l,a){if(l&1&&(vs(0,"mat-option",6),WC(1),fl()),l&2){let e=a.$implicit;Tg("value",e.id),XE(),yl(" ",e.name," ");}}function Ut(l,a){if(l&1){let e=dC();vs(0,"mat-checkbox",37),Ag("change",function(){let n=If(e).$implicit,o=mC();return wf(o.toggleDayOfWeek(n.value))}),WC(1),fl();}if(l&2){let e=a.$implicit,t=mC();Tg("checked",t.isDaySelected(e.value)),XE(),yl(" ",e.label," ");}}function qt(l,a){if(l&1){let e=dC();vs(0,"mat-form-field",2)(1,"mat-label"),WC(2,"Number of Occurrences"),fl(),vs(3,"input",11),Jg("ngModelChange",function(n){If(e);let o=mC();return KC(o.endOccurrences,n)||(o.endOccurrences=n),wf(n)}),fl(),HI(),fl();}if(l&2){let e=mC();XE(3),Xg("ngModel",e.endOccurrences),$I();}}function Ht(l,a){if(l&1){let e=dC();vs(0,"mat-form-field",2)(1,"mat-label"),WC(2,"End Date"),fl(),vs(3,"input",38),Jg("ngModelChange",function(n){If(e);let o=mC();return KC(o.endTimestamp,n)||(o.endTimestamp=n),wf(n)}),fl(),HI(),fl();}if(l&2){let e=mC();XE(3),Xg("ngModel",e.endTimestamp),$I();}}function jt(l,a){if(l&1){let e=dC();vs(0,"div")(1,"mat-form-field",2)(2,"mat-label"),WC(3,"Parameter Value"),fl(),vs(4,"input",39),Jg("ngModelChange",function(n){If(e);let o=mC();return KC(o.simpleParameter,n)||(o.simpleParameter=n),wf(n)}),fl(),HI(),vs(5,"mat-hint"),WC(6),fl()()();}if(l&2){let e=mC();XE(4),Xg("ngModel",e.simpleParameter),$I(),XE(2),yl("Simple value for ","{{PARAMETERS}}"," placeholder or appended to first command");}}function Qt(l,a){if(l&1){let e=dC();vs(0,"div",42)(1,"mat-form-field",43)(2,"mat-label"),WC(3,"Key"),fl(),vs(4,"input",44),Jg("ngModelChange",function(n){let o=If(e).$implicit;return KC(o.key,n)||(o.key=n),wf(n)}),fl(),HI(),fl(),vs(5,"mat-form-field",45)(6,"mat-label"),WC(7,"Value"),fl(),vs(8,"input",46),Jg("ngModelChange",function(n){let o=If(e).$implicit;return KC(o.value,n)||(o.value=n),wf(n)}),fl(),HI(),fl(),vs(9,"button",47),Ag("click",function(){let n=If(e).$index,o=mC(3);return wf(o.removeParameter(n))}),vs(10,"mat-icon"),WC(11,"delete"),fl()()();}if(l&2){let e=a.$implicit;XE(4),Xg("ngModel",e.key),$I(),XE(4),Xg("ngModel",e.value),$I();}}function $t(l,a){if(l&1&&(vs(0,"div",41),oC(1,Qt,12,2,"div",42,nC),fl()),l&2){let e=mC(2);XE(),iC(e.parameters);}}function Kt(l,a){if(l&1){let e=dC();vs(0,"div")(1,"div",28)(2,"button",40),Ag("click",function(){If(e);let n=mC();return wf(n.addParameter())}),vs(3,"mat-icon"),WC(4,"add"),fl()()(),eC(5,$t,3,0,"div",41),vs(6,"p",21),WC(7),fl()();}if(l&2){let e=mC();XE(5),tC(e.parameters.length>0?5:-1),XE(2),yl("Key-value pairs for ","{{key}}"," placeholders in prompt commands");}}function Xt(l,a){if(l&1&&(vs(0,"div",33)(1,"mat-icon"),WC(2,"error"),fl(),vs(3,"span"),WC(4),fl()()),l&2){let e=mC();XE(4),Zg(e.errorMessage);}}var B=class l{schedulerApi=g(xe);promptApi=g(d);dialogRef=g(z);availablePrompts=[];isLoadingPrompts=false;name="";promptId="";enabled=true;startTimestamp="";intervalValue=1;intervalUnit="h";daysOfWeek=[];endConditionType="none";endOccurrences=10;endTimestamp="";parameterMode="simple";simpleParameter="";parameters=[];isSaving=false;errorMessage="";isEditMode=false;schedulerId="";data=g(Ue);daysOfWeekOptions=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}];constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){if(this.loadPrompts(),this.isEditMode||(this.startTimestamp=this.formatDateForInput(new Date)),this.isEditMode&&this.data.scheduler){if(this.schedulerId=this.data.scheduler.id,this.name=this.data.scheduler.name,this.promptId=this.data.scheduler.promptId??"",this.enabled=this.data.scheduler.enabled,this.data.scheduler.schedule.startTimestamp){let e=new Date(this.data.scheduler.schedule.startTimestamp);this.startTimestamp=this.formatDateForInput(e);}let a=this.data.scheduler.schedule.interval.match(/^(\d+)(min|h|d|M)$/);a&&a[1]&&a[2]&&(this.intervalValue=parseInt(a[1],10),this.intervalUnit=a[2]),this.daysOfWeek=this.data.scheduler.schedule.daysOfWeek||[],this.data.scheduler.schedule.endCondition&&(this.endConditionType=this.data.scheduler.schedule.endCondition.type,this.endConditionType==="occurrences"?this.endOccurrences=this.data.scheduler.schedule.endCondition.value:this.endConditionType==="endTimestamp"&&(this.endTimestamp=this.data.scheduler.schedule.endCondition.value)),this.data.scheduler.parameters&&(typeof this.data.scheduler.parameters=="object"&&Object.keys(this.data.scheduler.parameters).length===1&&"PARAMETERS"in this.data.scheduler.parameters?(this.parameterMode="simple",this.simpleParameter=String(this.data.scheduler.parameters.PARAMETERS)):(this.parameterMode="structured",this.parameters=Object.entries(this.data.scheduler.parameters).map(([e,t])=>({key:e,value:String(t)}))));}}loadPrompts(){this.isLoadingPrompts=true,this.promptApi.listPrompts().subscribe({next:a=>{this.availablePrompts=a,this.isLoadingPrompts=false;},error:a=>{console.error("Error loading prompts:",a),this.errorMessage="Failed to load prompts",this.isLoadingPrompts=false;}});}toggleDayOfWeek(a){let e=this.daysOfWeek.indexOf(a);e>-1?this.daysOfWeek.splice(e,1):this.daysOfWeek.push(a),this.daysOfWeek.sort();}isDaySelected(a){return this.daysOfWeek.includes(a)}addParameter(){this.parameters.push({key:"",value:""});}removeParameter(a){this.parameters.splice(a,1);}trackByIndex(a){return a}formatDateForInput(a){let e=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),o=String(a.getHours()).padStart(2,"0"),u=String(a.getMinutes()).padStart(2,"0");return `${e}-${t}-${n}T${o}:${u}`}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!this.promptId)return this.errorMessage="Prompt is required",false;if(this.intervalValue<1)return this.errorMessage="Interval must be at least 1",false;switch(this.intervalUnit){case "min":if(this.intervalValue>59)return this.errorMessage="Minutes interval must be between 1 and 59 (use hours for longer)",false;break;case "h":if(this.intervalValue>24)return this.errorMessage="Hours interval must be between 1 and 24 (use days for longer)",false;break;case "d":if(this.intervalValue>31)return this.errorMessage="Days interval must be between 1 and 31 (use months for longer)",false;break;case "M":if(this.intervalValue>12)return this.errorMessage="Months interval must be between 1 and 12",false;break}return this.endConditionType==="occurrences"&&this.endOccurrences<1?(this.errorMessage="Occurrences must be at least 1",false):this.endConditionType==="endTimestamp"&&!this.endTimestamp?(this.errorMessage="End date is required",false):true}buildSchedule(){let e={startTimestamp:(this.startTimestamp?new Date(this.startTimestamp):new Date).toISOString(),interval:`${this.intervalValue}${this.intervalUnit}`};return this.daysOfWeek.length>0&&(e.daysOfWeek=[...this.daysOfWeek]),this.endConditionType==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences}:this.endConditionType==="endTimestamp"&&(e.endCondition={type:"endTimestamp",value:this.endTimestamp}),e}buildParameters(){if(this.parameterMode==="simple")return this.simpleParameter.trim()?{PARAMETERS:this.simpleParameter.trim()}:void 0;let a=this.parameters.filter(t=>t.key.trim());if(a.length===0)return;let e={};return a.forEach(t=>{e[t.key]=t.value;}),e}save(){if(this.errorMessage="",!this.validateForm())return;let a=this.buildSchedule(),e=this.buildParameters();this.isSaving=true,this.isEditMode&&this.schedulerId?this.schedulerApi.updateScheduler(this.schedulerId,{name:this.name.trim(),enabled:this.enabled,promptId:this.promptId,schedule:a,parameters:e}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update scheduler",this.isSaving=false;}}):this.schedulerApi.createScheduler({name:this.name.trim(),promptId:this.promptId,schedule:a,parameters:e,enabled:this.enabled}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create scheduler",this.isSaving=false;}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Aw({type:l,selectors:[["app-scheduler-form"]],decls:90,vars:20,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","My Scheduler","required","",3,"ngModelChange","ngModel"],["required","",3,"ngModelChange","ngModel","disabled"],["disabled",""],[3,"value"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"interval-section"],[1,"interval-fields"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1","required","",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],["required","",3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"days-section"],[1,"days-checkboxes"],[3,"checked"],[1,"hint"],[1,"end-condition-section"],[3,"ngModelChange","ngModel"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"parameters-section"],[1,"section-header"],[1,"mode-toggle",3,"ngModelChange","ngModel"],["value","simple"],["value","structured"],[1,"enabled-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"change","checked"],["matInput","","type","datetime-local","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g., 1234 or staging",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add parameter",3,"click"],[1,"parameters-list"],[1,"parameter-item"],["appearance","outline",1,"param-key"],["matInput","","placeholder","parameterName",3,"ngModelChange","ngModel"],["appearance","outline",1,"param-value"],["matInput","","placeholder","value",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove parameter",1,"remove-btn",3,"click"]],template:function(e,t){e&1&&(vs(0,"h2",0),WC(1),fl(),vs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),WC(6,"Name"),fl(),vs(7,"input",3),Jg("ngModelChange",function(o){return KC(t.name,o)||(t.name=o),o}),fl(),HI(),vs(8,"mat-hint"),WC(9,"A descriptive name for this scheduler"),fl()(),vs(10,"mat-form-field",2)(11,"mat-label"),WC(12,"Prompt"),fl(),vs(13,"mat-select",4),Jg("ngModelChange",function(o){return KC(t.promptId,o)||(t.promptId=o),o}),eC(14,Gt,2,0,"mat-option",5),oC(15,zt,2,2,"mat-option",6,Wt),fl(),HI(),vs(17,"mat-hint"),WC(18),fl()(),vs(19,"mat-form-field",2)(20,"mat-label"),WC(21,"Start Date & Time"),fl(),vs(22,"input",7),Jg("ngModelChange",function(o){return KC(t.startTimestamp,o)||(t.startTimestamp=o),o}),fl(),HI(),vs(23,"mat-hint"),WC(24,"When to start the scheduler (leave empty for now)"),fl()(),vs(25,"div",8)(26,"h3"),WC(27,"Schedule Interval"),fl(),vs(28,"div",9)(29,"mat-form-field",10)(30,"mat-label"),WC(31,"Every"),fl(),vs(32,"input",11),Jg("ngModelChange",function(o){return KC(t.intervalValue,o)||(t.intervalValue=o),o}),fl(),HI(),fl(),vs(33,"mat-form-field",12)(34,"mat-label"),WC(35,"Unit"),fl(),vs(36,"mat-select",13),Jg("ngModelChange",function(o){return KC(t.intervalUnit,o)||(t.intervalUnit=o),o}),vs(37,"mat-option",14),WC(38,"Minutes (1-59)"),fl(),vs(39,"mat-option",15),WC(40,"Hours (1-24)"),fl(),vs(41,"mat-option",16),WC(42,"Days (1-31)"),fl(),vs(43,"mat-option",17),WC(44,"Months (1-12)"),fl()(),HI(),fl()()(),vs(45,"div",18)(46,"h3"),WC(47,"Days of Week (Optional)"),fl(),vs(48,"div",19),oC(49,Ut,2,2,"mat-checkbox",20,Nt),fl(),vs(51,"p",21),WC(52,"Leave empty to run every day"),fl()(),vs(53,"div",22)(54,"h3"),WC(55,"End Condition (Optional)"),fl(),vs(56,"mat-form-field",2)(57,"mat-label"),WC(58,"End Type"),fl(),vs(59,"mat-select",23),Jg("ngModelChange",function(o){return KC(t.endConditionType,o)||(t.endConditionType=o),o}),vs(60,"mat-option",24),WC(61,"Never (run indefinitely)"),fl(),vs(62,"mat-option",25),WC(63,"After X occurrences"),fl(),vs(64,"mat-option",26),WC(65,"Until specific date"),fl()(),HI(),fl(),eC(66,qt,4,1,"mat-form-field",2),eC(67,Ht,4,1,"mat-form-field",2),fl(),vs(68,"div",27)(69,"div",28)(70,"h3"),WC(71,"Parameters (Optional)"),fl(),vs(72,"mat-button-toggle-group",29),Jg("ngModelChange",function(o){return KC(t.parameterMode,o)||(t.parameterMode=o),o}),vs(73,"mat-button-toggle",30),WC(74,"Simple"),fl(),vs(75,"mat-button-toggle",31),WC(76,"Structured"),fl()(),HI(),fl(),eC(77,jt,7,2,"div"),eC(78,Kt,8,2,"div"),fl(),vs(79,"div",32)(80,"mat-checkbox",23),Jg("ngModelChange",function(o){return KC(t.enabled,o)||(t.enabled=o),o}),WC(81,"Enabled"),fl(),HI(),vs(82,"p",21),WC(83,"Scheduler will only run if enabled"),fl()(),eC(84,Xt,5,1,"div",33),fl()(),vs(85,"mat-dialog-actions",34)(86,"button",35),Ag("click",function(){return t.cancel()}),WC(87,"Cancel"),fl(),vs(88,"button",36),Ag("click",function(){return t.save()}),WC(89),fl()()),e&2&&(XE(),Zg(t.isEditMode?"Edit Scheduler":"Create Scheduler"),XE(6),Xg("ngModel",t.name),$I(),XE(6),Xg("ngModel",t.promptId),Tg("disabled",t.isLoadingPrompts),$I(),XE(),tC(t.isLoadingPrompts?14:-1),XE(),iC(t.availablePrompts),XE(3),Zg(t.isLoadingPrompts?"Loading available prompts...":"Select the prompt to execute"),XE(4),Xg("ngModel",t.startTimestamp),$I(),XE(10),Xg("ngModel",t.intervalValue),$I(),XE(4),Xg("ngModel",t.intervalUnit),$I(),XE(13),iC(t.daysOfWeekOptions),XE(10),Xg("ngModel",t.endConditionType),$I(),XE(7),tC(t.endConditionType==="occurrences"?66:-1),XE(),tC(t.endConditionType==="endTimestamp"?67:-1),XE(5),Xg("ngModel",t.parameterMode),$I(),XE(5),tC(t.parameterMode==="simple"?77:-1),XE(),tC(t.parameterMode==="structured"?78:-1),XE(2),Xg("ngModel",t.enabled),$I(),XE(4),tC(t.errorMessage?84:-1),XE(2),Tg("disabled",t.isSaving),XE(2),Tg("disabled",t.isSaving),XE(),yl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Gm,ti,Ye,fn,Zn,gt,$t$1,cn,zt$1,jt$1,Vt,Nt$1,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt$1,wt,Pt$1,Lt,Fn,ve,ne,Mt,ie,X],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:600px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.interval-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%]{display:flex;gap:1rem}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%], .interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.days-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:1rem;margin-bottom:.5rem}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{min-width:120px}.days-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.end-condition-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] .mode-toggle[_ngcontent-%COMP%]{height:32px}.parameters-section[_ngcontent-%COMP%] .parameters-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-key[_ngcontent-%COMP%]{flex:1}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-value[_ngcontent-%COMP%]{flex:2}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.parameters-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.enabled-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.enabled-section[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem}.enabled-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var Yt=()=>[],Zt=l=>({id:l});function Jt(l,a){if(l&1&&(vs(0,"div",6),WC(1),fl()),l&2){let e=mC();XE(),Zg(e.errorMessage());}}function en(l,a){if(l&1){let e=dC();vs(0,"ds-entity-card",8),Ag("selected",function(n){If(e);let o=mC();return wf(o.onEdit(n))}),gl(1,9),vs(2,"button",10),Ag("click",function(n){return n.stopPropagation()}),vs(3,"mat-icon"),WC(4,"more_vert"),fl()(),ml(),fl();}if(l&2){let e=a.$implicit;mC();let t=TC(11);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,Yt)),XE(2),Tg("matMenuTriggerFor",t)("matMenuTriggerData",oT(7,Zt,e.id));}}function tn(l,a){if(l&1){let e=dC();vs(0,"button",11),Ag("click",function(){let n=If(e).id,o=mC();return wf(o.onEdit(n))}),vs(1,"mat-icon"),WC(2,"edit"),fl(),WC(3," Edit "),fl(),vs(4,"button",11),Ag("click",function(){let n=If(e).id,o=mC();return wf(o.onToggleEnabled(n))}),vs(5,"mat-icon"),WC(6),fl(),WC(7),fl(),vs(8,"button",11),Ag("click",function(){let n=If(e).id,o=mC();return wf(o.onRunNow(n))}),vs(9,"mat-icon"),WC(10,"play_arrow"),fl(),WC(11," Run now "),fl(),vs(12,"button",12),Ag("click",function(){let n=If(e).id,o=mC();return wf(o.onDelete(n))}),vs(13,"mat-icon"),WC(14,"delete"),fl(),WC(15," Delete "),fl();}if(l&2){let e=a.id,t=mC();XE(6),Zg(t.isEnabled(e)?"pause_circle":"play_circle"),XE(),yl(" ",t.isEnabled(e)?"Disable":"Enable"," ");}}var Ct=class l{schedulerApi=g(xe);promptApi=g(d);configApi=g(W);location=g(Sm);dialog=g(Re);schedulers=Hi([]);prompts=Hi([]);isLoading=Hi(false);errorMessage=Hi(null);showOnlyMine=Hi(true);currentUsername=Hi("");schedulerItems=mT(()=>{let a=this.schedulers(),e=this.currentUsername(),n=this.showOnlyMine()&&e?a.filter(C=>this.isMyScheduler(C)):a,u=[...new Set(n.map(C=>C.createdBy))].sort((C,F)=>C===e&&F!==e?-1:F===e&&C!==e?1:C.localeCompare(F)),I=[];for(let C of u){let F=C===e?`${C} (you)`:C;for(let V of n.filter(St=>St.createdBy===C))I.push({id:V.id,name:V.name,description:this.buildDescription(V),badges:this.buildBadges(V),groupKey:C,groupLabel:F});}return I});ngOnInit(){this.configApi.getUserConfig().subscribe({next:a=>this.currentUsername.set(a.username??""),error:()=>{}}),this.loadPrompts(),this.loadSchedulers();}loadPrompts(){this.promptApi.listPrompts().subscribe({next:a=>this.prompts.set(a),error:()=>{}});}loadSchedulers(){this.isLoading.set(true),this.schedulerApi.listSchedulers().subscribe({next:a=>{this.schedulers.set(a),this.isLoading.set(false);},error:a=>{this.errorMessage.set(a?.error?.error??"Failed to load schedulers"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadSchedulers();});}onEdit(a){this.schedulerApi.getScheduler(a).subscribe({next:e=>{this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"edit",scheduler:e}}).afterClosed().subscribe(n=>{n&&this.loadSchedulers();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load scheduler")});}onToggleEnabled(a){let e=this.schedulers().find(n=>n.id===a);if(!e)return;(e.enabled?this.schedulerApi.disableScheduler(a):this.schedulerApi.enableScheduler(a)).subscribe({next:()=>this.loadSchedulers(),error:n=>this.errorMessage.set(n?.error?.error??"Failed to toggle scheduler")});}onRunNow(a){this.schedulerApi.runSchedulerNow(a).subscribe({next:e=>{alert(`Scheduler executed successfully! Thread ID: ${e.threadId}`),this.loadSchedulers();},error:e=>this.errorMessage.set(e?.error?.error??"Failed to run scheduler")});}onDelete(a){confirm("Are you sure you want to delete this scheduler?")&&this.schedulerApi.deleteScheduler(a).subscribe({next:()=>this.loadSchedulers(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete scheduler")});}isEnabled(a){return this.schedulers().find(e=>e.id===a)?.enabled??false}buildDescription(a){let e;if(a.promptId)e=this.getPromptName(a.promptId);else if(a.agentName&&a.instruction){let o=a.instruction.length>40?a.instruction.slice(0,40)+"\u2026":a.instruction;e=`${a.agentName}: ${o}`;}else console.error(`Scheduler "${a.name}" (${a.id}) has neither promptId nor agentName+instruction`),e="Unknown source";let t=this.formatInterval(a.schedule.interval),n=a.nextRun?new Date(a.nextRun).toLocaleString():"Expired";return `${e} \xB7 ${t} \xB7 Next: ${n}`}buildBadges(a){return [a.enabled?{label:"enabled",variant:"success"}:{label:"disabled",variant:"warning"}]}getPromptName(a){let e=this.prompts().find(t=>t.id===a);return e?e.name:a}formatInterval(a){let e=/^(\d+)(min|h|d|M)$/.exec(a);if(!e)return a;let[,t,n]=e;if(!t||!n)return a;let u={min:"minute",h:"hour",d:"day",M:"month"}[n]??n;return `Every ${t} ${u}${parseInt(t,10)>1?"s":""}`}isMyScheduler(a){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(a.createdBy)===e(this.currentUsername())}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Aw({type:l,selectors:[["app-scheduler-list"]],decls:13,vars:6,consts:[["schedulerCard",""],["cardMenu","matMenu"],[1,"scheduler-list-page"],["title","Schedulers","cardMinWidth","384px","contentMaxWidth","1400px","searchPlaceholder","Filter schedulers\u2026","emptyMessage","No schedulers found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"scheduler-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"scheduler-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"scheduler-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(vs(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return t.onCreate()}),vs(2,"button",4),Ag("click",function(){return t.onBack()}),vs(3,"mat-icon"),WC(4,"chevron_left"),fl()(),vs(5,"mat-slide-toggle",5),Ag("ngModelChange",function(o){return t.showOnlyMine.set(o)}),WC(6," Mine "),fl(),HI(),fl(),eC(7,Jt,2,1,"div",6),fl(),Dg(8,en,5,9,"ng-template",null,0,fT),vs(10,"mat-menu",null,1),Dg(12,tn,16,2,"ng-template",7),fl()),e&2){let n=TC(9);XE(),Tg("items",t.schedulerItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",n),XE(4),Tg("ngModel",t.showOnlyMine()),$I(),XE(2),tC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt$1,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.scheduler-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.scheduler-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.scheduler-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.scheduler-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ct as SchedulerListComponent};
|
|
276
|
+
`],encapsulation:2})}return l})(),Mt=(()=>{class l{static \u0275fac=function(t){return new(t||l)};static \u0275mod=Eo({type:l});static \u0275inj=qn({imports:[sn,X,wt$1]})}return l})();var Wt=(l,a)=>a.id,Nt=(l,a)=>a.value;function Gt(l,a){l&1&&(Is(0,"mat-option",5),qC(1,"Loading prompts..."),pl());}function zt(l,a){if(l&1&&(Is(0,"mat-option",6),qC(1),pl()),l&2){let e=a.$implicit;Tg("value",e.id),JE(),vl(" ",e.name," ");}}function Ut(l,a){if(l&1){let e=fC();Is(0,"mat-checkbox",37),Ag("change",function(){let n=If(e).$implicit,o=yC();return wf(o.toggleDayOfWeek(n.value))}),qC(1),pl();}if(l&2){let e=a.$implicit,t=yC();Tg("checked",t.isDaySelected(e.value)),JE(),vl(" ",e.label," ");}}function qt(l,a){if(l&1){let e=fC();Is(0,"mat-form-field",2)(1,"mat-label"),qC(2,"Number of Occurrences"),pl(),Is(3,"input",11),Jg("ngModelChange",function(n){If(e);let o=yC();return XC(o.endOccurrences,n)||(o.endOccurrences=n),wf(n)}),pl(),UI(),pl();}if(l&2){let e=yC();JE(3),Xg("ngModel",e.endOccurrences),zI();}}function Ht(l,a){if(l&1){let e=fC();Is(0,"mat-form-field",2)(1,"mat-label"),qC(2,"End Date"),pl(),Is(3,"input",38),Jg("ngModelChange",function(n){If(e);let o=yC();return XC(o.endTimestamp,n)||(o.endTimestamp=n),wf(n)}),pl(),UI(),pl();}if(l&2){let e=yC();JE(3),Xg("ngModel",e.endTimestamp),zI();}}function jt(l,a){if(l&1){let e=fC();Is(0,"div")(1,"mat-form-field",2)(2,"mat-label"),qC(3,"Parameter Value"),pl(),Is(4,"input",39),Jg("ngModelChange",function(n){If(e);let o=yC();return XC(o.simpleParameter,n)||(o.simpleParameter=n),wf(n)}),pl(),UI(),Is(5,"mat-hint"),qC(6),pl()()();}if(l&2){let e=yC();JE(4),Xg("ngModel",e.simpleParameter),zI(),JE(2),vl("Simple value for ","{{PARAMETERS}}"," placeholder or appended to first command");}}function Qt(l,a){if(l&1){let e=fC();Is(0,"div",42)(1,"mat-form-field",43)(2,"mat-label"),qC(3,"Key"),pl(),Is(4,"input",44),Jg("ngModelChange",function(n){let o=If(e).$implicit;return XC(o.key,n)||(o.key=n),wf(n)}),pl(),UI(),pl(),Is(5,"mat-form-field",45)(6,"mat-label"),qC(7,"Value"),pl(),Is(8,"input",46),Jg("ngModelChange",function(n){let o=If(e).$implicit;return XC(o.value,n)||(o.value=n),wf(n)}),pl(),UI(),pl(),Is(9,"button",47),Ag("click",function(){let n=If(e).$index,o=yC(3);return wf(o.removeParameter(n))}),Is(10,"mat-icon"),qC(11,"delete"),pl()()();}if(l&2){let e=a.$implicit;JE(4),Xg("ngModel",e.key),zI(),JE(4),Xg("ngModel",e.value),zI();}}function $t(l,a){if(l&1&&(Is(0,"div",41),iC(1,Qt,12,2,"div",42,rC),pl()),l&2){let e=yC(2);JE(),sC(e.parameters);}}function Kt(l,a){if(l&1){let e=fC();Is(0,"div")(1,"div",28)(2,"button",40),Ag("click",function(){If(e);let n=yC();return wf(n.addParameter())}),Is(3,"mat-icon"),qC(4,"add"),pl()()(),tC(5,$t,3,0,"div",41),Is(6,"p",21),qC(7),pl()();}if(l&2){let e=yC();JE(5),nC(e.parameters.length>0?5:-1),JE(2),vl("Key-value pairs for ","{{key}}"," placeholders in prompt commands");}}function Xt(l,a){if(l&1&&(Is(0,"div",33)(1,"mat-icon"),qC(2,"error"),pl(),Is(3,"span"),qC(4),pl()()),l&2){let e=yC();JE(4),Zg(e.errorMessage);}}var B=class l{schedulerApi=g(xe);promptApi=g(d);dialogRef=g(z);availablePrompts=[];isLoadingPrompts=false;name="";promptId="";enabled=true;startTimestamp="";intervalValue=1;intervalUnit="h";daysOfWeek=[];endConditionType="none";endOccurrences=10;endTimestamp="";parameterMode="simple";simpleParameter="";parameters=[];isSaving=false;errorMessage="";isEditMode=false;schedulerId="";data=g(Ue);daysOfWeekOptions=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}];constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){if(this.loadPrompts(),this.isEditMode||(this.startTimestamp=this.formatDateForInput(new Date)),this.isEditMode&&this.data.scheduler){if(this.schedulerId=this.data.scheduler.id,this.name=this.data.scheduler.name,this.promptId=this.data.scheduler.promptId??"",this.enabled=this.data.scheduler.enabled,this.data.scheduler.schedule.startTimestamp){let e=new Date(this.data.scheduler.schedule.startTimestamp);this.startTimestamp=this.formatDateForInput(e);}let a=this.data.scheduler.schedule.interval.match(/^(\d+)(min|h|d|M)$/);a&&a[1]&&a[2]&&(this.intervalValue=parseInt(a[1],10),this.intervalUnit=a[2]),this.daysOfWeek=this.data.scheduler.schedule.daysOfWeek||[],this.data.scheduler.schedule.endCondition&&(this.endConditionType=this.data.scheduler.schedule.endCondition.type,this.endConditionType==="occurrences"?this.endOccurrences=this.data.scheduler.schedule.endCondition.value:this.endConditionType==="endTimestamp"&&(this.endTimestamp=this.data.scheduler.schedule.endCondition.value)),this.data.scheduler.parameters&&(typeof this.data.scheduler.parameters=="object"&&Object.keys(this.data.scheduler.parameters).length===1&&"PARAMETERS"in this.data.scheduler.parameters?(this.parameterMode="simple",this.simpleParameter=String(this.data.scheduler.parameters.PARAMETERS)):(this.parameterMode="structured",this.parameters=Object.entries(this.data.scheduler.parameters).map(([e,t])=>({key:e,value:String(t)}))));}}loadPrompts(){this.isLoadingPrompts=true,this.promptApi.listPrompts().subscribe({next:a=>{this.availablePrompts=a,this.isLoadingPrompts=false;},error:a=>{console.error("Error loading prompts:",a),this.errorMessage="Failed to load prompts",this.isLoadingPrompts=false;}});}toggleDayOfWeek(a){let e=this.daysOfWeek.indexOf(a);e>-1?this.daysOfWeek.splice(e,1):this.daysOfWeek.push(a),this.daysOfWeek.sort();}isDaySelected(a){return this.daysOfWeek.includes(a)}addParameter(){this.parameters.push({key:"",value:""});}removeParameter(a){this.parameters.splice(a,1);}trackByIndex(a){return a}formatDateForInput(a){let e=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),n=String(a.getDate()).padStart(2,"0"),o=String(a.getHours()).padStart(2,"0"),u=String(a.getMinutes()).padStart(2,"0");return `${e}-${t}-${n}T${o}:${u}`}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!this.promptId)return this.errorMessage="Prompt is required",false;if(this.intervalValue<1)return this.errorMessage="Interval must be at least 1",false;switch(this.intervalUnit){case "min":if(this.intervalValue>59)return this.errorMessage="Minutes interval must be between 1 and 59 (use hours for longer)",false;break;case "h":if(this.intervalValue>24)return this.errorMessage="Hours interval must be between 1 and 24 (use days for longer)",false;break;case "d":if(this.intervalValue>31)return this.errorMessage="Days interval must be between 1 and 31 (use months for longer)",false;break;case "M":if(this.intervalValue>12)return this.errorMessage="Months interval must be between 1 and 12",false;break}return this.endConditionType==="occurrences"&&this.endOccurrences<1?(this.errorMessage="Occurrences must be at least 1",false):this.endConditionType==="endTimestamp"&&!this.endTimestamp?(this.errorMessage="End date is required",false):true}buildSchedule(){let e={startTimestamp:(this.startTimestamp?new Date(this.startTimestamp):new Date).toISOString(),interval:`${this.intervalValue}${this.intervalUnit}`};return this.daysOfWeek.length>0&&(e.daysOfWeek=[...this.daysOfWeek]),this.endConditionType==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences}:this.endConditionType==="endTimestamp"&&(e.endCondition={type:"endTimestamp",value:this.endTimestamp}),e}buildParameters(){if(this.parameterMode==="simple")return this.simpleParameter.trim()?{PARAMETERS:this.simpleParameter.trim()}:void 0;let a=this.parameters.filter(t=>t.key.trim());if(a.length===0)return;let e={};return a.forEach(t=>{e[t.key]=t.value;}),e}save(){if(this.errorMessage="",!this.validateForm())return;let a=this.buildSchedule(),e=this.buildParameters();this.isSaving=true,this.isEditMode&&this.schedulerId?this.schedulerApi.updateScheduler(this.schedulerId,{name:this.name.trim(),enabled:this.enabled,promptId:this.promptId,schedule:a,parameters:e}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update scheduler",this.isSaving=false;}}):this.schedulerApi.createScheduler({name:this.name.trim(),promptId:this.promptId,schedule:a,parameters:e,enabled:this.enabled}).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create scheduler",this.isSaving=false;}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Rw({type:l,selectors:[["app-scheduler-form"]],decls:90,vars:20,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","My Scheduler","required","",3,"ngModelChange","ngModel"],["required","",3,"ngModelChange","ngModel","disabled"],["disabled",""],[3,"value"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"interval-section"],[1,"interval-fields"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1","required","",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],["required","",3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"days-section"],[1,"days-checkboxes"],[3,"checked"],[1,"hint"],[1,"end-condition-section"],[3,"ngModelChange","ngModel"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"parameters-section"],[1,"section-header"],[1,"mode-toggle",3,"ngModelChange","ngModel"],["value","simple"],["value","structured"],[1,"enabled-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"change","checked"],["matInput","","type","datetime-local","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g., 1234 or staging",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add parameter",3,"click"],[1,"parameters-list"],[1,"parameter-item"],["appearance","outline",1,"param-key"],["matInput","","placeholder","parameterName",3,"ngModelChange","ngModel"],["appearance","outline",1,"param-value"],["matInput","","placeholder","value",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove parameter",1,"remove-btn",3,"click"]],template:function(e,t){e&1&&(Is(0,"h2",0),qC(1),pl(),Is(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),qC(6,"Name"),pl(),Is(7,"input",3),Jg("ngModelChange",function(o){return XC(t.name,o)||(t.name=o),o}),pl(),UI(),Is(8,"mat-hint"),qC(9,"A descriptive name for this scheduler"),pl()(),Is(10,"mat-form-field",2)(11,"mat-label"),qC(12,"Prompt"),pl(),Is(13,"mat-select",4),Jg("ngModelChange",function(o){return XC(t.promptId,o)||(t.promptId=o),o}),tC(14,Gt,2,0,"mat-option",5),iC(15,zt,2,2,"mat-option",6,Wt),pl(),UI(),Is(17,"mat-hint"),qC(18),pl()(),Is(19,"mat-form-field",2)(20,"mat-label"),qC(21,"Start Date & Time"),pl(),Is(22,"input",7),Jg("ngModelChange",function(o){return XC(t.startTimestamp,o)||(t.startTimestamp=o),o}),pl(),UI(),Is(23,"mat-hint"),qC(24,"When to start the scheduler (leave empty for now)"),pl()(),Is(25,"div",8)(26,"h3"),qC(27,"Schedule Interval"),pl(),Is(28,"div",9)(29,"mat-form-field",10)(30,"mat-label"),qC(31,"Every"),pl(),Is(32,"input",11),Jg("ngModelChange",function(o){return XC(t.intervalValue,o)||(t.intervalValue=o),o}),pl(),UI(),pl(),Is(33,"mat-form-field",12)(34,"mat-label"),qC(35,"Unit"),pl(),Is(36,"mat-select",13),Jg("ngModelChange",function(o){return XC(t.intervalUnit,o)||(t.intervalUnit=o),o}),Is(37,"mat-option",14),qC(38,"Minutes (1-59)"),pl(),Is(39,"mat-option",15),qC(40,"Hours (1-24)"),pl(),Is(41,"mat-option",16),qC(42,"Days (1-31)"),pl(),Is(43,"mat-option",17),qC(44,"Months (1-12)"),pl()(),UI(),pl()()(),Is(45,"div",18)(46,"h3"),qC(47,"Days of Week (Optional)"),pl(),Is(48,"div",19),iC(49,Ut,2,2,"mat-checkbox",20,Nt),pl(),Is(51,"p",21),qC(52,"Leave empty to run every day"),pl()(),Is(53,"div",22)(54,"h3"),qC(55,"End Condition (Optional)"),pl(),Is(56,"mat-form-field",2)(57,"mat-label"),qC(58,"End Type"),pl(),Is(59,"mat-select",23),Jg("ngModelChange",function(o){return XC(t.endConditionType,o)||(t.endConditionType=o),o}),Is(60,"mat-option",24),qC(61,"Never (run indefinitely)"),pl(),Is(62,"mat-option",25),qC(63,"After X occurrences"),pl(),Is(64,"mat-option",26),qC(65,"Until specific date"),pl()(),UI(),pl(),tC(66,qt,4,1,"mat-form-field",2),tC(67,Ht,4,1,"mat-form-field",2),pl(),Is(68,"div",27)(69,"div",28)(70,"h3"),qC(71,"Parameters (Optional)"),pl(),Is(72,"mat-button-toggle-group",29),Jg("ngModelChange",function(o){return XC(t.parameterMode,o)||(t.parameterMode=o),o}),Is(73,"mat-button-toggle",30),qC(74,"Simple"),pl(),Is(75,"mat-button-toggle",31),qC(76,"Structured"),pl()(),UI(),pl(),tC(77,jt,7,2,"div"),tC(78,Kt,8,2,"div"),pl(),Is(79,"div",32)(80,"mat-checkbox",23),Jg("ngModelChange",function(o){return XC(t.enabled,o)||(t.enabled=o),o}),qC(81,"Enabled"),pl(),UI(),Is(82,"p",21),qC(83,"Scheduler will only run if enabled"),pl()(),tC(84,Xt,5,1,"div",33),pl()(),Is(85,"mat-dialog-actions",34)(86,"button",35),Ag("click",function(){return t.cancel()}),qC(87,"Cancel"),pl(),Is(88,"button",36),Ag("click",function(){return t.save()}),qC(89),pl()()),e&2&&(JE(),Zg(t.isEditMode?"Edit Scheduler":"Create Scheduler"),JE(6),Xg("ngModel",t.name),zI(),JE(6),Xg("ngModel",t.promptId),Tg("disabled",t.isLoadingPrompts),zI(),JE(),nC(t.isLoadingPrompts?14:-1),JE(),sC(t.availablePrompts),JE(3),Zg(t.isLoadingPrompts?"Loading available prompts...":"Select the prompt to execute"),JE(4),Xg("ngModel",t.startTimestamp),zI(),JE(10),Xg("ngModel",t.intervalValue),zI(),JE(4),Xg("ngModel",t.intervalUnit),zI(),JE(13),sC(t.daysOfWeekOptions),JE(10),Xg("ngModel",t.endConditionType),zI(),JE(7),nC(t.endConditionType==="occurrences"?66:-1),JE(),nC(t.endConditionType==="endTimestamp"?67:-1),JE(5),Xg("ngModel",t.parameterMode),zI(),JE(5),nC(t.parameterMode==="simple"?77:-1),JE(),nC(t.parameterMode==="structured"?78:-1),JE(2),Xg("ngModel",t.enabled),zI(),JE(4),nC(t.errorMessage?84:-1),JE(2),Tg("disabled",t.isSaving),JE(2),Tg("disabled",t.isSaving),JE(),vl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Gm,ti,Ye,fn,Zn,gt,$t$1,cn,zt$1,jt$1,Vt,Nt$1,hr,pr,Gn,Tn,Sn,nt,ae,le,ce,yt$1,wt,Pt$1,Lt,Fn,ve,ne,Mt,ie,X],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:600px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.interval-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%]{display:flex;gap:1rem}.interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%], .interval-section[_ngcontent-%COMP%] .interval-fields[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.days-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:1rem;margin-bottom:.5rem}.days-section[_ngcontent-%COMP%] .days-checkboxes[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{min-width:120px}.days-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.end-condition-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.parameters-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] .mode-toggle[_ngcontent-%COMP%]{height:32px}.parameters-section[_ngcontent-%COMP%] .parameters-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-key[_ngcontent-%COMP%]{flex:1}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .param-value[_ngcontent-%COMP%]{flex:2}.parameters-section[_ngcontent-%COMP%] .parameter-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.parameters-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.enabled-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.enabled-section[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem}.enabled-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}"],changeDetection:1})};var Yt=()=>[],Zt=l=>({id:l});function Jt(l,a){if(l&1&&(Is(0,"div",6),qC(1),pl()),l&2){let e=yC();JE(),Zg(e.errorMessage());}}function en(l,a){if(l&1){let e=fC();Is(0,"ds-entity-card",8),Ag("selected",function(n){If(e);let o=yC();return wf(o.onEdit(n))}),ml(1,9),Is(2,"button",10),Ag("click",function(n){return n.stopPropagation()}),Is(3,"mat-icon"),qC(4,"more_vert"),pl()(),yl(),pl();}if(l&2){let e=a.$implicit;yC();let t=bC(11);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??oT(6,Yt)),JE(2),Tg("matMenuTriggerFor",t)("matMenuTriggerData",iT(7,Zt,e.id));}}function tn(l,a){if(l&1){let e=fC();Is(0,"button",11),Ag("click",function(){let n=If(e).id,o=yC();return wf(o.onEdit(n))}),Is(1,"mat-icon"),qC(2,"edit"),pl(),qC(3," Edit "),pl(),Is(4,"button",11),Ag("click",function(){let n=If(e).id,o=yC();return wf(o.onToggleEnabled(n))}),Is(5,"mat-icon"),qC(6),pl(),qC(7),pl(),Is(8,"button",11),Ag("click",function(){let n=If(e).id,o=yC();return wf(o.onRunNow(n))}),Is(9,"mat-icon"),qC(10,"play_arrow"),pl(),qC(11," Run now "),pl(),Is(12,"button",12),Ag("click",function(){let n=If(e).id,o=yC();return wf(o.onDelete(n))}),Is(13,"mat-icon"),qC(14,"delete"),pl(),qC(15," Delete "),pl();}if(l&2){let e=a.id,t=yC();JE(6),Zg(t.isEnabled(e)?"pause_circle":"play_circle"),JE(),vl(" ",t.isEnabled(e)?"Disable":"Enable"," ");}}var Ct=class l{schedulerApi=g(xe);promptApi=g(d);configApi=g(W);location=g(Sm);dialog=g(Re);schedulers=zi([]);prompts=zi([]);isLoading=zi(false);errorMessage=zi(null);showOnlyMine=zi(true);currentUsername=zi("");schedulerItems=yT(()=>{let a=this.schedulers(),e=this.currentUsername(),n=this.showOnlyMine()&&e?a.filter(C=>this.isMyScheduler(C)):a,u=[...new Set(n.map(C=>C.createdBy))].sort((C,F)=>C===e&&F!==e?-1:F===e&&C!==e?1:C.localeCompare(F)),I=[];for(let C of u){let F=C===e?`${C} (you)`:C;for(let V of n.filter(St=>St.createdBy===C))I.push({id:V.id,name:V.name,description:this.buildDescription(V),badges:this.buildBadges(V),groupKey:C,groupLabel:F});}return I});ngOnInit(){this.configApi.getUserConfig().subscribe({next:a=>this.currentUsername.set(a.username??""),error:()=>{}}),this.loadPrompts(),this.loadSchedulers();}loadPrompts(){this.promptApi.listPrompts().subscribe({next:a=>this.prompts.set(a),error:()=>{}});}loadSchedulers(){this.isLoading.set(true),this.schedulerApi.listSchedulers().subscribe({next:a=>{this.schedulers.set(a),this.isLoading.set(false);},error:a=>{this.errorMessage.set(a?.error?.error??"Failed to load schedulers"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadSchedulers();});}onEdit(a){this.schedulerApi.getScheduler(a).subscribe({next:e=>{this.dialog.open(B,{width:"700px",maxHeight:"90vh",data:{mode:"edit",scheduler:e}}).afterClosed().subscribe(n=>{n&&this.loadSchedulers();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load scheduler")});}onToggleEnabled(a){let e=this.schedulers().find(n=>n.id===a);if(!e)return;(e.enabled?this.schedulerApi.disableScheduler(a):this.schedulerApi.enableScheduler(a)).subscribe({next:()=>this.loadSchedulers(),error:n=>this.errorMessage.set(n?.error?.error??"Failed to toggle scheduler")});}onRunNow(a){this.schedulerApi.runSchedulerNow(a).subscribe({next:e=>{alert(`Scheduler executed successfully! Thread ID: ${e.threadId}`),this.loadSchedulers();},error:e=>this.errorMessage.set(e?.error?.error??"Failed to run scheduler")});}onDelete(a){confirm("Are you sure you want to delete this scheduler?")&&this.schedulerApi.deleteScheduler(a).subscribe({next:()=>this.loadSchedulers(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete scheduler")});}isEnabled(a){return this.schedulers().find(e=>e.id===a)?.enabled??false}buildDescription(a){let e;if(a.promptId)e=this.getPromptName(a.promptId);else if(a.agentName&&a.instruction){let o=a.instruction.length>40?a.instruction.slice(0,40)+"\u2026":a.instruction;e=`${a.agentName}: ${o}`;}else console.error(`Scheduler "${a.name}" (${a.id}) has neither promptId nor agentName+instruction`),e="Unknown source";let t=this.formatInterval(a.schedule.interval),n=a.nextRun?new Date(a.nextRun).toLocaleString():"Expired";return `${e} \xB7 ${t} \xB7 Next: ${n}`}buildBadges(a){return [a.enabled?{label:"enabled",variant:"success"}:{label:"disabled",variant:"warning"}]}getPromptName(a){let e=this.prompts().find(t=>t.id===a);return e?e.name:a}formatInterval(a){let e=/^(\d+)(min|h|d|M)$/.exec(a);if(!e)return a;let[,t,n]=e;if(!t||!n)return a;let u={min:"minute",h:"hour",d:"day",M:"month"}[n]??n;return `Every ${t} ${u}${parseInt(t,10)>1?"s":""}`}isMyScheduler(a){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(a.createdBy)===e(this.currentUsername())}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=Rw({type:l,selectors:[["app-scheduler-list"]],decls:13,vars:6,consts:[["schedulerCard",""],["cardMenu","matMenu"],[1,"scheduler-list-page"],["title","Schedulers","cardMinWidth","384px","contentMaxWidth","1400px","searchPlaceholder","Filter schedulers\u2026","emptyMessage","No schedulers found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"scheduler-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"scheduler-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item","",1,"scheduler-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(Is(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return t.onCreate()}),Is(2,"button",4),Ag("click",function(){return t.onBack()}),Is(3,"mat-icon"),qC(4,"chevron_left"),pl()(),Is(5,"mat-slide-toggle",5),Ag("ngModelChange",function(o){return t.showOnlyMine.set(o)}),qC(6," Mine "),pl(),UI(),pl(),tC(7,Jt,2,1,"div",6),pl(),Dg(8,en,5,9,"ng-template",null,0,pT),Is(10,"mat-menu",null,1),Dg(12,tn,16,2,"ng-template",7),pl()),e&2){let n=bC(9);JE(),Tg("items",t.schedulerItems())("loading",t.isLoading())("showCreate",true)("itemTemplate",n),JE(4),Tg("ngModel",t.showOnlyMine()),zI(),JE(2),nC(t.errorMessage()?7:-1);}},dependencies:[Wn,ot,it,hr,Gn,yt$1,wt,ke,se,In,De,Be,ya,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.scheduler-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.scheduler-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.scheduler-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.scheduler-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Ct as SchedulerListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-BUpmxKd8.js';import {g,ao as V$1,G as G$1,w as we,d8 as B,aJ as Tr,z as zi,bS as va,S as By,a7 as ya,X as br,u as ue,c as U$1,h as Rw,aK as xb,I as Is,bf as cT,A as Ag,q as qC,m as pl,af as Dg,r as bC,T as Tg,bg as lT,ah as oT,t as tC,ac as yC,v as nC,a9 as fC,aa as If,ab as wf,ag as pT}from'./main-4SCUMPDY.js';import {W as Wn}from'./chunk-BESIk8ll.js';import'./chunk-BSY9MBD-.js';import'./chunk-LgALnta4.js';var U=()=>[];function V(i,t){if(i&1){let n=fC();Is(0,"agentos-agent-config-item",4),Ag("deleteRequested",function(o){If(n);let F=yC(2);return wf(F.deleteConfig(o))}),pl();}if(i&2){let n=yC().$implicit,e=yC();Tg("config",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformConfig(n.id));}}function j(i,t){if(i&1&&tC(0,V,1,3,"agentos-agent-config-item",3),i&2){let n,e=t.$implicit,o=yC();nC((n=o.resolveConfig(e.id))?0:-1,n);}}var G="namespace",K="platform",q=class i{route=g(V$1);router=g(G$1);destroyRef=g(we);agentConfigController=g(B);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=zi(true);allConfigs$=this.refresh$.pipe(va(()=>(this.isLoading.set(true),By({namespace:this.agentConfigController.listByParentAgentConfig(this.namespaceId),platform:this.agentConfigController.listPlatformAgentsAgentConfig().pipe(ya(()=>br([])))}))));configItems$=this.allConfigs$.pipe(ue(({namespace:t,platform:n})=>[...n.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:K,groupLabel:"Platform (read-only)"})),...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Namespace"}))]));namespaceConfigsById=new Map;platformConfigsById=new Map;constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:t,platform:n})=>{this.namespaceConfigsById=new Map(t.map(e=>[e.id??"",e])),this.platformConfigsById=new Map(n.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.namespaceConfigsById.get(t)??this.platformConfigsById.get(t)??null}isPlatformConfig(t){return this.platformConfigsById.has(t)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Rw({type:i,selectors:[["agentos-namespace-agent-configs"]],decls:6,vars:7,consts:[["agentConfigItemTpl",""],["title","Agent Configs","emptyMessage","No agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-agent-configs__back",3,"click"],[3,"config","namespaceId","readOnly"],[3,"deleteRequested","config","namespaceId","readOnly"]],template:function(n,e){if(n&1&&(Is(0,"ds-entity-list",1),cT(1,"async"),Ag("createRequested",function(){return e.openCreateForm()}),Is(2,"button",2),Ag("click",function(){return e.goBack()}),qC(3," \u2190 Namespaces "),pl()(),Dg(4,j,1,1,"ng-template",null,0,pT)),n&2){let o=bC(5);Tg("items",lT(1,4,e.configItems$)??oT(6,U))("loading",e.isLoading())("showCreate",true)("itemTemplate",o);}},dependencies:[Wn,O,xb],styles:[".namespace-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{q as NamespaceAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,cb as
|
|
1
|
+
import {g,G,cb as TB,cc as CB,z as zi,da as ge,dk as xe,h as Rw,I as Is,q as qC,m as pl,t as tC,J as JE,a8 as Zg,H as Hg,a5 as vl,v as nC,ac as yC,a9 as fC,A as Ag,T as Tg,aa as If,ab as wf}from'./main-4SCUMPDY.js';import {Z as Zn,S as Se}from'./chunk-BESIk8ll.js';function L(n,t){if(n&1&&(Is(0,"span",5),qC(1),pl()),n&2){let e=yC();JE(),Zg(e.definition().description);}}function q(n,t){if(n&1&&(Is(0,"span",7),qC(1),pl()),n&2){let e=yC();JE(),vl("Next: ",e.nextRunLabel);}}function U(n,t){if(n&1&&(Is(0,"span",8),qC(1),pl()),n&2){let e=yC();JE(),vl("Last run: ",e.lastRunLabel);}}function $(n,t){if(n&1){let e=fC();Is(0,"span",12),qC(1,"Delete?"),pl(),Is(2,"ds-icon-button",13),Ag("action",function(){If(e);let a=yC(2);return wf(a.onDeleteConfirmed())}),pl(),Is(3,"ds-icon-button",14),Ag("action",function(){If(e);let a=yC(2);return wf(a.onDeleteCancelled())}),pl();}}function N(n,t){if(n&1){let e=fC();Is(0,"ds-kebab-menu",15),Ag("itemSelected",function(a){If(e);let p=yC(2);return wf(p.onMenuAction(a))}),pl();}if(n&2){let e=yC(2);Tg("items",e.menuItems);}}function V(n,t){if(n&1&&(Is(0,"div",10),tC(1,$,4,0)(2,N,1,1,"ds-kebab-menu",11),pl()),n&2){let e=yC();Hg("scheduled-prompt-item__actions--confirming",e.pendingDelete()),JE(),nC(e.pendingDelete()?1:2);}}var R=class n{router=g(G);definition=TB.required();namespaceId=TB(void 0);platformMode=TB(false);readOnly=TB(false);enableRequested=CB();disableRequested=CB();deleteRequested=CB();pendingDelete=zi(false);get scheduleLabel(){let{recurrence:t}=this.definition(),e=t.unit,i=t.timeUtc,a=e===ge.WEEK?"week":"month",p=e===ge.WEEK&&t.days?.length?` (${t.days.map(_=>xe[_]??_).join(", ")})`:"";return `Every ${a}${p} at ${i} UTC`}formatInstant(t){if(!t)return null;let e=new Date(t),i=e.getUTCDate(),a=e.toLocaleString("en-GB",{month:"short",timeZone:"UTC"}),p=e.getUTCFullYear(),_=String(e.getUTCHours()).padStart(2,"0"),T=String(e.getUTCMinutes()).padStart(2,"0");return `${i} ${a} ${p} at ${_}:${T} UTC`}get nextRunLabel(){return this.formatInstant(this.definition().nextRunAt)}get lastRunLabel(){return this.formatInstant(this.definition().lastRunAt)}get menuItems(){let t=this.definition();return [{key:"edit",label:"Edit scheduled prompt",icon:"edit"},{key:"toggle",label:t.enabled?"Disable":"Enable",icon:t.enabled?"toggle_on":"toggle_off"},{key:"delete",label:"Delete scheduled prompt",icon:"delete",variant:"danger"}]}onMenuAction(t){let e=this.definition();switch(t){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","scheduled-prompts",e.id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"scheduled-prompts",e.id,"edit"]);break;case "toggle":e.enabled?this.disableRequested.emit(e):this.enableRequested.emit(e);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.definition());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Rw({type:n,selectors:[["agentos-scheduled-prompt-item"]],inputs:{definition:[1,"definition"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{enableRequested:"enableRequested",disableRequested:"disableRequested",deleteRequested:"deleteRequested"},decls:13,vars:11,consts:[["role","listitem",1,"scheduled-prompt-item"],[1,"scheduled-prompt-item__body"],[1,"scheduled-prompt-item__header"],[1,"scheduled-prompt-item__name"],[1,"scheduled-prompt-item__status"],[1,"scheduled-prompt-item__description"],[1,"scheduled-prompt-item__schedule"],[1,"scheduled-prompt-item__next-run"],[1,"scheduled-prompt-item__last-run"],[1,"scheduled-prompt-item__actions",3,"scheduled-prompt-item__actions--confirming"],[1,"scheduled-prompt-item__actions"],[3,"items"],[1,"scheduled-prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(Is(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),qC(4),pl(),Is(5,"span",4),qC(6),pl()(),tC(7,L,2,1,"span",5),Is(8,"span",6),qC(9),pl(),tC(10,q,2,1,"span",7),tC(11,U,2,1,"span",8),pl(),tC(12,V,3,3,"div",9),pl()),e&2&&(JE(4),Zg(i.definition().name),JE(),Hg("scheduled-prompt-item__status--enabled",i.definition().enabled)("scheduled-prompt-item__status--disabled",!i.definition().enabled),JE(),vl(" ",i.definition().enabled?"Enabled":"Disabled"," "),JE(),nC(i.definition().description?7:-1),JE(2),Zg(i.scheduleLabel),JE(),nC(i.nextRunLabel?10:-1),JE(),nC(i.lastRunLabel?11:-1),JE(),nC(i.readOnly()?-1:12));},dependencies:[Zn,Se],styles:[".scheduled-prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.scheduled-prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.scheduled-prompt-item__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.scheduled-prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.scheduled-prompt-item__status[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;padding:.15rem .5rem;border-radius:999px;white-space:nowrap;flex-shrink:0;text-transform:uppercase;letter-spacing:.04em}.scheduled-prompt-item__status--enabled[_ngcontent-%COMP%]{background:var(--color-success-bg, rgba(52, 199, 89, .12));color:var(--color-success, #34c759)}.scheduled-prompt-item__status--disabled[_ngcontent-%COMP%]{background:var(--color-warning-bg, rgba(255, 159, 10, .12));color:var(--color-warning, #ff9f0a)}.scheduled-prompt-item__description[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__schedule[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__next-run[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__last-run[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scheduled-prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.scheduled-prompt-item[_ngcontent-%COMP%]:hover .scheduled-prompt-item__actions[_ngcontent-%COMP%], .scheduled-prompt-item[_ngcontent-%COMP%]:focus-within .scheduled-prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__actions--confirming[_ngcontent-%COMP%]{opacity:1}.scheduled-prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as Qe}from'./chunk-
|
|
1
|
+
import {b as Qe}from'./chunk-BSY9MBD-.js';import {D as D$1,i as y}from'./chunk-LgALnta4.js';import {aL as Eo,aM as qn,aO as wt,g as g$1,az as Kt,bs as Tl,aP as G,aS as K,aW as w,al as yt,aX as D,bx as on,by as am,aT as Ut,z as zi,h as Rw,bz as Oi,aC as Tu,a_ as QT,bA as DC,I as Is,A as Ag,m as pl,n as bg,c9 as kf,ck as Ff,bB as EC,r as bC,T as Tg,J as JE,H as Hg,C as Cg,b5 as rT,bC as Ti,c8 as KT,c0 as Ng,b$ as PC,D as Fg,E as wC,K as CC}from'./main-4SCUMPDY.js';var W=["input"],Y=["label"],ee=["*"],f={color:"accent",clickAction:"check-indeterminate",disabledInteractive:false},ce=new w("mat-checkbox-default-options",{providedIn:"root",factory:()=>f}),a=(function(t){return t[t.Init=0]="Init",t[t.Checked=1]="Checked",t[t.Unchecked=2]="Unchecked",t[t.Indeterminate=3]="Indeterminate",t})(a||{}),g=class{source;checked},ne=(()=>{class t{_elementRef=g$1(Kt);_changeDetectorRef=g$1(Tl);_ngZone=g$1(G);_animationsDisabled=K();_options=g$1(ce,{optional:true});focus(){this._inputElement.nativeElement.focus();}_createChangeEvent(e){let n=new g;return n.source=this,n.checked=e,n}_getAnimationTargetElement(){return this._inputElement?.nativeElement}_animationClasses={uncheckedToChecked:"mdc-checkbox--anim-unchecked-checked",uncheckedToIndeterminate:"mdc-checkbox--anim-unchecked-indeterminate",checkedToUnchecked:"mdc-checkbox--anim-checked-unchecked",checkedToIndeterminate:"mdc-checkbox--anim-checked-indeterminate",indeterminateToChecked:"mdc-checkbox--anim-indeterminate-checked",indeterminateToUnchecked:"mdc-checkbox--anim-indeterminate-unchecked"};ariaLabel="";ariaLabelledby=null;ariaDescribedby;ariaExpanded;ariaControls;ariaOwns;_uniqueId;id;get inputId(){return `${this.id||this._uniqueId}-input`}required=false;labelPosition="after";name=null;change=new yt;indeterminateChange=new yt;value;disableRipple=false;_inputElement;_labelElement;tabIndex;color;disabledInteractive;_onTouched=()=>{};_currentAnimationClass="";_currentCheckState=a.Init;_controlValueAccessorChangeFn=()=>{};_validatorChangeFn=()=>{};constructor(){g$1(D).load(on);let e=g$1(new am("tabindex"),{optional:true});this._options=this._options||f,this.color=this._options.color||f.color,this.tabIndex=e==null?0:parseInt(e)||0,this.id=this._uniqueId=g$1(Ut).getId("mat-mdc-checkbox-"),this.disabledInteractive=this._options?.disabledInteractive??false;}ngOnChanges(e){e.required&&this._validatorChangeFn();}ngAfterViewInit(){this._syncIndeterminate(this.indeterminate);}get checked(){return this._checked}set checked(e){e!=this.checked&&(this._checked=e,this._changeDetectorRef.markForCheck());}_checked=false;get disabled(){return this._disabled}set disabled(e){e!==this.disabled&&(this._disabled=e,this._changeDetectorRef.markForCheck());}_disabled=false;get indeterminate(){return this._indeterminate()}set indeterminate(e){let n=e!=this._indeterminate();this._indeterminate.set(e),n&&(e?this._transitionCheckState(a.Indeterminate):this._transitionCheckState(this.checked?a.Checked:a.Unchecked),this.indeterminateChange.emit(e)),this._syncIndeterminate(e);}_indeterminate=zi(false);_isRippleDisabled(){return this.disableRipple||this.disabled}_onLabelTextChange(){this._changeDetectorRef.detectChanges();}writeValue(e){this.checked=!!e;}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}validate(e){return this.required&&e.value!==true?{required:true}:null}registerOnValidatorChange(e){this._validatorChangeFn=e;}_transitionCheckState(e){let n=this._currentCheckState,c=this._getAnimationTargetElement();if(!(n===e||!c)&&(this._currentAnimationClass&&c.classList.remove(this._currentAnimationClass),this._currentAnimationClass=this._getAnimationClassForCheckStateTransition(n,e),this._currentCheckState=e,this._currentAnimationClass.length>0)){c.classList.add(this._currentAnimationClass);let o=this._currentAnimationClass;this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{c.classList.remove(o);},1e3);});}}_emitChangeEvent(){this._controlValueAccessorChangeFn(this.checked),this.change.emit(this._createChangeEvent(this.checked)),this._inputElement&&(this._inputElement.nativeElement.checked=this.checked);}toggle(){this.checked=!this.checked,this._controlValueAccessorChangeFn(this.checked);}_handleInputClick(){let e=this._options?.clickAction;!this.disabled&&e!=="noop"?(this.indeterminate&&e!=="check"&&Promise.resolve().then(()=>{this._indeterminate.set(false),this.indeterminateChange.emit(false);}),this._checked=!this._checked,this._transitionCheckState(this._checked?a.Checked:a.Unchecked),this._emitChangeEvent()):(this.disabled&&this.disabledInteractive||!this.disabled&&e==="noop")&&(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate);}_onInteractionEvent(e){e.stopPropagation();}_onBlur(){Promise.resolve().then(()=>{this._onTouched(),this._changeDetectorRef.markForCheck();});}_getAnimationClassForCheckStateTransition(e,n){if(this._animationsDisabled)return "";switch(e){case a.Init:if(n===a.Checked)return this._animationClasses.uncheckedToChecked;if(n==a.Indeterminate)return this._checked?this._animationClasses.checkedToIndeterminate:this._animationClasses.uncheckedToIndeterminate;break;case a.Unchecked:return n===a.Checked?this._animationClasses.uncheckedToChecked:this._animationClasses.uncheckedToIndeterminate;case a.Checked:return n===a.Unchecked?this._animationClasses.checkedToUnchecked:this._animationClasses.checkedToIndeterminate;case a.Indeterminate:return n===a.Checked?this._animationClasses.indeterminateToChecked:this._animationClasses.indeterminateToUnchecked}return ""}_syncIndeterminate(e){let n=this._inputElement;n&&(n.nativeElement.indeterminate=e);}_onInputClick(){this._handleInputClick();}_onTouchTargetClick(){this._handleInputClick(),this.disabled||this._inputElement.nativeElement.focus();}_preventBubblingFromLabel(e){e.target&&this._labelElement.nativeElement.contains(e.target)&&e.stopPropagation();}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=Rw({type:t,selectors:[["mat-checkbox"]],viewQuery:function(n,c){if(n&1&&Fg(W,5)(Y,5),n&2){let o;wC(o=CC())&&(c._inputElement=o.first),wC(o=CC())&&(c._labelElement=o.first);}},hostAttrs:[1,"mat-mdc-checkbox"],hostVars:16,hostBindings:function(n,c){n&2&&(Ng("id",c.id),Cg("tabindex",null)("aria-label",null)("aria-labelledby",null),PC(c.color?"mat-"+c.color:"mat-accent"),Hg("_mat-animation-noopable",c._animationsDisabled)("mdc-checkbox--disabled",c.disabled)("mat-mdc-checkbox-disabled",c.disabled)("mat-mdc-checkbox-checked",c.checked)("mat-mdc-checkbox-disabled-interactive",c.disabledInteractive));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],ariaExpanded:[2,"aria-expanded","ariaExpanded",QT],ariaControls:[0,"aria-controls","ariaControls"],ariaOwns:[0,"aria-owns","ariaOwns"],id:"id",required:[2,"required","required",QT],labelPosition:"labelPosition",name:"name",value:"value",disableRipple:[2,"disableRipple","disableRipple",QT],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?void 0:KT(e)],color:"color",disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],indeterminate:[2,"indeterminate","indeterminate",QT]},outputs:{change:"change",indeterminateChange:"indeterminateChange"},exportAs:["matCheckbox"],features:[rT([{provide:D$1,useExisting:Ti(()=>t),multi:true},{provide:y,useExisting:t,multi:true}]),Tu],ngContentSelectors:ee,decls:15,vars:23,consts:[["checkbox",""],["input",""],["label",""],["mat-internal-form-field","",3,"click","labelPosition"],[1,"mdc-checkbox"],["aria-hidden","true",1,"mat-mdc-checkbox-touch-target",3,"click"],["type","checkbox",1,"mdc-checkbox__native-control",3,"blur","click","change","checked","indeterminate","disabled","id","required","tabIndex"],["aria-hidden","true",1,"mdc-checkbox__ripple"],["aria-hidden","true",1,"mdc-checkbox__background"],["focusable","false","viewBox","0 0 24 24",1,"mdc-checkbox__checkmark"],["fill","none","d","M1.73,12.91 8.1,19.28 22.79,4.59",1,"mdc-checkbox__checkmark-path"],[1,"mdc-checkbox__mixedmark"],["mat-ripple","","aria-hidden","true",1,"mat-mdc-checkbox-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mdc-label",3,"for"]],template:function(n,c){if(n&1&&(DC(),Is(0,"div",3),Ag("click",function(k){return c._preventBubblingFromLabel(k)}),Is(1,"div",4,0)(3,"div",5),Ag("click",function(){return c._onTouchTargetClick()}),pl(),Is(4,"input",6,1),Ag("blur",function(){return c._onBlur()})("click",function(){return c._onInputClick()})("change",function(k){return c._onInteractionEvent(k)}),pl(),bg(6,"div",7),Is(7,"div",8),kf(),Is(8,"svg",9),bg(9,"path",10),pl(),Ff(),bg(10,"div",11),pl(),bg(11,"div",12),pl(),Is(12,"label",13,2),EC(14),pl()()),n&2){let o=bC(2);Tg("labelPosition",c.labelPosition),JE(4),Hg("mdc-checkbox--selected",c.checked),Tg("checked",c.checked)("indeterminate",c.indeterminate)("disabled",c.disabled&&!c.disabledInteractive)("id",c.inputId)("required",c.required)("tabIndex",c.disabled&&!c.disabledInteractive?-1:c.tabIndex),Cg("aria-label",c.ariaLabel||null)("aria-labelledby",c.ariaLabelledby)("aria-describedby",c.ariaDescribedby)("aria-checked",c.indeterminate?"mixed":null)("aria-controls",c.ariaControls)("aria-disabled",c.disabled&&c.disabledInteractive?true:null)("aria-expanded",c.ariaExpanded)("aria-owns",c.ariaOwns)("name",c.name)("value",c.value),JE(7),Tg("matRippleTrigger",o)("matRippleDisabled",c.disableRipple||c.disabled)("matRippleCentered",true),JE(),Tg("for",c.inputId);}},dependencies:[Oi,Qe],styles:[`.mdc-checkbox {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
position: relative;
|
|
4
4
|
flex: 0 0 18px;
|
|
@@ -471,4 +471,4 @@ import {b as Qe}from'./chunk-CUmZcEGx.js';import {D as D$1,i as y}from'./chunk-C
|
|
|
471
471
|
.mdc-checkbox__native-control:focus-visible ~ .mat-focus-indicator::before {
|
|
472
472
|
content: "";
|
|
473
473
|
}
|
|
474
|
-
`],encapsulation:2})}return t})(),ve=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=
|
|
474
|
+
`],encapsulation:2})}return t})(),ve=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Eo({type:t});static \u0275inj=qn({imports:[ne,wt]})}return t})();export{ne as n,ve as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,P,
|
|
1
|
+
import {g,G,P,h as Rw,i as hr,j as pr,I as Is,A as Ag,q as qC,m as pl,t as tC,J as JE,T as Tg,v as nC,a5 as vl,al as yt$1,am as Gm,a9 as fC,ai as Jg,aa as If,aj as XC,ab as wf,a3 as UI,ak as Xg,a6 as zI,D as Fg,E as wC,K as CC,ac as yC,a8 as Zg}from'./main-4SCUMPDY.js';import {y as yt,w as wt,t as ti,Y as Ye,Z as Zn,c as cn}from'./chunk-LgALnta4.js';var J=["inputElement"];function K(o,r){if(o&1&&(Is(0,"span",3),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.label);}}function U(o,r){if(o&1&&(Is(0,"small",5),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.hint);}}var h=class o{label="";placeholder="";hint="";isDisabled=false;value="";autoFocus=true;valueChange=new yt$1;enterPressed=new yt$1;inputElement;inputValue="";ngAfterViewInit(){this.inputValue=this.value,this.autoFocus&&setTimeout(()=>this.inputElement?.nativeElement.focus(),100);}onValueChange(r){this.valueChange.emit(r);}onEnter(){this.inputValue.trim()&&this.enterPressed.emit(this.inputValue.trim());}focus(){this.inputElement?.nativeElement.focus();}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-text-input"]],viewQuery:function(t,e){if(t&1&&Fg(J,5),t&2){let p;wC(p=CC())&&(e.inputElement=p.first);}},inputs:{label:"label",placeholder:"placeholder",hint:"hint",isDisabled:"isDisabled",value:"value",autoFocus:"autoFocus"},outputs:{valueChange:"valueChange",enterPressed:"enterPressed"},decls:6,vars:5,consts:[["inputElement",""],[1,"text-input-container"],[1,"text-input-wrapper"],[1,"text-input-label"],["type","text",1,"text-input-field",3,"ngModelChange","keydown.enter","ngModel","placeholder","disabled"],[1,"text-input-hint"]],template:function(t,e){if(t&1){let p=fC();Is(0,"div",1)(1,"label",2),tC(2,K,2,1,"span",3),Is(3,"input",4,0),Jg("ngModelChange",function(m){return If(p),XC(e.inputValue,m)||(e.inputValue=m),wf(m)}),Ag("ngModelChange",function(m){return e.onValueChange(m)})("keydown.enter",function(){return e.onEnter()}),pl(),UI(),pl(),tC(5,U,2,1,"small",5),pl();}t&2&&(JE(2),nC(e.label?2:-1),JE(),Xg("ngModel",e.inputValue),Tg("placeholder",e.placeholder)("disabled",e.isDisabled),zI(),JE(2),nC(e.hint?5:-1));},dependencies:[ti,Ye,Zn,cn,Gm],styles:[".text-input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%}.text-input-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;cursor:text}.text-input-label[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);margin:0}.text-input-field[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;font-size:1rem;color:var(--color-text);background:var(--color-bg);border:1px solid var(--color-border);border-radius:8px;outline:none;transition:all .2s ease}.text-input-field[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.text-input-field[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.1)}.text-input-field[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed;background:var(--color-surface)}.text-input-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);margin:0;font-style:italic}@media(max-width:768px){.text-input-field[_ngcontent-%COMP%]{padding:.65rem .85rem;font-size:.95rem}.text-input-label[_ngcontent-%COMP%]{font-size:.9rem}.text-input-hint[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};function X(o,r){if(o&1&&(Is(0,"div",8),qC(1),pl()),o&2){let t=yC();JE(),Zg(t.errorMessage);}}var L=class o{router=g(G);projectStateService=g(P);projectName="";projectPath="";isCreating=false;errorMessage=null;isValid(){return this.projectName.trim()!==""&&this.projectPath.trim()!==""}onCreate(){if(!this.isValid()){this.errorMessage="Both name and path are required";return}this.isCreating=true,this.errorMessage=null,this.projectStateService.createProject(this.projectName.trim(),this.projectPath.trim()).subscribe({next:()=>{let r=this.projectName.trim();this.isCreating=false,this.projectStateService.selectProject(r),this.router.navigate(["project",r]);},error:r=>{this.errorMessage=r.error?.error??"Failed to create project",this.isCreating=false;}});}onCancel(){this.router.navigate(["/"]);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Rw({type:o,selectors:[["app-project-new"]],decls:19,vars:9,consts:[[1,"project-new-page"],[1,"project-new-card"],["mat-button","",1,"project-new__back",3,"click"],[1,"project-new__title"],[1,"project-new__subtitle"],[1,"project-new__form"],["label","Project name","placeholder","my-project",3,"valueChange","value","isDisabled","autoFocus"],["label","Project path","placeholder","/path/to/project","hint","Absolute path to the project directory",3,"valueChange","enterPressed","value","isDisabled"],[1,"project-new__error"],[1,"project-new__actions"],["mat-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,e){t&1&&(Is(0,"div",0)(1,"div",1)(2,"button",2),Ag("click",function(){return e.onCancel()}),Is(3,"mat-icon"),qC(4,"arrow_back"),pl(),qC(5," Back to projects "),pl(),Is(6,"h1",3),qC(7,"New project"),pl(),Is(8,"p",4),qC(9,"Point Coday to an existing directory on your machine."),pl(),Is(10,"div",5)(11,"app-text-input",6),Ag("valueChange",function(d){return e.projectName=d}),pl(),Is(12,"app-text-input",7),Ag("valueChange",function(d){return e.projectPath=d})("enterPressed",function(){return e.onCreate()}),pl(),tC(13,X,2,1,"div",8),pl(),Is(14,"div",9)(15,"button",10),Ag("click",function(){return e.onCancel()}),qC(16,"Cancel"),pl(),Is(17,"button",11),Ag("click",function(){return e.onCreate()}),qC(18),pl()()()()),t&2&&(JE(11),Tg("value",e.projectName)("isDisabled",e.isCreating)("autoFocus",true),JE(),Tg("value",e.projectPath)("isDisabled",e.isCreating),JE(),nC(e.errorMessage?13:-1),JE(2),Tg("disabled",e.isCreating),JE(2),Tg("disabled",!e.isValid()||e.isCreating),JE(),vl(" ",e.isCreating?"Creating\u2026":"Create project"," "));},dependencies:[hr,pr,yt,wt,h],styles:[".project-new-page[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:center;min-height:100vh;width:100%;background:var(--color-bg);padding:2rem 1.5rem;box-sizing:border-box}.project-new-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:560px;padding:2rem;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:16px;box-shadow:var(--glass-shadow, 0 8px 32px rgba(31, 38, 135, .15));margin-top:2rem}.project-new__back[_ngcontent-%COMP%]{align-self:flex-start;margin-left:-.5rem;color:var(--color-text-secondary, #6e6e73)}.project-new__title[_ngcontent-%COMP%]{margin:0;font-size:1.625rem;font-weight:700;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.project-new__subtitle[_ngcontent-%COMP%]{margin:-.75rem 0 0;font-size:.9375rem;color:var(--color-text-secondary, #6e6e73)}.project-new__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.project-new__error[_ngcontent-%COMP%]{padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}.project-new__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;padding-top:.25rem}"],changeDetection:1})};export{L as ProjectNewComponent};
|