@whoz-oss/coday-client 0.0.0-workstream-forge.100 → 0.0.0-workstream-forge.101
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-D8omHn7V.js → chunk--t7R2FQ4.js} +1 -1
- package/browser/{chunk-BMck3RrE.js → chunk-1I02Q6MC.js} +1 -1
- package/browser/{chunk-Cz3puK-P.js → chunk-8j0zbcE8.js} +1 -1
- package/browser/{chunk-C_5eQn8U.js → chunk-B0ec6QE2.js} +1 -1
- package/browser/{chunk-B5rnCx1b.js → chunk-B4NACXvL.js} +1 -1
- package/browser/{chunk-oODMxNh6.js → chunk-B6YuGUPU.js} +1 -1
- package/browser/{chunk-DLNa7187.js → chunk-BAJj5ySw.js} +1 -1
- package/browser/{chunk-DN2TqPUr.js → chunk-BCkdBoJT.js} +1 -1
- package/browser/{chunk-CBShRrKK.js → chunk-BD9QyJ_D.js} +1 -1
- package/browser/{chunk-C0ZbwTfx.js → chunk-BDClIjt_.js} +1 -1
- package/browser/{chunk-65tVAuhG.js → chunk-BLaIJYTj.js} +1 -1
- package/browser/{chunk-BtsE1R-P.js → chunk-BNS4nii-.js} +1 -1
- package/browser/{chunk-C0fiVu73.js → chunk-BNygw8cy.js} +1 -1
- package/browser/{chunk-CKI8BAs4.js → chunk-Bb97Kx1k.js} +1 -1
- package/browser/{chunk-DBuc5FLi.js → chunk-BhOBAGu0.js} +1 -1
- package/browser/{chunk-DfZZLMRA.js → chunk-Bk4wk-Q1.js} +1 -1
- package/browser/{chunk-x8X4JXC2.js → chunk-Bo7GcoVn.js} +1 -1
- package/browser/{chunk-DVHrTMkL.js → chunk-BuJ0a-jT.js} +1 -1
- package/browser/{chunk-BBUDU1bN.js → chunk-BvCaRkbC.js} +1 -1
- package/browser/{chunk-BHrmI0lw.js → chunk-BxKTxblc.js} +1 -1
- package/browser/{chunk-BrcfGPj_.js → chunk-BxlhPj4a.js} +1 -1
- package/browser/{chunk-J2uWrEAz.js → chunk-C-qaxhzV.js} +1 -1
- package/browser/{chunk-Jp1EkzoM.js → chunk-C2xbdglQ.js} +1 -1
- package/browser/{chunk-BFaLzff-.js → chunk-C6CIcqIe.js} +1 -1
- package/browser/{chunk-CXA9dtI0.js → chunk-CFyEUO4f.js} +1 -1
- package/browser/{chunk-DLde3g-3.js → chunk-CGFcBWlS.js} +1 -1
- package/browser/{chunk-BBgb869U.js → chunk-CIHz2nkf.js} +1 -1
- package/browser/{chunk-QpH9EEhD.js → chunk-CKhMv1Ug.js} +1 -1
- package/browser/{chunk-CDVwpBWc.js → chunk-CTEyKNKm.js} +1 -1
- package/browser/{chunk-DA_sbewE.js → chunk-CTRtr19h.js} +1 -1
- package/browser/chunk-CVM23KJ3.js +11 -0
- package/browser/{chunk-CdXOdNcd.js → chunk-CXyYyXX9.js} +1 -1
- package/browser/{chunk-C6aIC46X.js → chunk-C_etNNrs.js} +1 -1
- package/browser/{chunk-mQPGTeS6.js → chunk-CeL5OSae.js} +1 -1
- package/browser/{chunk-BKbzb9p8.js → chunk-ChNYRuIU.js} +1 -1
- package/browser/{chunk-BnAqiYqI.js → chunk-CkzIzWyC.js} +1 -1
- package/browser/{chunk-DoEwzfHE.js → chunk-ClEsObVj.js} +1 -1
- package/browser/{chunk-Bg9IOIBp.js → chunk-ClmFjies.js} +1 -1
- package/browser/{chunk-CjG8z5z5.js → chunk-CopZgdKm.js} +1 -1
- package/browser/{chunk-CgJRLZNp.js → chunk-Cpofe53u.js} +1 -1
- package/browser/{chunk-CvZWmgd7.js → chunk-CrU3BQQS.js} +1 -1
- package/browser/{chunk-DMAW_dUA.js → chunk-CvmyFGzy.js} +1 -1
- package/browser/{chunk-TPspvPcl.js → chunk-Cy8V5YYe.js} +1 -1
- package/browser/{chunk-C0L3lRLz.js → chunk-CyLUngtV.js} +1 -1
- package/browser/{chunk-bBy0vM9Y.js → chunk-D-FNlEoa.js} +1 -1
- package/browser/{chunk-DphUtWOw.js → chunk-D1duEHtM.js} +1 -1
- package/browser/{chunk-8li-9jxk.js → chunk-D8veTI-Z.js} +1 -1
- package/browser/{chunk-CSuL5t9_.js → chunk-DEcr5XTR.js} +1 -1
- package/browser/{chunk-2mrqEJI8.js → chunk-DI7OUCqm.js} +1 -1
- package/browser/{chunk-BHOfNKW0.js → chunk-DQuNupfJ.js} +1 -1
- package/browser/{chunk-6B3xFuOu.js → chunk-DUTgv2ie.js} +1 -1
- package/browser/{chunk-By9VfPER.js → chunk-DW5_PM92.js} +1 -1
- package/browser/{chunk-CxodB9Ss.js → chunk-DjIEzaIJ.js} +1 -1
- package/browser/{chunk-CccoF4zk.js → chunk-Dp3xB5xu.js} +1 -1
- package/browser/{chunk-rt0W0Bep.js → chunk-DsBVpg5c.js} +1 -1
- package/browser/{chunk-B7tH9_ts.js → chunk-DsvZ07ov.js} +1 -1
- package/browser/{chunk-DTHwi4pI.js → chunk-Du4XO3B9.js} +1 -1
- package/browser/{chunk-Dls1Urvo.js → chunk-DxHp0kqe.js} +1 -1
- package/browser/{chunk-BSWAm8Lc.js → chunk-DyVTJvil.js} +1 -1
- package/browser/chunk-Gb2w1W4p.js +1 -0
- package/browser/{chunk-OEx8WMIh.js → chunk-PT1nxNHL.js} +1 -1
- package/browser/{chunk-CuEHbWdb.js → chunk-PljuvLnA.js} +1 -1
- package/browser/{chunk-BvkBTPsn.js → chunk-T7g1MoTP.js} +1 -1
- package/browser/{chunk-DL_yUw7E.js → chunk-ZZzKEzSY.js} +1 -1
- package/browser/{chunk-D1K33IKA.js → chunk-aMjpfW4c.js} +1 -1
- package/browser/{chunk-Bm8CD55z.js → chunk-fU4sX2V7.js} +1 -1
- package/browser/{chunk-Ck9jrhg3.js → chunk-j9VL-NZi.js} +1 -1
- package/browser/{chunk-giFp1XTq.js → chunk-mLUorSK3.js} +1 -1
- package/browser/{chunk-DYh1IsU-.js → chunk-pBppBdvD.js} +1 -1
- package/browser/{chunk-CU55cDg_.js → chunk-spR5H-6W.js} +1 -1
- package/browser/{chunk-DyNaE9Xq.js → chunk-yRRB8B0R.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-HLQ22ACS.js → main-DB5EJGYC.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-BXgG4B5s.js +0 -1
- package/browser/chunk-B_yM2E8f.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import {A,k as kt,b as bt}from'./chunk-DphUtWOw.js';import {S as St}from'./chunk-BnAqiYqI.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-C_5eQn8U.js';import {g,F as F$1,P,U,N,p as pe$1,H as c,C as Ce$1,G as Gi,a as F$2,m as mT,b as U$1,e as xw,h as hr,i as pr,k as ws,n as GC,o as pl,q as Rg,J as Jw,s as rC,X as XE,u as bg,v as eC,y as oC,z as Ug,T as Tg,r as re,ca as _e$1,W as x,an as ue$1,ap as Cd,l as le$1,V,S as Sg,a9 as lC,aa as If,ac as gC,ab as wf,a8 as Yg,a5 as vl}from'./main-HLQ22ACS.js';import'./chunk-Jp1EkzoM.js';import'./chunk-CuEHbWdb.js';import'./chunk-DLde3g-3.js';import'./chunk-bBy0vM9Y.js';import {y as yt,w as wt}from'./chunk-65tVAuhG.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$2(this.threadState.threadList$,{initialValue:[]});selectedThread=F$2(this.threadState.selectedThread$,{initialValue:null});isThinking=F$2(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$2(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=mT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(Cd(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Sg(0,"mat-spinner",6);}function me(n,t){n&1&&(ws(0,"mat-icon"),GC(1,"add"),pl());}function ue(n,t){if(n&1&&(ws(0,"span",16),GC(1),pl()),n&2){let e=gC().$implicit,r=gC();XE(),Yg(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=lC();ws(0,"button",15),Rg("click",function(){let o=If(e).$implicit,i=gC();return wf(i.setFilter(o.key))}),ws(1,"mat-icon",10),GC(2),pl(),ws(3,"span"),GC(4),pl(),Jw(5,ue,2,1,"span",16),pl();}if(n&2){let e=t.$implicit,r=gC();Ug("active",r.activeFilter()===e.key),Tg("aria-selected",r.activeFilter()===e.key),XE(2),Yg(e.icon),XE(2),Yg(e.label),XE(),eC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(ws(0,"div",12),Sg(1,"mat-spinner",17),ws(2,"p"),GC(3,"Loading tasks\u2026"),pl()());}function fe(n,t){if(n&1){let e=lC();ws(0,"p"),GC(1,"No tasks yet. Start your first one!"),pl(),ws(2,"button",19),Rg("click",function(){If(e);let o=gC(2);return wf(o.createTask())}),ws(3,"mat-icon"),GC(4,"add"),pl(),GC(5," New Task "),pl();}}function he(n,t){n&1&&(ws(0,"p"),GC(1,"No tasks in this category."),pl());}function ke(n,t){if(n&1&&(ws(0,"div",13)(1,"mat-icon",18),GC(2,"rocket_launch"),pl(),Jw(3,fe,6,0)(4,he,2,0,"p"),pl()),n&2){let e=gC();XE(3),eC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=lC();ws(0,"app-task-card",25),Rg("stopRequested",function(o){If(e);let i=gC(3);return wf(i.onStopRequested(o))})("deleteRequested",function(o){If(e);let i=gC(3);return wf(i.onDeleteRequested(o))})("starToggled",function(o){If(e);let i=gC(3);return wf(i.onStarToggled(o))})("markDoneRequested",function(o){If(e);let i=gC(3);return wf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){If(e);let i=gC(3);return wf(i.onMarkActiveRequested(o))}),pl();}if(n&2){let e=t.$implicit;bg("task",e);}}function Ce(n,t){if(n&1&&(ws(0,"section",20)(1,"h2",21)(2,"mat-icon",22),GC(3),pl(),GC(4),ws(5,"span",23),GC(6),pl()(),ws(7,"div",14),rC(8,ve,1,1,"app-task-card",24,le),pl()()),n&2){let e=t.$implicit;XE(3),Yg(e.icon),XE(),vl(" ",e.label," "),XE(2),Yg(e.tasks.length),XE(2),oC(e.tasks);}}function be(n,t){if(n&1&&rC(0,Ce,10,3,"section",20,de),n&2){let e=gC();oC(e.taskGroups());}}function ye(n,t){if(n&1){let e=lC();ws(0,"app-task-card",25),Rg("stopRequested",function(o){If(e);let i=gC(2);return wf(i.onStopRequested(o))})("deleteRequested",function(o){If(e);let i=gC(2);return wf(i.onDeleteRequested(o))})("starToggled",function(o){If(e);let i=gC(2);return wf(i.onStarToggled(o))})("markDoneRequested",function(o){If(e);let i=gC(2);return wf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){If(e);let i=gC(2);return wf(i.onMarkActiveRequested(o))}),pl();}if(n&2){let e=t.$implicit;bg("task",e);}}function xe(n,t){if(n&1&&(ws(0,"div",14),rC(1,ye,1,1,"app-task-card",24,le),pl()),n&2){let e=gC();XE(),oC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(F$1);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Gi("all");starredOnly=Gi(false);isCreating=Gi(false);isLoadingList=F$2(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$2(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=mT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=mT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=mT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(ws(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),GC(6,"rocket_launch"),pl(),GC(7," Task Control "),pl(),ws(8,"button",5),Rg("click",function(){return r.createTask()}),Jw(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),GC(11," New Task "),pl()(),ws(12,"nav",7),rC(13,ge,6,6,"button",8,ce),ws(15,"button",9),Rg("click",function(){return r.toggleStarredFilter()}),ws(16,"mat-icon",10),GC(17,"star"),pl(),ws(18,"span"),GC(19,"Starred"),pl()()()(),ws(20,"main",11),Jw(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),pl()()()),e&2&&(XE(8),bg("disabled",r.isCreating()),XE(),eC(r.isCreating()?9:10),XE(4),oC(r.filters),XE(2),Ug("active",r.starredOnly()),Tg("aria-checked",r.starredOnly()),XE(6),eC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
|
|
1
|
+
import {A,k as kt,b as bt}from'./chunk-D1duEHtM.js';import {S as St}from'./chunk-CkzIzWyC.js';import {E as Et,y as yt$1,G as Ge}from'./chunk-B0ec6QE2.js';import {g,F as F$1,P,U,N,p as pe$1,H as c,C as Ce$1,G as Gi,a as F$2,m as mT,b as U$1,e as xw,h as hr,i as pr,k as ws,n as GC,o as pl,q as Rg,J as Jw,s as rC,X as XE,u as bg,v as eC,y as oC,z as Ug,T as Tg,r as re,ca as _e$1,W as x,an as ue$1,ap as Cd,l as le$1,V,S as Sg,a9 as lC,aa as If,ac as gC,ab as wf,a8 as Yg,a5 as vl}from'./main-DB5EJGYC.js';import'./chunk-C2xbdglQ.js';import'./chunk-PljuvLnA.js';import'./chunk-CGFcBWlS.js';import'./chunk-D-FNlEoa.js';import {y as yt,w as wt}from'./chunk-BLaIJYTj.js';var R=class n{threadState=g(U);codayService=g(Ge);threadList=F$2(this.threadState.threadList$,{initialValue:[]});selectedThread=F$2(this.threadState.selectedThread$,{initialValue:null});isThinking=F$2(this.codayService.isThinking$,{initialValue:false});inviteEvent=F$2(this.codayService.currentInviteEvent$.pipe(re(t=>t?.invite===_e$1?null:t)),{initialValue:null});tasks=mT(()=>{let t=this.threadList(),e=this.selectedThread(),r=this.isThinking(),o=this.inviteEvent();return t.filter(i=>!i.parentThreadId).map(i=>{let m=!!e&&i.id===e.id;return {id:i.id,name:i.name,summary:i.summary,modifiedDate:i.modifiedDate,starring:i.starring??[],users:i.users??[],status:this.deriveStatus(i,m,r,!!o),isActive:m,worktreeProject:i.worktreeProject}}).sort((i,m)=>{let q=kt[i.status]-kt[m.status];return q!==0?q:i.modifiedDate>m.modifiedDate?-1:1})});deriveStatus(t,e,r,o){let i=Date.now()-new Date(t.modifiedDate).getTime();return t.closedByUser?"done":t.pendingInvite?"waiting-you":e?r?"in-progress":"paused":i<bt?"in-progress":"paused"}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var F=class n{projectState=g(P);threadState=g(U);destroy$=new ue$1;eventSource=null;currentProject=null;constructor(){this.projectState.selectedProject$.pipe(Cd(this.destroy$)).subscribe(t=>{let e=t?.name??null;e!==this.currentProject&&(this.disconnect(),e&&this.connect(e));});}connect(t,e=5e3){this.currentProject=t;let r=`/api/projects/${encodeURIComponent(t)}/event-stream`;console.log(`[PROJECT_SSE] Connecting to ${r}`),this.eventSource=new EventSource(r),this.eventSource.onmessage=o=>{try{let i=JSON.parse(o.data),m=le$1(i);if(!m)return;m instanceof V&&(console.log("[PROJECT_SSE] ThreadUpdateEvent \u2014 refreshing thread list"),this.threadState.refreshThreadList());}catch(i){console.warn("[PROJECT_SSE] Failed to parse event:",i);}},this.eventSource.onerror=()=>{this.eventSource?.readyState===EventSource.CLOSED&&(console.warn(`[PROJECT_SSE] Connection closed for ${t}, reconnecting in ${e}ms`),this.eventSource=null,setTimeout(()=>{this.currentProject===t&&this.connect(t,Math.min(e*2,6e4));},e));};}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null,console.log(`[PROJECT_SSE] Disconnected from project ${this.currentProject}`)),this.currentProject=null;}ngOnDestroy(){this.disconnect(),this.destroy$.next(),this.destroy$.complete();}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=(n,t)=>t.key,de=(n,t)=>t.status,le=(n,t)=>t.id;function pe(n,t){n&1&&Sg(0,"mat-spinner",6);}function me(n,t){n&1&&(ws(0,"mat-icon"),GC(1,"add"),pl());}function ue(n,t){if(n&1&&(ws(0,"span",16),GC(1),pl()),n&2){let e=gC().$implicit,r=gC();XE(),Yg(r.filterCounts()[e.key]);}}function ge(n,t){if(n&1){let e=lC();ws(0,"button",15),Rg("click",function(){let o=If(e).$implicit,i=gC();return wf(i.setFilter(o.key))}),ws(1,"mat-icon",10),GC(2),pl(),ws(3,"span"),GC(4),pl(),Jw(5,ue,2,1,"span",16),pl();}if(n&2){let e=t.$implicit,r=gC();Ug("active",r.activeFilter()===e.key),Tg("aria-selected",r.activeFilter()===e.key),XE(2),Yg(e.icon),XE(2),Yg(e.label),XE(),eC(r.filterCounts()[e.key]>0?5:-1);}}function _e(n,t){n&1&&(ws(0,"div",12),Sg(1,"mat-spinner",17),ws(2,"p"),GC(3,"Loading tasks\u2026"),pl()());}function fe(n,t){if(n&1){let e=lC();ws(0,"p"),GC(1,"No tasks yet. Start your first one!"),pl(),ws(2,"button",19),Rg("click",function(){If(e);let o=gC(2);return wf(o.createTask())}),ws(3,"mat-icon"),GC(4,"add"),pl(),GC(5," New Task "),pl();}}function he(n,t){n&1&&(ws(0,"p"),GC(1,"No tasks in this category."),pl());}function ke(n,t){if(n&1&&(ws(0,"div",13)(1,"mat-icon",18),GC(2,"rocket_launch"),pl(),Jw(3,fe,6,0)(4,he,2,0,"p"),pl()),n&2){let e=gC();XE(3),eC(e.activeFilter()==="all"?3:4);}}function ve(n,t){if(n&1){let e=lC();ws(0,"app-task-card",25),Rg("stopRequested",function(o){If(e);let i=gC(3);return wf(i.onStopRequested(o))})("deleteRequested",function(o){If(e);let i=gC(3);return wf(i.onDeleteRequested(o))})("starToggled",function(o){If(e);let i=gC(3);return wf(i.onStarToggled(o))})("markDoneRequested",function(o){If(e);let i=gC(3);return wf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){If(e);let i=gC(3);return wf(i.onMarkActiveRequested(o))}),pl();}if(n&2){let e=t.$implicit;bg("task",e);}}function Ce(n,t){if(n&1&&(ws(0,"section",20)(1,"h2",21)(2,"mat-icon",22),GC(3),pl(),GC(4),ws(5,"span",23),GC(6),pl()(),ws(7,"div",14),rC(8,ve,1,1,"app-task-card",24,le),pl()()),n&2){let e=t.$implicit;XE(3),Yg(e.icon),XE(),vl(" ",e.label," "),XE(2),Yg(e.tasks.length),XE(2),oC(e.tasks);}}function be(n,t){if(n&1&&rC(0,Ce,10,3,"section",20,de),n&2){let e=gC();oC(e.taskGroups());}}function ye(n,t){if(n&1){let e=lC();ws(0,"app-task-card",25),Rg("stopRequested",function(o){If(e);let i=gC(2);return wf(i.onStopRequested(o))})("deleteRequested",function(o){If(e);let i=gC(2);return wf(i.onDeleteRequested(o))})("starToggled",function(o){If(e);let i=gC(2);return wf(i.onStarToggled(o))})("markDoneRequested",function(o){If(e);let i=gC(2);return wf(i.onMarkDoneRequested(o))})("markActiveRequested",function(o){If(e);let i=gC(2);return wf(i.onMarkActiveRequested(o))}),pl();}if(n&2){let e=t.$implicit;bg("task",e);}}function xe(n,t){if(n&1&&(ws(0,"div",14),rC(1,ye,1,1,"app-task-card",24,le),pl()),n&2){let e=gC();XE(),oC(e.filteredTasks());}}var Te=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],se=class n{router=g(F$1);projectState=g(P);threadState=g(U);threadApi=g(N);taskStatus=g(R);userService=g(pe$1);projectApi=g(c);destroyRef=g(Ce$1);_projectEventStream=g(F);filters=Te;activeFilter=Gi("all");starredOnly=Gi(false);isCreating=Gi(false);isLoadingList=F$2(this.threadState.isLoadingThreadList$,{initialValue:false});username=F$2(this.userService.username$,{initialValue:null});allTasks=this.taskStatus.tasks;filteredTasks=mT(()=>{let t=this.activeFilter(),e=this.username(),r=this.allTasks();return this.starredOnly()&&e&&(r=r.filter(o=>o.starring.includes(e))),t==="all"?r:r.filter(o=>o.status===t)});filterCounts=mT(()=>{let t=this.username(),e=this.allTasks();return this.starredOnly()&&t&&(e=e.filter(r=>r.starring.includes(t))),{all:e.length,"waiting-you":e.filter(r=>r.status==="waiting-you").length,"in-progress":e.filter(r=>r.status==="in-progress").length,paused:e.filter(r=>r.status==="paused").length,done:e.filter(r=>r.status==="done").length}});taskGroups=mT(()=>{let t=this.username(),e=this.allTasks();this.starredOnly()&&t&&(e=e.filter(o=>o.starring.includes(t)));let r=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt",tasks:[]},{status:"in-progress",label:"In progress",icon:"pending",tasks:[]},{status:"done",label:"Done",icon:"check_circle",tasks:[]},{status:"paused",label:"Paused",icon:"pause_circle",tasks:[]},{status:"error",label:"Error",icon:"error",tasks:[]}];for(let o of e){let i=r.find(m=>m.status===o.status);i&&i.tasks.push(o);}return r.filter(o=>o.tasks.length>0)});ngOnInit(){this.userService.fetchCurrentUser().pipe(U$1(this.destroyRef)).subscribe({error:t=>console.warn("[TASK-CONTROL] Could not fetch user:",t)});}setFilter(t){this.activeFilter.set(t);}toggleStarredFilter(){this.starredOnly.update(t=>!t);}createTask(){let t=this.projectState.getSelectedProjectId();!t||this.isCreating()||(this.isCreating.set(true),this.threadApi.createThread().pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.isCreating.set(false),this.router.navigate(["project",t,"thread",e.thread.id]);},error:e=>{console.error("[TASK-CONTROL] Failed to create thread:",e),this.isCreating.set(false);}}));}onStopRequested(t){this.threadApi.stopThread(t).pipe(U$1(this.destroyRef)).subscribe({error:e=>console.error("[TASK-CONTROL] Failed to stop thread:",e)});}onDeleteRequested(t){this.threadApi.deleteThread(t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:e=>console.error("[TASK-CONTROL] Failed to delete thread:",e)});}onStarToggled(t){let e=this.username();if(!e)return;let r=this.allTasks().find(m=>m.id===t);if(!r)return;let o=r.starring.includes(e),i=o?this.threadApi.unstarThread(t):this.threadApi.starThread(t);this.threadState.updateStarLocal(t,!o,e),i.pipe(U$1(this.destroyRef)).subscribe({error:m=>{console.error("[TASK-CONTROL] Failed to toggle star:",m),this.threadState.refreshThreadList();}});}onMarkDoneRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadDone(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as done:",r)});}onMarkActiveRequested(t){let e=this.projectState.getSelectedProjectId();e&&this.projectApi.markThreadActive(e,t).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.threadState.refreshThreadList(),error:r=>console.error("[TASK-CONTROL] Failed to mark task as active:",r)});}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["app-task-control"]],decls:25,vars:6,consts:[[1,"task-control"],[1,"tc-header"],[1,"tc-title-row"],[1,"tc-title"],[1,"title-icon"],["mat-flat-button","","aria-label","Start a new task",1,"new-task-btn",3,"click","disabled"],["diameter","16"],["role","tablist","aria-label","Filter tasks",1,"tc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"tc-grid-wrapper"],[1,"tc-loading"],[1,"tc-empty"],[1,"tc-grid"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","40"],[1,"empty-icon"],["mat-flat-button","",1,"new-task-btn",3,"click"],[1,"tc-group"],[1,"tc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task"],[3,"stopRequested","deleteRequested","starToggled","markDoneRequested","markActiveRequested","task"]],template:function(e,r){e&1&&(ws(0,"app-sidenav")(1,"div",0)(2,"header",1)(3,"div",2)(4,"h1",3)(5,"mat-icon",4),GC(6,"rocket_launch"),pl(),GC(7," Task Control "),pl(),ws(8,"button",5),Rg("click",function(){return r.createTask()}),Jw(9,pe,1,0,"mat-spinner",6)(10,me,2,0,"mat-icon"),GC(11," New Task "),pl()(),ws(12,"nav",7),rC(13,ge,6,6,"button",8,ce),ws(15,"button",9),Rg("click",function(){return r.toggleStarredFilter()}),ws(16,"mat-icon",10),GC(17,"star"),pl(),ws(18,"span"),GC(19,"Starred"),pl()()()(),ws(20,"main",11),Jw(21,_e,4,0,"div",12)(22,ke,5,1,"div",13)(23,be,2,0)(24,xe,3,0,"div",14),pl()()()),e&2&&(XE(8),bg("disabled",r.isCreating()),XE(),eC(r.isCreating()?9:10),XE(4),oC(r.filters),XE(2),Ug("active",r.starredOnly()),Tg("aria-checked",r.starredOnly()),XE(6),eC(r.isLoadingList()?21:r.filteredTasks().length===0?22:r.activeFilter()==="all"?23:24));},dependencies:[A,St,yt,wt,hr,pr,Et,yt$1],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden}.task-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;padding:1.5rem;gap:1.25rem;box-sizing:border-box}.tc-header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;flex-shrink:0}.tc-title-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem}.tc-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text)}.tc-title[_ngcontent-%COMP%] .title-icon[_ngcontent-%COMP%]{font-size:1.5rem;width:1.5rem;height:1.5rem;color:var(--color-primary)}.new-task-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;padding:0 1rem;height:36px;flex-shrink:0}.new-task-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.new-task-btn[_ngcontent-%COMP%] mat-spinner[_ngcontent-%COMP%]{display:inline-block}.tc-filters[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.375rem .875rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff4d;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.tc-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.tc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.tc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.85rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.tc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.tc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.75rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.tc-grid-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}.tc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem;padding-bottom:1rem}@media(max-width:600px){.tc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.tc-loading[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;height:100%;min-height:240px;color:var(--color-text-secondary);text-align:center}.tc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .tc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.95rem}.empty-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;opacity:.3}"]})};export{se as TaskControlComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,F,P,e as xw,h as hr,i as pr,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,u as bg,v as eC,a5 as vl,al as vt,am as qm,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,ak as em,a6 as UI,B as Pg,E as EC,I as IC,ac as gC,a8 as Yg}from'./main-
|
|
1
|
+
import {g,F,P,e as xw,h as hr,i as pr,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,u as bg,v as eC,a5 as vl,al as vt,am as qm,a9 as lC,ai as tm,aa as If,aj as KC,ab as wf,a3 as VI,ak as em,a6 as UI,B as Pg,E as EC,I as IC,ac as gC,a8 as Yg}from'./main-DB5EJGYC.js';import {y as yt,w as wt,t as ti,Y as Ye,Z as Zn,c as cn}from'./chunk-BLaIJYTj.js';var J=["inputElement"];function K(o,r){if(o&1&&(ws(0,"span",3),GC(1),pl()),o&2){let t=gC();XE(),Yg(t.label);}}function U(o,r){if(o&1&&(ws(0,"small",5),GC(1),pl()),o&2){let t=gC();XE(),Yg(t.hint);}}var h=class o{label="";placeholder="";hint="";isDisabled=false;value="";autoFocus=true;valueChange=new vt;enterPressed=new vt;inputElement;inputValue="";ngAfterViewInit(){this.inputValue=this.value,this.autoFocus&&setTimeout(()=>this.inputElement?.nativeElement.focus(),100);}onValueChange(r){this.valueChange.emit(r);}onEnter(){this.inputValue.trim()&&this.enterPressed.emit(this.inputValue.trim());}focus(){this.inputElement?.nativeElement.focus();}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-text-input"]],viewQuery:function(t,e){if(t&1&&Pg(J,5),t&2){let p;EC(p=IC())&&(e.inputElement=p.first);}},inputs:{label:"label",placeholder:"placeholder",hint:"hint",isDisabled:"isDisabled",value:"value",autoFocus:"autoFocus"},outputs:{valueChange:"valueChange",enterPressed:"enterPressed"},decls:6,vars:5,consts:[["inputElement",""],[1,"text-input-container"],[1,"text-input-wrapper"],[1,"text-input-label"],["type","text",1,"text-input-field",3,"ngModelChange","keydown.enter","ngModel","placeholder","disabled"],[1,"text-input-hint"]],template:function(t,e){if(t&1){let p=lC();ws(0,"div",1)(1,"label",2),Jw(2,K,2,1,"span",3),ws(3,"input",4,0),tm("ngModelChange",function(m){return If(p),KC(e.inputValue,m)||(e.inputValue=m),wf(m)}),Rg("ngModelChange",function(m){return e.onValueChange(m)})("keydown.enter",function(){return e.onEnter()}),pl(),VI(),pl(),Jw(5,U,2,1,"small",5),pl();}t&2&&(XE(2),eC(e.label?2:-1),XE(),em("ngModel",e.inputValue),bg("placeholder",e.placeholder)("disabled",e.isDisabled),UI(),XE(2),eC(e.hint?5:-1));},dependencies:[ti,Ye,Zn,cn,qm],styles:[".text-input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%}.text-input-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;width:100%;cursor:text}.text-input-label[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);margin:0}.text-input-field[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;font-size:1rem;color:var(--color-text);background:var(--color-bg);border:1px solid var(--color-border);border-radius:8px;outline:none;transition:all .2s ease}.text-input-field[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.text-input-field[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.1)}.text-input-field[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed;background:var(--color-surface)}.text-input-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);margin:0;font-style:italic}@media(max-width:768px){.text-input-field[_ngcontent-%COMP%]{padding:.65rem .85rem;font-size:.95rem}.text-input-label[_ngcontent-%COMP%]{font-size:.9rem}.text-input-hint[_ngcontent-%COMP%]{font-size:.8rem}}"],changeDetection:1})};function X(o,r){if(o&1&&(ws(0,"div",8),GC(1),pl()),o&2){let t=gC();XE(),Yg(t.errorMessage);}}var L=class o{router=g(F);projectStateService=g(P);projectName="";projectPath="";isCreating=false;errorMessage=null;isValid(){return this.projectName.trim()!==""&&this.projectPath.trim()!==""}onCreate(){if(!this.isValid()){this.errorMessage="Both name and path are required";return}this.isCreating=true,this.errorMessage=null,this.projectStateService.createProject(this.projectName.trim(),this.projectPath.trim()).subscribe({next:()=>{let r=this.projectName.trim();this.isCreating=false,this.projectStateService.selectProject(r),this.router.navigate(["project",r]);},error:r=>{this.errorMessage=r.error?.error??"Failed to create project",this.isCreating=false;}});}onCancel(){this.router.navigate(["/"]);}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=xw({type:o,selectors:[["app-project-new"]],decls:19,vars:9,consts:[[1,"project-new-page"],[1,"project-new-card"],["mat-button","",1,"project-new__back",3,"click"],[1,"project-new__title"],[1,"project-new__subtitle"],[1,"project-new__form"],["label","Project name","placeholder","my-project",3,"valueChange","value","isDisabled","autoFocus"],["label","Project path","placeholder","/path/to/project","hint","Absolute path to the project directory",3,"valueChange","enterPressed","value","isDisabled"],[1,"project-new__error"],[1,"project-new__actions"],["mat-button","",3,"click","disabled"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,e){t&1&&(ws(0,"div",0)(1,"div",1)(2,"button",2),Rg("click",function(){return e.onCancel()}),ws(3,"mat-icon"),GC(4,"arrow_back"),pl(),GC(5," Back to projects "),pl(),ws(6,"h1",3),GC(7,"New project"),pl(),ws(8,"p",4),GC(9,"Point Coday to an existing directory on your machine."),pl(),ws(10,"div",5)(11,"app-text-input",6),Rg("valueChange",function(d){return e.projectName=d}),pl(),ws(12,"app-text-input",7),Rg("valueChange",function(d){return e.projectPath=d})("enterPressed",function(){return e.onCreate()}),pl(),Jw(13,X,2,1,"div",8),pl(),ws(14,"div",9)(15,"button",10),Rg("click",function(){return e.onCancel()}),GC(16,"Cancel"),pl(),ws(17,"button",11),Rg("click",function(){return e.onCreate()}),GC(18),pl()()()()),t&2&&(XE(11),bg("value",e.projectName)("isDisabled",e.isCreating)("autoFocus",true),XE(),bg("value",e.projectPath)("isDisabled",e.isCreating),XE(),eC(e.errorMessage?13:-1),XE(2),bg("disabled",e.isCreating),XE(2),bg("disabled",!e.isValid()||e.isCreating),XE(),vl(" ",e.isCreating?"Creating\u2026":"Create project"," "));},dependencies:[hr,pr,yt,wt,h],styles:[".project-new-page[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:center;min-height:100vh;width:100%;background:var(--color-bg);padding:2rem 1.5rem;box-sizing:border-box}.project-new-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:560px;padding:2rem;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:16px;box-shadow:var(--glass-shadow, 0 8px 32px rgba(31, 38, 135, .15));margin-top:2rem}.project-new__back[_ngcontent-%COMP%]{align-self:flex-start;margin-left:-.5rem;color:var(--color-text-secondary, #6e6e73)}.project-new__title[_ngcontent-%COMP%]{margin:0;font-size:1.625rem;font-weight:700;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.project-new__subtitle[_ngcontent-%COMP%]{margin:-.75rem 0 0;font-size:.9375rem;color:var(--color-text-secondary, #6e6e73)}.project-new__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.project-new__error[_ngcontent-%COMP%]{padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}.project-new__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;padding-top:.25rem}"],changeDetection:1})};export{L as ProjectNewComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CccoF4zk.js';import {s,d}from'./chunk-B_yM2E8f.js';import {g,ao as W$1,F,C as Ce,G as Gi,m as mT,b as U,M as By,a7 as ya,Q as br,e as xw,$ as $t,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,u as bg,a9 as lC,a8 as Yg,z as Ug,a5 as vl,T as Tg,s as rC,y as oC,S as Sg,bf as aT,bg as uT,a4 as nC,aa as If,ab as wf,bj as aE}from'./main-HLQ22ACS.js';import'./chunk-QpH9EEhD.js';import'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.js';import'./chunk-65tVAuhG.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(ws(0,"a",5),GC(1,"Edit skill \u2192"),pl()),e&2){let i=gC();bg("routerLink",i.editRoute());}}function q(e,n){e&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function Q(e,n){e&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function W(e,n){e&1&&(ws(0,"p",8),GC(1,"Failed to load skill."),pl());}function X(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Created by"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.createdBy);}}function Y(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Last updated"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.updatedOn);}}function Z(e,n){if(e&1&&(Jw(0,X,4,1),Jw(1,Y,4,1)),e&2){let i=gC();eC(i.createdBy?0:-1),XE(),eC(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(ws(0,"span",17),GC(1),pl()),e&2){let i=gC(2);XE(),vl("(",i.consumers().length,")");}}function te(e,n){e&1&&(ws(0,"p",18),GC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function ne(e,n){e&1&&(ws(0,"p",18),GC(1,"Loading\u2026"),pl());}function ie(e,n){e&1&&(ws(0,"p",8),GC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function oe(e,n){e&1&&(ws(0,"p",18),GC(1,"No agent references this skill."),pl());}function le(e,n){e&1&&(ws(0,"span",16),GC(1,"platform agent"),pl());}function ae(e,n){e&1&&(ws(0,"span",16),GC(1,"via *"),pl());}function re(e,n){if(e&1&&(ws(0,"li",24)(1,"span",26),GC(2),pl(),Jw(3,le,2,0,"span",16),Jw(4,ae,2,0,"span",16),pl()),e&2){let i=n.$implicit;XE(2),Yg(i.name),XE(),eC(i.platform?3:-1),XE(),eC(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(ws(0,"ul",23),rC(1,re,5,3,"li",24,J),pl(),ws(3,"p",25),GC(4," An agent listed "),ws(5,"code"),GC(6,"via *"),pl(),GC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let i=gC(2);XE(),oC(i.consumers());}}function ce(e,n){if(e&1&&(Sg(0,"div",21),aT(1,"agentosMarkdown")),e&2){let i=gC();bg("innerHTML",uT(1,1,i.body),aE);}}function de(e,n){e&1&&(ws(0,"p",18),GC(1,"No resources bundled with this skill."),pl());}function pe(e,n){if(e&1&&(ws(0,"pre",30),GC(1),pl()),e&2){let i=gC().$implicit,a=gC(3);XE(),Yg(a.resourceContent(i));}}function me(e,n){if(e&1){let i=lC();ws(0,"li",27)(1,"button",28),Rg("click",function(){let s=If(i).$implicit,g=gC(3);return wf(g.toggleResource(s))}),ws(2,"span",29),GC(3),pl(),ws(4,"span",20),GC(5,"\u25BC"),pl()(),Jw(6,pe,2,1,"pre",30),pl();}if(e&2){let i=n.$implicit,a=gC(3);XE(),Tg("aria-expanded",a.isResourceExpanded(i)),XE(2),Yg(i),XE(),Ug("skill-inspect__chevron--open",a.isResourceExpanded(i)),XE(2),eC(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(ws(0,"ul",22),rC(1,me,7,5,"li",27,nC),pl()),e&2){let i=gC(2);XE(),oC(i.resourcePaths());}}function ge(e,n){if(e&1){let i=lC();ws(0,"div",9)(1,"section",10)(2,"h2",11),GC(3,"General"),pl(),ws(4,"dl",12)(5,"dt",13),GC(6,"Name"),pl(),ws(7,"dd",14),GC(8),pl(),ws(9,"dt",13),GC(10,"Description"),pl(),ws(11,"dd",15),GC(12),pl(),ws(13,"dt",13),GC(14,"Scope"),pl(),ws(15,"dd",15),GC(16),pl(),ws(17,"dt",13),GC(18,"Storage"),pl(),ws(19,"dd",15)(20,"span",16),GC(21),pl()(),Jw(22,Z,2,2),pl()(),ws(23,"section",10)(24,"h2",11),GC(25," Used by "),Jw(26,ee,2,1,"span",17),pl(),Jw(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),pl(),ws(32,"section",10)(33,"button",19),Rg("click",function(){If(i);let s=gC();return wf(s.toggleBody())}),ws(34,"h2",11),GC(35,"Body"),pl(),ws(36,"span",20),GC(37,"\u25BC"),pl()(),Jw(38,ce,2,3,"div",21),pl(),ws(39,"section",10)(40,"h2",11),GC(41," Resources "),ws(42,"span",17),GC(43),pl()(),Jw(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),pl()();}if(e&2){let i=n,a=gC();XE(8),Yg(i.name),XE(4),Yg(i.description),XE(4),Yg(i.namespaceId?"Namespace":"Platform"),XE(4),Ug("skill-inspect__badge--readonly",a.isFilesystemBacked()),XE(),vl(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),XE(),eC(a.isFilesystemBacked()?-1:22),XE(4),eC(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),XE(),eC(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),XE(6),Tg("aria-expanded",!a.bodyCollapsed()),XE(3),Ug("skill-inspect__chevron--open",!a.bodyCollapsed()),XE(2),eC(a.bodyCollapsed()?-1:38),XE(5),vl("(",a.resourcePaths().length,")"),XE(),eC(a.resourcePaths().length===0?44:45);}}var G=class e{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Gi(true);hasError=Gi(false);skill=Gi(null);bodyCollapsed=Gi(false);expandedResources=Gi(new Set);resourcePaths=mT(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=mT(()=>this.skill()?.readOnly===true);consumers=Gi([]);consumersUnavailable=Gi(false);consumersLoading=Gi(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Skills "),pl(),ws(6,"h1",4),GC(7,"Skill"),pl(),Jw(8,K,2,1,"a",5),Jw(9,q,2,0,"span",6),pl(),Jw(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),pl()),i&2){let s;XE(8),eC(a.skill()&&!a.isFilesystemBacked()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[$t,d],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
|
|
1
|
+
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-Dp3xB5xu.js';import {s,d}from'./chunk-CVM23KJ3.js';import {g,ao as W$1,F,C as Ce,G as Gi,m as mT,b as U,M as By,a7 as ya,Q as br,e as xw,$ as $t,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,v as eC,ac as gC,u as bg,a9 as lC,a8 as Yg,z as Ug,a5 as vl,T as Tg,s as rC,y as oC,S as Sg,bf as aT,bg as uT,a4 as nC,aa as If,ab as wf,bj as aE}from'./main-DB5EJGYC.js';import'./chunk-CKhMv1Ug.js';import'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';import'./chunk-BLaIJYTj.js';var J=(e,n)=>n.name+n.grant;function K(e,n){if(e&1&&(ws(0,"a",5),GC(1,"Edit skill \u2192"),pl()),e&2){let i=gC();bg("routerLink",i.editRoute());}}function q(e,n){e&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function Q(e,n){e&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function W(e,n){e&1&&(ws(0,"p",8),GC(1,"Failed to load skill."),pl());}function X(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Created by"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.createdBy);}}function Y(e,n){if(e&1&&(ws(0,"dt",13),GC(1,"Last updated"),pl(),ws(2,"dd",15),GC(3),pl()),e&2){let i=gC(2);XE(3),Yg(i.updatedOn);}}function Z(e,n){if(e&1&&(Jw(0,X,4,1),Jw(1,Y,4,1)),e&2){let i=gC();eC(i.createdBy?0:-1),XE(),eC(i.updatedOn?1:-1);}}function ee(e,n){if(e&1&&(ws(0,"span",17),GC(1),pl()),e&2){let i=gC(2);XE(),vl("(",i.consumers().length,")");}}function te(e,n){e&1&&(ws(0,"p",18),GC(1," A platform skill is offered to every namespace. Open it from a namespace to see which of its agents use it. "),pl());}function ne(e,n){e&1&&(ws(0,"p",18),GC(1,"Loading\u2026"),pl());}function ie(e,n){e&1&&(ws(0,"p",8),GC(1," The agent configs could not be read, so it is unknown whether any agent uses this skill. "),pl());}function oe(e,n){e&1&&(ws(0,"p",18),GC(1,"No agent references this skill."),pl());}function le(e,n){e&1&&(ws(0,"span",16),GC(1,"platform agent"),pl());}function ae(e,n){e&1&&(ws(0,"span",16),GC(1,"via *"),pl());}function re(e,n){if(e&1&&(ws(0,"li",24)(1,"span",26),GC(2),pl(),Jw(3,le,2,0,"span",16),Jw(4,ae,2,0,"span",16),pl()),e&2){let i=n.$implicit;XE(2),Yg(i.name),XE(),eC(i.platform?3:-1),XE(),eC(i.grant==="all"?4:-1);}}function se(e,n){if(e&1&&(ws(0,"ul",23),rC(1,re,5,3,"li",24,J),pl(),ws(3,"p",25),GC(4," An agent listed "),ws(5,"code"),GC(6,"via *"),pl(),GC(7," takes the whole catalogue and keeps working without this skill. The others name it, so deleting the skill leaves their selector resolving to nothing. "),pl()),e&2){let i=gC(2);XE(),oC(i.consumers());}}function ce(e,n){if(e&1&&(Sg(0,"div",21),aT(1,"agentosMarkdown")),e&2){let i=gC();bg("innerHTML",uT(1,1,i.body),aE);}}function de(e,n){e&1&&(ws(0,"p",18),GC(1,"No resources bundled with this skill."),pl());}function pe(e,n){if(e&1&&(ws(0,"pre",30),GC(1),pl()),e&2){let i=gC().$implicit,a=gC(3);XE(),Yg(a.resourceContent(i));}}function me(e,n){if(e&1){let i=lC();ws(0,"li",27)(1,"button",28),Rg("click",function(){let s=If(i).$implicit,g=gC(3);return wf(g.toggleResource(s))}),ws(2,"span",29),GC(3),pl(),ws(4,"span",20),GC(5,"\u25BC"),pl()(),Jw(6,pe,2,1,"pre",30),pl();}if(e&2){let i=n.$implicit,a=gC(3);XE(),Tg("aria-expanded",a.isResourceExpanded(i)),XE(2),Yg(i),XE(),Ug("skill-inspect__chevron--open",a.isResourceExpanded(i)),XE(2),eC(a.isResourceExpanded(i)?6:-1);}}function _e(e,n){if(e&1&&(ws(0,"ul",22),rC(1,me,7,5,"li",27,nC),pl()),e&2){let i=gC(2);XE(),oC(i.resourcePaths());}}function ge(e,n){if(e&1){let i=lC();ws(0,"div",9)(1,"section",10)(2,"h2",11),GC(3,"General"),pl(),ws(4,"dl",12)(5,"dt",13),GC(6,"Name"),pl(),ws(7,"dd",14),GC(8),pl(),ws(9,"dt",13),GC(10,"Description"),pl(),ws(11,"dd",15),GC(12),pl(),ws(13,"dt",13),GC(14,"Scope"),pl(),ws(15,"dd",15),GC(16),pl(),ws(17,"dt",13),GC(18,"Storage"),pl(),ws(19,"dd",15)(20,"span",16),GC(21),pl()(),Jw(22,Z,2,2),pl()(),ws(23,"section",10)(24,"h2",11),GC(25," Used by "),Jw(26,ee,2,1,"span",17),pl(),Jw(27,te,2,0,"p",18)(28,ne,2,0,"p",18)(29,ie,2,0,"p",8)(30,oe,2,0,"p",18)(31,se,8,0),pl(),ws(32,"section",10)(33,"button",19),Rg("click",function(){If(i);let s=gC();return wf(s.toggleBody())}),ws(34,"h2",11),GC(35,"Body"),pl(),ws(36,"span",20),GC(37,"\u25BC"),pl()(),Jw(38,ce,2,3,"div",21),pl(),ws(39,"section",10)(40,"h2",11),GC(41," Resources "),ws(42,"span",17),GC(43),pl()(),Jw(44,de,2,0,"p",18)(45,_e,3,0,"ul",22),pl()();}if(e&2){let i=n,a=gC();XE(8),Yg(i.name),XE(4),Yg(i.description),XE(4),Yg(i.namespaceId?"Namespace":"Platform"),XE(4),Ug("skill-inspect__badge--readonly",a.isFilesystemBacked()),XE(),vl(" ",a.isFilesystemBacked()?"SKILL.md file (read-only)":"Database"," "),XE(),eC(a.isFilesystemBacked()?-1:22),XE(4),eC(!a.isPlatformMode&&!a.consumersLoading()&&!a.consumersUnavailable()?26:-1),XE(),eC(a.isPlatformMode?27:a.consumersLoading()?28:a.consumersUnavailable()?29:a.consumers().length===0?30:31),XE(6),Tg("aria-expanded",!a.bodyCollapsed()),XE(3),Ug("skill-inspect__chevron--open",!a.bodyCollapsed()),XE(2),eC(a.bodyCollapsed()?-1:38),XE(5),vl("(",a.resourcePaths().length,")"),XE(),eC(a.resourcePaths().length===0?44:45);}}var G=class e{route=g(W$1);router=g(F);destroyRef=g(Ce);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;skillId=this.route.snapshot.params.skillId;isPlatformMode=!this.namespaceId;isLoading=Gi(true);hasError=Gi(false);skill=Gi(null);bodyCollapsed=Gi(false);expandedResources=Gi(new Set);resourcePaths=mT(()=>Object.keys(this.skill()?.resources??{}).sort());isFilesystemBacked=mT(()=>this.skill()?.readOnly===true);consumers=Gi([]);consumersUnavailable=Gi(false);consumersLoading=Gi(false);ngOnInit(){this.skillState.getById(this.skillId).pipe(U(this.destroyRef)).subscribe({next:n=>{this.skill.set(n),this.isLoading.set(false),this.loadConsumers(n.name);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}loadConsumers(n){this.namespaceId&&(this.consumersLoading.set(true),By({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ya(()=>br([])))}).pipe(U(this.destroyRef)).subscribe({next:({namespace:i,platform:a})=>{let s=[...this.toConsumers(i,n,false),...this.toConsumers(a,n,true)];this.consumers.set([...s.filter(g=>g.grant==="named"),...s.filter(g=>g.grant==="all")]),this.consumersLoading.set(false);},error:()=>{this.consumersUnavailable.set(true),this.consumersLoading.set(false);}}));}toConsumers(n,i,a$1){return n.map(s=>({config:s,grant:a(s.skillSelectors,i)})).filter(s=>s.grant!=="none").map(({config:s,grant:g})=>({name:s.name,grant:g,platform:a$1}))}toggleBody(){this.bodyCollapsed.update(n=>!n);}toggleResource(n){this.expandedResources.update(i=>{let a=new Set(i);return a.has(n)?a.delete(n):a.add(n),a});}isResourceExpanded(n){return this.expandedResources().has(n)}resourceContent(n){return this.skill()?.resources?.[n]??""}editRoute(){return this.isPlatformMode?["/agentos","admin","skills",this.skillId,"edit"]:["/agentos",this.namespaceId,"skills",this.skillId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(i){return new(i||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-skill-inspect"]],decls:13,vars:3,consts:[[1,"skill-inspect"],[1,"skill-inspect__header"],["type","button","title","Back to skills",1,"skill-inspect__back",3,"click"],[1,"skill-inspect__back-icon"],[1,"skill-inspect__title"],[1,"skill-inspect__sibling-link",3,"routerLink"],[1,"skill-inspect__platform-badge"],[1,"skill-inspect__loading"],["role","alert",1,"skill-inspect__error"],[1,"skill-inspect__content"],[1,"skill-inspect__section"],[1,"skill-inspect__section-title"],[1,"skill-inspect__dl"],[1,"skill-inspect__dt"],[1,"skill-inspect__dd","skill-inspect__dd--mono"],[1,"skill-inspect__dd"],[1,"skill-inspect__badge"],[1,"skill-inspect__count"],[1,"skill-inspect__empty"],["type","button",1,"skill-inspect__collapsible",3,"click"],[1,"skill-inspect__chevron"],[1,"skill-inspect__body",3,"innerHTML"],[1,"skill-inspect__resources"],[1,"skill-inspect__consumers"],[1,"skill-inspect__consumer"],[1,"skill-inspect__consumers-hint"],[1,"skill-inspect__consumer-name"],[1,"skill-inspect__resource"],["type","button",1,"skill-inspect__resource-header",3,"click"],[1,"skill-inspect__resource-path"],[1,"skill-inspect__resource-content"]],template:function(i,a){if(i&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.back()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Skills "),pl(),ws(6,"h1",4),GC(7,"Skill"),pl(),Jw(8,K,2,1,"a",5),Jw(9,q,2,0,"span",6),pl(),Jw(10,Q,2,0,"p",7)(11,W,2,0,"p",8)(12,ge,46,15,"div",9),pl()),i&2){let s;XE(8),eC(a.skill()&&!a.isFilesystemBacked()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:a.hasError()?11:(s=a.skill())?12:-1,s);}},dependencies:[$t,d],styles:[".skill-inspect[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:720px;margin:0 auto;padding:2rem 1rem}.skill-inspect__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.skill-inspect__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.skill-inspect__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.skill-inspect__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.skill-inspect__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-primary, #007aff);text-decoration:none}.skill-inspect__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.skill-inspect__platform-badge[_ngcontent-%COMP%]{align-self:flex-start;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.15rem .5rem;border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73)}.skill-inspect__loading[_ngcontent-%COMP%], .skill-inspect__error[_ngcontent-%COMP%], .skill-inspect__empty[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:var(--color-text-secondary, #6e6e73)}.skill-inspect__error[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.skill-inspect__content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.skill-inspect__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px}.skill-inspect__section-title[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;font-weight:600;color:var(--color-text, #1d1d1f)}.skill-inspect__count[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;margin-left:.25rem}.skill-inspect__dl[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.5rem 1.25rem;margin:0}.skill-inspect__dt[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);align-self:center}.skill-inspect__dd[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);align-self:center;word-break:break-word}.skill-inspect__dd--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.875rem}.skill-inspect__consumers[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.375rem}.skill-inspect__consumer[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.skill-inspect__consumer-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500}.skill-inspect__consumers-hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.skill-inspect__badge[_ngcontent-%COMP%]{display:inline-block;padding:.2em .6em;border-radius:4px;font-size:.75rem;font-weight:500;background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text-secondary, #6e6e73)}.skill-inspect__badge--readonly[_ngcontent-%COMP%]{background:var(--color-surface-muted, rgba(0, 0, 0, .06));color:var(--color-text, #1d1d1f);border:1px solid var(--color-divider, rgba(0, 0, 0, .12))}.skill-inspect__collapsible[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%;background:none;border:none;padding:0;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__chevron[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary, #6e6e73);transition:transform .15s ease;flex-shrink:0}.skill-inspect__chevron--open[_ngcontent-%COMP%]{transform:rotate(180deg)}.skill-inspect__body[_ngcontent-%COMP%]{font-size:.9375rem;line-height:1.6;color:var(--color-text, #1d1d1f);max-height:520px;overflow-y:auto;padding:.875rem 1rem;border-radius:6px;background:var(--color-surface-muted, rgba(0, 0, 0, .04));word-break:break-word}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.skill-inspect__body[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%], .skill-inspect__body[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem}.skill-inspect__body[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{padding:.75rem;border-radius:6px;background:var(--color-code-bg, rgba(0, 0, 0, .06));overflow-x:auto}.skill-inspect__resources[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.skill-inspect__resource[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .08));border-radius:6px;overflow:hidden}.skill-inspect__resource-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.75rem;width:100%;background:none;border:none;padding:.625rem .875rem;cursor:pointer;font-family:inherit;text-align:left}.skill-inspect__resource-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.skill-inspect__resource-path[_ngcontent-%COMP%]{font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);word-break:break-all}.skill-inspect__resource-content[_ngcontent-%COMP%]{margin:0;padding:.875rem;font-family:var(--font-code, monospace);font-size:.8125rem;color:var(--color-text, #1d1d1f);background:var(--color-surface-muted, rgba(0, 0, 0, .04));white-space:pre-wrap;word-break:break-word;max-height:320px;overflow-y:auto}"]})};export{G as SkillInspectComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bl as Mt,W as x}from'./main-
|
|
1
|
+
import {g,bl as Mt,W as x}from'./main-DB5EJGYC.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-DN2TqPUr.js';import {v}from'./chunk-Dls1Urvo.js';import {g,ao as W,F as F$1,C as Ce,G as Gi,a as F$2,df as Te,cd as Hf,b as U,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,s as rC,a4 as nC,a3 as VI,S as Sg,bo as tC,ac as gC,u as bg,a6 as UI,y as oC,a5 as vl,cH as Kw,aa as If,ab as wf}from'./main-HLQ22ACS.js';import'./chunk-B_yM2E8f.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-65tVAuhG.js';import'./chunk-BXgG4B5s.js';import'./chunk-QpH9EEhD.js';import'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.js';function ce(a,r){a&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function me(a,r){if(a&1&&(ws(0,"label",30),Sg(1,"input",31),VI(),ws(2,"span"),GC(3),pl()()),a&2){let e=r.$implicit,l=gC(3);XE(),bg("formControl",l.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!l.isAdmin()),UI(),XE(2),Yg(e.label);}}function ue(a,r){if(a&1&&(ws(0,"fieldset",8)(1,"legend",24),GC(2,"Port\xE9e de la configuration"),pl(),rC(3,me,4,4,"label",30,Kw().trackByScope,true),pl()),a&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ve(a,r){if(a&1&&(ws(0,"option",13),GC(1),pl()),a&2){let e=r.$implicit;bg("value",e),XE(),Yg(e);}}function fe(a,r){if(a&1){let e=lC();ws(0,"div",26),Sg(1,"input",32),VI(),Sg(2,"input",33),VI(),ws(3,"button",34),Rg("click",function(){let s=If(e).$index,f=gC(2);return wf(f.removeHeader(s))}),GC(4," \xD7 "),pl()();}if(a&2){let e=r.$index;bg("formGroupName",e),XE(),UI(),XE(),UI();}}function _e(a,r){if(a&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),Jw(1,ue,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"API type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ve,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),ws(20,"div",9)(21,"label",18),GC(22,"Base URL"),pl(),Sg(23,"input",19),VI(),pl(),ws(24,"div",9)(25,"label",20),GC(26,"API key"),pl(),Sg(27,"input",21),VI(),pl(),ws(28,"div",22)(29,"div",23)(30,"span",24),GC(31,"Custom headers"),pl(),ws(32,"button",25),Rg("click",function(){If(e);let s=gC();return wf(s.addHeader())}),GC(33,"+ Add header"),pl()(),rC(34,fe,5,1,"div",26,tC),pl(),ws(36,"div",27)(37,"button",28),GC(38),pl(),ws(39,"button",29),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(40,"Cancel"),pl()()();}if(a&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.apiTypeControl),UI(),XE(),oC(e.apiTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.baseUrlControl),UI(),XE(4),bg("formControl",e.apiKeyControl),UI(),XE(),bg("formArrayName","headers"),XE(6),oC(e.headersArray.controls),XE(3),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ge=new Set(["namespace","userOnNs","userGlobal"]),F=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),se=class a{route=g(W);router=g(F$1);destroyRef=g(Ce);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F$2(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Te);scopeOptions=[{value:"namespace",label:F.namespace},{value:"userOnNs",label:F.userOnNs},{value:"userGlobal",label:F.userGlobal}];form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),apiType:new _t("OpenAI",{nonNullable:true,validators:[_e$1.required]}),baseUrl:new _t("",{nonNullable:true}),apiKey:new _t("",{nonNullable:true}),scope:new _t("namespace",{nonNullable:true}),headers:new ze([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new z({key:new _t("",{nonNullable:true,validators:[_e$1.required]}),value:new _t("",{nonNullable:true})}));}removeHeader(r){this.headersArray.removeAt(r);}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,l=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(l){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(l);return}this.scopeControl.setValue(s);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(r){return r&&ge.has(r)?r:"namespace"}deriveScopeFromConfig(r){return !r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[l,s]of Object.entries(r.headers??{}))this.headersArray.push(new z({key:new _t(l,{nonNullable:true,validators:[_e$1.required]}),value:new _t(s,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),l=this.apiKeyControl.value,s=this.isEditMode()&&l===this.initialApiKey?null:l,f=this.headersArray.controls.filter(x=>x.controls.key.value.trim()).map(x=>[x.controls.key.value.trim(),x.controls.value.value]),de=f.length>0?Object.fromEntries(f):null,N={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:de},T=this.form.getRawValue().scope,pe=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,N,T,this.existingConfig):this.state.create(N,T,pe)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," AI Providers "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,ce,2,0,"p",5)(9,_e,41,10,"form",6),pl()),e&2&&(XE(7),Yg(l.isEditMode()?"Edit AI provider":"New AI provider"),XE(),eC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{se as AiProviderFormComponent};
|
|
1
|
+
import {O}from'./chunk-BCkdBoJT.js';import {v}from'./chunk-DxHp0kqe.js';import {g,ao as W,F as F$1,C as Ce,G as Gi,a as F$2,df as Te,cd as Hf,b as U,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,s as rC,a4 as nC,a3 as VI,S as Sg,bo as tC,ac as gC,u as bg,a6 as UI,y as oC,a5 as vl,cH as Kw,aa as If,ab as wf}from'./main-DB5EJGYC.js';import'./chunk-CVM23KJ3.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-BLaIJYTj.js';import'./chunk-Gb2w1W4p.js';import'./chunk-CKhMv1Ug.js';import'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';function ce(a,r){a&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function me(a,r){if(a&1&&(ws(0,"label",30),Sg(1,"input",31),VI(),ws(2,"span"),GC(3),pl()()),a&2){let e=r.$implicit,l=gC(3);XE(),bg("formControl",l.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!l.isAdmin()),UI(),XE(2),Yg(e.label);}}function ue(a,r){if(a&1&&(ws(0,"fieldset",8)(1,"legend",24),GC(2,"Port\xE9e de la configuration"),pl(),rC(3,me,4,4,"label",30,Kw().trackByScope,true),pl()),a&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ve(a,r){if(a&1&&(ws(0,"option",13),GC(1),pl()),a&2){let e=r.$implicit;bg("value",e),XE(),Yg(e);}}function fe(a,r){if(a&1){let e=lC();ws(0,"div",26),Sg(1,"input",32),VI(),Sg(2,"input",33),VI(),ws(3,"button",34),Rg("click",function(){let s=If(e).$index,f=gC(2);return wf(f.removeHeader(s))}),GC(4," \xD7 "),pl()();}if(a&2){let e=r.$index;bg("formGroupName",e),XE(),UI(),XE(),UI();}}function _e(a,r){if(a&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let s=gC();return wf(s.submit())}),Jw(1,ue,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"API type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ve,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),ws(20,"div",9)(21,"label",18),GC(22,"Base URL"),pl(),Sg(23,"input",19),VI(),pl(),ws(24,"div",9)(25,"label",20),GC(26,"API key"),pl(),Sg(27,"input",21),VI(),pl(),ws(28,"div",22)(29,"div",23)(30,"span",24),GC(31,"Custom headers"),pl(),ws(32,"button",25),Rg("click",function(){If(e);let s=gC();return wf(s.addHeader())}),GC(33,"+ Add header"),pl()(),rC(34,fe,5,1,"div",26,tC),pl(),ws(36,"div",27)(37,"button",28),GC(38),pl(),ws(39,"button",29),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(40,"Cancel"),pl()()();}if(a&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.apiTypeControl),UI(),XE(),oC(e.apiTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.baseUrlControl),UI(),XE(4),bg("formControl",e.apiKeyControl),UI(),XE(),bg("formArrayName","headers"),XE(6),oC(e.headersArray.controls),XE(3),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ge=new Set(["namespace","userOnNs","userGlobal"]),F=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),se=class a{route=g(W);router=g(F$1);destroyRef=g(Ce);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F$2(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(Te);scopeOptions=[{value:"namespace",label:F.namespace},{value:"userOnNs",label:F.userOnNs},{value:"userGlobal",label:F.userGlobal}];form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),apiType:new _t("OpenAI",{nonNullable:true,validators:[_e$1.required]}),baseUrl:new _t("",{nonNullable:true}),apiKey:new _t("",{nonNullable:true}),scope:new _t("namespace",{nonNullable:true}),headers:new ze([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new z({key:new _t("",{nonNullable:true,validators:[_e$1.required]}),value:new _t("",{nonNullable:true})}));}removeHeader(r){this.headersArray.removeAt(r);}isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,l=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(l){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(l);return}this.scopeControl.setValue(s);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(r){return r&&ge.has(r)?r:"namespace"}deriveScopeFromConfig(r){return !r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[l,s]of Object.entries(r.headers??{}))this.headersArray.push(new z({key:new _t(l,{nonNullable:true,validators:[_e$1.required]}),value:new _t(s,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),l=this.apiKeyControl.value,s=this.isEditMode()&&l===this.initialApiKey?null:l,f=this.headersArray.controls.filter(x=>x.controls.key.value.trim()).map(x=>[x.controls.key.value.trim(),x.controls.value.value]),de=f.length>0?Object.fromEntries(f):null,N={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:de},T=this.form.getRawValue().scope,pe=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,N,T,this.existingConfig):this.state.create(N,T,pe)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," AI Providers "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,ce,2,0,"p",5)(9,_e,41,10,"form",6),pl()),e&2&&(XE(7),Yg(l.isEditMode()?"Edit AI provider":"New AI provider"),XE(),eC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{se as AiProviderFormComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-Dls1Urvo.js';import {R,q,J}from'./chunk-CDVwpBWc.js';import {g,ao as W,F,C as Ce$1,G as Gi,a as F$1,m as mT,cd as Hf,b as U,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,s as rC,a4 as nC,a3 as VI,S as Sg,ac as gC,u as bg,a6 as UI,y as oC,a5 as vl,cH as Kw,aa as If,ab as wf,b$ as kC,T as Tg}from'./main-HLQ22ACS.js';import'./chunk-B_yM2E8f.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-65tVAuhG.js';import'./chunk-BXgG4B5s.js';import'./chunk-QpH9EEhD.js';import'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.js';function se(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ce(i,t){if(i&1&&(ws(0,"label",23),Sg(1,"input",24),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,o=gC(3);XE(),bg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),UI(),XE(2),Yg(e.label);}}function de(i,t){if(i&1&&(ws(0,"fieldset",8)(1,"legend",22),GC(2,"Configuration scope"),pl(),rC(3,ce,4,4,"label",23,Kw().trackByScope,true),pl()),i&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ue(i,t){if(i&1&&(ws(0,"option",13),GC(1),pl()),i&2){let e=t.$implicit,o=gC(2);bg("value",e),XE(),Yg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&GC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(ws(0,"span",11),GC(1,"*"),pl());}function me(i,t){if(i&1&&(ws(0,"p",28),GC(1),pl()),i&2){let e=gC(2).$implicit;bg("id","as-hint-"+e.key),XE(),Yg(e.hint);}}function ge(i,t){if(i&1&&(Sg(0,"input",27),VI(),Jw(1,me,2,2,"p",28)),i&2){let e=gC().$implicit;kC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),bg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Tg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI(),XE(),eC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(ws(0,"div",9)(1,"label",26),GC(2),Jw(3,he,2,0,"span",11),pl(),Jw(4,ge,2,9),pl()),i&2){let e,o=t.$implicit,l=gC(3);XE(),bg("for","as-cred-"+o.key),XE(),vl(" ",o.label," "),XE(),eC(o.required?3:-1),XE(),eC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(ws(0,"fieldset",18)(1,"legend",22),GC(2,"Credentials"),pl(),ws(3,"p",25),GC(4," Values are stored encrypted and masked on read. "),Jw(5,pe,1,0),pl(),rC(6,Ce,5,4,"div",9,Kw().trackByField,true),pl()),i&2){let e=gC(2);XE(5),eC(e.isEditMode()?5:-1),XE(),oC(e.credentialFields());}}function ye(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let l=gC();return wf(l.submit())}),Jw(1,de,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"Auth type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ue,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),Jw(20,fe,8,1,"fieldset",18),ws(21,"div",19)(22,"button",20),GC(23),pl(),ws(24,"button",21),Rg("click",function(){If(e);let l=gC();return wf(l.cancel())}),GC(25,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.authTypeControl),UI(),XE(),oC(e.authTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.credentialFields().length>0?20:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Auth Settings "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,se,2,0,"p",5)(9,ye,26,8,"form",6),pl()),e&2&&(XE(7),Yg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),eC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
1
|
+
import {v}from'./chunk-DxHp0kqe.js';import {R,q,J}from'./chunk-CTEyKNKm.js';import {g,ao as W,F,C as Ce$1,G as Gi,a as F$1,m as mT,cd as Hf,b as U,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,v as eC,a9 as lC,s as rC,a4 as nC,a3 as VI,S as Sg,ac as gC,u as bg,a6 as UI,y as oC,a5 as vl,cH as Kw,aa as If,ab as wf,b$ as kC,T as Tg}from'./main-DB5EJGYC.js';import'./chunk-CVM23KJ3.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BLaIJYTj.js';import'./chunk-Gb2w1W4p.js';import'./chunk-CKhMv1Ug.js';import'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';function se(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ce(i,t){if(i&1&&(ws(0,"label",23),Sg(1,"input",24),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,o=gC(3);XE(),bg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),UI(),XE(2),Yg(e.label);}}function de(i,t){if(i&1&&(ws(0,"fieldset",8)(1,"legend",22),GC(2,"Configuration scope"),pl(),rC(3,ce,4,4,"label",23,Kw().trackByScope,true),pl()),i&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ue(i,t){if(i&1&&(ws(0,"option",13),GC(1),pl()),i&2){let e=t.$implicit,o=gC(2);bg("value",e),XE(),Yg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&GC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(ws(0,"span",11),GC(1,"*"),pl());}function me(i,t){if(i&1&&(ws(0,"p",28),GC(1),pl()),i&2){let e=gC(2).$implicit;bg("id","as-hint-"+e.key),XE(),Yg(e.hint);}}function ge(i,t){if(i&1&&(Sg(0,"input",27),VI(),Jw(1,me,2,2,"p",28)),i&2){let e=gC().$implicit;kC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),bg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Tg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI(),XE(),eC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(ws(0,"div",9)(1,"label",26),GC(2),Jw(3,he,2,0,"span",11),pl(),Jw(4,ge,2,9),pl()),i&2){let e,o=t.$implicit,l=gC(3);XE(),bg("for","as-cred-"+o.key),XE(),vl(" ",o.label," "),XE(),eC(o.required?3:-1),XE(),eC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(ws(0,"fieldset",18)(1,"legend",22),GC(2,"Credentials"),pl(),ws(3,"p",25),GC(4," Values are stored encrypted and masked on read. "),Jw(5,pe,1,0),pl(),rC(6,Ce,5,4,"div",9,Kw().trackByField,true),pl()),i&2){let e=gC(2);XE(5),eC(e.isEditMode()?5:-1),XE(),oC(e.credentialFields());}}function ye(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let l=gC();return wf(l.submit())}),Jw(1,de,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"Auth type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ue,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),Jw(20,fe,8,1,"fieldset",18),ws(21,"div",19)(22,"button",20),GC(23),pl(),ws(24,"button",21),Rg("click",function(){If(e);let l=gC();return wf(l.cancel())}),GC(25,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.authTypeControl),UI(),XE(),oC(e.authTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.credentialFields().length>0?20:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(W);router=g(F);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Auth Settings "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,se,2,0,"p",5)(9,ye,26,8,"form",6),pl()),e&2&&(XE(7),Yg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),eC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
2
2
|
export{le as AuthSettingFormComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {x as xe}from'./chunk-DL_yUw7E.js';import {P as Pt$1,L as Lt}from'./chunk-CU55cDg_.js';import {v as ve,n as ne}from'./chunk-Jp1EkzoM.js';import {d}from'./chunk-B5rnCx1b.js';import {W,k as ke,s as se}from'./chunk-CuEHbWdb.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-DLde3g-3.js';import {$ as $n,o as ot,i as it,I as In,E as Ee,z as ze,a as Sa,D as Dn,F as Fn,g as gt$1,A as An}from'./chunk-D1K33IKA.js';import'./chunk-bBy0vM9Y.js';import {g,bm as Mm,R as Re,G as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,a3 as VI,J as Jw,af as Eg,ag as fT,t as CC,X as XE,u as bg,a6 as UI,v as eC,Y as z,Z as Ue,am as qm,_ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,i as pr,ai as tm,aj as KC,s as rC,a8 as Yg,ak as em,y as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,aL as wo,aM as Zn$1,br as sn,aO as wt$1,bs as Tl,bt as Qn,aT as Ut$1,al as vt$1,aW as C,bu as Ve,aZ as js,a_ as QT,b5 as nT,T as Tg,z as Ug,bv as Fg,E as EC,I as IC,az as Xt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as um,bz as Oi,bA as yC,bB as vC,S as Sg,B as Pg,bC as Si,bo as tC}from'./main-HLQ22ACS.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-65tVAuhG.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(ws(0,"div",2),Sg(1,"mat-pseudo-checkbox",6),pl()),l&2){let e=gC();XE(),bg("disabled",e.disabled);}}var yt=new C("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new C("MatButtonToggleGroup"),Dt={provide:D,useExisting:Si(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Tl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new vt$1;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new vt$1;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=js({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&Fg(o,X,5),t&2){let u;EC(u=IC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Rg("keydown",function(u){return n._keydown(u)}),t&2&&(Tg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Ug("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",QT],value:"value",multiple:[2,"multiple","multiple",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",QT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[nT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Tl);_elementRef=g(Xt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new vt$1;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new um("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Gi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=xw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Pg(Pt,5),t&2){let o;EC(o=IC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Rg("focus",function(){return n.focus()}),t&2&&(Tg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Ug("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",QT],appearance:"appearance",checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(yC(),ws(0,"button",1,0),Rg("click",function(){return n._onButtonClick()}),Jw(2,Ft,2,1,"div",2),ws(3,"span",3),vC(4),pl()(),Sg(5,"span",4)(6,"span",5)),t&2){let o=CC(1);bg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Tg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),XE(2),eC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),XE(4),bg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
1
|
+
import {x as xe}from'./chunk-ZZzKEzSY.js';import {P as Pt$1,L as Lt}from'./chunk-spR5H-6W.js';import {v as ve,n as ne}from'./chunk-C2xbdglQ.js';import {d}from'./chunk-B4NACXvL.js';import {W,k as ke,s as se}from'./chunk-PljuvLnA.js';import {T as Tn,S as Sn,n as nt,a as ae,l as le,c as ce}from'./chunk-CGFcBWlS.js';import {$ as $n,o as ot,i as it,I as In,E as Ee,z as ze,a as Sa,D as Dn,F as Fn,g as gt$1,A as An}from'./chunk-aMjpfW4c.js';import'./chunk-D-FNlEoa.js';import {g,bm as Mm,R as Re,G as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,a3 as VI,J as Jw,af as Eg,ag as fT,t as CC,X as XE,u as bg,a6 as UI,v as eC,Y as z,Z as Ue,am as qm,_ as zt$1,a0 as jt$1,a1 as Vt,a2 as Nt$1,i as pr,ai as tm,aj as KC,s as rC,a8 as Yg,ak as em,y as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,aL as wo,aM as Zn$1,br as sn,aO as wt$1,bs as Tl,bt as Qn,aT as Ut$1,al as vt$1,aW as C,bu as Ve,aZ as js,a_ as QT,b5 as nT,T as Tg,z as Ug,bv as Fg,E as EC,I as IC,az as Xt$1,bw as St,aS as K$1,aX as D$1,bx as on,by as um,bz as Oi,bA as yC,bB as vC,S as Sg,B as Pg,bC as Si,bo as tC}from'./main-DB5EJGYC.js';import {y as yt$1,w as wt,t as ti,Z as Zn,c as cn,Y as Ye,f as fn,g as gt,$ as $t$1,D}from'./chunk-BLaIJYTj.js';var Pt=["button"],Ot=["*"];function Ft(l,a){if(l&1&&(ws(0,"div",2),Sg(1,"mat-pseudo-checkbox",6),pl()),l&2){let e=gC();XE(),bg("disabled",e.disabled);}}var yt=new C("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:false,hideMultipleSelectionIndicator:false,disabledInteractive:false})}),vt=new C("MatButtonToggleGroup"),Dt={provide:D,useExisting:Si(()=>ie),multi:true},K=class{source;value;constructor(a,e){this.source=a,this.value=e;}},ie=(()=>{class l{_changeDetector=g(Tl);_dir=g(Qn,{optional:true});_multiple=false;_disabled=false;_disabledInteractive=false;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck();}_name=g(Ut$1).getId("mat-button-toggle-group-");vertical=false;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value);}valueChange=new vt$1;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck();}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck();}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck();}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new vt$1;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck();}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck();}_hideMultipleSelectionIndicator;constructor(){let e=g(yt,{optional:true});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??false,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??false;}ngOnInit(){this._selectionModel=new gt$1(this.multiple,void 0,false);}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex();}writeValue(e){this.value=e,this._changeDetector.markForCheck();}registerOnChange(e){this._controlValueAccessorChangeFn=e;}registerOnTouched(e){this._onTouched=e;}setDisabledState(e){this.disabled=e;}_keydown(e){if(this.multiple||this.disabled||Ve(e))return;let n=e.target.id,o=this._buttonToggles.toArray().findIndex(I=>I.buttonId===n),u=null;switch(e.keyCode){case 32:case 13:u=this._buttonToggles.get(o)||null;break;case 38:u=this._getNextButton(o,-1);break;case 37:u=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:u=this._getNextButton(o,1);break;case 39:u=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}u&&(e.preventDefault(),u._onButtonClick(),u.focus());}_emitChangeEvent(e){let t=new K(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t);}_syncButtonToggle(e,t,n=false,o=false){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=false),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=true,o?Promise.resolve().then(()=>this._updateModelValue(e,n)):this._updateModelValue(e,n);}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?false:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1;}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let n=this._buttonToggles;for(let o=1;o<=n.length;o++){let u=(e+t*o+n.length)%n.length,I=n.get(u);if(I&&!I.disabled)return I}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(this._clearSelection(),e.forEach(n=>this._selectValue(n,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(n=>n.tabIndex===-1)){for(let n of t)if(!n.disabled){n.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=false,this.multiple||(e.tabIndex=-1);});}_selectValue(e,t){for(let n of t)if(n.value===e){n.checked=true,this._selectionModel.select(n),this.multiple||(n.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value);}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck());}static \u0275fac=function(t){return new(t||l)};static \u0275dir=js({type:l,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,n,o){if(t&1&&Fg(o,X,5),t&2){let u;EC(u=IC())&&(n._buttonToggles=u);}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,n){t&1&&Rg("keydown",function(u){return n._keydown(u)}),t&2&&(Tg("role",n.multiple?"group":"radiogroup")("aria-disabled",n.disabled),Ug("mat-button-toggle-vertical",n.vertical)("mat-button-toggle-group-appearance-standard",n.appearance==="standard"));},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",QT],value:"value",multiple:[2,"multiple","multiple",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",QT],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",QT]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[nT([Dt,{provide:vt,useExisting:l}])]})}return l})(),X=(()=>{class l{_changeDetectorRef=g(Tl);_elementRef=g(Xt$1);_focusMonitor=g(St);_idGenerator=g(Ut$1);_animationDisabled=K$1();_checked=false;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return `${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e);}_tabIndex;disableRipple=false;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e;}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck());}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e;}_disabled=false;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e;}_disabledInteractive;change=new vt$1;constructor(){g(D$1).load(on);let e=g(vt,{optional:true}),t=g(new um("tabindex"),{optional:true})||"",n=g(yt,{optional:true});this._tabIndex=Gi(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=n&&n.appearance?n.appearance:"standard",this._disabledInteractive=n?.disabledInteractive??false;}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=true:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked));}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,true);}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,false,false,true);}focus(e){this._buttonElement.nativeElement.focus(e);}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?true:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,true),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(n=>n.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0;}this.change.emit(new K(this,this.value));}_markForCheck(){this._changeDetectorRef.markForCheck();}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=xw({type:l,selectors:[["mat-button-toggle"]],viewQuery:function(t,n){if(t&1&&Pg(Pt,5),t&2){let o;EC(o=IC())&&(n._buttonElement=o.first);}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,n){t&1&&Rg("focus",function(){return n.focus()}),t&2&&(Tg("aria-label",null)("aria-labelledby",null)("id",n.id)("name",null),Ug("mat-button-toggle-standalone",!n.buttonToggleGroup)("mat-button-toggle-checked",n.checked)("mat-button-toggle-disabled",n.disabled)("mat-button-toggle-disabled-interactive",n.disabledInteractive)("mat-button-toggle-appearance-standard",n.appearance==="standard"));},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",QT],appearance:"appearance",checked:[2,"checked","checked",QT],disabled:[2,"disabled","disabled",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Ot,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,n){if(t&1&&(yC(),ws(0,"button",1,0),Rg("click",function(){return n._onButtonClick()}),Jw(2,Ft,2,1,"div",2),ws(3,"span",3),vC(4),pl()(),Sg(5,"span",4)(6,"span",5)),t&2){let o=CC(1);bg("id",n.buttonId)("disabled",n.disabled&&!n.disabledInteractive||null),Tg("role",n.isSingleSelector()?"radio":"button")("tabindex",n.disabled&&!n.disabledInteractive?-1:n.tabIndex)("aria-pressed",n.isSingleSelector()?null:n.checked)("aria-checked",n.isSingleSelector()?n.checked:null)("name",n._getButtonName())("aria-label",n.ariaLabel)("aria-labelledby",n.ariaLabelledby)("aria-disabled",n.disabled&&n.disabledInteractive?"true":null),XE(2),eC(n.buttonToggleGroup&&(!n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideSingleSelectionIndicator||n.buttonToggleGroup.multiple&&!n.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),XE(4),bg("matRippleTrigger",o)("matRippleDisabled",n.disableRipple||n.disabled);}},dependencies:[Oi,An],styles:[`.mat-button-toggle-standalone,
|
|
2
2
|
.mat-button-toggle-group {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-flex;
|