@whoz-oss/coday-client 0.243.0 → 0.244.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/browser/{chunk-TRFKVZGV.js → chunk-2QDRHKK5.js} +1 -1
  2. package/browser/{chunk-JCKKIKVU.js → chunk-4CNY7Z64.js} +1 -1
  3. package/browser/{chunk-NEVEN2BG.js → chunk-4FGWE3EW.js} +1 -1
  4. package/browser/{chunk-HN4TBO7J.js → chunk-5N6DUZII.js} +1 -1
  5. package/browser/{chunk-IN5SVY4U.js → chunk-5OGZHNUE.js} +1 -1
  6. package/browser/{chunk-6BMCL5TR.js → chunk-5PVR7BPQ.js} +1 -1
  7. package/browser/{chunk-36EOCF7B.js → chunk-5Y2Q6WKL.js} +1 -1
  8. package/browser/{chunk-MZBZJFIH.js → chunk-76HYDFUL.js} +1 -1
  9. package/browser/{chunk-62AZ3TER.js → chunk-7H4TBVB7.js} +1 -1
  10. package/browser/{chunk-P3AFMA53.js → chunk-7O6TY5IW.js} +1 -1
  11. package/browser/{chunk-LU3ZSYWJ.js → chunk-ADEIEQGJ.js} +1 -1
  12. package/browser/{chunk-PXY6PLET.js → chunk-AK746XRX.js} +1 -1
  13. package/browser/{chunk-KKYAHLLD.js → chunk-BWBZLC7A.js} +1 -1
  14. package/browser/{chunk-GBTVBYVO.js → chunk-CSHG3PLJ.js} +1 -1
  15. package/browser/{chunk-AV3U5ZDG.js → chunk-CU7SABOQ.js} +1 -1
  16. package/browser/{chunk-WH2T6TJR.js → chunk-ECISS7V2.js} +1 -1
  17. package/browser/{chunk-QCC2HSMN.js → chunk-ENRRDIUM.js} +1 -1
  18. package/browser/{chunk-ZS3GOED4.js → chunk-F4ZRQ6MH.js} +1 -1
  19. package/browser/chunk-FA2MVU23.js +1 -0
  20. package/browser/{chunk-GWUHK3IY.js → chunk-GLFQ37PU.js} +1 -1
  21. package/browser/{chunk-YGBFW4ZS.js → chunk-GS2CQHR7.js} +1 -1
  22. package/browser/{chunk-KH3XUBG3.js → chunk-GSUU7JSY.js} +1 -1
  23. package/browser/{chunk-6UXZYGDR.js → chunk-H6NBS4JE.js} +1 -1
  24. package/browser/{chunk-FV7MYI7I.js → chunk-I4RHXOIC.js} +1 -1
  25. package/browser/{chunk-KZ2MXYPS.js → chunk-KJJPVCIH.js} +1 -1
  26. package/browser/chunk-KWJJEVAI.js +1 -0
  27. package/browser/{chunk-QA4DQZOM.js → chunk-LHKOA7FX.js} +1 -1
  28. package/browser/{chunk-FOUZFGE6.js → chunk-LUB22VNT.js} +1 -1
  29. package/browser/{chunk-6QIZQ7GE.js → chunk-MFSY4HYK.js} +1 -1
  30. package/browser/{chunk-LYXZJWHW.js → chunk-MIAKSSSF.js} +1 -1
  31. package/browser/{chunk-XFS5RNFU.js → chunk-N2NJQ7DJ.js} +1 -1
  32. package/browser/{chunk-HY5SN7AG.js → chunk-NNUJIQ6R.js} +1 -1
  33. package/browser/{chunk-TMQGM3DO.js → chunk-NYUYHMIH.js} +1 -1
  34. package/browser/{chunk-JMRUD2BW.js → chunk-ONZVOEJQ.js} +1 -1
  35. package/browser/chunk-P6WNH2KJ.js +1 -0
  36. package/browser/{chunk-VNLBXJU6.js → chunk-QTXEWRHZ.js} +1 -1
  37. package/browser/{chunk-OY6A2XLL.js → chunk-QXBTTCPM.js} +1 -1
  38. package/browser/{chunk-NIV7FMON.js → chunk-RQKLSUW5.js} +1 -1
  39. package/browser/{chunk-UU5QELSX.js → chunk-S5QSZK6N.js} +1 -1
  40. package/browser/chunk-SFQE4GQ6.js +1 -0
  41. package/browser/{chunk-RGGNQESF.js → chunk-SZM3NJVZ.js} +1 -1
  42. package/browser/{chunk-UAHVURDD.js → chunk-TNSH3NBF.js} +1 -1
  43. package/browser/{chunk-IV7SJSBN.js → chunk-U3AHBQTX.js} +1 -1
  44. package/browser/{chunk-IYEDRCU5.js → chunk-U7ZJFIOR.js} +1 -1
  45. package/browser/{chunk-D5BPAYOR.js → chunk-UO7SKQEC.js} +1 -1
  46. package/browser/{chunk-BLRBIAYK.js → chunk-UQTA3ACH.js} +1 -1
  47. package/browser/{chunk-35S3IW2A.js → chunk-UWYJO2DN.js} +1 -1
  48. package/browser/{chunk-M5ZWYOBX.js → chunk-VLDPXI7G.js} +1 -1
  49. package/browser/{chunk-R2NWLPS6.js → chunk-VVFVGWIQ.js} +1 -1
  50. package/browser/{chunk-MQEDNZF7.js → chunk-VZOBZ3DD.js} +1 -1
  51. package/browser/chunk-W7A7CPWM.js +1 -0
  52. package/browser/{chunk-N2F3TQJA.js → chunk-WMHS3NSI.js} +1 -1
  53. package/browser/{chunk-4T6SALXS.js → chunk-X5ZRXGFA.js} +1 -1
  54. package/browser/{chunk-5IIN2VT5.js → chunk-X73LZ3QV.js} +1 -1
  55. package/browser/{chunk-3MTFWGAR.js → chunk-XAEUGARN.js} +1 -1
  56. package/browser/chunk-XJYEZL5J.js +1 -0
  57. package/browser/{chunk-Y37OZMXI.js → chunk-XZRVHU66.js} +1 -1
  58. package/browser/{chunk-FELLJOVH.js → chunk-ZQZHBROX.js} +1 -1
  59. package/browser/{chunk-3MREZSO7.js → chunk-ZXQEKBPA.js} +1 -1
  60. package/browser/index.html +1 -1
  61. package/browser/{main-YKFAFCDV.js → main-JHPNU2VL.js} +1 -1
  62. package/package.json +1 -1
  63. package/browser/chunk-57XIXFX3.js +0 -1
  64. package/browser/chunk-EAVXJ7QN.js +0 -1
  65. package/browser/chunk-LQOQ3VK5.js +0 -1
  66. package/browser/chunk-MH3KTYRA.js +0 -1
  67. package/browser/chunk-QBT6LKOQ.js +0 -1
  68. package/browser/chunk-TET2CIOZ.js +0 -1
@@ -1 +1 @@
1
- import{j as $}from"./chunk-BLRBIAYK.js";import{Bb as M,Eb as _,Fb as s,Ka as h,P as T,Qb as O,Rb as E,Tb as p,Wa as V,Z as w,ca as k,ga as m,ha as d,i as g,ia as u,ja as C,lb as x,mb as f,pc as v,qc as c,ta as N,vb as i,wb as o,xb as l}from"./chunk-CHEXA6RY.js";var b=class{_namespaces$=new g([]);_selected$=new g(null);namespaces$=this._namespaces$.asObservable();selectedNamespace$=this._selected$.asObservable();constructor(t){t.subscribe(e=>{this._namespaces$.next(e),this._selected$.getValue()===null&&e.length>0&&this._selected$.next(e[0]??null)})}selectNamespace(t){let e=this._namespaces$.getValue().find(r=>r.id===t)??null;this._selected$.next(e)}};var S=class n{namespaceApi=k($);_initialized$=new g(!1);initialized$=this._initialized$.asObservable();activeNamespaceId=N(null);state=null;get namespaces$(){return this.getState().namespaces$}get selectedNamespace$(){return this.getState().selectedNamespace$}init(){if(this._initialized$.getValue())return;console.log("init 2");let t=this.namespaceApi.listAllNamespace().pipe(T(1));this.state=new b(t),t.subscribe({next:()=>this._initialized$.next(!0),error:()=>{this._initialized$.next(!0)}})}selectNamespace(t){this.activeNamespaceId.set(t),this.getState().selectNamespace(t)}getState(){return this.state||(this.state=new b(new g([]).asObservable())),this.state}static \u0275fac=function(e){return new(e||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};function L(n,t){if(n&1){let e=M();i(0,"button",2),_("click",function(){m(e);let a=s(2);return d(a.onNavigate("/agentos/admin"))}),u(),i(1,"svg",3),l(2,"path",15),o(),p(3," Administration "),o()}}function U(n,t){n&1&&(i(0,"span",14),p(1,"On"),o())}function z(n,t){n&1&&(u(),i(0,"svg",3),l(1,"circle",16)(2,"path",17),o(),p(3," Light mode "))}function A(n,t){n&1&&(u(),i(0,"svg",3),l(1,"path",18),o(),p(2," Dark mode "))}function I(n,t){if(n&1){let e=M();i(0,"div",0),_("click",function(a){m(e);let y=s();return d(y.onClose(a))})("keyup.escape",function(a){m(e);let y=s();return d(y.onClose(a))}),o(),i(1,"div",1)(2,"button",2),_("click",function(){m(e);let a=s();return d(a.onNavigate("/agentos/user"))}),u(),i(3,"svg",3),l(4,"circle",4)(5,"path",5),o(),p(6," User settings "),o(),x(7,L,4,0,"button",6),C(),l(8,"div",7),i(9,"button",2),_("click",function(){m(e);let a=s();return d(a.onNavigate("/agentos/namespaces"))}),u(),i(10,"svg",3),l(11,"rect",8)(12,"rect",9)(13,"rect",10)(14,"rect",11),o(),p(15," Namespaces "),o(),C(),i(16,"button",2),_("click",function(){m(e);let a=s();return d(a.onLogsToggle())}),u(),i(17,"svg",3),l(18,"polyline",12)(19,"line",13),o(),p(20," Technical logs "),x(21,U,2,0,"span",14),o(),C(),l(22,"div",7),i(23,"button",2),_("click",function(){m(e);let a=s();return d(a.onThemeToggle())}),x(24,z,4,0)(25,A,3,0),o()()}if(n&2){let e=s();h(),O("top",e.variant()==="compact"?e.fixedTop():null,"px")("left",e.variant()==="compact"?e.fixedLeft():null,"px"),E("shell-user-menu__overlay--topbar",e.variant()==="topbar")("shell-user-menu__overlay--mobile",e.variant()==="mobile")("shell-user-menu__overlay--compact",e.variant()==="compact"),h(6),f(e.isAdmin()?7:-1),h(9),E("shell-user-menu__item--active",e.showTechnical()),h(5),f(e.showTechnical()?21:-1),h(3),f(e.isDark()?24:25)}}var D=class n{open=c.required();isAdmin=c.required();isDark=c.required();themeVariant=c.required();showTechnical=c.required();variant=c("desktop");fixedTop=c(0);fixedLeft=c(0);navigateTo=v();themeToggled=v();themeVariantChanged=v();logsToggled=v();closed=v();onNavigate(t){this.navigateTo.emit(t)}onThemeToggle(){this.themeToggled.emit()}onThemeVariantChange(t){this.themeVariantChanged.emit(t)}onLogsToggle(){this.logsToggled.emit()}onClose(t){t.stopPropagation(),this.closed.emit(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=V({type:n,selectors:[["agentos-shell-user-menu"]],inputs:{open:[1,"open"],isAdmin:[1,"isAdmin"],isDark:[1,"isDark"],themeVariant:[1,"themeVariant"],showTechnical:[1,"showTechnical"],variant:[1,"variant"],fixedTop:[1,"fixedTop"],fixedLeft:[1,"fixedLeft"]},outputs:{navigateTo:"navigateTo",themeToggled:"themeToggled",themeVariantChanged:"themeVariantChanged",logsToggled:"logsToggled",closed:"closed"},decls:1,vars:1,consts:[["role","presentation","tabindex","-1",1,"shell-user-menu__backdrop",3,"click","keyup.escape"],[1,"shell-user-menu__overlay"],["type","button",1,"shell-user-menu__item",3,"click"],["width","15","height","15","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["cx","12","cy","8","r","4"],["d","M20 21a8 8 0 0 0-16 0"],["type","button",1,"shell-user-menu__item"],[1,"shell-user-menu__separator"],["width","7","height","7","x","3","y","3"],["width","7","height","7","x","14","y","3"],["width","7","height","7","x","14","y","14"],["width","7","height","7","x","3","y","14"],["points","4 17 10 11 4 5"],["x1","12","x2","20","y1","19","y2","19"],[1,"shell-user-menu__item-badge"],["d","M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1z"],["cx","12","cy","12","r","4"],["d","M12 2v2M12 20v2m-7.07-14.07 1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2m-4.93-7.07-1.41 1.41M6.34 17.66l-1.41 1.41"],["d","M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"]],template:function(e,r){e&1&&x(0,I,26,15),e&2&&f(r.open()?0:-1)},styles:[".shell-user-menu__backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:199}.shell-user-menu__overlay[_ngcontent-%COMP%]{position:absolute;bottom:calc(100% + 6px);right:0;min-width:226px;z-index:200;background:var(--color-bg);border:1px solid var(--color-divider);box-shadow:var(--shadow-lg)}.shell-user-menu__overlay--topbar[_ngcontent-%COMP%]{bottom:auto;top:calc(100% + 6px)}.shell-user-menu__overlay--mobile[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 4px);right:16px;left:auto;z-index:300}.shell-user-menu__overlay--compact[_ngcontent-%COMP%]{position:fixed;bottom:auto;right:auto;z-index:500;transform:translateY(-100%)}.shell-user-menu__item[_ngcontent-%COMP%]{appearance:none;background:transparent;border:none;margin:0;font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;display:flex;align-items:center;gap:10px;width:100%;padding:8px 12px;font-size:13.5px;color:var(--color-text);text-align:left;transition:background .1s}.shell-user-menu__item[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--color-text) 6%,transparent)}.shell-user-menu__item[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--color-neutral-600);flex-shrink:0}.shell-user-menu__item--active[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-accent) 10%,transparent);color:var(--color-accent-700)}.shell-user-menu__item--active[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--color-accent-700)}.shell-user-menu__item-badge[_ngcontent-%COMP%]{margin-left:auto;font-size:10px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--color-accent-700);border:1px solid var(--color-accent-300);padding:1px 5px}.shell-user-menu__separator[_ngcontent-%COMP%]{height:1px;background:var(--color-divider);margin:4px;border:none}"],changeDetection:0})};export{S as a,D as b};
1
+ import{j as $}from"./chunk-UQTA3ACH.js";import{Bb as M,Eb as _,Fb as s,Ka as h,P as T,Qb as O,Rb as E,Tb as p,Wa as V,Z as w,ca as k,ga as m,ha as d,i as g,ia as u,ja as C,lb as x,mb as f,pc as v,qc as c,ta as N,vb as i,wb as o,xb as l}from"./chunk-CHEXA6RY.js";var b=class{_namespaces$=new g([]);_selected$=new g(null);namespaces$=this._namespaces$.asObservable();selectedNamespace$=this._selected$.asObservable();constructor(t){t.subscribe(e=>{this._namespaces$.next(e),this._selected$.getValue()===null&&e.length>0&&this._selected$.next(e[0]??null)})}selectNamespace(t){let e=this._namespaces$.getValue().find(r=>r.id===t)??null;this._selected$.next(e)}};var S=class n{namespaceApi=k($);_initialized$=new g(!1);initialized$=this._initialized$.asObservable();activeNamespaceId=N(null);state=null;get namespaces$(){return this.getState().namespaces$}get selectedNamespace$(){return this.getState().selectedNamespace$}init(){if(this._initialized$.getValue())return;console.log("init 2");let t=this.namespaceApi.listAllNamespace().pipe(T(1));this.state=new b(t),t.subscribe({next:()=>this._initialized$.next(!0),error:()=>{this._initialized$.next(!0)}})}selectNamespace(t){this.activeNamespaceId.set(t),this.getState().selectNamespace(t)}getState(){return this.state||(this.state=new b(new g([]).asObservable())),this.state}static \u0275fac=function(e){return new(e||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};function L(n,t){if(n&1){let e=M();i(0,"button",2),_("click",function(){m(e);let a=s(2);return d(a.onNavigate("/agentos/admin"))}),u(),i(1,"svg",3),l(2,"path",15),o(),p(3," Administration "),o()}}function U(n,t){n&1&&(i(0,"span",14),p(1,"On"),o())}function z(n,t){n&1&&(u(),i(0,"svg",3),l(1,"circle",16)(2,"path",17),o(),p(3," Light mode "))}function A(n,t){n&1&&(u(),i(0,"svg",3),l(1,"path",18),o(),p(2," Dark mode "))}function I(n,t){if(n&1){let e=M();i(0,"div",0),_("click",function(a){m(e);let y=s();return d(y.onClose(a))})("keyup.escape",function(a){m(e);let y=s();return d(y.onClose(a))}),o(),i(1,"div",1)(2,"button",2),_("click",function(){m(e);let a=s();return d(a.onNavigate("/agentos/user"))}),u(),i(3,"svg",3),l(4,"circle",4)(5,"path",5),o(),p(6," User settings "),o(),x(7,L,4,0,"button",6),C(),l(8,"div",7),i(9,"button",2),_("click",function(){m(e);let a=s();return d(a.onNavigate("/agentos/namespaces"))}),u(),i(10,"svg",3),l(11,"rect",8)(12,"rect",9)(13,"rect",10)(14,"rect",11),o(),p(15," Namespaces "),o(),C(),i(16,"button",2),_("click",function(){m(e);let a=s();return d(a.onLogsToggle())}),u(),i(17,"svg",3),l(18,"polyline",12)(19,"line",13),o(),p(20," Technical logs "),x(21,U,2,0,"span",14),o(),C(),l(22,"div",7),i(23,"button",2),_("click",function(){m(e);let a=s();return d(a.onThemeToggle())}),x(24,z,4,0)(25,A,3,0),o()()}if(n&2){let e=s();h(),O("top",e.variant()==="compact"?e.fixedTop():null,"px")("left",e.variant()==="compact"?e.fixedLeft():null,"px"),E("shell-user-menu__overlay--topbar",e.variant()==="topbar")("shell-user-menu__overlay--mobile",e.variant()==="mobile")("shell-user-menu__overlay--compact",e.variant()==="compact"),h(6),f(e.isAdmin()?7:-1),h(9),E("shell-user-menu__item--active",e.showTechnical()),h(5),f(e.showTechnical()?21:-1),h(3),f(e.isDark()?24:25)}}var D=class n{open=c.required();isAdmin=c.required();isDark=c.required();themeVariant=c.required();showTechnical=c.required();variant=c("desktop");fixedTop=c(0);fixedLeft=c(0);navigateTo=v();themeToggled=v();themeVariantChanged=v();logsToggled=v();closed=v();onNavigate(t){this.navigateTo.emit(t)}onThemeToggle(){this.themeToggled.emit()}onThemeVariantChange(t){this.themeVariantChanged.emit(t)}onLogsToggle(){this.logsToggled.emit()}onClose(t){t.stopPropagation(),this.closed.emit(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=V({type:n,selectors:[["agentos-shell-user-menu"]],inputs:{open:[1,"open"],isAdmin:[1,"isAdmin"],isDark:[1,"isDark"],themeVariant:[1,"themeVariant"],showTechnical:[1,"showTechnical"],variant:[1,"variant"],fixedTop:[1,"fixedTop"],fixedLeft:[1,"fixedLeft"]},outputs:{navigateTo:"navigateTo",themeToggled:"themeToggled",themeVariantChanged:"themeVariantChanged",logsToggled:"logsToggled",closed:"closed"},decls:1,vars:1,consts:[["role","presentation","tabindex","-1",1,"shell-user-menu__backdrop",3,"click","keyup.escape"],[1,"shell-user-menu__overlay"],["type","button",1,"shell-user-menu__item",3,"click"],["width","15","height","15","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["cx","12","cy","8","r","4"],["d","M20 21a8 8 0 0 0-16 0"],["type","button",1,"shell-user-menu__item"],[1,"shell-user-menu__separator"],["width","7","height","7","x","3","y","3"],["width","7","height","7","x","14","y","3"],["width","7","height","7","x","14","y","14"],["width","7","height","7","x","3","y","14"],["points","4 17 10 11 4 5"],["x1","12","x2","20","y1","19","y2","19"],[1,"shell-user-menu__item-badge"],["d","M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1z"],["cx","12","cy","12","r","4"],["d","M12 2v2M12 20v2m-7.07-14.07 1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2m-4.93-7.07-1.41 1.41M6.34 17.66l-1.41 1.41"],["d","M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"]],template:function(e,r){e&1&&x(0,I,26,15),e&2&&f(r.open()?0:-1)},styles:[".shell-user-menu__backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:199}.shell-user-menu__overlay[_ngcontent-%COMP%]{position:absolute;bottom:calc(100% + 6px);right:0;min-width:226px;z-index:200;background:var(--color-bg);border:1px solid var(--color-divider);box-shadow:var(--shadow-lg)}.shell-user-menu__overlay--topbar[_ngcontent-%COMP%]{bottom:auto;top:calc(100% + 6px)}.shell-user-menu__overlay--mobile[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 4px);right:16px;left:auto;z-index:300}.shell-user-menu__overlay--compact[_ngcontent-%COMP%]{position:fixed;bottom:auto;right:auto;z-index:500;transform:translateY(-100%)}.shell-user-menu__item[_ngcontent-%COMP%]{appearance:none;background:transparent;border:none;margin:0;font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;display:flex;align-items:center;gap:10px;width:100%;padding:8px 12px;font-size:13.5px;color:var(--color-text);text-align:left;transition:background .1s}.shell-user-menu__item[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--color-text) 6%,transparent)}.shell-user-menu__item[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--color-neutral-600);flex-shrink:0}.shell-user-menu__item--active[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-accent) 10%,transparent);color:var(--color-accent-700)}.shell-user-menu__item--active[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{color:var(--color-accent-700)}.shell-user-menu__item-badge[_ngcontent-%COMP%]{margin-left:auto;font-size:10px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--color-accent-700);border:1px solid var(--color-accent-300);padding:1px 5px}.shell-user-menu__separator[_ngcontent-%COMP%]{height:1px;background:var(--color-divider);margin:4px;border:none}"],changeDetection:0})};export{S as a,D as b};
@@ -1 +1 @@
1
- import{a as E}from"./chunk-TFW43ZTS.js";import{c as $}from"./chunk-N2F3TQJA.js";import"./chunk-NWFFZ2FW.js";import"./chunk-MQEDNZF7.js";import"./chunk-BLRBIAYK.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
+ import{a as E}from"./chunk-TFW43ZTS.js";import{c as $}from"./chunk-WMHS3NSI.js";import"./chunk-NWFFZ2FW.js";import"./chunk-VZOBZ3DD.js";import"./chunk-UQTA3ACH.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,4 +1,4 @@
1
- import{a as _n}from"./chunk-EAVXJ7QN.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return O(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return O(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
1
+ import{a as _n}from"./chunk-SFQE4GQ6.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return O(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return O(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
2
2
 
3
3
  `),this.sessionHadTranscript=!1),this.pendingLineBreaksTimeout=null},500)}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null)}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t)}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...")},2e3)}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking..."}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite=""}))}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus()},50)}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e))}))}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n)},0)),setTimeout(()=>this.adjustTextareaHeight(),10)}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available")}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete()}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete()}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete()}}hideAutocomplete(){this.autocompleteVisible=!1,this.autocompleteItems=[],this.selectedAutocompleteIndex=0}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else{this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2)}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else{let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}},0)}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem()}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},0)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=S({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&ue(bi,7)(Ci,5),t&2){let o;Z(o=ee())&&(n.messageInput=o.first),Z(o=ee())&&(n.fileInput=o.first)}},hostBindings:function(t,n){t&1&&h("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},zt)},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Y],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=_();a(0,"div",2),g(1,_i,3,0,"div",3),g(2,xi,3,0,"div",3),g(3,Ti,3,0,"div",4),a(4,"div",5)(5,"textarea",6,0),He("ngModelChange",function(d){return f(o),Re(n.message,d)||(n.message=d),b(d)}),h("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return f(o),n.isFocused=!0,b(n.textareaFocused.emit())})("blur",function(){return n.isFocused=!1}),s(),g(7,Pi,4,3,"div",7),s()()}t&2&&(c(),u(!n.isVoiceMessageMode&&n.isRecording?1:-1),c(),u(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),c(),u(n.autocompleteVisible?3:-1),c(),N("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(),Fe("ngModel",n.message),C("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(2),u(n.isSessionInitializing?-1:7))},dependencies:[Ge,We,qe,Ye,In,Je],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}']})};var be=class i{unreadCountSubject=new Ie(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized")}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t)}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"))}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset")}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var et=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=m(be);project=m(X);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){Ft([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t)})}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n)}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle()}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var tt=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var ki=(i,e)=>e.label;function Ii(i,e){if(i&1){let t=_();a(0,"button",2),h("click",function(o){let r=f(t).$implicit,d=l();return b(d.executeAction(r,o))}),a(1,"mat-icon"),p(2),s()()}if(i&2){let t=e.$implicit;oe("title",t.tooltip||t.label),c(),oe("aria-label",t.label),c(),w(t.icon)}}var nt=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=S({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),V(1,Ii,3,3,"button",1,ki),s()),t&2&&(c(),L(n.actions))},dependencies:[j,re,R],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"]})};var J=class i{renderer;constructor(){this.renderer=new wn,this.configureRenderer()}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>')}return o}}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return!1;if(e.startsWith("//"))return!0;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return!1}}escapeHtml(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return O(this,null,function*(){let t=yield Tn.parse(e,{renderer:this.renderer,breaks:!0,gfm:!0});return Sn.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var Di=i=>({"user-message-wrapper":i});function Ai(i,e){if(i&1&&(a(0,"div",4)(1,"div",8),p(2),s()()),i&2){let t=l(2);c(2),he(" ",t.message.speaker," ")}}function Fi(i,e){if(i&1&&(a(0,"time",6),p(1),s()),i&2){let t=l(2);c(),w(t.formattedTimestamp)}}function Ri(i,e){if(i&1&&(a(0,"div",7),x(1,"app-message-context-menu",9),s()),i&2){let t=l(2);c(),C("actions",t.actions)}}function Hi(i,e){if(i&1&&(g(0,Ai,3,1,"div",4),x(1,"div",5),g(2,Fi,2,1,"time",6),g(3,Ri,2,1,"div",7)),i&2){let t=l();u(t.shouldShowSpeaker?0:-1),c(),C("innerHTML",t.renderedContent,H),c(),u(t.formattedTimestamp?2:-1),c(),u(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1)}}function Vi(i,e){if(i&1&&x(0,"span",12),i&2){let t=l(3);C("innerHTML",t.renderedContent,H)}}function Li(i,e){if(i&1&&(a(0,"span",13),p(1),s()),i&2){let t=l(3);c(),w(t.collapsedErrorText)}}function zi(i,e){i&1&&p(0," Show less \u25B2 ")}function Ni(i,e){i&1&&p(0," Show more \u25BC ")}function $i(i,e){if(i&1){let t=_();a(0,"div",10),g(1,Vi,1,1,"span",12)(2,Li,2,1,"span",13),a(3,"button",14),h("click",function(){f(t);let o=l(2);return b(o.toggleErrorExpanded())}),g(4,zi,1,0)(5,Ni,1,0),s()()}if(i&2){let t=l(2);c(),u(t.isErrorExpanded()?1:2),c(3),u(t.isErrorExpanded()?4:5)}}function ji(i,e){i&1&&p(0," \u25B2 ")}function Ui(i,e){i&1&&p(0," \u25BC ")}function Bi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Wi(i,e){if(i&1&&(a(0,"pre",18),p(1),s()),i&2){let t=l(3);c(),w(t.message.fullContent)}}function qi(i,e){if(i&1){let t=_();a(0,"div",15),x(1,"span",12),a(2,"button",16),h("click",function(){f(t);let o=l(2);return b(o.toggleTechnicalExpanded())}),g(3,ji,1,0)(4,Ui,1,0),s(),g(5,Bi,2,1,"a",17),s(),g(6,Wi,2,1,"pre",18)}if(i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(2),u(t.isTechnicalExpanded()?3:4),c(2),u(t.eventLink?5:-1),c(),u(t.isTechnicalExpanded()?6:-1)}}function Yi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Gi(i,e){if(i&1&&(a(0,"div",11),x(1,"span",12),g(2,Yi,2,1,"a",17),s()),i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(),u(t.eventLink?2:-1)}}function Qi(i,e){if(i&1&&g(0,$i,6,2,"div",10)(1,qi,7,4)(2,Gi,3,2,"div",11),i&2){let t=l();u(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2)}}function Xi(i,e){if(i&1&&(a(0,"div",2),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}function Ki(i,e){if(i&1&&(a(0,"div",3),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}var Ce=class i{destroy$=new B;message;canDelete=!0;isOtherUser=!1;containingThreadId;copyRequested=new M;deleteRequested=new M;renderedContent="";shouldHideTechnical=!1;shouldHideWarning=!1;isErrorExpanded=W(!1);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=W(!1);sanitizer=m(Q);notificationService=m(yn);preferencesService=m(se);projectState=m(X);threadState=m(K);markdownService=m(J);get messageClasses(){return{[this.message.role]:!0,[this.message.type]:!0,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return O(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(F(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e}),this.preferencesService.hideWarningMessages$.pipe(F(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=m(Mt);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?!1:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
4
4
  `)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e)}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e)}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
@@ -1 +1 @@
1
- import{o as l}from"./chunk-BLRBIAYK.js";import{V as o,Z as s,a as n,ca as a,ta as i}from"./chunk-CHEXA6RY.js";var u=class t{userController=a(l);currentUser=i(null);loadMe(){return this.userController.getMeUser().pipe(o(r=>this.currentUser.set(r)))}updateMe(r){let e=this.currentUser();if(!e)throw new Error("Cannot update: current user not loaded");if(!e.id)throw new Error("Cannot update: current user has no id");let c=n(n({},e),r);return this.userController.updateUser(e.id,c).pipe(o(d=>this.currentUser.set(d)))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=s({token:t,factory:t.\u0275fac,providedIn:"root"})};export{u as a};
1
+ import{o as l}from"./chunk-UQTA3ACH.js";import{V as o,Z as s,a as n,ca as a,ta as i}from"./chunk-CHEXA6RY.js";var u=class t{userController=a(l);currentUser=i(null);loadMe(){return this.userController.getMeUser().pipe(o(r=>this.currentUser.set(r)))}updateMe(r){let e=this.currentUser();if(!e)throw new Error("Cannot update: current user not loaded");if(!e.id)throw new Error("Cannot update: current user has no id");let c=n(n({},e),r);return this.userController.updateUser(e.id,c).pipe(o(d=>this.currentUser.set(d)))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=s({token:t,factory:t.\u0275fac,providedIn:"root"})};export{u as a};
@@ -0,0 +1 @@
1
+ import{a as le}from"./chunk-UO7SKQEC.js";import{A as H,b as G,y as x,z as u}from"./chunk-UQTA3ACH.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 y}from"./chunk-NWFFZ2FW.js";import{a as f}from"./chunk-MQEDNZF7.js";import{e as b}from"./chunk-BLRBIAYK.js";import{D as a,P as D,S as T,V as S,Z as m,a as h,b as A,ca as c,i as l,m as o,t as r,u as g}from"./chunk-CHEXA6RY.js";var q=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],J={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},_="none",C="me",I={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},U={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function E(n){let t=I[n.authType];return t?A(h({},n),{authType:t}):n}function d(n){return R(n)}function O(n){return n.map(R)}function R(n){let t=n;if(typeof t.authType=="string"){let e=U[t.authType];if(e)return A(h({},t),{authType:e})}return n}var v=class n{controller=c(b);userState=c(f);refresh$=new l(void 0);namespaceId$=new l(null);vm$=g([this.namespaceId$,this.refresh$]).pipe(T(([t])=>{let e=this.loadPlatformSettings().pipe(a(()=>o([])));return t?g([e,this.loadNamespaceSettings(t).pipe(a(()=>o([]))),this.loadUserSettings(t).pipe(a(()=>o([]))),this.loadUserSettings("global").pipe(a(()=>o([])))]).pipe(r(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):g([e,this.loadNamespaceSettings("").pipe(a(()=>o([]))),this.loadUserSettings("global").pipe(a(()=>o([])))]).pipe(r(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),D({bufferSize:1,refCount:!0}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t)}refresh(){this.refresh$.next()}loadUserSettings(t){let e=t==="global"?_:t;return this.controller.listAuthSetting(e,C).pipe(r(i=>O(i)))}userGlobal$=y(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting().pipe(r(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(r(e=>O(e))):o([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(r(i=>d(i)))}create(t,e,i){let u=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!u)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(i===void 0||i===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!i)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let p=E(A(h({},t),{namespaceId:e==="namespace"||e==="userOnNs"?i??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?u:void 0}));return this.controller.createAuthSetting(p).pipe(r(B=>d(B)),S(()=>this.refresh()))}update(t,e,i){let s=E(A(h({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(r(u=>d(u)),S(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(S(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=m({token:n,factory:n.\u0275fac,providedIn:"root"})};export{q as a,J as b,v as c};
1
+ import{a as y}from"./chunk-NWFFZ2FW.js";import{a as f}from"./chunk-VZOBZ3DD.js";import{e as b}from"./chunk-UQTA3ACH.js";import{D as a,P as D,S as T,V as S,Z as m,a as h,b as A,ca as c,i as l,m as o,t as r,u as g}from"./chunk-CHEXA6RY.js";var q=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],J={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},_="none",C="me",I={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},U={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function E(n){let t=I[n.authType];return t?A(h({},n),{authType:t}):n}function d(n){return R(n)}function O(n){return n.map(R)}function R(n){let t=n;if(typeof t.authType=="string"){let e=U[t.authType];if(e)return A(h({},t),{authType:e})}return n}var v=class n{controller=c(b);userState=c(f);refresh$=new l(void 0);namespaceId$=new l(null);vm$=g([this.namespaceId$,this.refresh$]).pipe(T(([t])=>{let e=this.loadPlatformSettings().pipe(a(()=>o([])));return t?g([e,this.loadNamespaceSettings(t).pipe(a(()=>o([]))),this.loadUserSettings(t).pipe(a(()=>o([]))),this.loadUserSettings("global").pipe(a(()=>o([])))]).pipe(r(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):g([e,this.loadNamespaceSettings("").pipe(a(()=>o([]))),this.loadUserSettings("global").pipe(a(()=>o([])))]).pipe(r(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),D({bufferSize:1,refCount:!0}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t)}refresh(){this.refresh$.next()}loadUserSettings(t){let e=t==="global"?_:t;return this.controller.listAuthSetting(e,C).pipe(r(i=>O(i)))}userGlobal$=y(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting().pipe(r(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(r(e=>O(e))):o([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(r(i=>d(i)))}create(t,e,i){let u=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!u)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(i===void 0||i===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!i)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let p=E(A(h({},t),{namespaceId:e==="namespace"||e==="userOnNs"?i??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?u:void 0}));return this.controller.createAuthSetting(p).pipe(r(B=>d(B)),S(()=>this.refresh()))}update(t,e,i){let s=E(A(h({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(r(u=>d(u)),S(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(S(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=m({token:n,factory:n.\u0275fac,providedIn:"root"})};export{q as a,J as b,v as c};
@@ -1 +1 @@
1
- import{a as N}from"./chunk-MZBZJFIH.js";import{a as D}from"./chunk-D5BPAYOR.js";import"./chunk-BLRBIAYK.js";import{a as w,c as E}from"./chunk-6XX7GME4.js";import{s as T,z as q}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as p}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as R,D as b,Db as c,Fb as r,Pb as I,Wa as y,ab as C,ca as a,ga as m,ha as d,jc as x,lb as S,m as P,ma as g,mb as v,mc as L,rb as _,sb as l,ta as u,tb as h,z as f}from"./chunk-CHEXA6RY.js";function V(i,e){if(i&1){let t=R();l(0,"agentos-scheduled-prompt-item",4),c("enableRequested",function(n){m(t);let s=r(2);return d(s.enablePrompt(n))})("disableRequested",function(n){m(t);let s=r(2);return d(s.disablePrompt(n))})("deleteRequested",function(n){m(t);let s=r(2);return d(s.deletePrompt(n))}),h()}if(i&2){let t=r().$implicit,o=r();_("definition",e)("namespaceId",o.namespaceId)("readOnly",o.isPlatformPrompt(t.id))}}function k(i,e){if(i&1&&S(0,V,1,3,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=r();v((t=n.resolvePrompt(o.id))?0:-1,t)}}var O="platform",B="namespace",M=class i{route=a(w);router=a(E);destroyRef=a(g);state=a(D);namespaceId=this.route.snapshot.params.namespaceId;platformPrompts=u([]);namespacePrompts=u([]);promptItems=L(()=>[...this.platformPrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:O,groupLabel:"Platform (read-only)",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})),...this.namespacePrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:B,groupLabel:"Namespace",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]}))]);constructor(){f({platform:this.state.listPlatform().pipe(b(()=>P([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(p(this.destroyRef)).subscribe(({platform:e,namespace:t})=>{this.platformPrompts.set(e),this.namespacePrompts.set(t)})}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"])}enablePrompt(e){this.state.enable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t))}disablePrompt(e){this.state.disable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t))}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(p(this.destroyRef)).subscribe(()=>this.namespacePrompts.update(o=>o.filter(n=>n.id!==t)))}resolvePrompt(e){return this.platformPrompts().find(t=>t.id===e)??this.namespacePrompts().find(t=>t.id===e)??null}isPlatformPrompt(e){return this.platformPrompts().some(t=>t.id===e)}patchNamespacePrompt(e){this.namespacePrompts.update(t=>t.map(o=>o.id===e.id?e:o))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["agentos-scheduled-prompt-list"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Scheduled Prompts","emptyMessage","No scheduled prompts yet. Create one to get started.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","namespaceId","readOnly"],[3,"enableRequested","disableRequested","deleteRequested","definition","namespaceId","readOnly"]],template:function(t,o){if(t&1&&(l(0,"ds-entity-list",1),c("createRequested",function(){return o.openCreateForm()}),l(1,"ds-icon-button",2),c("action",function(){return o.goBack()}),h()(),C(2,k,1,1,"ng-template",null,0,x)),t&2){let n=I(3);_("items",o.promptItems())("showCreate",!0)("itemTemplate",n)}},dependencies:[q,N,T],encapsulation:2,changeDetection:0})};export{M as ScheduledPromptListComponent};
1
+ import{a as N}from"./chunk-76HYDFUL.js";import{a as D}from"./chunk-UO7SKQEC.js";import"./chunk-UQTA3ACH.js";import{a as w,c as E}from"./chunk-6XX7GME4.js";import{s as T,z as q}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-SPV5SLNS.js";import{a as p}from"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-G5RWG2GK.js";import{Bb as R,D as b,Db as c,Fb as r,Pb as I,Wa as y,ab as C,ca as a,ga as m,ha as d,jc as x,lb as S,m as P,ma as g,mb as v,mc as L,rb as _,sb as l,ta as u,tb as h,z as f}from"./chunk-CHEXA6RY.js";function V(i,e){if(i&1){let t=R();l(0,"agentos-scheduled-prompt-item",4),c("enableRequested",function(n){m(t);let s=r(2);return d(s.enablePrompt(n))})("disableRequested",function(n){m(t);let s=r(2);return d(s.disablePrompt(n))})("deleteRequested",function(n){m(t);let s=r(2);return d(s.deletePrompt(n))}),h()}if(i&2){let t=r().$implicit,o=r();_("definition",e)("namespaceId",o.namespaceId)("readOnly",o.isPlatformPrompt(t.id))}}function k(i,e){if(i&1&&S(0,V,1,3,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=r();v((t=n.resolvePrompt(o.id))?0:-1,t)}}var O="platform",B="namespace",M=class i{route=a(w);router=a(E);destroyRef=a(g);state=a(D);namespaceId=this.route.snapshot.params.namespaceId;platformPrompts=u([]);namespacePrompts=u([]);promptItems=L(()=>[...this.platformPrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:O,groupLabel:"Platform (read-only)",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})),...this.namespacePrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:B,groupLabel:"Namespace",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]}))]);constructor(){f({platform:this.state.listPlatform().pipe(b(()=>P([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(p(this.destroyRef)).subscribe(({platform:e,namespace:t})=>{this.platformPrompts.set(e),this.namespacePrompts.set(t)})}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"])}enablePrompt(e){this.state.enable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t))}disablePrompt(e){this.state.disable(e.id??"").pipe(p(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t))}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(p(this.destroyRef)).subscribe(()=>this.namespacePrompts.update(o=>o.filter(n=>n.id!==t)))}resolvePrompt(e){return this.platformPrompts().find(t=>t.id===e)??this.namespacePrompts().find(t=>t.id===e)??null}isPlatformPrompt(e){return this.platformPrompts().some(t=>t.id===e)}patchNamespacePrompt(e){this.namespacePrompts.update(t=>t.map(o=>o.id===e.id?e:o))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["agentos-scheduled-prompt-list"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Scheduled Prompts","emptyMessage","No scheduled prompts yet. Create one to get started.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","namespaceId","readOnly"],[3,"enableRequested","disableRequested","deleteRequested","definition","namespaceId","readOnly"]],template:function(t,o){if(t&1&&(l(0,"ds-entity-list",1),c("createRequested",function(){return o.openCreateForm()}),l(1,"ds-icon-button",2),c("action",function(){return o.goBack()}),h()(),C(2,k,1,1,"ng-template",null,0,x)),t&2){let n=I(3);_("items",o.promptItems())("showCreate",!0)("itemTemplate",n)}},dependencies:[q,N,T],encapsulation:2,changeDetection:0})};export{M as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import{a as X}from"./chunk-HN4TBO7J.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
+ import{a as X}from"./chunk-5N6DUZII.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{a as ne}from"./chunk-OY6A2XLL.js";import{a as ie}from"./chunk-KZ2MXYPS.js";import"./chunk-NWFFZ2FW.js";import"./chunk-MQEDNZF7.js";import{q as L}from"./chunk-BLRBIAYK.js";import{a as K,c as G}from"./chunk-6XX7GME4.js";import{a as A,c as B}from"./chunk-VMYKE4ZC.js";import{F as oe,c as z,e as _,g as $,h as q,i as S,l as p,n as j,p as H,r as J,s as Q,t as W,u as X,v as Y,w as Z,x as ee,y as re,z as te}from"./chunk-7OGOI6WM.js";import{Bb as k,Db as f,Fb as m,Ka as l,Tb as i,Ub as P,Vb as U,Wa as I,ca as v,ga as g,ha as h,kb as V,lb as M,ma as N,mb as O,nb as R,ob as D,pb as C,qb as x,rb as d,sb as o,ta as y,tb as t,ua as T,ub as u}from"./chunk-CHEXA6RY.js";function de(n,r){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),t())}function pe(n,r){if(n&1&&(o(0,"label",30),u(1,"input",31),o(2,"span"),i(3),t()()),n&2){let e=r.$implicit,a=m(3);l(),d("formControl",a.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!a.isAdmin()),l(2),P(e.label)}}function me(n,r){if(n&1&&(o(0,"fieldset",8)(1,"legend",24),i(2,"Port\xE9e de la configuration"),t(),C(3,pe,4,4,"label",30,V().trackByScope,!0),t()),n&2){let e=m(2);d("disabled",e.isEditMode()),l(3),x(e.scopeOptions)}}function ce(n,r){if(n&1&&(o(0,"option",13),i(1),t()),n&2){let e=r.$implicit;d("value",e),l(),P(e)}}function ue(n,r){if(n&1){let e=k();o(0,"div",26),u(1,"input",32)(2,"input",33),o(3,"button",34),f("click",function(){let s=g(e).$index,c=m(2);return h(c.removeHeader(s))}),i(4," \xD7 "),t()()}if(n&2){let e=r.$index;d("formGroupName",e)}}function ve(n,r){if(n&1){let e=k();o(0,"form",7),f("ngSubmit",function(){g(e);let s=m();return h(s.submit())}),M(1,me,5,1,"fieldset",8),o(2,"div",9)(3,"label",10),i(4,"API type "),o(5,"span",11),i(6,"*"),t()(),o(7,"select",12),C(8,ce,2,2,"option",13,D),t()(),o(10,"div",9)(11,"label",14),i(12,"Name "),o(13,"span",11),i(14,"*"),t()(),u(15,"input",15),t(),o(16,"div",9)(17,"label",16),i(18,"Description"),t(),u(19,"input",17),t(),o(20,"div",9)(21,"label",18),i(22,"Base URL"),t(),u(23,"input",19),t(),o(24,"div",9)(25,"label",20),i(26,"API key"),t(),u(27,"input",21),t(),o(28,"div",22)(29,"div",23)(30,"span",24),i(31,"Custom headers"),t(),o(32,"button",25),f("click",function(){g(e);let s=m();return h(s.addHeader())}),i(33,"+ Add header"),t()(),C(34,ue,5,1,"div",26,R),t(),o(36,"div",27)(37,"button",28),i(38),t(),o(39,"button",29),f("click",function(){g(e);let s=m();return h(s.cancel())}),i(40,"Cancel"),t()()()}if(n&2){let e=m();d("formGroup",e.form),l(),O(e.isPlatformMode?-1:1),l(6),d("formControl",e.apiTypeControl),l(),x(e.apiTypeOptions),l(7),d("formControl",e.nameControl),l(4),d("formControl",e.descriptionControl),l(4),d("formControl",e.baseUrlControl),l(4),d("formControl",e.apiKeyControl),l(),d("formArrayName","headers"),l(6),x(e.headersArray.controls),l(3),d("disabled",e.form.invalid||e.isSubmitting()),l(),U(" ",e.isEditMode()?"Save changes":"Create"," ")}}var fe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ae=class n{route=v(K);router=v(G);destroyRef=v(N);state=v(ne);namespaceRole=v(ie);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?y(!0):B(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});apiTypeOptions=Object.values(L);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new S({name:new p("",{nonNullable:!0,validators:[_.required,_.minLength(1)]}),description:new p(null),apiType:new p("OpenAI",{nonNullable:!0,validators:[_.required]}),baseUrl:new p("",{nonNullable:!0}),apiKey:new p("",{nonNullable:!0}),scope:new p("namespace",{nonNullable:!0}),headers:new J([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new S({key:new p("",{nonNullable:!0,validators:[_.required]}),value:new p("",{nonNullable:!0})}))}removeHeader(r){this.headersArray.removeAt(r)}isEditMode=y(!1);isSubmitting=y(!1);isLoading=y(!1);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||T(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,a=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(a){this.isEditMode.set(!0),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(a);return}this.scopeControl.setValue(s);let c=e.get("template");c&&this.hydrateFromTemplate(c)}parseScope(r){return r&&fe.has(r)?r:"namespace"}deriveScopeFromConfig(r){return!r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(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(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[a,s]of Object.entries(r.headers??{}))this.headersArray.push(new S({key:new p(a,{nonNullable:!0,validators:[_.required]}),value:new p(s,{nonNullable:!0})}))}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),a=this.apiKeyControl.value,s=this.isEditMode()&&a===this.initialApiKey?null:a,c=this.headersArray.controls.filter(b=>b.controls.key.value.trim()).map(b=>[b.controls.key.value.trim(),b.controls.value.value]),le=c.length>0?Object.fromEntries(c):null,w={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:le},F=this.form.getRawValue().scope,se=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,F,this.existingConfig):this.state.create(w,F,se)).pipe(A(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"])}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,a){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return a.cancel()}),o(3,"span",3),i(4,"\u2190"),t(),i(5," AI Providers "),t(),o(6,"h1",4),i(7),t()(),M(8,de,2,0,"p",5)(9,ve,41,10,"form",6),t()),e&2&&(l(7),P(a.isEditMode()?"Edit AI provider":"New AI provider"),l(),O(a.isLoading()?8:9))},dependencies:[oe,j,re,te,z,ee,H,$,q,Q,Z,Y,W,X],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"],changeDetection:0})};export{ae as AiProviderFormComponent};
1
+ import{a as ne}from"./chunk-QXBTTCPM.js";import{a as ie}from"./chunk-KJJPVCIH.js";import"./chunk-NWFFZ2FW.js";import"./chunk-VZOBZ3DD.js";import{q as L}from"./chunk-UQTA3ACH.js";import{a as K,c as G}from"./chunk-6XX7GME4.js";import{a as A,c as B}from"./chunk-VMYKE4ZC.js";import{F as oe,c as z,e as _,g as $,h as q,i as S,l as p,n as j,p as H,r as J,s as Q,t as W,u as X,v as Y,w as Z,x as ee,y as re,z as te}from"./chunk-7OGOI6WM.js";import{Bb as k,Db as f,Fb as m,Ka as l,Tb as i,Ub as P,Vb as U,Wa as I,ca as v,ga as g,ha as h,kb as V,lb as M,ma as N,mb as O,nb as R,ob as D,pb as C,qb as x,rb as d,sb as o,ta as y,tb as t,ua as T,ub as u}from"./chunk-CHEXA6RY.js";function de(n,r){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),t())}function pe(n,r){if(n&1&&(o(0,"label",30),u(1,"input",31),o(2,"span"),i(3),t()()),n&2){let e=r.$implicit,a=m(3);l(),d("formControl",a.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!a.isAdmin()),l(2),P(e.label)}}function me(n,r){if(n&1&&(o(0,"fieldset",8)(1,"legend",24),i(2,"Port\xE9e de la configuration"),t(),C(3,pe,4,4,"label",30,V().trackByScope,!0),t()),n&2){let e=m(2);d("disabled",e.isEditMode()),l(3),x(e.scopeOptions)}}function ce(n,r){if(n&1&&(o(0,"option",13),i(1),t()),n&2){let e=r.$implicit;d("value",e),l(),P(e)}}function ue(n,r){if(n&1){let e=k();o(0,"div",26),u(1,"input",32)(2,"input",33),o(3,"button",34),f("click",function(){let s=g(e).$index,c=m(2);return h(c.removeHeader(s))}),i(4," \xD7 "),t()()}if(n&2){let e=r.$index;d("formGroupName",e)}}function ve(n,r){if(n&1){let e=k();o(0,"form",7),f("ngSubmit",function(){g(e);let s=m();return h(s.submit())}),M(1,me,5,1,"fieldset",8),o(2,"div",9)(3,"label",10),i(4,"API type "),o(5,"span",11),i(6,"*"),t()(),o(7,"select",12),C(8,ce,2,2,"option",13,D),t()(),o(10,"div",9)(11,"label",14),i(12,"Name "),o(13,"span",11),i(14,"*"),t()(),u(15,"input",15),t(),o(16,"div",9)(17,"label",16),i(18,"Description"),t(),u(19,"input",17),t(),o(20,"div",9)(21,"label",18),i(22,"Base URL"),t(),u(23,"input",19),t(),o(24,"div",9)(25,"label",20),i(26,"API key"),t(),u(27,"input",21),t(),o(28,"div",22)(29,"div",23)(30,"span",24),i(31,"Custom headers"),t(),o(32,"button",25),f("click",function(){g(e);let s=m();return h(s.addHeader())}),i(33,"+ Add header"),t()(),C(34,ue,5,1,"div",26,R),t(),o(36,"div",27)(37,"button",28),i(38),t(),o(39,"button",29),f("click",function(){g(e);let s=m();return h(s.cancel())}),i(40,"Cancel"),t()()()}if(n&2){let e=m();d("formGroup",e.form),l(),O(e.isPlatformMode?-1:1),l(6),d("formControl",e.apiTypeControl),l(),x(e.apiTypeOptions),l(7),d("formControl",e.nameControl),l(4),d("formControl",e.descriptionControl),l(4),d("formControl",e.baseUrlControl),l(4),d("formControl",e.apiKeyControl),l(),d("formArrayName","headers"),l(6),x(e.headersArray.controls),l(3),d("disabled",e.form.invalid||e.isSubmitting()),l(),U(" ",e.isEditMode()?"Save changes":"Create"," ")}}var fe=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ae=class n{route=v(K);router=v(G);destroyRef=v(N);state=v(ne);namespaceRole=v(ie);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?y(!0):B(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});apiTypeOptions=Object.values(L);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new S({name:new p("",{nonNullable:!0,validators:[_.required,_.minLength(1)]}),description:new p(null),apiType:new p("OpenAI",{nonNullable:!0,validators:[_.required]}),baseUrl:new p("",{nonNullable:!0}),apiKey:new p("",{nonNullable:!0}),scope:new p("namespace",{nonNullable:!0}),headers:new J([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new S({key:new p("",{nonNullable:!0,validators:[_.required]}),value:new p("",{nonNullable:!0})}))}removeHeader(r){this.headersArray.removeAt(r)}isEditMode=y(!1);isSubmitting=y(!1);isLoading=y(!1);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||T(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,a=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(a){this.isEditMode.set(!0),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(a);return}this.scopeControl.setValue(s);let c=e.get("template");c&&this.hydrateFromTemplate(c)}parseScope(r){return r&&fe.has(r)?r:"namespace"}deriveScopeFromConfig(r){return!r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(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(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[a,s]of Object.entries(r.headers??{}))this.headersArray.push(new S({key:new p(a,{nonNullable:!0,validators:[_.required]}),value:new p(s,{nonNullable:!0})}))}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),a=this.apiKeyControl.value,s=this.isEditMode()&&a===this.initialApiKey?null:a,c=this.headersArray.controls.filter(b=>b.controls.key.value.trim()).map(b=>[b.controls.key.value.trim(),b.controls.value.value]),le=c.length>0?Object.fromEntries(c):null,w={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:le},F=this.form.getRawValue().scope,se=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,F,this.existingConfig):this.state.create(w,F,se)).pipe(A(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"])}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,a){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return a.cancel()}),o(3,"span",3),i(4,"\u2190"),t(),i(5," AI Providers "),t(),o(6,"h1",4),i(7),t()(),M(8,de,2,0,"p",5)(9,ve,41,10,"form",6),t()),e&2&&(l(7),P(a.isEditMode()?"Edit AI provider":"New AI provider"),l(),O(a.isLoading()?8:9))},dependencies:[oe,j,re,te,z,ee,H,$,q,Q,Z,Y,W,X],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"],changeDetection:0})};export{ae as AiProviderFormComponent};
@@ -0,0 +1 @@
1
+ import{u as a}from"./chunk-GLFQ37PU.js";import"./chunk-KHMEGI4Z.js";import"./chunk-RB7N2NWN.js";import"./chunk-KWJJEVAI.js";import"./chunk-GSUU7JSY.js";import"./chunk-UWYJO2DN.js";import"./chunk-VZOBZ3DD.js";import"./chunk-YFCRBVWD.js";import"./chunk-UQTA3ACH.js";import"./chunk-TSYL5EEO.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 CaseShellComponent};
@@ -1 +1 @@
1
- import{a as U,b as F}from"./chunk-Y42FQQZC.js";import{j}from"./chunk-BLRBIAYK.js";import{c as $}from"./chunk-6XX7GME4.js";import{s as B,z}from"./chunk-VNO76B3S.js";import{a as b}from"./chunk-VMYKE4ZC.js";import{Bb as f,Db as d,Fb as r,Ka as P,Lc as O,Pb as L,S as T,Tb as u,Wa as w,ab as A,ca as v,cc as R,fc as E,ga as c,gc as D,ha as m,i as S,ia as _,ja as h,jc as G,lb as y,ma as I,mb as k,pc as l,qc as H,rb as C,sb as s,t as V,ta as x,tb as a,ub as g,yb as M,zb as q}from"./chunk-CHEXA6RY.js";var Q=()=>[];function X(p,n){if(p&1){let t=f();M(0,1),s(1,"span",2),u(2,"Delete?"),a(),s(3,"ds-icon-button",3),d("action",function(){c(t);let e=r();return m(e.onDeleteConfirmed())}),a(),s(4,"ds-icon-button",4),d("action",function(){c(t);let e=r();return m(e.onDeleteCancelled())}),a(),q()}}function Y(p,n){if(p&1){let t=f();M(0,1),s(1,"button",5),d("click",function(){c(t);let e=r();return m(e.onIntegrations())}),_(),s(2,"svg",6),g(3,"path",7)(4,"path",8),a(),u(5," Integrations "),a(),h(),s(6,"button",5),d("click",function(){c(t);let e=r();return m(e.onAiProviders())}),_(),s(7,"svg",6),g(8,"rect",9)(9,"rect",10)(10,"path",11),a(),u(11," AI Providers "),a(),h(),s(12,"button",5),d("click",function(){c(t);let e=r();return m(e.onAiModels())}),_(),s(13,"svg",6),g(14,"path",12),a(),u(15," AI Models "),a(),h(),s(16,"button",5),d("click",function(){c(t);let e=r();return m(e.onAgentConfigs())}),_(),s(17,"svg",6),g(18,"path",13)(19,"circle",14)(20,"circle",15),a(),u(21," Agent Configs "),a(),h(),s(22,"button",5),d("click",function(){c(t);let e=r();return m(e.onPrompts())}),_(),s(23,"svg",6),g(24,"path",16)(25,"path",17)(26,"path",18),a(),u(27," Prompts "),a(),h(),s(28,"button",5),d("click",function(){c(t);let e=r();return m(e.onScheduledPrompts())}),_(),s(29,"svg",6),g(30,"circle",19)(31,"path",20),a(),u(32," Schedulers "),a(),h(),s(33,"button",5),d("click",function(){c(t);let e=r();return m(e.onUserGroups())}),_(),s(34,"svg",6),g(35,"circle",21)(36,"path",22)(37,"path",23),a(),u(38," User Groups "),a(),h(),s(39,"button",5),d("click",function(){c(t);let e=r();return m(e.onAuthSettings())}),_(),s(40,"svg",6),g(41,"circle",24)(42,"path",25)(43,"path",26),a(),u(44," Auth Settings "),a(),q()}}var N=class p{namespace=H.required();selected=l();editRequested=l();integrationsRequested=l();aiProvidersRequested=l();aiModelsRequested=l();agentConfigsRequested=l();promptsRequested=l();scheduledPromptsRequested=l();userGroupsRequested=l();authSettingsRequested=l();deleteRequested=l();pendingDelete=x(!1);menuItems=[{key:"edit",label:"Edit namespace"},{key:"separator",label:"",variant:"separator"},{key:"delete",label:"Delete namespace",variant:"danger"}];onSelect(){this.selected.emit(this.namespace())}onIntegrations(){this.integrationsRequested.emit(this.namespace())}onAiProviders(){this.aiProvidersRequested.emit(this.namespace())}onAiModels(){this.aiModelsRequested.emit(this.namespace())}onAgentConfigs(){this.agentConfigsRequested.emit(this.namespace())}onPrompts(){this.promptsRequested.emit(this.namespace())}onScheduledPrompts(){this.scheduledPromptsRequested.emit(this.namespace())}onUserGroups(){this.userGroupsRequested.emit(this.namespace())}onAuthSettings(){this.authSettingsRequested.emit(this.namespace())}onMenuAction(n){switch(n){case"edit":this.editRequested.emit(this.namespace());break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.namespace())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(t){return new(t||p)};static \u0275cmp=w({type:p,selectors:[["agentos-namespace-item"]],inputs:{namespace:[1,"namespace"]},outputs:{selected:"selected",editRequested:"editRequested",integrationsRequested:"integrationsRequested",aiProvidersRequested:"aiProvidersRequested",aiModelsRequested:"aiModelsRequested",agentConfigsRequested:"agentConfigsRequested",promptsRequested:"promptsRequested",scheduledPromptsRequested:"scheduledPromptsRequested",userGroupsRequested:"userGroupsRequested",authSettingsRequested:"authSettingsRequested",deleteRequested:"deleteRequested"},decls:3,vars:4,consts:[[3,"nameClicked","menuAction","name","menuItems"],["agentosCardChips",""],[1,"ns-confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel",3,"action"],["type","button",1,"ac-chip",3,"click"],["width","13","height","13","viewBox","0 0 24 24","fill","none","aria-hidden","true"],["d","M8 2v4M16 2v4M6 8h12v3a6 6 0 01-12 0V8z","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["d","M12 17v3","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["x","7","y","7","width","10","height","10","rx","1.5","stroke","currentColor","stroke-width","1.6"],["x","10","y","10","width","4","height","4","rx","0.5","stroke","currentColor","stroke-width","1.4"],["d","M9 2v3M12 2v3M15 2v3M9 19v3M12 19v3M15 19v3M2 9h3M2 12h3M2 15h3M19 9h3M19 12h3M19 15h3","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"],["d","M12 3l1.8 5.6L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.4L12 3z","stroke","currentColor","stroke-width","1.5","stroke-linejoin","round"],["d","M4 7h9M17 7h3M4 17h3M11 17h9","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["cx","13","cy","7","r","2.2","stroke","currentColor","stroke-width","1.6"],["cx","8","cy","17","r","2.2","stroke","currentColor","stroke-width","1.6"],["d","M7 3h7l4 4v14a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M14 3v4h4","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M9 13h6M9 17h6","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"],["cx","12","cy","12","r","9","stroke","currentColor","stroke-width","1.6"],["d","M12 7v5l3 3","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["cx","9","cy","8","r","3","stroke","currentColor","stroke-width","1.6"],["d","M3 20a6 6 0 0112 0","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["d","M16 5.5a3 3 0 010 5.5M18 20a6 6 0 00-3-5.2","stroke","currentColor","stroke-width","1.5","stroke-linecap","round"],["cx","12","cy","8","r","3.2","stroke","currentColor","stroke-width","1.6"],["d","M5 20c0-3.3 3.1-6 7-6s7 2.7 7 6","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["d","M17 13.5l1 1.5-.8.5.8 1.5H16l-.3-1-.7.2-.7-.2-.3 1h-2l.8-1.5-.8-.5 1-1.5","stroke","currentColor","stroke-width","1.3","stroke-linejoin","round"]],template:function(t,i){t&1&&(s(0,"agentos-action-card",0),d("nameClicked",function(){return i.onSelect()})("menuAction",function(o){return i.onMenuAction(o)}),y(1,X,5,0,"ng-container",1)(2,Y,45,0,"ng-container",1),a()),t&2&&(C("name",i.namespace().name)("menuItems",i.pendingDelete()?R(3,Q):i.menuItems),P(),k(i.pendingDelete()?1:2))},dependencies:[F,U,B],styles:[".ns-confirm-label[_ngcontent-%COMP%]{font:500 12px Inter,sans-serif;color:var(--color-error, #a5140a);white-space:nowrap;align-self:center}"],changeDetection:0})};var Z=()=>[];function ee(p,n){if(p&1){let t=f();s(0,"agentos-namespace-item",3),d("selected",function(e){c(t);let o=r(2);return m(o.navigateToHome(e.id??""))})("editRequested",function(e){c(t);let o=r(2);return m(o.navigateToEdit(e))})("deleteRequested",function(e){c(t);let o=r(2);return m(o.deleteNamespace(e))})("integrationsRequested",function(e){c(t);let o=r(2);return m(o.openIntegrations(e))})("aiProvidersRequested",function(e){c(t);let o=r(2);return m(o.openAiProviders(e))})("aiModelsRequested",function(e){c(t);let o=r(2);return m(o.openAiModels(e))})("agentConfigsRequested",function(e){c(t);let o=r(2);return m(o.openAgentConfigs(e))})("promptsRequested",function(e){c(t);let o=r(2);return m(o.openPrompts(e))})("scheduledPromptsRequested",function(e){c(t);let o=r(2);return m(o.openScheduledPrompts(e))})("userGroupsRequested",function(e){c(t);let o=r(2);return m(o.openUserGroups(e))})("authSettingsRequested",function(e){c(t);let o=r(2);return m(o.openAuthSettings(e))}),a()}p&2&&C("namespace",n)}function te(p,n){if(p&1&&y(0,ee,1,1,"agentos-namespace-item",2),p&2){let t,i=n.$implicit,e=r();k((t=e.namespacesById().get(i.id))?0:-1,t)}}var W=class p{router=v($);namespaceController=v(j);destroyRef=v(I);refresh$=new S(void 0);namespaces$=this.refresh$.pipe(T(()=>this.namespaceController.listAllNamespace()));namespaceItems$=this.namespaces$.pipe(V(n=>n.map(t=>({id:t.id??"",name:t.name,description:t.description,badges:t.defaultAgentName?[{label:t.defaultAgentName,variant:"info"}]:void 0}))));namespacesById=x(new Map);constructor(){this.namespaces$.pipe(b(this.destroyRef)).subscribe(n=>{this.namespacesById.set(new Map(n.map(t=>[t.id??"",t])))})}navigateToHome(n){this.router.navigate(["/agentos/home"],{queryParams:{ns:n}})}navigateToCreate(){this.router.navigate(["/agentos/namespaces/new"])}navigateToEdit(n){this.router.navigate(["/agentos/namespaces",n.id??"","edit"])}openIntegrations(n){this.router.navigate(["/agentos",n.id,"integrations"])}openAiProviders(n){this.router.navigate(["/agentos",n.id,"ai-providers"])}openAiModels(n){this.router.navigate(["/agentos",n.id,"ai-models"])}openAgentConfigs(n){this.router.navigate(["/agentos",n.id,"agent-configs"])}openPrompts(n){this.router.navigate(["/agentos",n.id,"prompts"])}openScheduledPrompts(n){this.router.navigate(["/agentos",n.id,"scheduled-prompts"])}openUserGroups(n){this.router.navigate(["/agentos",n.id,"user-groups"])}openAuthSettings(n){this.router.navigate(["/agentos",n.id,"auth-settings"])}deleteNamespace(n){this.namespaceController.deleteNamespace(n.id??"").pipe(b(this.destroyRef)).subscribe(()=>this.refresh$.next())}static \u0275fac=function(t){return new(t||p)};static \u0275cmp=w({type:p,selectors:[["agentos-namespace-list"]],decls:4,vars:6,consts:[["namespaceItemTpl",""],["title","Namespaces","emptyMessage","No namespaces yet. Create one to get started.","cardMinWidth","400px",3,"itemSelected","createRequested","items","showCreate","itemTemplate"],[3,"namespace"],[3,"selected","editRequested","deleteRequested","integrationsRequested","aiProvidersRequested","aiModelsRequested","agentConfigsRequested","promptsRequested","scheduledPromptsRequested","userGroupsRequested","authSettingsRequested","namespace"]],template:function(t,i){if(t&1&&(s(0,"ds-entity-list",1),E(1,"async"),d("itemSelected",function(o){return i.navigateToHome(o)})("createRequested",function(){return i.navigateToCreate()}),a(),A(2,te,1,1,"ng-template",null,0,G)),t&2){let e=L(3);C("items",D(1,3,i.namespaceItems$)??R(5,Z))("showCreate",!0)("itemTemplate",e)}},dependencies:[N,z,O],styles:["[_nghost-%COMP%] .ac, [_nghost-%COMP%] .ac--clickable{background:var(--color-bg);border:1px solid var(--color-divider);box-shadow:none}[_nghost-%COMP%] .ac:hover, [_nghost-%COMP%] .ac--clickable:hover{border-color:var(--color-accent);box-shadow:none}[_nghost-%COMP%] .ac__mark{width:28px;height:28px;border-radius:0;background:var(--color-accent-900);color:var(--color-accent-100);font-family:var(--font-heading);font-weight:600;font-size:13px}[_nghost-%COMP%] .ac__name{font-family:var(--font-heading);font-weight:600;font-size:16.5px;line-height:1.15;overflow-wrap:anywhere;color:var(--color-text)}[_nghost-%COMP%] .ac__chips{gap:6px;padding:0 16px 16px}[_nghost-%COMP%] .ac-chip{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent;font-family:var(--font-heading);font-weight:600;font-size:11px;letter-spacing:.08em;text-transform:uppercase}[_nghost-%COMP%] .ac-chip:hover{background:var(--color-accent-100);border-color:var(--color-accent-300);color:var(--color-accent-700)}"],changeDetection:0})};export{N as a,W as b};
1
+ import{a as U,b as F}from"./chunk-Y42FQQZC.js";import{j}from"./chunk-UQTA3ACH.js";import{c as $}from"./chunk-6XX7GME4.js";import{s as B,z}from"./chunk-VNO76B3S.js";import{a as b}from"./chunk-VMYKE4ZC.js";import{Bb as f,Db as d,Fb as r,Ka as P,Lc as O,Pb as L,S as T,Tb as u,Wa as w,ab as A,ca as v,cc as R,fc as E,ga as c,gc as D,ha as m,i as S,ia as _,ja as h,jc as G,lb as y,ma as I,mb as k,pc as l,qc as H,rb as C,sb as s,t as V,ta as x,tb as a,ub as g,yb as M,zb as q}from"./chunk-CHEXA6RY.js";var Q=()=>[];function X(p,n){if(p&1){let t=f();M(0,1),s(1,"span",2),u(2,"Delete?"),a(),s(3,"ds-icon-button",3),d("action",function(){c(t);let e=r();return m(e.onDeleteConfirmed())}),a(),s(4,"ds-icon-button",4),d("action",function(){c(t);let e=r();return m(e.onDeleteCancelled())}),a(),q()}}function Y(p,n){if(p&1){let t=f();M(0,1),s(1,"button",5),d("click",function(){c(t);let e=r();return m(e.onIntegrations())}),_(),s(2,"svg",6),g(3,"path",7)(4,"path",8),a(),u(5," Integrations "),a(),h(),s(6,"button",5),d("click",function(){c(t);let e=r();return m(e.onAiProviders())}),_(),s(7,"svg",6),g(8,"rect",9)(9,"rect",10)(10,"path",11),a(),u(11," AI Providers "),a(),h(),s(12,"button",5),d("click",function(){c(t);let e=r();return m(e.onAiModels())}),_(),s(13,"svg",6),g(14,"path",12),a(),u(15," AI Models "),a(),h(),s(16,"button",5),d("click",function(){c(t);let e=r();return m(e.onAgentConfigs())}),_(),s(17,"svg",6),g(18,"path",13)(19,"circle",14)(20,"circle",15),a(),u(21," Agent Configs "),a(),h(),s(22,"button",5),d("click",function(){c(t);let e=r();return m(e.onPrompts())}),_(),s(23,"svg",6),g(24,"path",16)(25,"path",17)(26,"path",18),a(),u(27," Prompts "),a(),h(),s(28,"button",5),d("click",function(){c(t);let e=r();return m(e.onScheduledPrompts())}),_(),s(29,"svg",6),g(30,"circle",19)(31,"path",20),a(),u(32," Schedulers "),a(),h(),s(33,"button",5),d("click",function(){c(t);let e=r();return m(e.onUserGroups())}),_(),s(34,"svg",6),g(35,"circle",21)(36,"path",22)(37,"path",23),a(),u(38," User Groups "),a(),h(),s(39,"button",5),d("click",function(){c(t);let e=r();return m(e.onAuthSettings())}),_(),s(40,"svg",6),g(41,"circle",24)(42,"path",25)(43,"path",26),a(),u(44," Auth Settings "),a(),q()}}var N=class p{namespace=H.required();selected=l();editRequested=l();integrationsRequested=l();aiProvidersRequested=l();aiModelsRequested=l();agentConfigsRequested=l();promptsRequested=l();scheduledPromptsRequested=l();userGroupsRequested=l();authSettingsRequested=l();deleteRequested=l();pendingDelete=x(!1);menuItems=[{key:"edit",label:"Edit namespace"},{key:"separator",label:"",variant:"separator"},{key:"delete",label:"Delete namespace",variant:"danger"}];onSelect(){this.selected.emit(this.namespace())}onIntegrations(){this.integrationsRequested.emit(this.namespace())}onAiProviders(){this.aiProvidersRequested.emit(this.namespace())}onAiModels(){this.aiModelsRequested.emit(this.namespace())}onAgentConfigs(){this.agentConfigsRequested.emit(this.namespace())}onPrompts(){this.promptsRequested.emit(this.namespace())}onScheduledPrompts(){this.scheduledPromptsRequested.emit(this.namespace())}onUserGroups(){this.userGroupsRequested.emit(this.namespace())}onAuthSettings(){this.authSettingsRequested.emit(this.namespace())}onMenuAction(n){switch(n){case"edit":this.editRequested.emit(this.namespace());break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.namespace())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(t){return new(t||p)};static \u0275cmp=w({type:p,selectors:[["agentos-namespace-item"]],inputs:{namespace:[1,"namespace"]},outputs:{selected:"selected",editRequested:"editRequested",integrationsRequested:"integrationsRequested",aiProvidersRequested:"aiProvidersRequested",aiModelsRequested:"aiModelsRequested",agentConfigsRequested:"agentConfigsRequested",promptsRequested:"promptsRequested",scheduledPromptsRequested:"scheduledPromptsRequested",userGroupsRequested:"userGroupsRequested",authSettingsRequested:"authSettingsRequested",deleteRequested:"deleteRequested"},decls:3,vars:4,consts:[[3,"nameClicked","menuAction","name","menuItems"],["agentosCardChips",""],[1,"ns-confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel",3,"action"],["type","button",1,"ac-chip",3,"click"],["width","13","height","13","viewBox","0 0 24 24","fill","none","aria-hidden","true"],["d","M8 2v4M16 2v4M6 8h12v3a6 6 0 01-12 0V8z","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["d","M12 17v3","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["x","7","y","7","width","10","height","10","rx","1.5","stroke","currentColor","stroke-width","1.6"],["x","10","y","10","width","4","height","4","rx","0.5","stroke","currentColor","stroke-width","1.4"],["d","M9 2v3M12 2v3M15 2v3M9 19v3M12 19v3M15 19v3M2 9h3M2 12h3M2 15h3M19 9h3M19 12h3M19 15h3","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"],["d","M12 3l1.8 5.6L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.4L12 3z","stroke","currentColor","stroke-width","1.5","stroke-linejoin","round"],["d","M4 7h9M17 7h3M4 17h3M11 17h9","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["cx","13","cy","7","r","2.2","stroke","currentColor","stroke-width","1.6"],["cx","8","cy","17","r","2.2","stroke","currentColor","stroke-width","1.6"],["d","M7 3h7l4 4v14a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M14 3v4h4","stroke","currentColor","stroke-width","1.6","stroke-linejoin","round"],["d","M9 13h6M9 17h6","stroke","currentColor","stroke-width","1.4","stroke-linecap","round"],["cx","12","cy","12","r","9","stroke","currentColor","stroke-width","1.6"],["d","M12 7v5l3 3","stroke","currentColor","stroke-width","1.6","stroke-linecap","round","stroke-linejoin","round"],["cx","9","cy","8","r","3","stroke","currentColor","stroke-width","1.6"],["d","M3 20a6 6 0 0112 0","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["d","M16 5.5a3 3 0 010 5.5M18 20a6 6 0 00-3-5.2","stroke","currentColor","stroke-width","1.5","stroke-linecap","round"],["cx","12","cy","8","r","3.2","stroke","currentColor","stroke-width","1.6"],["d","M5 20c0-3.3 3.1-6 7-6s7 2.7 7 6","stroke","currentColor","stroke-width","1.6","stroke-linecap","round"],["d","M17 13.5l1 1.5-.8.5.8 1.5H16l-.3-1-.7.2-.7-.2-.3 1h-2l.8-1.5-.8-.5 1-1.5","stroke","currentColor","stroke-width","1.3","stroke-linejoin","round"]],template:function(t,i){t&1&&(s(0,"agentos-action-card",0),d("nameClicked",function(){return i.onSelect()})("menuAction",function(o){return i.onMenuAction(o)}),y(1,X,5,0,"ng-container",1)(2,Y,45,0,"ng-container",1),a()),t&2&&(C("name",i.namespace().name)("menuItems",i.pendingDelete()?R(3,Q):i.menuItems),P(),k(i.pendingDelete()?1:2))},dependencies:[F,U,B],styles:[".ns-confirm-label[_ngcontent-%COMP%]{font:500 12px Inter,sans-serif;color:var(--color-error, #a5140a);white-space:nowrap;align-self:center}"],changeDetection:0})};var Z=()=>[];function ee(p,n){if(p&1){let t=f();s(0,"agentos-namespace-item",3),d("selected",function(e){c(t);let o=r(2);return m(o.navigateToHome(e.id??""))})("editRequested",function(e){c(t);let o=r(2);return m(o.navigateToEdit(e))})("deleteRequested",function(e){c(t);let o=r(2);return m(o.deleteNamespace(e))})("integrationsRequested",function(e){c(t);let o=r(2);return m(o.openIntegrations(e))})("aiProvidersRequested",function(e){c(t);let o=r(2);return m(o.openAiProviders(e))})("aiModelsRequested",function(e){c(t);let o=r(2);return m(o.openAiModels(e))})("agentConfigsRequested",function(e){c(t);let o=r(2);return m(o.openAgentConfigs(e))})("promptsRequested",function(e){c(t);let o=r(2);return m(o.openPrompts(e))})("scheduledPromptsRequested",function(e){c(t);let o=r(2);return m(o.openScheduledPrompts(e))})("userGroupsRequested",function(e){c(t);let o=r(2);return m(o.openUserGroups(e))})("authSettingsRequested",function(e){c(t);let o=r(2);return m(o.openAuthSettings(e))}),a()}p&2&&C("namespace",n)}function te(p,n){if(p&1&&y(0,ee,1,1,"agentos-namespace-item",2),p&2){let t,i=n.$implicit,e=r();k((t=e.namespacesById().get(i.id))?0:-1,t)}}var W=class p{router=v($);namespaceController=v(j);destroyRef=v(I);refresh$=new S(void 0);namespaces$=this.refresh$.pipe(T(()=>this.namespaceController.listAllNamespace()));namespaceItems$=this.namespaces$.pipe(V(n=>n.map(t=>({id:t.id??"",name:t.name,description:t.description,badges:t.defaultAgentName?[{label:t.defaultAgentName,variant:"info"}]:void 0}))));namespacesById=x(new Map);constructor(){this.namespaces$.pipe(b(this.destroyRef)).subscribe(n=>{this.namespacesById.set(new Map(n.map(t=>[t.id??"",t])))})}navigateToHome(n){this.router.navigate(["/agentos/home"],{queryParams:{ns:n}})}navigateToCreate(){this.router.navigate(["/agentos/namespaces/new"])}navigateToEdit(n){this.router.navigate(["/agentos/namespaces",n.id??"","edit"])}openIntegrations(n){this.router.navigate(["/agentos",n.id,"integrations"])}openAiProviders(n){this.router.navigate(["/agentos",n.id,"ai-providers"])}openAiModels(n){this.router.navigate(["/agentos",n.id,"ai-models"])}openAgentConfigs(n){this.router.navigate(["/agentos",n.id,"agent-configs"])}openPrompts(n){this.router.navigate(["/agentos",n.id,"prompts"])}openScheduledPrompts(n){this.router.navigate(["/agentos",n.id,"scheduled-prompts"])}openUserGroups(n){this.router.navigate(["/agentos",n.id,"user-groups"])}openAuthSettings(n){this.router.navigate(["/agentos",n.id,"auth-settings"])}deleteNamespace(n){this.namespaceController.deleteNamespace(n.id??"").pipe(b(this.destroyRef)).subscribe(()=>this.refresh$.next())}static \u0275fac=function(t){return new(t||p)};static \u0275cmp=w({type:p,selectors:[["agentos-namespace-list"]],decls:4,vars:6,consts:[["namespaceItemTpl",""],["title","Namespaces","emptyMessage","No namespaces yet. Create one to get started.","cardMinWidth","400px",3,"itemSelected","createRequested","items","showCreate","itemTemplate"],[3,"namespace"],[3,"selected","editRequested","deleteRequested","integrationsRequested","aiProvidersRequested","aiModelsRequested","agentConfigsRequested","promptsRequested","scheduledPromptsRequested","userGroupsRequested","authSettingsRequested","namespace"]],template:function(t,i){if(t&1&&(s(0,"ds-entity-list",1),E(1,"async"),d("itemSelected",function(o){return i.navigateToHome(o)})("createRequested",function(){return i.navigateToCreate()}),a(),A(2,te,1,1,"ng-template",null,0,G)),t&2){let e=L(3);C("items",D(1,3,i.namespaceItems$)??R(5,Z))("showCreate",!0)("itemTemplate",e)}},dependencies:[N,z,O],styles:["[_nghost-%COMP%] .ac, [_nghost-%COMP%] .ac--clickable{background:var(--color-bg);border:1px solid var(--color-divider);box-shadow:none}[_nghost-%COMP%] .ac:hover, [_nghost-%COMP%] .ac--clickable:hover{border-color:var(--color-accent);box-shadow:none}[_nghost-%COMP%] .ac__mark{width:28px;height:28px;border-radius:0;background:var(--color-accent-900);color:var(--color-accent-100);font-family:var(--font-heading);font-weight:600;font-size:13px}[_nghost-%COMP%] .ac__name{font-family:var(--font-heading);font-weight:600;font-size:16.5px;line-height:1.15;overflow-wrap:anywhere;color:var(--color-text)}[_nghost-%COMP%] .ac__chips{gap:6px;padding:0 16px 16px}[_nghost-%COMP%] .ac-chip{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent;font-family:var(--font-heading);font-weight:600;font-size:11px;letter-spacing:.08em;text-transform:uppercase}[_nghost-%COMP%] .ac-chip:hover{background:var(--color-accent-100);border-color:var(--color-accent-300);color:var(--color-accent-700)}"],changeDetection:0})};export{N as a,W as b};