@bpinhosilva/agent-orchestrator 1.1.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +8 -1
  3. package/dist/cli/commands/backup.command.js +143 -0
  4. package/dist/cli/commands/index.js +2 -0
  5. package/dist/cli/commands/run.command.js +20 -1
  6. package/dist/cli/commands/setup.command.js +13 -0
  7. package/dist/cli/constants.js +2 -1
  8. package/dist/cli/env.js +2 -0
  9. package/dist/cli/preload.js +12 -0
  10. package/dist/cli/process-manager.js +33 -29
  11. package/dist/cli/setup/index.js +24 -0
  12. package/dist/cli/setup/validators.js +14 -0
  13. package/dist/config/env.validation.js +6 -0
  14. package/dist/config/runtime-logger.js +214 -0
  15. package/dist/main.js +8 -0
  16. package/dist/ui/assets/{AgentFleet-BarfEwcK.js → AgentFleet-B8p5vbKK.js} +1 -1
  17. package/dist/ui/assets/{AttachmentItem-Cerhbyya.js → AttachmentItem-C_uUACPz.js} +1 -1
  18. package/dist/ui/assets/{ConfirmDialog-y3vTcqFR.js → ConfirmDialog-BltdtevE.js} +1 -1
  19. package/dist/ui/assets/{CreateRecurrentTaskModal-BgfnJ1n8.js → CreateRecurrentTaskModal-CGSdgNAf.js} +1 -1
  20. package/dist/ui/assets/{CreateTaskModal-BH9lOLYT.js → CreateTaskModal-XNvIWKz3.js} +1 -1
  21. package/dist/ui/assets/{ExecLogModal-ShacCOOV.js → ExecLogModal-BYTGF04P.js} +1 -1
  22. package/dist/ui/assets/{MarkdownField--1gpyapw.js → MarkdownField-DR6tHsei.js} +1 -1
  23. package/dist/ui/assets/{Profile-qnuRN5Qv.js → Profile-ByioVLM8.js} +1 -1
  24. package/dist/ui/assets/{ProjectDetail-ZYQG9yn2.js → ProjectDetail-dwZDzb0m.js} +1 -1
  25. package/dist/ui/assets/{Providers-DR7srJHq.js → Providers-JAClEFt0.js} +1 -1
  26. package/dist/ui/assets/{Scheduler-Bs3DC0re.js → Scheduler-C1HQNxQ6.js} +2 -2
  27. package/dist/ui/assets/{Settings-C3ad44vP.js → Settings-Cjn2xdo1.js} +1 -1
  28. package/dist/ui/assets/{TaskDetail-D-f_Ao2a.js → TaskDetail-Blphf9tw.js} +1 -1
  29. package/dist/ui/assets/{TaskExecutions-BeodRIz1.js → TaskExecutions-ydR4KPCY.js} +3 -3
  30. package/dist/ui/assets/{TaskManager-BA2Y31ut.js → TaskManager-DrFbuAwN.js} +3 -3
  31. package/dist/ui/assets/{UserDetail-BvWm-U4y.js → UserDetail-mWjJPTzO.js} +1 -1
  32. package/dist/ui/assets/{Users-CQNcXLyV.js → Users-FaX0thJx.js} +1 -1
  33. package/dist/ui/assets/{activity-CmAajKmR.js → activity-B_2QSywM.js} +1 -1
  34. package/dist/ui/assets/{agents-b8btewki.js → agents-YQJ7JNfI.js} +1 -1
  35. package/dist/ui/assets/{auth-dROenHXk.js → auth-Lh2N3iYN.js} +1 -1
  36. package/dist/ui/assets/{bot-QVmnxPf4.js → bot-DadO9w3D.js} +1 -1
  37. package/dist/ui/assets/{box-Bw_pyYzU.js → box-CFDcDxHv.js} +1 -1
  38. package/dist/ui/assets/{brain-C6vlLcg3.js → brain-DWTpby6b.js} +1 -1
  39. package/dist/ui/assets/{briefcase-DtHlat45.js → briefcase-mFWNV6w9.js} +1 -1
  40. package/dist/ui/assets/check-BiORptL3.js +1 -0
  41. package/dist/ui/assets/chevron-down-BUOg3vvd.js +1 -0
  42. package/dist/ui/assets/chevron-left-B0NmQyxK.js +1 -0
  43. package/dist/ui/assets/chevron-right-Bm_d1KKk.js +1 -0
  44. package/dist/ui/assets/{circle-alert-pUx6yhcF.js → circle-alert-sCcf7ANF.js} +1 -1
  45. package/dist/ui/assets/circle-check-Jz8IOE4h.js +1 -0
  46. package/dist/ui/assets/client-B553SX3l.js +9 -0
  47. package/dist/ui/assets/clock-CSNFJjo4.js +1 -0
  48. package/dist/ui/assets/{cpu-8Sbc9Dk0.js → cpu-C2_GFeSH.js} +1 -1
  49. package/dist/ui/assets/{database-D6O4hvbm.js → database-zXW48-_N.js} +1 -1
  50. package/dist/ui/assets/{download-DHcd5oLD.js → download-DZdOdijy.js} +1 -1
  51. package/dist/ui/assets/{eye-Cc-vy4Zu.js → eye-CjrFwZG_.js} +1 -1
  52. package/dist/ui/assets/{file-text-DWBSXx5l.js → file-text-CX_Yqfjf.js} +1 -1
  53. package/dist/ui/assets/{index-BvUv9Lzq.js → index-IcLlFUZs.js} +3 -3
  54. package/dist/ui/assets/{info-1jA6X-_e.js → info-DGHChFI6.js} +1 -1
  55. package/dist/ui/assets/{layers-BcHXXg-4.js → layers-CVf8_Byb.js} +1 -1
  56. package/dist/ui/assets/loader-circle-CB6PQwdc.js +1 -0
  57. package/dist/ui/assets/{panels-top-left-Vk8FzAxf.js → panels-top-left-Cp169WzB.js} +1 -1
  58. package/dist/ui/assets/{paperclip-DWJjaP8B.js → paperclip-5Y367YTj.js} +1 -1
  59. package/dist/ui/assets/plus-CkteVqhM.js +1 -0
  60. package/dist/ui/assets/{projects-CUOthD8N.js → projects-DoalTI7c.js} +1 -1
  61. package/dist/ui/assets/{providers-CNrSTcdc.js → providers-AawjMy3x.js} +1 -1
  62. package/dist/ui/assets/{recurrent-tasks-CKT47N2l.js → recurrent-tasks-7thk45mk.js} +1 -1
  63. package/dist/ui/assets/{refresh-cw-DQW6jR7M.js → refresh-cw-BgDsJOC_.js} +1 -1
  64. package/dist/ui/assets/{rocket-CMSwBl_C.js → rocket-B9Iexkcw.js} +1 -1
  65. package/dist/ui/assets/{save-DycJmlX0.js → save-Cmqi1IkN.js} +1 -1
  66. package/dist/ui/assets/{send-BZjwSrJW.js → send-iK1X7WSe.js} +1 -1
  67. package/dist/ui/assets/{server-CJE2K1Vt.js → server-BBmM-vrg.js} +1 -1
  68. package/dist/ui/assets/{settings-at7JqFrc.js → settings-BpKLGxm8.js} +1 -1
  69. package/dist/ui/assets/{shield-alert-CP5GVXxa.js → shield-alert-Do_Sg9SX.js} +1 -1
  70. package/dist/ui/assets/{shield-check-Cr4SHjdR.js → shield-check-YKs9kUNq.js} +1 -1
  71. package/dist/ui/assets/{sparkles-v57Nc-z-.js → sparkles-krUpxie4.js} +1 -1
  72. package/dist/ui/assets/{taskFormSchemas-dl1t1OyX.js → taskFormSchemas-B6YlRxrx.js} +1 -1
  73. package/dist/ui/assets/{tasks-DEUQCNoH.js → tasks-DHsBE-ea.js} +1 -1
  74. package/dist/ui/assets/{terminal-a6AV2mPO.js → terminal-B6iyNuAm.js} +1 -1
  75. package/dist/ui/assets/{trash-2-DJpTXgEP.js → trash-2-CphQfk35.js} +1 -1
  76. package/dist/ui/assets/{trending-up-DlrXEXE6.js → trending-up-ClGbkbN9.js} +1 -1
  77. package/dist/ui/assets/user-Brcjlps5.js +1 -0
  78. package/dist/ui/assets/{user-plus-nDkwsBT1.js → user-plus-0Y0M1GKi.js} +1 -1
  79. package/dist/ui/assets/{users-C6WiDiuN.js → users-BcnlUG5N.js} +1 -1
  80. package/dist/ui/assets/{users-Ef6Sh2iR.js → users-tdyaGZbx.js} +1 -1
  81. package/dist/ui/assets/x-CCZGYGDC.js +1 -0
  82. package/dist/ui/assets/{zap-BmhZqgvm.js → zap-BDAytXMX.js} +1 -1
  83. package/dist/ui/index.html +17 -17
  84. package/package.json +2 -2
  85. package/dist/ui/assets/check-DTei8Qlg.js +0 -1
  86. package/dist/ui/assets/chevron-down-LTeQHW9O.js +0 -1
  87. package/dist/ui/assets/chevron-left-CJc_eQid.js +0 -1
  88. package/dist/ui/assets/chevron-right-G5-HRo_C.js +0 -1
  89. package/dist/ui/assets/circle-check-B9kyRki5.js +0 -1
  90. package/dist/ui/assets/client-BGOBXkO8.js +0 -9
  91. package/dist/ui/assets/clock-BY4rrypg.js +0 -1
  92. package/dist/ui/assets/loader-circle-Cl6yIkPK.js +0 -1
  93. package/dist/ui/assets/plus-Dx6G8SOZ.js +0 -1
  94. package/dist/ui/assets/user--KOoEB9m.js +0 -1
  95. package/dist/ui/assets/x-wDy15QMx.js +0 -1
@@ -1 +1 @@
1
- import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./bot-QVmnxPf4.js";import{t as c}from"./brain-C6vlLcg3.js";import{t as l}from"./chevron-down-LTeQHW9O.js";import{t as u}from"./circle-alert-pUx6yhcF.js";import{t as d}from"./clock-BY4rrypg.js";import{n as f,t as p}from"./MarkdownField--1gpyapw.js";import{t as m}from"./cpu-8Sbc9Dk0.js";import{t as h}from"./rocket-CMSwBl_C.js";import{t as g}from"./sparkles-v57Nc-z-.js";import{t as _}from"./x-wDy15QMx.js";import{n as v,t as y}from"./vendor-motion-CMGWJcqR.js";import{n as b}from"./agents-b8btewki.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as x,c as S,o as te,s as ne}from"./vendor-forms-DHyqHeyd.js";import{t as C}from"./tasks-DEUQCNoH.js";import{a as w}from"./taskFormSchemas-dl1t1OyX.js";import{n as T,r as E}from"./recurrent-tasks-CKT47N2l.js";var D=o(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),O=o(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),k=o(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),A=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),j=e(n(),1),M=e(A(),1),N=a(),P={title:``,description:``,cronExpression:``,assigneeId:``,priority:C.MEDIUM},F=({projectId:e,isOpen:t,onClose:n,onSuccess:a,initialData:o})=>{let{notifyApiError:A,notifyError:F}=ee(),[I,L]=(0,j.useState)(!1),[R,z]=(0,j.useState)(!1),{control:B,formState:{errors:V},handleSubmit:H,register:U,reset:W,setValue:G}=ne({resolver:x(w),defaultValues:P,mode:`onBlur`}),K=S({control:B,name:`cronExpression`}),q=S({control:B,name:`assigneeId`}),re=S({control:B,name:`priority`}),J=r({queryKey:[`agents`],enabled:t,queryFn:async()=>(await b.findAll()).data??[]}),ie=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,j.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),W(o?{title:o.title,description:o.description,cronExpression:o.cronExpression,assigneeId:o.assignee.id,priority:Number(o.priority)}:P),()=>{window.removeEventListener(`keydown`,e),z(!1),L(!1),W(P)}},[o,t,n,W]),(0,j.useEffect)(()=>{!t||!J.error||A(J.error,`Agents Load Failed`)},[J.error,t,A]);let Y=i({mutationFn:async t=>{if(o){await E.update(e,o.id,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority});return}await E.create(e,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority,status:T.ACTIVE})},onSuccess:()=>{a(),n()},onError:e=>{A(e,`Operation Failed`)}}),X=(0,j.useMemo)(()=>{if(!K||V.cronExpression)return null;try{return M.default.toString(K)}catch{return null}},[K,V.cronExpression]),ae=e=>{switch(e){case C.CRITICAL:return`CRIT`;case C.HIGH:return`HIGH`;case C.MEDIUM:return`MED`;case C.LOW:return`LOW`;default:return`MED`}},Z=J.data??[],Q=Z.find(e=>e.id===q),oe=J.isPending||J.isFetching,$=Y.isPending,se=H(async e=>{await Y.mutateAsync(e)},()=>{F(`Validation Error`,`Please fill in all required fields before deploying the task.`)});return t?(0,N.jsx)(v,{children:(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,N.jsxs)(y.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:o?`Update Protocol`:`Deploy New Task`}),(0,N.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:o?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,N.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,N.jsx)(_,{size:24})})]}),(0,N.jsxs)(`form`,{onSubmit:se,className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,N.jsx)(D,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,N.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,...U(`title`)})]}),(0,N.jsx)(te,{control:B,name:`description`,render:({field:e})=>(0,N.jsx)(p,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,N.jsx)(s,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>L(!I),role:`combobox`,"aria-expanded":I,"data-testid":`agent-select`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,N.jsx)(c,{size:16,className:`text-primary`})}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:Q?Q.name:`Select Intelligence Core`}),(0,N.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:Q?Q.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,N.jsx)(l,{size:20,className:`text-outline transition-transform ${I?`rotate-180`:``}`})]}),(0,N.jsx)(v,{children:I&&(0,N.jsx)(y.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:oe?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):Z.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):Z.map(e=>(0,N.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{G(`assigneeId`,e.id,{shouldDirty:!0,shouldValidate:!0}),L(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,N.jsx)(m,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,N.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,N.jsxs)(`select`,{className:`sr-only`,value:q,onChange:e=>G(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),children:[(0,N.jsx)(`option`,{value:``,children:`Select Agent`}),Z.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,N.jsx)(d,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative flex-1`,children:[(0,N.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${V.cronExpression?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,...U(`cronExpression`),placeholder:`e.g. 0 0 * * *`}),(0,N.jsx)(f,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>z(!R),className:`p-3 rounded-lg border transition-all ${R?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,N.jsx)(k,{size:18})})]}),(0,N.jsx)(v,{children:R&&(0,N.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,N.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,N.jsx)(g,{size:12}),`Temporal Presets`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{G(`cronExpression`,e.value,{shouldDirty:!0,shouldValidate:!0})},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${K===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),X&&!V.cronExpression&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,N.jsx)(O,{size:14,className:`shrink-0`}),(0,N.jsx)(`span`,{children:X})]}),(0,N.jsx)(`div`,{className:`px-1 py-1`,children:(0,N.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,N.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,N.jsx)(`span`,{children:`Min`}),(0,N.jsx)(`span`,{children:`Hour`}),(0,N.jsx)(`span`,{children:`Dom`}),(0,N.jsx)(`span`,{children:`Mon`}),(0,N.jsx)(`span`,{children:`Dow`})]})}),V.cronExpression?.message&&(0,N.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,N.jsx)(u,{size:12}),V.cronExpression.message]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,N.jsx)(u,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,N.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[C.LOW,C.MEDIUM,C.HIGH,C.CRITICAL].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>G(`priority`,e,{shouldDirty:!0,shouldValidate:!0}),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(re)===Number(e)?e===C.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,N.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,N.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,N.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,N.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,N.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,N.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,N.jsx)(`span`,{className:`text-primary`,children:Q?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,N.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,N.jsxs)(`button`,{type:`submit`,disabled:$,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[$?(0,N.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,N.jsx)(h,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),o?`Update Task`:`Create Task`]})]})]})]})})}):null};export{F as default};
1
+ import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./bot-DadO9w3D.js";import{t as c}from"./brain-DWTpby6b.js";import{t as l}from"./chevron-down-BUOg3vvd.js";import{t as u}from"./circle-alert-sCcf7ANF.js";import{t as d}from"./clock-CSNFJjo4.js";import{n as f,t as p}from"./MarkdownField-DR6tHsei.js";import{t as m}from"./cpu-C2_GFeSH.js";import{t as h}from"./rocket-B9Iexkcw.js";import{t as g}from"./sparkles-krUpxie4.js";import{t as _}from"./x-CCZGYGDC.js";import{n as v,t as y}from"./vendor-motion-CMGWJcqR.js";import{n as b}from"./agents-YQJ7JNfI.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as x,c as S,o as te,s as ne}from"./vendor-forms-DHyqHeyd.js";import{t as C}from"./tasks-DHsBE-ea.js";import{a as w}from"./taskFormSchemas-B6YlRxrx.js";import{n as T,r as E}from"./recurrent-tasks-7thk45mk.js";var D=o(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),O=o(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),k=o(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),A=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),j=e(n(),1),M=e(A(),1),N=a(),P={title:``,description:``,cronExpression:``,assigneeId:``,priority:C.MEDIUM},F=({projectId:e,isOpen:t,onClose:n,onSuccess:a,initialData:o})=>{let{notifyApiError:A,notifyError:F}=ee(),[I,L]=(0,j.useState)(!1),[R,z]=(0,j.useState)(!1),{control:B,formState:{errors:V},handleSubmit:H,register:U,reset:W,setValue:G}=ne({resolver:x(w),defaultValues:P,mode:`onBlur`}),K=S({control:B,name:`cronExpression`}),q=S({control:B,name:`assigneeId`}),re=S({control:B,name:`priority`}),J=r({queryKey:[`agents`],enabled:t,queryFn:async()=>(await b.findAll()).data??[]}),ie=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,j.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),W(o?{title:o.title,description:o.description,cronExpression:o.cronExpression,assigneeId:o.assignee.id,priority:Number(o.priority)}:P),()=>{window.removeEventListener(`keydown`,e),z(!1),L(!1),W(P)}},[o,t,n,W]),(0,j.useEffect)(()=>{!t||!J.error||A(J.error,`Agents Load Failed`)},[J.error,t,A]);let Y=i({mutationFn:async t=>{if(o){await E.update(e,o.id,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority});return}await E.create(e,{title:t.title,description:t.description,cronExpression:t.cronExpression,assigneeId:t.assigneeId,priority:t.priority,status:T.ACTIVE})},onSuccess:()=>{a(),n()},onError:e=>{A(e,`Operation Failed`)}}),X=(0,j.useMemo)(()=>{if(!K||V.cronExpression)return null;try{return M.default.toString(K)}catch{return null}},[K,V.cronExpression]),ae=e=>{switch(e){case C.CRITICAL:return`CRIT`;case C.HIGH:return`HIGH`;case C.MEDIUM:return`MED`;case C.LOW:return`LOW`;default:return`MED`}},Z=J.data??[],Q=Z.find(e=>e.id===q),oe=J.isPending||J.isFetching,$=Y.isPending,se=H(async e=>{await Y.mutateAsync(e)},()=>{F(`Validation Error`,`Please fill in all required fields before deploying the task.`)});return t?(0,N.jsx)(v,{children:(0,N.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,N.jsxs)(y.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:o?`Update Protocol`:`Deploy New Task`}),(0,N.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:o?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,N.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,N.jsx)(_,{size:24})})]}),(0,N.jsxs)(`form`,{onSubmit:se,className:`flex flex-col`,children:[(0,N.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,N.jsx)(D,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,N.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,...U(`title`)})]}),(0,N.jsx)(te,{control:B,name:`description`,render:({field:e})=>(0,N.jsx)(p,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,N.jsx)(s,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>L(!I),role:`combobox`,"aria-expanded":I,"data-testid":`agent-select`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,N.jsx)(c,{size:16,className:`text-primary`})}),(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:Q?Q.name:`Select Intelligence Core`}),(0,N.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:Q?Q.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,N.jsx)(l,{size:20,className:`text-outline transition-transform ${I?`rotate-180`:``}`})]}),(0,N.jsx)(v,{children:I&&(0,N.jsx)(y.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:oe?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):Z.length===0?(0,N.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):Z.map(e=>(0,N.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{G(`assigneeId`,e.id,{shouldDirty:!0,shouldValidate:!0}),L(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,N.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,N.jsx)(m,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,N.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,N.jsxs)(`select`,{className:`sr-only`,value:q,onChange:e=>G(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),children:[(0,N.jsx)(`option`,{value:``,children:`Select Agent`}),Z.map(e=>(0,N.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,N.jsx)(d,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative flex-1`,children:[(0,N.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${V.cronExpression?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,...U(`cronExpression`),placeholder:`e.g. 0 0 * * *`}),(0,N.jsx)(f,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>z(!R),className:`p-3 rounded-lg border transition-all ${R?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,N.jsx)(k,{size:18})})]}),(0,N.jsx)(v,{children:R&&(0,N.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,N.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,N.jsx)(g,{size:12}),`Temporal Presets`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>{G(`cronExpression`,e.value,{shouldDirty:!0,shouldValidate:!0})},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${K===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),X&&!V.cronExpression&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,N.jsx)(O,{size:14,className:`shrink-0`}),(0,N.jsx)(`span`,{children:X})]}),(0,N.jsx)(`div`,{className:`px-1 py-1`,children:(0,N.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,N.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,N.jsx)(`span`,{children:`Min`}),(0,N.jsx)(`span`,{children:`Hour`}),(0,N.jsx)(`span`,{children:`Dom`}),(0,N.jsx)(`span`,{children:`Mon`}),(0,N.jsx)(`span`,{children:`Dow`})]})}),V.cronExpression?.message&&(0,N.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,N.jsx)(u,{size:12}),V.cronExpression.message]})]})]}),(0,N.jsxs)(`section`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,N.jsx)(u,{size:16}),(0,N.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,N.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[C.LOW,C.MEDIUM,C.HIGH,C.CRITICAL].map(e=>(0,N.jsx)(`button`,{type:`button`,onClick:()=>G(`priority`,e,{shouldDirty:!0,shouldValidate:!0}),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(re)===Number(e)?e===C.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,N.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,N.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,N.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,N.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,N.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,N.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,N.jsx)(`span`,{className:`text-primary`,children:Q?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,N.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,N.jsxs)(`button`,{type:`submit`,disabled:$,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[$?(0,N.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,N.jsx)(h,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),o?`Update Task`:`Create Task`]})]})]})]})})}):null};export{F as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./chevron-down-LTeQHW9O.js";import{t as c}from"./MarkdownField--1gpyapw.js";import{t as l}from"./file-text-DWBSXx5l.js";import{t as ee}from"./sparkles-v57Nc-z-.js";import{t as te}from"./trash-2-DJpTXgEP.js";import{t as u}from"./user--KOoEB9m.js";import{t as d}from"./x-wDy15QMx.js";import{n as f,t as p}from"./vendor-motion-CMGWJcqR.js";import{n as m}from"./projects-CUOthD8N.js";import{n as h}from"./agents-b8btewki.js";import{t as g}from"./useNotification-DQayTSUL.js";import{a as ne,c as _,o as re,s as v}from"./vendor-forms-DHyqHeyd.js";import{i as y,n as b,t as x}from"./tasks-DEUQCNoH.js";import{i as ie,n as S}from"./taskFormSchemas-dl1t1OyX.js";var C=o(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),w=o(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),T=e(t(),1),E=a(),D={title:``,description:S,status:b.BACKLOG,priority:x.MEDIUM,assigneeId:``,projectId:``},O=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:O,notifyError:ae,notifySuccess:oe}=g(),k=(0,T.useId)(),se=(0,T.useId)(),A=(0,T.useId)(),j=(0,T.useId)(),M=(0,T.useId)(),N=(0,T.useId)(),P=(0,T.useId)(),F=(0,T.useId)(),I=(0,T.useId)(),{control:L,formState:{errors:R},handleSubmit:z,register:B,reset:V,setValue:H}=v({resolver:ne(ie),defaultValues:D,mode:`onBlur`}),U=r({queryKey:[`agents`],enabled:e,queryFn:async()=>(await h.findAll()).data}),W=r({queryKey:[`projects`],enabled:e,queryFn:async()=>(await m.findAll()).data});(0,T.useEffect)(()=>{if(!e){V(D);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,V]),(0,T.useEffect)(()=>{e&&U.error&&O(U.error,`Agents Load Failed`)},[U.error,e,O]),(0,T.useEffect)(()=>{e&&W.error&&O(W.error,`Projects Load Failed`)},[e,O,W.error]);let G=(0,T.useMemo)(()=>W.data??[],[W.data]),K=_({control:L,name:`projectId`});(0,T.useEffect)(()=>{!e||G.length===0||K||H(`projectId`,G[0].id,{shouldDirty:!1,shouldValidate:!0})},[K,e,G,H]);let q=i({mutationFn:async e=>(await y.create(e.projectId,{title:e.title,description:e.description,status:e.status,priority:e.priority,assigneeId:e.assigneeId||void 0,projectId:e.projectId}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`tasks`,e.projectId]}),o.invalidateQueries({queryKey:[`projects`]}),oe(`Task Commissioned`,`The task node has been added to the orchestration grid.`),a?.(),t(),V({...D,projectId:e.projectId})},onError:e=>{O(e,`Task Creation Failed`)}}),J=U.data??[],Y=U.isPending||W.isPending,X=q.isPending,Z=_({control:L,name:`priority`}),ce=_({control:L,name:`status`}),Q=_({control:L,name:`assigneeId`}),le=_({control:L,name:`projectId`}),ue=z(async e=>{await q.mutateAsync(e)},()=>{ae(`Validation Error`,`Please review the highlighted fields before commissioning the task.`)}),$=()=>{X||t()};return e?(0,E.jsx)(f,{children:(0,E.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,E.jsx)(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:$,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,E.jsxs)(p.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":F,"aria-describedby":I,"aria-busy":Y||X,className:`relative w-full max-w-3xl h-full max-h-[750px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,E.jsx)(C,{size:22,"aria-hidden":`true`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{id:F,className:`text-xl font-black font-headline text-white tracking-tight`,children:`Comission New Task`}),(0,E.jsx)(`p`,{id:I,className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`Node Specification Protocol`})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,"aria-label":`Close create task modal`,className:`w-10 h-10 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,E.jsx)(d,{size:20,"aria-hidden":`true`})})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar`,children:[(0,E.jsxs)(`section`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-primary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Essential Intelligence`})]}),(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{htmlFor:P,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Task Title`}),(0,E.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,E.jsx)(`input`,{id:P,type:`text`,placeholder:`e.g. Synthesize Vector DB results`,"aria-invalid":!!R.title,"aria-describedby":R.title?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`,...B(`title`)})}),R.title&&(0,E.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:R.title.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,E.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Objective / Description`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,S,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-surface-container-highest text-[9px] font-black text-on-surface-variant/60 uppercase tracking-widest transition-colors`,title:`Reset to template`,children:[(0,E.jsx)(l,{size:10,"aria-hidden":`true`}),`Template`]}),(0,E.jsx)(`div`,{className:`w-px h-3 bg-outline-variant/10`}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,``,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-error/10 text-[9px] font-black text-error/60 hover:text-error uppercase tracking-widest transition-colors`,title:`Clear field`,children:[(0,E.jsx)(te,{size:10,"aria-hidden":`true`}),`Clear`]})]})]}),(0,E.jsx)(re,{control:L,name:`description`,render:({field:e})=>(0,E.jsx)(c,{value:e.value,onChange:e.onChange,placeholder:`Describe the desired output and constraints for this node...`,height:`h-52`,maxLength:2e3})}),R.description&&(0,E.jsx)(`p`,{id:se,className:`text-xs text-error font-semibold`,children:R.description.message})]})]})]}),(0,E.jsxs)(`section`,{className:`space-y-6 pt-10 border-t border-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-secondary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Operational Configuration`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(w,{size:12,className:`text-secondary`,"aria-hidden":`true`}),`Priority Level`]}),(0,E.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-1 bg-surface-container-highest/30 rounded-xl ring-1 ring-outline-variant/10`,children:[{id:x.LOW,label:`LOW`},{id:x.MEDIUM,label:`MED`},{id:x.HIGH,label:`HIGH`},{id:x.CRITICAL,label:`CRIT`}].map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":Z===e.id,onClick:()=>H(`priority`,e.id,{shouldDirty:!0,shouldValidate:!0}),className:`py-2 rounded-lg text-[10px] font-black tracking-widest transition-all ${Z===e.id?e.id===x.CRITICAL||e.id===x.HIGH?`bg-error text-on-error shadow-lg shadow-error/30`:`bg-primary text-on-primary shadow-lg shadow-primary/30`:`hover:bg-surface-container-highest text-on-surface-variant`}`,children:e.label},e.id))}),R.priority&&(0,E.jsx)(`p`,{id:j,className:`text-xs text-error font-semibold`,children:R.priority.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-status`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Initial Status`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-status`,value:ce,onChange:e=>H(`status`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.status,"aria-describedby":R.status?A:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:[b.BACKLOG,b.IN_PROGRESS,b.REVIEW].map(e=>(0,E.jsx)(`option`,{value:e,className:`bg-surface-container-low text-on-surface uppercase`,children:e},e))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.status&&(0,E.jsx)(`p`,{id:A,className:`text-xs text-error font-semibold`,children:R.status.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(u,{size:12,className:`text-primary`,"aria-hidden":`true`}),`Assigned Intelligence (Optional)`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-3`,children:[J.map(e=>(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":Q===e.id,onClick:()=>H(`assigneeId`,Q===e.id?``:e.id,{shouldDirty:!0,shouldValidate:!0}),className:`p-3 rounded-xl border flex items-center gap-3 transition-all text-left ${Q===e.id?`bg-primary/10 border-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`:`bg-surface-container-highest/20 border-outline-variant/5 hover:border-outline-variant/30 hover:bg-surface-container-highest/30`}`,children:[(0,E.jsx)(`div`,{className:`w-8 h-8 rounded-lg flex items-center justify-center font-bold text-xs ${Q===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:e.name.substring(0,2).toUpperCase()}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-[11px] font-bold ${Q===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name}),(0,E.jsx)(`div`,{className:`text-[9px] text-on-surface-variant/50 uppercase tracking-widest font-black leading-none mt-0.5`,children:e.role||`Agent`})]})]},e.id)),J.length===0&&!U.isPending&&(0,E.jsx)(`div`,{className:`col-span-full py-4 text-center border-2 border-dashed border-outline-variant/10 rounded-xl`,children:(0,E.jsx)(`span`,{className:`text-[10px] font-bold text-on-surface-variant/30 uppercase tracking-[0.2em]`,children:`No active intelligence found`})})]}),R.assigneeId&&(0,E.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:R.assigneeId.message})]}),G.length>1?(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-project`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Target Project`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-project`,value:le,onChange:e=>H(`projectId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.projectId,"aria-describedby":R.projectId?N:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:G.map(e=>(0,E.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.title},e.id))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.projectId&&(0,E.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:R.projectId.message})]}):G.length===1?(0,E.jsxs)(`div`,{className:`col-span-full px-4 py-2 bg-surface-container-highest/10 rounded-lg border border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40`,children:`Target Project`}),(0,E.jsx)(`span`,{className:`text-xs font-bold text-primary/80`,children:G[0].title})]}):(0,E.jsxs)(`div`,{className:`col-span-full p-4 bg-error/5 border border-error/20 rounded-xl text-center`,children:[(0,E.jsx)(`p`,{className:`text-xs font-bold text-error`,children:`No Project Detected`}),(0,E.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-1 uppercase tracking-widest font-black`,children:`Create a project in the sidebar before commissioning tasks`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,E.jsx)(ee,{size:12,className:`text-primary animate-pulse`,"aria-hidden":`true`}),`Agentic Orchestration Active`]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,className:`px-6 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest disabled:opacity-50 disabled:cursor-not-allowed`,children:`Discard`}),(0,E.jsxs)(`button`,{type:`button`,onClick:ue,disabled:X||Y||G.length===0,className:`px-10 py-2.5 rounded-lg bg-primary text-on-primary text-sm font-black shadow-[0_8px_20px_rgba(173,198,255,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden disabled:hover:scale-100`,children:[(0,E.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),X?`Processing...`:`Comission Task`]})]})]})]})]})}):null};export{O as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./chevron-down-BUOg3vvd.js";import{t as c}from"./MarkdownField-DR6tHsei.js";import{t as l}from"./file-text-CX_Yqfjf.js";import{t as ee}from"./sparkles-krUpxie4.js";import{t as te}from"./trash-2-CphQfk35.js";import{t as u}from"./user-Brcjlps5.js";import{t as d}from"./x-CCZGYGDC.js";import{n as f,t as p}from"./vendor-motion-CMGWJcqR.js";import{n as m}from"./projects-DoalTI7c.js";import{n as h}from"./agents-YQJ7JNfI.js";import{t as g}from"./useNotification-DQayTSUL.js";import{a as ne,c as _,o as re,s as v}from"./vendor-forms-DHyqHeyd.js";import{i as y,n as b,t as x}from"./tasks-DHsBE-ea.js";import{i as ie,n as S}from"./taskFormSchemas-B6YlRxrx.js";var C=o(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),w=o(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),T=e(t(),1),E=a(),D={title:``,description:S,status:b.BACKLOG,priority:x.MEDIUM,assigneeId:``,projectId:``},O=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:O,notifyError:ae,notifySuccess:oe}=g(),k=(0,T.useId)(),se=(0,T.useId)(),A=(0,T.useId)(),j=(0,T.useId)(),M=(0,T.useId)(),N=(0,T.useId)(),P=(0,T.useId)(),F=(0,T.useId)(),I=(0,T.useId)(),{control:L,formState:{errors:R},handleSubmit:z,register:B,reset:V,setValue:H}=v({resolver:ne(ie),defaultValues:D,mode:`onBlur`}),U=r({queryKey:[`agents`],enabled:e,queryFn:async()=>(await h.findAll()).data}),W=r({queryKey:[`projects`],enabled:e,queryFn:async()=>(await m.findAll()).data});(0,T.useEffect)(()=>{if(!e){V(D);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,V]),(0,T.useEffect)(()=>{e&&U.error&&O(U.error,`Agents Load Failed`)},[U.error,e,O]),(0,T.useEffect)(()=>{e&&W.error&&O(W.error,`Projects Load Failed`)},[e,O,W.error]);let G=(0,T.useMemo)(()=>W.data??[],[W.data]),K=_({control:L,name:`projectId`});(0,T.useEffect)(()=>{!e||G.length===0||K||H(`projectId`,G[0].id,{shouldDirty:!1,shouldValidate:!0})},[K,e,G,H]);let q=i({mutationFn:async e=>(await y.create(e.projectId,{title:e.title,description:e.description,status:e.status,priority:e.priority,assigneeId:e.assigneeId||void 0,projectId:e.projectId}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`tasks`,e.projectId]}),o.invalidateQueries({queryKey:[`projects`]}),oe(`Task Commissioned`,`The task node has been added to the orchestration grid.`),a?.(),t(),V({...D,projectId:e.projectId})},onError:e=>{O(e,`Task Creation Failed`)}}),J=U.data??[],Y=U.isPending||W.isPending,X=q.isPending,Z=_({control:L,name:`priority`}),ce=_({control:L,name:`status`}),Q=_({control:L,name:`assigneeId`}),le=_({control:L,name:`projectId`}),ue=z(async e=>{await q.mutateAsync(e)},()=>{ae(`Validation Error`,`Please review the highlighted fields before commissioning the task.`)}),$=()=>{X||t()};return e?(0,E.jsx)(f,{children:(0,E.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,E.jsx)(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:$,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,E.jsxs)(p.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":F,"aria-describedby":I,"aria-busy":Y||X,className:`relative w-full max-w-3xl h-full max-h-[750px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,E.jsx)(C,{size:22,"aria-hidden":`true`})}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{id:F,className:`text-xl font-black font-headline text-white tracking-tight`,children:`Comission New Task`}),(0,E.jsx)(`p`,{id:I,className:`text-[10px] uppercase tracking-widest text-on-surface-variant/60 font-bold`,children:`Node Specification Protocol`})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,"aria-label":`Close create task modal`,className:`w-10 h-10 rounded-full flex items-center justify-center text-on-surface-variant hover:bg-surface-container-highest transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,E.jsx)(d,{size:20,"aria-hidden":`true`})})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar`,children:[(0,E.jsxs)(`section`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-primary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Essential Intelligence`})]}),(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{htmlFor:P,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Task Title`}),(0,E.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,E.jsx)(`input`,{id:P,type:`text`,placeholder:`e.g. Synthesize Vector DB results`,"aria-invalid":!!R.title,"aria-describedby":R.title?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-12 px-4 focus:outline-none placeholder:text-on-surface-variant/30 font-medium`,...B(`title`)})}),R.title&&(0,E.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:R.title.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,E.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Objective / Description`}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,S,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-surface-container-highest text-[9px] font-black text-on-surface-variant/60 uppercase tracking-widest transition-colors`,title:`Reset to template`,children:[(0,E.jsx)(l,{size:10,"aria-hidden":`true`}),`Template`]}),(0,E.jsx)(`div`,{className:`w-px h-3 bg-outline-variant/10`}),(0,E.jsxs)(`button`,{type:`button`,onClick:()=>H(`description`,``,{shouldDirty:!0,shouldValidate:!0}),className:`flex items-center gap-1 px-2 py-1 rounded hover:bg-error/10 text-[9px] font-black text-error/60 hover:text-error uppercase tracking-widest transition-colors`,title:`Clear field`,children:[(0,E.jsx)(te,{size:10,"aria-hidden":`true`}),`Clear`]})]})]}),(0,E.jsx)(re,{control:L,name:`description`,render:({field:e})=>(0,E.jsx)(c,{value:e.value,onChange:e.onChange,placeholder:`Describe the desired output and constraints for this node...`,height:`h-52`,maxLength:2e3})}),R.description&&(0,E.jsx)(`p`,{id:se,className:`text-xs text-error font-semibold`,children:R.description.message})]})]})]}),(0,E.jsxs)(`section`,{className:`space-y-6 pt-10 border-t border-outline-variant/10`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 mb-2`,children:[(0,E.jsx)(`div`,{className:`w-1 bg-secondary h-4 rounded-full`}),(0,E.jsx)(`h3`,{className:`text-xs font-black uppercase tracking-[0.2em] text-on-surface-variant`,children:`Operational Configuration`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(w,{size:12,className:`text-secondary`,"aria-hidden":`true`}),`Priority Level`]}),(0,E.jsx)(`div`,{className:`grid grid-cols-4 gap-2 p-1 bg-surface-container-highest/30 rounded-xl ring-1 ring-outline-variant/10`,children:[{id:x.LOW,label:`LOW`},{id:x.MEDIUM,label:`MED`},{id:x.HIGH,label:`HIGH`},{id:x.CRITICAL,label:`CRIT`}].map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":Z===e.id,onClick:()=>H(`priority`,e.id,{shouldDirty:!0,shouldValidate:!0}),className:`py-2 rounded-lg text-[10px] font-black tracking-widest transition-all ${Z===e.id?e.id===x.CRITICAL||e.id===x.HIGH?`bg-error text-on-error shadow-lg shadow-error/30`:`bg-primary text-on-primary shadow-lg shadow-primary/30`:`hover:bg-surface-container-highest text-on-surface-variant`}`,children:e.label},e.id))}),R.priority&&(0,E.jsx)(`p`,{id:j,className:`text-xs text-error font-semibold`,children:R.priority.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-status`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Initial Status`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-status`,value:ce,onChange:e=>H(`status`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.status,"aria-describedby":R.status?A:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer uppercase tracking-widest`,children:[b.BACKLOG,b.IN_PROGRESS,b.REVIEW].map(e=>(0,E.jsx)(`option`,{value:e,className:`bg-surface-container-low text-on-surface uppercase`,children:e},e))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.status&&(0,E.jsx)(`p`,{id:A,className:`text-xs text-error font-semibold`,children:R.status.message})]}),(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 flex items-center gap-1.5`,children:[(0,E.jsx)(u,{size:12,className:`text-primary`,"aria-hidden":`true`}),`Assigned Intelligence (Optional)`]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-3`,children:[J.map(e=>(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":Q===e.id,onClick:()=>H(`assigneeId`,Q===e.id?``:e.id,{shouldDirty:!0,shouldValidate:!0}),className:`p-3 rounded-xl border flex items-center gap-3 transition-all text-left ${Q===e.id?`bg-primary/10 border-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`:`bg-surface-container-highest/20 border-outline-variant/5 hover:border-outline-variant/30 hover:bg-surface-container-highest/30`}`,children:[(0,E.jsx)(`div`,{className:`w-8 h-8 rounded-lg flex items-center justify-center font-bold text-xs ${Q===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:e.name.substring(0,2).toUpperCase()}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-[11px] font-bold ${Q===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name}),(0,E.jsx)(`div`,{className:`text-[9px] text-on-surface-variant/50 uppercase tracking-widest font-black leading-none mt-0.5`,children:e.role||`Agent`})]})]},e.id)),J.length===0&&!U.isPending&&(0,E.jsx)(`div`,{className:`col-span-full py-4 text-center border-2 border-dashed border-outline-variant/10 rounded-xl`,children:(0,E.jsx)(`span`,{className:`text-[10px] font-bold text-on-surface-variant/30 uppercase tracking-[0.2em]`,children:`No active intelligence found`})})]}),R.assigneeId&&(0,E.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:R.assigneeId.message})]}),G.length>1?(0,E.jsxs)(`div`,{className:`space-y-3 col-span-full`,children:[(0,E.jsx)(`label`,{htmlFor:`create-task-project`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Target Project`}),(0,E.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,E.jsx)(`select`,{id:`create-task-project`,value:le,onChange:e=>H(`projectId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!R.projectId,"aria-describedby":R.projectId?N:void 0,className:`w-full bg-transparent border-none text-xs font-bold text-on-surface h-10 px-4 focus:outline-none appearance-none cursor-pointer`,children:G.map(e=>(0,E.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.title},e.id))}),(0,E.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,E.jsx)(s,{size:16,"aria-hidden":`true`})})]}),R.projectId&&(0,E.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:R.projectId.message})]}):G.length===1?(0,E.jsxs)(`div`,{className:`col-span-full px-4 py-2 bg-surface-container-highest/10 rounded-lg border border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40`,children:`Target Project`}),(0,E.jsx)(`span`,{className:`text-xs font-bold text-primary/80`,children:G[0].title})]}):(0,E.jsxs)(`div`,{className:`col-span-full p-4 bg-error/5 border border-error/20 rounded-xl text-center`,children:[(0,E.jsx)(`p`,{className:`text-xs font-bold text-error`,children:`No Project Detected`}),(0,E.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-1 uppercase tracking-widest font-black`,children:`Create a project in the sidebar before commissioning tasks`})]})]})]})]}),(0,E.jsxs)(`div`,{className:`px-8 py-6 bg-surface-container-low/80 backdrop-blur-md border-t border-outline-variant/10 flex items-center justify-between`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold text-on-surface-variant/50 uppercase tracking-widest`,children:[(0,E.jsx)(ee,{size:12,className:`text-primary animate-pulse`,"aria-hidden":`true`}),`Agentic Orchestration Active`]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:$,disabled:X,className:`px-6 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white transition-all hover:bg-surface-container-highest disabled:opacity-50 disabled:cursor-not-allowed`,children:`Discard`}),(0,E.jsxs)(`button`,{type:`button`,onClick:ue,disabled:X||Y||G.length===0,className:`px-10 py-2.5 rounded-lg bg-primary text-on-primary text-sm font-black shadow-[0_8px_20px_rgba(173,198,255,0.2)] hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group relative overflow-hidden disabled:hover:scale-100`,children:[(0,E.jsx)(`div`,{className:`absolute inset-0 bg-white/10 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700 skew-x-12`}),X?`Processing...`:`Comission Task`]})]})]})]})]})}):null};export{O as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{t as r}from"./MarkdownField--1gpyapw.js";import{t as i}from"./paperclip-DWJjaP8B.js";import{t as a}from"./x-wDy15QMx.js";import{n as o,t as s}from"./vendor-motion-CMGWJcqR.js";import{t as c}from"./recurrent-tasks-CKT47N2l.js";import{t as l}from"./AttachmentItem-Cerhbyya.js";var u=e(t(),1),d=n(),f={[c.SUCCESS]:{label:`Success`,dot:`bg-secondary`,badge:`text-secondary bg-secondary/10 border-secondary/20`},[c.FAILURE]:{label:`Failure`,dot:`bg-error`,badge:`text-error bg-error/10 border-error/20`},[c.RUNNING]:{label:`Running`,dot:`bg-tertiary animate-pulse`,badge:`text-tertiary bg-tertiary/10 border-tertiary/20`},[c.CANCELED]:{label:`Canceled`,dot:`bg-on-surface-variant`,badge:`text-on-surface-variant bg-surface-container-highest border-outline-variant/30`}},p=e=>({"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/svg+xml":`svg`,"application/pdf":`pdf`,"text/plain":`txt`,"text/csv":`csv`,"application/json":`json`})[e]??e.split(`/`).pop()??`file`,m=({isOpen:e,onClose:t,exec:n})=>{(0,u.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let m=n?f[n.status]??f[c.CANCELED]:null,h=n?.artifacts?.filter(Boolean)??[];return(0,d.jsx)(o,{children:e&&n&&(0,d.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,d.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,d.jsxs)(s.div,{initial:{opacity:0,scale:.97,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.97,y:12},transition:{duration:.2,ease:`easeOut`},className:`relative w-full max-w-3xl max-h-[85vh] flex flex-col bg-surface-container-low rounded-3xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden`,children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-8 py-6 border-b border-outline-variant/10 flex-shrink-0`,children:[(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-primary font-mono`,children:[`#EXEC-`,n.id.split(`-`)[0].toUpperCase()]}),m&&(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest px-3 py-1 rounded-full border ${m.badge}`,children:[(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${m.dot}`}),m.label]})]}),(0,d.jsx)(`h2`,{className:`text-xl font-headline font-black text-white tracking-tight`,children:`Execution Log`}),(0,d.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant/50 font-mono`,children:[new Date(n.createdAt).toLocaleString(),n.latencyMs!=null&&(0,d.jsx)(`span`,{className:`ml-4 text-on-surface-variant/40`,children:n.latencyMs>=6e4?`${Math.floor(n.latencyMs/6e4)}m ${String(Math.floor(n.latencyMs%6e4/1e3)).padStart(2,`0`)}s`:`${Math.floor(n.latencyMs/1e3)}s`})]})]}),(0,d.jsx)(`button`,{onClick:t,className:`flex-shrink-0 p-2 rounded-xl text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all active:scale-90`,"aria-label":`Close`,children:(0,d.jsx)(a,{size:20})})]}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar px-8 py-6 space-y-8`,children:[(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40 mb-4`,children:`Result`}),(0,d.jsx)(`div`,{className:`bg-surface-container-highest/20 rounded-2xl border border-outline-variant/10 px-6 py-5`,children:n.result?(0,d.jsx)(r,{readOnly:!0,value:n.result}):(0,d.jsx)(`p`,{className:`text-xs text-on-surface-variant/30 italic font-mono uppercase tracking-widest`,children:`No output recorded for this execution.`})})]}),h.length>0&&(0,d.jsxs)(`section`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,d.jsx)(i,{size:14,className:`text-on-surface-variant/40`}),(0,d.jsxs)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40`,children:[`Artifacts`,(0,d.jsx)(`span`,{className:`ml-2 text-primary/60`,children:h.length})]})]}),(0,d.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:h.map(e=>(0,d.jsx)(l,{name:e.originalName,type:p(e.mimeType),filePath:e.filePath},e.id))})]})]})]})]})})};export{m as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{r as n}from"./vendor-markdown-DoJbQ1of.js";import{t as r}from"./MarkdownField-DR6tHsei.js";import{t as i}from"./paperclip-5Y367YTj.js";import{t as a}from"./x-CCZGYGDC.js";import{n as o,t as s}from"./vendor-motion-CMGWJcqR.js";import{t as c}from"./recurrent-tasks-7thk45mk.js";import{t as l}from"./AttachmentItem-C_uUACPz.js";var u=e(t(),1),d=n(),f={[c.SUCCESS]:{label:`Success`,dot:`bg-secondary`,badge:`text-secondary bg-secondary/10 border-secondary/20`},[c.FAILURE]:{label:`Failure`,dot:`bg-error`,badge:`text-error bg-error/10 border-error/20`},[c.RUNNING]:{label:`Running`,dot:`bg-tertiary animate-pulse`,badge:`text-tertiary bg-tertiary/10 border-tertiary/20`},[c.CANCELED]:{label:`Canceled`,dot:`bg-on-surface-variant`,badge:`text-on-surface-variant bg-surface-container-highest border-outline-variant/30`}},p=e=>({"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/svg+xml":`svg`,"application/pdf":`pdf`,"text/plain":`txt`,"text/csv":`csv`,"application/json":`json`})[e]??e.split(`/`).pop()??`file`,m=({isOpen:e,onClose:t,exec:n})=>{(0,u.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let m=n?f[n.status]??f[c.CANCELED]:null,h=n?.artifacts?.filter(Boolean)??[];return(0,d.jsx)(o,{children:e&&n&&(0,d.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,d.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,d.jsxs)(s.div,{initial:{opacity:0,scale:.97,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.97,y:12},transition:{duration:.2,ease:`easeOut`},className:`relative w-full max-w-3xl max-h-[85vh] flex flex-col bg-surface-container-low rounded-3xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden`,children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-8 py-6 border-b border-outline-variant/10 flex-shrink-0`,children:[(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,d.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-primary font-mono`,children:[`#EXEC-`,n.id.split(`-`)[0].toUpperCase()]}),m&&(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest px-3 py-1 rounded-full border ${m.badge}`,children:[(0,d.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${m.dot}`}),m.label]})]}),(0,d.jsx)(`h2`,{className:`text-xl font-headline font-black text-white tracking-tight`,children:`Execution Log`}),(0,d.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant/50 font-mono`,children:[new Date(n.createdAt).toLocaleString(),n.latencyMs!=null&&(0,d.jsx)(`span`,{className:`ml-4 text-on-surface-variant/40`,children:n.latencyMs>=6e4?`${Math.floor(n.latencyMs/6e4)}m ${String(Math.floor(n.latencyMs%6e4/1e3)).padStart(2,`0`)}s`:`${Math.floor(n.latencyMs/1e3)}s`})]})]}),(0,d.jsx)(`button`,{onClick:t,className:`flex-shrink-0 p-2 rounded-xl text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all active:scale-90`,"aria-label":`Close`,children:(0,d.jsx)(a,{size:20})})]}),(0,d.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar px-8 py-6 space-y-8`,children:[(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40 mb-4`,children:`Result`}),(0,d.jsx)(`div`,{className:`bg-surface-container-highest/20 rounded-2xl border border-outline-variant/10 px-6 py-5`,children:n.result?(0,d.jsx)(r,{readOnly:!0,value:n.result}):(0,d.jsx)(`p`,{className:`text-xs text-on-surface-variant/30 italic font-mono uppercase tracking-widest`,children:`No output recorded for this execution.`})})]}),h.length>0&&(0,d.jsxs)(`section`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,d.jsx)(i,{size:14,className:`text-on-surface-variant/40`}),(0,d.jsxs)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.25em] text-on-surface-variant/40`,children:[`Artifacts`,(0,d.jsx)(`span`,{className:`ml-2 text-primary/60`,children:h.length})]})]}),(0,d.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:h.map(e=>(0,d.jsx)(l,{name:e.originalName,type:p(e.mimeType),filePath:e.filePath},e.id))})]})]})]})]})})};export{m as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n,r,t as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-BGOBXkO8.js";import{t as o}from"./eye-Cc-vy4Zu.js";import{t as s}from"./sparkles-v57Nc-z-.js";var c=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),l=e(t(),1),u=r(),d=({label:e,value:t,onChange:r=()=>{},placeholder:a,height:d=`h-40`,helperText:f,maxLength:p,onKeyDown:m,initialMode:h=`write`,readOnly:g=!1})=>{let[_,v]=(0,l.useState)(h);return g?(0,u.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||``})}):(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e&&(0,u.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:e}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface-container-high/50 p-1 rounded-lg ring-1 ring-outline-variant/10`,children:[(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`write`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`write`?`bg-primary text-surface shadow-lg shadow-primary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(c,{size:12}),`Write`]}),(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`preview`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`preview`?`bg-secondary text-surface shadow-lg shadow-secondary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(o,{size:12}),`Preview`]})]})]}),(0,u.jsx)(`div`,{className:`relative group bg-surface-container-highest/30 rounded-lg ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all ${d} overflow-hidden`,children:_===`write`?(0,u.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),onKeyDown:m,placeholder:a,maxLength:p,className:`w-full h-full bg-transparent border-none text-xs text-on-surface p-4 focus:outline-none placeholder:text-on-surface-variant/30 resize-none leading-relaxed font-mono`}):(0,u.jsx)(`div`,{className:`w-full h-full p-4 overflow-y-auto custom-scrollbar prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||`*Nothing to preview*`})})}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f?(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 py-0.5 rounded bg-tertiary/10 text-[9px] font-black text-tertiary tracking-widest uppercase w-fit`,children:[(0,u.jsx)(s,{size:10}),f]}):(0,u.jsx)(`div`,{}),p!=null&&p>0?(0,u.jsxs)(`div`,{className:`text-[10px] font-bold text-on-surface-variant/40 lowercase tracking-widest`,children:[t.length,` / `,p]}):null]})]})};export{c as n,d as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n,r,t as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-B553SX3l.js";import{t as o}from"./eye-CjrFwZG_.js";import{t as s}from"./sparkles-krUpxie4.js";var c=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),l=e(t(),1),u=r(),d=({label:e,value:t,onChange:r=()=>{},placeholder:a,height:d=`h-40`,helperText:f,maxLength:p,onKeyDown:m,initialMode:h=`write`,readOnly:g=!1})=>{let[_,v]=(0,l.useState)(h);return g?(0,u.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||``})}):(0,u.jsxs)(`div`,{className:`space-y-3`,children:[(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e&&(0,u.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:e}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1 bg-surface-container-high/50 p-1 rounded-lg ring-1 ring-outline-variant/10`,children:[(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`write`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`write`?`bg-primary text-surface shadow-lg shadow-primary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(c,{size:12}),`Write`]}),(0,u.jsxs)(`button`,{type:`button`,onClick:()=>v(`preview`),className:`flex items-center gap-1.5 px-3 py-1 rounded-md text-[9px] font-black tracking-widest uppercase transition-all ${_===`preview`?`bg-secondary text-surface shadow-lg shadow-secondary/20`:`text-on-surface-variant/60 hover:text-white`}`,children:[(0,u.jsx)(o,{size:12}),`Preview`]})]})]}),(0,u.jsx)(`div`,{className:`relative group bg-surface-container-highest/30 rounded-lg ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all ${d} overflow-hidden`,children:_===`write`?(0,u.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),onKeyDown:m,placeholder:a,maxLength:p,className:`w-full h-full bg-transparent border-none text-xs text-on-surface p-4 focus:outline-none placeholder:text-on-surface-variant/30 resize-none leading-relaxed font-mono`}):(0,u.jsx)(`div`,{className:`w-full h-full p-4 overflow-y-auto custom-scrollbar prose prose-invert prose-xs max-w-none`,children:(0,u.jsx)(n,{remarkPlugins:[i],children:t||`*Nothing to preview*`})})}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[f?(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 py-0.5 rounded bg-tertiary/10 text-[9px] font-black text-tertiary tracking-widest uppercase w-fit`,children:[(0,u.jsx)(s,{size:10}),f]}):(0,u.jsx)(`div`,{}),p!=null&&p>0?(0,u.jsxs)(`div`,{className:`text-[10px] font-bold text-on-surface-variant/40 lowercase tracking-widest`,children:[t.length,` / `,p]}):null]})]})};export{c as n,d as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n}from"./vendor-react-BmVaKUwY.js";import{r}from"./vendor-markdown-DoJbQ1of.js";import{i}from"./client-BGOBXkO8.js";import{t as a}from"./box-Bw_pyYzU.js";import{t as o}from"./check-DTei8Qlg.js";import{t as s}from"./chevron-down-LTeQHW9O.js";import{t as c}from"./circle-check-B9kyRki5.js";import{n as l,t as u}from"./user-plus-nDkwsBT1.js";import{t as d}from"./eye-Cc-vy4Zu.js";import{n as f,t as ee}from"./users-C6WiDiuN.js";import{n as te,t as p}from"./auth-dROenHXk.js";import{t as ne}from"./rocket-CMSwBl_C.js";import{t as re}from"./save-DycJmlX0.js";import{t as ie}from"./shield-check-Cr4SHjdR.js";import{t as ae}from"./user--KOoEB9m.js";import{t as m}from"./x-wDy15QMx.js";import{t as oe}from"./useProject-DhK9Ze6F.js";import{n as se}from"./AuthContextInstance-DiFo9Qb2.js";import{n as ce,t as le}from"./projects-CUOthD8N.js";import{i as ue,n as h,r as g,t as de}from"./UserAvatar-Z5W8S1dG.js";var _=i(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),fe=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),v=e(t(),1),y=r(),pe=({isOpen:e,selectedAvatar:t,currentAvatar:n,isSaving:r,onSelect:i,onClose:a,onConfirm:s})=>((0,v.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8 backdrop-blur-sm`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-picker-title`,className:`relative w-full max-w-2xl rounded-3xl border border-outline-variant/20 bg-surface p-6 shadow-[0_28px_80px_rgba(0,0,0,0.45)]`,children:[(0,y.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`mb-2 text-[11px] font-bold uppercase tracking-[0.3em] text-primary/80`,children:`Avatar presets`}),(0,y.jsx)(`h2`,{id:`avatar-picker-title`,className:`font-headline text-2xl font-bold text-on-surface`,children:`Choose your avatar`}),(0,y.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Pick one of the built-in presets. Your choice updates everywhere your profile picture is shown.`})]}),(0,y.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close avatar picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,y.jsx)(m,{size:18})})]}),(0,y.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:h.map(e=>{let r=e.key===t,a=e.key===n;return(0,y.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`group relative rounded-2xl border p-3 text-left transition-all ${r?`border-primary bg-primary/10 shadow-[0_0_0_1px_rgba(173,198,255,0.25)]`:`border-outline-variant/20 bg-surface-container-low hover:border-primary/40 hover:bg-surface-container-high`}`,children:[(0,y.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-container-high`,children:(0,y.jsx)(`img`,{src:e.src,alt:e.label,className:`aspect-square w-full object-cover`})}),(0,y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold text-on-surface`,children:e.label}),r?(0,y.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,y.jsx)(o,{size:14})}):null]}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:a?`Current avatar`:`Available preset`})]},e.key)})}),(0,y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,y.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save avatar`]})]})]})]}):null);function b({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,suffix:c,autoComplete:l,error:u}){return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,y.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(`input`,{id:t,type:n,value:r,autoComplete:l,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${u?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,y.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),u&&(0,y.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:u})]})}function me({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,v.useState)(!1);return(0,y.jsx)(b,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,y.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,y.jsx)(l,{size:16}):(0,y.jsx)(d,{size:16})})})}function he({projectId:e,title:t,description:r,status:i,icon:a,iconColor:o}){return(0,y.jsxs)(n,{to:`/projects/${e}`,className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10 hover:bg-surface-container-high transition-colors cursor-pointer ${i===`archived`?`opacity-70`:``}`,children:[(0,y.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg ${o}`,children:a}),(0,y.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded uppercase font-bold tracking-tight ${i===`active`?`bg-secondary/10 text-secondary border border-secondary/20`:`bg-surface-container-highest text-on-surface-variant`}`,children:i.replace(`_`,` `)})]}),(0,y.jsx)(`h3`,{className:`font-headline font-bold text-on-surface text-sm`,children:t}),(0,y.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-1 leading-relaxed`,children:r})]})}var x=()=>{let{user:e,refreshUser:t}=se(),{projects:n,refreshProjects:r}=oe(),i=e?.role===`admin`,o=n.some(e=>e.status===le.ACTIVE),l=i&&!o,d=i?`Only one active project is allowed at a time. Move the active project out of active status before creating a new one.`:`Only admins can create projects.`,[h,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(`user`),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[ge,_e]=(0,v.useState)(!1),[ve,ye]=(0,v.useState)(!1),[be,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(``),[xe,z]=(0,v.useState)(!1),[B,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(!1),[Se,W]=(0,v.useState)(!1),[Ce,G]=(0,v.useState)(!1),[we,K]=(0,v.useState)(!1),[q,J]=(0,v.useState)(``),[Y,Te]=(0,v.useState)(!1),[Ee,X]=(0,v.useState)(g),De=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Oe=()=>{let e={};return h.trim()?h.length>100&&(e.name=`Maximum 100 characters.`):e.name=`First name is required.`,S.trim()?S.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,w.trim()?De.test(w)?w.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email address.`:e.email=`Email is required.`,e},ke=()=>{let e={};return O?O.length<8?e.newPwd=`Minimum 8 characters.`:O.length>72&&(e.newPwd=`Maximum 72 characters.`):e.newPwd=`New password is required.`,A?O!==A&&(e.confirmPwd=`Passwords do not match.`):e.confirmPwd=`Please confirm the new password.`,e},Z=e=>ue(e)?e:g;(0,v.useEffect)(()=>{e&&(x(e.name??``),C(e.lastName??``),T(e.email??``),D(e.role??`user`),X(Z(e.avatar)))},[e]);let Ae=async()=>{let n=Oe();if(Object.keys(n).length>0){N(n);return}N({}),_e(!0),R(``),I(!1);try{let n={};h!==(e?.name??``)&&(n.name=h),S!==(e?.lastName??``)&&(n.lastName=S),w!==(e?.email??``)&&(n.email=w);let r=[];Object.keys(n).length>0&&r.push(p.updateProfile(n)),i&&e?.id&&E!==e?.role&&r.push(ee.updateRole(e.id,E)),r.length>0&&(await Promise.all(r),await t()),I(!0),setTimeout(()=>I(!1),3e3)}catch(e){R(e instanceof Error?e.message:`Failed to save changes`)}finally{_e(!1)}},je=async()=>{let e=ke();if(Object.keys(e).length>0){F(e);return}F({}),V(``),z(!1),ye(!0);try{await p.updateProfile({newPassword:O}),k(``),j(``),z(!0),setTimeout(()=>z(!1),4e3)}catch(e){V(e instanceof Error?e.message:`Failed to update password`)}finally{ye(!1)}},Me=async()=>{if(!(!q||!e?.id)){Te(!0);try{await ce.addMember(q,e.id),await r(),G(!1),J(``)}catch{}finally{Te(!1)}}},Ne=async()=>{R(``),I(!1),U(!0);try{await p.updateProfile({avatar:Ee}),await t(),K(!1),I(!0),setTimeout(()=>I(!1),3e3)}catch(e){R(e instanceof Error?e.message:`Failed to update avatar`)}finally{U(!1)}},Q=e?`${e.name??``} ${e.lastName??``}`.trim():`Agent`,$=e?.role??`user`,Pe=$.charAt(0).toUpperCase()+$.slice(1);return(0,y.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,y.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,y.jsxs)(`div`,{className:`relative group flex-shrink-0`,children:[(0,y.jsx)(`div`,{className:`absolute -inset-1 bg-gradient-to-tr from-primary to-tertiary rounded-full blur opacity-20 group-hover:opacity-40 transition duration-700`}),(0,y.jsx)(de,{name:Q,avatar:e?.avatar,avatarUrl:e?.avatarUrl,alt:Q,className:`relative h-28 w-28 overflow-hidden rounded-full ring-4 ring-surface sm:h-32 sm:w-32`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>{X(Z(e?.avatar)),K(!0)},title:`Change avatar`,className:`absolute bottom-1 right-1 bg-primary text-on-primary p-1.5 rounded-full shadow-lg hover:scale-110 active:scale-95 transition-transform`,children:(0,y.jsx)(fe,{size:14})})]}),(0,y.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,y.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Q}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,y.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest shadow-[0_0_12px_rgba(78,222,163,0.1)]`,children:Pe}),(0,y.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:e?.email})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,y.jsx)(`button`,{id:`profile-cancel-btn`,onClick:()=>{x(e?.name??``),C(e?.lastName??``),T(e?.email??``),D(e?.role??`user`),R(``),N({})},className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm`,children:(0,y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(m,{size:15}),` Cancel`]})}),(0,y.jsxs)(`button`,{id:`profile-save-btn`,onClick:Ae,disabled:ge,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.15)] text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[ge?(0,y.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,y.jsx)(re,{size:15}),`Save Changes`]})]})]}),be&&(0,y.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,y.jsx)(c,{size:16}),` Profile updated successfully.`]}),L&&(0,y.jsx)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium`,children:L}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,y.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,y.jsx)(ae,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Personal Information`})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5`,children:[(0,y.jsx)(b,{label:`First Name`,id:`profile-first-name`,value:h,onChange:x,placeholder:`Your first name`,error:M.name}),(0,y.jsx)(b,{label:`Last Name`,id:`profile-last-name`,value:S,onChange:C,placeholder:`Your last name`,error:M.lastName}),(0,y.jsx)(b,{label:`Email Address`,id:`profile-email`,type:`email`,value:w,onChange:T,placeholder:`your@email.com`,className:`sm:col-span-2`,error:M.email})]})]}),(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,y.jsx)(ie,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Role & Clearance`})]}),(0,y.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-5`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 flex-1`,children:[(0,y.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-widest shadow-[0_0_15px_rgba(78,222,163,0.1)] flex-shrink-0`,children:Pe}),(0,y.jsx)(`p`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:$===`admin`?`Full orchestration privileges across all projects.`:`Standard access for task execution and project participation.`})]}),i&&(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:w-48 flex-shrink-0`,children:[(0,y.jsx)(`label`,{htmlFor:`profile-role-select`,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Update Role`}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsxs)(`select`,{id:`profile-role-select`,value:E,onChange:e=>D(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all appearance-none cursor-pointer`,children:[(0,y.jsx)(`option`,{value:`admin`,children:`Admin`}),(0,y.jsx)(`option`,{value:`user`,children:`Member`})]}),(0,y.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]})]})]})]}),(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex justify-between items-center mb-7`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,y.jsx)(f,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Project Assignments`})]}),i&&(0,y.jsxs)(`button`,{onClick:()=>l&&W(!0),disabled:!l,title:l?void 0:d,className:`text-xs font-bold text-primary flex items-center gap-1 hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:[(0,y.jsx)(_,{size:14}),` Create Project`]})]}),i&&o&&(0,y.jsx)(`p`,{className:`mb-5 text-xs text-on-surface-variant`,children:d}),i&&n.length>0&&(0,y.jsx)(`div`,{className:`mb-5`,children:Ce?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`relative flex-1`,children:[(0,y.jsxs)(`select`,{id:`profile-assign-project-select`,value:q,onChange:e=>J(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 appearance-none`,children:[(0,y.jsx)(`option`,{value:``,children:`Select a project…`}),n.map(e=>(0,y.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,y.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}),(0,y.jsx)(`button`,{onClick:Me,disabled:!q||Y,className:`px-4 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary disabled:opacity-50 hover:brightness-110 transition-all`,children:Y?`…`:`Assign`}),(0,y.jsx)(`button`,{onClick:()=>{G(!1),J(``)},className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:(0,y.jsx)(m,{size:14})})]}):(0,y.jsxs)(`button`,{onClick:()=>G(!0),className:`text-xs font-bold text-on-surface-variant flex items-center gap-1.5 hover:text-primary transition-colors`,children:[(0,y.jsx)(u,{size:14}),` Assign to Project`]})}),n&&n.length>0?(0,y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[n.slice(0,4).map((e,t)=>(0,y.jsx)(he,{projectId:e.id,title:e.title,description:e.description??`No description provided.`,status:e.status,icon:t===0?(0,y.jsx)(ne,{size:18}):t===1?(0,y.jsx)(f,{size:18}):(0,y.jsx)(a,{size:18}),iconColor:t===0?`bg-primary/10 text-primary`:t===1?`bg-tertiary/10 text-tertiary`:`bg-on-surface-variant/10 text-on-surface-variant`},e.id)),i&&l&&(0,y.jsxs)(`div`,{onClick:()=>W(!0),role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&W(!0),className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all cursor-pointer min-h-[140px]`,children:[(0,y.jsx)(_,{size:24,className:`text-primary/40`}),(0,y.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:`New Project`})]})]}):(0,y.jsxs)(`div`,{onClick:l?()=>W(!0):void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,onKeyDown:l?e=>e.key===`Enter`&&W(!0):void 0,className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all min-h-[140px] ${l?`cursor-pointer`:`cursor-default opacity-60`}`,children:[(0,y.jsx)(_,{size:24,className:`text-primary/40`}),(0,y.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:l?`Create First Project`:i?`Active Project Exists`:`No Projects Assigned`})]})]})]}),(0,y.jsx)(`div`,{className:`lg:col-span-4 flex flex-col gap-6`,children:(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,y.jsx)(ie,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Security`})]}),xe&&(0,y.jsxs)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-xs font-medium flex items-center gap-2`,children:[(0,y.jsx)(c,{size:14}),` Password updated successfully.`]}),B&&(0,y.jsx)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-error/10 border border-error/30 text-error text-xs`,children:B}),(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsx)(me,{label:`New Password`,id:`profile-new-pwd`,value:O,onChange:k,placeholder:`Min. 8 characters`,error:P.newPwd}),(0,y.jsx)(me,{label:`Confirm New Password`,id:`profile-confirm-pwd`,value:A,onChange:j,placeholder:`Repeat new password`,error:P.confirmPwd}),(0,y.jsxs)(`button`,{id:`profile-update-creds-btn`,onClick:je,disabled:ve,className:`w-full py-2.5 rounded-lg text-sm font-bold bg-tertiary/10 text-tertiary border border-tertiary/20 hover:bg-tertiary hover:text-on-tertiary transition-all disabled:opacity-60 flex items-center justify-center gap-2`,children:[ve?(0,y.jsx)(`span`,{className:`w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin`}):null,`Update Credentials`]})]})]})})]}),(0,y.jsx)(te,{isOpen:Se,onClose:()=>W(!1),onCreated:async()=>{await r(),W(!1)},canCreate:l,blockedReason:d}),(0,y.jsx)(pe,{isOpen:we,selectedAvatar:Ee,currentAvatar:Z(e?.avatar),isSaving:H,onSelect:X,onClose:()=>{H||(K(!1),X(Z(e?.avatar)))},onConfirm:Ne})]})};export{x as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{n}from"./vendor-react-BmVaKUwY.js";import{r}from"./vendor-markdown-DoJbQ1of.js";import{i}from"./client-B553SX3l.js";import{t as a}from"./box-CFDcDxHv.js";import{t as o}from"./check-BiORptL3.js";import{t as s}from"./chevron-down-BUOg3vvd.js";import{t as c}from"./circle-check-Jz8IOE4h.js";import{n as l,t as u}from"./user-plus-0Y0M1GKi.js";import{t as d}from"./eye-CjrFwZG_.js";import{n as f,t as ee}from"./users-BcnlUG5N.js";import{n as te,t as p}from"./auth-Lh2N3iYN.js";import{t as ne}from"./rocket-B9Iexkcw.js";import{t as re}from"./save-Cmqi1IkN.js";import{t as ie}from"./shield-check-YKs9kUNq.js";import{t as ae}from"./user-Brcjlps5.js";import{t as m}from"./x-CCZGYGDC.js";import{t as oe}from"./useProject-DhK9Ze6F.js";import{n as se}from"./AuthContextInstance-DiFo9Qb2.js";import{n as ce,t as le}from"./projects-DoalTI7c.js";import{i as ue,n as h,r as g,t as de}from"./UserAvatar-Z5W8S1dG.js";var _=i(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),fe=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),v=e(t(),1),y=r(),pe=({isOpen:e,selectedAvatar:t,currentAvatar:n,isSaving:r,onSelect:i,onClose:a,onConfirm:s})=>((0,v.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8 backdrop-blur-sm`,children:[(0,y.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-picker-title`,className:`relative w-full max-w-2xl rounded-3xl border border-outline-variant/20 bg-surface p-6 shadow-[0_28px_80px_rgba(0,0,0,0.45)]`,children:[(0,y.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`mb-2 text-[11px] font-bold uppercase tracking-[0.3em] text-primary/80`,children:`Avatar presets`}),(0,y.jsx)(`h2`,{id:`avatar-picker-title`,className:`font-headline text-2xl font-bold text-on-surface`,children:`Choose your avatar`}),(0,y.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Pick one of the built-in presets. Your choice updates everywhere your profile picture is shown.`})]}),(0,y.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close avatar picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,y.jsx)(m,{size:18})})]}),(0,y.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:h.map(e=>{let r=e.key===t,a=e.key===n;return(0,y.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`group relative rounded-2xl border p-3 text-left transition-all ${r?`border-primary bg-primary/10 shadow-[0_0_0_1px_rgba(173,198,255,0.25)]`:`border-outline-variant/20 bg-surface-container-low hover:border-primary/40 hover:bg-surface-container-high`}`,children:[(0,y.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-container-high`,children:(0,y.jsx)(`img`,{src:e.src,alt:e.label,className:`aspect-square w-full object-cover`})}),(0,y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold text-on-surface`,children:e.label}),r?(0,y.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,y.jsx)(o,{size:14})}):null]}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:a?`Current avatar`:`Available preset`})]},e.key)})}),(0,y.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,y.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save avatar`]})]})]})]}):null);function b({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,suffix:c,autoComplete:l,error:u}){return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,y.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(`input`,{id:t,type:n,value:r,autoComplete:l,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${u?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,y.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),u&&(0,y.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:u})]})}function me({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,v.useState)(!1);return(0,y.jsx)(b,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,y.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,y.jsx)(l,{size:16}):(0,y.jsx)(d,{size:16})})})}function he({projectId:e,title:t,description:r,status:i,icon:a,iconColor:o}){return(0,y.jsxs)(n,{to:`/projects/${e}`,className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10 hover:bg-surface-container-high transition-colors cursor-pointer ${i===`archived`?`opacity-70`:``}`,children:[(0,y.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg ${o}`,children:a}),(0,y.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded uppercase font-bold tracking-tight ${i===`active`?`bg-secondary/10 text-secondary border border-secondary/20`:`bg-surface-container-highest text-on-surface-variant`}`,children:i.replace(`_`,` `)})]}),(0,y.jsx)(`h3`,{className:`font-headline font-bold text-on-surface text-sm`,children:t}),(0,y.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-1 leading-relaxed`,children:r})]})}var x=()=>{let{user:e,refreshUser:t}=se(),{projects:n,refreshProjects:r}=oe(),i=e?.role===`admin`,o=n.some(e=>e.status===le.ACTIVE),l=i&&!o,d=i?`Only one active project is allowed at a time. Move the active project out of active status before creating a new one.`:`Only admins can create projects.`,[h,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(`user`),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(``),[M,N]=(0,v.useState)({}),[P,F]=(0,v.useState)({}),[ge,_e]=(0,v.useState)(!1),[ve,ye]=(0,v.useState)(!1),[be,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(``),[xe,z]=(0,v.useState)(!1),[B,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(!1),[Se,W]=(0,v.useState)(!1),[Ce,G]=(0,v.useState)(!1),[we,K]=(0,v.useState)(!1),[q,J]=(0,v.useState)(``),[Y,Te]=(0,v.useState)(!1),[Ee,X]=(0,v.useState)(g),De=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Oe=()=>{let e={};return h.trim()?h.length>100&&(e.name=`Maximum 100 characters.`):e.name=`First name is required.`,S.trim()?S.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,w.trim()?De.test(w)?w.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email address.`:e.email=`Email is required.`,e},ke=()=>{let e={};return O?O.length<8?e.newPwd=`Minimum 8 characters.`:O.length>72&&(e.newPwd=`Maximum 72 characters.`):e.newPwd=`New password is required.`,A?O!==A&&(e.confirmPwd=`Passwords do not match.`):e.confirmPwd=`Please confirm the new password.`,e},Z=e=>ue(e)?e:g;(0,v.useEffect)(()=>{e&&(x(e.name??``),C(e.lastName??``),T(e.email??``),D(e.role??`user`),X(Z(e.avatar)))},[e]);let Ae=async()=>{let n=Oe();if(Object.keys(n).length>0){N(n);return}N({}),_e(!0),R(``),I(!1);try{let n={};h!==(e?.name??``)&&(n.name=h),S!==(e?.lastName??``)&&(n.lastName=S),w!==(e?.email??``)&&(n.email=w);let r=[];Object.keys(n).length>0&&r.push(p.updateProfile(n)),i&&e?.id&&E!==e?.role&&r.push(ee.updateRole(e.id,E)),r.length>0&&(await Promise.all(r),await t()),I(!0),setTimeout(()=>I(!1),3e3)}catch(e){R(e instanceof Error?e.message:`Failed to save changes`)}finally{_e(!1)}},je=async()=>{let e=ke();if(Object.keys(e).length>0){F(e);return}F({}),V(``),z(!1),ye(!0);try{await p.updateProfile({newPassword:O}),k(``),j(``),z(!0),setTimeout(()=>z(!1),4e3)}catch(e){V(e instanceof Error?e.message:`Failed to update password`)}finally{ye(!1)}},Me=async()=>{if(!(!q||!e?.id)){Te(!0);try{await ce.addMember(q,e.id),await r(),G(!1),J(``)}catch{}finally{Te(!1)}}},Ne=async()=>{R(``),I(!1),U(!0);try{await p.updateProfile({avatar:Ee}),await t(),K(!1),I(!0),setTimeout(()=>I(!1),3e3)}catch(e){R(e instanceof Error?e.message:`Failed to update avatar`)}finally{U(!1)}},Q=e?`${e.name??``} ${e.lastName??``}`.trim():`Agent`,$=e?.role??`user`,Pe=$.charAt(0).toUpperCase()+$.slice(1);return(0,y.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,y.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,y.jsxs)(`div`,{className:`relative group flex-shrink-0`,children:[(0,y.jsx)(`div`,{className:`absolute -inset-1 bg-gradient-to-tr from-primary to-tertiary rounded-full blur opacity-20 group-hover:opacity-40 transition duration-700`}),(0,y.jsx)(de,{name:Q,avatar:e?.avatar,avatarUrl:e?.avatarUrl,alt:Q,className:`relative h-28 w-28 overflow-hidden rounded-full ring-4 ring-surface sm:h-32 sm:w-32`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>{X(Z(e?.avatar)),K(!0)},title:`Change avatar`,className:`absolute bottom-1 right-1 bg-primary text-on-primary p-1.5 rounded-full shadow-lg hover:scale-110 active:scale-95 transition-transform`,children:(0,y.jsx)(fe,{size:14})})]}),(0,y.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,y.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Q}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,y.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest shadow-[0_0_12px_rgba(78,222,163,0.1)]`,children:Pe}),(0,y.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:e?.email})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,y.jsx)(`button`,{id:`profile-cancel-btn`,onClick:()=>{x(e?.name??``),C(e?.lastName??``),T(e?.email??``),D(e?.role??`user`),R(``),N({})},className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm`,children:(0,y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(m,{size:15}),` Cancel`]})}),(0,y.jsxs)(`button`,{id:`profile-save-btn`,onClick:Ae,disabled:ge,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.15)] text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[ge?(0,y.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,y.jsx)(re,{size:15}),`Save Changes`]})]})]}),be&&(0,y.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,y.jsx)(c,{size:16}),` Profile updated successfully.`]}),L&&(0,y.jsx)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium`,children:L}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,y.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,y.jsx)(ae,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Personal Information`})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5`,children:[(0,y.jsx)(b,{label:`First Name`,id:`profile-first-name`,value:h,onChange:x,placeholder:`Your first name`,error:M.name}),(0,y.jsx)(b,{label:`Last Name`,id:`profile-last-name`,value:S,onChange:C,placeholder:`Your last name`,error:M.lastName}),(0,y.jsx)(b,{label:`Email Address`,id:`profile-email`,type:`email`,value:w,onChange:T,placeholder:`your@email.com`,className:`sm:col-span-2`,error:M.email})]})]}),(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,y.jsx)(ie,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Role & Clearance`})]}),(0,y.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-5`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 flex-1`,children:[(0,y.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-widest shadow-[0_0_15px_rgba(78,222,163,0.1)] flex-shrink-0`,children:Pe}),(0,y.jsx)(`p`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:$===`admin`?`Full orchestration privileges across all projects.`:`Standard access for task execution and project participation.`})]}),i&&(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:w-48 flex-shrink-0`,children:[(0,y.jsx)(`label`,{htmlFor:`profile-role-select`,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Update Role`}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsxs)(`select`,{id:`profile-role-select`,value:E,onChange:e=>D(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all appearance-none cursor-pointer`,children:[(0,y.jsx)(`option`,{value:`admin`,children:`Admin`}),(0,y.jsx)(`option`,{value:`user`,children:`Member`})]}),(0,y.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]})]})]})]}),(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex justify-between items-center mb-7`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,y.jsx)(f,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Project Assignments`})]}),i&&(0,y.jsxs)(`button`,{onClick:()=>l&&W(!0),disabled:!l,title:l?void 0:d,className:`text-xs font-bold text-primary flex items-center gap-1 hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:[(0,y.jsx)(_,{size:14}),` Create Project`]})]}),i&&o&&(0,y.jsx)(`p`,{className:`mb-5 text-xs text-on-surface-variant`,children:d}),i&&n.length>0&&(0,y.jsx)(`div`,{className:`mb-5`,children:Ce?(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsxs)(`div`,{className:`relative flex-1`,children:[(0,y.jsxs)(`select`,{id:`profile-assign-project-select`,value:q,onChange:e=>J(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 appearance-none`,children:[(0,y.jsx)(`option`,{value:``,children:`Select a project…`}),n.map(e=>(0,y.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,y.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}),(0,y.jsx)(`button`,{onClick:Me,disabled:!q||Y,className:`px-4 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary disabled:opacity-50 hover:brightness-110 transition-all`,children:Y?`…`:`Assign`}),(0,y.jsx)(`button`,{onClick:()=>{G(!1),J(``)},className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:(0,y.jsx)(m,{size:14})})]}):(0,y.jsxs)(`button`,{onClick:()=>G(!0),className:`text-xs font-bold text-on-surface-variant flex items-center gap-1.5 hover:text-primary transition-colors`,children:[(0,y.jsx)(u,{size:14}),` Assign to Project`]})}),n&&n.length>0?(0,y.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[n.slice(0,4).map((e,t)=>(0,y.jsx)(he,{projectId:e.id,title:e.title,description:e.description??`No description provided.`,status:e.status,icon:t===0?(0,y.jsx)(ne,{size:18}):t===1?(0,y.jsx)(f,{size:18}):(0,y.jsx)(a,{size:18}),iconColor:t===0?`bg-primary/10 text-primary`:t===1?`bg-tertiary/10 text-tertiary`:`bg-on-surface-variant/10 text-on-surface-variant`},e.id)),i&&l&&(0,y.jsxs)(`div`,{onClick:()=>W(!0),role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&W(!0),className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all cursor-pointer min-h-[140px]`,children:[(0,y.jsx)(_,{size:24,className:`text-primary/40`}),(0,y.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:`New Project`})]})]}):(0,y.jsxs)(`div`,{onClick:l?()=>W(!0):void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,onKeyDown:l?e=>e.key===`Enter`&&W(!0):void 0,className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all min-h-[140px] ${l?`cursor-pointer`:`cursor-default opacity-60`}`,children:[(0,y.jsx)(_,{size:24,className:`text-primary/40`}),(0,y.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:l?`Create First Project`:i?`Active Project Exists`:`No Projects Assigned`})]})]})]}),(0,y.jsx)(`div`,{className:`lg:col-span-4 flex flex-col gap-6`,children:(0,y.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,y.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,y.jsx)(ie,{size:18})}),(0,y.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Security`})]}),xe&&(0,y.jsxs)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-xs font-medium flex items-center gap-2`,children:[(0,y.jsx)(c,{size:14}),` Password updated successfully.`]}),B&&(0,y.jsx)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-error/10 border border-error/30 text-error text-xs`,children:B}),(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsx)(me,{label:`New Password`,id:`profile-new-pwd`,value:O,onChange:k,placeholder:`Min. 8 characters`,error:P.newPwd}),(0,y.jsx)(me,{label:`Confirm New Password`,id:`profile-confirm-pwd`,value:A,onChange:j,placeholder:`Repeat new password`,error:P.confirmPwd}),(0,y.jsxs)(`button`,{id:`profile-update-creds-btn`,onClick:je,disabled:ve,className:`w-full py-2.5 rounded-lg text-sm font-bold bg-tertiary/10 text-tertiary border border-tertiary/20 hover:bg-tertiary hover:text-on-tertiary transition-all disabled:opacity-60 flex items-center justify-center gap-2`,children:[ve?(0,y.jsx)(`span`,{className:`w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin`}):null,`Update Credentials`]})]})]})})]}),(0,y.jsx)(te,{isOpen:Se,onClose:()=>W(!1),onCreated:async()=>{await r(),W(!1)},canCreate:l,blockedReason:d}),(0,y.jsx)(pe,{isOpen:we,selectedAvatar:Ee,currentAvatar:Z(e?.avatar),isSaving:H,onSelect:X,onClose:()=>{H||(K(!1),X(Z(e?.avatar)))},onConfirm:Ne})]})};export{x as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{c as n,s as r}from"./vendor-react-BmVaKUwY.js";import{r as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-BGOBXkO8.js";import{t as o}from"./briefcase-DtHlat45.js";import{t as s}from"./chevron-down-LTeQHW9O.js";import{t as c}from"./MarkdownField--1gpyapw.js";import{t as l}from"./layers-BcHXXg-4.js";import{t as u}from"./save-DycJmlX0.js";import{t as d}from"./shield-check-Cr4SHjdR.js";import{t as f}from"./sparkles-v57Nc-z-.js";import{t as p}from"./trash-2-DJpTXgEP.js";import{t as m}from"./user--KOoEB9m.js";import{t as h}from"./useProject-DhK9Ze6F.js";import{n as g,t as _}from"./projects-CUOthD8N.js";import{n as v}from"./agents-b8btewki.js";import{t as y}from"./useNotification-DQayTSUL.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=y(),{projects:C,refreshProjects:w}=h(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===_.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(_.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([g.findOne(e),v.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||_.PLANNING),V(r.ownerAgent?.id||``)}catch(e){a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(o,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(p,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await g.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(_).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===_.ACTIVE&&N&&R!==_.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==_.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(m,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(s,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(f,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{c as n,s as r}from"./vendor-react-BmVaKUwY.js";import{r as i}from"./vendor-markdown-DoJbQ1of.js";import{i as a}from"./client-B553SX3l.js";import{t as o}from"./briefcase-mFWNV6w9.js";import{t as s}from"./chevron-down-BUOg3vvd.js";import{t as c}from"./MarkdownField-DR6tHsei.js";import{t as l}from"./layers-CVf8_Byb.js";import{t as u}from"./save-Cmqi1IkN.js";import{t as d}from"./shield-check-YKs9kUNq.js";import{t as f}from"./sparkles-krUpxie4.js";import{t as p}from"./trash-2-CphQfk35.js";import{t as m}from"./user-Brcjlps5.js";import{t as h}from"./useProject-DhK9Ze6F.js";import{n as g,t as _}from"./projects-DoalTI7c.js";import{n as v}from"./agents-YQJ7JNfI.js";import{t as y}from"./useNotification-DQayTSUL.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=y(),{projects:C,refreshProjects:w}=h(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===_.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(_.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([g.findOne(e),v.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||_.PLANNING),V(r.ownerAgent?.id||``)}catch(e){a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(o,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(p,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await g.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(_).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===_.ACTIVE&&N&&R!==_.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==_.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(m,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(s,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(f,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};