@whoz-oss/coday-client 0.245.0 → 0.247.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-EHQPUQEI.js → chunk-2TDFGQ4U.js} +1 -1
- package/browser/{chunk-2BMHZNQA.js → chunk-2XANOO7Y.js} +1 -1
- package/browser/{chunk-2IN2N6PV.js → chunk-4QBMPKYR.js} +1 -1
- package/browser/{chunk-ZM4HUO26.js → chunk-55CLK4XC.js} +1 -1
- package/browser/{chunk-HD2F6BMJ.js → chunk-5GITXCTT.js} +1 -1
- package/browser/{chunk-CWVJWHAD.js → chunk-5KKUKGZH.js} +1 -1
- package/browser/{chunk-LIBCKDBU.js → chunk-7TO465TS.js} +1 -1
- package/browser/{chunk-4QXUUAXS.js → chunk-ABU55DK2.js} +1 -1
- package/browser/{chunk-CQANBPMP.js → chunk-BHAZO7U5.js} +1 -1
- package/browser/{chunk-ARAXWPWU.js → chunk-C3GZ6PYA.js} +1 -1
- package/browser/{chunk-W7ONGRS7.js → chunk-C6PO7H3U.js} +1 -1
- package/browser/{chunk-NYQXGX3Y.js → chunk-CRODJUF7.js} +1 -1
- package/browser/{chunk-FCFKY56K.js → chunk-DIN6OQ3X.js} +1 -1
- package/browser/{chunk-UJ2IGPRI.js → chunk-DPLTZQJN.js} +1 -1
- package/browser/chunk-EWQMM44H.js +1 -0
- package/browser/{chunk-OTZDQE5T.js → chunk-FFXIBE7G.js} +1 -1
- package/browser/{chunk-FSUOGZGO.js → chunk-FIDRP4UY.js} +1 -1
- package/browser/{chunk-FCEVFEIX.js → chunk-GNUSEOSN.js} +1 -1
- package/browser/{chunk-XC5W65K7.js → chunk-GOERELOH.js} +1 -1
- package/browser/{chunk-XKHDPUML.js → chunk-GS52HX7Q.js} +1 -1
- package/browser/{chunk-QTGBG7IF.js → chunk-H5R3SW7B.js} +1 -1
- package/browser/{chunk-T4R5WSRE.js → chunk-HT3AURU3.js} +1 -1
- package/browser/{chunk-PEPRUAAU.js → chunk-J7LPPELB.js} +1 -1
- package/browser/chunk-JF7QMQ4U.js +1 -0
- package/browser/{chunk-NT57GO6D.js → chunk-JOFWSHOO.js} +1 -1
- package/browser/chunk-JYYG7ZUT.js +1 -0
- package/browser/{chunk-6QJAB37Y.js → chunk-K2ZZYRVT.js} +1 -1
- package/browser/{chunk-GLZG7RKF.js → chunk-KY3GI5KF.js} +1 -1
- package/browser/{chunk-M6HAWZVC.js → chunk-L2LMV4CM.js} +1 -1
- package/browser/{chunk-Q3UQBBUS.js → chunk-LYDUBL3X.js} +1 -1
- package/browser/{chunk-KYYI3JSI.js → chunk-MK6PPMBU.js} +1 -1
- package/browser/{chunk-45MC2DTD.js → chunk-NXINMPV4.js} +1 -1
- package/browser/{chunk-W34FCJM7.js → chunk-OFAUBLZA.js} +1 -1
- package/browser/{chunk-7QFIBIYY.js → chunk-OITCRMRM.js} +1 -1
- package/browser/{chunk-4QVEFNE3.js → chunk-OOO6KSSL.js} +1 -1
- package/browser/{chunk-EG5EQQU3.js → chunk-PDUSJ4QD.js} +1 -1
- package/browser/{chunk-WTBQIOPQ.js → chunk-PI7ZIR5W.js} +1 -1
- package/browser/{chunk-YCZCEQQL.js → chunk-PNPPZSOI.js} +1 -1
- package/browser/{chunk-DGCILIN5.js → chunk-QH6RTNNU.js} +1 -1
- package/browser/{chunk-QCLAOYIL.js → chunk-RSGZ7YWF.js} +1 -1
- package/browser/{chunk-MBQHFE5U.js → chunk-RXH3NNTB.js} +1 -1
- package/browser/{chunk-LRIDOWQT.js → chunk-SGNDHUEQ.js} +1 -1
- package/browser/{chunk-AGUXPJDD.js → chunk-SQACXL4U.js} +1 -1
- package/browser/{chunk-XS4CC6GG.js → chunk-UKR2PSUI.js} +1 -1
- package/browser/{chunk-D67AF7QL.js → chunk-V63CBJL3.js} +1 -1
- package/browser/chunk-VCUQMGKI.js +1 -0
- package/browser/{chunk-WJZ4NXIG.js → chunk-WLOUHJRC.js} +1 -1
- package/browser/chunk-WLQB3UUA.js +1 -0
- package/browser/chunk-WRMHUQWQ.js +1 -0
- package/browser/{chunk-ZEN5PJJE.js → chunk-XRGYHVGI.js} +1 -1
- package/browser/chunk-XZIT26QS.js +1 -0
- package/browser/{chunk-QKICZGWX.js → chunk-Y52DC76K.js} +1 -1
- package/browser/{chunk-AMWKKZG5.js → chunk-YFONUBPG.js} +1 -1
- package/browser/{chunk-IMS7HQGJ.js → chunk-YGUO4DH3.js} +1 -1
- package/browser/{chunk-BSYMLXS6.js → chunk-YZ7HJLJI.js} +1 -1
- package/browser/{chunk-SC7BP3G3.js → chunk-Z34N3CUS.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-5JFQENOY.js → main-TPEZWDPT.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-6UZOFA34.js +0 -1
- package/browser/chunk-C2LUO2MP.js +0 -1
- package/browser/chunk-KCFDTF3A.js +0 -1
- package/browser/chunk-PKLY5FK2.js +0 -1
- package/browser/chunk-SI42WXFB.js +0 -1
- package/browser/chunk-YFQUZF2M.js +0 -1
- package/browser/chunk-ZJLDJUUY.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-WAGXU26A.js";import{d as D}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-WAGXU26A.js";import{d as D}from"./chunk-VCUQMGKI.js";import{c as q}from"./chunk-6XX7GME4.js";import{s as M,z as $}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as _}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as b,Db as s,Fb as d,Lc as T,Pb as w,S as P,Wa as y,ab as C,ca as n,cc as R,fc as I,ga as m,gc as x,ha as l,i as f,jc as B,lb as h,ma as g,mb as A,rb as c,sb as a,t as u,tb as v}from"./chunk-CHEXA6RY.js";var S=()=>[];function V(r,e){if(r&1){let t=b();a(0,"agentos-ai-provider-item",4),s("editRequested",function(i){m(t);let p=d(2);return l(p.onEdit(i))})("deleteRequested",function(i){m(t);let p=d(2);return l(p.onDelete(i))}),v()}r&2&&c("config",e)("showBadge",!1)}function F(r,e){if(r&1&&h(0,V,1,2,"agentos-ai-provider-item",3),r&2){let t,o=e.$implicit,i=d();A((t=i.resolveProvider(o.id))?0:-1,t)}}var E=class r{router=n(q);destroyRef=n(g);aiProviderController=n(D);refresh$=new f(void 0);providers$=this.refresh$.pipe(P(()=>this.aiProviderController.listAiProvider("none")));providerItems$=this.providers$.pipe(u(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.apiType}))));providersById=new Map;constructor(){this.providers$.pipe(_(this.destroyRef)).subscribe(e=>{this.providersById=new Map(e.map(t=>[t.id??"",t]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"])}onEdit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"])}onDelete(e){e.id&&this.aiProviderController.deleteAiProvider(e.id).pipe(_(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveProvider(e){return this.providersById.get(e)??null}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=y({type:r,selectors:[["agentos-platform-ai-providers"]],decls:5,vars:6,consts:[["aiProviderItemTpl",""],["title","Platform AI Providers","emptyMessage","No platform AI providers defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(t,o){if(t&1&&(a(0,"ds-entity-list",1),I(1,"async"),s("createRequested",function(){return o.openCreateForm()}),a(2,"ds-icon-button",2),s("action",function(){return o.goBack()}),v()(),C(3,F,1,1,"ng-template",null,0,B)),t&2){let i=w(4);c("items",x(1,3,o.providerItems$)??R(5,S))("showCreate",!0)("itemTemplate",i)}},dependencies:[$,k,M,T],styles:[".platform-ai-providers__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-providers__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"],changeDetection:0})};export{E as PlatformAiProvidersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-TIO4RSPY.js";import{c as q,d as O}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-TIO4RSPY.js";import{c as q,d as O}from"./chunk-VCUQMGKI.js";import{a as E,c as $}from"./chunk-6XX7GME4.js";import{s as D,z as S}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as M}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as R,D as g,Db as l,Fb as s,Lc as L,Pb as N,S as A,Wa as h,ab as I,ca as r,cc as w,fc as x,ga as p,gc as B,ha as m,i as u,jc as T,lb as b,m as f,ma as C,mb as P,rb as c,sb as d,t as y,tb as _,z as v}from"./chunk-CHEXA6RY.js";var V=()=>[];function K(n,t){if(n&1){let i=R();d(0,"agentos-ai-model-item",4),l("deleteRequested",function(a){p(i);let e=s(2);return m(e.deleteModel(a))})("editRequested",function(a){p(i);let e=s(2);return m(e.editModel(a))}),_()}if(n&2){let i=s().$implicit,o=s();c("model",t)("namespaceId",o.namespaceId)("readOnly",o.isPlatformModel(i.id))}}function U(n,t){if(n&1&&b(0,K,1,3,"agentos-ai-model-item",3),n&2){let i,o=t.$implicit,a=s();P((i=a.resolveModel(o.id))?0:-1,i)}}var j="__platform__",G="Platform (read-only)",F=class n{route=r(E);router=r($);destroyRef=r(C);aiModelController=r(q);aiProviderController=r(O);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new u(void 0);data$=this.refresh$.pipe(A(()=>v({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(g(()=>f([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)})));modelItems$=this.data$.pipe(y(({namespace:t,platform:i,providers:o})=>{let a=new Map(o.map(e=>[e.id??"",e.name]));return[...i.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:j,groupLabel:G})),...t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:a.get(e.aiProviderId)??e.aiProviderId}))]}));namespaceModelsById=new Map;platformModelsById=new Map;constructor(){this.data$.pipe(M(this.destroyRef)).subscribe(({namespace:t,platform:i})=>{this.namespaceModelsById=new Map(t.map(o=>[o.id??"",o])),this.platformModelsById=new Map(i.map(o=>[o.id??"",o]))})}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"])}editModel(t){this.router.navigate(["/agentos",this.namespaceId,"ai-models",t.id,"edit"])}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(M(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveModel(t){return this.namespaceModelsById.get(t)??this.platformModelsById.get(t)??null}isPlatformModel(t){return this.platformModelsById.has(t)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=h({type:n,selectors:[["agentos-namespace-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","AI models","emptyMessage","No AI models configured yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model","namespaceId","readOnly"],[3,"deleteRequested","editRequested","model","namespaceId","readOnly"]],template:function(i,o){if(i&1&&(d(0,"ds-entity-list",1),x(1,"async"),l("createRequested",function(){return o.openCreateForm()}),d(2,"ds-icon-button",2),l("action",function(){return o.goBack()}),_()(),I(3,U,1,1,"ng-template",null,0,T)),i&2){let a=N(4);c("items",B(1,3,o.modelItems$)??w(5,V))("showCreate",!0)("itemTemplate",a)}},dependencies:[S,k,D,L],encapsulation:2,changeDetection:0})};export{F as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-NWFFZ2FW.js";import{a as v}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-NWFFZ2FW.js";import{a as v}from"./chunk-K2ZZYRVT.js";import{h,v as b}from"./chunk-VCUQMGKI.js";import{D as g,P as C,S as I,V as a,Z as d,ca as p,i as u,m as o,t as m,u as l}from"./chunk-CHEXA6RY.js";var N="none",O="me",y=class f{nsController=p(h);exportService=p(b);userState=p(v);refresh$=new u(void 0);namespaceId$=new u(null);vm$=l([this.namespaceId$,this.refresh$]).pipe(I(([e])=>{let n=this.loadPlatformConfigs().pipe(g(()=>o([]))),t=this.loadUserConfigs("global").pipe(g(()=>o([])));return e?l([n,this.loadNamespaceConfigs(e).pipe(g(()=>o([]))),this.loadUserConfigs(e).pipe(g(()=>o([]))),t]).pipe(m(([i,r,c,s])=>({platform:i,namespace:r,userOnNs:c,userGlobal:s}))):l([n,t]).pipe(m(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),C({bufferSize:1,refCount:!0}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e)}refresh(){this.refresh$.next()}loadPlatformConfigs(){return this.nsController.listIntegrationConfig()}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=S(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):o([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(a(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(a(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(c).pipe(a(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0};return this.nsController.updateIntegrationConfig(e,r).pipe(a(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(a(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=d({token:f,factory:f.\u0275fac,providedIn:"root"})};export{y as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-SGNDHUEQ.js";import"./chunk-C3GZ6PYA.js";import"./chunk-XZIT26QS.js";import"./chunk-VCUQMGKI.js";import"./chunk-6XX7GME4.js";import"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import"./chunk-CHEXA6RY.js";export{a as NamespaceUserGroupsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-AMWKKZG5.js";import{A as H,b as G,y as x,z as u}from"./chunk-C2LUO2MP.js";import{a as L,c as B}from"./chunk-6XX7GME4.js";import{a as w,c as N}from"./chunk-VMYKE4ZC.js";import{B as ie,F as ae,b as K,c as j,e as h,g as Y,h as J,i as Q,l as p,n as X,o as Z,s as ee,w as te,x as ne,y as oe,z as re}from"./chunk-7OGOI6WM.js";import{Bb as F,D as q,Db as E,Fb as s,Ha as $,Ka as a,R as k,Rb as b,Tb as i,Ub as g,Vb as D,Wa as W,a as V,b as A,ca as C,ga as M,ha as O,lb as c,m as R,ma as z,mb as m,mc as T,pb as S,qb as P,rb as d,sb as o,ta as v,tb as r,ub as _,z as U}from"./chunk-CHEXA6RY.js";var I=(n,t)=>t.value,ce=(n,t)=>t.id;function me(n,t){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),r())}function se(n,t){n&1&&(o(0,"span",12),i(1," Name is required. "),r())}function pe(n,t){if(n&1&&(o(0,"p",40),i(1),r(),o(2,"span",13),i(3,"Agent Config cannot be changed after creation."),r()),n&2){let e=s(2);a(),g(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ue(n,t){if(n&1&&(o(0,"a",41),i(1,"Add an agent config"),r(),i(2," first. ")),n&2){let e=s(3);d("href","/agentos/"+e.namespaceId+"/agent-configs/new",$)}}function fe(n,t){if(n&1&&(o(0,"p",13),i(1," No agent configs available in this scope yet. "),c(2,ue,3,1),r()),n&2){let e=s(2);a(2),m(e.isPlatformMode?-1:2)}}function _e(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.id),a(),g(e.name)}}function he(n,t){n&1&&(o(0,"span",12),i(1,"Agent Config is required."),r())}function ge(n,t){if(n&1&&(o(0,"select",42)(1,"option",43),i(2,"Select an agent config\u2026"),r(),S(3,_e,2,2,"option",23,ce),r(),c(5,he,2,0,"span",12),o(6,"span",13),i(7,"Immutable after creation."),r()),n&2){let e=s(2);d("formControl",e.agentConfigIdControl),a(3),P(e.availableAgentConfigs()),a(2),m(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1)}}function Ce(n,t){n&1&&(o(0,"span",12),i(1,"Opening message is required."),r())}function ve(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function be(n,t){if(n&1){let e=F();o(0,"label",46)(1,"input",47),E("change",function(){let f=M(e).$implicit,y=s(3);return O(y.toggleDay(f.value))}),r(),o(2,"span",48),i(3),r()()}if(n&2){let e=t.$implicit,l=s(3);a(),d("checked",l.isDaySelected(e.value)),a(2),g(e.label)}}function xe(n,t){if(n&1&&(o(0,"div",8)(1,"span",44),i(2,"Days of week"),r(),o(3,"div",45),S(4,be,4,2,"label",46,I),r(),o(6,"span",13),i(7,"Leave empty to run every day of the week."),r()()),n&2){let e=s(2);a(4),P(e.dayOptions)}}function ye(n,t){n&1&&(o(0,"span",12),i(1,"Valid time is required (HH:mm)."),r())}function Se(n,t){n&1&&(o(0,"span",12),i(1,"Start date is required."),r())}function Pe(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function Ee(n,t){n&1&&(o(0,"span",12),i(1,"End date is required."),r())}function Me(n,t){if(n&1&&(o(0,"div",8)(1,"label",49),i(2," End date "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",50),c(6,Ee,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),d("formControl",e.endDateControl),a(),m(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1)}}function Oe(n,t){n&1&&(o(0,"span",12),i(1,"Must be at least 1."),r())}function De(n,t){if(n&1&&(o(0,"div",8)(1,"label",51),i(2," Number of occurrences "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",52),c(6,Oe,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),d("formControl",e.occurrenceCountControl),a(),m(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1)}}function Te(n,t){if(n&1&&(o(0,"p",36),i(1),r()),n&2){let e=s(2);a(),g(e.errorMessage())}}function we(n,t){if(n&1){let e=F();o(0,"form",7),E("ngSubmit",function(){M(e);let f=s();return O(f.submit())}),o(1,"div",8)(2,"label",9),i(3," Name "),o(4,"span",10),i(5,"*"),r()(),_(6,"input",11),c(7,se,2,0,"span",12),o(8,"span",13),i(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),r()(),o(10,"div",8)(11,"label",14),i(12,"Description"),r(),_(13,"input",15),r(),o(14,"div",8)(15,"label",16),i(16," Agent Config "),o(17,"span",10),i(18,"*"),r()(),c(19,pe,4,1)(20,fe,3,1,"p",13)(21,ge,8,2),r(),o(22,"div",8)(23,"label",17),i(24," Opening message "),o(25,"span",10),i(26,"*"),r()(),_(27,"textarea",18),c(28,Ce,2,0,"span",12),o(29,"span",13),i(30," The message sent to the agent when the scheduled prompt fires. "),r()(),o(31,"fieldset",19)(32,"legend",20),i(33,"Recurrence"),r(),o(34,"div",8)(35,"label",21),i(36," Unit "),o(37,"span",10),i(38,"*"),r()(),o(39,"select",22),S(40,ve,2,2,"option",23,I),r()(),c(42,xe,8,0,"div",8),o(43,"div",8)(44,"label",24),i(45," Time (UTC) "),o(46,"span",10),i(47,"*"),r()(),o(48,"div",25),_(49,"input",26),o(50,"span",27),i(51,"UTC"),r()(),c(52,ye,2,0,"span",12),r()(),o(53,"fieldset",19)(54,"legend",20),i(55,"Planning"),r(),o(56,"div",8)(57,"label",28),i(58," Start date "),o(59,"span",10),i(60,"*"),r()(),_(61,"input",29),c(62,Se,2,0,"span",12),r(),o(63,"div",8)(64,"label",30),i(65," Ends "),o(66,"span",10),i(67,"*"),r()(),o(68,"select",31),S(69,Pe,2,2,"option",23,I),r()(),c(71,Me,7,4,"div",8),c(72,De,7,4,"div",8),r(),o(73,"div",8)(74,"label",32),_(75,"input",33),o(76,"span",34),i(77,"Enabled"),r()(),o(78,"p",35),i(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),r()(),c(80,Te,2,1,"p",36),o(81,"div",37)(82,"button",38),i(83),r(),o(84,"button",39),E("click",function(){M(e);let f=s();return O(f.cancel())}),i(85,"Cancel"),r()()()}if(n&2){let e=s();d("formGroup",e.form),a(6),b("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),d("formControl",e.nameControl),a(),m(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(6),d("formControl",e.descriptionControl),a(6),m(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),a(8),b("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),d("formControl",e.promptContentControl),a(),m(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),a(11),d("formControl",e.unitControl),a(),P(e.schedulerUnits),a(2),m(e.showDayFilter()?42:-1),a(7),d("formControl",e.timeUtcControl),a(3),m(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),a(9),b("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),d("formControl",e.startDateControl),a(),m(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),a(6),d("formControl",e.endTypeControl),a(),P(e.endTypes),a(2),m(e.showEndDate()?71:-1),a(),m(e.showOccurrenceCount()?72:-1),a(3),d("formControl",e.enabledControl),a(5),m(e.errorMessage()?80:-1),a(2),d("disabled",e.form.invalid||e.isSubmitting()),a(),D(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ")}}var de=class n{route=C(L);router=C(B);destroyRef=C(z);state=C(le);agentConfigController=C(G);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new Q({name:new p("",{nonNullable:!0,validators:[h.required]}),description:new p(null),agentConfigId:new p("",{nonNullable:!0,validators:[h.required]}),promptContent:new p("",{nonNullable:!0,validators:[h.required]}),unit:new p(x.WEEK,{nonNullable:!0,validators:[h.required]}),days:new p([],{nonNullable:!0}),timeUtc:new p("09:00",{nonNullable:!0,validators:[h.required,h.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new p("",{nonNullable:!0,validators:[h.required]}),endType:new p(u.NEVER,{nonNullable:!0,validators:[h.required]}),endDate:new p(null),occurrenceCount:new p(null),enabled:new p(!0,{nonNullable:!0})},{validators:[ke,Fe]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=v(!1);isSubmitting=v(!1);isLoading=v(!1);errorMessage=v(null);SchedulerUnit=x;SchedulerEndType=u;schedulerUnits=[{value:x.WEEK,label:"Week(s)"},{value:x.MONTH,label:"Month(s)"}];endTypes=[{value:u.NEVER,label:"Never"},{value:u.ON_DATE,label:"On date"},{value:u.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(H).map(([t,e])=>({value:t,label:e}));unitSignal=N(this.unitControl.valueChanges.pipe(k(this.unitControl.value)));endTypeSignal=N(this.endTypeControl.valueChanges.pipe(k(this.endTypeControl.value)));showDayFilter=T(()=>this.unitSignal()===x.WEEK);showEndDate=T(()=>this.endTypeSignal()===u.ON_DATE);showOccurrenceCount=T(()=>this.endTypeSignal()===u.OCCURRENCES);agentConfigs=v([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ne());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(!0),this.loadPromptAndResources(t)):this.loadResources()}loadPromptAndResources(t){this.isLoading.set(!0),U({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(w(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadResources(){this.agentConfigs$().pipe(w(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t))}agentConfigs$(){return(this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(q(()=>R([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled)}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l)}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=A(V({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===u.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===u.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:y=>{this.isSubmitting.set(!1),y.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):y.status===400?this.errorMessage.set(y.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"])}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=W({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),E("click",function(){return l.cancel()}),o(3,"span",3),i(4,"\u2190"),r(),i(5),r(),o(6,"h1",4),i(7),r()(),c(8,me,2,0,"p",5)(9,we,86,26,"form",6),r()),e&2&&(a(5),D(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),a(2),D(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),a(),m(l.isLoading()?8:9))},dependencies:[ae,X,oe,re,j,Z,K,ne,Y,J,ie,ee,te],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};function ke(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===u.ON_DATE&&!e?{endDateRequired:!0}:null}function Fe(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===u.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:!0}:null}function Ne(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${t}-${e}-${l}`}export{de as ScheduledPromptFormComponent};
|
|
1
|
+
import{a as le}from"./chunk-YFONUBPG.js";import{A as H,b as G,y as x,z as u}from"./chunk-VCUQMGKI.js";import{a as L,c as B}from"./chunk-6XX7GME4.js";import{a as w,c as N}from"./chunk-VMYKE4ZC.js";import{B as ie,F as ae,b as K,c as j,e as h,g as Y,h as J,i as Q,l as p,n as X,o as Z,s as ee,w as te,x as ne,y as oe,z as re}from"./chunk-7OGOI6WM.js";import{Bb as F,D as q,Db as E,Fb as s,Ha as $,Ka as a,R as k,Rb as b,Tb as i,Ub as g,Vb as D,Wa as W,a as V,b as A,ca as C,ga as M,ha as O,lb as c,m as R,ma as z,mb as m,mc as T,pb as S,qb as P,rb as d,sb as o,ta as v,tb as r,ub as _,z as U}from"./chunk-CHEXA6RY.js";var I=(n,t)=>t.value,ce=(n,t)=>t.id;function me(n,t){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),r())}function se(n,t){n&1&&(o(0,"span",12),i(1," Name is required. "),r())}function pe(n,t){if(n&1&&(o(0,"p",40),i(1),r(),o(2,"span",13),i(3,"Agent Config cannot be changed after creation."),r()),n&2){let e=s(2);a(),g(e.resolveAgentConfigName(e.agentConfigIdControl.value))}}function ue(n,t){if(n&1&&(o(0,"a",41),i(1,"Add an agent config"),r(),i(2," first. ")),n&2){let e=s(3);d("href","/agentos/"+e.namespaceId+"/agent-configs/new",$)}}function fe(n,t){if(n&1&&(o(0,"p",13),i(1," No agent configs available in this scope yet. "),c(2,ue,3,1),r()),n&2){let e=s(2);a(2),m(e.isPlatformMode?-1:2)}}function _e(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.id),a(),g(e.name)}}function he(n,t){n&1&&(o(0,"span",12),i(1,"Agent Config is required."),r())}function ge(n,t){if(n&1&&(o(0,"select",42)(1,"option",43),i(2,"Select an agent config\u2026"),r(),S(3,_e,2,2,"option",23,ce),r(),c(5,he,2,0,"span",12),o(6,"span",13),i(7,"Immutable after creation."),r()),n&2){let e=s(2);d("formControl",e.agentConfigIdControl),a(3),P(e.availableAgentConfigs()),a(2),m(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1)}}function Ce(n,t){n&1&&(o(0,"span",12),i(1,"Opening message is required."),r())}function ve(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function be(n,t){if(n&1){let e=F();o(0,"label",46)(1,"input",47),E("change",function(){let f=M(e).$implicit,y=s(3);return O(y.toggleDay(f.value))}),r(),o(2,"span",48),i(3),r()()}if(n&2){let e=t.$implicit,l=s(3);a(),d("checked",l.isDaySelected(e.value)),a(2),g(e.label)}}function xe(n,t){if(n&1&&(o(0,"div",8)(1,"span",44),i(2,"Days of week"),r(),o(3,"div",45),S(4,be,4,2,"label",46,I),r(),o(6,"span",13),i(7,"Leave empty to run every day of the week."),r()()),n&2){let e=s(2);a(4),P(e.dayOptions)}}function ye(n,t){n&1&&(o(0,"span",12),i(1,"Valid time is required (HH:mm)."),r())}function Se(n,t){n&1&&(o(0,"span",12),i(1,"Start date is required."),r())}function Pe(n,t){if(n&1&&(o(0,"option",23),i(1),r()),n&2){let e=t.$implicit;d("value",e.value),a(),g(e.label)}}function Ee(n,t){n&1&&(o(0,"span",12),i(1,"End date is required."),r())}function Me(n,t){if(n&1&&(o(0,"div",8)(1,"label",49),i(2," End date "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",50),c(6,Ee,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),d("formControl",e.endDateControl),a(),m(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1)}}function Oe(n,t){n&1&&(o(0,"span",12),i(1,"Must be at least 1."),r())}function De(n,t){if(n&1&&(o(0,"div",8)(1,"label",51),i(2," Number of occurrences "),o(3,"span",10),i(4,"*"),r()(),_(5,"input",52),c(6,Oe,2,0,"span",12),r()),n&2){let e=s(2);a(5),b("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),d("formControl",e.occurrenceCountControl),a(),m(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1)}}function Te(n,t){if(n&1&&(o(0,"p",36),i(1),r()),n&2){let e=s(2);a(),g(e.errorMessage())}}function we(n,t){if(n&1){let e=F();o(0,"form",7),E("ngSubmit",function(){M(e);let f=s();return O(f.submit())}),o(1,"div",8)(2,"label",9),i(3," Name "),o(4,"span",10),i(5,"*"),r()(),_(6,"input",11),c(7,se,2,0,"span",12),o(8,"span",13),i(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),r()(),o(10,"div",8)(11,"label",14),i(12,"Description"),r(),_(13,"input",15),r(),o(14,"div",8)(15,"label",16),i(16," Agent Config "),o(17,"span",10),i(18,"*"),r()(),c(19,pe,4,1)(20,fe,3,1,"p",13)(21,ge,8,2),r(),o(22,"div",8)(23,"label",17),i(24," Opening message "),o(25,"span",10),i(26,"*"),r()(),_(27,"textarea",18),c(28,Ce,2,0,"span",12),o(29,"span",13),i(30," The message sent to the agent when the scheduled prompt fires. "),r()(),o(31,"fieldset",19)(32,"legend",20),i(33,"Recurrence"),r(),o(34,"div",8)(35,"label",21),i(36," Unit "),o(37,"span",10),i(38,"*"),r()(),o(39,"select",22),S(40,ve,2,2,"option",23,I),r()(),c(42,xe,8,0,"div",8),o(43,"div",8)(44,"label",24),i(45," Time (UTC) "),o(46,"span",10),i(47,"*"),r()(),o(48,"div",25),_(49,"input",26),o(50,"span",27),i(51,"UTC"),r()(),c(52,ye,2,0,"span",12),r()(),o(53,"fieldset",19)(54,"legend",20),i(55,"Planning"),r(),o(56,"div",8)(57,"label",28),i(58," Start date "),o(59,"span",10),i(60,"*"),r()(),_(61,"input",29),c(62,Se,2,0,"span",12),r(),o(63,"div",8)(64,"label",30),i(65," Ends "),o(66,"span",10),i(67,"*"),r()(),o(68,"select",31),S(69,Pe,2,2,"option",23,I),r()(),c(71,Me,7,4,"div",8),c(72,De,7,4,"div",8),r(),o(73,"div",8)(74,"label",32),_(75,"input",33),o(76,"span",34),i(77,"Enabled"),r()(),o(78,"p",35),i(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),r()(),c(80,Te,2,1,"p",36),o(81,"div",37)(82,"button",38),i(83),r(),o(84,"button",39),E("click",function(){M(e);let f=s();return O(f.cancel())}),i(85,"Cancel"),r()()()}if(n&2){let e=s();d("formGroup",e.form),a(6),b("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),d("formControl",e.nameControl),a(),m(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(6),d("formControl",e.descriptionControl),a(6),m(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),a(8),b("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),d("formControl",e.promptContentControl),a(),m(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),a(11),d("formControl",e.unitControl),a(),P(e.schedulerUnits),a(2),m(e.showDayFilter()?42:-1),a(7),d("formControl",e.timeUtcControl),a(3),m(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),a(9),b("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),d("formControl",e.startDateControl),a(),m(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),a(6),d("formControl",e.endTypeControl),a(),P(e.endTypes),a(2),m(e.showEndDate()?71:-1),a(),m(e.showOccurrenceCount()?72:-1),a(3),d("formControl",e.enabledControl),a(5),m(e.errorMessage()?80:-1),a(2),d("disabled",e.form.invalid||e.isSubmitting()),a(),D(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ")}}var de=class n{route=C(L);router=C(B);destroyRef=C(z);state=C(le);agentConfigController=C(G);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new Q({name:new p("",{nonNullable:!0,validators:[h.required]}),description:new p(null),agentConfigId:new p("",{nonNullable:!0,validators:[h.required]}),promptContent:new p("",{nonNullable:!0,validators:[h.required]}),unit:new p(x.WEEK,{nonNullable:!0,validators:[h.required]}),days:new p([],{nonNullable:!0}),timeUtc:new p("09:00",{nonNullable:!0,validators:[h.required,h.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new p("",{nonNullable:!0,validators:[h.required]}),endType:new p(u.NEVER,{nonNullable:!0,validators:[h.required]}),endDate:new p(null),occurrenceCount:new p(null),enabled:new p(!0,{nonNullable:!0})},{validators:[ke,Fe]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}isEditMode=v(!1);isSubmitting=v(!1);isLoading=v(!1);errorMessage=v(null);SchedulerUnit=x;SchedulerEndType=u;schedulerUnits=[{value:x.WEEK,label:"Week(s)"},{value:x.MONTH,label:"Month(s)"}];endTypes=[{value:u.NEVER,label:"Never"},{value:u.ON_DATE,label:"On date"},{value:u.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(H).map(([t,e])=>({value:t,label:e}));unitSignal=N(this.unitControl.valueChanges.pipe(k(this.unitControl.value)));endTypeSignal=N(this.endTypeControl.valueChanges.pipe(k(this.endTypeControl.value)));showDayFilter=T(()=>this.unitSignal()===x.WEEK);showEndDate=T(()=>this.endTypeSignal()===u.ON_DATE);showOccurrenceCount=T(()=>this.endTypeSignal()===u.OCCURRENCES);agentConfigs=v([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Ne());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(!0),this.loadPromptAndResources(t)):this.loadResources()}loadPromptAndResources(t){this.isLoading.set(!0),U({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(w(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}loadResources(){this.agentConfigs$().pipe(w(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t))}agentConfigs$(){return(this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(q(()=>R([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled)}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l)}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=A(V({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===u.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===u.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:y=>{this.isSubmitting.set(!1),y.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):y.status===400?this.errorMessage.set(y.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"])}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=W({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,l){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),E("click",function(){return l.cancel()}),o(3,"span",3),i(4,"\u2190"),r(),i(5),r(),o(6,"h1",4),i(7),r()(),c(8,me,2,0,"p",5)(9,we,86,26,"form",6),r()),e&2&&(a(5),D(" ",l.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),a(2),D(" ",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),a(),m(l.isLoading()?8:9))},dependencies:[ae,X,oe,re,j,Z,K,ne,Y,J,ie,ee,te],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};function ke(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===u.ON_DATE&&!e?{endDateRequired:!0}:null}function Fe(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===u.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:!0}:null}function Ne(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${t}-${e}-${l}`}export{de as ScheduledPromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-TFW43ZTS.js";import{c as $}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-TFW43ZTS.js";import{c as $}from"./chunk-OOO6KSSL.js";import"./chunk-NWFFZ2FW.js";import"./chunk-K2ZZYRVT.js";import"./chunk-VCUQMGKI.js";import{c as B}from"./chunk-6XX7GME4.js";import{z as q}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as g}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as b,Db as a,Fb as m,Lc as I,Pb as w,S as _,Tb as D,Wa as S,ab as C,ca as s,cc as R,fc as P,ga as l,gc as x,ha as u,i as f,jc as T,lb as v,ma as y,mb as A,rb as d,sb as r,t as h,tb as c}from"./chunk-CHEXA6RY.js";var M=()=>[];function V(i,t){if(i&1){let e=b();r(0,"agentos-auth-setting-item",4),a("editRequested",function(n){l(e);let p=m(2);return u(p.onEdit(n))})("deleteRequested",function(n){l(e);let p=m(2);return u(p.onDelete(n))}),c()}i&2&&d("config",t)("showBadge",!1)}function F(i,t){if(i&1&&v(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=m();A((e=n.resolveSetting(o.id))?0:-1,e)}}var k=class i{router=s(B);destroyRef=s(y);state=s($);refresh$=new f(void 0);settings$=this.refresh$.pipe(_(()=>this.state.loadPlatformSettings()));settingItems$=this.settings$.pipe(h(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(g(this.destroyRef)).subscribe(t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"])}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"])}onDelete(t){t.id&&this.state.delete(t.id,"platform").pipe(g(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=S({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:6,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,o){if(e&1&&(r(0,"ds-entity-list",1),P(1,"async"),a("createRequested",function(){return o.openCreateForm()}),r(2,"button",2),a("click",function(){return o.goBack()}),D(3,"\u2190 Admin"),c()(),C(4,F,1,1,"ng-template",null,0,T)),e&2){let n=w(5);d("items",x(1,3,o.settingItems$)??R(5,M))("showCreate",!0)("itemTemplate",n)}},dependencies:[q,E,I],encapsulation:2,changeDetection:0})};export{k as PlatformAuthSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as n,x as s}from"./chunk-
|
|
1
|
+
import{m as n,x as s}from"./chunk-VCUQMGKI.js";import{Z as l,a as p,ca as o}from"./chunk-CHEXA6RY.js";var m=class e{promptController=o(n);exportService=o(s);getById(r){return this.promptController.getByIdPrompt(r)}listPlatform(){return this.promptController.searchPrompt({namespaceId:null,userId:null})}listByNamespace(r){return this.promptController.searchPrompt({namespaceId:r,userId:null})}create(r){return this.promptController.createPrompt(r)}update(r,t){return this.promptController.updatePrompt(r,t)}delete(r){return this.promptController.deletePrompt(r)}listEffective(r,t){return this.promptController.resolveEffectivePrompt(p({namespaceId:r},t?{agentConfigId:t}:{}))}exportAsYaml(r){return this.exportService.exportAsYaml(r)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=l({token:e,factory:e.\u0275fac,providedIn:"root"})};export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te,b as ie,c as ne}from"./chunk-4QVEFNE3.js";import{a as ee}from"./chunk-ZJLDJUUY.js";import"./chunk-NWFFZ2FW.js";import"./chunk-6QJAB37Y.js";import"./chunk-C2LUO2MP.js";import{a as q,c as B}from"./chunk-6XX7GME4.js";import{a as k,c as T}from"./chunk-VMYKE4ZC.js";import{F as Z,c as L,e as x,g as K,h as G,i as $,l as c,n as H,p as j,s as Y,w as J,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as N,Db as v,Fb as d,Ka as l,Sb as R,Tb as s,Ub as A,Vb as I,Wa as E,a as p,b as h,ca as C,ga as V,ha as O,kb as U,lb as m,ma as F,mb as g,mc as z,ob as D,pb as S,qb as b,rb as u,sb as r,ta as f,tb as o,ua as w,ub as _}from"./chunk-CHEXA6RY.js";function re(i,t){i&1&&(r(0,"p",5),s(1,"Loading\u2026"),o())}function ae(i,t){if(i&1&&(r(0,"label",23),_(1,"input",24),r(2,"span"),s(3),o()()),i&2){let e=t.$implicit,n=d(3);l(),u("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),l(2),A(e.label)}}function le(i,t){if(i&1&&(r(0,"fieldset",8)(1,"legend",22),s(2,"Port\xE9e de la configuration"),o(),S(3,ae,4,4,"label",23,U().trackByScope,!0),o()),i&2){let e=d(2);u("disabled",e.isEditMode()),l(3),b(e.scopeOptions)}}function se(i,t){if(i&1&&(r(0,"option",13),s(1),o()),i&2){let e=t.$implicit,n=d(2);u("value",e),l(),A(n.authTypeLabel[e])}}function ce(i,t){i&1&&s(0," Leave a field unchanged to keep the stored credential. ")}function ue(i,t){i&1&&(r(0,"span",11),s(1,"*"),o())}function de(i,t){if(i&1&&_(0,"input",28),i&2){let e=d().$implicit;R("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),u("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off")}}function pe(i,t){if(i&1&&(r(0,"div",9)(1,"label",26),s(2),m(3,ue,2,0,"span",11),o(),m(4,de,1,7,"input",27),o()),i&2){let e,n=t.$implicit,a=d(3);l(),u("for","as-cred-"+n.key),l(),I(" ",n.label," "),l(),g(n.required?3:-1),l(),g((e=a.controlForField(n.key))?4:-1,e)}}function he(i,t){if(i&1&&(r(0,"fieldset",18)(1,"legend",22),s(2,"Credentials"),o(),r(3,"p",25),s(4," Values are stored encrypted and masked on read. "),m(5,ce,1,0),o(),S(6,pe,5,4,"div",9,U().trackByField,!0),o()),i&2){let e=d(2);l(5),g(e.isEditMode()?5:-1),l(),b(e.credentialFields())}}function me(i,t){if(i&1){let e=N();r(0,"form",7),v("ngSubmit",function(){V(e);let a=d();return O(a.submit())}),m(1,le,5,1,"fieldset",8),r(2,"div",9)(3,"label",10),s(4,"Auth type "),r(5,"span",11),s(6,"*"),o()(),r(7,"select",12),S(8,se,2,2,"option",13,D),o()(),r(10,"div",9)(11,"label",14),s(12,"Name "),r(13,"span",11),s(14,"*"),o()(),_(15,"input",15),o(),r(16,"div",9)(17,"label",16),s(18,"Description"),o(),_(19,"input",17),o(),m(20,he,8,1,"fieldset",18),r(21,"div",19)(22,"button",20),s(23),o(),r(24,"button",21),v("click",function(){V(e);let a=d();return O(a.cancel())}),s(25,"Cancel"),o()()()}if(i&2){let e=d();u("formGroup",e.form),l(),g(e.isPlatformMode?-1:1),l(6),u("formControl",e.authTypeControl),l(),b(e.authTypeOptions),l(7),u("formControl",e.nameControl),l(4),u("formControl",e.descriptionControl),l(),g(e.credentialFields().length>0?20:-1),l(2),u("disabled",e.form.invalid||e.isSubmitting()),l(),I(" ",e.isEditMode()?"Save changes":"Create"," ")}}var ge=new Set(["namespace","userOnNs","userGlobal"]),M=Object.freeze({platform:"Plateforme (lecture seule)",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),Ce={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:!0,required:!1}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:!1,required:!1},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:!0,required:!1}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:!0,required:!1}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:!1,required:!1},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:!1,required:!1},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://\u2026/mcp",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}]},oe=class i{route=C(q);router=C(B);destroyRef=C(F);state=C(ne);namespaceRole=C(ee);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?f(!0):T(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});authTypeOptions=te;authTypeLabel=ie;scopeOptions=[{value:"namespace",label:M.namespace},{value:"userOnNs",label:M.userOnNs},{value:"userGlobal",label:M.userGlobal}];nameControl=new c("",{nonNullable:!0,validators:[x.required,x.minLength(1)]});descriptionControl=new c(null);authTypeControl=new c("ApiKeyAuthSetting",{nonNullable:!0,validators:[x.required]});scopeControl=new c("namespace",{nonNullable:!0});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new c("",{nonNullable:!0});usernameControl=new c("",{nonNullable:!0});passwordControl=new c("",{nonNullable:!0});tokenControl=new c("",{nonNullable:!0});discoveryUrlControl=new c("",{nonNullable:!0});authorizationUrlControl=new c("",{nonNullable:!0});tokenUrlControl=new c("",{nonNullable:!0});clientIdControl=new c("",{nonNullable:!0});clientSecretControl=new c("",{nonNullable:!0});scopesControl=new c("",{nonNullable:!0});resourceUrlControl=new c("",{nonNullable:!0});selectedAuthType=T(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=z(()=>Ce[this.selectedAuthType()]);isEditMode=f(!1);isSubmitting=f(!1);isLoading=f(!1);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||w(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(!0),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let a=this.parseScope(e.get("scope"));this.scopeControl.setValue(a);let y=e.get("template");y&&this.hydrateFromTemplate(y)}parseScope(t){return t&&ge.has(t)?t:"namespace"}deriveScopeFromConfig(t){return!t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(!0),this.state.getById(t).pipe(k(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(t){this.isLoading.set(!0),this.state.getById(t).pipe(k(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(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}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,n=e.username??"",a=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(a),this.initialCredentials.username=n,this.initialCredentials.password=a;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(!0);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,a=this.form.getRawValue().scope,y=this.isPlatformMode?null:this.namespaceId??null,P=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,P,this.existingConfig):this.state.create(P,a,y)).pipe(k(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}buildTypedPayload(t,e,n){let a={name:e,description:n};switch(t){case"ApiKeyAuthSetting":return h(p({},a),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case"BasicAuthAuthSetting":return h(p({},a),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case"BearerTokenAuthSetting":return h(p({},a),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case"OAuthDiscoverableAuthSetting":return h(p({},a),{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 h(p({},a),{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 h(p({},a),{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 h(p({},a),{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=E({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","class","type","placeholder","formControl","autocomplete"],[3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(r(0,"div",0)(1,"header",1)(2,"button",2),v("click",function(){return n.cancel()}),r(3,"span",3),s(4,"\u2190"),o(),s(5," Auth Settings "),o(),r(6,"h1",4),s(7),o()(),m(8,re,2,0,"p",5)(9,me,26,8,"form",6),o()),e&2&&(l(7),A(n.isEditMode()?"Edit auth setting":"New auth setting"),l(),g(n.isLoading()?8:9))},dependencies:[Z,H,W,X,L,Q,j,K,G,Y,J],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__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))}"],changeDetection:0})};export{oe as AuthSettingFormComponent};
|
|
1
|
+
import{a as te,b as ie,c as ne}from"./chunk-OOO6KSSL.js";import{a as ee}from"./chunk-EWQMM44H.js";import"./chunk-NWFFZ2FW.js";import"./chunk-K2ZZYRVT.js";import"./chunk-VCUQMGKI.js";import{a as q,c as B}from"./chunk-6XX7GME4.js";import{a as k,c as T}from"./chunk-VMYKE4ZC.js";import{F as Z,c as L,e as x,g as K,h as G,i as $,l as c,n as H,p as j,s as Y,w as J,x as Q,y as W,z as X}from"./chunk-7OGOI6WM.js";import{Bb as N,Db as v,Fb as d,Ka as l,Sb as R,Tb as s,Ub as A,Vb as I,Wa as E,a as p,b as h,ca as C,ga as V,ha as O,kb as U,lb as m,ma as F,mb as g,mc as z,ob as D,pb as S,qb as b,rb as u,sb as r,ta as f,tb as o,ua as w,ub as _}from"./chunk-CHEXA6RY.js";function re(i,t){i&1&&(r(0,"p",5),s(1,"Loading\u2026"),o())}function ae(i,t){if(i&1&&(r(0,"label",23),_(1,"input",24),r(2,"span"),s(3),o()()),i&2){let e=t.$implicit,n=d(3);l(),u("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),l(2),A(e.label)}}function le(i,t){if(i&1&&(r(0,"fieldset",8)(1,"legend",22),s(2,"Port\xE9e de la configuration"),o(),S(3,ae,4,4,"label",23,U().trackByScope,!0),o()),i&2){let e=d(2);u("disabled",e.isEditMode()),l(3),b(e.scopeOptions)}}function se(i,t){if(i&1&&(r(0,"option",13),s(1),o()),i&2){let e=t.$implicit,n=d(2);u("value",e),l(),A(n.authTypeLabel[e])}}function ce(i,t){i&1&&s(0," Leave a field unchanged to keep the stored credential. ")}function ue(i,t){i&1&&(r(0,"span",11),s(1,"*"),o())}function de(i,t){if(i&1&&_(0,"input",28),i&2){let e=d().$implicit;R("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),u("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off")}}function pe(i,t){if(i&1&&(r(0,"div",9)(1,"label",26),s(2),m(3,ue,2,0,"span",11),o(),m(4,de,1,7,"input",27),o()),i&2){let e,n=t.$implicit,a=d(3);l(),u("for","as-cred-"+n.key),l(),I(" ",n.label," "),l(),g(n.required?3:-1),l(),g((e=a.controlForField(n.key))?4:-1,e)}}function he(i,t){if(i&1&&(r(0,"fieldset",18)(1,"legend",22),s(2,"Credentials"),o(),r(3,"p",25),s(4," Values are stored encrypted and masked on read. "),m(5,ce,1,0),o(),S(6,pe,5,4,"div",9,U().trackByField,!0),o()),i&2){let e=d(2);l(5),g(e.isEditMode()?5:-1),l(),b(e.credentialFields())}}function me(i,t){if(i&1){let e=N();r(0,"form",7),v("ngSubmit",function(){V(e);let a=d();return O(a.submit())}),m(1,le,5,1,"fieldset",8),r(2,"div",9)(3,"label",10),s(4,"Auth type "),r(5,"span",11),s(6,"*"),o()(),r(7,"select",12),S(8,se,2,2,"option",13,D),o()(),r(10,"div",9)(11,"label",14),s(12,"Name "),r(13,"span",11),s(14,"*"),o()(),_(15,"input",15),o(),r(16,"div",9)(17,"label",16),s(18,"Description"),o(),_(19,"input",17),o(),m(20,he,8,1,"fieldset",18),r(21,"div",19)(22,"button",20),s(23),o(),r(24,"button",21),v("click",function(){V(e);let a=d();return O(a.cancel())}),s(25,"Cancel"),o()()()}if(i&2){let e=d();u("formGroup",e.form),l(),g(e.isPlatformMode?-1:1),l(6),u("formControl",e.authTypeControl),l(),b(e.authTypeOptions),l(7),u("formControl",e.nameControl),l(4),u("formControl",e.descriptionControl),l(),g(e.credentialFields().length>0?20:-1),l(2),u("disabled",e.form.invalid||e.isSubmitting()),l(),I(" ",e.isEditMode()?"Save changes":"Create"," ")}}var ge=new Set(["namespace","userOnNs","userGlobal"]),M=Object.freeze({platform:"Plateforme (lecture seule)",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),Ce={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:!0,required:!1}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:!1,required:!1},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:!0,required:!1}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:!0,required:!1}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:!1,required:!1},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:!1,required:!1},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://\u2026/mcp",secret:!1,required:!1},{key:"clientId",label:"Client ID",placeholder:"",secret:!1,required:!1},{key:"clientSecret",label:"Client secret",placeholder:"",secret:!0,required:!1},{key:"scopes",label:"Scopes",placeholder:"openid profile email",secret:!1,required:!1}]},oe=class i{route=C(q);router=C(B);destroyRef=C(F);state=C(ne);namespaceRole=C(ee);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?f(!0):T(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});authTypeOptions=te;authTypeLabel=ie;scopeOptions=[{value:"namespace",label:M.namespace},{value:"userOnNs",label:M.userOnNs},{value:"userGlobal",label:M.userGlobal}];nameControl=new c("",{nonNullable:!0,validators:[x.required,x.minLength(1)]});descriptionControl=new c(null);authTypeControl=new c("ApiKeyAuthSetting",{nonNullable:!0,validators:[x.required]});scopeControl=new c("namespace",{nonNullable:!0});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new c("",{nonNullable:!0});usernameControl=new c("",{nonNullable:!0});passwordControl=new c("",{nonNullable:!0});tokenControl=new c("",{nonNullable:!0});discoveryUrlControl=new c("",{nonNullable:!0});authorizationUrlControl=new c("",{nonNullable:!0});tokenUrlControl=new c("",{nonNullable:!0});clientIdControl=new c("",{nonNullable:!0});clientSecretControl=new c("",{nonNullable:!0});scopesControl=new c("",{nonNullable:!0});resourceUrlControl=new c("",{nonNullable:!0});selectedAuthType=T(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=z(()=>Ce[this.selectedAuthType()]);isEditMode=f(!1);isSubmitting=f(!1);isLoading=f(!1);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||w(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(!0),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let a=this.parseScope(e.get("scope"));this.scopeControl.setValue(a);let y=e.get("template");y&&this.hydrateFromTemplate(y)}parseScope(t){return t&&ge.has(t)?t:"namespace"}deriveScopeFromConfig(t){return!t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(!0),this.state.getById(t).pipe(k(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(t){this.isLoading.set(!0),this.state.getById(t).pipe(k(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(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}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,n=e.username??"",a=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(a),this.initialCredentials.username=n,this.initialCredentials.password=a;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(!0);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,a=this.form.getRawValue().scope,y=this.isPlatformMode?null:this.namespaceId??null,P=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,P,this.existingConfig):this.state.create(P,a,y)).pipe(k(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}buildTypedPayload(t,e,n){let a={name:e,description:n};switch(t){case"ApiKeyAuthSetting":return h(p({},a),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case"BasicAuthAuthSetting":return h(p({},a),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case"BearerTokenAuthSetting":return h(p({},a),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case"OAuthDiscoverableAuthSetting":return h(p({},a),{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 h(p({},a),{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 h(p({},a),{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 h(p({},a),{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=E({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","class","type","placeholder","formControl","autocomplete"],[3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(r(0,"div",0)(1,"header",1)(2,"button",2),v("click",function(){return n.cancel()}),r(3,"span",3),s(4,"\u2190"),o(),s(5," Auth Settings "),o(),r(6,"h1",4),s(7),o()(),m(8,re,2,0,"p",5)(9,me,26,8,"form",6),o()),e&2&&(l(7),A(n.isEditMode()?"Edit auth setting":"New auth setting"),l(),g(n.isLoading()?8:9))},dependencies:[Z,H,W,X,L,Q,j,K,G,Y,J],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__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))}"],changeDetection:0})};export{oe as AuthSettingFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-6JMDCL65.js";import{a as k}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-6JMDCL65.js";import{a as k}from"./chunk-7TO465TS.js";import"./chunk-VCUQMGKI.js";import{c as x}from"./chunk-6XX7GME4.js";import{s as B,z as $}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as d}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as b,Db as m,Fb as l,Lc as T,Pb as w,S as _,Wa as g,ab as C,ca as i,cc as I,fc as M,ga as u,gc as R,ha as y,i as c,jc as S,lb as h,ma as P,mb as v,rb as a,sb as p,t as f,tb as s}from"./chunk-CHEXA6RY.js";var F=()=>[];function L(o,e){if(o&1){let t=b();p(0,"agentos-prompt-item",4),m("deleteRequested",function(r){u(t);let E=l(2);return y(E.deletePrompt(r))}),s()}o&2&&a("prompt",e)("platformMode",!0)}function N(o,e){if(o&1&&h(0,L,1,2,"agentos-prompt-item",3),o&2){let t,n=e.$implicit,r=l();v((t=r.resolvePrompt(n.id))?0:-1,t)}}var q=class o{router=i(x);destroyRef=i(P);promptState=i(k);refresh$=new c(void 0);prompts$=this.refresh$.pipe(_(()=>this.promptState.listPlatform()));promptItems$=this.prompts$.pipe(f(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.description}))));promptsById=new Map;constructor(){this.prompts$.pipe(d(this.destroyRef)).subscribe(e=>{this.promptsById=new Map(e.map(t=>[t.id??"",t]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"])}deletePrompt(e){this.promptState.delete(e.id??"").pipe(d(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolvePrompt(e){return this.promptsById.get(e)??null}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=g({type:o,selectors:[["agentos-platform-prompts"]],decls:5,vars:6,consts:[["promptItemTpl",""],["title","Platform Prompts","emptyMessage","No platform prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"prompt","platformMode"],[3,"deleteRequested","prompt","platformMode"]],template:function(t,n){if(t&1&&(p(0,"ds-entity-list",1),M(1,"async"),m("createRequested",function(){return n.openCreateForm()}),p(2,"ds-icon-button",2),m("action",function(){return n.goBack()}),s()(),C(3,N,1,1,"ng-template",null,0,S)),t&2){let r=w(4);a("items",R(1,3,n.promptItems$)??I(5,F))("showCreate",!0)("itemTemplate",r)}},dependencies:[$,D,B,T],styles:[".platform-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"],changeDetection:0})};export{q as PlatformPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./chunk-
|
|
1
|
+
import{a as X}from"./chunk-XZIT26QS.js";import{c as T}from"./chunk-6XX7GME4.js";import{A as Q,s as W,z as J}from"./chunk-VNO76B3S.js";import{a as j,b as N,c as H}from"./chunk-VMYKE4ZC.js";import{Bb as b,Cb as S,D as R,Db as c,Eb as A,Fb as u,Ka as l,Pb as B,Rb as F,S as P,Tb as p,Ub as M,Vb as z,Wa as y,Xb as K,ab as L,ca as v,ga as d,ha as g,jc as $,lb as _,m as U,ma as O,mb as f,mc as k,pb as q,pc as C,qb as V,qc as i,rb as h,sb as a,ta as I,tb as s,u as E,vb as x,wb as G}from"./chunk-CHEXA6RY.js";var te=(n,t)=>t.id;function ne(n,t){n&1&&(x(0,"option",3),p(1,"All namespaces"),G())}function oe(n,t){if(n&1&&(x(0,"option",4),p(1),G()),n&2){let e=t.$implicit;S("value",e.id),l(),M(e.name)}}var w=class n{namespaces=i.required();value=i(null);includeAllOption=i(!1);valueChange=C();onChange(t){let e=t.target.value;this.valueChange.emit(e===""?null:e)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=y({type:n,selectors:[["agentos-namespace-select"]],inputs:{namespaces:[1,"namespaces"],value:[1,"value"],includeAllOption:[1,"includeAllOption"]},outputs:{valueChange:"valueChange"},decls:7,vars:2,consts:[[1,"namespace-select"],[1,"namespace-select__label"],[1,"namespace-select__control",3,"change","value"],["value",""],[3,"value"]],template:function(e,o){e&1&&(x(0,"label",0)(1,"span",1),p(2,"Namespace"),G(),x(3,"select",2),A("change",function(m){return o.onChange(m)}),_(4,ne,2,0,"option",3),q(5,oe,2,2,"option",4,te),G()()),e&2&&(l(3),S("value",o.value()??""),l(),f(o.includeAllOption()?4:-1),l(),V(o.namespaces()))},styles:[".namespace-select[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem}.namespace-select__label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);white-space:nowrap}.namespace-select__control[_ngcontent-%COMP%]{padding:.35rem .6rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;cursor:pointer}.namespace-select__control[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary, #007aff)}"],changeDetection:0})};function re(n,t){if(n&1){let e=b();a(0,"span",6),p(1,"Delete?"),s(),a(2,"ds-icon-button",7),c("action",function(){d(e);let r=u();return g(r.onDeleteConfirmed())}),s(),a(3,"ds-icon-button",8),c("action",function(){d(e);let r=u();return g(r.onDeleteCancelled())}),s()}}function ie(n,t){if(n&1){let e=b();a(0,"ds-kebab-menu",9),c("itemSelected",function(r){d(e);let m=u();return g(m.onMenuAction(r))}),s()}if(n&2){let e=u();h("items",e.menuItems)}}var D=class n{router=v(T);userGroup=i.required();namespaceId=i.required();returnTo=i(void 0);deleteRequested=C();pendingDelete=I(!1);menuItems=[{key:"edit",label:"Edit group",icon:"edit"},{key:"delete",label:"Delete group",icon:"delete",variant:"danger"}];get agentCount(){return this.userGroup().agentIds.length}onMenuAction(t){switch(t){case"edit":this.router.navigate(["/agentos",this.namespaceId(),"user-groups",this.userGroup().userGroupId,"edit"],{queryParams:this.returnTo()?{returnTo:this.returnTo()}:{}});break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.userGroup())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=y({type:n,selectors:[["agentos-user-group-item"]],inputs:{userGroup:[1,"userGroup"],namespaceId:[1,"namespaceId"],returnTo:[1,"returnTo"]},outputs:{deleteRequested:"deleteRequested"},decls:9,vars:8,consts:[["role","listitem",1,"user-group-item"],[1,"user-group-item__body"],[1,"user-group-item__name"],[1,"user-group-item__meta"],[1,"user-group-item__actions"],[3,"items"],[1,"user-group-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(a(0,"div",0)(1,"div",1)(2,"span",2),p(3),s(),a(4,"span",3),p(5),s()(),a(6,"div",4),_(7,re,4,0)(8,ie,1,1,"ds-kebab-menu",5),s()()),e&2&&(F("user-group-item--pending-delete",o.pendingDelete()),l(3),M(o.userGroup().name),l(2),K(" ",o.agentCount," ",o.agentCount===1?"agent":"agents"," \xB7 ",o.userGroup().userCount," ",o.userGroup().userCount===1?"member":"members"," "),l(2),f(o.pendingDelete()?7:8))},dependencies:[Q,W],styles:[".user-group-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.user-group-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.user-group-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.user-group-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-group-item__meta[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-group-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.user-group-item[_ngcontent-%COMP%]:hover .user-group-item__actions[_ngcontent-%COMP%], .user-group-item[_ngcontent-%COMP%]:focus-within .user-group-item__actions[_ngcontent-%COMP%], .user-group-item--pending-delete[_ngcontent-%COMP%] .user-group-item__actions[_ngcontent-%COMP%]{opacity:1}.user-group-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};function ae(n,t){if(n&1){let e=b();a(0,"button",4),c("click",function(){d(e);let r=u();return g(r.onBack())}),p(1),s()}n&2&&(l(),z("\u2190 ",t))}function se(n,t){if(n&1){let e=b();a(0,"agentos-namespace-select",5),c("valueChange",function(r){d(e);let m=u();return g(m.onNamespaceChange(r))}),s()}if(n&2){let e=u();h("namespaces",t)("value",e.namespaceId())}}function le(n,t){if(n&1){let e=b();a(0,"agentos-user-group-item",7),c("deleteRequested",function(r){d(e);let m=u(2);return g(m.deleteGroup(r))}),s()}if(n&2){let e=u(2);h("userGroup",t)("namespaceId",e.namespaceId())("returnTo",e.returnTo())}}function ue(n,t){if(n&1&&_(0,le,1,3,"agentos-user-group-item",6),n&2){let e,o=t.$implicit,r=u();f((e=r.resolveGroup(o.id))?0:-1,e)}}var ee=class n{router=v(T);destroyRef=v(O);userGroupState=v(X);namespaceId=i.required();backLabel=i(void 0);namespaces=i(void 0);hideTitle=i(!1);returnTo=i(void 0);backRequested=C();namespaceChange=C();refresh=I(0);groups=H(E([N(this.namespaceId),N(this.refresh)]).pipe(P(([t])=>this.userGroupState.listByNamespace(t).pipe(R(e=>(console.error("[UserGroupList] Failed to load user groups",e),U([])))))),{initialValue:[]});groupItems=k(()=>this.groups().map(t=>({id:t.userGroupId,name:t.name})));groupsById=k(()=>new Map(this.groups().map(t=>[t.userGroupId,t])));resolveGroup(t){return this.groupsById().get(t)??null}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId(),"user-groups","new"],{queryParams:this.returnTo()?{returnTo:this.returnTo()}:{}})}deleteGroup(t){this.userGroupState.delete(t.userGroupId).pipe(j(this.destroyRef)).subscribe(()=>this.refresh.update(e=>e+1))}onBack(){this.backRequested.emit()}onNamespaceChange(t){t&&this.namespaceChange.emit(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=y({type:n,selectors:[["agentos-user-group-list"]],inputs:{namespaceId:[1,"namespaceId"],backLabel:[1,"backLabel"],namespaces:[1,"namespaces"],hideTitle:[1,"hideTitle"],returnTo:[1,"returnTo"]},outputs:{backRequested:"backRequested",namespaceChange:"namespaceChange"},decls:5,vars:5,consts:[["groupItemTpl",""],["title","User Groups","emptyMessage","No user groups yet. Create one above.","cardMinWidth","400px",3,"createRequested","hideTitle","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"user-group-list__back"],["toolbar-start","",3,"namespaces","value"],["toolbar-start","","type","button",1,"user-group-list__back",3,"click"],["toolbar-start","",3,"valueChange","namespaces","value"],[3,"userGroup","namespaceId","returnTo"],[3,"deleteRequested","userGroup","namespaceId","returnTo"]],template:function(e,o){if(e&1&&(a(0,"ds-entity-list",1),c("createRequested",function(){return o.openCreateForm()}),_(1,ae,2,1,"button",2)(2,se,1,2,"agentos-namespace-select",3),s(),L(3,ue,1,1,"ng-template",null,0,$)),e&2){let r,m=B(4);h("hideTitle",o.hideTitle())("items",o.groupItems())("showCreate",!0)("itemTemplate",m),l(),f((r=o.backLabel())?1:(r=o.namespaces())?2:-1,r)}},dependencies:[J,D,w],styles:[".user-group-list__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.user-group-list__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"],changeDetection:0})};export{w as a,D as b,ee as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as p}from"./chunk-
|
|
1
|
+
import{o as p}from"./chunk-VCUQMGKI.js";import{V as s,Z as d,a as n,ca as u,ta as a}from"./chunk-CHEXA6RY.js";var c=class o{userController=u(p);users=a([]);isLoading=a(!1);loadAll(){return this.isLoading.set(!0),this.userController.listAllUser().pipe(s({next:e=>{this.users.set(e),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)}))}createUser(e){return this.userController.createUser(e).pipe(s(()=>{this.loadAll().subscribe()}))}updateUser(e,r){let t=this.users().find(i=>i.id===e);if(!t)throw new Error(`Cannot update: user ${e} not found in state`);let U=n(n({},t),r);return this.userController.updateUser(e,U).pipe(s(i=>{this.users.update(b=>b.map(l=>l.id===i.id?i:l))}))}deleteUser(e){return this.userController.deleteUser(e).pipe(s(()=>{this.users.update(r=>r.filter(t=>t.id!==e))}))}static \u0275fac=function(r){return new(r||o)};static \u0275prov=d({token:o,factory:o.\u0275fac,providedIn:"root"})};export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-TIO4RSPY.js";import{c as $,d as k}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-TIO4RSPY.js";import{c as $,d as k}from"./chunk-VCUQMGKI.js";import{c as B}from"./chunk-6XX7GME4.js";import{s as E,z as D}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as f}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as P,Db as l,Fb as d,Lc as q,Pb as I,S as y,Wa as C,ab as A,ca as n,cc as w,fc as R,ga as m,gc as x,ha as p,i as u,jc as T,lb as b,ma as g,mb as h,rb as c,sb as a,t as M,tb as _,u as v}from"./chunk-CHEXA6RY.js";var N=()=>[];function V(r,t){if(r&1){let o=P();a(0,"agentos-ai-model-item",4),l("editRequested",function(e){m(o);let s=d(2);return p(s.onEdit(e))})("deleteRequested",function(e){m(o);let s=d(2);return p(s.deleteModel(e))}),_()}r&2&&c("model",t)}function F(r,t){if(r&1&&b(0,V,1,1,"agentos-ai-model-item",3),r&2){let o,i=t.$implicit,e=d();h((o=e.resolveModel(i.id))?0:-1,o)}}var L=class r{router=n(B);destroyRef=n(g);aiModelController=n($);aiProviderController=n(k);refresh$=new u(void 0);data$=this.refresh$.pipe(y(()=>v([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")])));modelItems$=this.data$.pipe(M(([t,o])=>{let i=new Map(o.map(e=>[e.id??"",e.name]));return t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:i.get(e.aiProviderId)??e.aiProviderId}))}));modelsById=new Map;constructor(){this.data$.pipe(f(this.destroyRef)).subscribe(([t])=>{this.modelsById=new Map(t.map(o=>[o.id??"",o]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"])}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(f(this.destroyRef)).subscribe(()=>this.refresh$.next())}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-models",t.id,"edit"])}resolveModel(t){return this.modelsById.get(t)??null}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=C({type:r,selectors:[["agentos-platform-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","Platform AI Models","emptyMessage","No platform AI models defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model"],[3,"editRequested","deleteRequested","model"]],template:function(o,i){if(o&1&&(a(0,"ds-entity-list",1),R(1,"async"),l("createRequested",function(){return i.openCreateForm()}),a(2,"ds-icon-button",2),l("action",function(){return i.goBack()}),_()(),A(3,F,1,1,"ng-template",null,0,T)),o&2){let e=I(4);c("items",x(1,3,i.modelItems$)??w(5,N))("showCreate",!0)("itemTemplate",e)}},dependencies:[D,S,E,q],styles:[".platform-ai-models__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-models__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"],changeDetection:0})};export{L as PlatformAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-FCEVFEIX.js";import{c as te}from"./chunk-4QVEFNE3.js";import{a as Z}from"./chunk-2IN2N6PV.js";import"./chunk-NWFFZ2FW.js";import{c as X}from"./chunk-RB7N2NWN.js";import{a as W}from"./chunk-6QJAB37Y.js";import{d as Q}from"./chunk-YFCRBVWD.js";import"./chunk-C2LUO2MP.js";import{c as N}from"./chunk-6XX7GME4.js";import{s as q}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as k,c as K}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import{F as J,c as B,g as R,h as A,i as L,l as O,n as j,v as Y,w as H}from"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as f,Db as c,Fb as l,Hc as $,Ka as _,Rb as E,Tb as r,Ub as u,Vb as S,Wa as z,ca as x,ga as p,ha as m,jb as P,kb as w,lb as g,ma as G,mb as v,mc as T,pb as b,qb as h,rb as U,sb as n,t as F,ta as y,tb as t,u as I,ub as M}from"./chunk-CHEXA6RY.js";var V=(o,i)=>i.value;function ie(o,i){o&1&&(n(0,"p",4),r(1,"Loading\u2026"),t())}function oe(o,i){if(o&1){let e=f();n(0,"button",18),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setThemeVariant(s.value))}),n(1,"span",19),r(2),t(),n(3,"span",20),r(4),t()()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__theme-variant--active",a.themeVariant()===e.value),P("aria-pressed",a.themeVariant()===e.value),_(2),u(e.label),_(2),u(e.description)}}function re(o,i){if(o&1){let e=f();n(0,"button",21),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setTheme(s.value))}),r(1),t()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__segmented-option--active",a.themeMode()===e.value),P("aria-pressed",a.themeMode()===e.value),_(),S(" ",e.label," ")}}function ae(o,i){if(o&1){let e=f();n(0,"button",21),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setEnterKeyBehavior(s.value))}),r(1),t()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),P("aria-pressed",a.enterKeyBehavior()===e.value),_(),S(" ",e.label," ")}}function le(o,i){if(o&1){let e=f();n(0,"form",22),c("ngSubmit",function(){p(e);let s=l(2);return m(s.save())}),n(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",23),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",23),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"label",24),r(19,"First name"),t(),M(20,"input",25),t(),n(21,"div",7)(22,"label",26),r(23,"Last name"),t(),M(24,"input",27),t(),n(25,"div",7)(26,"label",28),r(27,"Bio"),t(),M(28,"textarea",29),t()(),n(29,"div",30)(30,"button",31),r(31),t(),n(32,"button",32),c("click",function(){p(e);let s=l(2);return m(s.cancelEditing())}),r(33,"Cancel"),t()()()}if(o&2){let e=l(),a=l();U("formGroup",a.form),_(8),u(e.email),_(5),u(e.externalId),_(17),U("disabled",a.isSaving()),_(),S(" ",a.isSaving()?"Saving\u2026":"Save changes"," ")}}function se(o,i){o&1&&(n(0,"p",40),r(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),t())}function _e(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function de(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function ce(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,_e,6,0)(6,de,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function pe(o,i){if(o&1&&(n(0,"h3",41),r(1,"Integrations"),t(),n(2,"ul",42),b(3,ce,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().integrations)}}function me(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function ue(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function fe(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,me,6,0)(6,ue,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function Ce(o,i){if(o&1&&(n(0,"h3",41),r(1,"AI Providers"),t(),n(2,"ul",42),b(3,fe,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().aiProviders)}}function ge(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function ve(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function xe(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,ge,6,0)(6,ve,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function be(o,i){if(o&1&&(n(0,"h3",41),r(1,"My global auth settings"),t(),n(2,"ul",42),b(3,xe,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().authSettings)}}function he(o,i){if(o&1&&(g(0,pe,5,0),g(1,Ce,5,0),g(2,be,5,0)),o&2){let e=l(4);v(e.recap().integrations.length>0?0:-1),_(),v(e.recap().aiProviders.length>0?1:-1),_(),v(e.recap().authSettings.length>0?2:-1)}}function ye(o,i){if(o&1&&g(0,se,2,0,"p",40)(1,he,3,3),o&2){let e=l(3);v(e.recap().total===0?0:1)}}function Pe(o,i){if(o&1){let e=f();n(0,"div",17)(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",33),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",33),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"span",8),r(19,"First name"),t(),n(20,"span",33),r(21),t()(),n(22,"div",7)(23,"span",8),r(24,"Last name"),t(),n(25,"span",33),r(26),t()(),n(27,"div",34)(28,"span",8),r(29,"Bio"),t(),n(30,"span",33),r(31),t()()(),n(32,"div",30)(33,"button",35),c("click",function(){p(e);let s=l(2);return m(s.startEditing())}),r(34," Edit profile "),t()(),n(35,"div",36)(36,"button",37),c("click",function(){p(e);let s=l(2);return m(s.toggleOverrides())}),n(37,"span",38),r(38,"\u25B6"),t(),r(39," My global user configurations "),n(40,"span",39),r(41),t()(),g(42,ye,2,1),t()()}if(o&2){let e=l(),a=l();_(8),u(e.email),_(5),u(e.externalId),_(8),u(e.firstname||"\u2014"),_(5),u(e.lastname||"\u2014"),_(5),u(e.bio||"\u2014"),_(5),P("aria-expanded",a.isOverridesExpanded()),_(),E("user-profile__overrides-arrow--open",a.isOverridesExpanded()),_(4),S("(",a.recap().total,")"),_(),v(a.isOverridesExpanded()?42:-1)}}function Ee(o,i){if(o&1&&(n(0,"div",5)(1,"h2",6),r(2,"Appearance"),t(),n(3,"div",7)(4,"span",8),r(5,"Skin"),t(),n(6,"div",9),b(7,oe,5,5,"button",10,V),t()(),n(9,"div",7)(10,"span",8),r(11,"Mode"),t(),n(12,"div",11),b(13,re,2,4,"button",12,V),t()()(),n(15,"div",5)(16,"h2",6),r(17,"Composer"),t(),n(18,"div",7)(19,"span",8),r(20,"Enter key"),t(),n(21,"div",13)(22,"div",14),b(23,ae,2,4,"button",12,V),t(),n(25,"p",15),r(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),t()()()(),g(27,le,34,5,"form",16)(28,Pe,43,10,"div",17)),o&2){let e=l();_(7),h(e.themeVariantOptions),_(6),h(e.themeOptions),_(10),h(e.enterKeyOptions),_(4),v(e.isEditing()?27:28)}}function Se(o,i){o&1&&(n(0,"p",4),r(1,"Unable to load profile."),t())}var ne=class o{userState=x(W);router=x(N);location=x($);destroyRef=x(G);integrationState=x(Z);providerState=x(ee);authSettingState=x(te);themePort=x(Q);preferencesPort=x(X);isEditing=y(!1);isLoading=y(!1);isSaving=y(!1);isOverridesExpanded=y(!1);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=T(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=T(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new L({firstname:new O("",{nonNullable:!0}),lastname:new O("",{nonNullable:!0}),bio:new O("",{nonNullable:!0})});recap=K(I([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(F(([i,e,a])=>{let s=i.map(C=>({category:"integration",id:C.id??"",name:C.name,subtitle:C.integrationType})),d=e.map(C=>({category:"aiProvider",id:C.id??"",name:C.name,subtitle:C.apiType})),D=a.map(C=>({category:"authSetting",id:C.id??"",name:C.name,subtitle:C.authType}));return{integrations:s,aiProviders:d,authSettings:D,total:s.length+d.length+D.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(!0),this.userState.loadMe().pipe(k(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)})}startEditing(){this.syncFormFromState(),this.isEditing.set(!0)}cancelEditing(){this.isEditing.set(!1)}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i})}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode})}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i)}save(){this.isSaving()||(this.isSaving.set(!0),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(k(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(!1),this.isEditing.set(!1)},error:()=>this.isSaving.set(!1)}))}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null)}pendingDeleteKey=y(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i))}cancelDelete(){this.pendingDeleteKey.set(null)}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(k(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a)}})}entryKey(i){return`${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"])}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=z({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(n(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),c("action",function(){return a.goBack()}),t(),n(3,"h1",3),r(4,"My profile"),t()(),g(5,ie,2,0,"p",4)(6,Ee,29,1)(7,Se,2,0,"p",4),t()),e&2){let s;_(5),v(a.isLoading()?5:(s=a.currentUser())?6:7,s)}},dependencies:[J,j,B,R,A,H,Y,q],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}"],changeDetection:0})};export{ne as UserProfileComponent};
|
|
1
|
+
import{a as ee}from"./chunk-GNUSEOSN.js";import{c as te}from"./chunk-OOO6KSSL.js";import{a as Z}from"./chunk-4QBMPKYR.js";import"./chunk-NWFFZ2FW.js";import{c as X}from"./chunk-RB7N2NWN.js";import{a as W}from"./chunk-K2ZZYRVT.js";import{d as Q}from"./chunk-YFCRBVWD.js";import"./chunk-VCUQMGKI.js";import{c as N}from"./chunk-6XX7GME4.js";import{s as q}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as k,c as K}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import{F as J,c as B,g as R,h as A,i as L,l as O,n as j,v as Y,w as H}from"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as f,Db as c,Fb as l,Hc as $,Ka as _,Rb as E,Tb as r,Ub as u,Vb as S,Wa as z,ca as x,ga as p,ha as m,jb as P,kb as w,lb as g,ma as G,mb as v,mc as T,pb as b,qb as h,rb as U,sb as n,t as F,ta as y,tb as t,u as I,ub as M}from"./chunk-CHEXA6RY.js";var V=(o,i)=>i.value;function ie(o,i){o&1&&(n(0,"p",4),r(1,"Loading\u2026"),t())}function oe(o,i){if(o&1){let e=f();n(0,"button",18),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setThemeVariant(s.value))}),n(1,"span",19),r(2),t(),n(3,"span",20),r(4),t()()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__theme-variant--active",a.themeVariant()===e.value),P("aria-pressed",a.themeVariant()===e.value),_(2),u(e.label),_(2),u(e.description)}}function re(o,i){if(o&1){let e=f();n(0,"button",21),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setTheme(s.value))}),r(1),t()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__segmented-option--active",a.themeMode()===e.value),P("aria-pressed",a.themeMode()===e.value),_(),S(" ",e.label," ")}}function ae(o,i){if(o&1){let e=f();n(0,"button",21),c("click",function(){let s=p(e).$implicit,d=l(2);return m(d.setEnterKeyBehavior(s.value))}),r(1),t()}if(o&2){let e=i.$implicit,a=l(2);E("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),P("aria-pressed",a.enterKeyBehavior()===e.value),_(),S(" ",e.label," ")}}function le(o,i){if(o&1){let e=f();n(0,"form",22),c("ngSubmit",function(){p(e);let s=l(2);return m(s.save())}),n(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",23),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",23),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"label",24),r(19,"First name"),t(),M(20,"input",25),t(),n(21,"div",7)(22,"label",26),r(23,"Last name"),t(),M(24,"input",27),t(),n(25,"div",7)(26,"label",28),r(27,"Bio"),t(),M(28,"textarea",29),t()(),n(29,"div",30)(30,"button",31),r(31),t(),n(32,"button",32),c("click",function(){p(e);let s=l(2);return m(s.cancelEditing())}),r(33,"Cancel"),t()()()}if(o&2){let e=l(),a=l();U("formGroup",a.form),_(8),u(e.email),_(5),u(e.externalId),_(17),U("disabled",a.isSaving()),_(),S(" ",a.isSaving()?"Saving\u2026":"Save changes"," ")}}function se(o,i){o&1&&(n(0,"p",40),r(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),t())}function _e(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function de(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function ce(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,_e,6,0)(6,de,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function pe(o,i){if(o&1&&(n(0,"h3",41),r(1,"Integrations"),t(),n(2,"ul",42),b(3,ce,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().integrations)}}function me(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function ue(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function fe(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,me,6,0)(6,ue,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function Ce(o,i){if(o&1&&(n(0,"h3",41),r(1,"AI Providers"),t(),n(2,"ul",42),b(3,fe,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().aiProviders)}}function ge(o,i){if(o&1){let e=f();n(0,"span",47),r(1,"Delete?"),t(),n(2,"button",48),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.confirmDelete(s))}),r(3," Confirm "),t(),n(4,"button",49),c("click",function(){p(e);let s=l(7);return m(s.cancelDelete())}),r(5," Cancel "),t()}}function ve(o,i){if(o&1){let e=f();n(0,"button",49),c("click",function(){p(e);let s=l().$implicit,d=l(6);return m(d.armDelete(s))}),r(1," Delete "),t()}}function xe(o,i){if(o&1&&(n(0,"li",43)(1,"span",44),r(2),t(),n(3,"span",45),r(4),t(),g(5,ge,6,0)(6,ve,2,0,"button",46),t()),o&2){let e=i.$implicit,a=l(6);_(2),u(e.name),_(2),u(e.subtitle),_(),v(a.isPendingDelete(e)?5:6)}}function be(o,i){if(o&1&&(n(0,"h3",41),r(1,"My global auth settings"),t(),n(2,"ul",42),b(3,xe,7,3,"li",43,w().trackEntry,!0),t()),o&2){let e=l(5);_(3),h(e.recap().authSettings)}}function he(o,i){if(o&1&&(g(0,pe,5,0),g(1,Ce,5,0),g(2,be,5,0)),o&2){let e=l(4);v(e.recap().integrations.length>0?0:-1),_(),v(e.recap().aiProviders.length>0?1:-1),_(),v(e.recap().authSettings.length>0?2:-1)}}function ye(o,i){if(o&1&&g(0,se,2,0,"p",40)(1,he,3,3),o&2){let e=l(3);v(e.recap().total===0?0:1)}}function Pe(o,i){if(o&1){let e=f();n(0,"div",17)(1,"div",5)(2,"h2",6),r(3,"Identity"),t(),n(4,"div",7)(5,"span",8),r(6,"Email"),t(),n(7,"span",33),r(8),t()(),n(9,"div",7)(10,"span",8),r(11,"External ID"),t(),n(12,"span",33),r(13),t()()(),n(14,"div",5)(15,"h2",6),r(16,"Profile"),t(),n(17,"div",7)(18,"span",8),r(19,"First name"),t(),n(20,"span",33),r(21),t()(),n(22,"div",7)(23,"span",8),r(24,"Last name"),t(),n(25,"span",33),r(26),t()(),n(27,"div",34)(28,"span",8),r(29,"Bio"),t(),n(30,"span",33),r(31),t()()(),n(32,"div",30)(33,"button",35),c("click",function(){p(e);let s=l(2);return m(s.startEditing())}),r(34," Edit profile "),t()(),n(35,"div",36)(36,"button",37),c("click",function(){p(e);let s=l(2);return m(s.toggleOverrides())}),n(37,"span",38),r(38,"\u25B6"),t(),r(39," My global user configurations "),n(40,"span",39),r(41),t()(),g(42,ye,2,1),t()()}if(o&2){let e=l(),a=l();_(8),u(e.email),_(5),u(e.externalId),_(8),u(e.firstname||"\u2014"),_(5),u(e.lastname||"\u2014"),_(5),u(e.bio||"\u2014"),_(5),P("aria-expanded",a.isOverridesExpanded()),_(),E("user-profile__overrides-arrow--open",a.isOverridesExpanded()),_(4),S("(",a.recap().total,")"),_(),v(a.isOverridesExpanded()?42:-1)}}function Ee(o,i){if(o&1&&(n(0,"div",5)(1,"h2",6),r(2,"Appearance"),t(),n(3,"div",7)(4,"span",8),r(5,"Skin"),t(),n(6,"div",9),b(7,oe,5,5,"button",10,V),t()(),n(9,"div",7)(10,"span",8),r(11,"Mode"),t(),n(12,"div",11),b(13,re,2,4,"button",12,V),t()()(),n(15,"div",5)(16,"h2",6),r(17,"Composer"),t(),n(18,"div",7)(19,"span",8),r(20,"Enter key"),t(),n(21,"div",13)(22,"div",14),b(23,ae,2,4,"button",12,V),t(),n(25,"p",15),r(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),t()()()(),g(27,le,34,5,"form",16)(28,Pe,43,10,"div",17)),o&2){let e=l();_(7),h(e.themeVariantOptions),_(6),h(e.themeOptions),_(10),h(e.enterKeyOptions),_(4),v(e.isEditing()?27:28)}}function Se(o,i){o&1&&(n(0,"p",4),r(1,"Unable to load profile."),t())}var ne=class o{userState=x(W);router=x(N);location=x($);destroyRef=x(G);integrationState=x(Z);providerState=x(ee);authSettingState=x(te);themePort=x(Q);preferencesPort=x(X);isEditing=y(!1);isLoading=y(!1);isSaving=y(!1);isOverridesExpanded=y(!1);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=T(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=T(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new L({firstname:new O("",{nonNullable:!0}),lastname:new O("",{nonNullable:!0}),bio:new O("",{nonNullable:!0})});recap=K(I([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(F(([i,e,a])=>{let s=i.map(C=>({category:"integration",id:C.id??"",name:C.name,subtitle:C.integrationType})),d=e.map(C=>({category:"aiProvider",id:C.id??"",name:C.name,subtitle:C.apiType})),D=a.map(C=>({category:"authSetting",id:C.id??"",name:C.name,subtitle:C.authType}));return{integrations:s,aiProviders:d,authSettings:D,total:s.length+d.length+D.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(!0),this.userState.loadMe().pipe(k(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)})}startEditing(){this.syncFormFromState(),this.isEditing.set(!0)}cancelEditing(){this.isEditing.set(!1)}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i})}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode})}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i)}save(){this.isSaving()||(this.isSaving.set(!0),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(k(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(!1),this.isEditing.set(!1)},error:()=>this.isSaving.set(!1)}))}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null)}pendingDeleteKey=y(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i))}cancelDelete(){this.pendingDeleteKey.set(null)}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(k(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a)}})}entryKey(i){return`${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"])}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=z({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(n(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),c("action",function(){return a.goBack()}),t(),n(3,"h1",3),r(4,"My profile"),t()(),g(5,ie,2,0,"p",4)(6,Ee,29,1)(7,Se,2,0,"p",4),t()),e&2){let s;_(5),v(a.isLoading()?5:(s=a.currentUser())?6:7,s)}},dependencies:[J,j,B,R,A,H,Y,q],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}"],changeDetection:0})};export{ne as UserProfileComponent};
|