@whoz-oss/coday-client 0.0.0-workstream-forge.93 → 0.0.0-workstream-forge.94
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-Cs9kJRRU.js → chunk-0K1upHa9.js} +1 -1
- package/browser/{chunk-CknzYxoU.js → chunk-4wXLkIgQ.js} +1 -1
- package/browser/{chunk-rHBsGEuM.js → chunk-7BX4gbCT.js} +1 -1
- package/browser/{chunk-g-xyqEqQ.js → chunk-7mdb_4mR.js} +1 -1
- package/browser/{chunk-XBhSA1N4.js → chunk-9xjn8Egf.js} +1 -1
- package/browser/{chunk-AcmfVMLq.js → chunk-AQsKVA6d.js} +1 -1
- package/browser/{chunk-CIabQB0K.js → chunk-B-MDIiFA.js} +1 -1
- package/browser/{chunk-yQF1M2wb.js → chunk-B3baCRtb.js} +1 -1
- package/browser/{chunk-BEmAw7iX.js → chunk-B5idR_PH.js} +1 -1
- package/browser/{chunk-D-WtqIw8.js → chunk-B68rmVfl.js} +1 -1
- package/browser/{chunk-BSzQsiO6.js → chunk-B9R_DbfC.js} +1 -1
- package/browser/{chunk-CS5IaoWg.js → chunk-BKXvmkUu.js} +1 -1
- package/browser/{chunk-C8OjnVE9.js → chunk-BNoigwlG.js} +1 -1
- package/browser/{chunk-SlCVUuti.js → chunk-BTUoK8fP.js} +1 -1
- package/browser/{chunk--VmBz6Cf.js → chunk-BXFaW6J1.js} +1 -1
- package/browser/{chunk-B1TvJscy.js → chunk-BdzUnayP.js} +1 -1
- package/browser/{chunk-D4pRabsj.js → chunk-BgPtK78d.js} +1 -1
- package/browser/{chunk-BVCyS-so.js → chunk-Bk3NqrnA.js} +1 -1
- package/browser/{chunk-BPR1B3ya.js → chunk-BojVkIWl.js} +1 -1
- package/browser/{chunk-DM-taP0T.js → chunk-BzU4ht22.js} +1 -1
- package/browser/{chunk-BUpwEWqw.js → chunk-C1w_QGS2.js} +1 -1
- package/browser/{chunk-CSXW8eI5.js → chunk-C3dC15Cy.js} +1 -1
- package/browser/{chunk-D4LcV5HQ.js → chunk-C3w6kqV4.js} +1 -1
- package/browser/{chunk-493leBy2.js → chunk-C7oAHrH-.js} +1 -1
- package/browser/{chunk-CHPGjyfP.js → chunk-C9DRVPq2.js} +1 -1
- package/browser/{chunk-GhpKMDaK.js → chunk-CCHGxQwW.js} +1 -1
- package/browser/{chunk-C-YiRSlK.js → chunk-CEtg3c_H.js} +1 -1
- package/browser/{chunk-CwmsJkMM.js → chunk-CGGV0vF4.js} +1 -1
- package/browser/{chunk-CwVNlz2-.js → chunk-CJGaU-bS.js} +1 -1
- package/browser/{chunk-CQ_FY7Nm.js → chunk-CMcuhZca.js} +1 -1
- package/browser/{chunk-CptnPQPc.js → chunk-CUA4cnMp.js} +1 -1
- package/browser/{chunk-CjaubGFJ.js → chunk-CXywabYk.js} +1 -1
- package/browser/{chunk-BLyVCNMG.js → chunk-CjmliJcM.js} +1 -1
- package/browser/{chunk-DNkYFPsD.js → chunk-Cn8R85n1.js} +1 -1
- package/browser/{chunk-AqmhRsNI.js → chunk-Csa3hGs7.js} +1 -1
- package/browser/{chunk-D0rNl8bG.js → chunk-CsyzylmW.js} +1 -1
- package/browser/chunk-D1nZmts_.js +11 -0
- package/browser/{chunk-CEcYVC8L.js → chunk-D4oFaPAv.js} +1 -1
- package/browser/{chunk-CGtfhng3.js → chunk-D56Lf-dS.js} +1 -1
- package/browser/{chunk-DfOj7Ckk.js → chunk-DKB_-5nU.js} +1 -1
- package/browser/{chunk-BI06wG8D.js → chunk-DUYMjeQJ.js} +1 -1
- package/browser/{chunk-C59hhV25.js → chunk-DV5rOgFh.js} +1 -1
- package/browser/{chunk-CBTAHjIq.js → chunk-DXWpj06A.js} +1 -1
- package/browser/{chunk-CFUGnoau.js → chunk-DX_Vo3Ef.js} +1 -1
- package/browser/{chunk-D2rCay4H.js → chunk-DZuzGTyw.js} +1 -1
- package/browser/{chunk-CJ4GIpQh.js → chunk-Dl-2liq_.js} +1 -1
- package/browser/{chunk-CFkYuI2I.js → chunk-Dl6jjuEM.js} +1 -1
- package/browser/{chunk-CuY4DpEy.js → chunk-Doe9Up4y.js} +1 -1
- package/browser/{chunk-CQ66t_XC.js → chunk-DqE2HsdR.js} +1 -1
- package/browser/{chunk-5Y113ccl.js → chunk-Dsb0cbz7.js} +1 -1
- package/browser/{chunk-r4DIGFGA.js → chunk-DurvOM6S.js} +1 -1
- package/browser/{chunk-BQ1ZxVtl.js → chunk-DxysADy-.js} +1 -1
- package/browser/{chunk-Dv9t6ngX.js → chunk-DyMrbDO9.js} +1 -1
- package/browser/{chunk-DYIClc3-.js → chunk-DyTaDs8R.js} +1 -1
- package/browser/{chunk-CDlB_MgW.js → chunk-DyyzL0tV.js} +1 -1
- package/browser/{chunk-BZweLJbi.js → chunk-EaGpSLvo.js} +1 -1
- package/browser/{chunk-Boj1gYcQ.js → chunk-Egf0g5_d.js} +1 -1
- package/browser/{chunk-mPI6bYEV.js → chunk-G8AvIixl.js} +1 -1
- package/browser/{chunk-odhKIvc0.js → chunk-KWNHQk-V.js} +1 -1
- package/browser/{chunk-DF0OFBlh.js → chunk-M_1EV2Ae.js} +1 -1
- package/browser/{chunk-BT_jhPai.js → chunk-TFMuQzlk.js} +1 -1
- package/browser/{chunk-C1XFfqoT.js → chunk-UXySco7a.js} +1 -1
- package/browser/{chunk-BI52yvMl.js → chunk-WZ8ibLUm.js} +1 -1
- package/browser/{chunk-D88hl6XI.js → chunk-XpIi-MBQ.js} +1 -1
- package/browser/chunk-YQeiGavg.js +1 -0
- package/browser/{chunk-BwDh7lEt.js → chunk-csI-VsQo.js} +1 -1
- package/browser/{chunk-DuMRNwed.js → chunk-dBRlMEQQ.js} +1 -1
- package/browser/{chunk-CaZI6OEa.js → chunk-g2KeqoSd.js} +1 -1
- package/browser/{chunk-0-y9Db5v.js → chunk-k5Amgaum.js} +1 -1
- package/browser/{chunk-BorrTujx.js → chunk-nXl61KvO.js} +1 -1
- package/browser/{chunk-nTJ-vUJP.js → chunk-w0oeabgA.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-R5QFX3OD.js → main-NF2IMZ2D.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-CfodLKpx.js +0 -10
- package/browser/chunk-y0Xz-lHq.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,D as py,P,Q as br,r as re,W as x}from'./main-
|
|
1
|
+
import {g,D as py,P,Q as br,r as re,W as x}from'./main-NF2IMZ2D.js';var d=class i{http=g(py);projectState=g(P);promptsCache=new Map;getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/prompts`}listPrompts(){return this.http.get(this.getBaseUrl())}getPromptsAutocomplete(t,e){let r=this.promptsCache.get(t);return r?br(this.filterPromptsForAutocomplete(r,e)):this.http.get(`/api/projects/${t}/prompts`).pipe(re(p=>(this.promptsCache.set(t,p),this.filterPromptsForAutocomplete(p,e))))}filterPromptsForAutocomplete(t,e){let r=e.toLowerCase();return t.filter(o=>o.name.toLowerCase().includes(r)||o.description.toLowerCase().includes(r)).map(o=>({name:o.name,description:o.description,parameterFormat:o.parameterFormat}))}clearCache(t){t?this.promptsCache.delete(t):this.promptsCache.clear();}getPrompt(t){return this.http.get(`${this.getBaseUrl()}/${t}`)}createPrompt(t){return this.http.post(this.getBaseUrl(),t).pipe(re(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}updatePrompt(t,e){return this.http.put(`${this.getBaseUrl()}/${t}`,e).pipe(re(r=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),r)))}deletePrompt(t){return this.http.delete(`${this.getBaseUrl()}/${t}`).pipe(re(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}enableWebhook(t){return this.http.post(`${this.getBaseUrl()}/${t}/webhook`,{})}disableWebhook(t){return this.http.delete(`${this.getBaseUrl()}/${t}/webhook`)}static \u0275fac=function(e){return new(e||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,D as py,Q as br,bU as Td,r as re,W as x}from'./main-
|
|
1
|
+
import {g,D as py,Q as br,bU as Td,r as re,W as x}from'./main-NF2IMZ2D.js';var f=class s{http=g(py);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?br(t):this.http.get(`/api/projects/${e}/agents`).pipe(Td(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(re(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f}from'./chunk-CGtfhng3.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-C8OjnVE9.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-5Y113ccl.js';import {al as vt$1,an as ue,g,ay as O,a as F,L,az as Xt,U,N,p as pe$1,F as F$1,ap as Cd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,u as bg,v as eC,B as Pg,E as EC,I as IC,P as P$1,aD as Ly,W as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,z as Ug,ak as em,a6 as UI,A as dE,G as Gi$1,aE as W,D as py,Q as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,s as rC,y as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-R5QFX3OD.js';import {s}from'./chunk-nTJ-vUJP.js';import {d}from'./chunk-CEcYVC8L.js';import {S as Se$1,P as Pn}from'./chunk-D88hl6XI.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-odhKIvc0.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-D2rCay4H.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
1
|
+
import {f}from'./chunk-D56Lf-dS.js';import {G as Ge,z as z$1,Q as Qe,E as Et,y as yt$2}from'./chunk-BNoigwlG.js';import {U as Ue$1,x as x$2,i as is}from'./chunk-Dsb0cbz7.js';import {al as vt$1,an as ue,g,ay as O,a as F,L,az as Xt,U,N,p as pe$1,F as F$1,ap as Cd,ae as kt,aA as an,av as B,e as xw,h as hr$1,aB as fr$1,aC as Tu,k as ws,q as Rg,J as Jw,o as pl,X as XE,u as bg,v as eC,B as Pg,E as EC,I as IC,P as P$1,aD as Ly,W as x,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,z as Ug,ak as em,a6 as UI,A as dE,G as Gi$1,aE as W,D as py,Q as br$1,aF as R,r as re,a7 as ya,aG as fe,m as mT,x as x$1,w as w$1,aH as z,b as U$1,aI as bS,s as rC,y as oC,aJ as Tr$1,aK as xb,am as qm,j as Gn$1,n as GC,aL as wo$1,aM as Zn$2,aN as Nn,aO as wt$2,aP as G,aQ as $a,aR as Fs,aS as K,aT as Ut,aU as Ue,aV as U$2,aW as C,aX as D$1,aY as ft$1,aZ as js,a_ as QT,ac as gC,a$ as XC,b0 as Qg,a5 as vl,S as Sg,ah as rT,b1 as On,b2 as kb,b3 as Sb,b4 as oT,b5 as nT,aw as hl,b6 as _g,ax as gl,l as le,b7 as u,b8 as B$1,b9 as T,ba as v,bb as m,bc as R$1,bd as h,be as A,a8 as Yg,bf as aT,bg as uT,T as Tg,bh as Vy,i as pr$1,bi as lT,bj as aE,bk as yh}from'./main-NF2IMZ2D.js';import {s}from'./chunk-w0oeabgA.js';import {d}from'./chunk-D4oFaPAv.js';import {S as Se$1,P as Pn}from'./chunk-XpIi-MBQ.js';import {u as ui$1,m as mt$1,p as pt$1,Z as Z$1,V as Ve}from'./chunk-KWNHQk-V.js';import {y as yt$1,w as wt$1,t as ti$1,Y as Ye,Z as Zn$1,c as cn}from'./chunk-DZuzGTyw.js';var ot=class i{sanitizer=g(bS);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=On({name:"highlight",type:i,pure:true})};var be=class i{http=g(py);projectState=g(P$1);threadState=g(U);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,w$1({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var yi=["messageInput"],wi=["fileInput"],Ti=(i,e)=>e.name;function Si(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",8),GC(2," Recording... Click mic to stop "),pl());}function Mi(i,e){i&1&&(ws(0,"div",3),Sg(1,"span",9),GC(2," Transcribing... "),pl());}function Ei(i,e){if(i&1&&(ws(0,"span",14),GC(1),pl()),i&2){let t=gC().$implicit,n=gC(2);XE(),Yg(" "+(n.getParameterFormat(t)||""));}}function Oi(i,e){if(i&1){let t=lC();ws(0,"div",11),Rg("click",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=If(t).$index,r=gC(2);return wf(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=If(t).$index,r=gC(2);return wf(r.selectedAutocompleteIndex=o)}),ws(1,"div",12),Sg(2,"span",13),aT(3,"highlight"),Jw(4,Ei,2,1,"span",14),pl(),Sg(5,"div",15),aT(6,"highlight"),pl();}if(i&2){let t=e.$implicit,n=e.$index,o=gC(2);Ug("selected",n===o.selectedAutocompleteIndex),Tg("aria-selected",n===o.selectedAutocompleteIndex),XE(2),bg("innerHTML",lT(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),aE),XE(2),eC(o.hasParameterFormat(t)?4:-1),XE(),bg("innerHTML",lT(6,9,t.description,o.getAutocompleteQuery()),aE);}}function Pi(i,e){if(i&1&&(ws(0,"div",4),rC(1,Oi,7,12,"div",10,Ti),pl()),i&2){let t=gC();XE(),oC(t.autocompleteItems);}}function ki(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",18),Rg("action",function(){If(t);let o=gC(2);return wf(o.onStopClick())}),pl();}}function Ii(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",19),Rg("action",function(){If(t);let o=gC(2);return wf(o.sendMessage())}),pl();}if(i&2){let t=gC(2);Ug("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),bg("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim());}}function Di(i,e){if(i&1){let t=lC();ws(0,"ds-icon-button",21),Rg("action",function(){If(t);let o=gC(3);return wf(o.triggerFileUpload())}),pl(),ws(1,"input",22,1),Rg("change",function(o){If(t);let r=gC(3);return wf(r.onFileInputChange(o))}),pl();}if(i&2){let t=gC(3);bg("disabled",t.isDisabled);}}function Ai(i,e){if(i&1){let t=lC();Jw(0,Di,3,1),ws(1,"ds-icon-button",20),Rg("action",function(){If(t);let o=gC(2);return wf(o.toggleRecording())}),pl();}if(i&2){let t=gC(2);eC(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),XE(),Ug("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),bg("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording");}}function Fi(i,e){if(i&1&&(ws(0,"div",7),Jw(1,ki,1,0,"ds-icon-button",16),Jw(2,Ii,1,6,"ds-icon-button",17),Jw(3,Ai,2,6),pl()),i&2){let t=gC();XE(),eC(t.isThinking?1:-1),XE(),eC((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),XE(),eC(t.isThinking?-1:3);}}var rt=class i{isDisabled=false;showWelcome=false;isThinking=false;isStarting=false;isSessionInitializing=false;isStopping=false;filesPasted=new vt$1;messageSubmitted=new vt$1;voiceMessageReady=new vt$1;voiceRecordingToggled=new vt$1;heightChanged=new vt$1;stopRequested=new vt$1;textareaFocused=new vt$1;messageInput;fileInput;message="";isRecording=false;isTranscribing=false;isFocused=false;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=false;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=false;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=false;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(L);codayService=g(Ge);agentApiService=g(f);promptApiService=g(d);projectStateService=g(P$1);audioApiService=g(be);threadStateService=g(U);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e;})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e;})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore();}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200);});}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=false,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100);})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"));}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation();}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case "ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case "ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case "Tab":case "Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case "Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(true)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(true)));}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete();}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o);}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click();}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value="";}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete();}sendMessage(e=false){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0));}onStopClick(){this.isStopping=true,this.stopRequested.emit();}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording();}startWhisperRecording(){return B(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data);},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio();},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1);},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording");}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording");}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(false);}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=true;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=false;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=false,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=false,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50));},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=false,this.fallbackToTranscription(o,t,d);}});}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=false,v.text&&this.appendToTextarea(v.text+" ");},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=false;}});},n.readAsDataURL(e);}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=false,o.text&&this.appendToTextarea(o.text+" ");},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=false;}});}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=true,this.recognition.interimResults=true,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0);}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported");}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=true,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r);}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=false,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=false,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording);},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully");},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected");},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended");};}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording");}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=false,this.voiceRecordingToggled.emit(this.isRecording);}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks();}catch(e){console.error("[SPEECH] Failed to stop recording:",e);}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e);}}improveTranscriptPunctuation(e){let t=e;return /[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}setTimeout(()=>this.adjustTextareaHeight(),0);}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
|
|
2
2
|
|
|
3
3
|
`),this.sessionHadTranscript=false),this.pendingLineBreaksTimeout=null;},500);}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null);}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t);}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...");},2e3);}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking...";}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite="";}));}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus();},50);}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e));}));}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n);},0)),setTimeout(()=>this.adjustTextareaHeight(),10);}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available");}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete();}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete();}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0;},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete();}});}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete();}}hideAutocomplete(){this.autocompleteVisible=false,this.autocompleteItems=[],this.selectedAutocompleteIndex=0;}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else {this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2);}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else {let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n);}},0);}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem();}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});},0);}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&Pg(yi,7)(wi,5),t&2){let o;EC(o=IC())&&(n.messageInput=o.first),EC(o=IC())&&(n.fileInput=o.first);}},hostBindings:function(t,n){t&1&&Rg("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},dE);},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Tu],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=lC();ws(0,"div",2),Jw(1,Si,3,0,"div",3),Jw(2,Mi,3,0,"div",3),Jw(3,Pi,3,0,"div",4),ws(4,"div",5)(5,"textarea",6,0),tm("ngModelChange",function(d){return If(o),KC(n.message,d)||(n.message=d),wf(d)}),Rg("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return If(o),n.isFocused=true,wf(n.textareaFocused.emit())})("blur",function(){return n.isFocused=false}),pl(),VI(),Jw(7,Fi,4,3,"div",7),pl()();}t&2&&(XE(),eC(!n.isVoiceMessageMode&&n.isRecording?1:-1),XE(),eC(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),XE(),eC(n.autocompleteVisible?3:-1),XE(),Ug("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),XE(),em("ngModel",n.message),bg("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),UI(),XE(2),eC(n.isSessionInitializing?-1:7));},dependencies:[ti$1,Ye,Zn$1,cn,Se$1,ot],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}'],changeDetection:1})};var Ce=class i{unreadCountSubject=new Tr$1(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized");}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t);}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"));}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset");}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var at=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=false;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(Ce);project=g(P$1);constructor(){this.initializeTitleUpdates();}initializeTitleUpdates(){Ly([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t);});}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n);}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=true,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=false,this.forceUpdateTitle();},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle();}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=false,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle();}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t);}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var st=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e;}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e;}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null;}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ri=(i,e)=>e.label;function Hi(i,e){if(i&1){let t=lC();ws(0,"button",2),Rg("click",function(o){let r=If(t).$implicit,d=gC();return wf(d.executeAction(r,o))}),ws(1,"mat-icon"),GC(2),pl()();}if(i&2){let t=e.$implicit;Tg("title",t.tooltip||t.label),XE(),Tg("aria-label",t.label),XE(),Yg(t.icon);}}var ct=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action();}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(ws(0,"div",0),rC(1,Hi,3,3,"button",1,Ri),pl()),t&2&&(XE(),oC(n.actions));},dependencies:[qm,Gn$1,wt$1],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"],changeDetection:1})};var Z=class i{renderer;constructor(){this.renderer=new Ue$1,this.configureRenderer();}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>');}return o};}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return false;if(e.startsWith("//"))return true;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return false}}escapeHtml(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return B(this,null,function*(){let t=yield x$2.parse(e,{renderer:this.renderer,breaks:true,gfm:true});return is.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};var Vi=i=>({"user-message-wrapper":i});function Li(i,e){if(i&1&&(ws(0,"div",4)(1,"div",8),GC(2),pl()()),i&2){let t=gC(2);XE(2),vl(" ",t.message.speaker," ");}}function zi(i,e){if(i&1&&(ws(0,"time",6),GC(1),pl()),i&2){let t=gC(2);XE(),Yg(t.formattedTimestamp);}}function Ni(i,e){if(i&1&&(ws(0,"div",7),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC(2);XE(),bg("actions",t.actions);}}function $i(i,e){if(i&1&&(Jw(0,Li,3,1,"div",4),Sg(1,"div",5),Jw(2,zi,2,1,"time",6),Jw(3,Ni,2,1,"div",7)),i&2){let t=gC();eC(t.shouldShowSpeaker?0:-1),XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.formattedTimestamp?2:-1),XE(),eC(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1);}}function ji(i,e){if(i&1&&Sg(0,"span",12),i&2){let t=gC(3);bg("innerHTML",t.renderedContent,aE);}}function Ui(i,e){if(i&1&&(ws(0,"span",13),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.collapsedErrorText);}}function Bi(i,e){i&1&&GC(0," Show less \u25B2 ");}function Wi(i,e){i&1&&GC(0," Show more \u25BC ");}function qi(i,e){if(i&1){let t=lC();ws(0,"div",10),Jw(1,ji,1,1,"span",12)(2,Ui,2,1,"span",13),ws(3,"button",14),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleErrorExpanded())}),Jw(4,Bi,1,0)(5,Wi,1,0),pl()();}if(i&2){let t=gC(2);XE(),eC(t.isErrorExpanded()?1:2),XE(3),eC(t.isErrorExpanded()?4:5);}}function Yi(i,e){i&1&&GC(0," \u25B2 ");}function Gi(i,e){i&1&&GC(0," \u25BC ");}function Qi(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Xi(i,e){if(i&1&&(ws(0,"pre",18),GC(1),pl()),i&2){let t=gC(3);XE(),Yg(t.message.fullContent);}}function Ki(i,e){if(i&1){let t=lC();ws(0,"div",15),Sg(1,"span",12),ws(2,"button",16),Rg("click",function(){If(t);let o=gC(2);return wf(o.toggleTechnicalExpanded())}),Jw(3,Yi,1,0)(4,Gi,1,0),pl(),Jw(5,Qi,2,1,"a",17),pl(),Jw(6,Xi,2,1,"pre",18);}if(i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(2),eC(t.isTechnicalExpanded()?3:4),XE(2),eC(t.eventLink?5:-1),XE(),eC(t.isTechnicalExpanded()?6:-1);}}function Ji(i,e){if(i&1&&(ws(0,"a",17),GC(1,"view"),pl()),i&2){let t=gC(3);bg("href",t.eventLink,yh);}}function Zi(i,e){if(i&1&&(ws(0,"div",11),Sg(1,"span",12),Jw(2,Ji,2,1,"a",17),pl()),i&2){let t=gC(2);XE(),bg("innerHTML",t.renderedContent,aE),XE(),eC(t.eventLink?2:-1);}}function eo(i,e){if(i&1&&Jw(0,qi,6,2,"div",10)(1,Ki,7,4)(2,Zi,3,2,"div",11),i&2){let t=gC();eC(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2);}}function to(i,e){if(i&1&&(ws(0,"div",2),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}function no(i,e){if(i&1&&(ws(0,"div",3),Sg(1,"app-message-context-menu",9),pl()),i&2){let t=gC();XE(),bg("actions",t.actions);}}var ve=class i{destroy$=new ue;message;canDelete=true;isOtherUser=false;containingThreadId;copyRequested=new vt$1;deleteRequested=new vt$1;renderedContent="";shouldHideTechnical=false;shouldHideWarning=false;isErrorExpanded=Gi$1(false);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=Gi$1(false);sanitizer=g(bS);notificationService=g(s);preferencesService=g(L);projectState=g(P$1);threadState=g(U);markdownService=g(Z);get messageClasses(){return {[this.message.role]:true,[this.message.type]:true,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return B(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(Cd(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e;}),this.preferencesService.hideWarningMessages$.pipe(Cd(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e;}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages();})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=g(kb);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?false:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
|
|
4
4
|
`)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e);}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e);}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z}from'./chunk-
|
|
1
|
+
import {z}from'./chunk-B9R_DbfC.js';import {s}from'./chunk-w0oeabgA.js';import {g as g$1,F,P,R as Re,C as Ce,a as F$1,m as mT,x,w,ae as kt,b as U,e as xw,j as Gn,$ as $t,k as ws,q as Rg,S as Sg,o as pl,af as Eg,ag as fT,t as CC,X as XE,u as bg,a9 as lC,aa as If,ac as gC,ab as wf,n as GC,ah as rT}from'./main-NF2IMZ2D.js';import'./chunk-BojVkIWl.js';import {$ as $n,o as ot}from'./chunk-XpIi-MBQ.js';import'./chunk-KWNHQk-V.js';import {y as yt,w as wt}from'./chunk-DZuzGTyw.js';var ee=()=>[];function te(u,t){if(u&1){let o=lC();ws(0,"div",5)(1,"ds-entity-card",6),Rg("selected",function(r){If(o);let i=gC();return wf(i.onItemSelected(r))}),pl(),ws(2,"button",7),Rg("click",function(r){let i=If(o).$implicit,f=gC();return r.stopPropagation(),wf(f.onDeleteRequested(i.id))}),ws(3,"mat-icon"),GC(4,"close"),pl()()();}if(u&2){let o=t.$implicit;XE(),bg("id",o.id)("name",o.name)("description",o.description)("badges",o.badges??rT(4,ee));}}var g="__",Y=class u{router=g$1(F);projectStateService=g$1(P);dialog=g$1(Re);destroyRef=g$1(Ce);notification=g$1(s);projects=F$1(this.projectStateService.projectList$);forcedProject=F$1(this.projectStateService.forcedProject$,{initialValue:null});isLoading=F$1(this.projectStateService.isLoading$,{initialValue:false});projectItems=mT(()=>{let t=this.projects();if(!t)return [];let o=t.filter(e=>!e.name.includes(g)),n=t.filter(e=>e.name.includes(g)),r=new Set(o.map(e=>e.name)),i=e=>e.split(g)[0]??null,f=new Set(n.map(e=>i(e.name)).filter(e=>e!==null&&r.has(e))),l=[],G=[...f].sort((e,a)=>e.localeCompare(a));for(let e of G){let a=o.find(s=>s.name===e);l.push(x(w({},this.toEntityListItem(a)),{groupKey:e,groupLabel:e}));let Z=n.filter(s=>i(s.name)===e).sort((s,C)=>s.name.localeCompare(C.name));for(let s of Z){let C=s.name.slice(e.length+g.length);l.push(x(w({},this.toEntityListItem(s)),{name:C,description:s.name,groupKey:e,groupLabel:e}));}}let H=[...o].filter(e=>!f.has(e.name)&&!e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of H)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__standalone__",groupLabel:"Projects"}));let Q=[...o].filter(e=>!f.has(e.name)&&e.volatile).sort((e,a)=>e.name.localeCompare(a.name));for(let e of Q)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let X=n.filter(e=>{let a=i(e.name);return a!==null&&!r.has(a)}).sort((e,a)=>e.name.localeCompare(a.name));for(let e of X)l.push(x(w({},this.toEntityListItem(e)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return l});showCreateButton=mT(()=>!this.forcedProject());constructor(){}onItemSelected(t){this.projectStateService.selectProject(t),this.router.navigate(["project",t]);}onCreateRequested(){this.router.navigate(["project","new"]);}onDeleteRequested(t){let o=t.includes(g);this.dialog.open(z,{width:"400px",panelClass:"confirm-dialog-panel",data:w({title:"Delete project",message:`This will remove the project "${t}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:true},o?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(kt(r=>r?.confirmed===true),U(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(t,r.checkboxChecked).pipe(U(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${t}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(t)}`)&&this.router.navigate(["/"]);},error:i=>{console.error("[PROJECT-LIST] Failed to delete project:",i),this.notification.error(i?.error?.error??"Failed to delete project");}});});}toEntityListItem(t){return {id:t.name,name:t.name,badges:t.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(o){return new(o||u)};static \u0275cmp=xw({type:u,selectors:[["app-project-selection"]],decls:6,vars:5,consts:[["projectCard",""],[1,"project-page-layout"],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","loading","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","routerLink","/","title","Back to tasks",1,"project-list__logo"],["src","CODAY-Logo.png","alt","Coday"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(o,n){if(o&1&&(ws(0,"div",1)(1,"ds-entity-list",2),Rg("itemSelected",function(i){return n.onItemSelected(i)})("createRequested",function(){return n.onCreateRequested()}),ws(2,"a",3),Sg(3,"img",4),pl()()(),Eg(4,te,5,5,"ng-template",null,0,fT)),o&2){let r=CC(5);XE(),bg("items",n.projectItems())("loading",n.isLoading())("itemTemplate",r)("showCreate",n.showCreateButton())("autoFocusSearch",true);}},dependencies:[$n,ot,yt,wt,Gn,$t],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.project-page-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.project-list__logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;border-radius:4px;opacity:.85;transition:opacity .15s ease;cursor:pointer}.project-list__logo[_ngcontent-%COMP%]:hover{opacity:1}.project-list__logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:40px;height:40px;object-fit:contain;border-radius:4px}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"],changeDetection:1})};export{Y as ProjectListComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {O}from'./chunk-CFUGnoau.js';import {R}from'./chunk-CFkYuI2I.js';import {N}from'./chunk-BI52yvMl.js';import {g,F,bm as Mm,C as Ce$1,G as Gi,m as mT,a as F$1,aD as Ly,r as re,b as U,e as xw,k as ws,q as Rg,o as pl,n as GC,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,z as Ug,T as Tg,a8 as Yg,a5 as vl,S as Sg,a3 as VI,u as bg,a6 as UI,aa as If,ab as wf,cH as Kw}from'./main-R5QFX3OD.js';import {l,I,f}from'./chunk-CfodLKpx.js';import {S as Se$1}from'./chunk-D88hl6XI.js';import'./chunk-odhKIvc0.js';import {o as z,k as _t,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,E as En,p as An}from'./chunk-D2rCay4H.js';import'./chunk-y0Xz-lHq.js';import'./chunk-5Y113ccl.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(ws(0,"p",4),GC(1,"Loading\u2026"),pl());}function de(r,i){if(r&1){let e=lC();ws(0,"button",18),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setThemeVariant(d.value))}),ws(1,"span",19),GC(2),pl(),ws(3,"span",20),GC(4),pl()();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__theme-variant--active",a.themeVariant()===e.value),Tg("aria-pressed",a.themeVariant()===e.value),XE(2),Yg(e.label),XE(2),Yg(e.description);}}function _e(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setTheme(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.themeMode()===e.value),Tg("aria-pressed",a.themeMode()===e.value),XE(),vl(" ",e.label," ");}}function ce(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setEnterKeyBehavior(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Tg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),vl(" ",e.label," ");}}function pe(r,i){if(r&1&&(ws(0,"option",32),GC(1),pl()),r&2){let e=i.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function me(r,i){if(r&1){let e=lC();ws(0,"form",22),Rg("ngSubmit",function(){If(e);let d=gC(2);return wf(d.save())}),ws(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",23),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",23),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"label",24),GC(19,"First name"),pl(),Sg(20,"input",25),VI(),pl(),ws(21,"div",7)(22,"label",26),GC(23,"Last name"),pl(),Sg(24,"input",27),VI(),pl(),ws(25,"div",7)(26,"label",28),GC(27,"Bio"),pl(),Sg(28,"textarea",29),VI(),pl(),ws(29,"div",7)(30,"label",30),GC(31,"Language"),pl(),ws(32,"select",31),rC(33,pe,2,2,"option",32,D),pl(),VI(),pl()(),ws(35,"div",33)(36,"button",34),GC(37),pl(),ws(38,"button",35),Rg("click",function(){If(e);let d=gC(2);return wf(d.cancelEditing())}),GC(39,"Cancel"),pl()()();}if(r&2){let e=gC(),a=gC();bg("formGroup",a.form),XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(7),UI(),XE(4),UI(),XE(4),UI(),XE(4),UI(),XE(),oC(a.languageOptions),XE(3),bg("disabled",a.isSaving()),XE(),vl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(ws(0,"p",43),GC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function fe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function ge(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Ce(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,fe,6,0)(6,ge,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"Integrations"),pl(),ws(2,"ul",45),rC(3,Ce,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().integrations);}}function xe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function be(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function ye(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,xe,6,0)(6,be,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"AI Providers"),pl(),ws(2,"ul",45),rC(3,ye,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function Pe(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Se(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,Ee,6,0)(6,Pe,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"My global auth settings"),pl(),ws(2,"ul",45),rC(3,Se,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().authSettings);}}function ke(r,i){if(r&1&&(Jw(0,ve,5,0),Jw(1,he,5,0),Jw(2,we,5,0)),r&2){let e=gC(4);eC(e.recap().integrations.length>0?0:-1),XE(),eC(e.recap().aiProviders.length>0?1:-1),XE(),eC(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&Jw(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=gC(3);eC(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=lC();ws(0,"div",17)(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",36),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",36),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"span",8),GC(19,"First name"),pl(),ws(20,"span",36),GC(21),pl()(),ws(22,"div",7)(23,"span",8),GC(24,"Last name"),pl(),ws(25,"span",36),GC(26),pl()(),ws(27,"div",37)(28,"span",8),GC(29,"Bio"),pl(),ws(30,"span",36),GC(31),pl()(),ws(32,"div",7)(33,"span",8),GC(34,"Language"),pl(),ws(35,"span",36),GC(36),pl()()(),ws(37,"div",33)(38,"button",38),Rg("click",function(){If(e);let d=gC(2);return wf(d.startEditing())}),GC(39," Edit profile "),pl()(),ws(40,"div",39)(41,"button",40),Rg("click",function(){If(e);let d=gC(2);return wf(d.toggleOverrides())}),ws(42,"span",41),GC(43,"\u25B6"),pl(),GC(44," My global user configurations "),ws(45,"span",42),GC(46),pl()(),Jw(47,Me,2,1),pl()();}if(r&2){let e=gC(),a=gC();XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(8),Yg(e.firstname||"\u2014"),XE(5),Yg(e.lastname||"\u2014"),XE(5),Yg(e.bio||"\u2014"),XE(5),Yg(e.preferredLanguage||"\u2014"),XE(5),Tg("aria-expanded",a.isOverridesExpanded()),XE(),Ug("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),vl("(",a.recap().total,")"),XE(),eC(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(ws(0,"div",5)(1,"h2",6),GC(2,"Appearance"),pl(),ws(3,"div",7)(4,"span",8),GC(5,"Skin"),pl(),ws(6,"div",9),rC(7,de,5,5,"button",10,D),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"Mode"),pl(),ws(12,"div",11),rC(13,_e,2,4,"button",12,D),pl()()(),ws(15,"div",5)(16,"h2",6),GC(17,"Composer"),pl(),ws(18,"div",7)(19,"span",8),GC(20,"Enter key"),pl(),ws(21,"div",13)(22,"div",14),rC(23,ce,2,4,"button",12,D),pl(),ws(25,"p",15),GC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),pl()()()(),Jw(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=gC();XE(7),oC(e.themeVariantOptions),XE(6),oC(e.themeOptions),XE(10),oC(e.enterKeyOptions),XE(4),eC(e.isEditing()?27:28);}}function Te(r,i){r&1&&(ws(0,"p",4),GC(1,"Unable to load profile."),pl());}var le=class r{userState=g(l);router=g(F);location=g(Mm);destroyRef=g(Ce$1);integrationState=g(N);providerState=g(O);authSettingState=g(R);themePort=g(I);preferencesPort=g(f);isEditing=Gi(false);isLoading=Gi(false);isSaving=Gi(false);isOverridesExpanded=Gi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true}),preferredLanguage:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(re(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();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,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Gi(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"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}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??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,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"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",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__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["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"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[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,a){if(e&1&&(ws(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Rg("action",function(){return a.goBack()}),pl(),ws(3,"h1",3),GC(4,"My profile"),pl()(),Jw(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),pl()),e&2){let d;XE(5),eC(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An,Se$1],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.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-accent)}.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:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);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-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);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);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;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-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.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)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.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:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.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-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);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:0}.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:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
|
|
1
|
+
import {O}from'./chunk-DX_Vo3Ef.js';import {R}from'./chunk-Dl6jjuEM.js';import {N}from'./chunk-WZ8ibLUm.js';import {g,F,bm as Mm,C as Ce$1,G as Gi,m as mT,a as F$1,aD as Ly,r as re,b as U,e as xw,k as ws,q as Rg,o as pl,n as GC,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,z as Ug,T as Tg,a8 as Yg,a5 as vl,S as Sg,a3 as VI,u as bg,a6 as UI,aa as If,ab as wf,cH as Kw}from'./main-NF2IMZ2D.js';import {l,I,f}from'./chunk-D1nZmts_.js';import {S as Se$1}from'./chunk-XpIi-MBQ.js';import'./chunk-KWNHQk-V.js';import {o as z,k as _t,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,l as Xn,E as En,p as An}from'./chunk-DZuzGTyw.js';import'./chunk-YQeiGavg.js';import'./chunk-Dsb0cbz7.js';var D=(r,i)=>i.value;function se(r,i){r&1&&(ws(0,"p",4),GC(1,"Loading\u2026"),pl());}function de(r,i){if(r&1){let e=lC();ws(0,"button",18),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setThemeVariant(d.value))}),ws(1,"span",19),GC(2),pl(),ws(3,"span",20),GC(4),pl()();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__theme-variant--active",a.themeVariant()===e.value),Tg("aria-pressed",a.themeVariant()===e.value),XE(2),Yg(e.label),XE(2),Yg(e.description);}}function _e(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setTheme(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.themeMode()===e.value),Tg("aria-pressed",a.themeMode()===e.value),XE(),vl(" ",e.label," ");}}function ce(r,i){if(r&1){let e=lC();ws(0,"button",21),Rg("click",function(){let d=If(e).$implicit,_=gC(2);return wf(_.setEnterKeyBehavior(d.value))}),GC(1),pl();}if(r&2){let e=i.$implicit,a=gC(2);Ug("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Tg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),vl(" ",e.label," ");}}function pe(r,i){if(r&1&&(ws(0,"option",32),GC(1),pl()),r&2){let e=i.$implicit;bg("value",e.value),XE(),Yg(e.label);}}function me(r,i){if(r&1){let e=lC();ws(0,"form",22),Rg("ngSubmit",function(){If(e);let d=gC(2);return wf(d.save())}),ws(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",23),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",23),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"label",24),GC(19,"First name"),pl(),Sg(20,"input",25),VI(),pl(),ws(21,"div",7)(22,"label",26),GC(23,"Last name"),pl(),Sg(24,"input",27),VI(),pl(),ws(25,"div",7)(26,"label",28),GC(27,"Bio"),pl(),Sg(28,"textarea",29),VI(),pl(),ws(29,"div",7)(30,"label",30),GC(31,"Language"),pl(),ws(32,"select",31),rC(33,pe,2,2,"option",32,D),pl(),VI(),pl()(),ws(35,"div",33)(36,"button",34),GC(37),pl(),ws(38,"button",35),Rg("click",function(){If(e);let d=gC(2);return wf(d.cancelEditing())}),GC(39,"Cancel"),pl()()();}if(r&2){let e=gC(),a=gC();bg("formGroup",a.form),XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(7),UI(),XE(4),UI(),XE(4),UI(),XE(4),UI(),XE(),oC(a.languageOptions),XE(3),bg("disabled",a.isSaving()),XE(),vl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function ue(r,i){r&1&&(ws(0,"p",43),GC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function fe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function ge(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Ce(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,fe,6,0)(6,ge,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function ve(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"Integrations"),pl(),ws(2,"ul",45),rC(3,Ce,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().integrations);}}function xe(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function be(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function ye(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,xe,6,0)(6,be,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function he(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"AI Providers"),pl(),ws(2,"ul",45),rC(3,ye,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().aiProviders);}}function Ee(r,i){if(r&1){let e=lC();ws(0,"span",50),GC(1,"Delete?"),pl(),ws(2,"button",51),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.confirmDelete(d))}),GC(3," Confirm "),pl(),ws(4,"button",52),Rg("click",function(){If(e);let d=gC(7);return wf(d.cancelDelete())}),GC(5," Cancel "),pl();}}function Pe(r,i){if(r&1){let e=lC();ws(0,"button",52),Rg("click",function(){If(e);let d=gC().$implicit,_=gC(6);return wf(_.armDelete(d))}),GC(1," Delete "),pl();}}function Se(r,i){if(r&1&&(ws(0,"li",46)(1,"span",47),GC(2),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,Ee,6,0)(6,Pe,2,0,"button",49),pl()),r&2){let e=i.$implicit,a=gC(6);XE(2),Yg(e.name),XE(2),Yg(e.subtitle),XE(),eC(a.isPendingDelete(e)?5:6);}}function we(r,i){if(r&1&&(ws(0,"h3",44),GC(1,"My global auth settings"),pl(),ws(2,"ul",45),rC(3,Se,7,3,"li",46,Kw().trackEntry,true),pl()),r&2){let e=gC(5);XE(3),oC(e.recap().authSettings);}}function ke(r,i){if(r&1&&(Jw(0,ve,5,0),Jw(1,he,5,0),Jw(2,we,5,0)),r&2){let e=gC(4);eC(e.recap().integrations.length>0?0:-1),XE(),eC(e.recap().aiProviders.length>0?1:-1),XE(),eC(e.recap().authSettings.length>0?2:-1);}}function Me(r,i){if(r&1&&Jw(0,ue,2,0,"p",43)(1,ke,3,3),r&2){let e=gC(3);eC(e.recap().total===0?0:1);}}function Oe(r,i){if(r&1){let e=lC();ws(0,"div",17)(1,"div",5)(2,"h2",6),GC(3,"Identity"),pl(),ws(4,"div",7)(5,"span",8),GC(6,"Email"),pl(),ws(7,"span",36),GC(8),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"External ID"),pl(),ws(12,"span",36),GC(13),pl()()(),ws(14,"div",5)(15,"h2",6),GC(16,"Profile"),pl(),ws(17,"div",7)(18,"span",8),GC(19,"First name"),pl(),ws(20,"span",36),GC(21),pl()(),ws(22,"div",7)(23,"span",8),GC(24,"Last name"),pl(),ws(25,"span",36),GC(26),pl()(),ws(27,"div",37)(28,"span",8),GC(29,"Bio"),pl(),ws(30,"span",36),GC(31),pl()(),ws(32,"div",7)(33,"span",8),GC(34,"Language"),pl(),ws(35,"span",36),GC(36),pl()()(),ws(37,"div",33)(38,"button",38),Rg("click",function(){If(e);let d=gC(2);return wf(d.startEditing())}),GC(39," Edit profile "),pl()(),ws(40,"div",39)(41,"button",40),Rg("click",function(){If(e);let d=gC(2);return wf(d.toggleOverrides())}),ws(42,"span",41),GC(43,"\u25B6"),pl(),GC(44," My global user configurations "),ws(45,"span",42),GC(46),pl()(),Jw(47,Me,2,1),pl()();}if(r&2){let e=gC(),a=gC();XE(8),Yg(e.email),XE(5),Yg(e.externalId),XE(8),Yg(e.firstname||"\u2014"),XE(5),Yg(e.lastname||"\u2014"),XE(5),Yg(e.bio||"\u2014"),XE(5),Yg(e.preferredLanguage||"\u2014"),XE(5),Tg("aria-expanded",a.isOverridesExpanded()),XE(),Ug("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),vl("(",a.recap().total,")"),XE(),eC(a.isOverridesExpanded()?47:-1);}}function Ue(r,i){if(r&1&&(ws(0,"div",5)(1,"h2",6),GC(2,"Appearance"),pl(),ws(3,"div",7)(4,"span",8),GC(5,"Skin"),pl(),ws(6,"div",9),rC(7,de,5,5,"button",10,D),pl()(),ws(9,"div",7)(10,"span",8),GC(11,"Mode"),pl(),ws(12,"div",11),rC(13,_e,2,4,"button",12,D),pl()()(),ws(15,"div",5)(16,"h2",6),GC(17,"Composer"),pl(),ws(18,"div",7)(19,"span",8),GC(20,"Enter key"),pl(),ws(21,"div",13)(22,"div",14),rC(23,ce,2,4,"button",12,D),pl(),ws(25,"p",15),GC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),pl()()()(),Jw(27,me,40,5,"form",16)(28,Oe,48,11,"div",17)),r&2){let e=gC();XE(7),oC(e.themeVariantOptions),XE(6),oC(e.themeOptions),XE(10),oC(e.enterKeyOptions),XE(4),eC(e.isEditing()?27:28);}}function Te(r,i){r&1&&(ws(0,"p",4),GC(1,"Unable to load profile."),pl());}var le=class r{userState=g(l);router=g(F);location=g(Mm);destroyRef=g(Ce$1);integrationState=g(N);providerState=g(O);authSettingState=g(R);themePort=g(I);preferencesPort=g(f);isEditing=Gi(false);isLoading=Gi(false);isSaving=Gi(false);isOverridesExpanded=Gi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true}),preferredLanguage:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(re(([i,e,a])=>{let d=i.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),_=e.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=a.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:d,aiProviders:_,authSettings:I,total:d.length+_.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){if(this.isSaving())return;this.isSaving.set(true);let i=this.form.controls.preferredLanguage.value.trim();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,preferredLanguage:i||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Gi(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"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}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??"",preferredLanguage:i.preferredLanguage??""});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,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"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",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__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["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"],["for","up-preferredLanguage",1,"user-profile__label"],["id","up-preferredLanguage","formControlName","preferredLanguage",1,"user-profile__input","user-profile__select"],[3,"value"],[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,a){if(e&1&&(ws(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Rg("action",function(){return a.goBack()}),pl(),ws(3,"h1",3),GC(4,"My profile"),pl()(),Jw(5,se,2,0,"p",4)(6,Ue,29,1)(7,Te,2,0,"p",4),pl()),e&2){let d;XE(5),eC(a.isLoading()?5:(d=a.currentUser())?6:7,d);}},dependencies:[ni,Jn,Qn,ei,Ye,At,Zn,Xn,En,An,Se$1],styles:[`.user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.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-accent)}.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:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);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-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);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);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;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-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.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)}.user-profile__select[_ngcontent-%COMP%]{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .75rem center;padding-right:2.25rem}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.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:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.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-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);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:0}.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:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}`]})};
|
|
2
2
|
export{le as UserProfileComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,ao as W,F as F$1,C as Ce,da as $,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,b as U$1,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,a8 as Yg,u as bg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,ao as W,F as F$1,C as Ce,da as $,aJ as Tr,G as Gi,bS as Ea,M as By,a7 as ya,Q as br,b as U$1,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,s as rC,ac as gC,y as oC,a9 as lC,a8 as Yg,u as bg,aa as If,ab as wf}from'./main-NF2IMZ2D.js';import {d as Kn,J as Jn,Y as Yn}from'./chunk-XpIi-MBQ.js';import'./chunk-KWNHQk-V.js';import'./chunk-DZuzGTyw.js';var V=(o,e)=>e.key;function F(o,e){o&1&&(ws(0,"p",2),GC(1,"Loading agent configs\u2026"),pl());}function j(o,e){o&1&&(ws(0,"p",3),GC(1,"No agent configs available."),pl());}function z(o,e){o&1&&(ws(0,"ds-tag",11),GC(1,"Read-only"),pl());}function B(o,e){if(o&1){let t=lC();ws(0,"button",13),Rg("click",function(){If(t);let c=gC().$implicit,g=gC(2);return wf(g.launch(c))}),GC(1,"Launch"),pl();}}function H(o,e){if(o&1){let t=lC();ws(0,"button",13),Rg("click",function(){If(t);let c=gC().$implicit,g=gC(2);return wf(g.edit(c))}),GC(1,"Edit"),pl(),ws(2,"button",15),Rg("click",function(){If(t);let c=gC().$implicit,g=gC(2);return wf(g.delete(c))}),GC(3,"Delete"),pl();}}function J(o,e){if(o&1){let t=lC();ws(0,"tr")(1,"td",7),GC(2),pl(),ws(3,"td",8),GC(4),pl(),ws(5,"td"),GC(6),pl(),ws(7,"td")(8,"div",9)(9,"ds-tag",10),GC(10),pl(),Jw(11,z,2,0,"ds-tag",11),pl()(),ws(12,"td",12)(13,"button",13),Rg("click",function(){let c=If(t).$implicit,g=gC(2);return wf(g.inspect(c))}),GC(14,"Inspect"),pl(),Jw(15,B,2,0,"button",14),Jw(16,H,4,0),pl()();}if(o&2){let t=e.$implicit,r=gC(2);XE(2),Yg(t.config.name),XE(2),Yg(t.config.description||"\u2014"),XE(2),Yg(r.mode(t)),XE(3),bg("variant",t.scope==="platform"?"neutral":"accent"),XE(),Yg(t.scope==="platform"?"Platform":"Namespace"),XE(),eC(t.scope==="platform"?11:-1),XE(4),eC(r.canLaunch(t)?15:-1),XE(),eC(t.scope==="namespace"?16:-1);}}function U(o,e){if(o&1&&(ws(0,"div",4)(1,"table",5)(2,"thead")(3,"tr")(4,"th"),GC(5,"Name"),pl(),ws(6,"th"),GC(7,"Description"),pl(),ws(8,"th"),GC(9,"Execution mode"),pl(),ws(10,"th"),GC(11,"Scope"),pl(),ws(12,"th")(13,"span",6),GC(14,"Actions"),pl()()()(),ws(15,"tbody"),rC(16,J,17,8,"tr",null,V),pl()()()),o&2){let t=gC();XE(16),oC(t.rows());}}var L=class o{route=g(W);router=g(F$1);destroyRef=g(Ce);controller=g($);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=Gi(true);rows=Gi([]);allConfigs$=this.refresh$.pipe(Ea(()=>(this.isLoading.set(true),By({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(ya(()=>br([])))}))));constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((r,c)=>({key:`platform:${r.id??c}`,config:r,scope:"platform"})),...e.map((r,c)=>({key:`namespace:${r.id??c}`,config:r,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}delete(e){e.scope==="platform"||!e.config.id||!confirm(`Delete agent config \u201C${e.config.name}\u201D?`)||this.controller.deleteAgentConfig(e.config.id).pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-namespace-agent-configs"]],decls:6,vars:1,consts:[["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["type","button",1,"agent-configs__new",3,"click"],["role","status",1,"agent-configs__status"],[1,"agent-configs__status"],[1,"agent-configs__table-wrap"],["dsTable",""],[1,"sr-only"],[1,"agent-configs__name"],[1,"agent-configs__description"],[1,"agent-configs__tags"],[3,"variant"],["variant","outline"],[1,"agent-configs__actions"],["type","button",3,"click"],["type","button"],["type","button",1,"agent-configs__delete",3,"click"]],template:function(t,r){t&1&&(ws(0,"ds-section-header",0)(1,"button",1),Rg("click",function(){return r.openCreateForm()}),GC(2," New agent config "),pl()(),Jw(3,F,2,0,"p",2)(4,j,2,0,"p",3)(5,U,18,0,"div",4)),t&2&&(XE(3),eC(r.isLoading()?3:r.rows().length===0?4:5));},dependencies:[Kn,Jn,Yn],styles:[".agent-configs__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.agent-configs__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.agent-configs__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.agent-configs__name[_ngcontent-%COMP%]{font-weight:500}.agent-configs__description[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.agent-configs__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.agent-configs__actions[_ngcontent-%COMP%]{white-space:nowrap;vertical-align:middle;text-align:center}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.agent-configs__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.agent-configs__actions[_ngcontent-%COMP%] .agent-configs__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}"]})};export{L as NamespaceAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-YQeiGavg.js';import {l}from'./chunk-D1nZmts_.js';import {g as g$1,dg as k,aJ as Tr,aD as Ly,bS as Ea,a7 as ya,Q as br,r as re,cE as Dd,bU as Td,w,W as x}from'./main-NF2IMZ2D.js';var g="none",N="me",O=class p{nsController=g$1(k);userState=g$1(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(Ea(([e])=>{let r=this.loadPlatformProviders().pipe(ya(()=>br([])));return e?Ly([r,this.loadNamespaceProviders(e).pipe(ya(()=>br([]))),this.loadUserProviders(e).pipe(ya(()=>br([]))),this.loadUserProviders("global").pipe(ya(()=>br([])))]).pipe(re(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):Ly([r,this.loadNamespaceProviders("").pipe(ya(()=>br([]))),this.loadUserProviders("global").pipe(ya(()=>br([])))]).pipe(re(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Dd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):br([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Td(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Td(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Td(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Td(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=x({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
|