@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}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"./box-Bw_pyYzU.js";import{t as c}from"./chevron-right-G5-HRo_C.js";import{t as l}from"./clock-BY4rrypg.js";import{t as u}from"./cpu-8Sbc9Dk0.js";import{t as d}from"./database-D6O4hvbm.js";import{n as f,r as p,t as m}from"./providers-CNrSTcdc.js";import{t as h}from"./info-1jA6X-_e.js";import{t as g}from"./plus-Dx6G8SOZ.js";import{t as _}from"./rocket-CMSwBl_C.js";import{t as v}from"./server-CJE2K1Vt.js";import{t as y}from"./trash-2-DJpTXgEP.js";import{t as b}from"./ConfirmDialog-y3vTcqFR.js";import{t as x}from"./x-wDy15QMx.js";import{t as S}from"./zap-BmhZqgvm.js";import{n as C,t as w}from"./vendor-motion-CMGWJcqR.js";import{t as T}from"./useNotification-DQayTSUL.js";import{t as E}from"./cn-CWOQtFh4.js";var D=o(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),O=o(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),k=e(t(),1),A={all:[`providers`],models:e=>[`providers`,e,`models`]},j=()=>r({queryKey:A.all,queryFn:async()=>(await m.findAll()).data}),M=e=>r({queryKey:e?A.models(e):[`providers`,`unselected`,`models`],queryFn:async()=>{if(!e)return[];let t=await m.findModels(e);return Array.isArray(t.data)?t.data:[]},enabled:!!e}),N=e=>{let t=n(),{notifyApiError:r}=T();return i({mutationFn:async({providerName:e,models:t})=>{let n=(await m.create({name:e.trim()})).data,r=t.map(e=>e.trim()).filter(Boolean);return r.length>0&&await Promise.all(r.map(e=>f.create({name:e,providerId:n.id}))),n},onSuccess:async n=>{await Promise.all([t.invalidateQueries({queryKey:A.all}),t.invalidateQueries({queryKey:A.models(n.id)})]),e?.onSuccess?.(n)},onError:e=>{r(e,`Registration Failed`)}})},P=e=>{let t=n(),{notifyApiError:r}=T();return i({mutationFn:async({providerId:e,models:t})=>{let n=t.map(e=>e.trim()).filter(Boolean);await Promise.all(n.map(t=>f.create({name:t,providerId:e})))},onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:A.models(r.providerId)}),e?.onSuccess?.()},onError:e=>{r(e,`Registration Failed`)}})},F=e=>{let t=n(),{notifySuccess:r,notifyApiError:a}=T();return i({mutationFn:e=>f.delete(e),onSuccess:async()=>{await t.invalidateQueries({queryKey:A.models(e)}),r(`Model Removed`,`The model has been successfully deleted from the registry.`)},onError:e=>{a(e,`Cannot Delete Model`)}})},I=a(),L=({isOpen:e,onClose:t,onCreated:n,providerId:r,providerName:i})=>{let[a,o]=(0,k.useState)([``]),s=P({onSuccess:()=>{n(),o([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!s.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[s.isPending,e,t]);let c=(0,k.useMemo)(()=>a.some(e=>e.trim().length>0),[a]),l=a.length>1,d=()=>o(e=>[...e,``]),f=(e,t)=>{o(n=>{let r=[...n];return r[e]=t,r})},p=e=>{l&&o(t=>t.filter((t,n)=>n!==e))},m=()=>{s.isPending||t()};return(0,I.jsx)(C,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 text-white`,children:[(0,I.jsx)(w.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:m,disabled:s.isPending,"aria-label":`Close create model modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(w.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`create-model-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(78,222,163,0.1)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(u,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`create-model-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Expand Provider Fleets`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:m,disabled:s.isPending,"aria-label":`Close create model modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(x,{size:18})})]}),(0,I.jsxs)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:[`Registering new registry variants for `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:i})]})]}),(0,I.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),!(!r||!c)&&await s.mutateAsync({providerId:r,models:a})},children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Identifiers`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:`Batch register endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[300px] overflow-y-auto pr-2 scrollbar-none custom-scrollbar`,children:a.map((e,t)=>(0,I.jsxs)(w.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{autoFocus:t===a.length-1,type:`text`,value:e,onChange:e=>f(t,e.target.value),placeholder:`e.g., gpt-4o-2024-05-13`,disabled:s.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model identifier ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>p(t),disabled:!l||s.isPending,"aria-label":`Remove model identifier ${t+1}`,title:l?`Remove model identifier`:`At least one model input is kept visible`,className:E(`w-12 h-12 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,l?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,s.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(y,{size:18})})]},`${e}-${t}`))}),(0,I.jsxs)(`button`,{type:`button`,onClick:d,disabled:s.isPending,className:`w-full py-4 border-2 border-dashed border-primary/20 rounded-xl flex items-center justify-center gap-3 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest bg-primary/5 hover:bg-primary/10 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model identifier`,children:[(0,I.jsx)(g,{size:16,className:`group-hover:scale-110 transition-transform`}),`Register New Target variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-primary/5 p-5 rounded-2xl flex gap-4 border border-primary/5 transition-all group relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-primary/5 blur-2xl rounded-full -mr-10 -mt-10 pointer-events-none`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(S,{size:18,className:`text-primary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Batch models registered here will be synchronized with the`,` `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:`Orchestrator Registry`}),` for global accessibility.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:m,disabled:s.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:s.isPending||!c||!r,className:`bg-primary px-8 py-3.5 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:s.isPending?(0,I.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{size:16}),`Append Provider Fleets`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -right-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},R=({isOpen:e,onClose:t,onCreated:n})=>{let{notifyError:r}=T(),[i,a]=(0,k.useState)(``),[o,c]=(0,k.useState)([``]),l=N({onSuccess:e=>{n?.(e.id),a(``),c([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!l.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,l.isPending]);let u=o.length>1,d=i.trim().length>0,f=(0,k.useMemo)(()=>o.filter(e=>e.trim().length>0).length,[o]),p=()=>c(e=>[...e,``]),m=(e,t)=>{c(n=>{let r=[...n];return r[e]=t,r})},v=e=>{u&&c(t=>t.filter((t,n)=>n!==e))},b=()=>{l.isPending||t()};return(0,I.jsx)(C,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,children:[(0,I.jsx)(w.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:b,disabled:l.isPending,"aria-label":`Close register provider modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(w.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`register-provider-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(173,198,255,0.2)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(s,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`register-provider-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Register Provider`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:b,disabled:l.isPending,"aria-label":`Close register provider modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(x,{size:18})})]}),(0,I.jsx)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:`Onboard a new computational gateway to your agentic ecosystem.`})]}),(0,I.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!d){r(`Validation Error`,`Please enter a provider name`);return}await l.mutateAsync({providerName:i,models:o})},children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,htmlFor:`provider-name-input`,children:`Provider Name`}),(0,I.jsx)(`div`,{className:`bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{id:`provider-name-input`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g., OpenAI`,disabled:l.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`})})]}),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Variants`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:f>0?`${f} pending`:`Define available endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[200px] overflow-y-auto pr-2 scrollbar-hide`,children:o.map((e,t)=>(0,I.jsxs)(w.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/5 focus-within:ring-secondary/40 transition-all`,children:(0,I.jsx)(`input`,{type:`text`,value:e,onChange:e=>m(t,e.target.value),placeholder:`gpt-4o`,disabled:l.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-2.5 text-xs text-white focus:outline-none placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model variant ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>v(t),disabled:!u||l.isPending,"aria-label":`Remove model variant ${t+1}`,title:u?`Remove model variant`:`At least one model input is kept visible`,className:E(`w-10 h-10 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,u?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,l.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(y,{size:16})})]},`${e}-${t}`))}),(0,I.jsxs)(`button`,{type:`button`,onClick:p,disabled:l.isPending,className:`w-full py-3 border-2 border-dashed border-outline-variant/10 rounded-xl flex items-center justify-center gap-2 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model variant`,children:[(0,I.jsx)(g,{size:14,className:`group-hover:scale-110 transition-transform`}),`Add model variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-tertiary-container/10 p-5 rounded-2xl flex gap-4 border border-tertiary/5 relative overflow-hidden group`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-tertiary/5 blur-2xl rounded-full -mr-10 -mt-10`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-tertiary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(h,{size:18,className:`text-tertiary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Once registered, these models will be available in the`,` `,(0,I.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Orchestration Canvas`}),` for node deployment and agent personality mapping.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:b,disabled:l.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:l.isPending||!d,className:`bg-primary px-8 py-3 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:l.isPending?(0,I.jsx)(`span`,{className:`w-3 h-3 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(_,{size:14}),`Register Provider`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -left-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},z=({model:e,onDelete:t})=>{let[n,r]=(0,k.useState)(!1),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return n&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,I.jsxs)(`div`,{ref:i,className:`relative inline-block`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":`Actions for model ${e.name}`,title:`Actions for model ${e.name}`,className:`text-on-surface-variant/40 hover:text-white transition-colors p-1 rounded`,children:(0,I.jsx)(p,{size:14})}),n&&(0,I.jsx)(`div`,{className:`absolute right-0 bottom-full mb-1 z-50 w-36 bg-surface-container-high rounded-xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden animate-in fade-in zoom-in-95 duration-150`,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{r(!1),t(e)},className:`w-full px-4 py-3 text-left text-xs font-bold text-error hover:bg-error/10 transition-colors flex items-center gap-2`,"aria-label":`Remove model ${e.name}`,children:[(0,I.jsx)(y,{size:12}),`Remove`]})})]})},B=({provider:e,models:t,isLoadingModels:n,isRefreshing:r,onRefresh:i,onOpenCreateModel:a,onDeleteModel:o})=>e?(0,I.jsxs)(`div`,{className:`bg-surface-container-low rounded-3xl overflow-hidden ring-1 ring-outline-variant/10 shadow-2xl animate-in fade-in zoom-in-95 duration-500`,children:[(0,I.jsxs)(`div`,{className:`p-10 relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-[500px] h-full bg-gradient-to-l from-primary/5 to-transparent pointer-events-none`}),(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start justify-between gap-8 relative z-10`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 bg-surface rounded-2xl flex items-center justify-center ring-1 ring-primary/20 shadow-inner group transition-all duration-500 hover:ring-primary/40`,children:(0,I.jsx)(D,{size:40,className:`text-primary group-hover:scale-110 transition-transform`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h2`,{className:`text-3xl font-headline font-black text-white tracking-tight`,children:e.name}),(0,I.jsx)(`div`,{className:`flex gap-2`,children:(0,I.jsx)(`span`,{className:`px-2.5 py-0.5 bg-secondary/10 text-secondary text-[9px] font-black uppercase tracking-widest rounded ring-1 ring-secondary/20 font-headline`,children:`Primary`})})]}),(0,I.jsx)(`p`,{className:`text-on-surface-variant/60 text-sm mt-2`,children:e.description||`Infrastructure gateway for agentic cognition & reasoning.`})]})]}),(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:i,disabled:r,"aria-label":`Refresh ${e.name} data`,title:`Refresh ${e.name} data`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(O,{size:18,className:E(r&&`animate-spin`)})}),(0,I.jsx)(`button`,{type:`button`,disabled:!0,"aria-label":`More provider actions unavailable`,title:`More provider actions unavailable`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant/40 transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(p,{size:18})})]})]})]}),(0,I.jsxs)(`div`,{className:`p-10 border-t border-outline-variant/5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h3`,{className:`font-headline font-black text-lg text-white`,children:`Registered Models`}),(0,I.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-surface-container-high text-[10px] font-bold text-on-surface-variant`,children:[t.length,` Models`]})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:a,disabled:!e.id,className:`text-[10px] font-black uppercase tracking-widest text-primary hover:text-primary/70 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Register models for ${e.name}`,children:[(0,I.jsx)(`div`,{className:`w-5 h-5 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(g,{size:12})}),`Register New Model`]})]}),(0,I.jsx)(`div`,{className:`rounded-2xl border border-outline-variant/5 overflow-visible`,children:(0,I.jsxs)(`table`,{className:`w-full text-left text-xs border-collapse`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{className:`bg-surface-container-high/30 text-on-surface-variant/40 font-black uppercase tracking-[0.2em]`,children:[(0,I.jsx)(`th`,{className:`py-5 px-6`,children:`Model ID`}),(0,I.jsx)(`th`,{className:`py-5 px-6 text-right`,children:`Status`}),(0,I.jsx)(`th`,{className:`py-5 px-6 w-12 text-center`,children:`Action`})]})}),(0,I.jsx)(`tbody`,{className:`divide-y divide-outline-variant/5`,children:n?(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-20 text-center`,children:(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center space-y-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin`}),(0,I.jsx)(`p`,{className:`text-[10px] uppercase font-black tracking-widest text-primary animate-pulse`,children:`Hydrating Model Registry...`})]})})}):t.length>0?t.map(e=>(0,I.jsxs)(`tr`,{className:`group hover:bg-primary/5 transition-all`,children:[(0,I.jsx)(`td`,{className:`py-5 px-6 font-mono text-on-surface font-medium`,children:e.name}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-right`,children:(0,I.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 rounded font-black text-[8px] uppercase tracking-widest bg-secondary/10 text-secondary`,children:`Active`})}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-center`,children:(0,I.jsx)(z,{model:e,onDelete:o})})]},e.id)):(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-12 text-center text-on-surface-variant/20 italic font-medium`,children:`No models registered for this provider gate.`})})})]})})]}),(0,I.jsxs)(`div`,{className:`ui-helper-text p-8 border-t border-outline-variant/5 bg-surface-container-lowest/20 flex items-center gap-3`,children:[(0,I.jsx)(l,{size:14,className:`text-tertiary`}),`Model registry updates propagate automatically after provider and model changes.`]})]}):(0,I.jsxs)(`div`,{className:`h-[600px] bg-surface-container-low/50 rounded-3xl border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-on-surface-variant gap-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 rounded-2xl bg-surface-container flex items-center justify-center shadow-inner`,children:(0,I.jsx)(D,{size:40,className:`text-primary/50`})}),(0,I.jsxs)(`div`,{className:`text-center`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-headline font-black text-white uppercase tracking-widest mb-1`,children:`Infrastructure Hub`}),(0,I.jsx)(`p`,{className:`text-[10px] font-medium opacity-60`,children:`Select a provider on the left to view active node details.`})]})]}),V=({providers:e,selectedProviderId:t,selectedProviderModelCount:n,isLoading:r,onSelect:i})=>r&&e.length===0?(0,I.jsx)(`div`,{className:`space-y-3`,"aria-live":`polite`,children:Array.from({length:3}).map((e,t)=>(0,I.jsx)(`div`,{className:`h-28 rounded-2xl border border-outline-variant/10 bg-surface-container-low animate-pulse`},t))}):e.length===0?(0,I.jsxs)(`div`,{className:`p-8 border-2 border-dashed border-outline-variant/10 rounded-2xl flex flex-col items-center justify-center text-center opacity-40`,children:[(0,I.jsx)(v,{size:24,className:`mb-4`}),(0,I.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest leading-relaxed`,children:[`No providers registered yet.`,(0,I.jsx)(`br`,{}),`Establish logical gateways in the infrastructure hub.`]})]}):(0,I.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let r=t===e.id,a=r?`${n} Models Active`:`Select to inspect`;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:E(`w-full p-5 rounded-2xl border text-left transition-all duration-300 group`,r?`bg-surface-container-high border-secondary/20 shadow-lg shadow-secondary/5 ring-1 ring-secondary/10 text-white`:`bg-surface-container-low border-transparent hover:bg-surface-container-high/50 text-on-surface-variant`),"aria-pressed":r,"aria-label":`Select provider ${e.name}`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,I.jsx)(`div`,{className:E(`w-10 h-10 rounded-xl bg-surface-container-highest flex items-center justify-center transition-colors`,r?`text-primary`:`text-on-surface-variant`),children:(0,I.jsx)(d,{size:20})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:E(`font-bold text-sm block transition-colors`,r?`text-white`:`group-hover:text-white`),children:e.name}),(0,I.jsx)(`span`,{className:`text-[9px] font-bold text-on-surface-variant/40 uppercase tracking-widest leading-none mt-1 block`,children:a})]})]}),(0,I.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-secondary animate-pulse shadow-[0_0_10px_rgba(78,222,163,0.5)]`})]}),(0,I.jsx)(`div`,{className:`flex justify-start`,children:(0,I.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest text-secondary`,children:`Healthy`})})]},e.id)})}),H=()=>{let[e,t]=(0,k.useState)(!1),[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),{data:c=[],isPending:l,isFetching:u,refetch:d}=j(),f=c.find(e=>e.id===i)?.id??c[0]?.id??null,p=M(f),m=(0,k.useMemo)(()=>c.find(e=>e.id===f)??null,[c,f]),{mutate:h,isPending:g}=F(f??``),_=(0,k.useCallback)(async()=>{await Promise.all([d(),f?p.refetch():Promise.resolve(void 0)])},[p,d,f]);return{providers:c,selectedProvider:m,selectedProviderId:f,setSelectedProviderId:a,models:p.data??[],isLoadingProviders:l,isFetchingProviders:u,isLoadingModels:p.isPending||p.isFetching,isRegisterProviderModalOpen:e,setIsRegisterProviderModalOpen:t,isCreateModelModalOpen:n,setIsCreateModelModalOpen:r,refreshProviders:_,modelPendingDelete:o,setModelPendingDelete:s,deleteModel:h,isDeletingModel:g}},U=()=>{let{providers:e,selectedProvider:t,selectedProviderId:n,setSelectedProviderId:r,models:i,isLoadingProviders:a,isFetchingProviders:o,isLoadingModels:s,isRegisterProviderModalOpen:l,setIsRegisterProviderModalOpen:u,isCreateModelModalOpen:d,setIsCreateModelModalOpen:f,refreshProviders:p,modelPendingDelete:m,setModelPendingDelete:h,deleteModel:_,isDeletingModel:y}=H();return(0,I.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,I.jsx)(`header`,{children:(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-end justify-between gap-6`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`nav`,{className:`flex items-center gap-2 mb-2 text-[10px] uppercase tracking-widest text-primary font-bold`,children:[(0,I.jsx)(`span`,{className:`opacity-60`,children:`Infrastructure`}),(0,I.jsx)(c,{size:12,className:`opacity-40`}),(0,I.jsx)(`span`,{children:`Model Providers`})]}),(0,I.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline tracking-tighter text-white`,children:`Provider Core`}),(0,I.jsx)(`p`,{className:`text-on-surface-variant text-sm mt-1`,children:`Manage global LLM integrations and endpoint health.`})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{p()},disabled:o,className:`px-5 py-2.5 bg-surface-container-high text-on-surface rounded-lg text-xs font-bold uppercase tracking-widest hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Refresh provider status`,children:[(0,I.jsx)(O,{size:14,className:E(o&&`animate-spin`)}),o?`Refreshing...`:`Refresh Status`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`px-6 py-2.5 bg-primary text-on-primary rounded-lg text-xs font-bold uppercase tracking-widest shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all flex items-center gap-2`,"aria-label":`Open register provider modal`,children:[(0,I.jsx)(g,{size:16}),`Register Provider`]})]})]})}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-8`,children:[(0,I.jsxs)(`div`,{className:`lg:col-span-4 space-y-5`,children:[(0,I.jsxs)(`h2`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant/40 flex items-center gap-3`,children:[(0,I.jsx)(v,{size:14,className:`text-primary`}),` Active Providers`]}),(0,I.jsx)(V,{providers:e,selectedProviderId:n,selectedProviderModelCount:n===t?.id?i.length:0,isLoading:a,onSelect:r})]}),(0,I.jsx)(`div`,{className:`lg:col-span-8 space-y-8`,children:(0,I.jsx)(B,{provider:t,models:i,isLoadingModels:s,isRefreshing:o,onRefresh:()=>{p()},onOpenCreateModel:()=>f(!0),onDeleteModel:h})})]}),(0,I.jsx)(R,{isOpen:l,onClose:()=>u(!1),onCreated:e=>{r(e),u(!1)}}),(0,I.jsx)(L,{isOpen:d,onClose:()=>f(!1),onCreated:()=>f(!1),providerId:t?.id??``,providerName:t?.name??``}),(0,I.jsx)(b,{isOpen:m!==null,onClose:()=>h(null),onConfirm:()=>{m&&_(m.id,{onSettled:()=>h(null)})},title:`Remove Model`,message:`Are you sure you want to remove "${m?.name??``}"? This action cannot be undone.`,confirmText:`Remove`,cancelText:`Cancel`,variant:`danger`,loading:y})]})};export{U 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"./box-CFDcDxHv.js";import{t as c}from"./chevron-right-Bm_d1KKk.js";import{t as l}from"./clock-CSNFJjo4.js";import{t as u}from"./cpu-C2_GFeSH.js";import{t as d}from"./database-zXW48-_N.js";import{n as f,r as p,t as m}from"./providers-AawjMy3x.js";import{t as h}from"./info-DGHChFI6.js";import{t as g}from"./plus-CkteVqhM.js";import{t as _}from"./rocket-B9Iexkcw.js";import{t as v}from"./server-BBmM-vrg.js";import{t as y}from"./trash-2-CphQfk35.js";import{t as b}from"./ConfirmDialog-BltdtevE.js";import{t as x}from"./x-CCZGYGDC.js";import{t as S}from"./zap-BDAytXMX.js";import{n as C,t as w}from"./vendor-motion-CMGWJcqR.js";import{t as T}from"./useNotification-DQayTSUL.js";import{t as E}from"./cn-CWOQtFh4.js";var D=o(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),O=o(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),k=e(t(),1),A={all:[`providers`],models:e=>[`providers`,e,`models`]},j=()=>r({queryKey:A.all,queryFn:async()=>(await m.findAll()).data}),M=e=>r({queryKey:e?A.models(e):[`providers`,`unselected`,`models`],queryFn:async()=>{if(!e)return[];let t=await m.findModels(e);return Array.isArray(t.data)?t.data:[]},enabled:!!e}),N=e=>{let t=n(),{notifyApiError:r}=T();return i({mutationFn:async({providerName:e,models:t})=>{let n=(await m.create({name:e.trim()})).data,r=t.map(e=>e.trim()).filter(Boolean);return r.length>0&&await Promise.all(r.map(e=>f.create({name:e,providerId:n.id}))),n},onSuccess:async n=>{await Promise.all([t.invalidateQueries({queryKey:A.all}),t.invalidateQueries({queryKey:A.models(n.id)})]),e?.onSuccess?.(n)},onError:e=>{r(e,`Registration Failed`)}})},P=e=>{let t=n(),{notifyApiError:r}=T();return i({mutationFn:async({providerId:e,models:t})=>{let n=t.map(e=>e.trim()).filter(Boolean);await Promise.all(n.map(t=>f.create({name:t,providerId:e})))},onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:A.models(r.providerId)}),e?.onSuccess?.()},onError:e=>{r(e,`Registration Failed`)}})},F=e=>{let t=n(),{notifySuccess:r,notifyApiError:a}=T();return i({mutationFn:e=>f.delete(e),onSuccess:async()=>{await t.invalidateQueries({queryKey:A.models(e)}),r(`Model Removed`,`The model has been successfully deleted from the registry.`)},onError:e=>{a(e,`Cannot Delete Model`)}})},I=a(),L=({isOpen:e,onClose:t,onCreated:n,providerId:r,providerName:i})=>{let[a,o]=(0,k.useState)([``]),s=P({onSuccess:()=>{n(),o([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!s.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[s.isPending,e,t]);let c=(0,k.useMemo)(()=>a.some(e=>e.trim().length>0),[a]),l=a.length>1,d=()=>o(e=>[...e,``]),f=(e,t)=>{o(n=>{let r=[...n];return r[e]=t,r})},p=e=>{l&&o(t=>t.filter((t,n)=>n!==e))},m=()=>{s.isPending||t()};return(0,I.jsx)(C,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 text-white`,children:[(0,I.jsx)(w.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:m,disabled:s.isPending,"aria-label":`Close create model modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(w.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`create-model-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(78,222,163,0.1)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(u,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`create-model-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Expand Provider Fleets`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:m,disabled:s.isPending,"aria-label":`Close create model modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(x,{size:18})})]}),(0,I.jsxs)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:[`Registering new registry variants for `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:i})]})]}),(0,I.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),!(!r||!c)&&await s.mutateAsync({providerId:r,models:a})},children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Identifiers`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:`Batch register endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[300px] overflow-y-auto pr-2 scrollbar-none custom-scrollbar`,children:a.map((e,t)=>(0,I.jsxs)(w.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{autoFocus:t===a.length-1,type:`text`,value:e,onChange:e=>f(t,e.target.value),placeholder:`e.g., gpt-4o-2024-05-13`,disabled:s.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model identifier ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>p(t),disabled:!l||s.isPending,"aria-label":`Remove model identifier ${t+1}`,title:l?`Remove model identifier`:`At least one model input is kept visible`,className:E(`w-12 h-12 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,l?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,s.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(y,{size:18})})]},`${e}-${t}`))}),(0,I.jsxs)(`button`,{type:`button`,onClick:d,disabled:s.isPending,className:`w-full py-4 border-2 border-dashed border-primary/20 rounded-xl flex items-center justify-center gap-3 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest bg-primary/5 hover:bg-primary/10 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model identifier`,children:[(0,I.jsx)(g,{size:16,className:`group-hover:scale-110 transition-transform`}),`Register New Target variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-primary/5 p-5 rounded-2xl flex gap-4 border border-primary/5 transition-all group relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-primary/5 blur-2xl rounded-full -mr-10 -mt-10 pointer-events-none`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(S,{size:18,className:`text-primary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Batch models registered here will be synchronized with the`,` `,(0,I.jsx)(`span`,{className:`text-primary font-bold`,children:`Orchestrator Registry`}),` for global accessibility.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:m,disabled:s.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:s.isPending||!c||!r,className:`bg-primary px-8 py-3.5 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:s.isPending?(0,I.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g,{size:16}),`Append Provider Fleets`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -right-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},R=({isOpen:e,onClose:t,onCreated:n})=>{let{notifyError:r}=T(),[i,a]=(0,k.useState)(``),[o,c]=(0,k.useState)([``]),l=N({onSuccess:e=>{n?.(e.id),a(``),c([``]),t()}});(0,k.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!l.isPending&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,l.isPending]);let u=o.length>1,d=i.trim().length>0,f=(0,k.useMemo)(()=>o.filter(e=>e.trim().length>0).length,[o]),p=()=>c(e=>[...e,``]),m=(e,t)=>{c(n=>{let r=[...n];return r[e]=t,r})},v=e=>{u&&c(t=>t.filter((t,n)=>n!==e))},b=()=>{l.isPending||t()};return(0,I.jsx)(C,{children:e&&(0,I.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,children:[(0,I.jsx)(w.button,{type:`button`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:b,disabled:l.isPending,"aria-label":`Close register provider modal`,className:`absolute inset-0 bg-background/80 backdrop-blur-md disabled:cursor-not-allowed`}),(0,I.jsxs)(w.div,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`register-provider-title`,initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-lg bg-surface-container-low/90 backdrop-blur-2xl rounded-2xl shadow-[0_0_50px_-12px_rgba(173,198,255,0.2)] overflow-hidden border border-outline-variant/20`,children:[(0,I.jsxs)(`div`,{className:`px-8 pt-8 pb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(s,{size:18,className:`text-primary`})}),(0,I.jsx)(`h2`,{id:`register-provider-title`,className:`text-xl font-headline font-bold text-on-surface tracking-tight`,children:`Register Provider`})]}),(0,I.jsx)(`button`,{type:`button`,onClick:b,disabled:l.isPending,"aria-label":`Close register provider modal`,title:`Close`,className:`p-2 rounded-full hover:bg-white/5 transition-colors text-on-surface-variant/40 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(x,{size:18})})]}),(0,I.jsx)(`p`,{className:`text-xs text-on-surface-variant font-medium opacity-60`,children:`Onboard a new computational gateway to your agentic ecosystem.`})]}),(0,I.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),!d){r(`Validation Error`,`Please enter a provider name`);return}await l.mutateAsync({providerName:i,models:o})},children:[(0,I.jsxs)(`div`,{className:`px-8 py-4 space-y-6`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,htmlFor:`provider-name-input`,children:`Provider Name`}),(0,I.jsx)(`div`,{className:`bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,I.jsx)(`input`,{id:`provider-name-input`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g., OpenAI`,disabled:l.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-3 text-sm focus:outline-none text-white placeholder:text-on-surface-variant/20 disabled:opacity-60`})})]}),(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`label`,{className:`block text-[10px] font-black text-primary tracking-[0.2em] uppercase`,children:`Model Variants`}),(0,I.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/40 italic font-medium`,children:f>0?`${f} pending`:`Define available endpoints`})]}),(0,I.jsx)(`div`,{className:`space-y-3 max-h-[200px] overflow-y-auto pr-2 scrollbar-hide`,children:o.map((e,t)=>(0,I.jsxs)(w.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:`flex gap-2 group`,children:[(0,I.jsx)(`div`,{className:`relative flex-1 bg-surface-container-lowest/50 rounded-xl p-0.5 ring-1 ring-outline-variant/5 focus-within:ring-secondary/40 transition-all`,children:(0,I.jsx)(`input`,{type:`text`,value:e,onChange:e=>m(t,e.target.value),placeholder:`gpt-4o`,disabled:l.isPending,className:`w-full bg-transparent border-none rounded-lg px-4 py-2.5 text-xs text-white focus:outline-none placeholder:text-on-surface-variant/20 disabled:opacity-60`,"aria-label":`Model variant ${t+1}`})}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>v(t),disabled:!u||l.isPending,"aria-label":`Remove model variant ${t+1}`,title:u?`Remove model variant`:`At least one model input is kept visible`,className:E(`w-10 h-10 flex items-center justify-center transition-colors bg-surface-container-highest/10 rounded-xl`,u?`text-on-surface-variant/20 hover:text-error hover:bg-error/10`:`text-on-surface-variant/10 cursor-not-allowed opacity-50`,l.isPending&&`cursor-not-allowed opacity-50`),children:(0,I.jsx)(y,{size:16})})]},`${e}-${t}`))}),(0,I.jsxs)(`button`,{type:`button`,onClick:p,disabled:l.isPending,className:`w-full py-3 border-2 border-dashed border-outline-variant/10 rounded-xl flex items-center justify-center gap-2 text-on-surface-variant/40 hover:border-primary/40 hover:text-primary transition-all group font-bold text-[10px] uppercase tracking-widest disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Add model variant`,children:[(0,I.jsx)(g,{size:14,className:`group-hover:scale-110 transition-transform`}),`Add model variant`]})]}),(0,I.jsxs)(`div`,{className:`bg-tertiary-container/10 p-5 rounded-2xl flex gap-4 border border-tertiary/5 relative overflow-hidden group`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-24 h-24 bg-tertiary/5 blur-2xl rounded-full -mr-10 -mt-10`}),(0,I.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-tertiary/10 flex items-center justify-center shrink-0`,children:(0,I.jsx)(h,{size:18,className:`text-tertiary`})}),(0,I.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant/80 leading-relaxed font-medium`,children:[`Once registered, these models will be available in the`,` `,(0,I.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Orchestration Canvas`}),` for node deployment and agent personality mapping.`]})]})]}),(0,I.jsxs)(`div`,{className:`px-8 py-8 flex items-center justify-end gap-6 bg-gradient-to-t from-surface-container-lowest/50 to-transparent`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:b,disabled:l.isPending,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/40 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,disabled:l.isPending||!d,className:`bg-primary px-8 py-3 rounded-xl text-on-primary text-[10px] font-black uppercase tracking-[0.2em] shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-95 transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed flex items-center gap-2`,children:l.isPending?(0,I.jsx)(`span`,{className:`w-3 h-3 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(_,{size:14}),`Register Provider`]})})]})]}),(0,I.jsx)(`div`,{className:`absolute -bottom-16 -left-16 w-48 h-48 bg-primary/10 blur-[60px] rounded-full pointer-events-none`}),(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-1 bg-gradient-to-l from-secondary/40 to-transparent`})]})]})})},z=({model:e,onDelete:t})=>{let[n,r]=(0,k.useState)(!1),i=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return n&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]),(0,I.jsxs)(`div`,{ref:i,className:`relative inline-block`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-label":`Actions for model ${e.name}`,title:`Actions for model ${e.name}`,className:`text-on-surface-variant/40 hover:text-white transition-colors p-1 rounded`,children:(0,I.jsx)(p,{size:14})}),n&&(0,I.jsx)(`div`,{className:`absolute right-0 bottom-full mb-1 z-50 w-36 bg-surface-container-high rounded-xl shadow-2xl ring-1 ring-outline-variant/10 overflow-hidden animate-in fade-in zoom-in-95 duration-150`,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{r(!1),t(e)},className:`w-full px-4 py-3 text-left text-xs font-bold text-error hover:bg-error/10 transition-colors flex items-center gap-2`,"aria-label":`Remove model ${e.name}`,children:[(0,I.jsx)(y,{size:12}),`Remove`]})})]})},B=({provider:e,models:t,isLoadingModels:n,isRefreshing:r,onRefresh:i,onOpenCreateModel:a,onDeleteModel:o})=>e?(0,I.jsxs)(`div`,{className:`bg-surface-container-low rounded-3xl overflow-hidden ring-1 ring-outline-variant/10 shadow-2xl animate-in fade-in zoom-in-95 duration-500`,children:[(0,I.jsxs)(`div`,{className:`p-10 relative overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`absolute top-0 right-0 w-[500px] h-full bg-gradient-to-l from-primary/5 to-transparent pointer-events-none`}),(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start justify-between gap-8 relative z-10`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 bg-surface rounded-2xl flex items-center justify-center ring-1 ring-primary/20 shadow-inner group transition-all duration-500 hover:ring-primary/40`,children:(0,I.jsx)(D,{size:40,className:`text-primary group-hover:scale-110 transition-transform`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h2`,{className:`text-3xl font-headline font-black text-white tracking-tight`,children:e.name}),(0,I.jsx)(`div`,{className:`flex gap-2`,children:(0,I.jsx)(`span`,{className:`px-2.5 py-0.5 bg-secondary/10 text-secondary text-[9px] font-black uppercase tracking-widest rounded ring-1 ring-secondary/20 font-headline`,children:`Primary`})})]}),(0,I.jsx)(`p`,{className:`text-on-surface-variant/60 text-sm mt-2`,children:e.description||`Infrastructure gateway for agentic cognition & reasoning.`})]})]}),(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:i,disabled:r,"aria-label":`Refresh ${e.name} data`,title:`Refresh ${e.name} data`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(O,{size:18,className:E(r&&`animate-spin`)})}),(0,I.jsx)(`button`,{type:`button`,disabled:!0,"aria-label":`More provider actions unavailable`,title:`More provider actions unavailable`,className:`p-2.5 rounded-xl bg-surface-container-high text-on-surface-variant/40 transition-all ring-1 ring-outline-variant/10 disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,I.jsx)(p,{size:18})})]})]})]}),(0,I.jsxs)(`div`,{className:`p-10 border-t border-outline-variant/5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h3`,{className:`font-headline font-black text-lg text-white`,children:`Registered Models`}),(0,I.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-surface-container-high text-[10px] font-bold text-on-surface-variant`,children:[t.length,` Models`]})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:a,disabled:!e.id,className:`text-[10px] font-black uppercase tracking-widest text-primary hover:text-primary/70 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Register models for ${e.name}`,children:[(0,I.jsx)(`div`,{className:`w-5 h-5 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(g,{size:12})}),`Register New Model`]})]}),(0,I.jsx)(`div`,{className:`rounded-2xl border border-outline-variant/5 overflow-visible`,children:(0,I.jsxs)(`table`,{className:`w-full text-left text-xs border-collapse`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{className:`bg-surface-container-high/30 text-on-surface-variant/40 font-black uppercase tracking-[0.2em]`,children:[(0,I.jsx)(`th`,{className:`py-5 px-6`,children:`Model ID`}),(0,I.jsx)(`th`,{className:`py-5 px-6 text-right`,children:`Status`}),(0,I.jsx)(`th`,{className:`py-5 px-6 w-12 text-center`,children:`Action`})]})}),(0,I.jsx)(`tbody`,{className:`divide-y divide-outline-variant/5`,children:n?(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-20 text-center`,children:(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center space-y-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin`}),(0,I.jsx)(`p`,{className:`text-[10px] uppercase font-black tracking-widest text-primary animate-pulse`,children:`Hydrating Model Registry...`})]})})}):t.length>0?t.map(e=>(0,I.jsxs)(`tr`,{className:`group hover:bg-primary/5 transition-all`,children:[(0,I.jsx)(`td`,{className:`py-5 px-6 font-mono text-on-surface font-medium`,children:e.name}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-right`,children:(0,I.jsx)(`span`,{className:`inline-flex items-center px-2 py-1 rounded font-black text-[8px] uppercase tracking-widest bg-secondary/10 text-secondary`,children:`Active`})}),(0,I.jsx)(`td`,{className:`py-5 px-6 text-center`,children:(0,I.jsx)(z,{model:e,onDelete:o})})]},e.id)):(0,I.jsx)(`tr`,{children:(0,I.jsx)(`td`,{colSpan:3,className:`py-12 text-center text-on-surface-variant/20 italic font-medium`,children:`No models registered for this provider gate.`})})})]})})]}),(0,I.jsxs)(`div`,{className:`ui-helper-text p-8 border-t border-outline-variant/5 bg-surface-container-lowest/20 flex items-center gap-3`,children:[(0,I.jsx)(l,{size:14,className:`text-tertiary`}),`Model registry updates propagate automatically after provider and model changes.`]})]}):(0,I.jsxs)(`div`,{className:`h-[600px] bg-surface-container-low/50 rounded-3xl border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-on-surface-variant gap-4 opacity-40`,children:[(0,I.jsx)(`div`,{className:`w-20 h-20 rounded-2xl bg-surface-container flex items-center justify-center shadow-inner`,children:(0,I.jsx)(D,{size:40,className:`text-primary/50`})}),(0,I.jsxs)(`div`,{className:`text-center`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-headline font-black text-white uppercase tracking-widest mb-1`,children:`Infrastructure Hub`}),(0,I.jsx)(`p`,{className:`text-[10px] font-medium opacity-60`,children:`Select a provider on the left to view active node details.`})]})]}),V=({providers:e,selectedProviderId:t,selectedProviderModelCount:n,isLoading:r,onSelect:i})=>r&&e.length===0?(0,I.jsx)(`div`,{className:`space-y-3`,"aria-live":`polite`,children:Array.from({length:3}).map((e,t)=>(0,I.jsx)(`div`,{className:`h-28 rounded-2xl border border-outline-variant/10 bg-surface-container-low animate-pulse`},t))}):e.length===0?(0,I.jsxs)(`div`,{className:`p-8 border-2 border-dashed border-outline-variant/10 rounded-2xl flex flex-col items-center justify-center text-center opacity-40`,children:[(0,I.jsx)(v,{size:24,className:`mb-4`}),(0,I.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest leading-relaxed`,children:[`No providers registered yet.`,(0,I.jsx)(`br`,{}),`Establish logical gateways in the infrastructure hub.`]})]}):(0,I.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let r=t===e.id,a=r?`${n} Models Active`:`Select to inspect`;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:E(`w-full p-5 rounded-2xl border text-left transition-all duration-300 group`,r?`bg-surface-container-high border-secondary/20 shadow-lg shadow-secondary/5 ring-1 ring-secondary/10 text-white`:`bg-surface-container-low border-transparent hover:bg-surface-container-high/50 text-on-surface-variant`),"aria-pressed":r,"aria-label":`Select provider ${e.name}`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,I.jsx)(`div`,{className:E(`w-10 h-10 rounded-xl bg-surface-container-highest flex items-center justify-center transition-colors`,r?`text-primary`:`text-on-surface-variant`),children:(0,I.jsx)(d,{size:20})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`span`,{className:E(`font-bold text-sm block transition-colors`,r?`text-white`:`group-hover:text-white`),children:e.name}),(0,I.jsx)(`span`,{className:`text-[9px] font-bold text-on-surface-variant/40 uppercase tracking-widest leading-none mt-1 block`,children:a})]})]}),(0,I.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-secondary animate-pulse shadow-[0_0_10px_rgba(78,222,163,0.5)]`})]}),(0,I.jsx)(`div`,{className:`flex justify-start`,children:(0,I.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest text-secondary`,children:`Healthy`})})]},e.id)})}),H=()=>{let[e,t]=(0,k.useState)(!1),[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(null),{data:c=[],isPending:l,isFetching:u,refetch:d}=j(),f=c.find(e=>e.id===i)?.id??c[0]?.id??null,p=M(f),m=(0,k.useMemo)(()=>c.find(e=>e.id===f)??null,[c,f]),{mutate:h,isPending:g}=F(f??``),_=(0,k.useCallback)(async()=>{await Promise.all([d(),f?p.refetch():Promise.resolve(void 0)])},[p,d,f]);return{providers:c,selectedProvider:m,selectedProviderId:f,setSelectedProviderId:a,models:p.data??[],isLoadingProviders:l,isFetchingProviders:u,isLoadingModels:p.isPending||p.isFetching,isRegisterProviderModalOpen:e,setIsRegisterProviderModalOpen:t,isCreateModelModalOpen:n,setIsCreateModelModalOpen:r,refreshProviders:_,modelPendingDelete:o,setModelPendingDelete:s,deleteModel:h,isDeletingModel:g}},U=()=>{let{providers:e,selectedProvider:t,selectedProviderId:n,setSelectedProviderId:r,models:i,isLoadingProviders:a,isFetchingProviders:o,isLoadingModels:s,isRegisterProviderModalOpen:l,setIsRegisterProviderModalOpen:u,isCreateModelModalOpen:d,setIsCreateModelModalOpen:f,refreshProviders:p,modelPendingDelete:m,setModelPendingDelete:h,deleteModel:_,isDeletingModel:y}=H();return(0,I.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,I.jsx)(`header`,{children:(0,I.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-end justify-between gap-6`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`nav`,{className:`flex items-center gap-2 mb-2 text-[10px] uppercase tracking-widest text-primary font-bold`,children:[(0,I.jsx)(`span`,{className:`opacity-60`,children:`Infrastructure`}),(0,I.jsx)(c,{size:12,className:`opacity-40`}),(0,I.jsx)(`span`,{children:`Model Providers`})]}),(0,I.jsx)(`h1`,{className:`text-4xl font-extrabold font-headline tracking-tighter text-white`,children:`Provider Core`}),(0,I.jsx)(`p`,{className:`text-on-surface-variant text-sm mt-1`,children:`Manage global LLM integrations and endpoint health.`})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{p()},disabled:o,className:`px-5 py-2.5 bg-surface-container-high text-on-surface rounded-lg text-xs font-bold uppercase tracking-widest hover:bg-surface-container-highest transition-all ring-1 ring-outline-variant/10 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Refresh provider status`,children:[(0,I.jsx)(O,{size:14,className:E(o&&`animate-spin`)}),o?`Refreshing...`:`Refresh Status`]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`px-6 py-2.5 bg-primary text-on-primary rounded-lg text-xs font-bold uppercase tracking-widest shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all flex items-center gap-2`,"aria-label":`Open register provider modal`,children:[(0,I.jsx)(g,{size:16}),`Register Provider`]})]})]})}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-8`,children:[(0,I.jsxs)(`div`,{className:`lg:col-span-4 space-y-5`,children:[(0,I.jsxs)(`h2`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant/40 flex items-center gap-3`,children:[(0,I.jsx)(v,{size:14,className:`text-primary`}),` Active Providers`]}),(0,I.jsx)(V,{providers:e,selectedProviderId:n,selectedProviderModelCount:n===t?.id?i.length:0,isLoading:a,onSelect:r})]}),(0,I.jsx)(`div`,{className:`lg:col-span-8 space-y-8`,children:(0,I.jsx)(B,{provider:t,models:i,isLoadingModels:s,isRefreshing:o,onRefresh:()=>{p()},onOpenCreateModel:()=>f(!0),onDeleteModel:h})})]}),(0,I.jsx)(R,{isOpen:l,onClose:()=>u(!1),onCreated:e=>{r(e),u(!1)}}),(0,I.jsx)(L,{isOpen:d,onClose:()=>f(!1),onCreated:()=>f(!1),providerId:t?.id??``,providerName:t?.name??``}),(0,I.jsx)(b,{isOpen:m!==null,onClose:()=>h(null),onConfirm:()=>{m&&_(m.id,{onSettled:()=>h(null)})},title:`Remove Model`,message:`Are you sure you want to remove "${m?.name??``}"? This action cannot be undone.`,confirmText:`Remove`,cancelText:`Cancel`,variant:`danger`,loading:y})]})};export{U as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CreateRecurrentTaskModal-BgfnJ1n8.js","assets/vendor-query-xpDrc4rM.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-dnd-CfaHPvi0.js","assets/vendor-markdown-DoJbQ1of.js","assets/vendor-forms-DHyqHeyd.js","assets/client-BGOBXkO8.js","assets/vendor-motion-CMGWJcqR.js","assets/bot-QVmnxPf4.js","assets/brain-C6vlLcg3.js","assets/chevron-down-LTeQHW9O.js","assets/circle-alert-pUx6yhcF.js","assets/clock-BY4rrypg.js","assets/MarkdownField--1gpyapw.js","assets/eye-Cc-vy4Zu.js","assets/sparkles-v57Nc-z-.js","assets/cpu-8Sbc9Dk0.js","assets/rocket-CMSwBl_C.js","assets/x-wDy15QMx.js","assets/agents-b8btewki.js","assets/recurrent-tasks-CKT47N2l.js","assets/tasks-DEUQCNoH.js","assets/useNotification-DQayTSUL.js","assets/taskFormSchemas-dl1t1OyX.js","assets/agentEmojis-BQA0jC3z.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{l as n,s as r}from"./vendor-react-BmVaKUwY.js";import{i,n as a,t as o}from"./vendor-query-xpDrc4rM.js";import{r as s}from"./vendor-markdown-DoJbQ1of.js";import{i as c}from"./client-BGOBXkO8.js";import{t as l}from"./activity-CmAajKmR.js";import{t as u}from"./bot-QVmnxPf4.js";import{t as d}from"./database-D6O4hvbm.js";import{t as f}from"./panels-top-left-Vk8FzAxf.js";import{i as p,n as m,r as h,t as g}from"./trending-up-DlrXEXE6.js";import{t as _}from"./plus-Dx6G8SOZ.js";import{t as v}from"./refresh-cw-DQW6jR7M.js";import{t as y}from"./sparkles-v57Nc-z-.js";import{t as b}from"./trash-2-DJpTXgEP.js";import{t as x}from"./ConfirmDialog-y3vTcqFR.js";import{t as S}from"./useProject-DhK9Ze6F.js";import{t as C}from"./vendor-motion-CMGWJcqR.js";import{t as w}from"./useNotification-DQayTSUL.js";import{n as T,r as E}from"./recurrent-tasks-CKT47N2l.js";import{t as D}from"./usePersistentFlag-R3_SXL_2.js";var O=c(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),k=e(t(),1),A=s(),j=(0,k.lazy)(()=>n(()=>import(`./CreateRecurrentTaskModal-BgfnJ1n8.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),M=()=>{let{activeProject:e,loading:t}=S(),{notifySuccess:n,notifyApiError:s}=w(),c=r(),M=i(),[N,P]=(0,k.useState)(!1),[F,I]=D(`scheduler_show_insight`,!0),[L,R]=(0,k.useState)(void 0),[z,B]=(0,k.useState)(null),V=()=>{I(!1)},H=[`recurrent-tasks`,e?.id],{data:U=[],isLoading:W}=a({queryKey:H,queryFn:async()=>{let t=await E.findAll(e.id);return Array.isArray(t.data)?t.data:[]},enabled:!!e?.id}),G=o({mutationFn:t=>E.delete(e.id,t.id),onSuccess:(e,t)=>{n(`Protocol Terminated`,`The task "${t.title}" has been removed from the fleet.`),B(null),M.invalidateQueries({queryKey:H})},onError:e=>s(e,`Error deleting task`)}),K=o({mutationFn:t=>{let n=t.status===T.ACTIVE?T.PAUSED:T.ACTIVE;return E.update(e.id,t.id,{status:n}).then(()=>n)},onSuccess:(e,t)=>{n(`Protocol ${e===T.ACTIVE?`Resumed`:`Paused`}`,`Operation "${t.title}" has been ${e===T.ACTIVE?`re-activated`:`suspended`}.`),M.invalidateQueries({queryKey:H})},onError:e=>s(e,`Failed to update protocol status`)}),q=()=>{R(void 0),P(!0)},J=e=>{R(e),P(!0)},Y=e=>{K.isPending||K.mutate(e)},X=U.length>0?(U.length-U.filter(e=>e.status===T.ERROR).length)/U.length*100:100,Z=[{label:`Active Schedules`,value:U.filter(e=>e.status===T.ACTIVE).length.toString(),change:`+12%`,icon:g,color:`text-secondary`,bg:`bg-secondary/10`},{label:`Success Rate`,value:`${X.toFixed(1)}%`,trend:X,icon:l,color:`text-primary`},{label:`Paused Agents`,value:U.filter(e=>e.status===T.PAUSED).length.toString(),subtext:`Awaiting manual audit`,icon:p,color:`text-on-surface-variant`},{label:`Critical Errors`,value:U.filter(e=>e.status===T.ERROR).length.toString(),subtext:`System integrity: nominal`,icon:O,color:`text-error`,bg:`bg-error/10`}];return t?(0,A.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Initializing Temporal Grid`})]})}):e?(0,A.jsxs)(`div`,{className:`space-y-10 animate-in fade-in duration-700`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-end gap-6`,children:[(0,A.jsxs)(C.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},children:[(0,A.jsx)(`h2`,{className:`text-4xl font-headline font-extrabold text-white tracking-tight mb-2`,children:`Temporal Orchestration`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant font-body max-w-md`,children:`Manage autonomous agent lifecycle schedules and recurrent operational flows.`})]}),(0,A.jsxs)(C.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:q,className:`px-6 py-3.5 bg-primary text-on-primary rounded-xl font-black text-xs uppercase tracking-widest flex items-center gap-2 shadow-lg shadow-primary/20 transition-all border border-primary-container/20 group hover:shadow-primary/40`,children:[(0,A.jsx)(_,{size:18,className:`group-hover:rotate-90 transition-transform duration-300`}),`New Scheduled Task`]})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6`,children:Z.map((e,t)=>(0,A.jsxs)(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.1},className:`bg-surface-container-low p-6 rounded-2xl border border-outline-variant/10 shadow-xl group hover:border-primary/20 transition-colors`,children:[(0,A.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 mb-1`,children:e.label}),(0,A.jsx)(`h3`,{className:`text-3xl font-headline font-black ${e.color}`,children:e.value}),e.change&&(0,A.jsxs)(`div`,{className:`mt-4 flex items-center text-[10px] font-black uppercase tracking-wider ${e.color} ${e.bg} px-2.5 py-1 rounded-full w-fit`,children:[(0,A.jsx)(e.icon,{size:12,className:`mr-1.5`}),e.change,` vs last month`]}),e.trend!==void 0&&(0,A.jsx)(`div`,{className:`mt-4 w-full bg-surface-container-highest h-1.5 rounded-full overflow-hidden`,children:(0,A.jsx)(C.div,{initial:{width:0},animate:{width:`${e.trend}%`},transition:{duration:1,delay:.5},className:`bg-primary h-full shadow-[0_0_12px_rgba(173,198,255,0.6)]`})}),e.subtext&&(0,A.jsx)(`p`,{className:`mt-4 text-[11px] text-on-surface-variant/50 font-medium italic`,children:e.subtext})]},t))}),(0,A.jsxs)(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:`bg-surface-container-low rounded-2xl overflow-hidden border border-outline-variant/10 shadow-2xl`,children:[(0,A.jsxs)(`div`,{className:`px-8 py-5 flex flex-col md:flex-row justify-between items-center gap-4 bg-surface-container-high/30 border-b border-outline-variant/10`,children:[(0,A.jsx)(`h4`,{className:`font-headline font-bold text-lg text-white`,children:`Recurrent Protocols`}),(0,A.jsxs)(`div`,{className:`flex gap-6`,children:[(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-secondary shadow-[0_0_8px_rgba(78,222,163,0.4)]`}),` Active`]}),(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-on-surface-variant/40`}),` Paused`]}),(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-error shadow-[0_0_8px_rgba(255,180,171,0.4)]`}),` Error`]})]})]}),(0,A.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:W?(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-4`,children:[(0,A.jsx)(v,{className:`text-primary animate-spin`,size:40}),(0,A.jsx)(`p`,{className:`text-on-surface-variant font-mono text-xs uppercase tracking-widest animate-pulse`,children:`Synchronizing Fleet States...`})]}):U.length===0?(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-6 text-center`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-surface-container-highest flex items-center justify-center text-on-surface-variant`,children:(0,A.jsx)(d,{size:32})}),(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(`h5`,{className:`text-xl font-headline font-bold text-white`,children:`No active protocols detected`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant max-w-sm font-body`,children:`Deployment requested: Initiating autonomous routines requires manual configuration.`})]}),(0,A.jsx)(`button`,{onClick:q,className:`px-4 py-2 border border-primary/30 text-primary rounded-lg text-[10px] font-black uppercase tracking-widest hover:bg-primary/5 transition-colors`,children:`Initiate First Sequence`})]}):U.map(e=>(0,A.jsx)(`div`,{className:`px-8 py-6 hover:bg-surface-container-high/20 transition-all group`,children:(0,A.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[auto_1fr_160px_160px_160px_220px] items-center gap-10`,children:[(0,A.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-surface-container-highest flex items-center justify-center border border-outline-variant/20 group-hover:border-primary/30 transition-colors shadow-inner`,children:(0,A.jsx)(l,{className:e.status===T.ERROR?`text-error`:`text-primary`,size:24})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h5`,{className:`text-xl font-headline font-black text-white mb-2 group-hover:text-primary transition-colors tracking-tight cursor-pointer`,onClick:()=>c(`/scheduler/tasks/${e.id}/executions`),children:e.title}),(0,A.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 bg-surface-container-highest px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest text-on-surface-variant border border-outline-variant/10 shadow-sm`,children:[(0,A.jsx)(u,{size:12}),e.assignee?.name||`Unassigned`]})})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Cycle Pattern`}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsx)(`p`,{className:`font-mono text-xs text-tertiary font-bold tracking-widest`,children:e.cronExpression}),(0,A.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter italic`,children:`Recurrent Loop`})]})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Last Execution`}),(0,A.jsx)(`p`,{className:`text-sm font-bold tracking-tight text-white/90`,children:e.lastRun?new Date(e.lastRun).toLocaleString():(0,A.jsx)(`span`,{className:`text-on-surface-variant/40 italic`,children:`Never executed`})})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Deployed`}),(0,A.jsx)(`p`,{className:`text-sm font-bold text-on-surface tracking-tight`,children:new Date(e.createdAt).toLocaleDateString()})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end relative h-full`,children:[(0,A.jsx)(`div`,{className:`flex items-center gap-4 group-hover:opacity-0 transition-opacity`,children:(0,A.jsx)(`span`,{className:`px-4 py-1.5 rounded-full text-[10px] font-black uppercase tracking-widest border transition-all ${e.status===T.ACTIVE?`bg-secondary/10 text-secondary border-secondary/20 shadow-[0_0_15px_rgba(78,222,163,0.1)]`:e.status===T.PAUSED?`bg-surface-container-highest text-on-surface-variant/60 border-outline-variant/20`:`bg-error/10 text-error border-error/20 shadow-[0_0_15px_rgba(255,180,171,0.1)]`}`,children:e.status})}),(0,A.jsxs)(`div`,{className:`absolute right-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all translate-x-2 group-hover:translate-x-0`,children:[(0,A.jsx)(`button`,{className:`p-3 transition-colors disabled:opacity-40 ${e.status===T.ACTIVE?`text-secondary hover:text-secondary/80`:`text-on-surface-variant hover:text-secondary`}`,title:e.status===T.ACTIVE?`Pause Protocol`:`Resume Protocol`,disabled:K.isPending,onClick:()=>Y(e),children:e.status===T.ACTIVE?(0,A.jsx)(p,{size:20}):(0,A.jsx)(h,{size:20})}),(0,A.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-primary transition-colors`,title:`Edit`,onClick:()=>J(e),children:(0,A.jsx)(m,{size:20})}),(0,A.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-error transition-colors`,title:`Delete`,onClick:()=>B(e),children:(0,A.jsx)(b,{size:20})})]})]})]})},e.id))})]}),F&&(0,A.jsxs)(C.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{delay:.6},className:`p-8 rounded-3xl bg-gradient-to-br from-tertiary/10 via-surface-container-low to-surface-container-low border border-tertiary/20 relative overflow-hidden group`,children:[(0,A.jsxs)(`div`,{className:`relative z-10 flex flex-col md:flex-row gap-8 items-start md:items-center`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 bg-tertiary/10 rounded-2xl border border-tertiary/20 flex items-center justify-center text-tertiary shadow-xl group-hover:scale-110 transition-transform duration-500`,children:(0,A.jsx)(y,{size:32})}),(0,A.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`text-xl font-headline font-black text-tertiary mb-2 uppercase tracking-tight`,children:`Orchestrator Intelligence Insight`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant leading-relaxed max-w-4xl font-body italic text-base`,children:`"To maximize efficiency, schedule tasks with non-overlapping times."`})]}),(0,A.jsx)(`div`,{className:`flex gap-4`,children:(0,A.jsx)(`button`,{onClick:V,className:`px-6 py-2.5 border border-tertiary/30 text-tertiary rounded-xl font-black text-xs uppercase tracking-widest hover:bg-tertiary/5 transition-colors`,children:`Dismiss`})})]})]}),(0,A.jsx)(`div`,{className:`absolute -right-20 -bottom-20 w-80 h-80 bg-tertiary/5 blur-[100px] rounded-full group-hover:bg-tertiary/10 transition-colors duration-1000`})]}),(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(j,{projectId:e.id,isOpen:N,onClose:()=>P(!1),onSuccess:()=>{P(!1),M.invalidateQueries({queryKey:H})},initialData:L})}),(0,A.jsx)(x,{isOpen:!!z,onClose:()=>!G.isPending&&B(null),onConfirm:()=>z&&G.mutate(z),title:`Delete Recurrent Protocol?`,message:`Are you sure you want to delete the recurrent protocol "${z?.title}"? This action cannot be undone.`,confirmText:`Delete Protocol`,variant:`danger`,loading:G.isPending})]}):(0,A.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`text-center space-y-6 max-w-md`,children:[(0,A.jsx)(`div`,{className:`w-20 h-20 bg-surface-container-highest rounded-3xl flex items-center justify-center text-on-surface-variant/20 mx-auto border border-outline-variant/10 shadow-xl`,children:(0,A.jsx)(f,{size:40})}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-black font-headline text-white tracking-tight`,children:`No Active Projects Found`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant text-sm leading-relaxed`,children:`Temporal orchestration requires an active project. Create or select a project from the sidebar to manage recurrent tasks.`})]})]})})};export{M as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CreateRecurrentTaskModal-CGSdgNAf.js","assets/vendor-query-xpDrc4rM.js","assets/rolldown-runtime-COnpUsM8.js","assets/vendor-dnd-CfaHPvi0.js","assets/vendor-markdown-DoJbQ1of.js","assets/vendor-forms-DHyqHeyd.js","assets/client-B553SX3l.js","assets/vendor-motion-CMGWJcqR.js","assets/bot-DadO9w3D.js","assets/brain-DWTpby6b.js","assets/chevron-down-BUOg3vvd.js","assets/circle-alert-sCcf7ANF.js","assets/clock-CSNFJjo4.js","assets/MarkdownField-DR6tHsei.js","assets/eye-CjrFwZG_.js","assets/sparkles-krUpxie4.js","assets/cpu-C2_GFeSH.js","assets/rocket-B9Iexkcw.js","assets/x-CCZGYGDC.js","assets/agents-YQJ7JNfI.js","assets/recurrent-tasks-7thk45mk.js","assets/tasks-DHsBE-ea.js","assets/useNotification-DQayTSUL.js","assets/taskFormSchemas-B6YlRxrx.js","assets/agentEmojis-BQA0jC3z.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{l as n,s as r}from"./vendor-react-BmVaKUwY.js";import{i,n as a,t as o}from"./vendor-query-xpDrc4rM.js";import{r as s}from"./vendor-markdown-DoJbQ1of.js";import{i as c}from"./client-B553SX3l.js";import{t as l}from"./activity-B_2QSywM.js";import{t as u}from"./bot-DadO9w3D.js";import{t as d}from"./database-zXW48-_N.js";import{t as f}from"./panels-top-left-Cp169WzB.js";import{i as p,n as m,r as h,t as g}from"./trending-up-ClGbkbN9.js";import{t as _}from"./plus-CkteVqhM.js";import{t as v}from"./refresh-cw-BgDsJOC_.js";import{t as y}from"./sparkles-krUpxie4.js";import{t as b}from"./trash-2-CphQfk35.js";import{t as x}from"./ConfirmDialog-BltdtevE.js";import{t as S}from"./useProject-DhK9Ze6F.js";import{t as C}from"./vendor-motion-CMGWJcqR.js";import{t as w}from"./useNotification-DQayTSUL.js";import{n as T,r as E}from"./recurrent-tasks-7thk45mk.js";import{t as D}from"./usePersistentFlag-R3_SXL_2.js";var O=c(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),k=e(t(),1),A=s(),j=(0,k.lazy)(()=>n(()=>import(`./CreateRecurrentTaskModal-CGSdgNAf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),M=()=>{let{activeProject:e,loading:t}=S(),{notifySuccess:n,notifyApiError:s}=w(),c=r(),M=i(),[N,P]=(0,k.useState)(!1),[F,I]=D(`scheduler_show_insight`,!0),[L,R]=(0,k.useState)(void 0),[z,B]=(0,k.useState)(null),V=()=>{I(!1)},H=[`recurrent-tasks`,e?.id],{data:U=[],isLoading:W}=a({queryKey:H,queryFn:async()=>{let t=await E.findAll(e.id);return Array.isArray(t.data)?t.data:[]},enabled:!!e?.id}),G=o({mutationFn:t=>E.delete(e.id,t.id),onSuccess:(e,t)=>{n(`Protocol Terminated`,`The task "${t.title}" has been removed from the fleet.`),B(null),M.invalidateQueries({queryKey:H})},onError:e=>s(e,`Error deleting task`)}),K=o({mutationFn:t=>{let n=t.status===T.ACTIVE?T.PAUSED:T.ACTIVE;return E.update(e.id,t.id,{status:n}).then(()=>n)},onSuccess:(e,t)=>{n(`Protocol ${e===T.ACTIVE?`Resumed`:`Paused`}`,`Operation "${t.title}" has been ${e===T.ACTIVE?`re-activated`:`suspended`}.`),M.invalidateQueries({queryKey:H})},onError:e=>s(e,`Failed to update protocol status`)}),q=()=>{R(void 0),P(!0)},J=e=>{R(e),P(!0)},Y=e=>{K.isPending||K.mutate(e)},X=U.length>0?(U.length-U.filter(e=>e.status===T.ERROR).length)/U.length*100:100,Z=[{label:`Active Schedules`,value:U.filter(e=>e.status===T.ACTIVE).length.toString(),change:`+12%`,icon:g,color:`text-secondary`,bg:`bg-secondary/10`},{label:`Success Rate`,value:`${X.toFixed(1)}%`,trend:X,icon:l,color:`text-primary`},{label:`Paused Agents`,value:U.filter(e=>e.status===T.PAUSED).length.toString(),subtext:`Awaiting manual audit`,icon:p,color:`text-on-surface-variant`},{label:`Critical Errors`,value:U.filter(e=>e.status===T.ERROR).length.toString(),subtext:`System integrity: nominal`,icon:O,color:`text-error`,bg:`bg-error/10`}];return t?(0,A.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Initializing Temporal Grid`})]})}):e?(0,A.jsxs)(`div`,{className:`space-y-10 animate-in fade-in duration-700`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-end gap-6`,children:[(0,A.jsxs)(C.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},children:[(0,A.jsx)(`h2`,{className:`text-4xl font-headline font-extrabold text-white tracking-tight mb-2`,children:`Temporal Orchestration`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant font-body max-w-md`,children:`Manage autonomous agent lifecycle schedules and recurrent operational flows.`})]}),(0,A.jsxs)(C.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:q,className:`px-6 py-3.5 bg-primary text-on-primary rounded-xl font-black text-xs uppercase tracking-widest flex items-center gap-2 shadow-lg shadow-primary/20 transition-all border border-primary-container/20 group hover:shadow-primary/40`,children:[(0,A.jsx)(_,{size:18,className:`group-hover:rotate-90 transition-transform duration-300`}),`New Scheduled Task`]})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6`,children:Z.map((e,t)=>(0,A.jsxs)(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.1},className:`bg-surface-container-low p-6 rounded-2xl border border-outline-variant/10 shadow-xl group hover:border-primary/20 transition-colors`,children:[(0,A.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 mb-1`,children:e.label}),(0,A.jsx)(`h3`,{className:`text-3xl font-headline font-black ${e.color}`,children:e.value}),e.change&&(0,A.jsxs)(`div`,{className:`mt-4 flex items-center text-[10px] font-black uppercase tracking-wider ${e.color} ${e.bg} px-2.5 py-1 rounded-full w-fit`,children:[(0,A.jsx)(e.icon,{size:12,className:`mr-1.5`}),e.change,` vs last month`]}),e.trend!==void 0&&(0,A.jsx)(`div`,{className:`mt-4 w-full bg-surface-container-highest h-1.5 rounded-full overflow-hidden`,children:(0,A.jsx)(C.div,{initial:{width:0},animate:{width:`${e.trend}%`},transition:{duration:1,delay:.5},className:`bg-primary h-full shadow-[0_0_12px_rgba(173,198,255,0.6)]`})}),e.subtext&&(0,A.jsx)(`p`,{className:`mt-4 text-[11px] text-on-surface-variant/50 font-medium italic`,children:e.subtext})]},t))}),(0,A.jsxs)(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:`bg-surface-container-low rounded-2xl overflow-hidden border border-outline-variant/10 shadow-2xl`,children:[(0,A.jsxs)(`div`,{className:`px-8 py-5 flex flex-col md:flex-row justify-between items-center gap-4 bg-surface-container-high/30 border-b border-outline-variant/10`,children:[(0,A.jsx)(`h4`,{className:`font-headline font-bold text-lg text-white`,children:`Recurrent Protocols`}),(0,A.jsxs)(`div`,{className:`flex gap-6`,children:[(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-secondary shadow-[0_0_8px_rgba(78,222,163,0.4)]`}),` Active`]}),(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-on-surface-variant/40`}),` Paused`]}),(0,A.jsxs)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-error shadow-[0_0_8px_rgba(255,180,171,0.4)]`}),` Error`]})]})]}),(0,A.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:W?(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-4`,children:[(0,A.jsx)(v,{className:`text-primary animate-spin`,size:40}),(0,A.jsx)(`p`,{className:`text-on-surface-variant font-mono text-xs uppercase tracking-widest animate-pulse`,children:`Synchronizing Fleet States...`})]}):U.length===0?(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-20 space-y-6 text-center`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-surface-container-highest flex items-center justify-center text-on-surface-variant`,children:(0,A.jsx)(d,{size:32})}),(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(`h5`,{className:`text-xl font-headline font-bold text-white`,children:`No active protocols detected`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant max-w-sm font-body`,children:`Deployment requested: Initiating autonomous routines requires manual configuration.`})]}),(0,A.jsx)(`button`,{onClick:q,className:`px-4 py-2 border border-primary/30 text-primary rounded-lg text-[10px] font-black uppercase tracking-widest hover:bg-primary/5 transition-colors`,children:`Initiate First Sequence`})]}):U.map(e=>(0,A.jsx)(`div`,{className:`px-8 py-6 hover:bg-surface-container-high/20 transition-all group`,children:(0,A.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-[auto_1fr_160px_160px_160px_220px] items-center gap-10`,children:[(0,A.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-surface-container-highest flex items-center justify-center border border-outline-variant/20 group-hover:border-primary/30 transition-colors shadow-inner`,children:(0,A.jsx)(l,{className:e.status===T.ERROR?`text-error`:`text-primary`,size:24})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h5`,{className:`text-xl font-headline font-black text-white mb-2 group-hover:text-primary transition-colors tracking-tight cursor-pointer`,onClick:()=>c(`/scheduler/tasks/${e.id}/executions`),children:e.title}),(0,A.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 bg-surface-container-highest px-3 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest text-on-surface-variant border border-outline-variant/10 shadow-sm`,children:[(0,A.jsx)(u,{size:12}),e.assignee?.name||`Unassigned`]})})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Cycle Pattern`}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsx)(`p`,{className:`font-mono text-xs text-tertiary font-bold tracking-widest`,children:e.cronExpression}),(0,A.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter italic`,children:`Recurrent Loop`})]})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Last Execution`}),(0,A.jsx)(`p`,{className:`text-sm font-bold tracking-tight text-white/90`,children:e.lastRun?new Date(e.lastRun).toLocaleString():(0,A.jsx)(`span`,{className:`text-on-surface-variant/40 italic`,children:`Never executed`})})]}),(0,A.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-black uppercase tracking-[0.2em] text-on-surface-variant/40 mb-2`,children:`Deployed`}),(0,A.jsx)(`p`,{className:`text-sm font-bold text-on-surface tracking-tight`,children:new Date(e.createdAt).toLocaleDateString()})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end relative h-full`,children:[(0,A.jsx)(`div`,{className:`flex items-center gap-4 group-hover:opacity-0 transition-opacity`,children:(0,A.jsx)(`span`,{className:`px-4 py-1.5 rounded-full text-[10px] font-black uppercase tracking-widest border transition-all ${e.status===T.ACTIVE?`bg-secondary/10 text-secondary border-secondary/20 shadow-[0_0_15px_rgba(78,222,163,0.1)]`:e.status===T.PAUSED?`bg-surface-container-highest text-on-surface-variant/60 border-outline-variant/20`:`bg-error/10 text-error border-error/20 shadow-[0_0_15px_rgba(255,180,171,0.1)]`}`,children:e.status})}),(0,A.jsxs)(`div`,{className:`absolute right-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all translate-x-2 group-hover:translate-x-0`,children:[(0,A.jsx)(`button`,{className:`p-3 transition-colors disabled:opacity-40 ${e.status===T.ACTIVE?`text-secondary hover:text-secondary/80`:`text-on-surface-variant hover:text-secondary`}`,title:e.status===T.ACTIVE?`Pause Protocol`:`Resume Protocol`,disabled:K.isPending,onClick:()=>Y(e),children:e.status===T.ACTIVE?(0,A.jsx)(p,{size:20}):(0,A.jsx)(h,{size:20})}),(0,A.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-primary transition-colors`,title:`Edit`,onClick:()=>J(e),children:(0,A.jsx)(m,{size:20})}),(0,A.jsx)(`button`,{className:`p-3 text-on-surface-variant hover:text-error transition-colors`,title:`Delete`,onClick:()=>B(e),children:(0,A.jsx)(b,{size:20})})]})]})]})},e.id))})]}),F&&(0,A.jsxs)(C.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{delay:.6},className:`p-8 rounded-3xl bg-gradient-to-br from-tertiary/10 via-surface-container-low to-surface-container-low border border-tertiary/20 relative overflow-hidden group`,children:[(0,A.jsxs)(`div`,{className:`relative z-10 flex flex-col md:flex-row gap-8 items-start md:items-center`,children:[(0,A.jsx)(`div`,{className:`w-16 h-16 bg-tertiary/10 rounded-2xl border border-tertiary/20 flex items-center justify-center text-tertiary shadow-xl group-hover:scale-110 transition-transform duration-500`,children:(0,A.jsx)(y,{size:32})}),(0,A.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`text-xl font-headline font-black text-tertiary mb-2 uppercase tracking-tight`,children:`Orchestrator Intelligence Insight`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant leading-relaxed max-w-4xl font-body italic text-base`,children:`"To maximize efficiency, schedule tasks with non-overlapping times."`})]}),(0,A.jsx)(`div`,{className:`flex gap-4`,children:(0,A.jsx)(`button`,{onClick:V,className:`px-6 py-2.5 border border-tertiary/30 text-tertiary rounded-xl font-black text-xs uppercase tracking-widest hover:bg-tertiary/5 transition-colors`,children:`Dismiss`})})]})]}),(0,A.jsx)(`div`,{className:`absolute -right-20 -bottom-20 w-80 h-80 bg-tertiary/5 blur-[100px] rounded-full group-hover:bg-tertiary/10 transition-colors duration-1000`})]}),(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(j,{projectId:e.id,isOpen:N,onClose:()=>P(!1),onSuccess:()=>{P(!1),M.invalidateQueries({queryKey:H})},initialData:L})}),(0,A.jsx)(x,{isOpen:!!z,onClose:()=>!G.isPending&&B(null),onConfirm:()=>z&&G.mutate(z),title:`Delete Recurrent Protocol?`,message:`Are you sure you want to delete the recurrent protocol "${z?.title}"? This action cannot be undone.`,confirmText:`Delete Protocol`,variant:`danger`,loading:G.isPending})]}):(0,A.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`text-center space-y-6 max-w-md`,children:[(0,A.jsx)(`div`,{className:`w-20 h-20 bg-surface-container-highest rounded-3xl flex items-center justify-center text-on-surface-variant/20 mx-auto border border-outline-variant/10 shadow-xl`,children:(0,A.jsx)(f,{size:40})}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-black font-headline text-white tracking-tight`,children:`No Active Projects Found`}),(0,A.jsx)(`p`,{className:`text-on-surface-variant text-sm leading-relaxed`,children:`Temporal orchestration requires an active project. Create or select a project from the sidebar to manage recurrent tasks.`})]})]})})};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{r as n}from"./vendor-markdown-DoJbQ1of.js";import{t as r}from"./client-BGOBXkO8.js";import{t as i}from"./activity-CmAajKmR.js";import{n as a,t as o}from"./terminal-a6AV2mPO.js";import{t as s}from"./cpu-8Sbc9Dk0.js";import{t as c}from"./refresh-cw-DQW6jR7M.js";import{t as l}from"./save-DycJmlX0.js";import{t as u}from"./useNotification-DQayTSUL.js";var d=e(t(),1),f=async()=>{let{data:e}=await r.get(`/system-settings`);return e},p=async e=>{let{data:t}=await r.patch(`/system-settings`,e);return t},m=n(),h=()=>{let[e,t]=(0,d.useState)(null),[n,r]=(0,d.useState)(!0),[h,g]=(0,d.useState)(!1),{notifySuccess:_,notifyApiError:v,notifyInfo:y}=u();(0,d.useEffect)(()=>{(async()=>{try{t(await f())}catch(e){v(e,`Failed to load settings`)}finally{r(!1)}})()},[v]);let b=async()=>{if(e){g(!0);try{await p(e),_(`Settings committed`,`Configuration synchronized with central orchestrator.`)}catch(e){v(e,`Commit failed`)}finally{g(!1)}}},x=(0,d.useMemo)(()=>{if(!e)return{};let t={},n=e.data.taskScheduler,r=e.data.recurrentTasksScheduler;return(!n.pollIntervalInMs||n.pollIntervalInMs<1e4)&&(t[`ts.poll`]=`Minimum 10 000 ms`),(!n.maxTaskPerExecution||n.maxTaskPerExecution<1||n.maxTaskPerExecution>15)&&(t[`ts.max`]=`Must be between 1 and 15`),(!r.pollIntervalInMs||r.pollIntervalInMs<15e3)&&(t[`rs.poll`]=`Minimum 15 000 ms`),(!r.executionTimeout||r.executionTimeout<6e4)&&(t[`rs.timeout`]=`Minimum 60 000 ms`),(!r.maxActiveTasks||r.maxActiveTasks<1||r.maxActiveTasks>5)&&(t[`rs.max`]=`Must be between 1 and 5`),t},[e]),S=Object.keys(x).length>0,C=async()=>{r(!0);try{t(await f()),y(`Changes aborted`,`Configuration reloaded from the last known state.`)}catch{}finally{r(!1)}},w=(n,r)=>{e&&t({...e,data:{...e.data,taskScheduler:{...e.data.taskScheduler,[n]:r}}})},T=(n,r)=>{e&&t({...e,data:{...e.data,recurrentTasksScheduler:{...e.data.recurrentTasksScheduler,[n]:r}}})};return n?(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border-outline-variant/30 border-t-primary animate-spin`})}):e?(0,m.jsxs)(`div`,{className:`flex flex-col h-full font-mono text-on-surface`,children:[(0,m.jsxs)(`div`,{className:`flex justify-between items-center mb-10 border-b border-outline-variant/10 pb-6`,children:[(0,m.jsxs)(`div`,{className:`border-l-2 border-primary/40 pl-6`,children:[(0,m.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-1`,children:`Developer Configuration Terminal`}),(0,m.jsxs)(`p`,{className:`text-on-surface-variant text-sm flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-secondary animate-pulse`}),`Direct access to system scheduling and processing parameters.`]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,m.jsxs)(`button`,{onClick:C,className:`text-on-surface-variant text-[11px] hover:text-on-surface transition-colors px-3 py-1 flex items-center gap-2`,children:[(0,m.jsx)(a,{size:14}),` ABORT_CHANGES`]}),(0,m.jsxs)(`button`,{onClick:b,disabled:h||S,className:`bg-primary/10 border border-primary/40 text-primary text-[11px] font-bold px-4 py-1 hover:bg-primary/20 transition-all flex items-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:[h?(0,m.jsx)(i,{size:14,className:`animate-spin`}):(0,m.jsx)(l,{size:14}),`COMMIT --PUSH`]})]})]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-8 flex-1 overflow-y-auto pr-2 custom-scrollbar pb-24`,children:[(0,m.jsx)(`aside`,{className:`lg:col-span-1 border-r border-outline-variant/10 pr-4 hidden lg:flex flex-col gap-1`,children:(0,m.jsxs)(`nav`,{className:`space-y-0.5`,children:[(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 bg-primary/5 text-primary border-r-2 border-primary text-left`,children:[(0,m.jsx)(o,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Scheduler`})]}),(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 text-on-surface-variant hover:text-on-surface hover:bg-surface-container transition-all text-left`,children:[(0,m.jsx)(c,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Recurrent`})]})]})}),(0,m.jsxs)(`div`,{className:`lg:col-span-3 space-y-12`,children:[(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(s,{size:14}),` 01. TASK_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 10 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:1e4,value:e.data.taskScheduler.pollIntervalInMs,onChange:e=>w(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Tasks Per Execution `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 15`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:15,value:e.data.taskScheduler.maxTaskPerExecution,onChange:e=>w(`maxTaskPerExecution`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.max`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.max`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.max`]})]})]})]}),(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(c,{size:14}),` 02. RECURRENT_TASKS_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 15 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:15e3,value:e.data.recurrentTasksScheduler.pollIntervalInMs,onChange:e=>T(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Execution Timeout (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 60 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:6e4,value:e.data.recurrentTasksScheduler.executionTimeout,onChange:e=>T(`executionTimeout`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.timeout`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.timeout`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.timeout`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Active Tasks `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 5`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:5,value:e.data.recurrentTasksScheduler.maxActiveTasks,onChange:e=>T(`maxActiveTasks`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border border-outline-variant/30 px-3 py-1.5 text-secondary font-mono text-sm focus:border-primary focus:ring-0 outline-none transition-colors`})]})]})]})]})]})]}):null};export{h 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"./client-B553SX3l.js";import{t as i}from"./activity-B_2QSywM.js";import{n as a,t as o}from"./terminal-B6iyNuAm.js";import{t as s}from"./cpu-C2_GFeSH.js";import{t as c}from"./refresh-cw-BgDsJOC_.js";import{t as l}from"./save-Cmqi1IkN.js";import{t as u}from"./useNotification-DQayTSUL.js";var d=e(t(),1),f=async()=>{let{data:e}=await r.get(`/system-settings`);return e},p=async e=>{let{data:t}=await r.patch(`/system-settings`,e);return t},m=n(),h=()=>{let[e,t]=(0,d.useState)(null),[n,r]=(0,d.useState)(!0),[h,g]=(0,d.useState)(!1),{notifySuccess:_,notifyApiError:v,notifyInfo:y}=u();(0,d.useEffect)(()=>{(async()=>{try{t(await f())}catch(e){v(e,`Failed to load settings`)}finally{r(!1)}})()},[v]);let b=async()=>{if(e){g(!0);try{await p(e),_(`Settings committed`,`Configuration synchronized with central orchestrator.`)}catch(e){v(e,`Commit failed`)}finally{g(!1)}}},x=(0,d.useMemo)(()=>{if(!e)return{};let t={},n=e.data.taskScheduler,r=e.data.recurrentTasksScheduler;return(!n.pollIntervalInMs||n.pollIntervalInMs<1e4)&&(t[`ts.poll`]=`Minimum 10 000 ms`),(!n.maxTaskPerExecution||n.maxTaskPerExecution<1||n.maxTaskPerExecution>15)&&(t[`ts.max`]=`Must be between 1 and 15`),(!r.pollIntervalInMs||r.pollIntervalInMs<15e3)&&(t[`rs.poll`]=`Minimum 15 000 ms`),(!r.executionTimeout||r.executionTimeout<6e4)&&(t[`rs.timeout`]=`Minimum 60 000 ms`),(!r.maxActiveTasks||r.maxActiveTasks<1||r.maxActiveTasks>5)&&(t[`rs.max`]=`Must be between 1 and 5`),t},[e]),S=Object.keys(x).length>0,C=async()=>{r(!0);try{t(await f()),y(`Changes aborted`,`Configuration reloaded from the last known state.`)}catch{}finally{r(!1)}},w=(n,r)=>{e&&t({...e,data:{...e.data,taskScheduler:{...e.data.taskScheduler,[n]:r}}})},T=(n,r)=>{e&&t({...e,data:{...e.data,recurrentTasksScheduler:{...e.data.recurrentTasksScheduler,[n]:r}}})};return n?(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border-outline-variant/30 border-t-primary animate-spin`})}):e?(0,m.jsxs)(`div`,{className:`flex flex-col h-full font-mono text-on-surface`,children:[(0,m.jsxs)(`div`,{className:`flex justify-between items-center mb-10 border-b border-outline-variant/10 pb-6`,children:[(0,m.jsxs)(`div`,{className:`border-l-2 border-primary/40 pl-6`,children:[(0,m.jsx)(`h2`,{className:`text-2xl font-bold text-on-surface mb-1`,children:`Developer Configuration Terminal`}),(0,m.jsxs)(`p`,{className:`text-on-surface-variant text-sm flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-secondary animate-pulse`}),`Direct access to system scheduling and processing parameters.`]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,m.jsxs)(`button`,{onClick:C,className:`text-on-surface-variant text-[11px] hover:text-on-surface transition-colors px-3 py-1 flex items-center gap-2`,children:[(0,m.jsx)(a,{size:14}),` ABORT_CHANGES`]}),(0,m.jsxs)(`button`,{onClick:b,disabled:h||S,className:`bg-primary/10 border border-primary/40 text-primary text-[11px] font-bold px-4 py-1 hover:bg-primary/20 transition-all flex items-center gap-2 disabled:opacity-40 disabled:cursor-not-allowed`,children:[h?(0,m.jsx)(i,{size:14,className:`animate-spin`}):(0,m.jsx)(l,{size:14}),`COMMIT --PUSH`]})]})]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-8 flex-1 overflow-y-auto pr-2 custom-scrollbar pb-24`,children:[(0,m.jsx)(`aside`,{className:`lg:col-span-1 border-r border-outline-variant/10 pr-4 hidden lg:flex flex-col gap-1`,children:(0,m.jsxs)(`nav`,{className:`space-y-0.5`,children:[(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 bg-primary/5 text-primary border-r-2 border-primary text-left`,children:[(0,m.jsx)(o,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Scheduler`})]}),(0,m.jsxs)(`button`,{className:`w-full flex items-center gap-2 py-1.5 px-3 text-on-surface-variant hover:text-on-surface hover:bg-surface-container transition-all text-left`,children:[(0,m.jsx)(c,{size:14}),(0,m.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-tight`,children:`Recurrent`})]})]})}),(0,m.jsxs)(`div`,{className:`lg:col-span-3 space-y-12`,children:[(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(s,{size:14}),` 01. TASK_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 10 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:1e4,value:e.data.taskScheduler.pollIntervalInMs,onChange:e=>w(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Tasks Per Execution `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 15`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:15,value:e.data.taskScheduler.maxTaskPerExecution,onChange:e=>w(`maxTaskPerExecution`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`ts.max`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`ts.max`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`ts.max`]})]})]})]}),(0,m.jsxs)(`section`,{children:[(0,m.jsxs)(`div`,{className:`font-mono text-xs font-bold text-primary mb-4 border-b border-outline-variant/20 pb-1 flex items-center gap-2 uppercase tracking-wider`,children:[(0,m.jsx)(c,{size:14}),` 02. RECURRENT_TASKS_SCHEDULER_CONFIG`]}),(0,m.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-6 bg-surface-container-low/30 p-6 border border-outline-variant/10`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Poll Interval (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 15 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:15e3,value:e.data.recurrentTasksScheduler.pollIntervalInMs,onChange:e=>T(`pollIntervalInMs`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.poll`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.poll`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.poll`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Execution Timeout (ms) `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`min 60 000`})]}),(0,m.jsx)(`input`,{type:`number`,min:6e4,value:e.data.recurrentTasksScheduler.executionTimeout,onChange:e=>T(`executionTimeout`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border px-3 py-1.5 text-secondary font-mono text-sm focus:ring-0 outline-none transition-colors ${x[`rs.timeout`]?`border-error`:`border-outline-variant/30 focus:border-primary`}`}),x[`rs.timeout`]&&(0,m.jsx)(`p`,{className:`text-error text-[10px] mt-1`,children:x[`rs.timeout`]})]}),(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`label`,{className:`block font-mono text-[11px] text-on-surface-variant/80 uppercase tracking-wider mb-1`,children:[`Max Active Tasks `,(0,m.jsx)(`span`,{className:`text-outline normal-case`,children:`1 – 5`})]}),(0,m.jsx)(`input`,{type:`number`,min:1,max:5,value:e.data.recurrentTasksScheduler.maxActiveTasks,onChange:e=>T(`maxActiveTasks`,parseInt(e.target.value)),className:`w-full bg-surface-container-lowest border border-outline-variant/30 px-3 py-1.5 text-secondary font-mono text-sm focus:border-primary focus:ring-0 outline-none transition-colors`})]})]})]})]})]})]}):null};export{h as default};
@@ -1 +1 @@
1
- import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{c as r,s as i}from"./vendor-react-BmVaKUwY.js";import{i as a,n as o,t as s}from"./vendor-query-xpDrc4rM.js";import{n as c,r as l,t as u}from"./vendor-markdown-DoJbQ1of.js";import{i as d,t as f}from"./client-BGOBXkO8.js";import{t as p}from"./chevron-right-G5-HRo_C.js";import{t as m}from"./MarkdownField--1gpyapw.js";import{t as h}from"./save-DycJmlX0.js";import{t as g}from"./send-BZjwSrJW.js";import{t as _}from"./shield-check-Cr4SHjdR.js";import{t as v}from"./trash-2-DJpTXgEP.js";import{t as y}from"./ConfirmDialog-y3vTcqFR.js";import{t as b}from"./user--KOoEB9m.js";import{t as x}from"./zap-BmhZqgvm.js";import{n as S}from"./AuthContextInstance-DiFo9Qb2.js";import{n as C}from"./agents-b8btewki.js";import{t as w}from"./useNotification-DQayTSUL.js";import{a as T}from"./agentEmojis-BQA0jC3z.js";import{a as E,c as D,o as O,s as ee}from"./vendor-forms-DHyqHeyd.js";import{i as k,n as A,t as j}from"./tasks-DEUQCNoH.js";import{o as te}from"./taskFormSchemas-dl1t1OyX.js";import{t as M}from"./AttachmentItem-Cerhbyya.js";var ne=d(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),re=d(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),N=d(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ie=d(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ae=d(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),P=e(n(),1),F={USER:`user`,AGENT:`agent`},I={create:async(e,t)=>(await f.post(`/tasks/${e}/comments`,t)).data,findAllByTask:async e=>(await f.get(`/tasks/${e}/comments`)).data,remove:async(e,t)=>{await f.delete(`/tasks/${e}/comments/${t}`)}},L=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||(e(t,E,w),e.$i=!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),R=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e=e||{};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),z=e(L(),1),B=e(R(),1),V=l();z.default.extend(B.default);var H=({comment:e,onDelete:t})=>{let n=e.authorType===F.AGENT,r=n?e.authorAgent?.name:e.authorUser?.username,i=n?e.authorAgent?.avatarUrl:e.authorUser?.avatarUrl,a=n?T(e.authorAgent?.emoji):null;return(0,V.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0 h-10 w-10 rounded-xl flex items-center justify-center border transition-all ${n?`bg-tertiary/10 border-tertiary/20 text-tertiary shadow-[0_0_15px_rgba(221,183,255,0.1)]`:`bg-primary/10 border-primary/20 text-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`}`,children:n?(0,V.jsx)(`span`,{className:`text-2xl`,"aria-label":`${r} emoji`,children:a}):i?(0,V.jsx)(`img`,{src:i,alt:r,className:`h-full w-full object-cover p-1`}):(0,V.jsx)(b,{size:20})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-sm font-headline font-bold ${n?`text-tertiary`:`text-primary`}`,children:r||`Anonymous`}),n&&(0,V.jsx)(`span`,{className:`px-1.5 py-0.5 bg-tertiary/10 text-tertiary text-[9px] font-black uppercase tracking-widest rounded border border-tertiary/20`,children:`Agent`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-xs font-mono text-on-surface-variant/40 lowercase`,children:(0,z.default)(e.createdAt).format(`MMM DD, YYYY HH:mm:ss`)}),t&&(0,V.jsx)(`button`,{onClick:()=>t(e.id),className:`opacity-0 group-hover:opacity-100 p-2 hover:bg-error/10 text-on-surface-variant/40 hover:text-error rounded-lg transition-all`,title:`Delete comment`,children:(0,V.jsx)(v,{size:18})})]})]}),(0,V.jsxs)(`div`,{className:`bg-surface-container-high/40 border border-outline-variant/5 p-4 rounded-xl shadow-sm group-hover:bg-surface-container-high/60 transition-colors`,children:[(0,V.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none text-on-surface leading-relaxed`,children:(0,V.jsx)(c,{remarkPlugins:[u],children:e.content})}),e.artifacts&&e.artifacts.length>0&&(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 mt-4 pt-4 border-t border-outline-variant/10`,children:e.artifacts.map(e=>(0,V.jsx)(M,{name:e.originalName,type:e.mimeType.split(`/`)[1]||`file`,filePath:e.filePath,size:`Artifact`},e.id))})]})]})]})},U=({comments:e,isLoading:t,onDelete:n})=>(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-6 custom-scrollbar`,children:t?(0,V.jsx)(`div`,{className:`space-y-6 animate-pulse`,children:[1,2,3].map(e=>(0,V.jsxs)(`div`,{className:`flex gap-4`,children:[(0,V.jsx)(`div`,{className:`h-10 w-10 bg-surface-container-highest rounded-xl`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsx)(`div`,{className:`h-4 w-1/4 bg-surface-container-highest rounded`}),(0,V.jsx)(`div`,{className:`h-20 w-full bg-surface-container-highest rounded-xl`})]})]},e))}):e.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 bg-surface-container-high/20 rounded-2xl border border-dashed border-outline-variant/20`,children:[(0,V.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-surface-container-highest flex items-center justify-center text-on-surface-variant/40`,children:(0,V.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`})})}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`No comments yet`}),(0,V.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:`Start the conversation by adding a comment below.`})]})]}):(0,V.jsx)(`div`,{className:`space-y-8`,children:e.map(e=>(0,V.jsx)(H,{comment:e,onDelete:n},e.id))})}),W=({onSend:e,isSending:t})=>{let[n,r]=(0,P.useState)(``),i=()=>{n.trim()&&!t&&(e(n),r(``))};return(0,V.jsxs)(`div`,{className:`bg-surface-container-low border border-outline-variant/10 rounded-2xl p-4 shadow-2xl shadow-primary/5 focus-within:border-primary/30 transition-all space-y-4`,children:[(0,V.jsx)(m,{value:n,onChange:r,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&i()},placeholder:`Write a comment...`,height:`min-h-[120px]`}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between pt-4 border-t border-outline-variant/5`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-1`}),(0,V.jsx)(`button`,{onClick:i,disabled:!n.trim()||t,className:`flex items-center gap-2 px-5 py-2.5 rounded-xl font-bold text-xs uppercase tracking-widest transition-all active:scale-95 disabled:opacity-50 disabled:active:scale-100 ${n.trim()?`bg-gradient-to-r from-primary to-primary/80 text-on-primary shadow-lg shadow-primary/20 hover:brightness-110`:`bg-surface-container-highest text-on-surface-variant cursor-not-allowed`}`,children:t?(0,V.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 border-on-primary/30 border-t-on-primary animate-spin`}):(0,V.jsxs)(V.Fragment,{children:[`Send`,(0,V.jsx)(g,{size:14})]})})]})]})},oe=({taskId:e})=>{let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),{user:l}=S(),{notifySuccess:u,notifyApiError:d}=w(),f=a(),{data:p=[],isLoading:m}=o({queryKey:[`comments`,e],queryFn:async()=>[...await I.findAllByTask(e)].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()),enabled:!!e,refetchInterval:1e4}),h=(0,P.useCallback)(()=>{f.invalidateQueries({queryKey:[`comments`,e]})},[f,e]);return(0,V.jsxs)(`div`,{className:`bg-surface-container-low rounded-2xl border border-outline-variant/10 shadow-2xl shadow-primary/5 overflow-hidden flex flex-col h-full`,children:[(0,V.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/5 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-primary/20 p-2.5 rounded-xl shadow-lg shadow-primary/10`,children:(0,V.jsx)(N,{size:22,className:`text-secondary stroke-[2.5]`})}),(0,V.jsx)(`h2`,{className:`text-lg font-headline font-black tracking-tight text-on-surface`,children:`Comments & Activity`})]}),(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsxs)(`span`,{className:`text-[10px] bg-white/5 border border-white/10 px-2 py-0.5 rounded text-white/40 font-mono tracking-widest uppercase`,children:[p.length,` Logged`]})})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,V.jsx)(U,{comments:p,isLoading:m,onDelete:e=>{i(e)}})}),(0,V.jsx)(`div`,{className:`p-6 bg-surface-container-low/50 border-t border-outline-variant/5 backdrop-blur-md`,children:(0,V.jsx)(W,{onSend:async t=>{if(!(!e||!l))try{n(!0),await I.create(e,{content:t,authorType:F.USER,authorUserId:l.id}),h()}catch{}finally{n(!1)}},isSending:t})}),(0,V.jsx)(y,{isOpen:!!r,onClose:()=>!s&&i(null),onConfirm:async()=>{if(!(!e||!r))try{c(!0),await I.remove(e,r),h(),i(null),u(`Protocol Cleared`,`The comment data has been purged from the orchestration logs.`)}catch(e){d(e,`Purge Failed`)}finally{c(!1)}},title:`Purge Communication Protocol?`,message:`This action will permanently erase the selected entry and all its associated artifacts from the neural stream. This operation is irreversible.`,confirmText:`Execute Purge`,variant:`danger`,loading:s})]})},G=[`#6366f1`,`#8b5cf6`,`#a855f7`,`#d946ef`,`#ec4899`,`#f43f5e`,`#ef4444`,`#f97316`,`#eab308`,`#84cc16`,`#22c55e`,`#14b8a6`,`#06b6d4`,`#0ea5e9`,`#3b82f6`,`#6d28d9`];function K(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Math.abs(t)}var se=({name:e,size:t=40,className:n=``})=>{let r=(0,P.useMemo)(()=>{let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(t[0]?.[0]??`U`).toUpperCase()},[e]),i=(0,P.useMemo)(()=>G[K(e)%G.length],[e]);return(0,V.jsx)(`div`,{role:`img`,"aria-label":`${e} avatar`,className:`inline-flex items-center justify-center rounded-full text-white font-bold select-none shrink-0 ${n}`,style:{width:t,height:t,backgroundColor:i,fontSize:t*.38},children:r})},ce={title:``,description:``,status:A.BACKLOG,priority:j.MEDIUM,assigneeId:``},q=()=>{let{projectId:e,taskId:t}=r(),n=i(),c=a(),{notifyApiError:l,notifyError:u,notifySuccess:d}=w(),[f,g]=(0,P.useState)(!1),b=(0,P.useId)(),S=(0,P.useId)(),T=(0,P.useId)(),M=(0,P.useId)(),N=(0,P.useId)(),{control:F,formState:{errors:I,isDirty:L},handleSubmit:R,register:z,reset:B,setValue:H}=ee({resolver:E(te),defaultValues:ce,mode:`onBlur`}),U=o({queryKey:[`task`,e,t],enabled:!!(e&&t),queryFn:async()=>(await k.findOne(e,t)).data}),W=o({queryKey:[`agents`],queryFn:async()=>(await C.findAll()).data});(0,P.useEffect)(()=>{U.error&&l(U.error,`Fetch Error`)},[l,U.error]),(0,P.useEffect)(()=>{W.error&&l(W.error,`Agents Load Failed`)},[W.error,l]),(0,P.useEffect)(()=>{if(!U.data)return;let e=U.data.status===A.ARCHIVED?A.BACKLOG:U.data.status;B({title:U.data.title,description:U.data.description,status:e,priority:Number(U.data.priority),assigneeId:U.data.assignee?.id??``})},[B,U.data]);let G=s({mutationFn:async n=>{if(!e||!t)throw Error(`Task route is missing required identifiers`);return await k.update(e,t,{title:n.title,description:n.description,status:n.status,priority:n.priority,assigneeId:n.assigneeId||null}),n},onSuccess:n=>{!e||!t||(c.invalidateQueries({queryKey:[`task`,e,t]}),c.invalidateQueries({queryKey:[`tasks`,e]}),B(n),d(`Task Updated`,`Intelligence node parameters successfully reconfigured.`))},onError:e=>{l(e,`Update Failed`)}}),K=s({mutationFn:async()=>{if(!e||!t)throw Error(`Task route is missing required identifiers`);await k.delete(e,t)},onSuccess:()=>{e&&c.invalidateQueries({queryKey:[`tasks`,e]}),c.removeQueries({queryKey:[`task`,e,t]}),d(`Task Decommissioned`,`Intelligence node removed from the orchestration grid.`),n(`/`)},onError:e=>{l(e,`Decommission Failed`)}}),q=U.data,J=(0,P.useMemo)(()=>W.data??[],[W.data]),le=D({control:F,name:`title`}),Y=D({control:F,name:`status`}),ue=D({control:F,name:`priority`}),X=D({control:F,name:`assigneeId`}),Z=(0,P.useMemo)(()=>J.find(e=>e.id===X)??null,[J,X]),Q=U.isPending||G.isPending||K.isPending,de=R(async e=>{await G.mutateAsync(e)},()=>{u(`Validation Error`,`Please review the highlighted fields before saving.`)}),fe=()=>{K.isPending||g(!0)};if(U.isPending)return(0,V.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,"aria-busy":`true`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,V.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,V.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Accessing Node Data`})]})});if(!q)return(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto w-full py-16 text-center space-y-4`,children:[(0,V.jsx)(`p`,{className:`text-sm font-black uppercase tracking-[0.2em] text-on-surface-variant/60`,children:`Task intelligence node unavailable`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>n(`/`),className:`px-5 py-2 rounded-xl bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Return to Task Manager`})]});let $=`#NODE-${q.id.substring(0,4).toUpperCase()}`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto w-full space-y-8 animate-in fade-in duration-500`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,V.jsxs)(`nav`,{className:`flex items-center space-x-2 text-sm text-on-surface-variant font-medium`,"aria-label":`Task breadcrumb`,children:[(0,V.jsx)(`button`,{type:`button`,className:`hover:text-primary transition-colors`,onClick:()=>n(`/`),children:`Task Manager`}),(0,V.jsx)(p,{size:16,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-on-surface`,children:$})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:fe,disabled:Q,className:`flex items-center gap-2 px-4 py-2 text-xs font-black uppercase tracking-widest text-error hover:bg-error/10 transition-all rounded-xl active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`}),`Decommission`]}),(0,V.jsxs)(`button`,{type:`button`,disabled:!0,"aria-disabled":`true`,className:`flex items-center gap-2 px-4 py-2 text-xs font-black uppercase tracking-widest text-on-surface bg-surface-container-high hover:bg-surface-container-highest transition-all rounded-xl opacity-50 cursor-not-allowed`,children:[(0,V.jsx)(re,{size:16,"aria-hidden":`true`}),`Halt execution`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:de,disabled:Q||!L,className:`flex items-center gap-2 px-6 py-2 text-xs font-black uppercase tracking-widest bg-primary text-on-primary rounded-xl shadow-lg shadow-primary/20 hover:scale-105 transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100`,children:[(0,V.jsx)(h,{size:16,"aria-hidden":`true`}),G.isPending?`Synchronizing...`:`Save Protocol`]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,V.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-2xl relative overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-32 bg-primary/5 rounded-full blur-3xl -mr-16 -mt-16`}),(0,V.jsxs)(`div`,{className:`flex items-start justify-between mb-10 relative z-10 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-[0.2em] text-primary/70`,children:`Intelligence Node identifier`}),(0,V.jsxs)(`h2`,{className:`text-3xl font-headline font-black text-white tracking-tight break-words`,children:[$,`: `,le||q.title]})]}),(0,V.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,V.jsxs)(`select`,{...z(`status`),"aria-invalid":!!I.status,"aria-describedby":I.status?b:void 0,className:`appearance-none cursor-pointer px-6 py-2 rounded-xl border font-black text-[10px] uppercase tracking-widest outline-none transition-all hover:brightness-110 active:scale-95 ${Y===A.DONE?`bg-secondary/10 border-secondary/20 text-secondary`:Y===A.IN_PROGRESS?`bg-primary/10 border-primary/20 text-primary`:`bg-surface-container-highest/50 border-outline-variant/20 text-on-surface-variant`}`,children:[(0,V.jsx)(`option`,{value:A.BACKLOG,className:`bg-surface-container-low`,children:`Backlog`}),(0,V.jsx)(`option`,{value:A.IN_PROGRESS,className:`bg-surface-container-low`,children:`In Progress`}),(0,V.jsx)(`option`,{value:A.REVIEW,className:`bg-surface-container-low`,children:`Review`}),(0,V.jsx)(`option`,{value:A.DONE,className:`bg-surface-container-low`,children:`Done`})]}),Y===A.IN_PROGRESS&&(0,V.jsxs)(`span`,{className:`absolute -left-1 -top-1 flex h-2 w-2`,"aria-hidden":`true`,children:[(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75`}),(0,V.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-primary`})]})]})]}),I.status&&(0,V.jsx)(`p`,{id:b,className:`mb-6 text-xs text-error font-semibold`,children:I.status.message}),(0,V.jsxs)(`div`,{className:`space-y-8 relative z-10`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{htmlFor:`task-detail-title`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Node Designation`}),(0,V.jsx)(`input`,{id:`task-detail-title`,className:`w-full bg-surface-container-highest/30 border border-outline-variant/10 rounded-xl px-4 py-3 text-sm text-white focus:ring-1 focus:ring-primary/40 focus:bg-surface-container-highest/50 transition-all outline-none font-medium`,type:`text`,"aria-invalid":!!I.title,"aria-describedby":I.title?S:void 0,...z(`title`)}),I.title&&(0,V.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:I.title.message})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{htmlFor:`task-detail-priority`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Operational Priority`}),(0,V.jsx)(O,{control:F,name:`priority`,render:({field:e})=>(0,V.jsxs)(`select`,{id:`task-detail-priority`,value:e.value,onChange:t=>e.onChange(Number(t.target.value)),onBlur:e.onBlur,"aria-invalid":!!I.priority,"aria-describedby":I.priority?T:void 0,className:`w-full border rounded-xl px-4 py-3 text-sm transition-all outline-none font-black tracking-widest uppercase appearance-none ${ue===j.CRITICAL?`bg-error/30 text-white border-error shadow-[0_0_15px_rgba(255,107,107,0.15)] ring-1 ring-error/20`:`bg-surface-container-highest/30 text-white border-outline-variant/10 focus:ring-1 focus:ring-primary/40 focus:bg-surface-container-highest/50`}`,children:[(0,V.jsx)(`option`,{value:j.CRITICAL,className:`bg-surface-container-low`,children:`CRITICAL`}),(0,V.jsx)(`option`,{value:j.HIGH,className:`bg-surface-container-low`,children:`HIGH`}),(0,V.jsx)(`option`,{value:j.MEDIUM,className:`bg-surface-container-low`,children:`MEDIUM`}),(0,V.jsx)(`option`,{value:j.LOW,className:`bg-surface-container-low`,children:`LOW`})]})}),I.priority&&(0,V.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:I.priority.message})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(O,{control:F,name:`description`,render:({field:e})=>(0,V.jsx)(m,{label:`Objective / Parameters`,value:e.value,onChange:t=>e.onChange(t),placeholder:`Describe the desired output and constraints for this node...`,height:`h-56`,helperText:`Supports GitHub Flavored Markdown for logic structure`,initialMode:`preview`,maxLength:2e3})}),I.description&&(0,V.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:I.description.message})]})]})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(oe,{taskId:t||``})})]}),(0,V.jsxs)(`div`,{className:`lg:col-span-4 space-y-6`,children:[(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-xl`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-tertiary/80 block mb-6`,children:`Assigned Intelligence`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsxs)(`select`,{value:X,onChange:e=>{H(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0})},"aria-invalid":!!I.assigneeId,"aria-describedby":I.assigneeId?N:void 0,className:`w-full bg-surface-container-high/50 border border-outline-variant/5 rounded-2xl p-5 appearance-none cursor-pointer focus:ring-1 focus:ring-tertiary/40 outline-none text-white font-headline font-black transition-all hover:border-tertiary/30`,children:[(0,V.jsx)(`option`,{value:``,children:`Protocol Unassigned`}),J.map(e=>(0,V.jsx)(`option`,{value:e.id,className:`bg-surface-container-low`,children:e.name},e.id))]}),(0,V.jsx)(`div`,{className:`absolute right-5 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/40`,children:(0,V.jsx)(ne,{size:20,"aria-hidden":`true`})})]}),I.assigneeId&&(0,V.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:I.assigneeId.message}),Z?(0,V.jsxs)(`div`,{className:`flex items-center gap-5 p-5 bg-tertiary/5 rounded-2xl border border-tertiary/10 animate-in fade-in slide-in-from-top-2 duration-300`,children:[(0,V.jsx)(`div`,{className:`h-14 w-14 rounded-xl bg-tertiary/10 flex items-center justify-center text-tertiary overflow-hidden shadow-inner`,children:(0,V.jsx)(se,{name:Z.name||`U`,size:48,className:`rounded-lg`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h4`,{className:`font-headline font-black text-white`,children:Z.name}),(0,V.jsx)(`p`,{className:`text-[10px] text-tertiary/60 font-black uppercase tracking-widest mt-1`,children:Z.role||`Intelligence Unit`})]})]}):(0,V.jsxs)(`div`,{className:`flex items-center gap-5 p-5 bg-surface-container-high/20 rounded-2xl border border-dashed border-outline-variant/20 italic`,children:[(0,V.jsx)(`div`,{className:`h-14 w-14 rounded-xl bg-surface-container-highest/30 flex items-center justify-center text-on-surface-variant/20`,children:(0,V.jsx)(x,{size:24,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h4`,{className:`font-headline font-bold text-on-surface-variant/40`,children:`Awaiting Assignment`}),(0,V.jsx)(`p`,{className:`text-[9px] text-on-surface-variant/30 font-black uppercase tracking-widest mt-1`,children:`Grid performance limited`})]})]})]}),(0,V.jsxs)(`button`,{type:`button`,disabled:!0,"aria-disabled":`true`,className:`w-full mt-6 py-3 text-[10px] font-black uppercase tracking-[0.2em] text-on-surface-variant transition-all flex items-center justify-center gap-3 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5 opacity-50 cursor-not-allowed`,children:[(0,V.jsx)(ie,{size:16,className:`text-primary`,"aria-hidden":`true`}),`Tune Node Parameters`]})]}),(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-xl`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 block mb-8`,children:`Execution metrics`}),(0,V.jsxs)(`div`,{className:`space-y-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex justify-between items-end`,children:[(0,V.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface`,children:`Node Progress`}),(0,V.jsxs)(`span`,{className:`text-xs font-mono text-primary font-bold`,children:[Y===A.DONE?`100`:Y===A.IN_PROGRESS?`42`:`0`,`%`]})]}),(0,V.jsx)(`div`,{className:`h-2 w-full bg-surface-container-highest rounded-full overflow-hidden`,children:(0,V.jsx)(`div`,{className:`h-full rounded-full transition-all duration-1000 ${Y===A.DONE?`bg-secondary`:`bg-primary`}`,style:{width:`${Y===A.DONE?100:Y===A.IN_PROGRESS?42:0}%`}})})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`p-4 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 text-on-surface-variant/60`,children:[(0,V.jsx)(x,{size:14,className:`text-secondary`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest`,children:`Latency`})]}),(0,V.jsxs)(`div`,{className:`text-lg font-mono font-bold text-white`,children:[q.llmLatency||0,`ms`]})]}),(0,V.jsxs)(`div`,{className:`p-4 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 text-on-surface-variant/60`,children:[(0,V.jsx)(ae,{size:14,className:`text-tertiary`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest`,children:`Node Cost`})]}),(0,V.jsxs)(`div`,{className:`text-lg font-mono font-bold text-white`,children:[`$`,(q.costEstimate||0).toFixed(6)]})]})]})]})]}),(0,V.jsxs)(`div`,{className:`bg-gradient-to-br from-secondary/5 to-primary/5 p-8 rounded-2xl border border-secondary/10 relative overflow-hidden group shadow-xl`,children:[(0,V.jsx)(`div`,{className:`absolute top-0 right-0 -mr-4 -mt-4 text-secondary/5 opacity-50 transition-transform group-hover:scale-110`,children:(0,V.jsx)(_,{size:120,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`relative z-10`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,V.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.2em] text-secondary/80`,children:`Integrity status`}),(0,V.jsx)(`span`,{className:`px-2 py-0.5 bg-secondary/20 text-secondary text-[9px] font-black rounded uppercase`,children:`Optimal`})]}),(0,V.jsx)(`div`,{className:`text-4xl font-headline font-black text-white tracking-tighter`,children:`99.8%`}),(0,V.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-2 italic font-medium leading-relaxed`,children:`Intelligence stream verified and synchronized across grid.`})]})]})]})]})]}),(0,V.jsx)(y,{isOpen:f,onClose:()=>g(!1),onConfirm:()=>{g(!1),K.mutate()},title:`Decommission Task Node?`,message:`Are you sure you want to decommission this task node? This action cannot be undone.`,confirmText:`Decommission`,variant:`danger`,loading:K.isPending})]})};export{q as default};
1
+ import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CfaHPvi0.js";import{c as r,s as i}from"./vendor-react-BmVaKUwY.js";import{i as a,n as o,t as s}from"./vendor-query-xpDrc4rM.js";import{n as c,r as l,t as u}from"./vendor-markdown-DoJbQ1of.js";import{i as d,t as f}from"./client-B553SX3l.js";import{t as p}from"./chevron-right-Bm_d1KKk.js";import{t as m}from"./MarkdownField-DR6tHsei.js";import{t as h}from"./save-Cmqi1IkN.js";import{t as g}from"./send-iK1X7WSe.js";import{t as _}from"./shield-check-YKs9kUNq.js";import{t as v}from"./trash-2-CphQfk35.js";import{t as y}from"./ConfirmDialog-BltdtevE.js";import{t as b}from"./user-Brcjlps5.js";import{t as x}from"./zap-BDAytXMX.js";import{n as S}from"./AuthContextInstance-DiFo9Qb2.js";import{n as C}from"./agents-YQJ7JNfI.js";import{t as w}from"./useNotification-DQayTSUL.js";import{a as T}from"./agentEmojis-BQA0jC3z.js";import{a as E,c as D,o as O,s as ee}from"./vendor-forms-DHyqHeyd.js";import{i as k,n as A,t as j}from"./tasks-DHsBE-ea.js";import{o as te}from"./taskFormSchemas-B6YlRxrx.js";import{t as M}from"./AttachmentItem-C_uUACPz.js";var ne=d(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),re=d(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),N=d(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),ie=d(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),ae=d(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),P=e(n(),1),F={USER:`user`,AGENT:`agent`},I={create:async(e,t)=>(await f.post(`/tasks/${e}/comments`,t)).data,findAllByTask:async e=>(await f.get(`/tasks/${e}/comments`)).data,remove:async(e,t)=>{await f.delete(`/tasks/${e}/comments/${t}`)}},L=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||(e(t,E,w),e.$i=!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),R=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e=e||{};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),z=e(L(),1),B=e(R(),1),V=l();z.default.extend(B.default);var H=({comment:e,onDelete:t})=>{let n=e.authorType===F.AGENT,r=n?e.authorAgent?.name:e.authorUser?.username,i=n?e.authorAgent?.avatarUrl:e.authorUser?.avatarUrl,a=n?T(e.authorAgent?.emoji):null;return(0,V.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,V.jsx)(`div`,{className:`flex-shrink-0 h-10 w-10 rounded-xl flex items-center justify-center border transition-all ${n?`bg-tertiary/10 border-tertiary/20 text-tertiary shadow-[0_0_15px_rgba(221,183,255,0.1)]`:`bg-primary/10 border-primary/20 text-primary shadow-[0_0_15px_rgba(173,198,255,0.1)]`}`,children:n?(0,V.jsx)(`span`,{className:`text-2xl`,"aria-label":`${r} emoji`,children:a}):i?(0,V.jsx)(`img`,{src:i,alt:r,className:`h-full w-full object-cover p-1`}):(0,V.jsx)(b,{size:20})}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-sm font-headline font-bold ${n?`text-tertiary`:`text-primary`}`,children:r||`Anonymous`}),n&&(0,V.jsx)(`span`,{className:`px-1.5 py-0.5 bg-tertiary/10 text-tertiary text-[9px] font-black uppercase tracking-widest rounded border border-tertiary/20`,children:`Agent`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-xs font-mono text-on-surface-variant/40 lowercase`,children:(0,z.default)(e.createdAt).format(`MMM DD, YYYY HH:mm:ss`)}),t&&(0,V.jsx)(`button`,{onClick:()=>t(e.id),className:`opacity-0 group-hover:opacity-100 p-2 hover:bg-error/10 text-on-surface-variant/40 hover:text-error rounded-lg transition-all`,title:`Delete comment`,children:(0,V.jsx)(v,{size:18})})]})]}),(0,V.jsxs)(`div`,{className:`bg-surface-container-high/40 border border-outline-variant/5 p-4 rounded-xl shadow-sm group-hover:bg-surface-container-high/60 transition-colors`,children:[(0,V.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none text-on-surface leading-relaxed`,children:(0,V.jsx)(c,{remarkPlugins:[u],children:e.content})}),e.artifacts&&e.artifacts.length>0&&(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 mt-4 pt-4 border-t border-outline-variant/10`,children:e.artifacts.map(e=>(0,V.jsx)(M,{name:e.originalName,type:e.mimeType.split(`/`)[1]||`file`,filePath:e.filePath,size:`Artifact`},e.id))})]})]})]})},U=({comments:e,isLoading:t,onDelete:n})=>(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-6 custom-scrollbar`,children:t?(0,V.jsx)(`div`,{className:`space-y-6 animate-pulse`,children:[1,2,3].map(e=>(0,V.jsxs)(`div`,{className:`flex gap-4`,children:[(0,V.jsx)(`div`,{className:`h-10 w-10 bg-surface-container-highest rounded-xl`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsx)(`div`,{className:`h-4 w-1/4 bg-surface-container-highest rounded`}),(0,V.jsx)(`div`,{className:`h-20 w-full bg-surface-container-highest rounded-xl`})]})]},e))}):e.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center space-y-4 bg-surface-container-high/20 rounded-2xl border border-dashed border-outline-variant/20`,children:[(0,V.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-surface-container-highest flex items-center justify-center text-on-surface-variant/40`,children:(0,V.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`})})}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:`No comments yet`}),(0,V.jsx)(`p`,{className:`text-xs text-on-surface-variant/60`,children:`Start the conversation by adding a comment below.`})]})]}):(0,V.jsx)(`div`,{className:`space-y-8`,children:e.map(e=>(0,V.jsx)(H,{comment:e,onDelete:n},e.id))})}),W=({onSend:e,isSending:t})=>{let[n,r]=(0,P.useState)(``),i=()=>{n.trim()&&!t&&(e(n),r(``))};return(0,V.jsxs)(`div`,{className:`bg-surface-container-low border border-outline-variant/10 rounded-2xl p-4 shadow-2xl shadow-primary/5 focus-within:border-primary/30 transition-all space-y-4`,children:[(0,V.jsx)(m,{value:n,onChange:r,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&i()},placeholder:`Write a comment...`,height:`min-h-[120px]`}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between pt-4 border-t border-outline-variant/5`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-1`}),(0,V.jsx)(`button`,{onClick:i,disabled:!n.trim()||t,className:`flex items-center gap-2 px-5 py-2.5 rounded-xl font-bold text-xs uppercase tracking-widest transition-all active:scale-95 disabled:opacity-50 disabled:active:scale-100 ${n.trim()?`bg-gradient-to-r from-primary to-primary/80 text-on-primary shadow-lg shadow-primary/20 hover:brightness-110`:`bg-surface-container-highest text-on-surface-variant cursor-not-allowed`}`,children:t?(0,V.jsx)(`div`,{className:`w-4 h-4 rounded-full border-2 border-on-primary/30 border-t-on-primary animate-spin`}):(0,V.jsxs)(V.Fragment,{children:[`Send`,(0,V.jsx)(g,{size:14})]})})]})]})},oe=({taskId:e})=>{let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),{user:l}=S(),{notifySuccess:u,notifyApiError:d}=w(),f=a(),{data:p=[],isLoading:m}=o({queryKey:[`comments`,e],queryFn:async()=>[...await I.findAllByTask(e)].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()),enabled:!!e,refetchInterval:1e4}),h=(0,P.useCallback)(()=>{f.invalidateQueries({queryKey:[`comments`,e]})},[f,e]);return(0,V.jsxs)(`div`,{className:`bg-surface-container-low rounded-2xl border border-outline-variant/10 shadow-2xl shadow-primary/5 overflow-hidden flex flex-col h-full`,children:[(0,V.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/5 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-primary/20 p-2.5 rounded-xl shadow-lg shadow-primary/10`,children:(0,V.jsx)(N,{size:22,className:`text-secondary stroke-[2.5]`})}),(0,V.jsx)(`h2`,{className:`text-lg font-headline font-black tracking-tight text-on-surface`,children:`Comments & Activity`})]}),(0,V.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,V.jsxs)(`span`,{className:`text-[10px] bg-white/5 border border-white/10 px-2 py-0.5 rounded text-white/40 font-mono tracking-widest uppercase`,children:[p.length,` Logged`]})})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,V.jsx)(U,{comments:p,isLoading:m,onDelete:e=>{i(e)}})}),(0,V.jsx)(`div`,{className:`p-6 bg-surface-container-low/50 border-t border-outline-variant/5 backdrop-blur-md`,children:(0,V.jsx)(W,{onSend:async t=>{if(!(!e||!l))try{n(!0),await I.create(e,{content:t,authorType:F.USER,authorUserId:l.id}),h()}catch{}finally{n(!1)}},isSending:t})}),(0,V.jsx)(y,{isOpen:!!r,onClose:()=>!s&&i(null),onConfirm:async()=>{if(!(!e||!r))try{c(!0),await I.remove(e,r),h(),i(null),u(`Protocol Cleared`,`The comment data has been purged from the orchestration logs.`)}catch(e){d(e,`Purge Failed`)}finally{c(!1)}},title:`Purge Communication Protocol?`,message:`This action will permanently erase the selected entry and all its associated artifacts from the neural stream. This operation is irreversible.`,confirmText:`Execute Purge`,variant:`danger`,loading:s})]})},G=[`#6366f1`,`#8b5cf6`,`#a855f7`,`#d946ef`,`#ec4899`,`#f43f5e`,`#ef4444`,`#f97316`,`#eab308`,`#84cc16`,`#22c55e`,`#14b8a6`,`#06b6d4`,`#0ea5e9`,`#3b82f6`,`#6d28d9`];function K(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Math.abs(t)}var se=({name:e,size:t=40,className:n=``})=>{let r=(0,P.useMemo)(()=>{let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(t[0]?.[0]??`U`).toUpperCase()},[e]),i=(0,P.useMemo)(()=>G[K(e)%G.length],[e]);return(0,V.jsx)(`div`,{role:`img`,"aria-label":`${e} avatar`,className:`inline-flex items-center justify-center rounded-full text-white font-bold select-none shrink-0 ${n}`,style:{width:t,height:t,backgroundColor:i,fontSize:t*.38},children:r})},ce={title:``,description:``,status:A.BACKLOG,priority:j.MEDIUM,assigneeId:``},q=()=>{let{projectId:e,taskId:t}=r(),n=i(),c=a(),{notifyApiError:l,notifyError:u,notifySuccess:d}=w(),[f,g]=(0,P.useState)(!1),b=(0,P.useId)(),S=(0,P.useId)(),T=(0,P.useId)(),M=(0,P.useId)(),N=(0,P.useId)(),{control:F,formState:{errors:I,isDirty:L},handleSubmit:R,register:z,reset:B,setValue:H}=ee({resolver:E(te),defaultValues:ce,mode:`onBlur`}),U=o({queryKey:[`task`,e,t],enabled:!!(e&&t),queryFn:async()=>(await k.findOne(e,t)).data}),W=o({queryKey:[`agents`],queryFn:async()=>(await C.findAll()).data});(0,P.useEffect)(()=>{U.error&&l(U.error,`Fetch Error`)},[l,U.error]),(0,P.useEffect)(()=>{W.error&&l(W.error,`Agents Load Failed`)},[W.error,l]),(0,P.useEffect)(()=>{if(!U.data)return;let e=U.data.status===A.ARCHIVED?A.BACKLOG:U.data.status;B({title:U.data.title,description:U.data.description,status:e,priority:Number(U.data.priority),assigneeId:U.data.assignee?.id??``})},[B,U.data]);let G=s({mutationFn:async n=>{if(!e||!t)throw Error(`Task route is missing required identifiers`);return await k.update(e,t,{title:n.title,description:n.description,status:n.status,priority:n.priority,assigneeId:n.assigneeId||null}),n},onSuccess:n=>{!e||!t||(c.invalidateQueries({queryKey:[`task`,e,t]}),c.invalidateQueries({queryKey:[`tasks`,e]}),B(n),d(`Task Updated`,`Intelligence node parameters successfully reconfigured.`))},onError:e=>{l(e,`Update Failed`)}}),K=s({mutationFn:async()=>{if(!e||!t)throw Error(`Task route is missing required identifiers`);await k.delete(e,t)},onSuccess:()=>{e&&c.invalidateQueries({queryKey:[`tasks`,e]}),c.removeQueries({queryKey:[`task`,e,t]}),d(`Task Decommissioned`,`Intelligence node removed from the orchestration grid.`),n(`/`)},onError:e=>{l(e,`Decommission Failed`)}}),q=U.data,J=(0,P.useMemo)(()=>W.data??[],[W.data]),le=D({control:F,name:`title`}),Y=D({control:F,name:`status`}),ue=D({control:F,name:`priority`}),X=D({control:F,name:`assigneeId`}),Z=(0,P.useMemo)(()=>J.find(e=>e.id===X)??null,[J,X]),Q=U.isPending||G.isPending||K.isPending,de=R(async e=>{await G.mutateAsync(e)},()=>{u(`Validation Error`,`Please review the highlighted fields before saving.`)}),fe=()=>{K.isPending||g(!0)};if(U.isPending)return(0,V.jsx)(`div`,{className:`w-full h-[60vh] flex items-center justify-center`,"aria-busy":`true`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,V.jsx)(`div`,{className:`w-16 h-16 border-4 border-primary border-t-transparent rounded-full animate-spin`}),(0,V.jsx)(`p`,{className:`text-on-surface-variant text-sm font-black uppercase tracking-[0.3em] animate-pulse`,children:`Accessing Node Data`})]})});if(!q)return(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto w-full py-16 text-center space-y-4`,children:[(0,V.jsx)(`p`,{className:`text-sm font-black uppercase tracking-[0.2em] text-on-surface-variant/60`,children:`Task intelligence node unavailable`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>n(`/`),className:`px-5 py-2 rounded-xl bg-surface-container-high text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Return to Task Manager`})]});let $=`#NODE-${q.id.substring(0,4).toUpperCase()}`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto w-full space-y-8 animate-in fade-in duration-500`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,V.jsxs)(`nav`,{className:`flex items-center space-x-2 text-sm text-on-surface-variant font-medium`,"aria-label":`Task breadcrumb`,children:[(0,V.jsx)(`button`,{type:`button`,className:`hover:text-primary transition-colors`,onClick:()=>n(`/`),children:`Task Manager`}),(0,V.jsx)(p,{size:16,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-on-surface`,children:$})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:fe,disabled:Q,className:`flex items-center gap-2 px-4 py-2 text-xs font-black uppercase tracking-widest text-error hover:bg-error/10 transition-all rounded-xl active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`}),`Decommission`]}),(0,V.jsxs)(`button`,{type:`button`,disabled:!0,"aria-disabled":`true`,className:`flex items-center gap-2 px-4 py-2 text-xs font-black uppercase tracking-widest text-on-surface bg-surface-container-high hover:bg-surface-container-highest transition-all rounded-xl opacity-50 cursor-not-allowed`,children:[(0,V.jsx)(re,{size:16,"aria-hidden":`true`}),`Halt execution`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:de,disabled:Q||!L,className:`flex items-center gap-2 px-6 py-2 text-xs font-black uppercase tracking-widest bg-primary text-on-primary rounded-xl shadow-lg shadow-primary/20 hover:scale-105 transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100`,children:[(0,V.jsx)(h,{size:16,"aria-hidden":`true`}),G.isPending?`Synchronizing...`:`Save Protocol`]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,V.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-2xl relative overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`absolute top-0 right-0 w-32 h-32 bg-primary/5 rounded-full blur-3xl -mr-16 -mt-16`}),(0,V.jsxs)(`div`,{className:`flex items-start justify-between mb-10 relative z-10 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-[0.2em] text-primary/70`,children:`Intelligence Node identifier`}),(0,V.jsxs)(`h2`,{className:`text-3xl font-headline font-black text-white tracking-tight break-words`,children:[$,`: `,le||q.title]})]}),(0,V.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,V.jsxs)(`select`,{...z(`status`),"aria-invalid":!!I.status,"aria-describedby":I.status?b:void 0,className:`appearance-none cursor-pointer px-6 py-2 rounded-xl border font-black text-[10px] uppercase tracking-widest outline-none transition-all hover:brightness-110 active:scale-95 ${Y===A.DONE?`bg-secondary/10 border-secondary/20 text-secondary`:Y===A.IN_PROGRESS?`bg-primary/10 border-primary/20 text-primary`:`bg-surface-container-highest/50 border-outline-variant/20 text-on-surface-variant`}`,children:[(0,V.jsx)(`option`,{value:A.BACKLOG,className:`bg-surface-container-low`,children:`Backlog`}),(0,V.jsx)(`option`,{value:A.IN_PROGRESS,className:`bg-surface-container-low`,children:`In Progress`}),(0,V.jsx)(`option`,{value:A.REVIEW,className:`bg-surface-container-low`,children:`Review`}),(0,V.jsx)(`option`,{value:A.DONE,className:`bg-surface-container-low`,children:`Done`})]}),Y===A.IN_PROGRESS&&(0,V.jsxs)(`span`,{className:`absolute -left-1 -top-1 flex h-2 w-2`,"aria-hidden":`true`,children:[(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75`}),(0,V.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-primary`})]})]})]}),I.status&&(0,V.jsx)(`p`,{id:b,className:`mb-6 text-xs text-error font-semibold`,children:I.status.message}),(0,V.jsxs)(`div`,{className:`space-y-8 relative z-10`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{htmlFor:`task-detail-title`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Node Designation`}),(0,V.jsx)(`input`,{id:`task-detail-title`,className:`w-full bg-surface-container-highest/30 border border-outline-variant/10 rounded-xl px-4 py-3 text-sm text-white focus:ring-1 focus:ring-primary/40 focus:bg-surface-container-highest/50 transition-all outline-none font-medium`,type:`text`,"aria-invalid":!!I.title,"aria-describedby":I.title?S:void 0,...z(`title`)}),I.title&&(0,V.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:I.title.message})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{htmlFor:`task-detail-priority`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1`,children:`Operational Priority`}),(0,V.jsx)(O,{control:F,name:`priority`,render:({field:e})=>(0,V.jsxs)(`select`,{id:`task-detail-priority`,value:e.value,onChange:t=>e.onChange(Number(t.target.value)),onBlur:e.onBlur,"aria-invalid":!!I.priority,"aria-describedby":I.priority?T:void 0,className:`w-full border rounded-xl px-4 py-3 text-sm transition-all outline-none font-black tracking-widest uppercase appearance-none ${ue===j.CRITICAL?`bg-error/30 text-white border-error shadow-[0_0_15px_rgba(255,107,107,0.15)] ring-1 ring-error/20`:`bg-surface-container-highest/30 text-white border-outline-variant/10 focus:ring-1 focus:ring-primary/40 focus:bg-surface-container-highest/50`}`,children:[(0,V.jsx)(`option`,{value:j.CRITICAL,className:`bg-surface-container-low`,children:`CRITICAL`}),(0,V.jsx)(`option`,{value:j.HIGH,className:`bg-surface-container-low`,children:`HIGH`}),(0,V.jsx)(`option`,{value:j.MEDIUM,className:`bg-surface-container-low`,children:`MEDIUM`}),(0,V.jsx)(`option`,{value:j.LOW,className:`bg-surface-container-low`,children:`LOW`})]})}),I.priority&&(0,V.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:I.priority.message})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(O,{control:F,name:`description`,render:({field:e})=>(0,V.jsx)(m,{label:`Objective / Parameters`,value:e.value,onChange:t=>e.onChange(t),placeholder:`Describe the desired output and constraints for this node...`,height:`h-56`,helperText:`Supports GitHub Flavored Markdown for logic structure`,initialMode:`preview`,maxLength:2e3})}),I.description&&(0,V.jsx)(`p`,{id:M,className:`text-xs text-error font-semibold`,children:I.description.message})]})]})]}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(oe,{taskId:t||``})})]}),(0,V.jsxs)(`div`,{className:`lg:col-span-4 space-y-6`,children:[(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-xl`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-tertiary/80 block mb-6`,children:`Assigned Intelligence`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsxs)(`select`,{value:X,onChange:e=>{H(`assigneeId`,e.target.value,{shouldDirty:!0,shouldValidate:!0})},"aria-invalid":!!I.assigneeId,"aria-describedby":I.assigneeId?N:void 0,className:`w-full bg-surface-container-high/50 border border-outline-variant/5 rounded-2xl p-5 appearance-none cursor-pointer focus:ring-1 focus:ring-tertiary/40 outline-none text-white font-headline font-black transition-all hover:border-tertiary/30`,children:[(0,V.jsx)(`option`,{value:``,children:`Protocol Unassigned`}),J.map(e=>(0,V.jsx)(`option`,{value:e.id,className:`bg-surface-container-low`,children:e.name},e.id))]}),(0,V.jsx)(`div`,{className:`absolute right-5 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/40`,children:(0,V.jsx)(ne,{size:20,"aria-hidden":`true`})})]}),I.assigneeId&&(0,V.jsx)(`p`,{id:N,className:`text-xs text-error font-semibold`,children:I.assigneeId.message}),Z?(0,V.jsxs)(`div`,{className:`flex items-center gap-5 p-5 bg-tertiary/5 rounded-2xl border border-tertiary/10 animate-in fade-in slide-in-from-top-2 duration-300`,children:[(0,V.jsx)(`div`,{className:`h-14 w-14 rounded-xl bg-tertiary/10 flex items-center justify-center text-tertiary overflow-hidden shadow-inner`,children:(0,V.jsx)(se,{name:Z.name||`U`,size:48,className:`rounded-lg`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h4`,{className:`font-headline font-black text-white`,children:Z.name}),(0,V.jsx)(`p`,{className:`text-[10px] text-tertiary/60 font-black uppercase tracking-widest mt-1`,children:Z.role||`Intelligence Unit`})]})]}):(0,V.jsxs)(`div`,{className:`flex items-center gap-5 p-5 bg-surface-container-high/20 rounded-2xl border border-dashed border-outline-variant/20 italic`,children:[(0,V.jsx)(`div`,{className:`h-14 w-14 rounded-xl bg-surface-container-highest/30 flex items-center justify-center text-on-surface-variant/20`,children:(0,V.jsx)(x,{size:24,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h4`,{className:`font-headline font-bold text-on-surface-variant/40`,children:`Awaiting Assignment`}),(0,V.jsx)(`p`,{className:`text-[9px] text-on-surface-variant/30 font-black uppercase tracking-widest mt-1`,children:`Grid performance limited`})]})]})]}),(0,V.jsxs)(`button`,{type:`button`,disabled:!0,"aria-disabled":`true`,className:`w-full mt-6 py-3 text-[10px] font-black uppercase tracking-[0.2em] text-on-surface-variant transition-all flex items-center justify-center gap-3 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5 opacity-50 cursor-not-allowed`,children:[(0,V.jsx)(ie,{size:16,className:`text-primary`,"aria-hidden":`true`}),`Tune Node Parameters`]})]}),(0,V.jsxs)(`div`,{className:`bg-surface-container-low p-8 rounded-2xl border border-outline-variant/10 shadow-xl`,children:[(0,V.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 block mb-8`,children:`Execution metrics`}),(0,V.jsxs)(`div`,{className:`space-y-8`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex justify-between items-end`,children:[(0,V.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface`,children:`Node Progress`}),(0,V.jsxs)(`span`,{className:`text-xs font-mono text-primary font-bold`,children:[Y===A.DONE?`100`:Y===A.IN_PROGRESS?`42`:`0`,`%`]})]}),(0,V.jsx)(`div`,{className:`h-2 w-full bg-surface-container-highest rounded-full overflow-hidden`,children:(0,V.jsx)(`div`,{className:`h-full rounded-full transition-all duration-1000 ${Y===A.DONE?`bg-secondary`:`bg-primary`}`,style:{width:`${Y===A.DONE?100:Y===A.IN_PROGRESS?42:0}%`}})})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`p-4 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 text-on-surface-variant/60`,children:[(0,V.jsx)(x,{size:14,className:`text-secondary`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest`,children:`Latency`})]}),(0,V.jsxs)(`div`,{className:`text-lg font-mono font-bold text-white`,children:[q.llmLatency||0,`ms`]})]}),(0,V.jsxs)(`div`,{className:`p-4 bg-surface-container-highest/20 rounded-xl border border-outline-variant/5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-1 text-on-surface-variant/60`,children:[(0,V.jsx)(ae,{size:14,className:`text-tertiary`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`text-[9px] font-black uppercase tracking-widest`,children:`Node Cost`})]}),(0,V.jsxs)(`div`,{className:`text-lg font-mono font-bold text-white`,children:[`$`,(q.costEstimate||0).toFixed(6)]})]})]})]})]}),(0,V.jsxs)(`div`,{className:`bg-gradient-to-br from-secondary/5 to-primary/5 p-8 rounded-2xl border border-secondary/10 relative overflow-hidden group shadow-xl`,children:[(0,V.jsx)(`div`,{className:`absolute top-0 right-0 -mr-4 -mt-4 text-secondary/5 opacity-50 transition-transform group-hover:scale-110`,children:(0,V.jsx)(_,{size:120,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`relative z-10`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,V.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.2em] text-secondary/80`,children:`Integrity status`}),(0,V.jsx)(`span`,{className:`px-2 py-0.5 bg-secondary/20 text-secondary text-[9px] font-black rounded uppercase`,children:`Optimal`})]}),(0,V.jsx)(`div`,{className:`text-4xl font-headline font-black text-white tracking-tighter`,children:`99.8%`}),(0,V.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 mt-2 italic font-medium leading-relaxed`,children:`Intelligence stream verified and synchronized across grid.`})]})]})]})]})]}),(0,V.jsx)(y,{isOpen:f,onClose:()=>g(!1),onConfirm:()=>{g(!1),K.mutate()},title:`Decommission Task Node?`,message:`Are you sure you want to decommission this task node? This action cannot be undone.`,confirmText:`Decommission`,variant:`danger`,loading:K.isPending})]})};export{q as default};