@bpinhosilva/agent-orchestrator 1.0.0-alpha.34 → 1.0.0-alpha.35

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 (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +2 -1
  3. package/dist/ui/assets/{AgentFleet-BNgsWY2o.js → AgentFleet-eDOzJ1ln.js} +1 -1
  4. package/dist/ui/assets/{ConfirmDialog-CIfNuBst.js → ConfirmDialog-BC4kXR-v.js} +1 -1
  5. package/dist/ui/assets/CreateRecurrentTaskModal-3i2kvJ7D.js +1 -0
  6. package/dist/ui/assets/{Profile-CPwg7w-x.js → Profile-CIVwII8X.js} +1 -1
  7. package/dist/ui/assets/{ProjectDetail-bkd8jRYr.js → ProjectDetail-D9GECicH.js} +1 -1
  8. package/dist/ui/assets/{Providers-CsLkW8rv.js → Providers-e_57YNh2.js} +1 -1
  9. package/dist/ui/assets/Scheduler-D8kBg7x3.js +1 -0
  10. package/dist/ui/assets/{Settings-Dd6mlxMN.js → Settings-CPWN7Z5a.js} +1 -1
  11. package/dist/ui/assets/{TaskDetail-DKuMLlM2.js → TaskDetail-DmbJFnj7.js} +1 -1
  12. package/dist/ui/assets/TaskExecutions-DSqVbwe_.js +2 -0
  13. package/dist/ui/assets/{TaskManager-DD3ABMx5.js → TaskManager-A75O4y6b.js} +2 -2
  14. package/dist/ui/assets/{UserDetail-D3EMlcu7.js → UserDetail-DQxuKynZ.js} +1 -1
  15. package/dist/ui/assets/Users-BLJjzn5Z.js +1 -0
  16. package/dist/ui/assets/index-B-2XAA2C.js +3 -0
  17. package/dist/ui/assets/index-BUrAFVNL.css +2 -0
  18. package/dist/ui/assets/{taskFormSchemas-CKu2m51r.js → taskFormSchemas-CgvN8KCz.js} +1 -1
  19. package/dist/ui/assets/tasks-CaT1ysud.js +1 -0
  20. package/dist/ui/assets/vendor-query-BMPnNmZi.js +1 -0
  21. package/dist/ui/index.html +4 -4
  22. package/package.json +1 -1
  23. package/dist/ui/assets/CreateRecurrentTaskModal-k4iA_ECJ.js +0 -1
  24. package/dist/ui/assets/Scheduler-DJ4e83Kr.js +0 -1
  25. package/dist/ui/assets/TaskExecutions-BeeSmLar.js +0 -1
  26. package/dist/ui/assets/Users-BmHfRaGc.js +0 -1
  27. package/dist/ui/assets/index-uV1e3LjR.css +0 -2
  28. package/dist/ui/assets/index-wA5sKdfn.js +0 -3
  29. package/dist/ui/assets/search-FGpO3s2Z.js +0 -1
  30. package/dist/ui/assets/tasks-RLY66Qjl.js +0 -1
  31. package/dist/ui/assets/vendor-query-DQlZ8h7P.js +0 -1
  32. /package/dist/ui/assets/{cn-DqKDUEQs.js → cn-DjbzjBLV.js} +0 -0
  33. /package/dist/ui/assets/{send-DHRDZ09J.js → send-Bwuzypop.js} +0 -0
  34. /package/dist/ui/assets/{shield-alert-DwOWpTph.js → shield-alert-BRwAB12k.js} +0 -0
  35. /package/dist/ui/assets/{shield-check-5104WjFF.js → shield-check-CdGbbgI2.js} +0 -0
  36. /package/dist/ui/assets/{trash-2-BlARVDmE.js → trash-2-BWnYC9Ad.js} +0 -0
  37. /package/dist/ui/assets/{trending-up-VOBRPers.js → trending-up-D2Iapk5q.js} +0 -0
  38. /package/dist/ui/assets/{user-CCOu6zJa.js → user-DpMk7aqI.js} +0 -0
  39. /package/dist/ui/assets/{vendor-forms-Cl5GroiL.js → vendor-forms-BmyvqYDG.js} +0 -0
  40. /package/dist/ui/assets/{vendor-motion-B6xhOm18.js → vendor-motion-CPra8At-.js} +0 -0
  41. /package/dist/ui/assets/{zap-kFzU0aZV.js → zap-BI5M4WZX.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-alpha.35](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2026-04-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * add Spanish release notes and update task priority handling ([42484db](https://github.com/bpinhosilva/agent-orchestrator/commit/42484db728a48eed290c00be180598718ca572a5))
7
+
1
8
  # [1.0.0-alpha.34](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2026-04-09)
2
9
 
3
10
 
package/README.md CHANGED
@@ -13,7 +13,8 @@
13
13
  </p>
14
14
 
15
15
  <p align="center">
16
- <a href="docs/i18n/pt-br/README.md">🇧🇷 Português (Brasil)</a>
16
+ <a href="docs/i18n/pt-br/README.md">🇧🇷 Português (Brasil)</a> &nbsp;&middot;&nbsp;
17
+ <a href="docs/i18n/es-es/README.md">🇪🇸 Español (España)</a>
17
18
  </p>
18
19
 
19
20
  Agent Orchestrator is an open-source platform for managing AI agents, tasks, and project-scoped automation across multiple model providers. It combines a NestJS API, a React dashboard, a packaged CLI/runtime, and Docker deployment options for both local use and production-style environments.
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{i as n,n as r,t as i}from"./vendor-query-DQlZ8h7P.js";import{r as a}from"./vendor-markdown-Dl_1qnne.js";import{i as o}from"./client-CylGrWpP.js";import{t as s}from"./activity-D2aBFbnN.js";import{t as c}from"./box-3f35ZKNV.js";import{t as l}from"./brain-DwFWAhZ9.js";import{t as u}from"./check-BhOeS9mA.js";import{t as d}from"./chevron-down-DOfOMDZp.js";import{n as f,t as p}from"./terminal-DXcWSHx9.js";import{n as m,r as h,t as g}from"./MarkdownField-DJ12Ejut.js";import{i as _,r as v,t as y}from"./providers-BLAJFnS4.js";import{t as b}from"./layers-CpiP5U5p.js";import{t as x}from"./loader-circle-DbVXtlbV.js";import{t as S}from"./send-DHRDZ09J.js";import{t as C}from"./trash-2-BlARVDmE.js";import{t as w}from"./ConfirmDialog-CIfNuBst.js";import{n as T,t as E}from"./vendor-motion-B6xhOm18.js";import{C as D,S as O,_ as k,c as ee,h as te,l as A,u as j,y as M}from"./index-wA5sKdfn.js";import{c as N,l as P,o as F,r as ne,s as I,t as L}from"./taskFormSchemas-CKu2m51r.js";import{a as re,c as R,o as z,s as B}from"./vendor-forms-Cl5GroiL.js";import"./tasks-RLY66Qjl.js";var V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ie=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ae=o(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),W=e(t(),1),G=a(),K={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:m},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:f}},q=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:s,onProbe:c,onConfigure:u,onDelete:d,onActivate:f})=>{let[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return m&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${_.bg} ${_.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${_.dot} ${_.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${_.color}`,children:s})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:g,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),h(!m)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${m?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(v,{size:16,"aria-hidden":`true`})}),m&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),c?.(e),h(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(p,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(k,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),f?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(C,{size:14}),`Decommission`]})]})]})]})]})},oe=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(m,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(te,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:F.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),J=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],Y=1,X=5,Z=.01,Q=e=>(e??A.creativity).toFixed(2),se=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??A.creativity,i=e.strictness??A.strictness,a=n=>{t({...e,creativity:parseFloat(n.target.value)})},o=n=>{t({...e,strictness:parseFloat(n.target.value)})};return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Q(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:r,onChange:a,disabled:n,"aria-label":`Creativity`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Q(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:i,onChange:o,disabled:n,"aria-label":`Strictness`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},ce=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=ee(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[v,b]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),[E,D]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[M,F]=(0,W.useState)(``),[ne,I]=(0,W.useState)([]),[L,re]=(0,W.useState)(``),[R,z]=(0,W.useState)(`🧠`),[B,V]=(0,W.useState)(!1),[H,U]=(0,W.useState)({...A});(0,W.useEffect)(()=>{e&&r&&(b(r.name||``),C(r.role||``),T(r.description||``),D(r.systemInstructions||``),re(r.model?.id||``),z(P(r.emoji)),F(r.provider?.id??r.model?.provider?.id??``),U(r.attributes??{...A}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await y.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!M){I([]);return}(async()=>{try{l(!0);let{data:e}=await y.findModels(M);I(e),L&&!e.find(e=>e.id===L)&&re(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[M,L]);let ae=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},K=async()=>{if(r?.id)try{s(!0),await j.update(r.id,{name:v,emoji:R,role:S,description:w,systemInstructions:E,providerId:M||void 0,modelId:L||void 0,attributes:H}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!B&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[B,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(te,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>V(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:R}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(ie,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:N(R).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:N(R).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:v,onChange:e=>b(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:ae,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:m?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(_,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:S,onChange:e=>C(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:w,onChange:T,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:M,onChange:e=>F(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),O.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>re(e.target.value),disabled:c||ne.length===0,children:[ne.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),ne.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(se,{value:H,onChange:U}),(0,G.jsx)(g,{label:`System Instructions`,value:E,onChange:D,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{K()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(oe,{isOpen:B,selectedEmoji:R,currentEmoji:P(r?.emoji),isSaving:o,onSelect:z,onClose:()=>V(!1),onConfirm:()=>V(!1)})]}):null},le={name:``,role:``,description:``,emoji:I,providerId:``,modelId:``,instructions:L,attributes:{...A}},ue=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],$=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=ee(),[f,p]=(0,W.useState)(1),[_,v]=(0,W.useState)(!1),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),w=(0,W.useId)(),D=(0,W.useId)(),O=(0,W.useId)(),k=(0,W.useId)(),te=(0,W.useId)(),{control:M,formState:{errors:F},handleSubmit:L,register:V,reset:H,setValue:U}=B({resolver:re(ne),defaultValues:le,mode:`onBlur`}),K=R({control:M,name:`providerId`}),q=R({control:M,name:`modelId`}),J=R({control:M,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await y.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await y.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(le);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let ce=i({mutationFn:async e=>(await j.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,providerId:e.providerId,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(le),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=ce.isPending,de=Y.isPending||X.isPending,fe=L(async e=>{await ce.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),pe=()=>{$||(p(1),t())};return e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:pe,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(E.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":x,"aria-describedby":S,"aria-busy":$||de,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:x,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:S,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:pe,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:fe,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:ue.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(m,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>v(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:P(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:N(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:N(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(ie,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!F.name,"aria-describedby":F.name?C:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),F.name&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:F.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!F.role,"aria-describedby":F.role?w:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),F.role&&(0,G.jsx)(`p`,{id:w,className:`text-xs text-error font-semibold`,children:F.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:M,name:`description`,render:({field:e})=>(0,G.jsx)(g,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),F.description&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:F.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),de&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(b,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),F.providerId&&(0,G.jsx)(`p`,{id:O,className:`text-xs text-error font-semibold`,children:F.providerId.message})]}),(0,G.jsx)(T,{mode:`wait`,children:K&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!F.modelId,"aria-describedby":F.modelId?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),F.modelId&&(0,G.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:F.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(z,{control:M,name:`attributes`,render:({field:e})=>(0,G.jsx)(se,{value:e.value??{...A},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:M,name:`instructions`,render:({field:e})=>(0,G.jsx)(g,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),F.instructions&&(0,G.jsx)(`p`,{id:te,className:`text-xs text-error font-semibold`,children:F.instructions.message})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Knowledge Integration`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(h,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Connect Repo`})]}),(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(ae,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Access Policies`})]})]})]})]})]})]})]}),(0,G.jsx)(oe,{isOpen:_,selectedEmoji:P(J),currentEmoji:I,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>v(!1),onConfirm:()=>v(!1)})]})}):null},de=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[f,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),g(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(E.div,{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-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(te,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(p,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{m(!0),g(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await j.probe(n.id,i);c(e.content),d(e.image),g(`success`)}catch(e){console.error(`Probe failed:`,e);let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),g(`error`)}finally{m(!1)}},disabled:f||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:f?(0,G.jsx)(x,{size:18,className:`animate-spin`}):(0,G.jsx)(S,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:f?`animate-pulse`:``}),`Neural Response`]}),h===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(O,{size:10}),` Sync Complete`]}),h===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(D,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${h===`error`?`text-error/80 border-error/20`:h===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(T,{children:u&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},fe=()=>{let{notifySuccess:e,notifyApiError:t}=ee(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await j.findAll();return e}}),b=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),S=i({mutationFn:e=>j.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),b()},onError:e=>t(e,`Operation Failed`)}),C=i({mutationFn:e=>j.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),b()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},E=e=>{s(e),p(!0)},D=e=>{s(e),h(!0)},O=()=>{o&&S.mutate(o.id)},k=e=>{C.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(x,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(q,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>E(e),onDelete:()=>D(e),onActivate:()=>k(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(M,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(ce,{isOpen:c,onClose:()=>l(!1),onUpdated:b,agent:o},o?.id||`none`),(0,G.jsx)(de,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:b}),(0,G.jsx)(w,{isOpen:m,onClose:()=>h(!1),onConfirm:O,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{fe as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{i as n,n as r,t as i}from"./vendor-query-BMPnNmZi.js";import{r as a}from"./vendor-markdown-Dl_1qnne.js";import{i as o}from"./client-CylGrWpP.js";import{t as s}from"./activity-D2aBFbnN.js";import{t as c}from"./box-3f35ZKNV.js";import{t as l}from"./brain-DwFWAhZ9.js";import{t as u}from"./check-BhOeS9mA.js";import{t as d}from"./chevron-down-DOfOMDZp.js";import{n as f,t as p}from"./terminal-DXcWSHx9.js";import{n as m,r as h,t as g}from"./MarkdownField-DJ12Ejut.js";import{i as _,r as v,t as y}from"./providers-BLAJFnS4.js";import{t as b}from"./layers-CpiP5U5p.js";import{t as x}from"./loader-circle-DbVXtlbV.js";import{t as S}from"./send-Bwuzypop.js";import{t as C}from"./trash-2-BWnYC9Ad.js";import{t as w}from"./ConfirmDialog-BC4kXR-v.js";import{n as T,t as E}from"./vendor-motion-CPra8At-.js";import{C as D,S as O,_ as k,c as ee,h as te,l as A,u as j,y as M}from"./index-B-2XAA2C.js";import{c as N,l as P,o as F,r as ne,s as I,t as L}from"./taskFormSchemas-CgvN8KCz.js";import{a as re,c as R,o as z,s as B}from"./vendor-forms-BmyvqYDG.js";import"./tasks-CaT1ysud.js";var V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ie=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ae=o(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),W=e(t(),1),G=a(),K={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:m},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:f}},q=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:s,onProbe:c,onConfigure:u,onDelete:d,onActivate:f})=>{let[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return m&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${_.bg} ${_.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${_.dot} ${_.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${_.color}`,children:s})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:g,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),h(!m)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${m?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(v,{size:16,"aria-hidden":`true`})}),m&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),c?.(e),h(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(p,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(k,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),f?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),h(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(C,{size:14}),`Decommission`]})]})]})]})]})},oe=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(m,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(te,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:F.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),J=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],Y=1,X=5,Z=.01,Q=e=>(e??A.creativity).toFixed(2),se=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??A.creativity,i=e.strictness??A.strictness,a=n=>{t({...e,creativity:parseFloat(n.target.value)})},o=n=>{t({...e,strictness:parseFloat(n.target.value)})};return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Q(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:r,onChange:a,disabled:n,"aria-label":`Creativity`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Q(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:Y,max:X,step:Z,value:i,onChange:o,disabled:n,"aria-label":`Strictness`,"aria-valuemin":Y,"aria-valuemax":X,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},ce=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=ee(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[v,b]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),[E,D]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[M,F]=(0,W.useState)(``),[ne,I]=(0,W.useState)([]),[L,re]=(0,W.useState)(``),[R,z]=(0,W.useState)(`🧠`),[B,V]=(0,W.useState)(!1),[H,U]=(0,W.useState)({...A});(0,W.useEffect)(()=>{e&&r&&(b(r.name||``),C(r.role||``),T(r.description||``),D(r.systemInstructions||``),re(r.model?.id||``),z(P(r.emoji)),F(r.provider?.id??r.model?.provider?.id??``),U(r.attributes??{...A}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await y.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!M){I([]);return}(async()=>{try{l(!0);let{data:e}=await y.findModels(M);I(e),L&&!e.find(e=>e.id===L)&&re(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[M,L]);let ae=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},K=async()=>{if(r?.id)try{s(!0),await j.update(r.id,{name:v,emoji:R,role:S,description:w,systemInstructions:E,providerId:M||void 0,modelId:L||void 0,attributes:H}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!B&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[B,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(te,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>V(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:R}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(ie,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:N(R).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:N(R).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:v,onChange:e=>b(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:ae,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:m?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(_,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:S,onChange:e=>C(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:w,onChange:T,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:M,onChange:e=>F(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),O.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(x,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>re(e.target.value),disabled:c||ne.length===0,children:[ne.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),ne.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(se,{value:H,onChange:U}),(0,G.jsx)(g,{label:`System Instructions`,value:E,onChange:D,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{K()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(oe,{isOpen:B,selectedEmoji:R,currentEmoji:P(r?.emoji),isSaving:o,onSelect:z,onClose:()=>V(!1),onConfirm:()=>V(!1)})]}):null},le={name:``,role:``,description:``,emoji:I,providerId:``,modelId:``,instructions:L,attributes:{...A}},ue=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],$=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=ee(),[f,p]=(0,W.useState)(1),[_,v]=(0,W.useState)(!1),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),w=(0,W.useId)(),D=(0,W.useId)(),O=(0,W.useId)(),k=(0,W.useId)(),te=(0,W.useId)(),{control:M,formState:{errors:F},handleSubmit:L,register:V,reset:H,setValue:U}=B({resolver:re(ne),defaultValues:le,mode:`onBlur`}),K=R({control:M,name:`providerId`}),q=R({control:M,name:`modelId`}),J=R({control:M,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await y.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await y.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(le);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let ce=i({mutationFn:async e=>(await j.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,providerId:e.providerId,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(le),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=ce.isPending,de=Y.isPending||X.isPending,fe=L(async e=>{await ce.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),pe=()=>{$||(p(1),t())};return e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:pe,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(E.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":x,"aria-describedby":S,"aria-busy":$||de,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:x,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:S,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:pe,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:fe,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:ue.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(m,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>v(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:P(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:N(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:N(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(ie,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!F.name,"aria-describedby":F.name?C:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),F.name&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:F.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!F.role,"aria-describedby":F.role?w:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),F.role&&(0,G.jsx)(`p`,{id:w,className:`text-xs text-error font-semibold`,children:F.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:M,name:`description`,render:({field:e})=>(0,G.jsx)(g,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),F.description&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:F.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),de&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(b,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),F.providerId&&(0,G.jsx)(`p`,{id:O,className:`text-xs text-error font-semibold`,children:F.providerId.message})]}),(0,G.jsx)(T,{mode:`wait`,children:K&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!F.modelId,"aria-describedby":F.modelId?k:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),F.modelId&&(0,G.jsx)(`p`,{id:k,className:`text-xs text-error font-semibold`,children:F.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(z,{control:M,name:`attributes`,render:({field:e})=>(0,G.jsx)(se,{value:e.value??{...A},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(z,{control:M,name:`instructions`,render:({field:e})=>(0,G.jsx)(g,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),F.instructions&&(0,G.jsx)(`p`,{id:te,className:`text-xs text-error font-semibold`,children:F.instructions.message})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Knowledge Integration`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(h,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Connect Repo`})]}),(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(ae,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Access Policies`})]})]})]})]})]})]})]}),(0,G.jsx)(oe,{isOpen:_,selectedEmoji:P(J),currentEmoji:I,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>v(!1),onConfirm:()=>v(!1)})]})}):null},de=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[f,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),g(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(T,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(E.div,{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-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(te,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(p,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{m(!0),g(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await j.probe(n.id,i);c(e.content),d(e.image),g(`success`)}catch(e){console.error(`Probe failed:`,e);let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),g(`error`)}finally{m(!1)}},disabled:f||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:f?(0,G.jsx)(x,{size:18,className:`animate-spin`}):(0,G.jsx)(S,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:f?`animate-pulse`:``}),`Neural Response`]}),h===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(O,{size:10}),` Sync Complete`]}),h===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(D,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${h===`error`?`text-error/80 border-error/20`:h===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(T,{children:u&&(0,G.jsxs)(E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},fe=()=>{let{notifySuccess:e,notifyApiError:t}=ee(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await j.findAll();return e}}),b=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),S=i({mutationFn:e=>j.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),b()},onError:e=>t(e,`Operation Failed`)}),C=i({mutationFn:e=>j.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),b()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},E=e=>{s(e),p(!0)},D=e=>{s(e),h(!0)},O=()=>{o&&S.mutate(o.id)},k=e=>{C.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(x,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(q,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>E(e),onDelete:()=>D(e),onActivate:()=>k(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(M,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(ce,{isOpen:c,onClose:()=>l(!1),onUpdated:b,agent:o},o?.id||`none`),(0,G.jsx)(de,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:b}),(0,G.jsx)(w,{isOpen:m,onClose:()=>h(!1),onConfirm:O,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{fe as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{n as r,t as i}from"./vendor-motion-B6xhOm18.js";import{S as a,h as o,x as s}from"./index-wA5sKdfn.js";var c=n(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var l=t(),u=({isOpen:e,onClose:t,onConfirm:n,title:u,message:d,confirmText:f=`Confirm`,cancelText:p=`Cancel`,variant:m=`primary`,loading:h=!1,showCheckbox:g=!1,checkboxLabel:_=`Don't show this again`,onCheckboxChange:v})=>{let y={danger:{icon:c,iconBg:`bg-error/10`,iconColor:`text-error`,buttonBg:`bg-error hover:bg-error/90`,buttonText:`text-on-error`,ring:`ring-error/20`},primary:{icon:s,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:a,iconBg:`bg-secondary/10`,iconColor:`text-secondary`,buttonBg:`bg-secondary hover:bg-secondary/90`,buttonText:`text-surface`,ring:`ring-secondary/20`},warning:{icon:c,iconBg:`bg-tertiary/10`,iconColor:`text-tertiary`,buttonBg:`bg-tertiary hover:bg-tertiary/90`,buttonText:`text-surface`,ring:`ring-tertiary/20`}}[m],b=y.icon;return e?(0,l.jsx)(r,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(i.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`relative w-full max-w-md bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden ring-1 ring-outline-variant/10 p-6 flex flex-col gap-6`,children:[(0,l.jsxs)(`div`,{className:`flex gap-4`,children:[(0,l.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex-shrink-0 flex items-center justify-center ${y.iconBg} ${y.iconColor}`,children:(0,l.jsx)(b,{size:24})}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`h3`,{className:`text-xl font-black font-headline text-white tracking-tight mb-2`,children:u}),(0,l.jsx)(`p`,{className:`text-sm text-on-surface-variant leading-relaxed`,children:d})]}),(0,l.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors h-fit p-1`,children:(0,l.jsx)(o,{size:20})})]}),g&&(0,l.jsx)(`div`,{className:`flex items-center gap-3 px-1 mt-[-12px]`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer group`,children:[(0,l.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,l.jsx)(`input`,{type:`checkbox`,onChange:e=>v?.(e.target.checked),className:`peer appearance-none w-5 h-5 rounded border border-outline-variant/30 bg-surface-container-highest checked:bg-primary checked:border-primary transition-all cursor-pointer`}),(0,l.jsx)(a,{size:14,className:`absolute inset-0 m-auto text-on-primary opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none`})]}),(0,l.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant group-hover:text-white transition-colors uppercase tracking-wider`,children:_})]})}),(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-2`,children:[(0,l.jsx)(`button`,{onClick:t,disabled:h,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all disabled:opacity-50`,children:p}),(0,l.jsx)(`button`,{onClick:n,disabled:h,className:`px-6 py-2.5 rounded-lg text-sm font-bold shadow-lg transition-all ${y.buttonBg} ${y.buttonText} ${y.ring} hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed`,children:h?`Processing...`:f})]})]})]})}):null};export{u as t};
1
+ import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{n as r,t as i}from"./vendor-motion-CPra8At-.js";import{S as a,h as o,x as s}from"./index-B-2XAA2C.js";var c=n(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var l=t(),u=({isOpen:e,onClose:t,onConfirm:n,title:u,message:d,confirmText:f=`Confirm`,cancelText:p=`Cancel`,variant:m=`primary`,loading:h=!1,showCheckbox:g=!1,checkboxLabel:_=`Don't show this again`,onCheckboxChange:v})=>{let y={danger:{icon:c,iconBg:`bg-error/10`,iconColor:`text-error`,buttonBg:`bg-error hover:bg-error/90`,buttonText:`text-on-error`,ring:`ring-error/20`},primary:{icon:s,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:a,iconBg:`bg-secondary/10`,iconColor:`text-secondary`,buttonBg:`bg-secondary hover:bg-secondary/90`,buttonText:`text-surface`,ring:`ring-secondary/20`},warning:{icon:c,iconBg:`bg-tertiary/10`,iconColor:`text-tertiary`,buttonBg:`bg-tertiary hover:bg-tertiary/90`,buttonText:`text-surface`,ring:`ring-tertiary/20`}}[m],b=y.icon;return e?(0,l.jsx)(r,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(i.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`relative w-full max-w-md bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden ring-1 ring-outline-variant/10 p-6 flex flex-col gap-6`,children:[(0,l.jsxs)(`div`,{className:`flex gap-4`,children:[(0,l.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex-shrink-0 flex items-center justify-center ${y.iconBg} ${y.iconColor}`,children:(0,l.jsx)(b,{size:24})}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`h3`,{className:`text-xl font-black font-headline text-white tracking-tight mb-2`,children:u}),(0,l.jsx)(`p`,{className:`text-sm text-on-surface-variant leading-relaxed`,children:d})]}),(0,l.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors h-fit p-1`,children:(0,l.jsx)(o,{size:20})})]}),g&&(0,l.jsx)(`div`,{className:`flex items-center gap-3 px-1 mt-[-12px]`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer group`,children:[(0,l.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,l.jsx)(`input`,{type:`checkbox`,onChange:e=>v?.(e.target.checked),className:`peer appearance-none w-5 h-5 rounded border border-outline-variant/30 bg-surface-container-highest checked:bg-primary checked:border-primary transition-all cursor-pointer`}),(0,l.jsx)(a,{size:14,className:`absolute inset-0 m-auto text-on-primary opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none`})]}),(0,l.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant group-hover:text-white transition-colors uppercase tracking-wider`,children:_})]})}),(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-2`,children:[(0,l.jsx)(`button`,{onClick:t,disabled:h,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all disabled:opacity-50`,children:p}),(0,l.jsx)(`button`,{onClick:n,disabled:h,className:`px-6 py-2.5 rounded-lg text-sm font-bold shadow-lg transition-all ${y.buttonBg} ${y.buttonText} ${y.ring} hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed`,children:h?`Processing...`:f})]})]})]})}):null};export{u as t};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./rolldown-runtime-COnpUsM8.js";import{g as n}from"./vendor-dnd-CxfOy4-Z.js";import{r}from"./vendor-markdown-Dl_1qnne.js";import{i,t as a}from"./client-CylGrWpP.js";import{t as o}from"./brain-DwFWAhZ9.js";import{t as s}from"./chevron-down-DOfOMDZp.js";import{t as c}from"./clock-BTNXfvPT.js";import{n as l,r as u,t as d}from"./MarkdownField-DJ12Ejut.js";import{t as f}from"./cpu-C3sglvsN.js";import{t as p}from"./rocket-DzN1Mizs.js";import{n as m,t as h}from"./vendor-motion-CPra8At-.js";import{C as g,T as _,c as v,h as ee,u as y}from"./index-B-2XAA2C.js";import{t as b}from"./tasks-CaT1ysud.js";var x=i(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),S=i(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),C=i(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),w=i(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),T=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),E=i(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),D={ACTIVE:`active`,PAUSED:`paused`,ERROR:`error`},O={RUNNING:`running`,SUCCESS:`success`,FAILURE:`failure`,CANCELED:`canceled`},k={create:(e,t)=>a.post(`/projects/${e}/recurrent-tasks`,t),findAll:e=>a.get(`/projects/${e}/recurrent-tasks`),findOne:(e,t)=>a.get(`/projects/${e}/recurrent-tasks/${t}`),update:(e,t,n)=>a.patch(`/projects/${e}/recurrent-tasks/${t}`,n),delete:(e,t)=>a.delete(`/projects/${e}/recurrent-tasks/${t}`),findExecutions:(e,t,n=1,r=10)=>a.get(`/projects/${e}/recurrent-tasks/${t}/executions`,{params:{page:n,limit:r}})},A=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.trimHoursLeadingZero,m=p===void 0?!1:p,h=r.locale,g=h===void 0?null:h,_=r.logicalAndDayFields,v={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,trimHoursLeadingZero:m,locale:g,logicalAndDayFields:_===void 0?!1:_};return v.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,v).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;n&&(l=`:${(`00`+n).substring(n.length)}`);var u=a.toString(),d=(`00`+u).substring(u.length),f=o.toString(),p=(`00`+f).substring(f.length),m=this.options.trimHoursLeadingZero?u:d;return`${c?s:``}${m}:${p}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())})),j=e(n(),1),te=e(A(),1),M=r(),N=({projectId:e,isOpen:t,onClose:n,onSuccess:r,initialData:i})=>{let{notifyApiError:a,notifyError:C}=v(),[w,T]=(0,j.useState)(!1),[O,A]=(0,j.useState)([]),[N,P]=(0,j.useState)(!1),[F,I]=(0,j.useState)(!1),[L,R]=(0,j.useState)(``),[z,B]=(0,j.useState)(``),[V,H]=(0,j.useState)(``),[U,W]=(0,j.useState)(``),[G,K]=(0,j.useState)(b.MEDIUM),[q,J]=(0,j.useState)(null),[Y,X]=(0,j.useState)(!1),Z=(()=>{try{return te.default.toString(V)}catch{return null}})(),ne=[{label:`Every 10s`,value:`*/10 * * * * *`},{label:`Every 15m`,value:`*/15 * * * *`},{label:`Hourly`,value:`0 * * * *`},{label:`Daily (12AM)`,value:`0 0 * * *`},{label:`Weekly (Sun)`,value:`0 0 * * 0`},{label:`Monthly (1st)`,value:`0 0 1 * *`}];(0,j.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return t?(window.addEventListener(`keydown`,e),re(),i&&(R(i.title),B(i.description),H(i.cronExpression),W(i.assignee.id),K(Number(i.priority)))):(R(``),B(``),H(``),W(``),K(b.MEDIUM),J(null),X(!1)),()=>window.removeEventListener(`keydown`,e)},[t,i,n]);let re=async()=>{try{P(!0),A((await y.findAll()).data||[])}catch(e){console.error(`Failed to fetch agents:`,e)}finally{P(!1)}},Q=e=>{if(!e.trim())return J(`Cron expression is required`),!1;let t=e.trim().split(/\s+/);return t.length!==5&&t.length!==6?(J(`Invalid cron format (expected 5 or 6 fields)`),!1):(J(null),!0)},ie=async t=>{if(t.preventDefault(),!L||!z||!U||!V){let e=[];L||e.push(`title`),z||e.push(`description`),U||e.push(`assigneeId`),V||e.push(`cronExpression`),C(`Validation Error`,`Please fill in all required fields: ${e.join(`, `)}`);return}if(Q(V))try{T(!0),i?await k.update(e,i.id,{title:L,description:z,cronExpression:V,assigneeId:U,priority:G}):await k.create(e,{title:L,description:z,cronExpression:V,assigneeId:U,priority:G,status:D.ACTIVE}),r(),n()}catch(e){console.error(`Failed to save recurrent task:`,e),a(e,`Operation Failed`)}finally{T(!1)}},ae=e=>{switch(e){case b.CRITICAL:return`CRIT`;case b.HIGH:return`HIGH`;case b.MEDIUM:return`MED`;case b.LOW:return`LOW`;default:return`MED`}},$=O.find(e=>e.id===U);return t?(0,M.jsx)(m,{children:(0,M.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-background/60 backdrop-blur-md flex items-center justify-center p-4 overflow-y-auto`,children:(0,M.jsxs)(h.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`glass-panel w-full max-w-2xl rounded-xl overflow-hidden shadow-2xl glow-primary flex flex-col my-8`,"data-testid":`recurrent-task-modal`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`p-6 pb-0 flex justify-between items-start`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-2xl font-headline font-extrabold text-primary tracking-tight`,children:i?`Update Protocol`:`Deploy New Task`}),(0,M.jsx)(`p`,{className:`text-sm text-on-surface-variant mt-1`,children:i?`Modify the existing automated orchestration routine.`:`Configure an automated orchestration routine.`})]}),(0,M.jsx)(`button`,{onClick:n,className:`text-on-surface-variant hover:text-on-surface transition-colors p-1`,children:(0,M.jsx)(ee,{size:24})})]}),(0,M.jsxs)(`form`,{onSubmit:ie,className:`flex flex-col`,children:[(0,M.jsxs)(`div`,{className:`p-8 space-y-8 overflow-y-auto max-h-[70vh] custom-scrollbar`,children:[(0,M.jsxs)(`section`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-tertiary`,children:[(0,M.jsx)(x,{size:16}),(0,M.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Task Identity`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(`label`,{className:`text-xs font-medium text-on-surface-variant px-1`,children:`Task Name`}),(0,M.jsx)(`input`,{type:`text`,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 text-on-surface placeholder:text-outline-variant focus:ring-1 focus:ring-tertiary transition-all`,placeholder:`e.g., Daily Market Sweep`,value:L,onChange:e=>R(e.target.value)})]}),(0,M.jsx)(d,{label:`Description`,value:z,onChange:B,placeholder:`Briefly describe the objective of this task... You can use markdown for formatting.`,height:`h-32`,helperText:`Supports GitHub Flavored Markdown`})]})]}),(0,M.jsxs)(`section`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-primary`,children:[(0,M.jsx)(_,{size:16}),(0,M.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Agent Fleet`})]}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsxs)(`div`,{className:`flex items-center bg-surface-container-lowest rounded-lg p-3 cursor-pointer hover:bg-surface-container-high transition-colors ring-1 ring-outline-variant/10 focus-within:ring-primary/40`,onClick:()=>I(!F),role:`combobox`,"aria-expanded":F,"data-testid":`agent-select`,children:[(0,M.jsx)(`div`,{className:`w-8 h-8 rounded bg-primary/20 flex items-center justify-center mr-3`,children:(0,M.jsx)(o,{size:16,className:`text-primary`})}),(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-semibold text-on-surface`,children:$?$.name:`Select Intelligence Core`}),(0,M.jsx)(`div`,{className:`text-xs text-on-surface-variant`,children:$?$.role||`Active Agent`:`Choose an active agent for execution`})]}),(0,M.jsx)(s,{size:20,className:`text-outline transition-transform ${F?`rotate-180`:``}`})]}),(0,M.jsx)(m,{children:F&&(0,M.jsx)(h.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`absolute top-full left-0 w-full mt-2 bg-surface-container-highest rounded-lg shadow-xl p-2 z-50 border border-outline-variant/20 max-h-60 overflow-y-auto custom-scrollbar`,"data-testid":`agent-dropdown`,children:N?(0,M.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant animate-pulse`,children:`Scanning fleet...`}):O.length===0?(0,M.jsx)(`div`,{className:`p-4 text-center text-xs text-on-surface-variant`,children:`No active agents found.`}):O.map(e=>(0,M.jsxs)(`div`,{className:`p-3 hover:bg-surface-container-low rounded cursor-pointer flex items-center gap-3 transition-colors group`,onClick:()=>{W(e.id),I(!1)},"data-testid":`agent-option-${e.id}`,children:[(0,M.jsx)(`div`,{className:`w-8 h-8 rounded bg-surface-container-high flex items-center justify-center group-hover:bg-primary/20 transition-colors`,children:(0,M.jsx)(f,{size:14,className:`text-secondary group-hover:text-primary`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-bold text-on-surface group-hover:text-primary transition-colors`,children:e.name}),(0,M.jsxs)(`div`,{className:`text-[10px] text-secondary`,children:[e.status||`Active`,` • `,e.role||`Core`]})]})]},e.id))})}),(0,M.jsxs)(`select`,{className:`sr-only`,value:U,onChange:e=>W(e.target.value),children:[(0,M.jsx)(`option`,{value:``,children:`Select Agent`}),O.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8`,children:[(0,M.jsxs)(`section`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-secondary`,children:[(0,M.jsx)(c,{size:16}),(0,M.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Scheduling Protocol`})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`relative flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(`input`,{required:!0,className:`w-full bg-surface-container-lowest border-none rounded-lg p-3 font-mono text-sm text-secondary focus:ring-1 transition-all pr-10 ${q?`ring-1 ring-error`:`focus:ring-secondary`}`,type:`text`,value:V,onChange:e=>{H(e.target.value),q&&Q(e.target.value)},onBlur:e=>Q(e.target.value),placeholder:`e.g. 0 0 * * *`}),(0,M.jsx)(u,{size:16,className:`absolute right-3 top-3.5 text-outline-variant`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>X(!Y),className:`p-3 rounded-lg border transition-all ${Y?`bg-secondary/20 border-secondary text-secondary shadow-[0_0_10px_rgba(78,222,163,0.2)]`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:text-secondary hover:border-secondary/30`}`,title:`Open Cron Wizard`,children:(0,M.jsx)(E,{size:18})})]}),(0,M.jsx)(m,{children:Y&&(0,M.jsx)(h.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`overflow-hidden bg-surface-container-highest/30 rounded-xl border border-secondary/10`,children:(0,M.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-secondary/60`,children:[(0,M.jsx)(l,{size:12}),`Temporal Presets`]}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ne.map(e=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>{H(e.value),J(null)},className:`px-3 py-1.5 rounded-full text-[10px] font-bold border transition-all ${V===e.value?`bg-secondary text-on-secondary border-secondary shadow-lg shadow-secondary/20`:`bg-surface-container-lowest border-outline-variant/10 text-on-surface-variant hover:border-secondary/40 hover:text-secondary`}`,children:e.label},e.value))})]})})}),Z&&!q&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-secondary font-medium bg-secondary/5 px-3 py-2 rounded-lg border border-secondary/10 animate-in fade-in slide-in-from-left-2`,children:[(0,M.jsx)(S,{size:14,className:`shrink-0`}),(0,M.jsx)(`span`,{children:Z})]}),(0,M.jsx)(`div`,{className:`px-1 py-1`,children:(0,M.jsxs)(`p`,{className:`text-[9px] text-on-surface-variant/40 font-mono uppercase tracking-[0.1em] flex gap-2`,children:[(0,M.jsx)(`span`,{className:`text-secondary/60 opacity-60 font-black`,children:`[Sec]`}),(0,M.jsx)(`span`,{children:`Min`}),(0,M.jsx)(`span`,{children:`Hour`}),(0,M.jsx)(`span`,{children:`Dom`}),(0,M.jsx)(`span`,{children:`Mon`}),(0,M.jsx)(`span`,{children:`Dow`})]})}),q&&(0,M.jsxs)(`p`,{className:`text-[10px] text-error px-1 flex items-center gap-1.5 font-medium`,children:[(0,M.jsx)(g,{size:12}),q]})]})]}),(0,M.jsxs)(`section`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-error`,children:[(0,M.jsx)(g,{size:16}),(0,M.jsx)(`h3`,{className:`text-xs font-bold uppercase tracking-widest font-headline`,children:`Execution Priority`})]}),(0,M.jsx)(`div`,{className:`flex bg-surface-container-lowest p-1 rounded-lg`,children:[b.LOW,b.MEDIUM,b.HIGH,b.CRITICAL].map(e=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`flex-1 py-2 text-[10px] font-bold rounded transition-all ${Number(G)===Number(e)?e===b.CRITICAL?`bg-error/20 text-error`:`bg-surface-container-high text-primary`:`text-on-surface-variant hover:text-on-surface`}`,children:ae(e)},e))})]})]}),(0,M.jsxs)(`section`,{className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between items-center mb-4`,children:[(0,M.jsx)(`h4`,{className:`text-xs font-bold font-headline text-on-surface-variant tracking-wide`,children:`Deployment Preview`}),(0,M.jsx)(`span`,{className:`text-[10px] bg-secondary-container/30 text-secondary px-2 py-0.5 rounded-full font-bold uppercase`,children:`System Cluster 0-A`})]}),(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 bg-surface-container-high/50 rounded-lg`,children:[(0,M.jsx)(`span`,{className:`text-on-surface font-medium italic`,children:`Logic integrity check passed`}),(0,M.jsx)(`span`,{className:`text-secondary font-bold`,children:`READY`})]}),(0,M.jsxs)(`div`,{className:`text-[10px] text-on-surface-variant leading-relaxed`,children:[`This task will be registered in the Alpha-Centauri cluster and executed by `,(0,M.jsx)(`span`,{className:`text-primary`,children:$?.name||`an assigned agent`}),` according to the provided temporal sequence.`]})]})]})]}),(0,M.jsxs)(`div`,{className:`p-6 bg-surface-container-low/50 flex justify-end items-center gap-4 sticky bottom-0 border-t border-outline-variant/10`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,className:`px-6 py-2.5 text-sm font-bold text-on-surface-variant hover:text-on-surface transition-all active:scale-95`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`submit`,disabled:w,className:`px-8 py-2.5 text-sm font-bold bg-primary text-on-primary rounded-lg shadow-lg hover:shadow-primary/20 transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:[w?(0,M.jsx)(`div`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,M.jsx)(p,{size:16,className:`group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform`}),i?`Update Task`:`Create Task`]})]})]})]})})}):null};export{T as a,k as i,O as n,w as o,D as r,C as s,N as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{n}from"./vendor-react-CiDbU5Ns.js";import{r}from"./vendor-markdown-Dl_1qnne.js";import{i}from"./client-CylGrWpP.js";import{t as a}from"./box-3f35ZKNV.js";import{t as o}from"./check-BhOeS9mA.js";import{t as s}from"./chevron-down-DOfOMDZp.js";import{n as c,t as l}from"./user-plus-CiJgTJ8j.js";import{t as u}from"./eye-CSLoB6-a.js";import{n as d,t as ee}from"./users-BVNMRlU5.js";import{t as te}from"./rocket-DzN1Mizs.js";import{t as ne}from"./save-zLR2Bpx5.js";import{t as re}from"./shield-check-5104WjFF.js";import{t as ie}from"./user-CCOu6zJa.js";import"./vendor-motion-B6xhOm18.js";import{S as ae,a as oe,d as se,f as ce,h as f,i as p,m as le,n as m,o as ue,p as de,r as fe,s as pe}from"./index-wA5sKdfn.js";var h=i(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),me=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),g=e(t(),1),_=r(),he=({isOpen:e,selectedAvatar:t,currentAvatar:n,isSaving:r,onSelect:i,onClose:a,onConfirm:s})=>((0,g.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,_.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8 backdrop-blur-sm`,children:[(0,_.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,_.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-picker-title`,className:`relative w-full max-w-2xl rounded-3xl border border-outline-variant/20 bg-surface p-6 shadow-[0_28px_80px_rgba(0,0,0,0.45)]`,children:[(0,_.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`mb-2 text-[11px] font-bold uppercase tracking-[0.3em] text-primary/80`,children:`Avatar presets`}),(0,_.jsx)(`h2`,{id:`avatar-picker-title`,className:`font-headline text-2xl font-bold text-on-surface`,children:`Choose your avatar`}),(0,_.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Pick one of the built-in presets. Your choice updates everywhere your profile picture is shown.`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close avatar picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,_.jsx)(f,{size:18})})]}),(0,_.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:p.map(e=>{let r=e.key===t,a=e.key===n;return(0,_.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`group relative rounded-2xl border p-3 text-left transition-all ${r?`border-primary bg-primary/10 shadow-[0_0_0_1px_rgba(173,198,255,0.25)]`:`border-outline-variant/20 bg-surface-container-low hover:border-primary/40 hover:bg-surface-container-high`}`,children:[(0,_.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-container-high`,children:(0,_.jsx)(`img`,{src:e.src,alt:e.label,className:`aspect-square w-full object-cover`})}),(0,_.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-sm font-semibold text-on-surface`,children:e.label}),r?(0,_.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,_.jsx)(o,{size:14})}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:a?`Current avatar`:`Available preset`})]},e.key)})}),(0,_.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,_.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save avatar`]})]})]})]}):null);function ge({enabled:e,onToggle:t,id:n}){return(0,_.jsx)(`button`,{id:n,type:`button`,role:`switch`,"aria-checked":e,onClick:t,className:`relative inline-flex flex-shrink-0 w-10 h-5 rounded-full transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-primary/40 ${e?`bg-secondary`:`bg-surface-container-highest`}`,children:(0,_.jsx)(`span`,{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow-md transition-all duration-300 ${e?`left-5`:`left-0.5`}`})})}function v({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,suffix:c,autoComplete:l,error:u}){return(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,_.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(`input`,{id:t,type:n,value:r,autoComplete:l,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${u?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,_.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),u&&(0,_.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:u})]})}function _e({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,g.useState)(!1);return(0,_.jsx)(v,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,_.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,_.jsx)(c,{size:16}):(0,_.jsx)(u,{size:16})})})}function ve({projectId:e,title:t,description:r,status:i,icon:a,iconColor:o}){return(0,_.jsxs)(n,{to:`/projects/${e}`,className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10 hover:bg-surface-container-high transition-colors cursor-pointer ${i===`archived`?`opacity-70`:``}`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg ${o}`,children:a}),(0,_.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded uppercase font-bold tracking-tight ${i===`active`?`bg-secondary/10 text-secondary border border-secondary/20`:`bg-surface-container-highest text-on-surface-variant`}`,children:i.replace(`_`,` `)})]}),(0,_.jsx)(`h3`,{className:`font-headline font-bold text-on-surface text-sm`,children:t}),(0,_.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-1 leading-relaxed`,children:r})]})}var y=()=>{let{user:e,refreshUser:t}=de(),{projects:n,refreshProjects:r}=le(),i=e?.role===`admin`,o=n.some(e=>e.status===se.ACTIVE),c=i&&!o,u=i?`Only one active project is allowed at a time. Move the active project out of active status before creating a new one.`:`Only admins can create projects.`,[p,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(`user`),[E,D]=(0,g.useState)(``),[O,k]=(0,g.useState)(``),[ye,be]=(0,g.useState)(!1),[xe,Se]=(0,g.useState)(!1),[A,j]=(0,g.useState)({}),[M,N]=(0,g.useState)({}),[P,F]=(0,g.useState)(!1),[I,L]=(0,g.useState)(!1),[Ce,R]=(0,g.useState)(!1),[z,B]=(0,g.useState)(``),[we,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(``),[Te,Ee]=(0,g.useState)(!1),[De,W]=(0,g.useState)(!1),[Oe,G]=(0,g.useState)(!1),[ke,K]=(0,g.useState)(!1),[q,J]=(0,g.useState)(``),[Ae,je]=(0,g.useState)(!1),[Y,X]=(0,g.useState)(oe),Me=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ne=()=>{let e={};return p.trim()?p.length>100&&(e.name=`Maximum 100 characters.`):e.name=`First name is required.`,b.trim()?b.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,S.trim()?Me.test(S)?S.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email address.`:e.email=`Email is required.`,e},Pe=()=>{let e={};return E?E.length<8?e.newPwd=`Minimum 8 characters.`:E.length>72&&(e.newPwd=`Maximum 72 characters.`):e.newPwd=`New password is required.`,O?E!==O&&(e.confirmPwd=`Passwords do not match.`):e.confirmPwd=`Please confirm the new password.`,e},Z=e=>ue(e)?e:oe;(0,g.useEffect)(()=>{e&&(y(e.name??``),x(e.last_name??``),C(e.email??``),T(e.role??`user`),X(Z(e.avatar)))},[e]);let Fe=async()=>{let n=Ne();if(Object.keys(n).length>0){j(n);return}j({}),F(!0),B(``),R(!1);try{let n={};p!==(e?.name??``)&&(n.name=p),b!==(e?.last_name??``)&&(n.last_name=b),S!==(e?.email??``)&&(n.email=S);let r=[];Object.keys(n).length>0&&r.push(m.updateProfile(n)),i&&e?.id&&w!==e?.role&&r.push(ee.updateRole(e.id,w)),r.length>0&&(await Promise.all(r),await t()),R(!0),setTimeout(()=>R(!1),3e3)}catch(e){B(e instanceof Error?e.message:`Failed to save changes`)}finally{F(!1)}},Ie=async()=>{let e=Pe();if(Object.keys(e).length>0){N(e);return}N({}),U(``),V(!1),L(!0);try{await m.updateProfile({newPassword:E}),D(``),k(``),V(!0),setTimeout(()=>V(!1),4e3)}catch(e){U(e instanceof Error?e.message:`Failed to update password`)}finally{L(!1)}},Le=async()=>{if(!(!q||!e?.id)){je(!0);try{await ce.addMember(q,e.id),await r(),G(!1),J(``)}catch(e){console.error(`Failed to assign project:`,e)}finally{je(!1)}}},Re=async()=>{B(``),R(!1),Ee(!0);try{await m.updateProfile({avatar:Y}),await t(),K(!1),R(!0),setTimeout(()=>R(!1),3e3)}catch(e){B(e instanceof Error?e.message:`Failed to update avatar`)}finally{Ee(!1)}},Q=e?`${e.name??``} ${e.last_name??``}`.trim():`Agent`,$=e?.role??`user`,ze=$.charAt(0).toUpperCase()+$.slice(1);return(0,_.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,_.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,_.jsxs)(`div`,{className:`relative group flex-shrink-0`,children:[(0,_.jsx)(`div`,{className:`absolute -inset-1 bg-gradient-to-tr from-primary to-tertiary rounded-full blur opacity-20 group-hover:opacity-40 transition duration-700`}),(0,_.jsx)(fe,{name:Q,avatar:e?.avatar,avatarUrl:e?.avatarUrl,alt:Q,className:`relative h-28 w-28 overflow-hidden rounded-full ring-4 ring-surface sm:h-32 sm:w-32`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{X(Z(e?.avatar)),K(!0)},title:`Change avatar`,className:`absolute bottom-1 right-1 bg-primary text-on-primary p-1.5 rounded-full shadow-lg hover:scale-110 active:scale-95 transition-transform`,children:(0,_.jsx)(me,{size:14})})]}),(0,_.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,_.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Q}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,_.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest shadow-[0_0_12px_rgba(78,222,163,0.1)]`,children:ze}),(0,_.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:e?.email})]})]}),(0,_.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,_.jsx)(`button`,{id:`profile-cancel-btn`,onClick:()=>{y(e?.name??``),x(e?.last_name??``),C(e?.email??``),T(e?.role??`user`),B(``),j({})},className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm`,children:(0,_.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,_.jsx)(f,{size:15}),` Cancel`]})}),(0,_.jsxs)(`button`,{id:`profile-save-btn`,onClick:Fe,disabled:P,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.15)] text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[P?(0,_.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,_.jsx)(ne,{size:15}),`Save Changes`]})]})]}),Ce&&(0,_.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,_.jsx)(ae,{size:16}),` Profile updated successfully.`]}),z&&(0,_.jsx)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium`,children:z}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,_.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,_.jsx)(ie,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Personal Information`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5`,children:[(0,_.jsx)(v,{label:`First Name`,id:`profile-first-name`,value:p,onChange:y,placeholder:`Your first name`,error:A.name}),(0,_.jsx)(v,{label:`Last Name`,id:`profile-last-name`,value:b,onChange:x,placeholder:`Your last name`,error:A.lastName}),(0,_.jsx)(v,{label:`Email Address`,id:`profile-email`,type:`email`,value:S,onChange:C,placeholder:`your@email.com`,className:`sm:col-span-2`,error:A.email})]})]}),(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,_.jsx)(re,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Role & Clearance`})]}),(0,_.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 flex-1`,children:[(0,_.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-widest shadow-[0_0_15px_rgba(78,222,163,0.1)] flex-shrink-0`,children:ze}),(0,_.jsx)(`p`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:$===`admin`?`Full orchestration privileges across all projects.`:`Standard access for task execution and project participation.`})]}),i&&(0,_.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:w-48 flex-shrink-0`,children:[(0,_.jsx)(`label`,{htmlFor:`profile-role-select`,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Update Role`}),(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsxs)(`select`,{id:`profile-role-select`,value:w,onChange:e=>T(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all appearance-none cursor-pointer`,children:[(0,_.jsx)(`option`,{value:`admin`,children:`Admin`}),(0,_.jsx)(`option`,{value:`user`,children:`Member`})]}),(0,_.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]})]})]})]}),(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-center mb-7`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,_.jsx)(d,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Project Assignments`})]}),i&&(0,_.jsxs)(`button`,{onClick:()=>c&&W(!0),disabled:!c,title:c?void 0:u,className:`text-xs font-bold text-primary flex items-center gap-1 hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:[(0,_.jsx)(h,{size:14}),` Create Project`]})]}),i&&o&&(0,_.jsx)(`p`,{className:`mb-5 text-xs text-on-surface-variant`,children:u}),i&&n.length>0&&(0,_.jsx)(`div`,{className:`mb-5`,children:Oe?(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsxs)(`div`,{className:`relative flex-1`,children:[(0,_.jsxs)(`select`,{id:`profile-assign-project-select`,value:q,onChange:e=>J(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 appearance-none`,children:[(0,_.jsx)(`option`,{value:``,children:`Select a project…`}),n.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,_.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}),(0,_.jsx)(`button`,{onClick:Le,disabled:!q||Ae,className:`px-4 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary disabled:opacity-50 hover:brightness-110 transition-all`,children:Ae?`…`:`Assign`}),(0,_.jsx)(`button`,{onClick:()=>{G(!1),J(``)},className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:(0,_.jsx)(f,{size:14})})]}):(0,_.jsxs)(`button`,{onClick:()=>G(!0),className:`text-xs font-bold text-on-surface-variant flex items-center gap-1.5 hover:text-primary transition-colors`,children:[(0,_.jsx)(l,{size:14}),` Assign to Project`]})}),n&&n.length>0?(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[n.slice(0,4).map((e,t)=>(0,_.jsx)(ve,{projectId:e.id,title:e.title,description:e.description??`No description provided.`,status:e.status,icon:t===0?(0,_.jsx)(te,{size:18}):t===1?(0,_.jsx)(d,{size:18}):(0,_.jsx)(a,{size:18}),iconColor:t===0?`bg-primary/10 text-primary`:t===1?`bg-tertiary/10 text-tertiary`:`bg-on-surface-variant/10 text-on-surface-variant`},e.id)),i&&c&&(0,_.jsxs)(`div`,{onClick:()=>W(!0),role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&W(!0),className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all cursor-pointer min-h-[140px]`,children:[(0,_.jsx)(h,{size:24,className:`text-primary/40`}),(0,_.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:`New Project`})]})]}):(0,_.jsxs)(`div`,{onClick:c?()=>W(!0):void 0,role:c?`button`:void 0,tabIndex:c?0:void 0,onKeyDown:c?e=>e.key===`Enter`&&W(!0):void 0,className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all min-h-[140px] ${c?`cursor-pointer`:`cursor-default opacity-60`}`,children:[(0,_.jsx)(h,{size:24,className:`text-primary/40`}),(0,_.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:c?`Create First Project`:i?`Active Project Exists`:`No Projects Assigned`})]})]})]}),(0,_.jsx)(`div`,{className:`lg:col-span-4 flex flex-col gap-6`,children:(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,_.jsx)(re,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Security`})]}),we&&(0,_.jsxs)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-xs font-medium flex items-center gap-2`,children:[(0,_.jsx)(ae,{size:14}),` Password updated successfully.`]}),H&&(0,_.jsx)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-error/10 border border-error/30 text-error text-xs`,children:H}),(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsx)(_e,{label:`New Password`,id:`profile-new-pwd`,value:E,onChange:D,placeholder:`Min. 8 characters`,error:M.newPwd}),(0,_.jsx)(_e,{label:`Confirm New Password`,id:`profile-confirm-pwd`,value:O,onChange:k,placeholder:`Repeat new password`,error:M.confirmPwd}),(0,_.jsxs)(`button`,{id:`profile-update-creds-btn`,onClick:Ie,disabled:I,className:`w-full py-2.5 rounded-lg text-sm font-bold bg-tertiary/10 text-tertiary border border-tertiary/20 hover:bg-tertiary hover:text-on-tertiary transition-all disabled:opacity-60 flex items-center justify-center gap-2`,children:[I?(0,_.jsx)(`span`,{className:`w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin`}):null,`Update Credentials`]})]}),(0,_.jsxs)(`div`,{className:`mt-7 pt-6 border-t border-outline-variant/20 space-y-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-sm font-medium text-on-surface`,children:`Two-Factor Auth`}),(0,_.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`TOTP-based second factor`})]}),(0,_.jsx)(ge,{id:`profile-2fa-toggle`,enabled:ye,onToggle:()=>be(e=>!e)})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-sm font-medium text-on-surface`,children:`Biometric Access`}),(0,_.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`WebAuthn / passkey`})]}),(0,_.jsx)(ge,{id:`profile-biometric-toggle`,enabled:xe,onToggle:()=>Se(e=>!e)})]})]})]})})]}),(0,_.jsx)(pe,{isOpen:De,onClose:()=>W(!1),onCreated:async()=>{await r(),W(!1)},canCreate:c,blockedReason:u}),(0,_.jsx)(he,{isOpen:ke,selectedAvatar:Y,currentAvatar:Z(e?.avatar),isSaving:Te,onSelect:X,onClose:()=>{Te||(K(!1),X(Z(e?.avatar)))},onConfirm:Re})]})};export{y as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{n}from"./vendor-react-CiDbU5Ns.js";import{r}from"./vendor-markdown-Dl_1qnne.js";import{i}from"./client-CylGrWpP.js";import{t as a}from"./box-3f35ZKNV.js";import{t as o}from"./check-BhOeS9mA.js";import{t as s}from"./chevron-down-DOfOMDZp.js";import{n as c,t as l}from"./user-plus-CiJgTJ8j.js";import{t as u}from"./eye-CSLoB6-a.js";import{n as d,t as ee}from"./users-BVNMRlU5.js";import{t as te}from"./rocket-DzN1Mizs.js";import{t as ne}from"./save-zLR2Bpx5.js";import{t as re}from"./shield-check-CdGbbgI2.js";import{t as ie}from"./user-DpMk7aqI.js";import"./vendor-motion-CPra8At-.js";import{S as ae,a as oe,d as se,f as ce,h as f,i as p,m as le,n as m,o as ue,p as de,r as fe,s as pe}from"./index-B-2XAA2C.js";var h=i(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),me=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),g=e(t(),1),_=r(),he=({isOpen:e,selectedAvatar:t,currentAvatar:n,isSaving:r,onSelect:i,onClose:a,onConfirm:s})=>((0,g.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,_.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-4 py-8 backdrop-blur-sm`,children:[(0,_.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,_.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-picker-title`,className:`relative w-full max-w-2xl rounded-3xl border border-outline-variant/20 bg-surface p-6 shadow-[0_28px_80px_rgba(0,0,0,0.45)]`,children:[(0,_.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`mb-2 text-[11px] font-bold uppercase tracking-[0.3em] text-primary/80`,children:`Avatar presets`}),(0,_.jsx)(`h2`,{id:`avatar-picker-title`,className:`font-headline text-2xl font-bold text-on-surface`,children:`Choose your avatar`}),(0,_.jsx)(`p`,{className:`mt-2 text-sm text-on-surface-variant`,children:`Pick one of the built-in presets. Your choice updates everywhere your profile picture is shown.`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close avatar picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,_.jsx)(f,{size:18})})]}),(0,_.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:p.map(e=>{let r=e.key===t,a=e.key===n;return(0,_.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`group relative rounded-2xl border p-3 text-left transition-all ${r?`border-primary bg-primary/10 shadow-[0_0_0_1px_rgba(173,198,255,0.25)]`:`border-outline-variant/20 bg-surface-container-low hover:border-primary/40 hover:bg-surface-container-high`}`,children:[(0,_.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-container-high`,children:(0,_.jsx)(`img`,{src:e.src,alt:e.label,className:`aspect-square w-full object-cover`})}),(0,_.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-sm font-semibold text-on-surface`,children:e.label}),r?(0,_.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,_.jsx)(o,{size:14})}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:a?`Current avatar`:`Available preset`})]},e.key)})}),(0,_.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>void s(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,_.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save avatar`]})]})]})]}):null);function ge({enabled:e,onToggle:t,id:n}){return(0,_.jsx)(`button`,{id:n,type:`button`,role:`switch`,"aria-checked":e,onClick:t,className:`relative inline-flex flex-shrink-0 w-10 h-5 rounded-full transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-primary/40 ${e?`bg-secondary`:`bg-surface-container-highest`}`,children:(0,_.jsx)(`span`,{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow-md transition-all duration-300 ${e?`left-5`:`left-0.5`}`})})}function v({label:e,id:t,type:n=`text`,value:r,onChange:i,placeholder:a,disabled:o=!1,className:s=``,suffix:c,autoComplete:l,error:u}){return(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 ${s}`,children:[(0,_.jsx)(`label`,{htmlFor:t,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:e}),(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(`input`,{id:t,type:n,value:r,autoComplete:l,onChange:e=>i(e.target.value),placeholder:a,disabled:o,className:`w-full bg-surface-container-lowest rounded-lg px-4 py-3 text-sm text-on-surface border focus:outline-none focus:ring-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-on-surface-variant/40 ${u?`border-error/60 focus:ring-error/40`:`border-outline-variant/20 focus:ring-primary/40`}`}),c&&(0,_.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2`,children:c})]}),u&&(0,_.jsx)(`p`,{className:`text-[11px] text-error mt-0.5`,children:u})]})}function _e({label:e,id:t,value:n,onChange:r,placeholder:i,error:a}){let[o,s]=(0,g.useState)(!1);return(0,_.jsx)(v,{label:e,id:t,type:o?`text`:`password`,value:n,onChange:r,autoComplete:`new-password`,placeholder:i??`••••••••`,error:a,suffix:(0,_.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-on-surface-variant hover:text-primary transition-colors`,"aria-label":o?`Hide password`:`Show password`,children:o?(0,_.jsx)(c,{size:16}):(0,_.jsx)(u,{size:16})})})}function ve({projectId:e,title:t,description:r,status:i,icon:a,iconColor:o}){return(0,_.jsxs)(n,{to:`/projects/${e}`,className:`bg-surface-container-low p-5 rounded-xl border border-outline-variant/10 hover:bg-surface-container-high transition-colors cursor-pointer ${i===`archived`?`opacity-70`:``}`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-start mb-4`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg ${o}`,children:a}),(0,_.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded uppercase font-bold tracking-tight ${i===`active`?`bg-secondary/10 text-secondary border border-secondary/20`:`bg-surface-container-highest text-on-surface-variant`}`,children:i.replace(`_`,` `)})]}),(0,_.jsx)(`h3`,{className:`font-headline font-bold text-on-surface text-sm`,children:t}),(0,_.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-1 leading-relaxed`,children:r})]})}var y=()=>{let{user:e,refreshUser:t}=de(),{projects:n,refreshProjects:r}=le(),i=e?.role===`admin`,o=n.some(e=>e.status===se.ACTIVE),c=i&&!o,u=i?`Only one active project is allowed at a time. Move the active project out of active status before creating a new one.`:`Only admins can create projects.`,[p,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(`user`),[E,D]=(0,g.useState)(``),[O,k]=(0,g.useState)(``),[ye,be]=(0,g.useState)(!1),[xe,Se]=(0,g.useState)(!1),[A,j]=(0,g.useState)({}),[M,N]=(0,g.useState)({}),[P,F]=(0,g.useState)(!1),[I,L]=(0,g.useState)(!1),[Ce,R]=(0,g.useState)(!1),[z,B]=(0,g.useState)(``),[we,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(``),[Te,Ee]=(0,g.useState)(!1),[De,W]=(0,g.useState)(!1),[Oe,G]=(0,g.useState)(!1),[ke,K]=(0,g.useState)(!1),[q,J]=(0,g.useState)(``),[Ae,je]=(0,g.useState)(!1),[Y,X]=(0,g.useState)(oe),Me=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ne=()=>{let e={};return p.trim()?p.length>100&&(e.name=`Maximum 100 characters.`):e.name=`First name is required.`,b.trim()?b.length>100&&(e.lastName=`Maximum 100 characters.`):e.lastName=`Last name is required.`,S.trim()?Me.test(S)?S.length>255&&(e.email=`Maximum 255 characters.`):e.email=`Must be a valid email address.`:e.email=`Email is required.`,e},Pe=()=>{let e={};return E?E.length<8?e.newPwd=`Minimum 8 characters.`:E.length>72&&(e.newPwd=`Maximum 72 characters.`):e.newPwd=`New password is required.`,O?E!==O&&(e.confirmPwd=`Passwords do not match.`):e.confirmPwd=`Please confirm the new password.`,e},Z=e=>ue(e)?e:oe;(0,g.useEffect)(()=>{e&&(y(e.name??``),x(e.last_name??``),C(e.email??``),T(e.role??`user`),X(Z(e.avatar)))},[e]);let Fe=async()=>{let n=Ne();if(Object.keys(n).length>0){j(n);return}j({}),F(!0),B(``),R(!1);try{let n={};p!==(e?.name??``)&&(n.name=p),b!==(e?.last_name??``)&&(n.last_name=b),S!==(e?.email??``)&&(n.email=S);let r=[];Object.keys(n).length>0&&r.push(m.updateProfile(n)),i&&e?.id&&w!==e?.role&&r.push(ee.updateRole(e.id,w)),r.length>0&&(await Promise.all(r),await t()),R(!0),setTimeout(()=>R(!1),3e3)}catch(e){B(e instanceof Error?e.message:`Failed to save changes`)}finally{F(!1)}},Ie=async()=>{let e=Pe();if(Object.keys(e).length>0){N(e);return}N({}),U(``),V(!1),L(!0);try{await m.updateProfile({newPassword:E}),D(``),k(``),V(!0),setTimeout(()=>V(!1),4e3)}catch(e){U(e instanceof Error?e.message:`Failed to update password`)}finally{L(!1)}},Le=async()=>{if(!(!q||!e?.id)){je(!0);try{await ce.addMember(q,e.id),await r(),G(!1),J(``)}catch(e){console.error(`Failed to assign project:`,e)}finally{je(!1)}}},Re=async()=>{B(``),R(!1),Ee(!0);try{await m.updateProfile({avatar:Y}),await t(),K(!1),R(!0),setTimeout(()=>R(!1),3e3)}catch(e){B(e instanceof Error?e.message:`Failed to update avatar`)}finally{Ee(!1)}},Q=e?`${e.name??``} ${e.last_name??``}`.trim():`Agent`,$=e?.role??`user`,ze=$.charAt(0).toUpperCase()+$.slice(1);return(0,_.jsxs)(`div`,{className:`min-h-full pb-16`,children:[(0,_.jsxs)(`header`,{className:`mb-10 flex flex-col sm:flex-row items-center sm:items-end gap-6`,children:[(0,_.jsxs)(`div`,{className:`relative group flex-shrink-0`,children:[(0,_.jsx)(`div`,{className:`absolute -inset-1 bg-gradient-to-tr from-primary to-tertiary rounded-full blur opacity-20 group-hover:opacity-40 transition duration-700`}),(0,_.jsx)(fe,{name:Q,avatar:e?.avatar,avatarUrl:e?.avatarUrl,alt:Q,className:`relative h-28 w-28 overflow-hidden rounded-full ring-4 ring-surface sm:h-32 sm:w-32`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{X(Z(e?.avatar)),K(!0)},title:`Change avatar`,className:`absolute bottom-1 right-1 bg-primary text-on-primary p-1.5 rounded-full shadow-lg hover:scale-110 active:scale-95 transition-transform`,children:(0,_.jsx)(me,{size:14})})]}),(0,_.jsxs)(`div`,{className:`text-center sm:text-left flex-1`,children:[(0,_.jsx)(`h1`,{className:`font-headline text-3xl sm:text-4xl font-extrabold text-on-surface tracking-tight`,children:Q}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mt-1 justify-center sm:justify-start`,children:[(0,_.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-3 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-widest shadow-[0_0_12px_rgba(78,222,163,0.1)]`,children:ze}),(0,_.jsx)(`span`,{className:`text-on-surface-variant text-sm font-body`,children:e?.email})]})]}),(0,_.jsxs)(`div`,{className:`flex gap-3 sm:ml-auto flex-shrink-0`,children:[(0,_.jsx)(`button`,{id:`profile-cancel-btn`,onClick:()=>{y(e?.name??``),x(e?.last_name??``),C(e?.email??``),T(e?.role??`user`),B(``),j({})},className:`px-5 py-2 rounded-lg font-bold text-on-surface-variant hover:bg-surface-container-high border border-outline-variant/20 transition-colors text-sm`,children:(0,_.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,_.jsx)(f,{size:15}),` Cancel`]})}),(0,_.jsxs)(`button`,{id:`profile-save-btn`,onClick:Fe,disabled:P,className:`px-6 py-2 rounded-lg font-bold bg-primary text-on-primary hover:brightness-110 active:scale-95 transition-all shadow-[0_8px_24px_rgba(173,198,255,0.15)] text-sm disabled:opacity-60 flex items-center gap-1.5`,children:[P?(0,_.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,_.jsx)(ne,{size:15}),`Save Changes`]})]})]}),Ce&&(0,_.jsxs)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-sm font-medium flex items-center gap-2`,children:[(0,_.jsx)(ae,{size:16}),` Profile updated successfully.`]}),z&&(0,_.jsx)(`div`,{className:`mb-6 px-4 py-3 rounded-lg bg-error/10 border border-error/30 text-error text-sm font-medium`,children:z}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6`,children:[(0,_.jsxs)(`div`,{className:`lg:col-span-8 flex flex-col gap-6`,children:[(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,_.jsx)(ie,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Personal Information`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5`,children:[(0,_.jsx)(v,{label:`First Name`,id:`profile-first-name`,value:p,onChange:y,placeholder:`Your first name`,error:A.name}),(0,_.jsx)(v,{label:`Last Name`,id:`profile-last-name`,value:b,onChange:x,placeholder:`Your last name`,error:A.lastName}),(0,_.jsx)(v,{label:`Email Address`,id:`profile-email`,type:`email`,value:S,onChange:C,placeholder:`your@email.com`,className:`sm:col-span-2`,error:A.email})]})]}),(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-secondary/10 text-secondary`,children:(0,_.jsx)(re,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Role & Clearance`})]}),(0,_.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 flex-1`,children:[(0,_.jsx)(`span`,{className:`bg-secondary/10 text-secondary border border-secondary/20 px-4 py-1.5 rounded-full text-xs font-bold uppercase tracking-widest shadow-[0_0_15px_rgba(78,222,163,0.1)] flex-shrink-0`,children:ze}),(0,_.jsx)(`p`,{className:`text-xs text-on-surface-variant leading-relaxed`,children:$===`admin`?`Full orchestration privileges across all projects.`:`Standard access for task execution and project participation.`})]}),i&&(0,_.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:w-48 flex-shrink-0`,children:[(0,_.jsx)(`label`,{htmlFor:`profile-role-select`,className:`text-[10px] font-bold text-on-surface-variant uppercase tracking-[0.15em]`,children:`Update Role`}),(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsxs)(`select`,{id:`profile-role-select`,value:w,onChange:e=>T(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all appearance-none cursor-pointer`,children:[(0,_.jsx)(`option`,{value:`admin`,children:`Admin`}),(0,_.jsx)(`option`,{value:`user`,children:`Member`})]}),(0,_.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]})]})]})]}),(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-center mb-7`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,_.jsx)(d,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Project Assignments`})]}),i&&(0,_.jsxs)(`button`,{onClick:()=>c&&W(!0),disabled:!c,title:c?void 0:u,className:`text-xs font-bold text-primary flex items-center gap-1 hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:[(0,_.jsx)(h,{size:14}),` Create Project`]})]}),i&&o&&(0,_.jsx)(`p`,{className:`mb-5 text-xs text-on-surface-variant`,children:u}),i&&n.length>0&&(0,_.jsx)(`div`,{className:`mb-5`,children:Oe?(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsxs)(`div`,{className:`relative flex-1`,children:[(0,_.jsxs)(`select`,{id:`profile-assign-project-select`,value:q,onChange:e=>J(e.target.value),className:`w-full bg-surface-container-lowest rounded-lg px-4 py-2.5 text-sm text-on-surface border border-outline-variant/20 focus:outline-none focus:ring-2 focus:ring-primary/40 appearance-none`,children:[(0,_.jsx)(`option`,{value:``,children:`Select a project…`}),n.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,_.jsx)(s,{size:14,className:`absolute right-3 top-1/2 -translate-y-1/2 text-on-surface-variant pointer-events-none`})]}),(0,_.jsx)(`button`,{onClick:Le,disabled:!q||Ae,className:`px-4 py-2.5 rounded-lg text-sm font-bold bg-primary text-on-primary disabled:opacity-50 hover:brightness-110 transition-all`,children:Ae?`…`:`Assign`}),(0,_.jsx)(`button`,{onClick:()=>{G(!1),J(``)},className:`p-2.5 rounded-lg text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:(0,_.jsx)(f,{size:14})})]}):(0,_.jsxs)(`button`,{onClick:()=>G(!0),className:`text-xs font-bold text-on-surface-variant flex items-center gap-1.5 hover:text-primary transition-colors`,children:[(0,_.jsx)(l,{size:14}),` Assign to Project`]})}),n&&n.length>0?(0,_.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[n.slice(0,4).map((e,t)=>(0,_.jsx)(ve,{projectId:e.id,title:e.title,description:e.description??`No description provided.`,status:e.status,icon:t===0?(0,_.jsx)(te,{size:18}):t===1?(0,_.jsx)(d,{size:18}):(0,_.jsx)(a,{size:18}),iconColor:t===0?`bg-primary/10 text-primary`:t===1?`bg-tertiary/10 text-tertiary`:`bg-on-surface-variant/10 text-on-surface-variant`},e.id)),i&&c&&(0,_.jsxs)(`div`,{onClick:()=>W(!0),role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&W(!0),className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all cursor-pointer min-h-[140px]`,children:[(0,_.jsx)(h,{size:24,className:`text-primary/40`}),(0,_.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:`New Project`})]})]}):(0,_.jsxs)(`div`,{onClick:c?()=>W(!0):void 0,role:c?`button`:void 0,tabIndex:c?0:void 0,onKeyDown:c?e=>e.key===`Enter`&&W(!0):void 0,className:`bg-surface-container-low p-5 rounded-xl border-2 border-dashed border-outline-variant/20 flex flex-col items-center justify-center gap-2 hover:border-primary/40 transition-all min-h-[140px] ${c?`cursor-pointer`:`cursor-default opacity-60`}`,children:[(0,_.jsx)(h,{size:24,className:`text-primary/40`}),(0,_.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant uppercase tracking-wide`,children:c?`Create First Project`:i?`Active Project Exists`:`No Projects Assigned`})]})]})]}),(0,_.jsx)(`div`,{className:`lg:col-span-4 flex flex-col gap-6`,children:(0,_.jsxs)(`section`,{className:`glass-panel ghost-border p-7 rounded-2xl shadow-[0_24px_48px_rgba(173,198,255,0.05)]`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-7`,children:[(0,_.jsx)(`div`,{className:`p-2 rounded-lg bg-tertiary/10 text-tertiary`,children:(0,_.jsx)(re,{size:18})}),(0,_.jsx)(`h2`,{className:`font-headline text-base font-bold text-on-surface`,children:`Security`})]}),we&&(0,_.jsxs)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-secondary/10 border border-secondary/30 text-secondary text-xs font-medium flex items-center gap-2`,children:[(0,_.jsx)(ae,{size:14}),` Password updated successfully.`]}),H&&(0,_.jsx)(`div`,{className:`mb-5 px-3 py-2.5 rounded-lg bg-error/10 border border-error/30 text-error text-xs`,children:H}),(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsx)(_e,{label:`New Password`,id:`profile-new-pwd`,value:E,onChange:D,placeholder:`Min. 8 characters`,error:M.newPwd}),(0,_.jsx)(_e,{label:`Confirm New Password`,id:`profile-confirm-pwd`,value:O,onChange:k,placeholder:`Repeat new password`,error:M.confirmPwd}),(0,_.jsxs)(`button`,{id:`profile-update-creds-btn`,onClick:Ie,disabled:I,className:`w-full py-2.5 rounded-lg text-sm font-bold bg-tertiary/10 text-tertiary border border-tertiary/20 hover:bg-tertiary hover:text-on-tertiary transition-all disabled:opacity-60 flex items-center justify-center gap-2`,children:[I?(0,_.jsx)(`span`,{className:`w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin`}):null,`Update Credentials`]})]}),(0,_.jsxs)(`div`,{className:`mt-7 pt-6 border-t border-outline-variant/20 space-y-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-sm font-medium text-on-surface`,children:`Two-Factor Auth`}),(0,_.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`TOTP-based second factor`})]}),(0,_.jsx)(ge,{id:`profile-2fa-toggle`,enabled:ye,onToggle:()=>be(e=>!e)})]}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`text-sm font-medium text-on-surface`,children:`Biometric Access`}),(0,_.jsx)(`p`,{className:`text-[10px] text-on-surface-variant`,children:`WebAuthn / passkey`})]}),(0,_.jsx)(ge,{id:`profile-biometric-toggle`,enabled:xe,onToggle:()=>Se(e=>!e)})]})]})]})})]}),(0,_.jsx)(pe,{isOpen:De,onClose:()=>W(!1),onCreated:async()=>{await r(),W(!1)},canCreate:c,blockedReason:u}),(0,_.jsx)(he,{isOpen:ke,selectedAvatar:Y,currentAvatar:Z(e?.avatar),isSaving:Te,onSelect:X,onClose:()=>{Te||(K(!1),X(Z(e?.avatar)))},onConfirm:Re})]})};export{y as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{c as n,s as r}from"./vendor-react-CiDbU5Ns.js";import{r as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./chevron-down-DOfOMDZp.js";import{n as s,t as c}from"./MarkdownField-DJ12Ejut.js";import{t as l}from"./layers-CpiP5U5p.js";import{t as u}from"./save-zLR2Bpx5.js";import{t as d}from"./shield-check-5104WjFF.js";import{t as f}from"./trash-2-BlARVDmE.js";import{t as p}from"./user-CCOu6zJa.js";import{c as m,d as h,f as g,m as _,u as v,w as y}from"./index-wA5sKdfn.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=m(),{projects:C,refreshProjects:w}=_(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===h.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(h.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([g.findOne(e),v.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||h.PLANNING),V(r.ownerAgent?.id||``)}catch(e){console.error(`Failed to load project details:`,e),a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(y,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(f,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await g.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){console.error(`Failed to update project:`,e),a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(h).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===h.ACTIVE&&N&&R!==h.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==h.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(p,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(o,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(s,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{c as n,s as r}from"./vendor-react-CiDbU5Ns.js";import{r as i}from"./vendor-markdown-Dl_1qnne.js";import{i as a}from"./client-CylGrWpP.js";import{t as o}from"./chevron-down-DOfOMDZp.js";import{n as s,t as c}from"./MarkdownField-DJ12Ejut.js";import{t as l}from"./layers-CpiP5U5p.js";import{t as u}from"./save-zLR2Bpx5.js";import{t as d}from"./shield-check-CdGbbgI2.js";import{t as f}from"./trash-2-BWnYC9Ad.js";import{t as p}from"./user-DpMk7aqI.js";import{c as m,d as h,f as g,m as _,u as v,w as y}from"./index-B-2XAA2C.js";var b=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),x=e(t(),1),S=i(),C=()=>{let{projectId:e}=n(),t=r(),{notifySuccess:i,notifyApiError:a}=m(),{projects:C,refreshProjects:w}=_(),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)([]),[k,A]=(0,x.useState)(!0),[j,M]=(0,x.useState)(!1),N=C.some(t=>t.status===h.ACTIVE&&t.id!==e),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[R,z]=(0,x.useState)(h.PLANNING),[B,V]=(0,x.useState)(``),H=(0,x.useCallback)(async()=>{try{A(!0);let[t,n]=await Promise.all([g.findOne(e),v.findAll()]),r=t.data;E(r),O(n.data),F(r.title),L(r.description||``),z(r.status||h.PLANNING),V(r.ownerAgent?.id||``)}catch(e){console.error(`Failed to load project details:`,e),a(e,`Fetch Error`)}finally{A(!1)}},[e,a]);return(0,x.useEffect)(()=>{e&&H()},[e,H]),k?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[50vh]`,children:(0,S.jsx)(`div`,{className:`w-8 h-8 rounded-full border-4 border border-outline-variant/30 border-t-primary animate-spin`})}):T?(0,S.jsxs)(`div`,{className:`space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col md:flex-row justify-between items-start md:items-center gap-6`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`w-12 h-12 rounded-2xl bg-surface-container-high border border-outline-variant/10 flex items-center justify-center text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all group`,children:(0,S.jsx)(b,{size:20,className:`group-hover:-translate-x-1 transition-transform`})}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,S.jsx)(`div`,{className:`w-6 h-6 rounded-lg bg-secondary/20 flex items-center justify-center text-secondary`,children:(0,S.jsx)(y,{size:12})}),(0,S.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-[0.3em] text-on-surface-variant`,children:`Project Console`})]}),(0,S.jsx)(`h1`,{className:`text-3xl font-black font-headline text-white tracking-tight -mt-1`,children:T.title})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 w-full md:w-auto`,children:[(0,S.jsxs)(`button`,{className:`flex-1 md:flex-initial px-6 py-3 rounded-2xl bg-surface-container-high text-on-article-variant font-bold text-sm flex items-center justify-center gap-2 hover:bg-error/10 hover:text-error transition-all ring-1 ring-outline-variant/10 border-none`,children:[(0,S.jsx)(f,{size:18}),`Delete Project`]}),(0,S.jsxs)(`button`,{onClick:async()=>{if(e)try{M(!0),await g.update(e,{title:P,description:I||void 0,status:R,ownerAgentId:B||null}),await w(),i(`Project Updated`,`Project settings have been updated`)}catch(e){console.error(`Failed to update project:`,e),a(e,`Sync Error`)}finally{M(!1)}},disabled:j,className:`flex-1 md:flex-initial px-8 py-3 rounded-2xl bg-primary text-surface font-black text-sm flex items-center justify-center gap-2 hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-primary/20 disabled:grayscale disabled:opacity-50`,children:[j?(0,S.jsx)(`div`,{className:`w-5 h-5 border-2 border-surface/30 border-t-surface rounded-full animate-spin`}):(0,S.jsx)(u,{size:18}),`Synchronize Parameters`]})]})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-8`,children:[(0,S.jsx)(`div`,{className:`lg:col-span-2 space-y-8`,children:(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 overflow-hidden shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/5 flex items-center gap-3`,children:[(0,S.jsx)(l,{size:18,className:`text-primary`}),(0,S.jsx)(`h3`,{className:`text-sm font-black uppercase tracking-widest text-on-surface`,children:`Project Settings`})]}),(0,S.jsxs)(`div`,{className:`p-8 space-y-8`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 ml-1 italic`,children:`Identification Tag`}),(0,S.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 focus-within:bg-surface-container-highest/50 transition-all`,children:(0,S.jsx)(`input`,{type:`text`,value:P,onChange:e=>F(e.target.value),className:`w-full bg-transparent border-none text-base text-on-surface h-14 px-5 focus:outline-none font-bold`})})]}),(0,S.jsx)(`div`,{className:`space-y-2`,children:(0,S.jsx)(c,{label:`Operational Directives`,value:I,onChange:L,height:`h-64`,maxLength:5e3,placeholder:`Enter strategic goals, scope, and specific node instructions...`})})]})]})}),(0,S.jsxs)(`div`,{className:`space-y-8`,children:[(0,S.jsxs)(`section`,{className:`bg-surface-container-low rounded-3xl border border-outline-variant/10 p-8 space-y-6 shadow-2xl`,children:[(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(d,{size:14,className:`text-secondary`}),`Operational Protocol`]}),(0,S.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:Object.values(h).map(e=>(0,S.jsx)(`button`,{onClick:()=>z(e),disabled:e===h.ACTIVE&&N&&R!==h.ACTIVE,className:`px-4 py-3 rounded-xl border text-[11px] font-black uppercase tracking-widest transition-all text-left ${R===e?`bg-secondary/10 border-secondary text-secondary shadow-lg shadow-secondary/5`:`bg-surface-container-high/30 border-outline-variant/5 text-on-surface-variant/60 hover:bg-surface-container-high/60 disabled:opacity-50 disabled:cursor-not-allowed`}`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.replace(`_`,` `),R===e&&(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-secondary animate-pulse`})]})},e))}),N&&R!==h.ACTIVE&&(0,S.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:`Another project is already active. Move it out of active status before activating this one.`})]}),(0,S.jsxs)(`div`,{className:`pt-6 border-t border-outline-variant/5 space-y-4`,children:[(0,S.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,S.jsx)(p,{size:14,className:`text-primary`}),`Designated Project Lead`]}),(0,S.jsxs)(`div`,{className:`bg-surface-container-high/30 rounded-2xl p-0.5 ring-1 ring-outline-variant/10 transition-all relative`,children:[(0,S.jsxs)(`select`,{value:B,onChange:e=>V(e.target.value),className:`w-full bg-transparent border-none text-[11px] font-bold text-on-surface h-12 px-5 focus:outline-none appearance-none cursor-pointer`,children:[(0,S.jsx)(`option`,{value:``,className:`bg-surface-container-low text-on-surface uppercase`,children:`Unassigned Protocol Lead`}),D.map(e=>(0,S.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface font-bold uppercase tracking-tight`,children:e.name},e.id))]}),(0,S.jsx)(`div`,{className:`absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,S.jsx)(o,{size:14})})]}),(0,S.jsx)(`p`,{className:`px-1 text-[11px] text-on-surface-variant/70 italic leading-relaxed`,children:`*The Project Lead will oversee autonomous reasoning and token allocation for this project.`})]})]}),(0,S.jsxs)(`div`,{className:`px-8 py-10 rounded-3xl bg-surface-container-low/30 border border-dashed border-outline-variant/10 flex flex-col items-center justify-center text-center`,children:[(0,S.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant/20 mb-4 animate-pulse`,children:(0,S.jsx)(s,{size:24})}),(0,S.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 max-w-[180px]`,children:`Statistical insight logs will be synchronized here`})]})]})]})]}):(0,S.jsxs)(`div`,{className:`p-8 text-center bg-surface-container-low rounded-3xl border border-outline-variant/10 max-w-lg mx-auto mt-20`,children:[(0,S.jsx)(`h2`,{className:`text-xl font-black text-white mb-4`,children:`Project Not Found`}),(0,S.jsx)(`button`,{onClick:()=>t(`/`),className:`bg-primary text-surface px-6 py-2 rounded-lg font-bold hover:scale-105 transition-all`,children:`Return to Hub`})]})};export{C as default};