@whoz-oss/coday-client 0.211.0 → 0.211.1
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-26Y7QHUX.js +6 -0
- package/browser/{chunk-AFDQ6DZP.js → chunk-2D4GFLRK.js} +1 -1
- package/browser/{chunk-RAZWY4EA.js → chunk-2DY4SDDH.js} +1 -1
- package/browser/{chunk-BE7M4IG4.js → chunk-2RE6V43M.js} +1 -1
- package/browser/{chunk-TISGZSTL.js → chunk-4MF2HW3L.js} +1 -1
- package/browser/{chunk-CJGAUAQG.js → chunk-4SGDH2OK.js} +1 -1
- package/browser/{chunk-XEZ6VJ4O.js → chunk-5WOINLAX.js} +1 -1
- package/browser/{chunk-2BY3KQRI.js → chunk-6PK5FNSW.js} +1 -1
- package/browser/{chunk-C2WDN7VC.js → chunk-AUQEDCYM.js} +1 -1
- package/browser/{chunk-GPFXEDNE.js → chunk-B4FX32QR.js} +1 -1
- package/browser/{chunk-H3TZ44FQ.js → chunk-BFRQNDIH.js} +1 -1
- package/browser/{chunk-JE46DHIY.js → chunk-CFLI2OWG.js} +1 -1
- package/browser/{chunk-P2H3E3A5.js → chunk-CGTCICKZ.js} +1 -1
- package/browser/{chunk-XMX2HILZ.js → chunk-CX7XKBK2.js} +1 -1
- package/browser/{chunk-M7KJM66I.js → chunk-FNFYAJMS.js} +1 -1
- package/browser/{chunk-DCQJI6UI.js → chunk-HCFETNQ6.js} +1 -1
- package/browser/{chunk-SVDYPTKV.js → chunk-JBAFVFZR.js} +1 -1
- package/browser/{chunk-LNJHIZH4.js → chunk-JVDPRI2N.js} +1 -1
- package/browser/{chunk-ERDL7CBL.js → chunk-M3ZPITZW.js} +1 -1
- package/browser/{chunk-ICVL3MNG.js → chunk-M7CBEYMD.js} +1 -1
- package/browser/{chunk-EKDXOFZ4.js → chunk-MLKV56MK.js} +1 -1
- package/browser/{chunk-E5DDFFB5.js → chunk-MR7WYSXF.js} +1 -1
- package/browser/{chunk-2C5ENIQ7.js → chunk-MXVXTRUI.js} +1 -1
- package/browser/{chunk-JEQJLLFU.js → chunk-QNFNT462.js} +1 -1
- package/browser/{chunk-BIRQBBDM.js → chunk-QX3PREUS.js} +1 -1
- package/browser/{chunk-Z54GR5ZE.js → chunk-S7FMQPO3.js} +1 -1
- package/browser/{chunk-Y7F5MAVT.js → chunk-SJFPTVIP.js} +1 -1
- package/browser/{chunk-74OAAPUO.js → chunk-SOHEYVJF.js} +1 -1
- package/browser/{chunk-JKGV5VDH.js → chunk-SQCTA46L.js} +1 -1
- package/browser/{chunk-QGAK24J7.js → chunk-SQWYD6HJ.js} +1 -1
- package/browser/{chunk-7ZPD4MSE.js → chunk-U4IRQFQX.js} +1 -1
- package/browser/{chunk-VMVYRYDR.js → chunk-UDIJZYRI.js} +1 -1
- package/browser/{chunk-MXMEO3GF.js → chunk-UMIKI5LE.js} +1 -1
- package/browser/{chunk-UQKCMPNK.js → chunk-XKH66LUP.js} +1 -1
- package/browser/{chunk-GMEPQIKD.js → chunk-Y2UH6C4J.js} +1 -1
- package/browser/{chunk-6XJNC5K6.js → chunk-Y32N3VH4.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/main-FRF4H6OA.js +1 -0
- package/package.json +1 -1
- package/browser/chunk-F7X52MX4.js +0 -6
- package/browser/main-NWHBJ3QR.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-76J57JUY.js";import{c as S,d as _,f as u,g as C}from"./chunk-QVW2GZXC.js";import{a as q,b as U,c as Y,d as Q}from"./chunk-JKGV5VDH.js";import"./chunk-KCCB2UUO.js";import{e as I}from"./chunk-S7353OXG.js";import"./chunk-CHH2YNB6.js";import"./chunk-SDPYXC6U.js";import{a as L,d as b}from"./chunk-WE6G6IT3.js";import"./chunk-46WOQYAR.js";import"./chunk-AR4TQRY3.js";import{a as $,c as H}from"./chunk-32554AB2.js";import"./chunk-EIJAV76W.js";import"./chunk-E5MHC5FO.js";import"./chunk-SECZWZIB.js";import"./chunk-WBQOEBH7.js";import"./chunk-F7X52MX4.js";import"./chunk-NXKPUZGQ.js";import"./chunk-TGWQ4PGG.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import"./chunk-FM5EGDVD.js";import"./chunk-NNVKL253.js";import{B as x,Bb as M,Db as y,Fb as s,Jb as W,Ka as m,Kb as O,Lb as P,N as A,T as p,Tb as G,Ub as z,Wa as v,Z as F,ca as a,d as k,ga as c,h as f,ha as d,lb as V,mb as j,rb as w,sb as h,tb as g,ub as R,vb as D,wb as B}from"./chunk-QDO3O2UB.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=v({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(D(0,"h1",0),G(1),B()),t&2&&(m(),z(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}}"]})};var N=class o{destroy$=new f;isSetup=!1;codayService=a(I);preferencesService=a(b);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(p(this.destroy$),A(),x(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}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 k(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);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(!1)}})}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:!1});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:!1});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=F({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=M();h(0,"app-thread",4),y("chatFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){c(t);let r=s();return d(r.onDrawerStateChange(n))}),g()}if(o&2){let t=s();w("projectName",t.projectName)("threadId",t.threadId)}}function te(o,e){if(o&1){let t=M();h(0,"div",5),R(1,"app-welcome-message"),g(),h(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),y("messageSubmitted",function(n){c(t);let r=s();return d(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){c(t);let r=s();return d(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){c(t);let r=s();return d(r.onVoiceToggled(n))})("heightChanged",function(n){c(t);let r=s();return d(r.onInputHeightChanged(n))})("textareaFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())}),g()()()()}if(o&2){let t=s();m(6),w("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var K=class o{destroy$=new f;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=a(I);titleService=a(U);preferencesService=a(b);route=a($);router=a(H);threadApiService=a(L);agentNotificationService=a(N);firstMessageState=a(Y);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)")}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(p(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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}isDrawerOpen=!1;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=v({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&W(Z,5)(E,5),t&2){let n;O(n=P())&&(i.inputSection=n.first),O(n=P())&&(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&&(h(0,"app-sidenav",1)(1,"div",2),y("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),V(2,ee,1,2,"app-thread",3)(3,te,7,5),g()()),t&2&&(w("drawerOpen",i.isDrawerOpen),m(2),j(i.threadId?2:3))},dependencies:[q,Q,T,E],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:[S("slideIn",[C(":enter",[u({transform:"translateY(100%)",opacity:0}),_("300ms ease-out",u({transform:"translateY(0)",opacity:1}))]),C(":leave",[_("200ms ease-in",u({transform:"translateY(100%)",opacity:0}))])])]}})};export{K as MainAppComponent};
|
|
1
|
+
import{a as E}from"./chunk-76J57JUY.js";import{c as S,d as _,f as u,g as C}from"./chunk-QVW2GZXC.js";import{a as q,b as U,c as Y,d as Q}from"./chunk-SQCTA46L.js";import"./chunk-KCCB2UUO.js";import{e as I}from"./chunk-S7353OXG.js";import"./chunk-CHH2YNB6.js";import"./chunk-SDPYXC6U.js";import{a as L,d as b}from"./chunk-WE6G6IT3.js";import"./chunk-46WOQYAR.js";import"./chunk-AR4TQRY3.js";import{a as $,c as H}from"./chunk-32554AB2.js";import"./chunk-EIJAV76W.js";import"./chunk-E5MHC5FO.js";import"./chunk-SECZWZIB.js";import"./chunk-WBQOEBH7.js";import"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import"./chunk-TGWQ4PGG.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import"./chunk-FM5EGDVD.js";import"./chunk-NNVKL253.js";import{B as x,Bb as M,Db as y,Fb as s,Jb as W,Ka as m,Kb as O,Lb as P,N as A,T as p,Tb as G,Ub as z,Wa as v,Z as F,ca as a,d as k,ga as c,h as f,ha as d,lb as V,mb as j,rb as w,sb as h,tb as g,ub as R,vb as D,wb as B}from"./chunk-QDO3O2UB.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=v({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(D(0,"h1",0),G(1),B()),t&2&&(m(),z(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}}"]})};var N=class o{destroy$=new f;isSetup=!1;codayService=a(I);preferencesService=a(b);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(p(this.destroy$),A(),x(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}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 k(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);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(!1)}})}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:!1});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:!1});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=F({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=M();h(0,"app-thread",4),y("chatFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){c(t);let r=s();return d(r.onDrawerStateChange(n))}),g()}if(o&2){let t=s();w("projectName",t.projectName)("threadId",t.threadId)}}function te(o,e){if(o&1){let t=M();h(0,"div",5),R(1,"app-welcome-message"),g(),h(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),y("messageSubmitted",function(n){c(t);let r=s();return d(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){c(t);let r=s();return d(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){c(t);let r=s();return d(r.onVoiceToggled(n))})("heightChanged",function(n){c(t);let r=s();return d(r.onInputHeightChanged(n))})("textareaFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())}),g()()()()}if(o&2){let t=s();m(6),w("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var K=class o{destroy$=new f;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=a(I);titleService=a(U);preferencesService=a(b);route=a($);router=a(H);threadApiService=a(L);agentNotificationService=a(N);firstMessageState=a(Y);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)")}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(p(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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,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=!0,this.isStartingFirstMessage=!0,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=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}isDrawerOpen=!1;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=v({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&W(Z,5)(E,5),t&2){let n;O(n=P())&&(i.inputSection=n.first),O(n=P())&&(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&&(h(0,"app-sidenav",1)(1,"div",2),y("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),V(2,ee,1,2,"app-thread",3)(3,te,7,5),g()()),t&2&&(w("drawerOpen",i.isDrawerOpen),m(2),j(i.threadId?2:3))},dependencies:[q,Q,T,E],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:[S("slideIn",[C(":enter",[u({transform:"translateY(100%)",opacity:0}),_("300ms ease-out",u({transform:"translateY(0)",opacity:1}))]),C(":leave",[_("200ms ease-in",u({transform:"translateY(100%)",opacity:0}))])])]}})};export{K as MainAppComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as M,u as D}from"./chunk-
|
|
1
|
+
import{o as M,u as D}from"./chunk-26Y7QHUX.js";import{Bb as v,Db as g,Fb as a,Ka as r,Tb as c,Ub as b,Vb as P,Wa as y,ga as s,ha as m,jb as h,lb as p,lc as C,mb as _,oc as f,pc as u,rb as w,sb as n,ta as x,tb as i}from"./chunk-QDO3O2UB.js";function A(t,d){if(t&1&&(n(0,"span",4),c(1),i()),t&2){let e=a();h("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),r(),P(" ",e.badge().label," ")}}function I(t,d){if(t&1&&(n(0,"span",6),c(1),i()),t&2){let e=a();r(),b(e.config().baseUrl)}}function k(t,d){if(t&1){let e=v();n(0,"span",8),c(1,"Delete?"),i(),n(2,"ds-icon-button",9),g("action",function(){s(e);let l=a();return m(l.onDeleteConfirmed())}),i(),n(3,"ds-icon-button",10),g("action",function(){s(e);let l=a();return m(l.onDeleteCancelled())}),i()}}function E(t,d){if(t&1){let e=v();n(0,"ds-kebab-menu",13),g("itemSelected",function(l){s(e);let S=a(2);return m(S.onMenuAction(l))}),i()}if(t&2){let e=a(2);w("items",e.menuItems())}}function R(t,d){if(t&1){let e=v();n(0,"ds-icon-button",11),g("action",function(){s(e);let l=a();return m(l.onDuplicate())}),i(),p(1,E,1,1,"ds-kebab-menu",12)}if(t&2){let e=a();r(),_(e.readOnly()?-1:1)}}var q=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration de niveau plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),O=class t{config=u.required();scope=u.required();readOnly=u(!1);showBadge=u(!0);editRequested=f();deleteRequested=f();duplicateRequested=f();pendingDelete=x(!1);badge=C(()=>q[this.scope()]);menuItems=C(()=>[{key:"edit",label:"Edit provider",icon:"edit"},{key:"delete",label:"Delete provider",icon:"delete",variant:"danger"}]);onMenuAction(d){switch(d){case"edit":this.editRequested.emit(this.config());break;case"delete":this.pendingDelete.set(!0);break}}onDuplicate(){this.duplicateRequested.emit(this.config())}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.config())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=y({type:t,selectors:[["agentos-ai-provider-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:5,consts:[["role","listitem",1,"ai-provider-item"],[1,"ai-provider-item__body"],[1,"ai-provider-item__heading"],[1,"ai-provider-item__name"],[1,"ai-provider-item__badge"],[1,"ai-provider-item__type"],[1,"ai-provider-item__url"],[1,"ai-provider-item__actions"],[1,"ai-provider-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this provider",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(n(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),c(4),i(),p(5,A,2,3,"span",4),i(),n(6,"span",5),c(7),i(),p(8,I,2,1,"span",6),i(),n(9,"div",7),p(10,k,4,0)(11,R,2,1),i()()),e&2&&(r(4),b(o.config().name),r(),_(o.showBadge()?5:-1),r(2),b(o.config().apiType),r(),_(o.config().baseUrl?8:-1),r(2),_(o.pendingDelete()?10:11))},dependencies:[D,M],styles:[".ai-provider-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}.ai-provider-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.ai-provider-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-provider-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.ai-provider-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.ai-provider-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.ai-provider-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.ai-provider-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.ai-provider-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.ai-provider-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__url[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover .ai-provider-item__actions[_ngcontent-%COMP%], .ai-provider-item[_ngcontent-%COMP%]:focus-within .ai-provider-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-provider-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{O as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"./chunk-X5QAL64P.js";import{a as Q}from"./chunk-RYCGZWL2.js";import"./chunk-CK52GCRW.js";import{c as H}from"./chunk-IAIUV3RV.js";import{a as q}from"./chunk-ZX7BSCA5.js";import{c as Y}from"./chunk-Q4QETBSU.js";import"./chunk-5TU5JR3W.js";import{c as F}from"./chunk-32554AB2.js";import{o as j}from"./chunk-F7X52MX4.js";import"./chunk-NXKPUZGQ.js";import"./chunk-QN7OUZIZ.js";import{a as w,c as G}from"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import{F as A,c as K,g as z,h as N,i as $,l as M,n as B,v as R,w as L}from"./chunk-7VQ75OC6.js";import"./chunk-NNVKL253.js";import{Bb as v,Db as c,Ec as I,Fb as s,Ka as d,Rb as S,Tb as r,Ub as u,Vb as h,Wa as V,ca as f,ga as p,ha as m,jb as E,kb as O,lb as g,ma as D,mb as C,pb as b,qb as y,rb as k,sb as n,t as U,ta as x,tb as t,u as T,ub as P}from"./chunk-QDO3O2UB.js";var W=(o,i)=>i.value;function Z(o,i){o&1&&(n(0,"p",4),r(1,"Loading\u2026"),t())}function ee(o,i){if(o&1){let e=v();n(0,"button",16),c("click",function(){let a=p(e).$implicit,_=s(2);return m(_.setTheme(a.value))}),r(1),t()}if(o&2){let e=i.$implicit,l=s(2);S("user-profile__segmented-option--active",l.theme()===e.value),E("aria-pressed",l.theme()===e.value),d(),h(" ",e.label," ")}}function te(o,i){if(o&1){let e=v();n(0,"button",16),c("click",function(){let a=p(e).$implicit,_=s(2);return m(_.setEnterKeyBehavior(a.value))}),r(1),t()}if(o&2){let e=i.$implicit,l=s(2);S("user-profile__segmented-option--active",l.enterKeyBehavior()===e.value),E("aria-pressed",l.enterKeyBehavior()===e.value),d(),h(" ",e.label," ")}}function ne(o,i){if(o&1){let e=v();n(0,"form",17),c("ngSubmit",function(){p(e);let a=s(2);return m(a.save())}),n(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",18),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",18),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"label",19),r(19,"First name"),t(),P(20,"input",20),t(),n(21,"div",7)(22,"label",21),r(23,"Last name"),t(),P(24,"input",22),t(),n(25,"div",7)(26,"label",23),r(27,"Bio"),t(),P(28,"textarea",24),t()(),n(29,"div",25)(30,"button",26),r(31),t(),n(32,"button",27),c("click",function(){p(e);let a=s(2);return m(a.cancelEditing())}),r(33,"Cancel"),t()()()}if(o&2){let e=s(),l=s();k("formGroup",l.form),d(8),u(e.email),d(5),u(e.externalId),d(17),k("disabled",l.isSaving()),d(),h(" ",l.isSaving()?"Saving\u2026":"Save changes"," ")}}function ie(o,i){o&1&&(n(0,"p",35),r(1," No global configuration yet. Create one from the Integrations / AI Providers / AI Models pages of your namespaces. "),t())}function re(o,i){if(o&1){let e=v();n(0,"span",42),r(1,"Delete?"),t(),n(2,"button",43),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.confirmDelete(a))}),r(3," Confirm "),t(),n(4,"button",44),c("click",function(){p(e);let a=s(7);return m(a.cancelDelete())}),r(5," Cancel "),t()}}function oe(o,i){if(o&1){let e=v();n(0,"button",44),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.armDelete(a))}),r(1," Delete "),t()}}function le(o,i){if(o&1&&(n(0,"li",38)(1,"span",39),r(2),t(),n(3,"span",40),r(4),t(),g(5,re,6,0)(6,oe,2,0,"button",41),t()),o&2){let e=i.$implicit,l=s(6);d(2),u(e.name),d(2),u(e.subtitle),d(),C(l.isPendingDelete(e)?5:6)}}function ae(o,i){if(o&1&&(n(0,"h3",36),r(1,"Integrations"),t(),n(2,"ul",37),b(3,le,7,3,"li",38,O().trackEntry,!0),t()),o&2){let e=s(5);d(3),y(e.recap().integrations)}}function se(o,i){if(o&1){let e=v();n(0,"span",42),r(1,"Delete?"),t(),n(2,"button",43),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.confirmDelete(a))}),r(3," Confirm "),t(),n(4,"button",44),c("click",function(){p(e);let a=s(7);return m(a.cancelDelete())}),r(5," Cancel "),t()}}function de(o,i){if(o&1){let e=v();n(0,"button",44),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.armDelete(a))}),r(1," Delete "),t()}}function _e(o,i){if(o&1&&(n(0,"li",38)(1,"span",39),r(2),t(),n(3,"span",40),r(4),t(),g(5,se,6,0)(6,de,2,0,"button",41),t()),o&2){let e=i.$implicit,l=s(6);d(2),u(e.name),d(2),u(e.subtitle),d(),C(l.isPendingDelete(e)?5:6)}}function ce(o,i){if(o&1&&(n(0,"h3",36),r(1,"AI Providers"),t(),n(2,"ul",37),b(3,_e,7,3,"li",38,O().trackEntry,!0),t()),o&2){let e=s(5);d(3),y(e.recap().aiProviders)}}function pe(o,i){if(o&1&&(g(0,ae,5,0),g(1,ce,5,0)),o&2){let e=s(4);C(e.recap().integrations.length>0?0:-1),d(),C(e.recap().aiProviders.length>0?1:-1)}}function me(o,i){if(o&1&&g(0,ie,2,0,"p",35)(1,pe,2,2),o&2){let e=s(3);C(e.recap().total===0?0:1)}}function ue(o,i){if(o&1){let e=v();n(0,"div",15)(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",28),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",28),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"span",8),r(19,"First name"),t(),n(20,"span",28),r(21),t()(),n(22,"div",7)(23,"span",8),r(24,"Last name"),t(),n(25,"span",28),r(26),t()(),n(27,"div",29)(28,"span",8),r(29,"Bio"),t(),n(30,"span",28),r(31),t()()(),n(32,"div",25)(33,"button",30),c("click",function(){p(e);let a=s(2);return m(a.startEditing())}),r(34," Edit profile "),t()(),n(35,"div",31)(36,"button",32),c("click",function(){p(e);let a=s(2);return m(a.toggleOverrides())}),n(37,"span",33),r(38,"\u25B6"),t(),r(39," My global user configurations "),n(40,"span",34),r(41),t()(),g(42,me,2,1),t()()}if(o&2){let e=s(),l=s();d(8),u(e.email),d(5),u(e.externalId),d(8),u(e.firstname||"\u2014"),d(5),u(e.lastname||"\u2014"),d(5),u(e.bio||"\u2014"),d(5),E("aria-expanded",l.isOverridesExpanded()),d(),S("user-profile__overrides-arrow--open",l.isOverridesExpanded()),d(4),h("(",l.recap().total,")"),d(),C(l.isOverridesExpanded()?42:-1)}}function fe(o,i){if(o&1&&(n(0,"div",5)(1,"h2",6),r(2,"Appearance"),t(),n(3,"div",7)(4,"span",8),r(5,"Theme"),t(),n(6,"div",9),b(7,ee,2,4,"button",10,W),t()()(),n(9,"div",5)(10,"h2",6),r(11,"Composer"),t(),n(12,"div",7)(13,"span",8),r(14,"Enter key"),t(),n(15,"div",11)(16,"div",12),b(17,te,2,4,"button",10,W),t(),n(19,"p",13),r(20,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),t()()()(),g(21,ne,34,5,"form",14)(22,ue,43,10,"div",15)),o&2){let e=s();d(7),y(e.themeOptions),d(10),y(e.enterKeyOptions),d(4),C(e.isEditing()?21:22)}}function ge(o,i){o&1&&(n(0,"p",4),r(1,"Unable to load profile."),t())}var X=class o{userState=f(q);router=f(F);location=f(I);destroyRef=f(D);integrationState=f(J);providerState=f(Q);themePort=f(Y);preferencesPort=f(H);isEditing=x(!1);isLoading=x(!1);isSaving=x(!1);isOverridesExpanded=x(!1);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new $({firstname:new M("",{nonNullable:!0}),lastname:new M("",{nonNullable:!0}),bio:new M("",{nonNullable:!0})});recap=G(T([this.integrationState.userGlobal$,this.providerState.userGlobal$]).pipe(U(([i,e])=>{let l=i.map(_=>({category:"integration",id:_.id??"",name:_.name,subtitle:_.integrationType})),a=e.map(_=>({category:"aiProvider",id:_.id??"",name:_.name,subtitle:_.apiType}));return{integrations:l,aiProviders:a,total:l.length+a.length}})),{initialValue:{integrations:[],aiProviders:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(!0),this.userState.loadMe().pipe(w(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)})}startEditing(){this.syncFormFromState(),this.isEditing.set(!0)}cancelEditing(){this.isEditing.set(!1)}setTheme(i){this.themePort.setTheme(i)}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i)}save(){this.isSaving()||(this.isSaving.set(!0),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(w(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(!1),this.isEditing.set(!1)},error:()=>this.isSaving.set(!1)}))}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null)}pendingDeleteKey=x(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i))}cancelDelete(){this.pendingDeleteKey.set(null)}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(w(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,l)}})}entryKey(i){return`${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"])}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],["role","group","aria-label","Theme",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,l){if(e&1&&(n(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),c("action",function(){return l.goBack()}),t(),n(3,"h1",3),r(4,"My profile"),t()(),g(5,Z,2,0,"p",4)(6,fe,23,1)(7,ge,2,0,"p",4),t()),e&2){let a;d(5),C(l.isLoading()?5:(a=l.currentUser())?6:7,a)}},dependencies:[A,B,K,z,N,L,R,j],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px dashed var(--color-border)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-size:.75rem;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-tertiary);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:6px}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:none;font-size:.75rem;color:var(--color-error);cursor:pointer;padding:.2rem .4rem;border-radius:4px}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--color-error) 12%,transparent)}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-secondary, #6e6e73);border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .06));padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text, #1d1d1f);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-border, rgba(0, 0, 0, .1));color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover, #0051d5)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{X as UserProfileComponent};
|
|
1
|
+
import{a as J}from"./chunk-X5QAL64P.js";import{a as Q}from"./chunk-RYCGZWL2.js";import"./chunk-CK52GCRW.js";import{c as H}from"./chunk-IAIUV3RV.js";import{a as q}from"./chunk-ZX7BSCA5.js";import{c as Y}from"./chunk-Q4QETBSU.js";import"./chunk-5TU5JR3W.js";import{c as F}from"./chunk-32554AB2.js";import{o as j}from"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import"./chunk-QN7OUZIZ.js";import{a as w,c as G}from"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import{F as A,c as K,g as z,h as N,i as $,l as M,n as B,v as R,w as L}from"./chunk-7VQ75OC6.js";import"./chunk-NNVKL253.js";import{Bb as v,Db as c,Ec as I,Fb as s,Ka as d,Rb as S,Tb as r,Ub as u,Vb as h,Wa as V,ca as f,ga as p,ha as m,jb as E,kb as O,lb as g,ma as D,mb as C,pb as b,qb as y,rb as k,sb as n,t as U,ta as x,tb as t,u as T,ub as P}from"./chunk-QDO3O2UB.js";var W=(o,i)=>i.value;function Z(o,i){o&1&&(n(0,"p",4),r(1,"Loading\u2026"),t())}function ee(o,i){if(o&1){let e=v();n(0,"button",16),c("click",function(){let a=p(e).$implicit,_=s(2);return m(_.setTheme(a.value))}),r(1),t()}if(o&2){let e=i.$implicit,l=s(2);S("user-profile__segmented-option--active",l.theme()===e.value),E("aria-pressed",l.theme()===e.value),d(),h(" ",e.label," ")}}function te(o,i){if(o&1){let e=v();n(0,"button",16),c("click",function(){let a=p(e).$implicit,_=s(2);return m(_.setEnterKeyBehavior(a.value))}),r(1),t()}if(o&2){let e=i.$implicit,l=s(2);S("user-profile__segmented-option--active",l.enterKeyBehavior()===e.value),E("aria-pressed",l.enterKeyBehavior()===e.value),d(),h(" ",e.label," ")}}function ne(o,i){if(o&1){let e=v();n(0,"form",17),c("ngSubmit",function(){p(e);let a=s(2);return m(a.save())}),n(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",18),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",18),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"label",19),r(19,"First name"),t(),P(20,"input",20),t(),n(21,"div",7)(22,"label",21),r(23,"Last name"),t(),P(24,"input",22),t(),n(25,"div",7)(26,"label",23),r(27,"Bio"),t(),P(28,"textarea",24),t()(),n(29,"div",25)(30,"button",26),r(31),t(),n(32,"button",27),c("click",function(){p(e);let a=s(2);return m(a.cancelEditing())}),r(33,"Cancel"),t()()()}if(o&2){let e=s(),l=s();k("formGroup",l.form),d(8),u(e.email),d(5),u(e.externalId),d(17),k("disabled",l.isSaving()),d(),h(" ",l.isSaving()?"Saving\u2026":"Save changes"," ")}}function ie(o,i){o&1&&(n(0,"p",35),r(1," No global configuration yet. Create one from the Integrations / AI Providers / AI Models pages of your namespaces. "),t())}function re(o,i){if(o&1){let e=v();n(0,"span",42),r(1,"Delete?"),t(),n(2,"button",43),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.confirmDelete(a))}),r(3," Confirm "),t(),n(4,"button",44),c("click",function(){p(e);let a=s(7);return m(a.cancelDelete())}),r(5," Cancel "),t()}}function oe(o,i){if(o&1){let e=v();n(0,"button",44),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.armDelete(a))}),r(1," Delete "),t()}}function le(o,i){if(o&1&&(n(0,"li",38)(1,"span",39),r(2),t(),n(3,"span",40),r(4),t(),g(5,re,6,0)(6,oe,2,0,"button",41),t()),o&2){let e=i.$implicit,l=s(6);d(2),u(e.name),d(2),u(e.subtitle),d(),C(l.isPendingDelete(e)?5:6)}}function ae(o,i){if(o&1&&(n(0,"h3",36),r(1,"Integrations"),t(),n(2,"ul",37),b(3,le,7,3,"li",38,O().trackEntry,!0),t()),o&2){let e=s(5);d(3),y(e.recap().integrations)}}function se(o,i){if(o&1){let e=v();n(0,"span",42),r(1,"Delete?"),t(),n(2,"button",43),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.confirmDelete(a))}),r(3," Confirm "),t(),n(4,"button",44),c("click",function(){p(e);let a=s(7);return m(a.cancelDelete())}),r(5," Cancel "),t()}}function de(o,i){if(o&1){let e=v();n(0,"button",44),c("click",function(){p(e);let a=s().$implicit,_=s(6);return m(_.armDelete(a))}),r(1," Delete "),t()}}function _e(o,i){if(o&1&&(n(0,"li",38)(1,"span",39),r(2),t(),n(3,"span",40),r(4),t(),g(5,se,6,0)(6,de,2,0,"button",41),t()),o&2){let e=i.$implicit,l=s(6);d(2),u(e.name),d(2),u(e.subtitle),d(),C(l.isPendingDelete(e)?5:6)}}function ce(o,i){if(o&1&&(n(0,"h3",36),r(1,"AI Providers"),t(),n(2,"ul",37),b(3,_e,7,3,"li",38,O().trackEntry,!0),t()),o&2){let e=s(5);d(3),y(e.recap().aiProviders)}}function pe(o,i){if(o&1&&(g(0,ae,5,0),g(1,ce,5,0)),o&2){let e=s(4);C(e.recap().integrations.length>0?0:-1),d(),C(e.recap().aiProviders.length>0?1:-1)}}function me(o,i){if(o&1&&g(0,ie,2,0,"p",35)(1,pe,2,2),o&2){let e=s(3);C(e.recap().total===0?0:1)}}function ue(o,i){if(o&1){let e=v();n(0,"div",15)(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",28),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",28),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"span",8),r(19,"First name"),t(),n(20,"span",28),r(21),t()(),n(22,"div",7)(23,"span",8),r(24,"Last name"),t(),n(25,"span",28),r(26),t()(),n(27,"div",29)(28,"span",8),r(29,"Bio"),t(),n(30,"span",28),r(31),t()()(),n(32,"div",25)(33,"button",30),c("click",function(){p(e);let a=s(2);return m(a.startEditing())}),r(34," Edit profile "),t()(),n(35,"div",31)(36,"button",32),c("click",function(){p(e);let a=s(2);return m(a.toggleOverrides())}),n(37,"span",33),r(38,"\u25B6"),t(),r(39," My global user configurations "),n(40,"span",34),r(41),t()(),g(42,me,2,1),t()()}if(o&2){let e=s(),l=s();d(8),u(e.email),d(5),u(e.externalId),d(8),u(e.firstname||"\u2014"),d(5),u(e.lastname||"\u2014"),d(5),u(e.bio||"\u2014"),d(5),E("aria-expanded",l.isOverridesExpanded()),d(),S("user-profile__overrides-arrow--open",l.isOverridesExpanded()),d(4),h("(",l.recap().total,")"),d(),C(l.isOverridesExpanded()?42:-1)}}function fe(o,i){if(o&1&&(n(0,"div",5)(1,"h2",6),r(2,"Appearance"),t(),n(3,"div",7)(4,"span",8),r(5,"Theme"),t(),n(6,"div",9),b(7,ee,2,4,"button",10,W),t()()(),n(9,"div",5)(10,"h2",6),r(11,"Composer"),t(),n(12,"div",7)(13,"span",8),r(14,"Enter key"),t(),n(15,"div",11)(16,"div",12),b(17,te,2,4,"button",10,W),t(),n(19,"p",13),r(20,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),t()()()(),g(21,ne,34,5,"form",14)(22,ue,43,10,"div",15)),o&2){let e=s();d(7),y(e.themeOptions),d(10),y(e.enterKeyOptions),d(4),C(e.isEditing()?21:22)}}function ge(o,i){o&1&&(n(0,"p",4),r(1,"Unable to load profile."),t())}var X=class o{userState=f(q);router=f(F);location=f(I);destroyRef=f(D);integrationState=f(J);providerState=f(Q);themePort=f(Y);preferencesPort=f(H);isEditing=x(!1);isLoading=x(!1);isSaving=x(!1);isOverridesExpanded=x(!1);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new $({firstname:new M("",{nonNullable:!0}),lastname:new M("",{nonNullable:!0}),bio:new M("",{nonNullable:!0})});recap=G(T([this.integrationState.userGlobal$,this.providerState.userGlobal$]).pipe(U(([i,e])=>{let l=i.map(_=>({category:"integration",id:_.id??"",name:_.name,subtitle:_.integrationType})),a=e.map(_=>({category:"aiProvider",id:_.id??"",name:_.name,subtitle:_.apiType}));return{integrations:l,aiProviders:a,total:l.length+a.length}})),{initialValue:{integrations:[],aiProviders:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(!0),this.userState.loadMe().pipe(w(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)})}startEditing(){this.syncFormFromState(),this.isEditing.set(!0)}cancelEditing(){this.isEditing.set(!1)}setTheme(i){this.themePort.setTheme(i)}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i)}save(){this.isSaving()||(this.isSaving.set(!0),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(w(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(!1),this.isEditing.set(!1)},error:()=>this.isSaving.set(!1)}))}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null)}pendingDeleteKey=x(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i))}cancelDelete(){this.pendingDeleteKey.set(null)}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(w(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,l)}})}entryKey(i){return`${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"])}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=V({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],["role","group","aria-label","Theme",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,l){if(e&1&&(n(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),c("action",function(){return l.goBack()}),t(),n(3,"h1",3),r(4,"My profile"),t()(),g(5,Z,2,0,"p",4)(6,fe,23,1)(7,ge,2,0,"p",4),t()),e&2){let a;d(5),C(l.isLoading()?5:(a=l.currentUser())?6:7,a)}},dependencies:[A,B,K,z,N,L,R,j],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px dashed var(--color-border)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-size:.75rem;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-tertiary);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:6px}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:none;font-size:.75rem;color:var(--color-error);cursor:pointer;padding:.2rem .4rem;border-radius:4px}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--color-error) 12%,transparent)}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-secondary, #6e6e73);border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .06));padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text, #1d1d1f);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-border, rgba(0, 0, 0, .1));color:var(--color-text-secondary, #6e6e73);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover, #0051d5)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{X as UserProfileComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as U}from"./chunk-
|
|
1
|
+
import{a as O,b as U}from"./chunk-BFRQNDIH.js";import{h as G}from"./chunk-5TU5JR3W.js";import{c as j}from"./chunk-32554AB2.js";import{o as F,t as z}from"./chunk-26Y7QHUX.js";import{a as b}from"./chunk-BVQ4XPRS.js";import{Bb as f,Db as d,Fb as r,Ic as H,Ka as D,Pb as L,S as V,Tb as _,Wa as N,ab as A,bc as M,ca as v,ec as E,fc as P,ga as m,ha as c,i as I,ia as u,ic as $,ja as C,lb as x,ma as S,mb as w,oc as l,pc as B,rb as h,sb as a,t as T,ta as y,tb as s,ub as g,yb as k,zb as q}from"./chunk-QDO3O2UB.js";var Q=()=>[];function X(p,n){if(p&1){let e=f();k(0,1),a(1,"span",2),_(2,"Delete?"),s(),a(3,"ds-icon-button",3),d("action",function(){m(e);let t=r();return c(t.onDeleteConfirmed())}),s(),a(4,"ds-icon-button",4),d("action",function(){m(e);let t=r();return c(t.onDeleteCancelled())}),s(),q()}}function Y(p,n){if(p&1){let e=f();k(0,1),a(1,"button",5),d("click",function(){m(e);let t=r();return c(t.onIntegrations())}),u(),a(2,"svg",6),g(3,"path",7)(4,"path",8),s(),_(5," Integrations "),s(),C(),a(6,"button",5),d("click",function(){m(e);let t=r();return c(t.onAiProviders())}),u(),a(7,"svg",6),g(8,"rect",9)(9,"rect",10)(10,"path",11),s(),_(11," AI Providers "),s(),C(),a(12,"button",5),d("click",function(){m(e);let t=r();return c(t.onAiModels())}),u(),a(13,"svg",6),g(14,"path",12),s(),_(15," AI Models "),s(),C(),a(16,"button",5),d("click",function(){m(e);let t=r();return c(t.onAgentConfigs())}),u(),a(17,"svg",6),g(18,"path",13)(19,"circle",14)(20,"circle",15),s(),_(21," Agent Configs "),s(),C(),a(22,"button",5),d("click",function(){m(e);let t=r();return c(t.onPrompts())}),u(),a(23,"svg",6),g(24,"path",16)(25,"path",17)(26,"path",18),s(),_(27," Prompts "),s(),q()}}var R=class p{namespace=B.required();selected=l();editRequested=l();integrationsRequested=l();aiProvidersRequested=l();aiModelsRequested=l();agentConfigsRequested=l();promptsRequested=l();deleteRequested=l();pendingDelete=y(!1);menuItems=[{key:"edit",label:"Edit namespace"},{key:"separator",label:"",variant:"separator"},{key:"delete",label:"Delete namespace",variant:"danger"}];onSelect(){this.selected.emit(this.namespace())}onIntegrations(){this.integrationsRequested.emit(this.namespace())}onAiProviders(){this.aiProvidersRequested.emit(this.namespace())}onAiModels(){this.aiModelsRequested.emit(this.namespace())}onAgentConfigs(){this.agentConfigsRequested.emit(this.namespace())}onPrompts(){this.promptsRequested.emit(this.namespace())}onMenuAction(n){switch(n){case"edit":this.editRequested.emit(this.namespace());break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.namespace())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||p)};static \u0275cmp=N({type:p,selectors:[["agentos-namespace-item"]],inputs:{namespace:[1,"namespace"]},outputs:{selected:"selected",editRequested:"editRequested",integrationsRequested:"integrationsRequested",aiProvidersRequested:"aiProvidersRequested",aiModelsRequested:"aiModelsRequested",agentConfigsRequested:"agentConfigsRequested",promptsRequested:"promptsRequested",deleteRequested:"deleteRequested"},decls:3,vars:4,consts:[[3,"nameClicked","menuAction","name","menuItems"],["agentosCardChips",""],[1,"ns-confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel",3,"action"],["type","button",1,"ac-chip",3,"click"],["width","13","height","13","viewBox","0 0 24 24","fill","none","aria-hidden","true"],["d","M8 2v4M16 2v4M6 8h12v3a6 6 0 01-12 0V8z","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["d","M12 17v3","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["x","7","y","7","width","10","height","10","rx","1.5","stroke","currentColor","stroke-width","1.6"],["x","10","y","10","width","4","height","4","rx","0.5","stroke","currentColor","stroke-width","1.4"],["d","M9 2v3M12 2v3M15 2v3M9 19v3M12 19v3M15 19v3M2 9h3M2 12h3M2 15h3M19 9h3M19 12h3M19 15h3","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"],["d","M12 3l1.8 5.6L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.4L12 3z","stroke","currentColor","stroke-width","1.5","stroke-linejoin","round"],["d","M4 7h9M17 7h3M4 17h3M11 17h9","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["cx","13","cy","7","r","2.2","stroke","currentColor","stroke-width","1.6"],["cx","8","cy","17","r","2.2","stroke","currentColor","stroke-width","1.6"],["d","M7 3h7l4 4v14a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M14 3v4h4","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M9 13h6M9 17h6","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"]],template:function(e,i){e&1&&(a(0,"agentos-action-card",0),d("nameClicked",function(){return i.onSelect()})("menuAction",function(o){return i.onMenuAction(o)}),x(1,X,5,0,"ng-container",1)(2,Y,28,0,"ng-container",1),s()),e&2&&(h("name",i.namespace().name)("menuItems",i.pendingDelete()?M(3,Q):i.menuItems),D(),w(i.pendingDelete()?1:2))},dependencies:[U,O,F],styles:[".ns-confirm-label[_ngcontent-%COMP%]{font:500 12px Inter,sans-serif;color:var(--color-error, #a5140a);white-space:nowrap;align-self:center}"],changeDetection:0})};var Z=()=>[];function ee(p,n){if(p&1){let e=f();a(0,"agentos-namespace-item",3),d("selected",function(t){m(e);let o=r(2);return c(o.navigateToHome(t.id??""))})("editRequested",function(t){m(e);let o=r(2);return c(o.navigateToEdit(t))})("deleteRequested",function(t){m(e);let o=r(2);return c(o.deleteNamespace(t))})("integrationsRequested",function(t){m(e);let o=r(2);return c(o.openIntegrations(t))})("aiProvidersRequested",function(t){m(e);let o=r(2);return c(o.openAiProviders(t))})("aiModelsRequested",function(t){m(e);let o=r(2);return c(o.openAiModels(t))})("agentConfigsRequested",function(t){m(e);let o=r(2);return c(o.openAgentConfigs(t))})("promptsRequested",function(t){m(e);let o=r(2);return c(o.openPrompts(t))}),s()}p&2&&h("namespace",n)}function te(p,n){if(p&1&&x(0,ee,1,1,"agentos-namespace-item",2),p&2){let e,i=n.$implicit,t=r();w((e=t.namespacesById().get(i.id))?0:-1,e)}}var W=class p{router=v(j);namespaceController=v(G);destroyRef=v(S);refresh$=new I(void 0);namespaces$=this.refresh$.pipe(V(()=>this.namespaceController.listAllNamespace()));namespaceItems$=this.namespaces$.pipe(T(n=>n.map(e=>({id:e.id??"",name:e.name,description:e.description,badges:e.defaultAgentName?[{label:e.defaultAgentName,variant:"info"}]:void 0}))));namespacesById=y(new Map);constructor(){this.namespaces$.pipe(b(this.destroyRef)).subscribe(n=>{this.namespacesById.set(new Map(n.map(e=>[e.id??"",e])))})}navigateToHome(n){this.router.navigate(["/agentos/home"],{queryParams:{ns:n}})}navigateToCreate(){this.router.navigate(["/agentos/namespaces/new"])}navigateToEdit(n){this.router.navigate(["/agentos/namespaces",n.id??"","edit"])}openIntegrations(n){this.router.navigate(["/agentos",n.id,"integrations"])}openAiProviders(n){this.router.navigate(["/agentos",n.id,"ai-providers"])}openAiModels(n){this.router.navigate(["/agentos",n.id,"ai-models"])}openAgentConfigs(n){this.router.navigate(["/agentos",n.id,"agent-configs"])}openPrompts(n){this.router.navigate(["/agentos",n.id,"prompts"])}deleteNamespace(n){this.namespaceController.deleteNamespace(n.id??"").pipe(b(this.destroyRef)).subscribe(()=>this.refresh$.next())}static \u0275fac=function(e){return new(e||p)};static \u0275cmp=N({type:p,selectors:[["agentos-namespace-list"]],decls:4,vars:6,consts:[["namespaceItemTpl",""],["title","Namespaces","emptyMessage","No namespaces yet. Create one to get started.","cardMinWidth","400px",3,"itemSelected","createRequested","items","showCreate","itemTemplate"],[3,"namespace"],[3,"selected","editRequested","deleteRequested","integrationsRequested","aiProvidersRequested","aiModelsRequested","agentConfigsRequested","promptsRequested","namespace"]],template:function(e,i){if(e&1&&(a(0,"ds-entity-list",1),E(1,"async"),d("itemSelected",function(o){return i.navigateToHome(o)})("createRequested",function(){return i.navigateToCreate()}),s(),A(2,te,1,1,"ng-template",null,0,$)),e&2){let t=L(3);h("items",P(1,3,i.namespaceItems$)??M(5,Z))("showCreate",!0)("itemTemplate",t)}},dependencies:[R,z,H],encapsulation:2,changeDetection:0})};export{R as a,W as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a}from"./chunk-
|
|
1
|
+
import{d as a}from"./chunk-SQWYD6HJ.js";import"./chunk-IAIUV3RV.js";import"./chunk-7BVQ2WHQ.js";import"./chunk-5V6YWKKW.js";import"./chunk-ZX7BSCA5.js";import"./chunk-Q4QETBSU.js";import"./chunk-5TU5JR3W.js";import"./chunk-CHH2YNB6.js";import"./chunk-32554AB2.js";import"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import"./chunk-NNVKL253.js";import"./chunk-QDO3O2UB.js";export{a as CaseShellComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-JBAFVFZR.js";import"./chunk-BFRQNDIH.js";import"./chunk-5TU5JR3W.js";import"./chunk-32554AB2.js";import"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import"./chunk-NNVKL253.js";import"./chunk-QDO3O2UB.js";export{a as NamespaceListComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as j}from"./chunk-Z54GR5ZE.js";import{a as rt,b as lt}from"./chunk-74OAAPUO.js";import{a as st,b as dt}from"./chunk-RAN3AUJQ.js";import{a as q}from"./chunk-E5MHC5FO.js";import{a as ct,b as mt,c as ht}from"./chunk-SECZWZIB.js";import{a as qe,b as Qe,g as $e,h as Ke,i as tt,j as nt}from"./chunk-WBQOEBH7.js";import{a as Ge,b as ze,c as Ue,d as He,e as je,f as at,j as ot,n as it,r as ut,s as gt,t as pt}from"./chunk-F7X52MX4.js";import"./chunk-NXKPUZGQ.js";import{a as Oe,b as Pe,d as Fe,e as De,f as Be,g as Ve,h as Ae}from"./chunk-TGWQ4PGG.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import{a as N,b as G}from"./chunk-HTKDXFLE.js";import{B as Je,C as et,E as H,a as Xe,c as Ye,g as z,m as U,o as Ze}from"./chunk-7VQ75OC6.js";import"./chunk-FM5EGDVD.js";import{A as we,E as Ie,K as Ee,M as Re,N as Le,O as L,P as We,Q as Ne,S as W,h as xe,i as ke,t as ne,u as Te}from"./chunk-NNVKL253.js";import{Bb as x,Db as g,Ec as Ce,Fb as c,Gb as ue,Hb as ge,Ib as pe,Jb as he,Ka as d,Kb as Z,Lb as J,Mc as Se,Pb as P,Rb as ee,Tb as s,Ub as E,Vb as w,Wa as I,Xa as le,Y as oe,Ya as se,Yb as _,Zb as f,_ as ie,_b as v,aa as K,ab as X,ac as be,bc as _e,ca as m,cc as fe,ga as p,ha as h,ic as ve,jb as V,lb as M,lc as ye,mb as C,nb as de,nc as Me,oa as B,pb as A,qb as R,rb as b,sb as i,ta as k,tb as r,ub as Y,uc as te,vc as S,ya as re,yb as ce,zb as me}from"./chunk-QDO3O2UB.js";var It=["button"],Et=["*"];function Ot(l,a){if(l&1&&(i(0,"div",2),Y(1,"mat-pseudo-checkbox",6),r()),l&2){let e=c();d(),b("disabled",e.disabled)}}var _t=new K("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1})}),ft=new K("MatButtonToggleGroup"),Pt={provide:Xe,useExisting:oe(()=>ae),multi:!0},Q=class{source;value;constructor(a,e){this.source=a,this.value=e}},ae=(()=>{class l{_changeDetector=m(te);_dir=m(we,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck()}_name=m(ne).getId("mat-button-toggle-group-");vertical=!1;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 B;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 B;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=m(_t,{optional:!0});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??!1,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new it(this.multiple,void 0,!1)}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||Te(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(T=>T.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 Q(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t)}_syncButtonToggle(e,t,n=!1,o=!1){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=!1),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=!0,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"?!1: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,T=n.get(u);if(T&&!T.disabled)return T}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(Array.isArray(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=!1,this.multiple||(e.tabIndex=-1)})}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=!0,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=se({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&pe(o,$,5),t&2){let u;Z(u=J())&&(n._buttonToggles=u)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&g("keydown",function(u){return n._keydown(u)}),t&2&&(V("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),ee("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",S],value:"value",multiple:[2,"multiple","multiple",S],disabled:[2,"disabled","disabled",S],disabledInteractive:[2,"disabledInteractive","disabledInteractive",S],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",S],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",S]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[be([Pt,{provide:ft,useExisting:l}])]})}return l})(),$=(()=>{class l{_changeDetectorRef=m(te);_elementRef=m(re);_focusMonitor=m(xe);_idGenerator=m(ne);_animationDisabled=Ee();_checked=!1;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=!1;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=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e}_disabledInteractive;change=new B;constructor(){m(ke).load(Le);let e=m(ft,{optional:!0}),t=m(new Me("tabindex"),{optional:!0})||"",n=m(_t,{optional:!0});this._tabIndex=k(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??!1}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=!0: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,!0)}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,!1,!1,!0)}focus(e){this._buttonElement.nativeElement.focus(e)}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?!0:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),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 Q(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=I({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&he(It,5),t&2){let o;Z(o=J())&&(n._buttonElement=o.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&g("focus",function(){return n.focus()}),t&2&&(V("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),ee("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",S],appearance:"appearance",checked:[2,"checked","checked",S],disabled:[2,"disabled","disabled",S],disabledInteractive:[2,"disabledInteractive","disabledInteractive",S]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Et,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&&(ue(),i(0,"button",1,0),g("click",function(){return n._onButtonClick()}),M(2,Ot,2,1,"div",2),i(3,"span",3),ge(4),r()(),Y(5,"span",4)(6,"span",5)),t&2){let o=P(1);b("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),V("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),d(2),C(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),d(4),b("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)}},dependencies:[Re,at],styles:[`.mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:var(--mat-button-toggle-legacy-shape);transform:translateZ(0)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-button-toggle-legacy-text-color);font-family:var(--mat-button-toggle-legacy-label-text-font);font-size:var(--mat-button-toggle-legacy-label-text-size);line-height:var(--mat-button-toggle-legacy-label-text-line-height);font-weight:var(--mat-button-toggle-legacy-label-text-weight);letter-spacing:var(--mat-button-toggle-legacy-label-text-tracking);--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-legacy-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-legacy-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-button-toggle-legacy-selected-state-text-color);background-color:var(--mat-button-toggle-legacy-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-button-toggle-legacy-disabled-state-text-color);background-color:var(--mat-button-toggle-legacy-disabled-state-background-color);--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-legacy-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-button-toggle-legacy-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-button-toggle-background-color, transparent);font-family:var(--mat-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-button-toggle-legacy-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-button-toggle-legacy-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}
|
|
1
|
+
import{d as j}from"./chunk-S7FMQPO3.js";import{a as rt,b as lt}from"./chunk-SOHEYVJF.js";import{a as st,b as dt}from"./chunk-RAN3AUJQ.js";import{a as q}from"./chunk-E5MHC5FO.js";import{a as ct,b as mt,c as ht}from"./chunk-SECZWZIB.js";import{a as qe,b as Qe,g as $e,h as Ke,i as tt,j as nt}from"./chunk-WBQOEBH7.js";import{a as Ge,b as ze,c as Ue,d as He,e as je,f as at,j as ot,n as it,r as ut,s as gt,t as pt}from"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import{a as Oe,b as Pe,d as Fe,e as De,f as Be,g as Ve,h as Ae}from"./chunk-TGWQ4PGG.js";import"./chunk-QN7OUZIZ.js";import"./chunk-BVQ4XPRS.js";import{a as N,b as G}from"./chunk-HTKDXFLE.js";import{B as Je,C as et,E as H,a as Xe,c as Ye,g as z,m as U,o as Ze}from"./chunk-7VQ75OC6.js";import"./chunk-FM5EGDVD.js";import{A as we,E as Ie,K as Ee,M as Re,N as Le,O as L,P as We,Q as Ne,S as W,h as xe,i as ke,t as ne,u as Te}from"./chunk-NNVKL253.js";import{Bb as x,Db as g,Ec as Ce,Fb as c,Gb as ue,Hb as ge,Ib as pe,Jb as he,Ka as d,Kb as Z,Lb as J,Mc as Se,Pb as P,Rb as ee,Tb as s,Ub as E,Vb as w,Wa as I,Xa as le,Y as oe,Ya as se,Yb as _,Zb as f,_ as ie,_b as v,aa as K,ab as X,ac as be,bc as _e,ca as m,cc as fe,ga as p,ha as h,ic as ve,jb as V,lb as M,lc as ye,mb as C,nb as de,nc as Me,oa as B,pb as A,qb as R,rb as b,sb as i,ta as k,tb as r,ub as Y,uc as te,vc as S,ya as re,yb as ce,zb as me}from"./chunk-QDO3O2UB.js";var It=["button"],Et=["*"];function Ot(l,a){if(l&1&&(i(0,"div",2),Y(1,"mat-pseudo-checkbox",6),r()),l&2){let e=c();d(),b("disabled",e.disabled)}}var _t=new K("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1})}),ft=new K("MatButtonToggleGroup"),Pt={provide:Xe,useExisting:oe(()=>ae),multi:!0},Q=class{source;value;constructor(a,e){this.source=a,this.value=e}},ae=(()=>{class l{_changeDetector=m(te);_dir=m(we,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck()}_name=m(ne).getId("mat-button-toggle-group-");vertical=!1;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 B;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 B;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=m(_t,{optional:!0});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??!1,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new it(this.multiple,void 0,!1)}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||Te(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(T=>T.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 Q(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t)}_syncButtonToggle(e,t,n=!1,o=!1){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=!1),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=!0,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"?!1: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,T=n.get(u);if(T&&!T.disabled)return T}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(Array.isArray(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=!1,this.multiple||(e.tabIndex=-1)})}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=!0,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=se({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&pe(o,$,5),t&2){let u;Z(u=J())&&(n._buttonToggles=u)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&g("keydown",function(u){return n._keydown(u)}),t&2&&(V("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),ee("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",S],value:"value",multiple:[2,"multiple","multiple",S],disabled:[2,"disabled","disabled",S],disabledInteractive:[2,"disabledInteractive","disabledInteractive",S],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",S],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",S]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[be([Pt,{provide:ft,useExisting:l}])]})}return l})(),$=(()=>{class l{_changeDetectorRef=m(te);_elementRef=m(re);_focusMonitor=m(xe);_idGenerator=m(ne);_animationDisabled=Ee();_checked=!1;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=!1;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=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e}_disabledInteractive;change=new B;constructor(){m(ke).load(Le);let e=m(ft,{optional:!0}),t=m(new Me("tabindex"),{optional:!0})||"",n=m(_t,{optional:!0});this._tabIndex=k(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??!1}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=!0: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,!0)}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,!1,!1,!0)}focus(e){this._buttonElement.nativeElement.focus(e)}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?!0:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),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 Q(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=I({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&he(It,5),t&2){let o;Z(o=J())&&(n._buttonElement=o.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&g("focus",function(){return n.focus()}),t&2&&(V("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),ee("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",S],appearance:"appearance",checked:[2,"checked","checked",S],disabled:[2,"disabled","disabled",S],disabledInteractive:[2,"disabledInteractive","disabledInteractive",S]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Et,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&&(ue(),i(0,"button",1,0),g("click",function(){return n._onButtonClick()}),M(2,Ot,2,1,"div",2),i(3,"span",3),ge(4),r()(),Y(5,"span",4)(6,"span",5)),t&2){let o=P(1);b("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),V("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),d(2),C(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),d(4),b("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled)}},dependencies:[Re,at],styles:[`.mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:var(--mat-button-toggle-legacy-shape);transform:translateZ(0)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-button-toggle-legacy-text-color);font-family:var(--mat-button-toggle-legacy-label-text-font);font-size:var(--mat-button-toggle-legacy-label-text-size);line-height:var(--mat-button-toggle-legacy-label-text-line-height);font-weight:var(--mat-button-toggle-legacy-label-text-weight);letter-spacing:var(--mat-button-toggle-legacy-label-text-tracking);--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-legacy-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-legacy-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-button-toggle-legacy-selected-state-text-color);background-color:var(--mat-button-toggle-legacy-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-button-toggle-legacy-disabled-state-text-color);background-color:var(--mat-button-toggle-legacy-disabled-state-background-color);--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-legacy-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-button-toggle-legacy-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-button-toggle-background-color, transparent);font-family:var(--mat-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-button-toggle-legacy-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-button-toggle-legacy-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}
|
|
2
2
|
`],encapsulation:2,changeDetection:0})}return l})(),vt=(()=>{class l{static \u0275fac=function(t){return new(t||l)};static \u0275mod=le({type:l});static \u0275inj=ie({imports:[We,$,Ie]})}return l})();var Rt=(l,a)=>a.id,Lt=(l,a)=>a.value;function Wt(l,a){if(l&1&&(i(0,"mat-option",5),s(1),r()),l&2){let e=a.$implicit;b("value",e.id),d(),w(" ",e.name," ")}}function Nt(l,a){if(l&1){let e=x();i(0,"mat-checkbox",35),g("change",function(){let n=p(e).$implicit,o=c();return h(o.toggleDayOfWeek(n.value))}),s(1),r()}if(l&2){let e=a.$implicit,t=c();b("checked",t.isDaySelected(e.value)),d(),w(" ",e.label," ")}}function Gt(l,a){if(l&1){let e=x();i(0,"mat-form-field",2)(1,"mat-label"),s(2,"Number of Occurrences"),r(),i(3,"input",10),v("ngModelChange",function(n){p(e);let o=c();return f(o.endOccurrences,n)||(o.endOccurrences=n),h(n)}),r()()}if(l&2){let e=c();d(3),_("ngModel",e.endOccurrences)}}function zt(l,a){if(l&1){let e=x();i(0,"mat-form-field",2)(1,"mat-label"),s(2,"End Date"),r(),i(3,"input",36),v("ngModelChange",function(n){p(e);let o=c();return f(o.endTimestamp,n)||(o.endTimestamp=n),h(n)}),r()()}if(l&2){let e=c();d(3),_("ngModel",e.endTimestamp)}}function Ut(l,a){if(l&1){let e=x();i(0,"div")(1,"mat-form-field",2)(2,"mat-label"),s(3,"Parameter Value"),r(),i(4,"input",37),v("ngModelChange",function(n){p(e);let o=c();return f(o.simpleParameter,n)||(o.simpleParameter=n),h(n)}),r(),i(5,"mat-hint"),s(6),r()()()}if(l&2){let e=c();d(4),_("ngModel",e.simpleParameter),d(2),w("Simple value for ","{{PARAMETERS}}"," placeholder or appended to first command")}}function Ht(l,a){if(l&1){let e=x();i(0,"div",40)(1,"mat-form-field",41)(2,"mat-label"),s(3,"Key"),r(),i(4,"input",42),v("ngModelChange",function(n){let o=p(e).$implicit;return f(o.key,n)||(o.key=n),h(n)}),r()(),i(5,"mat-form-field",43)(6,"mat-label"),s(7,"Value"),r(),i(8,"input",44),v("ngModelChange",function(n){let o=p(e).$implicit;return f(o.value,n)||(o.value=n),h(n)}),r()(),i(9,"button",45),g("click",function(){let n=p(e).$index,o=c(3);return h(o.removeParameter(n))}),i(10,"mat-icon"),s(11,"delete"),r()()()}if(l&2){let e=a.$implicit;d(4),_("ngModel",e.key),d(4),_("ngModel",e.value)}}function jt(l,a){if(l&1&&(i(0,"div",39),A(1,Ht,12,2,"div",40,de),r()),l&2){let e=c(2);d(),R(e.parameters)}}function qt(l,a){if(l&1){let e=x();i(0,"div")(1,"div",26)(2,"button",38),g("click",function(){p(e);let n=c();return h(n.addParameter())}),i(3,"mat-icon"),s(4,"add"),r()()(),M(5,jt,3,0,"div",39),i(6,"p",19),s(7),r()()}if(l&2){let e=c();d(5),C(e.parameters.length>0?5:-1),d(2),w("Key-value pairs for ","{{key}}"," placeholders in prompt commands")}}function Qt(l,a){if(l&1&&(i(0,"div",31)(1,"mat-icon"),s(2,"error"),r(),i(3,"span"),s(4),r()()),l&2){let e=c();d(4),E(e.errorMessage)}}var F=class l{schedulerApi=m(j);promptApi=m(q);dialogRef=m(Oe);availablePrompts=[];isLoadingPrompts=!1;name="";promptId="";enabled=!0;startTimestamp="";intervalValue=1;intervalUnit="h";daysOfWeek=[];endConditionType="none";endOccurrences=10;endTimestamp="";parameterMode="simple";simpleParameter="";parameters=[];isSaving=!1;errorMessage="";isEditMode=!1;schedulerId="";data=m(Pe);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=!0,this.promptApi.listPrompts().subscribe({next:a=>{this.availablePrompts=a,this.isLoadingPrompts=!1},error:a=>{console.error("Error loading prompts:",a),this.errorMessage="Failed to load prompts",this.isLoadingPrompts=!1}})}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",!1;if(!this.promptId)return this.errorMessage="Prompt is required",!1;if(this.intervalValue<1)return this.errorMessage="Interval must be at least 1",!1;switch(this.intervalUnit){case"min":if(this.intervalValue>59)return this.errorMessage="Minutes interval must be between 1 and 59 (use hours for longer)",!1;break;case"h":if(this.intervalValue>24)return this.errorMessage="Hours interval must be between 1 and 24 (use days for longer)",!1;break;case"d":if(this.intervalValue>31)return this.errorMessage="Days interval must be between 1 and 31 (use months for longer)",!1;break;case"M":if(this.intervalValue>12)return this.errorMessage="Months interval must be between 1 and 12",!1;break}return this.endConditionType==="occurrences"&&this.endOccurrences<1?(this.errorMessage="Occurrences must be at least 1",!1):this.endConditionType==="endTimestamp"&&!this.endTimestamp?(this.errorMessage="End date is required",!1):!0}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=!0,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=!1,this.dialogRef.close(!0)},error:t=>{console.error("Error updating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update scheduler",this.isSaving=!1}}):this.schedulerApi.createScheduler({name:this.name.trim(),promptId:this.promptId,schedule:a,parameters:e,enabled:this.enabled}).subscribe({next:()=>{this.isSaving=!1,this.dialogRef.close(!0)},error:t=>{console.error("Error creating scheduler:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create scheduler",this.isSaving=!1}})}cancel(){this.dialogRef.close(!1)}static \u0275fac=function(e){return new(e||l)};static \u0275cmp=I({type:l,selectors:[["app-scheduler-form"]],decls:89,vars:17,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","My Scheduler","required","",3,"ngModelChange","ngModel"],["required","",3,"ngModelChange","ngModel"],[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"],["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&&(i(0,"h2",0),s(1),r(),i(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),s(6,"Name"),r(),i(7,"input",3),v("ngModelChange",function(o){return f(t.name,o)||(t.name=o),o}),r(),i(8,"mat-hint"),s(9,"A descriptive name for this scheduler"),r()(),i(10,"mat-form-field",2)(11,"mat-label"),s(12,"Prompt"),r(),i(13,"mat-select",4),v("ngModelChange",function(o){return f(t.promptId,o)||(t.promptId=o),o}),A(14,Wt,2,2,"mat-option",5,Rt),r(),i(16,"mat-hint"),s(17,"Select the prompt to execute"),r()(),i(18,"mat-form-field",2)(19,"mat-label"),s(20,"Start Date & Time"),r(),i(21,"input",6),v("ngModelChange",function(o){return f(t.startTimestamp,o)||(t.startTimestamp=o),o}),r(),i(22,"mat-hint"),s(23,"When to start the scheduler (leave empty for now)"),r()(),i(24,"div",7)(25,"h3"),s(26,"Schedule Interval"),r(),i(27,"div",8)(28,"mat-form-field",9)(29,"mat-label"),s(30,"Every"),r(),i(31,"input",10),v("ngModelChange",function(o){return f(t.intervalValue,o)||(t.intervalValue=o),o}),r()(),i(32,"mat-form-field",11)(33,"mat-label"),s(34,"Unit"),r(),i(35,"mat-select",4),v("ngModelChange",function(o){return f(t.intervalUnit,o)||(t.intervalUnit=o),o}),i(36,"mat-option",12),s(37,"Minutes (1-59)"),r(),i(38,"mat-option",13),s(39,"Hours (1-24)"),r(),i(40,"mat-option",14),s(41,"Days (1-31)"),r(),i(42,"mat-option",15),s(43,"Months (1-12)"),r()()()()(),i(44,"div",16)(45,"h3"),s(46,"Days of Week (Optional)"),r(),i(47,"div",17),A(48,Nt,2,2,"mat-checkbox",18,Lt),r(),i(50,"p",19),s(51,"Leave empty to run every day"),r()(),i(52,"div",20)(53,"h3"),s(54,"End Condition (Optional)"),r(),i(55,"mat-form-field",2)(56,"mat-label"),s(57,"End Type"),r(),i(58,"mat-select",21),v("ngModelChange",function(o){return f(t.endConditionType,o)||(t.endConditionType=o),o}),i(59,"mat-option",22),s(60,"Never (run indefinitely)"),r(),i(61,"mat-option",23),s(62,"After X occurrences"),r(),i(63,"mat-option",24),s(64,"Until specific date"),r()()(),M(65,Gt,4,1,"mat-form-field",2),M(66,zt,4,1,"mat-form-field",2),r(),i(67,"div",25)(68,"div",26)(69,"h3"),s(70,"Parameters (Optional)"),r(),i(71,"mat-button-toggle-group",27),v("ngModelChange",function(o){return f(t.parameterMode,o)||(t.parameterMode=o),o}),i(72,"mat-button-toggle",28),s(73,"Simple"),r(),i(74,"mat-button-toggle",29),s(75,"Structured"),r()()(),M(76,Ut,7,2,"div"),M(77,qt,8,2,"div"),r(),i(78,"div",30)(79,"mat-checkbox",21),v("ngModelChange",function(o){return f(t.enabled,o)||(t.enabled=o),o}),s(80,"Enabled"),r(),i(81,"p",19),s(82,"Scheduler will only run if enabled"),r()(),M(83,Qt,5,1,"div",31),r()(),i(84,"mat-dialog-actions",32)(85,"button",33),g("click",function(){return t.cancel()}),s(86,"Cancel"),r(),i(87,"button",34),g("click",function(){return t.save()}),s(88),r()()),e&2&&(d(),E(t.isEditMode?"Edit Scheduler":"Create Scheduler"),d(6),_("ngModel",t.name),d(6),_("ngModel",t.promptId),d(),R(t.availablePrompts),d(7),_("ngModel",t.startTimestamp),d(10),_("ngModel",t.intervalValue),d(4),_("ngModel",t.intervalUnit),d(13),R(t.daysOfWeekOptions),d(10),_("ngModel",t.endConditionType),d(7),C(t.endConditionType==="occurrences"?65:-1),d(),C(t.endConditionType==="endTimestamp"?66:-1),d(5),_("ngModel",t.parameterMode),d(5),C(t.parameterMode==="simple"?76:-1),d(),C(t.parameterMode==="structured"?77:-1),d(2),_("ngModel",t.enabled),d(4),C(t.errorMessage?83:-1),d(2),b("disabled",t.isSaving),d(2),b("disabled",t.isSaving),d(),w(" ",t.isSaving?"Saving...":"Save"," "))},dependencies:[Se,H,Ye,Ze,z,et,Je,U,Ae,De,Ve,Be,W,Ne,L,nt,tt,$e,qe,Qe,Ke,G,N,lt,rt,ot,dt,st,vt,ae,$],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}"]})};var $t=()=>[],Kt=l=>({id:l});function Xt(l,a){if(l&1&&(i(0,"div",6),s(1),r()),l&2){let e=c();d(),E(e.errorMessage())}}function Yt(l,a){if(l&1){let e=x();i(0,"ds-entity-card",8),g("selected",function(n){p(e);let o=c();return h(o.onEdit(n))}),ce(1,9),i(2,"button",10),g("click",function(n){return n.stopPropagation()}),i(3,"mat-icon"),s(4,"more_vert"),r()(),me(),r()}if(l&2){let e=a.$implicit;c();let t=P(11);b("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??_e(6,$t)),d(2),b("matMenuTriggerFor",t)("matMenuTriggerData",fe(7,Kt,e.id))}}function Zt(l,a){if(l&1){let e=x();i(0,"button",11),g("click",function(){let n=p(e).id,o=c();return h(o.onEdit(n))}),i(1,"mat-icon"),s(2,"edit"),r(),s(3," Edit "),r(),i(4,"button",11),g("click",function(){let n=p(e).id,o=c();return h(o.onToggleEnabled(n))}),i(5,"mat-icon"),s(6),r(),s(7),r(),i(8,"button",11),g("click",function(){let n=p(e).id,o=c();return h(o.onRunNow(n))}),i(9,"mat-icon"),s(10,"play_arrow"),r(),s(11," Run now "),r(),i(12,"button",12),g("click",function(){let n=p(e).id,o=c();return h(o.onDelete(n))}),i(13,"mat-icon"),s(14,"delete"),r(),s(15," Delete "),r()}if(l&2){let e=a.id,t=c();d(6),E(t.isEnabled(e)?"pause_circle":"play_circle"),d(),w(" ",t.isEnabled(e)?"Disable":"Enable"," ")}}var yt=class l{schedulerApi=m(j);promptApi=m(q);configApi=m(ht);location=m(Ce);dialog=m(Fe);schedulers=k([]);prompts=k([]);isLoading=k(!1);errorMessage=k(null);showOnlyMine=k(!0);currentUsername=k("");schedulerItems=ye(()=>{let a=this.schedulers(),e=this.currentUsername(),n=this.showOnlyMine()&&e?a.filter(y=>this.isMyScheduler(y)):a,u=[...new Set(n.map(y=>y.createdBy))].sort((y,O)=>y===e&&O!==e?-1:O===e&&y!==e?1:y.localeCompare(O)),T=[];for(let y of u){let O=y===e?`${y} (you)`:y;for(let D of n.filter(Mt=>Mt.createdBy===y))T.push({id:D.id,name:D.name,description:this.buildDescription(D),badges:this.buildBadges(D),groupKey:y,groupLabel:O})}return T});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(!0),this.schedulerApi.listSchedulers().subscribe({next:a=>{this.schedulers.set(a),this.isLoading.set(!1)},error:a=>{this.errorMessage.set(a?.error?.error??"Failed to load schedulers"),this.isLoading.set(!1)}})}onBack(){this.location.back()}onCreate(){this.dialog.open(F,{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(F,{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??!1}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=I({type:l,selectors:[["app-scheduler-list"]],decls:13,vars:5,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","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&&(i(0,"div",2)(1,"ds-entity-list",3),g("createRequested",function(){return t.onCreate()}),i(2,"button",4),g("click",function(){return t.onBack()}),i(3,"mat-icon"),s(4,"chevron_left"),r()(),i(5,"mat-slide-toggle",5),g("ngModelChange",function(o){return t.showOnlyMine.set(o)}),s(6," Mine "),r()(),M(7,Xt,2,1,"div",6),r(),X(8,Yt,5,9,"ng-template",null,0,ve),i(10,"mat-menu",null,1),X(12,Zt,16,2,"ng-template",7),r()),e&2){let n=P(9);d(),b("items",t.schedulerItems())("showCreate",!0)("itemTemplate",n),d(4),b("ngModel",t.showOnlyMine()),d(2),C(t.errorMessage()?7:-1)}},dependencies:[pt,gt,ut,W,L,G,N,mt,ct,je,Ue,Ge,ze,He,H,z,U],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}"]})};export{yt as SchedulerListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N}from"./chunk-BFHBI6M4.js";import{a as U}from"./chunk-AR4TQRY3.js";import{c as F,d as $}from"./chunk-32554AB2.js";import"./chunk-EIJAV76W.js";import"./chunk-RAN3AUJQ.js";import{s as z,t as J}from"./chunk-
|
|
1
|
+
import{a as N}from"./chunk-BFHBI6M4.js";import{a as U}from"./chunk-AR4TQRY3.js";import{c as F,d as $}from"./chunk-32554AB2.js";import"./chunk-EIJAV76W.js";import"./chunk-RAN3AUJQ.js";import{s as z,t as J}from"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import{d as K}from"./chunk-TGWQ4PGG.js";import"./chunk-QN7OUZIZ.js";import{a as L,c as S}from"./chunk-BVQ4XPRS.js";import{a as W,b as A}from"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import{b as B}from"./chunk-FM5EGDVD.js";import{O as V}from"./chunk-NNVKL253.js";import{B as x,Bb as k,Db as h,Fb as b,Ka as v,Pb as E,Tb as O,Wa as D,a as c,ab as I,b as p,bc as T,ca as m,ga as C,ha as j,ic as q,lc as w,ma as R,rb as P,sb as d,tb as _,ub as M}from"./chunk-QDO3O2UB.js";var ee=()=>[];function te(u,t){if(u&1){let o=k();d(0,"div",5)(1,"ds-entity-card",6),h("selected",function(r){C(o);let n=b();return j(n.onItemSelected(r))}),_(),d(2,"button",7),h("click",function(r){let n=C(o).$implicit,f=b();return r.stopPropagation(),j(f.onDeleteRequested(n.id))}),d(3,"mat-icon"),O(4,"close"),_()()()}if(u&2){let o=t.$implicit;v(),P("id",o.id)("name",o.name)("description",o.description)("badges",o.badges??T(4,ee))}}var g="__",Y=class u{router=m(F);projectStateService=m(B);dialog=m(K);destroyRef=m(R);notification=m(U);projects=S(this.projectStateService.projectList$);forcedProject=S(this.projectStateService.forcedProject$,{initialValue:null});projectItems=w(()=>{let t=this.projects();if(!t)return[];let o=t.filter(e=>!e.name.includes(g)),a=t.filter(e=>e.name.includes(g)),r=new Set(o.map(e=>e.name)),n=e=>e.split(g)[0]??null,f=new Set(a.map(e=>n(e.name)).filter(e=>e!==null&&r.has(e))),l=[],G=[...f].sort((e,i)=>e.localeCompare(i));for(let e of G){let i=o.find(s=>s.name===e);l.push(p(c({},this.toEntityListItem(i)),{groupKey:e,groupLabel:e}));let Z=a.filter(s=>n(s.name)===e).sort((s,y)=>s.name.localeCompare(y.name));for(let s of Z){let y=s.name.slice(e.length+g.length);l.push(p(c({},this.toEntityListItem(s)),{name:y,description:s.name,groupKey:e,groupLabel:e}))}}let H=[...o].filter(e=>!f.has(e.name)&&!e.volatile).sort((e,i)=>e.name.localeCompare(i.name));for(let e of H)l.push(p(c({},this.toEntityListItem(e)),{groupKey:"__standalone__",groupLabel:"Projects"}));let Q=[...o].filter(e=>!f.has(e.name)&&e.volatile).sort((e,i)=>e.name.localeCompare(i.name));for(let e of Q)l.push(p(c({},this.toEntityListItem(e)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let X=a.filter(e=>{let i=n(e.name);return i!==null&&!r.has(i)}).sort((e,i)=>e.name.localeCompare(i.name));for(let e of X)l.push(p(c({},this.toEntityListItem(e)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return l});showCreateButton=w(()=>!this.forcedProject());constructor(){}onItemSelected(t){this.projectStateService.selectProject(t),this.router.navigate(["project",t])}onCreateRequested(){this.router.navigate(["project","new"])}onDeleteRequested(t){let o=t.includes(g);this.dialog.open(N,{width:"400px",panelClass:"confirm-dialog-panel",data:c({title:"Delete project",message:`This will remove the project "${t}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:!0},o?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(x(r=>r?.confirmed===!0),L(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(t,r.checkboxChecked).pipe(L(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${t}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(t)}`)&&this.router.navigate(["/"])},error:n=>{console.error("[PROJECT-LIST] Failed to delete project:",n),this.notification.error(n?.error?.error??"Failed to delete project")}})})}toEntityListItem(t){return{id:t.name,name:t.name,badges:t.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(o){return new(o||u)};static \u0275cmp=D({type:u,selectors:[["app-project-selection"]],decls:6,vars:4,consts:[["projectCard",""],[1,"project-page-layout"],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","routerLink","/","title","Back to tasks",1,"project-list__logo"],["src","CODAY-Logo.png","alt","Coday"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(o,a){if(o&1&&(d(0,"div",1)(1,"ds-entity-list",2),h("itemSelected",function(n){return a.onItemSelected(n)})("createRequested",function(){return a.onCreateRequested()}),d(2,"a",3),M(3,"img",4),_()()(),I(4,te,5,5,"ng-template",null,0,q)),o&2){let r=E(5);v(),P("items",a.projectItems())("itemTemplate",r)("showCreate",a.showCreateButton())("autoFocusSearch",!0)}},dependencies:[J,z,A,W,V,$],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.project-page-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.project-list__logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;border-radius:4px;opacity:.85;transition:opacity .15s ease;cursor:pointer}.project-list__logo[_ngcontent-%COMP%]:hover{opacity:1}.project-list__logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:contain;border-radius:4px}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"]})};export{Y as ProjectListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as I}from"./chunk-
|
|
1
|
+
import{o as I}from"./chunk-26Y7QHUX.js";import{Bb as p,Db as d,Fb as c,Ka as r,Tb as s,Ub as C,Vb as w,Wa as x,ga as l,ha as g,jb as y,lb as u,lc as h,mb as b,oc as f,pc as _,sb as n,ta as v,tb as i}from"./chunk-QDO3O2UB.js";function O(o,m){if(o&1){let e=p();n(0,"span",7),s(1,"Delete?"),i(),n(2,"ds-icon-button",8),d("action",function(){l(e);let a=c();return g(a.onDeleteConfirmed())}),i(),n(3,"ds-icon-button",9),d("action",function(){l(e);let a=c();return g(a.onDeleteCancelled())}),i()}}function M(o,m){if(o&1){let e=p();n(0,"ds-icon-button",11),d("action",function(){l(e);let a=c(2);return g(a.onEdit())}),i(),n(1,"ds-icon-button",12),d("action",function(){l(e);let a=c(2);return g(a.onDeleteArmed())}),i()}}function S(o,m){if(o&1){let e=p();n(0,"ds-icon-button",10),d("action",function(){l(e);let a=c();return g(a.onDuplicate())}),i(),u(1,M,2,0)}if(o&2){let e=c();r(),b(e.readOnly()?-1:1)}}var P=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration partag\xE9e plateforme",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),D=class o{config=_.required();scope=_.required();readOnly=_(!1);editRequested=f();deleteRequested=f();duplicateRequested=f();pendingDelete=v(!1);badge=h(()=>P[this.scope()]);onEdit(){this.editRequested.emit(this.config())}onDuplicate(){this.duplicateRequested.emit(this.config())}onDeleteArmed(){this.pendingDelete.set(!0)}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.config())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=x({type:o,selectors:[["agentos-integration-config-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:6,consts:[["role","listitem",1,"integration-config-item"],[1,"integration-config-item__body"],[1,"integration-config-item__heading"],[1,"integration-config-item__name"],[1,"integration-config-item__badge"],[1,"integration-config-item__type"],[1,"integration-config-item__actions"],[1,"integration-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this configuration",3,"action"],["icon","edit","title","Edit integration",3,"action"],["icon","delete","variant","danger","title","Delete integration",3,"action"]],template:function(e,t){e&1&&(n(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),s(4),i(),n(5,"span",4),s(6),i()(),n(7,"span",5),s(8),i()(),n(9,"div",6),u(10,O,4,0)(11,S,2,1),i()()),e&2&&(r(4),C(t.config().name),r(),y("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),r(),w(" ",t.badge().label," "),r(2),C(t.config().integrationType),r(2),b(t.pendingDelete()?10:11))},dependencies:[I],styles:[".integration-config-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}.integration-config-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.integration-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.integration-config-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.integration-config-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.integration-config-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;padding:.15rem .5rem;border-radius:999px;border:1px solid transparent;text-transform:uppercase;white-space:nowrap}.integration-config-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary);border-color:var(--color-border)}.integration-config-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 12%,transparent);color:var(--color-info);border-color:color-mix(in srgb,var(--color-info) 30%,transparent)}.integration-config-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 12%,transparent);color:var(--color-warning);border-color:color-mix(in srgb,var(--color-warning) 30%,transparent)}.integration-config-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.integration-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover .integration-config-item__actions[_ngcontent-%COMP%], .integration-config-item[_ngcontent-%COMP%]:focus-within .integration-config-item__actions[_ngcontent-%COMP%]{opacity:1}.integration-config-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{D as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./chunk-
|
|
1
|
+
import{a as B}from"./chunk-FNFYAJMS.js";import{a as G}from"./chunk-AIC4U2MU.js";import{a as K}from"./chunk-RYCGZWL2.js";import{a as V}from"./chunk-MAHIDPCP.js";import"./chunk-CK52GCRW.js";import"./chunk-ZX7BSCA5.js";import"./chunk-5TU5JR3W.js";import{a as N,c as D}from"./chunk-32554AB2.js";import{o as $,t as L}from"./chunk-26Y7QHUX.js";import"./chunk-NXKPUZGQ.js";import"./chunk-QN7OUZIZ.js";import{a as d}from"./chunk-BVQ4XPRS.js";import"./chunk-HTKDXFLE.js";import"./chunk-7VQ75OC6.js";import"./chunk-NNVKL253.js";import{Bb as b,Db as u,Fb as s,Ic as q,Ka as A,Pb as S,S as g,Tb as x,Ub as E,Wa as I,ab as P,bc as w,ca as n,ec as O,fc as M,ga as l,ha as c,ic as T,lb as C,m as f,ma as y,mb as R,rb as v,sb as p,t as _,ta as h,tb as m}from"./chunk-QDO3O2UB.js";var z=()=>[];function W(r,e){if(r&1&&(p(0,"p",3),x(1),m()),r&2){let t=s().$implicit;A(),E(t.name)}}function U(r,e){if(r&1){let t=b();p(0,"agentos-ai-provider-item",5),u("editRequested",function(){let o=l(t),a=s(2);return c(a.onEdit(o))})("deleteRequested",function(){let o=l(t),a=s(2);return c(a.onDelete(o))})("duplicateRequested",function(){let o=l(t),a=s(2);return c(a.onDuplicate(o))}),m()}if(r&2){let t=e,i=s(2);v("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!i.isAdmin())}}function X(r,e){if(r&1&&C(0,W,2,1,"p",3)(1,U,1,3,"agentos-ai-provider-item",4),r&2){let t,i=e.$implicit,o=s();R(o.isEmptyPlaceholder(i.id)?0:(t=o.resolve(i.id))?1:-1,t)}}var k=Object.freeze({platform:"Platform (read-only)",namespace:"AI Providers du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class r{route=n(N);router=n(D);destroyRef=n(y);state=n(K);namespaceRole=n(V);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(_(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(d(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(_(e=>e.get("namespaceId")??""),g(e=>e?this.namespaceRole.isAdminOfNamespace$(e):f(!1)),d(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(d(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(i=>{i.id&&t.set(this.itemKey("platform",i.id),{config:i,scope:"platform"})}),e.namespace.forEach(i=>{i.id&&t.set(this.itemKey("namespace",i.id),{config:i,scope:"namespace"})}),e.userOnNs.forEach(i=>{i.id&&t.set(this.itemKey("userOnNs",i.id),{config:i,scope:"userOnNs"})}),e.userGlobal.forEach(i=>{i.id&&t.set(this.itemKey("userGlobal",i.id),{config:i,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id;t&&this.router.navigate(["/agentos",this.namespaceId,"ai-providers",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(d(this.destroyRef)).subscribe({error:i=>{console.error(`[AiProvidersAllScopes] Delete failed for ${e.scope}:${t}:`,i)}})}onDuplicate(e){if(!e.config.id)return;let t=e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucun AI Provider",groupKey:e,groupLabel:k[e]}]:t.filter(i=>!!i.id).map(i=>({id:this.itemKey(e,i.id),name:i.name,description:i.apiType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=I({type:r,selectors:[["agentos-ai-providers-all-scopes"]],decls:5,vars:6,consts:[["aiProviderItemTpl",""],["title","AI Providers","emptyMessage","No AI providers available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"ai-providers-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,i){if(t&1&&(p(0,"ds-entity-list",1),O(1,"async"),u("createRequested",function(){return i.openCreateForm()}),p(2,"ds-icon-button",2),u("action",function(){return i.goBack()}),m()(),P(3,X,2,1,"ng-template",null,0,T)),t&2){let o=S(4);v("items",M(1,3,i.listItems$)??w(5,z))("showCreate",!0)("itemTemplate",o)}},dependencies:[L,B,$,q],styles:[".ai-providers-all-scopes__empty[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);padding:.5rem .25rem;margin:0;font-style:italic}"],changeDetection:0})};export{j as AiProvidersAllScopesComponent};
|