@bpinhosilva/agent-orchestrator 1.1.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +8 -1
- package/dist/cli/commands/backup.command.js +143 -0
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/run.command.js +20 -1
- package/dist/cli/commands/setup.command.js +13 -0
- package/dist/cli/constants.js +2 -1
- package/dist/cli/env.js +2 -0
- package/dist/cli/preload.js +12 -0
- package/dist/cli/process-manager.js +33 -29
- package/dist/cli/setup/index.js +24 -0
- package/dist/cli/setup/validators.js +14 -0
- package/dist/config/env.validation.js +6 -0
- package/dist/config/runtime-logger.js +214 -0
- package/dist/main.js +8 -0
- package/dist/ui/assets/{AgentFleet-BarfEwcK.js → AgentFleet-B8p5vbKK.js} +1 -1
- package/dist/ui/assets/{AttachmentItem-Cerhbyya.js → AttachmentItem-C_uUACPz.js} +1 -1
- package/dist/ui/assets/{ConfirmDialog-y3vTcqFR.js → ConfirmDialog-BltdtevE.js} +1 -1
- package/dist/ui/assets/{CreateRecurrentTaskModal-BgfnJ1n8.js → CreateRecurrentTaskModal-CGSdgNAf.js} +1 -1
- package/dist/ui/assets/{CreateTaskModal-BH9lOLYT.js → CreateTaskModal-XNvIWKz3.js} +1 -1
- package/dist/ui/assets/{ExecLogModal-ShacCOOV.js → ExecLogModal-BYTGF04P.js} +1 -1
- package/dist/ui/assets/{MarkdownField--1gpyapw.js → MarkdownField-DR6tHsei.js} +1 -1
- package/dist/ui/assets/{Profile-qnuRN5Qv.js → Profile-ByioVLM8.js} +1 -1
- package/dist/ui/assets/{ProjectDetail-ZYQG9yn2.js → ProjectDetail-dwZDzb0m.js} +1 -1
- package/dist/ui/assets/{Providers-DR7srJHq.js → Providers-JAClEFt0.js} +1 -1
- package/dist/ui/assets/{Scheduler-Bs3DC0re.js → Scheduler-C1HQNxQ6.js} +2 -2
- package/dist/ui/assets/{Settings-C3ad44vP.js → Settings-Cjn2xdo1.js} +1 -1
- package/dist/ui/assets/{TaskDetail-D-f_Ao2a.js → TaskDetail-Blphf9tw.js} +1 -1
- package/dist/ui/assets/{TaskExecutions-BeodRIz1.js → TaskExecutions-ydR4KPCY.js} +3 -3
- package/dist/ui/assets/{TaskManager-BA2Y31ut.js → TaskManager-DrFbuAwN.js} +3 -3
- package/dist/ui/assets/{UserDetail-BvWm-U4y.js → UserDetail-mWjJPTzO.js} +1 -1
- package/dist/ui/assets/{Users-CQNcXLyV.js → Users-FaX0thJx.js} +1 -1
- package/dist/ui/assets/{activity-CmAajKmR.js → activity-B_2QSywM.js} +1 -1
- package/dist/ui/assets/{agents-b8btewki.js → agents-YQJ7JNfI.js} +1 -1
- package/dist/ui/assets/{auth-dROenHXk.js → auth-Lh2N3iYN.js} +1 -1
- package/dist/ui/assets/{bot-QVmnxPf4.js → bot-DadO9w3D.js} +1 -1
- package/dist/ui/assets/{box-Bw_pyYzU.js → box-CFDcDxHv.js} +1 -1
- package/dist/ui/assets/{brain-C6vlLcg3.js → brain-DWTpby6b.js} +1 -1
- package/dist/ui/assets/{briefcase-DtHlat45.js → briefcase-mFWNV6w9.js} +1 -1
- package/dist/ui/assets/check-BiORptL3.js +1 -0
- package/dist/ui/assets/chevron-down-BUOg3vvd.js +1 -0
- package/dist/ui/assets/chevron-left-B0NmQyxK.js +1 -0
- package/dist/ui/assets/chevron-right-Bm_d1KKk.js +1 -0
- package/dist/ui/assets/{circle-alert-pUx6yhcF.js → circle-alert-sCcf7ANF.js} +1 -1
- package/dist/ui/assets/circle-check-Jz8IOE4h.js +1 -0
- package/dist/ui/assets/client-B553SX3l.js +9 -0
- package/dist/ui/assets/clock-CSNFJjo4.js +1 -0
- package/dist/ui/assets/{cpu-8Sbc9Dk0.js → cpu-C2_GFeSH.js} +1 -1
- package/dist/ui/assets/{database-D6O4hvbm.js → database-zXW48-_N.js} +1 -1
- package/dist/ui/assets/{download-DHcd5oLD.js → download-DZdOdijy.js} +1 -1
- package/dist/ui/assets/{eye-Cc-vy4Zu.js → eye-CjrFwZG_.js} +1 -1
- package/dist/ui/assets/{file-text-DWBSXx5l.js → file-text-CX_Yqfjf.js} +1 -1
- package/dist/ui/assets/{index-BvUv9Lzq.js → index-IcLlFUZs.js} +3 -3
- package/dist/ui/assets/{info-1jA6X-_e.js → info-DGHChFI6.js} +1 -1
- package/dist/ui/assets/{layers-BcHXXg-4.js → layers-CVf8_Byb.js} +1 -1
- package/dist/ui/assets/loader-circle-CB6PQwdc.js +1 -0
- package/dist/ui/assets/{panels-top-left-Vk8FzAxf.js → panels-top-left-Cp169WzB.js} +1 -1
- package/dist/ui/assets/{paperclip-DWJjaP8B.js → paperclip-5Y367YTj.js} +1 -1
- package/dist/ui/assets/plus-CkteVqhM.js +1 -0
- package/dist/ui/assets/{projects-CUOthD8N.js → projects-DoalTI7c.js} +1 -1
- package/dist/ui/assets/{providers-CNrSTcdc.js → providers-AawjMy3x.js} +1 -1
- package/dist/ui/assets/{recurrent-tasks-CKT47N2l.js → recurrent-tasks-7thk45mk.js} +1 -1
- package/dist/ui/assets/{refresh-cw-DQW6jR7M.js → refresh-cw-BgDsJOC_.js} +1 -1
- package/dist/ui/assets/{rocket-CMSwBl_C.js → rocket-B9Iexkcw.js} +1 -1
- package/dist/ui/assets/{save-DycJmlX0.js → save-Cmqi1IkN.js} +1 -1
- package/dist/ui/assets/{send-BZjwSrJW.js → send-iK1X7WSe.js} +1 -1
- package/dist/ui/assets/{server-CJE2K1Vt.js → server-BBmM-vrg.js} +1 -1
- package/dist/ui/assets/{settings-at7JqFrc.js → settings-BpKLGxm8.js} +1 -1
- package/dist/ui/assets/{shield-alert-CP5GVXxa.js → shield-alert-Do_Sg9SX.js} +1 -1
- package/dist/ui/assets/{shield-check-Cr4SHjdR.js → shield-check-YKs9kUNq.js} +1 -1
- package/dist/ui/assets/{sparkles-v57Nc-z-.js → sparkles-krUpxie4.js} +1 -1
- package/dist/ui/assets/{taskFormSchemas-dl1t1OyX.js → taskFormSchemas-B6YlRxrx.js} +1 -1
- package/dist/ui/assets/{tasks-DEUQCNoH.js → tasks-DHsBE-ea.js} +1 -1
- package/dist/ui/assets/{terminal-a6AV2mPO.js → terminal-B6iyNuAm.js} +1 -1
- package/dist/ui/assets/{trash-2-DJpTXgEP.js → trash-2-CphQfk35.js} +1 -1
- package/dist/ui/assets/{trending-up-DlrXEXE6.js → trending-up-ClGbkbN9.js} +1 -1
- package/dist/ui/assets/user-Brcjlps5.js +1 -0
- package/dist/ui/assets/{user-plus-nDkwsBT1.js → user-plus-0Y0M1GKi.js} +1 -1
- package/dist/ui/assets/{users-C6WiDiuN.js → users-BcnlUG5N.js} +1 -1
- package/dist/ui/assets/{users-Ef6Sh2iR.js → users-tdyaGZbx.js} +1 -1
- package/dist/ui/assets/x-CCZGYGDC.js +1 -0
- package/dist/ui/assets/{zap-BmhZqgvm.js → zap-BDAytXMX.js} +1 -1
- package/dist/ui/index.html +17 -17
- package/package.json +2 -2
- package/dist/ui/assets/check-DTei8Qlg.js +0 -1
- package/dist/ui/assets/chevron-down-LTeQHW9O.js +0 -1
- package/dist/ui/assets/chevron-left-CJc_eQid.js +0 -1
- package/dist/ui/assets/chevron-right-G5-HRo_C.js +0 -1
- package/dist/ui/assets/circle-check-B9kyRki5.js +0 -1
- package/dist/ui/assets/client-BGOBXkO8.js +0 -9
- package/dist/ui/assets/clock-BY4rrypg.js +0 -1
- package/dist/ui/assets/loader-circle-Cl6yIkPK.js +0 -1
- package/dist/ui/assets/plus-Dx6G8SOZ.js +0 -1
- package/dist/ui/assets/user--KOoEB9m.js +0 -1
- package/dist/ui/assets/x-wDy15QMx.js +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RotatingFileLogger = exports.DEFAULT_MAX_FILES = exports.DEFAULT_MAX_SIZE_MB = exports.LOG_FILENAME = void 0;
|
|
37
|
+
exports.shouldEnableFileLogging = shouldEnableFileLogging;
|
|
38
|
+
exports.getLogRotationOptions = getLogRotationOptions;
|
|
39
|
+
exports.persistRuntimeLoggerInitFailure = persistRuntimeLoggerInitFailure;
|
|
40
|
+
exports.initRuntimeLogger = initRuntimeLogger;
|
|
41
|
+
exports.teardownRuntimeLogger = teardownRuntimeLogger;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const os = __importStar(require("os"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
exports.LOG_FILENAME = 'server.log';
|
|
46
|
+
exports.DEFAULT_MAX_SIZE_MB = 10;
|
|
47
|
+
exports.DEFAULT_MAX_FILES = 4;
|
|
48
|
+
const ARCHIVE_PREFIX = 'server-';
|
|
49
|
+
function parseStrictPositiveInt(value, envName) {
|
|
50
|
+
if (!/^[1-9]\d*$/.test(value)) {
|
|
51
|
+
throw new Error(`Invalid ${envName}: "${value}". Must be a plain positive integer (e.g. 10).`);
|
|
52
|
+
}
|
|
53
|
+
const n = Number(value);
|
|
54
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
55
|
+
throw new Error(`Invalid ${envName}: "${value}". Must be a positive integer >= 1.`);
|
|
56
|
+
}
|
|
57
|
+
return n;
|
|
58
|
+
}
|
|
59
|
+
function shouldEnableFileLogging() {
|
|
60
|
+
if (process.env.AGENT_ORCHESTRATOR_HOME)
|
|
61
|
+
return true;
|
|
62
|
+
if (process.env.LOG_ROTATION_MAX_SIZE_MB !== undefined ||
|
|
63
|
+
process.env.LOG_ROTATION_MAX_FILES !== undefined)
|
|
64
|
+
return true;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function getLogRotationOptions() {
|
|
68
|
+
if (!shouldEnableFileLogging())
|
|
69
|
+
return null;
|
|
70
|
+
const logDir = process.env.AGENT_ORCHESTRATOR_HOME || os.tmpdir();
|
|
71
|
+
const maxSizeMb = process.env.LOG_ROTATION_MAX_SIZE_MB !== undefined
|
|
72
|
+
? parseStrictPositiveInt(process.env.LOG_ROTATION_MAX_SIZE_MB, 'LOG_ROTATION_MAX_SIZE_MB')
|
|
73
|
+
: exports.DEFAULT_MAX_SIZE_MB;
|
|
74
|
+
const maxFiles = process.env.LOG_ROTATION_MAX_FILES !== undefined
|
|
75
|
+
? parseStrictPositiveInt(process.env.LOG_ROTATION_MAX_FILES, 'LOG_ROTATION_MAX_FILES')
|
|
76
|
+
: exports.DEFAULT_MAX_FILES;
|
|
77
|
+
return { logDir, maxSizeMb, maxFiles };
|
|
78
|
+
}
|
|
79
|
+
function persistRuntimeLoggerInitFailure(message, fsDep = fs) {
|
|
80
|
+
if (!shouldEnableFileLogging()) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const logDir = process.env.AGENT_ORCHESTRATOR_HOME || os.tmpdir();
|
|
84
|
+
fsDep.mkdirSync(logDir, { recursive: true, mode: 0o700 });
|
|
85
|
+
const logFilePath = path.join(logDir, exports.LOG_FILENAME);
|
|
86
|
+
fsDep.appendFileSync(logFilePath, `[preload] Runtime logger initialization failed: ${message}\n`);
|
|
87
|
+
return logFilePath;
|
|
88
|
+
}
|
|
89
|
+
class RotatingFileLogger {
|
|
90
|
+
logFile;
|
|
91
|
+
maxSizeBytes;
|
|
92
|
+
maxFiles;
|
|
93
|
+
fsDep;
|
|
94
|
+
getNow;
|
|
95
|
+
originalStdoutWrite = null;
|
|
96
|
+
originalStderrWrite = null;
|
|
97
|
+
active = false;
|
|
98
|
+
constructor(options) {
|
|
99
|
+
this.logFile = path.join(options.logDir, exports.LOG_FILENAME);
|
|
100
|
+
this.maxSizeBytes = options.maxSizeMb * 1024 * 1024;
|
|
101
|
+
this.maxFiles = options.maxFiles;
|
|
102
|
+
this.fsDep = options.fsDep ?? fs;
|
|
103
|
+
this.getNow = options.getNow ?? (() => new Date());
|
|
104
|
+
}
|
|
105
|
+
get logFilePath() {
|
|
106
|
+
return this.logFile;
|
|
107
|
+
}
|
|
108
|
+
init() {
|
|
109
|
+
if (this.active)
|
|
110
|
+
return;
|
|
111
|
+
const dir = path.dirname(this.logFile);
|
|
112
|
+
if (!this.fsDep.existsSync(dir)) {
|
|
113
|
+
this.fsDep.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
114
|
+
}
|
|
115
|
+
this.originalStdoutWrite = process.stdout.write;
|
|
116
|
+
this.originalStderrWrite = process.stderr.write;
|
|
117
|
+
process.stdout.write = makeTeePatch(this.originalStdoutWrite, (chunk) => this.writeToFile(chunk));
|
|
118
|
+
process.stderr.write = makeTeePatch(this.originalStderrWrite, (chunk) => this.writeToFile(chunk));
|
|
119
|
+
this.active = true;
|
|
120
|
+
}
|
|
121
|
+
writeToFile(chunk) {
|
|
122
|
+
try {
|
|
123
|
+
const incomingBytes = typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.byteLength;
|
|
124
|
+
this.rotateIfNeeded(incomingBytes);
|
|
125
|
+
this.fsDep.appendFileSync(this.logFile, chunk);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
rotateIfNeeded(incomingBytes = 0) {
|
|
131
|
+
try {
|
|
132
|
+
if (!this.fsDep.existsSync(this.logFile))
|
|
133
|
+
return;
|
|
134
|
+
const stat = this.fsDep.statSync(this.logFile);
|
|
135
|
+
if (stat.size + incomingBytes < this.maxSizeBytes)
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const ts = this.getNow().toISOString().replace(/[:.]/g, '-');
|
|
142
|
+
const dir = path.dirname(this.logFile);
|
|
143
|
+
const rotated = path.join(dir, `${ARCHIVE_PREFIX}${ts}.log`);
|
|
144
|
+
try {
|
|
145
|
+
this.fsDep.renameSync(this.logFile, rotated);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.pruneOldArchives();
|
|
151
|
+
}
|
|
152
|
+
pruneOldArchives() {
|
|
153
|
+
const dir = path.dirname(this.logFile);
|
|
154
|
+
let archives;
|
|
155
|
+
try {
|
|
156
|
+
archives = this.fsDep
|
|
157
|
+
.readdirSync(dir)
|
|
158
|
+
.filter((f) => f.startsWith(ARCHIVE_PREFIX) &&
|
|
159
|
+
f.endsWith('.log') &&
|
|
160
|
+
f !== exports.LOG_FILENAME)
|
|
161
|
+
.sort();
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
while (archives.length > this.maxFiles) {
|
|
167
|
+
const oldest = archives.shift();
|
|
168
|
+
try {
|
|
169
|
+
this.fsDep.unlinkSync(path.join(dir, oldest));
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
teardown() {
|
|
176
|
+
if (!this.active)
|
|
177
|
+
return;
|
|
178
|
+
if (this.originalStdoutWrite) {
|
|
179
|
+
process.stdout.write = this.originalStdoutWrite;
|
|
180
|
+
}
|
|
181
|
+
if (this.originalStderrWrite) {
|
|
182
|
+
process.stderr.write = this.originalStderrWrite;
|
|
183
|
+
}
|
|
184
|
+
this.active = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.RotatingFileLogger = RotatingFileLogger;
|
|
188
|
+
function makeTeePatch(original, writeToFile) {
|
|
189
|
+
const orig = original;
|
|
190
|
+
return function (chunk, encodingOrCb, cb) {
|
|
191
|
+
writeToFile(chunk);
|
|
192
|
+
if (typeof encodingOrCb === 'function') {
|
|
193
|
+
return orig.call(this, chunk, encodingOrCb);
|
|
194
|
+
}
|
|
195
|
+
return orig.call(this, chunk, encodingOrCb, cb);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
let activeLogger = null;
|
|
199
|
+
function initRuntimeLogger() {
|
|
200
|
+
if (activeLogger)
|
|
201
|
+
return activeLogger;
|
|
202
|
+
const opts = getLogRotationOptions();
|
|
203
|
+
if (!opts)
|
|
204
|
+
return null;
|
|
205
|
+
activeLogger = new RotatingFileLogger(opts);
|
|
206
|
+
activeLogger.init();
|
|
207
|
+
return activeLogger;
|
|
208
|
+
}
|
|
209
|
+
function teardownRuntimeLogger() {
|
|
210
|
+
if (activeLogger) {
|
|
211
|
+
activeLogger.teardown();
|
|
212
|
+
activeLogger = null;
|
|
213
|
+
}
|
|
214
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -15,6 +15,7 @@ const migration_state_1 = require("./database/migration-state");
|
|
|
15
15
|
const port_defaults_1 = require("./config/port.defaults");
|
|
16
16
|
const host_defaults_1 = require("./config/host.defaults");
|
|
17
17
|
const runtime_paths_1 = require("./config/runtime-paths");
|
|
18
|
+
const runtime_logger_1 = require("./config/runtime-logger");
|
|
18
19
|
const logger = new common_1.Logger('Bootstrap');
|
|
19
20
|
(0, runtime_paths_1.loadRuntimeEnv)();
|
|
20
21
|
async function ensureDatabaseIsReadyForStartup() {
|
|
@@ -38,6 +39,13 @@ async function ensureDatabaseIsReadyForStartup() {
|
|
|
38
39
|
].join(' '));
|
|
39
40
|
}
|
|
40
41
|
async function bootstrap() {
|
|
42
|
+
try {
|
|
43
|
+
(0, runtime_logger_1.initRuntimeLogger)();
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
(0, runtime_logger_1.persistRuntimeLoggerInitFailure)(String(err));
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
41
49
|
await ensureDatabaseIsReadyForStartup();
|
|
42
50
|
const nodeEnv = process.env.NODE_ENV || 'development';
|
|
43
51
|
const defaultLevels = nodeEnv === 'production'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-BGOBXkO8.js";import{t as s}from"./activity-CmAajKmR.js";import{t as c}from"./box-Bw_pyYzU.js";import{t as l}from"./brain-C6vlLcg3.js";import{t as u}from"./check-DTei8Qlg.js";import{t as d}from"./chevron-down-LTeQHW9O.js";import{t as f}from"./circle-alert-pUx6yhcF.js";import{t as p}from"./circle-check-B9kyRki5.js";import{n as m,t as h}from"./terminal-a6AV2mPO.js";import{t as g}from"./MarkdownField--1gpyapw.js";import{r as _,t as v}from"./providers-CNrSTcdc.js";import{t as y}from"./layers-BcHXXg-4.js";import{t as b}from"./loader-circle-Cl6yIkPK.js";import{t as x}from"./plus-Dx6G8SOZ.js";import{t as S}from"./send-BZjwSrJW.js";import{t as C}from"./settings-at7JqFrc.js";import{t as w}from"./sparkles-v57Nc-z-.js";import{t as T}from"./trash-2-DJpTXgEP.js";import{t as E}from"./ConfirmDialog-y3vTcqFR.js";import{t as D}from"./x-wDy15QMx.js";import{n as O,t as k}from"./vendor-motion-CMGWJcqR.js";import{n as A,t as j}from"./agents-b8btewki.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as M,i as te,r as N,t as P}from"./agentEmojis-BQA0jC3z.js";import{a as F,c as I,o as L,s as R}from"./vendor-forms-DHyqHeyd.js";import{r as z,t as B}from"./taskFormSchemas-dl1t1OyX.js";var ne=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),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`}]]),re=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`}]]),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:w},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:m}},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[p,m]=(0,W.useState)(!1),g=(0,W.useRef)(null),v=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&m(!1)};return p&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(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 ${v.bg} ${v.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${v.dot} ${v.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 ${v.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(),m(!p)},"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 ${p?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(_,{size:16,"aria-hidden":`true`})}),p&&(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),m(!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)(h,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),m(!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)(C,{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),m(!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),m(!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)(T,{size:14}),`Decommission`]})]})]})]})]})},ie=({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)(w,{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)(D,{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:P.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??j.creativity).toFixed(2),ae=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??j.creativity,i=e.strictness??j.strictness;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:n=>{t({...e,creativity:parseFloat(n.target.value)})},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:n=>{t({...e,strictness:parseFloat(n.target.value)})},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`})]})]})]})},oe=({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),[_,y]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[N,P]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[V,H]=(0,W.useState)(!1),[U,K]=(0,W.useState)({...j});(0,W.useEffect)(()=>{e&&r&&(y(r.name||``),S(r.role||``),w(r.description||``),E(r.systemInstructions||``),R(r.model?.id||``),B(M(r.emoji)),P(r.model?.provider?.id??``),K(r.attributes??{...j}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await v.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!N){I([]);return}(async()=>{try{l(!0);let{data:e}=await v.findModels(N);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[N,L]);let q=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},J=async()=>{if(r?.id)try{s(!0),await A.update(r.id,{name:_,emoji:z,role:x,description:C,systemInstructions:T,modelId:L||void 0,attributes:U}),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`&&!V&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[V,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)(D,{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:()=>H(!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:z}),(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)(re,{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:te(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:te(z).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:_,onChange:e=>y(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:q,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)(ne,{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:x,onChange:e=>S(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:C,onChange:w,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)(b,{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:N,onChange:e=>P(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)(b,{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=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.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)(ae,{value:U,onChange:K}),(0,G.jsx)(g,{label:`System Instructions`,value:T,onChange:E,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:()=>{J()},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)(ie,{isOpen:V,selectedEmoji:z,currentEmoji:M(r?.emoji),isSaving:o,onSelect:B,onClose:()=>H(!1),onConfirm:()=>H(!1)})]}):null},se={name:``,role:``,description:``,emoji:N,providerId:``,modelId:``,instructions:B,attributes:{...j}},ce=[{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),[m,h]=(0,W.useState)(!1),_=(0,W.useId)(),b=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),T=(0,W.useId)(),E=(0,W.useId)(),D=(0,W.useId)(),{control:P,formState:{errors:B},handleSubmit:ne,register:V,reset:H,setValue:U}=R({resolver:F(z),defaultValues:se,mode:`onBlur`}),K=I({control:P,name:`providerId`}),q=I({control:P,name:`modelId`}),J=I({control:P,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await v.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await v.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(se);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 oe=i({mutationFn:async e=>(await A.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,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(se),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=oe.isPending,le=Y.isPending||X.isPending,ue=ne(async e=>{await oe.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),de=()=>{$||(p(1),t())};return e?(0,G.jsx)(O,{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)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:de,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(k.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":_,"aria-describedby":b,"aria-busy":$||le,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:_,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:b,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:de,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:ue,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:ce.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)(w,{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:()=>h(!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:M(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:te(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:te(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)(re,{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":!!B.name,"aria-describedby":B.name?x: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`)})}),B.name&&(0,G.jsx)(`p`,{id:x,className:`text-xs text-error font-semibold`,children:B.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":!!B.role,"aria-describedby":B.role?S: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`)})}),B.role&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:B.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,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})}),B.description&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:B.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`}),le&&(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)(y,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),B.providerId&&(0,G.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:B.providerId.message})]}),(0,G.jsx)(O,{mode:`wait`,children:K&&(0,G.jsxs)(k.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":!!B.modelId,"aria-describedby":B.modelId?E: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`})})]}),B.modelId&&(0,G.jsx)(`p`,{id:E,className:`text-xs text-error font-semibold`,children:B.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)(L,{control:P,name:`attributes`,render:({field:e})=>(0,G.jsx)(ae,{value:e.value??{...j},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)(L,{control:P,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})}),B.instructions&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:B.instructions.message})]})]})]})]})]}),(0,G.jsx)(ie,{isOpen:m,selectedEmoji:M(J),currentEmoji:N,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>h(!1),onConfirm:()=>h(!1)})]})}):null},le=({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)(),[m,g]=(0,W.useState)(!1),[_,v]=(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),v(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(k.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)(k.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)(D,{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)(h,{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{g(!0),v(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await A.probe(n.id,i);c(e.content),d(e.image),v(`success`)}catch(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}`),v(`error`)}finally{g(!1)}},disabled:m||!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:m?(0,G.jsx)(b,{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:m?`animate-pulse`:``}),`Neural Response`]}),_===`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)(p,{size:10}),` Sync Complete`]}),_===`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)(f,{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 ${_===`error`?`text-error/80 border-error/20`:_===`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)(O,{children:u&&(0,G.jsxs)(k.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},ue=()=>{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 A.findAll();return e}}),S=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),C=i({mutationFn:e=>A.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),S()},onError:e=>t(e,`Operation Failed`)}),w=i({mutationFn:e=>A.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),S()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},D=e=>{s(e),p(!0)},O=e=>{s(e),h(!0)},k=()=>{o&&C.mutate(o.id)},j=e=>{w.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)(b,{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.model?.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>D(e),onDelete:()=>O(e),onActivate:()=>j(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)(x,{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)(oe,{isOpen:c,onClose:()=>l(!1),onUpdated:S,agent:o},o?.id||`none`),(0,G.jsx)(le,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:S}),(0,G.jsx)(E,{isOpen:m,onClose:()=>h(!1),onConfirm:k,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{ue as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CfaHPvi0.js";import{i as n,n as r,t as i}from"./vendor-query-xpDrc4rM.js";import{r as a}from"./vendor-markdown-DoJbQ1of.js";import{i as o}from"./client-B553SX3l.js";import{t as s}from"./activity-B_2QSywM.js";import{t as c}from"./box-CFDcDxHv.js";import{t as l}from"./brain-DWTpby6b.js";import{t as u}from"./check-BiORptL3.js";import{t as d}from"./chevron-down-BUOg3vvd.js";import{t as f}from"./circle-alert-sCcf7ANF.js";import{t as p}from"./circle-check-Jz8IOE4h.js";import{n as m,t as h}from"./terminal-B6iyNuAm.js";import{t as g}from"./MarkdownField-DR6tHsei.js";import{r as _,t as v}from"./providers-AawjMy3x.js";import{t as y}from"./layers-CVf8_Byb.js";import{t as b}from"./loader-circle-CB6PQwdc.js";import{t as x}from"./plus-CkteVqhM.js";import{t as S}from"./send-iK1X7WSe.js";import{t as C}from"./settings-BpKLGxm8.js";import{t as w}from"./sparkles-krUpxie4.js";import{t as T}from"./trash-2-CphQfk35.js";import{t as E}from"./ConfirmDialog-BltdtevE.js";import{t as D}from"./x-CCZGYGDC.js";import{n as O,t as k}from"./vendor-motion-CMGWJcqR.js";import{n as A,t as j}from"./agents-YQJ7JNfI.js";import{t as ee}from"./useNotification-DQayTSUL.js";import{a as M,i as te,r as N,t as P}from"./agentEmojis-BQA0jC3z.js";import{a as F,c as I,o as L,s as R}from"./vendor-forms-DHyqHeyd.js";import{r as z,t as B}from"./taskFormSchemas-B6YlRxrx.js";var ne=o(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),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`}]]),re=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`}]]),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:w},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:m}},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[p,m]=(0,W.useState)(!1),g=(0,W.useRef)(null),v=K[a];return(0,W.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&m(!1)};return p&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]),(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 ${v.bg} ${v.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${v.dot} ${v.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 ${v.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(),m(!p)},"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 ${p?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(_,{size:16,"aria-hidden":`true`})}),p&&(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),m(!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)(h,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),m(!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)(C,{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),m(!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),m(!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)(T,{size:14}),`Decommission`]})]})]})]})]})},ie=({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)(w,{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)(D,{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:P.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??j.creativity).toFixed(2),ae=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??j.creativity,i=e.strictness??j.strictness;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:n=>{t({...e,creativity:parseFloat(n.target.value)})},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:n=>{t({...e,strictness:parseFloat(n.target.value)})},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`})]})]})]})},oe=({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),[_,y]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(``),[O,k]=(0,W.useState)([]),[N,P]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[V,H]=(0,W.useState)(!1),[U,K]=(0,W.useState)({...j});(0,W.useEffect)(()=>{e&&r&&(y(r.name||``),S(r.role||``),w(r.description||``),E(r.systemInstructions||``),R(r.model?.id||``),B(M(r.emoji)),P(r.model?.provider?.id??``),K(r.attributes??{...j}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await v.findAll();k(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!N){I([]);return}(async()=>{try{l(!0);let{data:e}=await v.findModels(N);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[N,L]);let q=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},J=async()=>{if(r?.id)try{s(!0),await A.update(r.id,{name:_,emoji:z,role:x,description:C,systemInstructions:T,modelId:L||void 0,attributes:U}),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`&&!V&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[V,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)(D,{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:()=>H(!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:z}),(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)(re,{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:te(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:te(z).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:_,onChange:e=>y(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:q,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)(ne,{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:x,onChange:e=>S(e.target.value)})]})]}),(0,G.jsx)(g,{label:`Description`,value:C,onChange:w,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)(b,{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:N,onChange:e=>P(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)(b,{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=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.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)(ae,{value:U,onChange:K}),(0,G.jsx)(g,{label:`System Instructions`,value:T,onChange:E,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:()=>{J()},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)(ie,{isOpen:V,selectedEmoji:z,currentEmoji:M(r?.emoji),isSaving:o,onSelect:B,onClose:()=>H(!1),onConfirm:()=>H(!1)})]}):null},se={name:``,role:``,description:``,emoji:N,providerId:``,modelId:``,instructions:B,attributes:{...j}},ce=[{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),[m,h]=(0,W.useState)(!1),_=(0,W.useId)(),b=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),T=(0,W.useId)(),E=(0,W.useId)(),D=(0,W.useId)(),{control:P,formState:{errors:B},handleSubmit:ne,register:V,reset:H,setValue:U}=R({resolver:F(z),defaultValues:se,mode:`onBlur`}),K=I({control:P,name:`providerId`}),q=I({control:P,name:`modelId`}),J=I({control:P,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await v.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await v.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(se);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 oe=i({mutationFn:async e=>(await A.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,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(se),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=oe.isPending,le=Y.isPending||X.isPending,ue=ne(async e=>{await oe.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),de=()=>{$||(p(1),t())};return e?(0,G.jsx)(O,{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)(k.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:de,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(k.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":_,"aria-describedby":b,"aria-busy":$||le,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:_,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:b,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:de,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:ue,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:ce.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)(w,{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:()=>h(!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:M(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:te(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:te(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)(re,{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":!!B.name,"aria-describedby":B.name?x: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`)})}),B.name&&(0,G.jsx)(`p`,{id:x,className:`text-xs text-error font-semibold`,children:B.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":!!B.role,"aria-describedby":B.role?S: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`)})}),B.role&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:B.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(L,{control:P,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})}),B.description&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:B.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`}),le&&(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)(y,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),B.providerId&&(0,G.jsx)(`p`,{id:T,className:`text-xs text-error font-semibold`,children:B.providerId.message})]}),(0,G.jsx)(O,{mode:`wait`,children:K&&(0,G.jsxs)(k.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":!!B.modelId,"aria-describedby":B.modelId?E: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`})})]}),B.modelId&&(0,G.jsx)(`p`,{id:E,className:`text-xs text-error font-semibold`,children:B.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)(L,{control:P,name:`attributes`,render:({field:e})=>(0,G.jsx)(ae,{value:e.value??{...j},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)(L,{control:P,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})}),B.instructions&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:B.instructions.message})]})]})]})]})]}),(0,G.jsx)(ie,{isOpen:m,selectedEmoji:M(J),currentEmoji:N,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>h(!1),onConfirm:()=>h(!1)})]})}):null},le=({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)(),[m,g]=(0,W.useState)(!1),[_,v]=(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),v(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(O,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(k.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)(k.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)(D,{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)(h,{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{g(!0),v(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await A.probe(n.id,i);c(e.content),d(e.image),v(`success`)}catch(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}`),v(`error`)}finally{g(!1)}},disabled:m||!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:m?(0,G.jsx)(b,{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:m?`animate-pulse`:``}),`Neural Response`]}),_===`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)(p,{size:10}),` Sync Complete`]}),_===`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)(f,{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 ${_===`error`?`text-error/80 border-error/20`:_===`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)(O,{children:u&&(0,G.jsxs)(k.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},ue=()=>{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 A.findAll();return e}}),S=(0,W.useCallback)(()=>a.invalidateQueries({queryKey:[`agents`]}),[a]),C=i({mutationFn:e=>A.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),S()},onError:e=>t(e,`Operation Failed`)}),w=i({mutationFn:e=>A.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),S()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},D=e=>{s(e),p(!0)},O=e=>{s(e),h(!0)},k=()=>{o&&C.mutate(o.id)},j=e=>{w.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)(b,{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.model?.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>D(e),onDelete:()=>O(e),onActivate:()=>j(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)(x,{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)(oe,{isOpen:c,onClose:()=>l(!1),onUpdated:S,agent:o},o?.id||`none`),(0,G.jsx)(le,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)($,{isOpen:u,onClose:()=>d(!1),onCreated:S}),(0,G.jsx)(E,{isOpen:m,onClose:()=>h(!1),onConfirm:k,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{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{t as n}from"./download-
|
|
1
|
+
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{t as n}from"./download-DZdOdijy.js";import{t as r}from"./file-text-CX_Yqfjf.js";e();var i=t(),a=({name:e,size:t,type:a,filePath:o})=>{let s=[`png`,`jpg`,`jpeg`,`svg`,`gif`].includes(a.toLowerCase()),c=(e=>e.startsWith(`http`)?e:e.startsWith(`uploads/`)?`/api/v1/${e}`:`/api/v1/uploads/artifacts/${e}`)(o);return(0,i.jsxs)(`div`,{className:`flex items-center gap-4 p-3 bg-surface-container-highest/40 rounded-lg border border-outline-variant/10 group hover:border-primary/20 transition-all cursor-pointer`,onClick:()=>window.open(c,`_blank`),children:[(0,i.jsx)(`div`,{className:`h-10 w-10 rounded shadow-inner flex items-center justify-center overflow-hidden ${s?`bg-secondary/10 text-secondary`:`bg-primary/10 text-primary`}`,children:s?(0,i.jsx)(`img`,{src:c,alt:e,className:`h-full w-full object-cover`}):(0,i.jsx)(r,{size:20})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`p`,{className:`text-xs font-bold text-on-surface truncate`,children:e}),(0,i.jsx)(`p`,{className:`text-[10px] text-on-surface-variant/60 font-medium uppercase tracking-tighter`,children:t||`Artifact`})]}),(0,i.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,i.jsx)(`button`,{className:`p-1.5 hover:bg-surface-container-highest rounded text-on-surface-variant hover:text-primary transition-colors`,children:(0,i.jsx)(n,{size:14})})})]})};export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{i as n}from"./client-
|
|
1
|
+
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CfaHPvi0.js";import{r as t}from"./vendor-markdown-DoJbQ1of.js";import{i as n}from"./client-B553SX3l.js";import{t as r}from"./circle-check-Jz8IOE4h.js";import{t as i}from"./info-DGHChFI6.js";import{t as a}from"./x-CCZGYGDC.js";import{n as o,t as s}from"./vendor-motion-CMGWJcqR.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:i,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:r,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)(o,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(s.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(s.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)(a,{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)(r,{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};
|