@agentstep/gateway 0.4.38 → 0.4.41
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/dist/gateway.js +301 -223
- package/package.json +2 -2
package/dist/gateway.js
CHANGED
|
@@ -158681,7 +158681,7 @@ var init_session_resources2 = __esm({
|
|
|
158681
158681
|
}
|
|
158682
158682
|
});
|
|
158683
158683
|
|
|
158684
|
-
// ../agent-sdk/dist/chunk-
|
|
158684
|
+
// ../agent-sdk/dist/chunk-NQVRZAIX.js
|
|
158685
158685
|
function hydrate7(row) {
|
|
158686
158686
|
return {
|
|
158687
158687
|
id: row.id,
|
|
@@ -158689,8 +158689,9 @@ function hydrate7(row) {
|
|
|
158689
158689
|
filename: row.filename,
|
|
158690
158690
|
mime_type: row.content_type,
|
|
158691
158691
|
size_bytes: row.size,
|
|
158692
|
+
// All local files are downloadable. Anthropic sets downloadable: false
|
|
158693
|
+
// for user-uploaded inputs, but we always serve them (UI needs access).
|
|
158692
158694
|
downloadable: true,
|
|
158693
|
-
// local files are always downloadable; remote: files are proxy-downloadable
|
|
158694
158695
|
scope: row.scope_type && row.scope_id ? { type: row.scope_type, id: row.scope_id } : null,
|
|
158695
158696
|
created_at: toIso(row.created_at)
|
|
158696
158697
|
};
|
|
@@ -158803,8 +158804,8 @@ function deleteFileRecord(id) {
|
|
|
158803
158804
|
db.delete(schema_exports.files).where(eq(schema_exports.files.id, id)).run();
|
|
158804
158805
|
return { id, type: "file_deleted" };
|
|
158805
158806
|
}
|
|
158806
|
-
var
|
|
158807
|
-
"../agent-sdk/dist/chunk-
|
|
158807
|
+
var init_chunk_NQVRZAIX = __esm({
|
|
158808
|
+
"../agent-sdk/dist/chunk-NQVRZAIX.js"() {
|
|
158808
158809
|
"use strict";
|
|
158809
158810
|
init_chunk_F4WUVOLE();
|
|
158810
158811
|
init_chunk_HFDLUBWN();
|
|
@@ -158832,7 +158833,7 @@ __export(files_exports, {
|
|
|
158832
158833
|
var init_files = __esm({
|
|
158833
158834
|
"../agent-sdk/dist/db/files.js"() {
|
|
158834
158835
|
"use strict";
|
|
158835
|
-
|
|
158836
|
+
init_chunk_NQVRZAIX();
|
|
158836
158837
|
init_chunk_F4WUVOLE();
|
|
158837
158838
|
init_chunk_HFDLUBWN();
|
|
158838
158839
|
init_chunk_R5T4LJSK();
|
|
@@ -158906,7 +158907,7 @@ var init_storage = __esm({
|
|
|
158906
158907
|
}
|
|
158907
158908
|
});
|
|
158908
158909
|
|
|
158909
|
-
// ../agent-sdk/dist/chunk-
|
|
158910
|
+
// ../agent-sdk/dist/chunk-N76ZVITA.js
|
|
158910
158911
|
function wrapProviderWithSecrets(provider, secrets) {
|
|
158911
158912
|
if (!secrets || Object.keys(secrets).length === 0) return provider;
|
|
158912
158913
|
return {
|
|
@@ -159412,8 +159413,8 @@ async function reconcileDockerOrphanSandboxes() {
|
|
|
159412
159413
|
return { deleted, kept };
|
|
159413
159414
|
}
|
|
159414
159415
|
var import_ulid2, lcLog, SANDBOX_NAME_PREFIX;
|
|
159415
|
-
var
|
|
159416
|
-
"../agent-sdk/dist/chunk-
|
|
159416
|
+
var init_chunk_N76ZVITA = __esm({
|
|
159417
|
+
"../agent-sdk/dist/chunk-N76ZVITA.js"() {
|
|
159417
159418
|
"use strict";
|
|
159418
159419
|
init_chunk_4XXQAVKE();
|
|
159419
159420
|
init_chunk_5IGBMS2U();
|
|
@@ -159558,7 +159559,8 @@ async function discoverChangedFiles(sandboxName, provider, secrets) {
|
|
|
159558
159559
|
{ secrets, timeoutMs: 1e4 }
|
|
159559
159560
|
);
|
|
159560
159561
|
if (result.exit_code !== 0 || !result.stdout.trim()) return [];
|
|
159561
|
-
|
|
159562
|
+
const clean = result.stdout.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "");
|
|
159563
|
+
return clean.trim().split("\n").map((l) => l.trim()).filter(Boolean);
|
|
159562
159564
|
} catch {
|
|
159563
159565
|
return [];
|
|
159564
159566
|
}
|
|
@@ -159568,6 +159570,42 @@ async function syncContainerFiles(opts) {
|
|
|
159568
159570
|
const extracted = extractFilePaths(sessionId);
|
|
159569
159571
|
let allPaths = extracted.paths;
|
|
159570
159572
|
console.log(`[container-file-sync] ${sessionId}: extracted ${allPaths.length} paths, sawFileTools=${extracted.sawFileTools}, sawBash=${extracted.sawBash}`);
|
|
159573
|
+
const autoExecResults = [];
|
|
159574
|
+
if (extracted.sawFileTools && !extracted.sawBash) {
|
|
159575
|
+
const scriptPaths = allPaths.filter((p2) => /\.(js|mjs)$/.test(p2));
|
|
159576
|
+
for (const scriptPath of scriptPaths) {
|
|
159577
|
+
try {
|
|
159578
|
+
const peek = await provider.exec(sandboxName, ["head", "-20", "--", scriptPath], { secrets, timeoutMs: 5e3 });
|
|
159579
|
+
const head = (peek.stdout ?? "").replace(/[\x00-\x1f]/g, "");
|
|
159580
|
+
const LIB_PATTERNS = [
|
|
159581
|
+
{ re: /require\(["']docx["']\)|from\s+["']docx["']/, pkg: "docx" },
|
|
159582
|
+
{ re: /require\(["']pdfkit["']\)|from\s+["']pdfkit["']/, pkg: "pdfkit" },
|
|
159583
|
+
{ re: /require\(["']exceljs["']\)|from\s+["']exceljs["']/, pkg: "exceljs" },
|
|
159584
|
+
{ re: /require\(["']officegen["']\)|from\s+["']officegen["']/, pkg: "officegen" }
|
|
159585
|
+
];
|
|
159586
|
+
const matched = LIB_PATTERNS.find((p2) => p2.re.test(head));
|
|
159587
|
+
if (!matched) continue;
|
|
159588
|
+
console.log(`[container-file-sync] ${sessionId}: auto-executing ${matched.pkg} script: ${scriptPath}`);
|
|
159589
|
+
const dir = path9.dirname(scriptPath) || "/tmp";
|
|
159590
|
+
const run3 = await provider.exec(
|
|
159591
|
+
sandboxName,
|
|
159592
|
+
["sh", "-c", `cd -- "${dir}" && (npm list "${matched.pkg}" 2>/dev/null || npm install "${matched.pkg}" 2>/dev/null) && node -- "${scriptPath}"`],
|
|
159593
|
+
{ secrets, timeoutMs: 3e4 }
|
|
159594
|
+
);
|
|
159595
|
+
if (run3.exit_code === 0) {
|
|
159596
|
+
console.log(`[container-file-sync] ${sessionId}: script executed successfully`);
|
|
159597
|
+
extracted.sawBash = true;
|
|
159598
|
+
autoExecResults.push({ scriptPath, success: true });
|
|
159599
|
+
} else {
|
|
159600
|
+
const stderr = (run3.stderr ?? "").replace(/[\x00-\x1f]/g, "").slice(0, 200);
|
|
159601
|
+
console.warn(`[container-file-sync] ${sessionId}: script failed (exit ${run3.exit_code}): ${stderr}`);
|
|
159602
|
+
autoExecResults.push({ scriptPath, success: false });
|
|
159603
|
+
}
|
|
159604
|
+
} catch (err) {
|
|
159605
|
+
console.warn(`[container-file-sync] ${sessionId}: auto-execute check failed for ${scriptPath}:`, err);
|
|
159606
|
+
}
|
|
159607
|
+
}
|
|
159608
|
+
}
|
|
159571
159609
|
if (allPaths.length > 0) {
|
|
159572
159610
|
console.log(`[container-file-sync] ${sessionId}: tracked paths: ${allPaths.join(", ")}`);
|
|
159573
159611
|
}
|
|
@@ -159580,7 +159618,7 @@ async function syncContainerFiles(opts) {
|
|
|
159580
159618
|
}
|
|
159581
159619
|
if (allPaths.length === 0) {
|
|
159582
159620
|
console.log(`[container-file-sync] ${sessionId}: no paths to sync`);
|
|
159583
|
-
return { synced: 0, skipped: 0, files: [] };
|
|
159621
|
+
return { synced: 0, skipped: 0, files: [], autoExecuted: [] };
|
|
159584
159622
|
}
|
|
159585
159623
|
const validPaths = [];
|
|
159586
159624
|
let skipped = 0;
|
|
@@ -159598,7 +159636,7 @@ async function syncContainerFiles(opts) {
|
|
|
159598
159636
|
validPaths.push(p2);
|
|
159599
159637
|
}
|
|
159600
159638
|
console.log(`[container-file-sync] ${sessionId}: ${validPaths.length} valid paths, ${skipped} skipped`);
|
|
159601
|
-
if (validPaths.length === 0) return { synced: 0, skipped, files: [] };
|
|
159639
|
+
if (validPaths.length === 0) return { synced: 0, skipped, files: [], autoExecuted: autoExecResults };
|
|
159602
159640
|
if (validPaths.length > MAX_FILES_PER_SYNC) {
|
|
159603
159641
|
console.warn(
|
|
159604
159642
|
`[container-file-sync] ${sessionId}: ${validPaths.length} files to sync, capping at ${MAX_FILES_PER_SYNC}`
|
|
@@ -159632,7 +159670,7 @@ async function syncContainerFiles(opts) {
|
|
|
159632
159670
|
try {
|
|
159633
159671
|
const ext = path9.extname(filePath).toLowerCase();
|
|
159634
159672
|
const isBinary = BINARY_READ_EXTS.has(ext);
|
|
159635
|
-
const result = isBinary ? await provider.exec(sandboxName, ["
|
|
159673
|
+
const result = isBinary ? await provider.exec(sandboxName, ["sh", "-c", `base64 < "${filePath}" | tr -d '\\n'`], { secrets, timeoutMs: 15e3 }) : await provider.exec(sandboxName, ["cat", "--", filePath], { secrets, timeoutMs: 15e3 });
|
|
159636
159674
|
if (result.exit_code !== 0 || !result.stdout) {
|
|
159637
159675
|
skipped++;
|
|
159638
159676
|
continue;
|
|
@@ -159670,14 +159708,14 @@ async function syncContainerFiles(opts) {
|
|
|
159670
159708
|
skipped++;
|
|
159671
159709
|
}
|
|
159672
159710
|
}
|
|
159673
|
-
return { synced, skipped, files: syncedFiles };
|
|
159711
|
+
return { synced, skipped, files: syncedFiles, autoExecuted: autoExecResults };
|
|
159674
159712
|
}
|
|
159675
159713
|
var BINARY_EXTENSIONS, BLOCKED_PREFIXES, MAX_FILE_SIZE, MAX_FILES_PER_SYNC, MIME_MAP;
|
|
159676
159714
|
var init_container_file_sync = __esm({
|
|
159677
159715
|
"../agent-sdk/dist/sync/container-file-sync.js"() {
|
|
159678
159716
|
"use strict";
|
|
159679
159717
|
init_chunk_STPT3SWU();
|
|
159680
|
-
|
|
159718
|
+
init_chunk_NQVRZAIX();
|
|
159681
159719
|
init_chunk_TH7WJLZC();
|
|
159682
159720
|
init_chunk_F4WUVOLE();
|
|
159683
159721
|
init_chunk_HFDLUBWN();
|
|
@@ -160013,7 +160051,7 @@ var MAX_THREAD_DEPTH;
|
|
|
160013
160051
|
var init_threads = __esm({
|
|
160014
160052
|
"../agent-sdk/dist/sessions/threads.js"() {
|
|
160015
160053
|
"use strict";
|
|
160016
|
-
|
|
160054
|
+
init_chunk_DAVYI5H4();
|
|
160017
160055
|
init_chunk_PJZ5TQYW();
|
|
160018
160056
|
init_chunk_AU4NAQGA();
|
|
160019
160057
|
init_chunk_H6TQGV4L();
|
|
@@ -160023,7 +160061,7 @@ var init_threads = __esm({
|
|
|
160023
160061
|
init_chunk_E7DD7F7J();
|
|
160024
160062
|
init_chunk_L5RW66H5();
|
|
160025
160063
|
init_chunk_LAWTTG2E();
|
|
160026
|
-
|
|
160064
|
+
init_chunk_N76ZVITA();
|
|
160027
160065
|
init_chunk_4XXQAVKE();
|
|
160028
160066
|
init_chunk_5IGBMS2U();
|
|
160029
160067
|
init_chunk_5ZFOKZGR();
|
|
@@ -160097,7 +160135,7 @@ var init_threads = __esm({
|
|
|
160097
160135
|
}
|
|
160098
160136
|
});
|
|
160099
160137
|
|
|
160100
|
-
// ../agent-sdk/dist/chunk-
|
|
160138
|
+
// ../agent-sdk/dist/chunk-DAVYI5H4.js
|
|
160101
160139
|
function formatStopReason(reason, eventIds) {
|
|
160102
160140
|
if (reason === "custom_tool_call") {
|
|
160103
160141
|
return { type: "requires_action", event_ids: eventIds ?? [] };
|
|
@@ -160588,6 +160626,12 @@ ${turnBuild.stdin}`;
|
|
|
160588
160626
|
provider,
|
|
160589
160627
|
secrets
|
|
160590
160628
|
});
|
|
160629
|
+
for (const ae3 of syncResult.autoExecuted) {
|
|
160630
|
+
emit("session.script_executed", {
|
|
160631
|
+
script_path: ae3.scriptPath,
|
|
160632
|
+
success: ae3.success
|
|
160633
|
+
});
|
|
160634
|
+
}
|
|
160591
160635
|
if (syncResult.synced > 0) {
|
|
160592
160636
|
console.log(`[driver] synced ${syncResult.synced} files from container (${syncResult.skipped} skipped)`);
|
|
160593
160637
|
for (const f of syncResult.files) {
|
|
@@ -160857,18 +160901,6 @@ async function checkToolBridgeSentinel(sessionId, sandboxName, provider, secrets
|
|
|
160857
160901
|
console.warn(`[driver] failed to read tool bridge request for ${sessionId}:`, err);
|
|
160858
160902
|
return;
|
|
160859
160903
|
}
|
|
160860
|
-
const input = request2.input;
|
|
160861
|
-
const filename = input?.filename ?? "";
|
|
160862
|
-
const SCRIPT_EXTS = /\.(js|ts|py|sh|mjs|cjs)$/i;
|
|
160863
|
-
if (request2.name === "save_output" && SCRIPT_EXTS.test(filename)) {
|
|
160864
|
-
console.log(`[driver] ${sessionId} rejecting save_output for script file: ${filename}`);
|
|
160865
|
-
pendingToolBridgeCalls.add(sessionId);
|
|
160866
|
-
await writeToolBridgeResponse(sessionId, [{
|
|
160867
|
-
type: "text",
|
|
160868
|
-
text: `Error: "${filename}" is a script file, not a deliverable. Run the script first (e.g. "node ${filename}" or "python3 ${filename}"), then call save_output with the OUTPUT file (e.g. the .docx, .pdf, or .csv that the script produces).`
|
|
160869
|
-
}]);
|
|
160870
|
-
return;
|
|
160871
|
-
}
|
|
160872
160904
|
pendingToolBridgeCalls.add(sessionId);
|
|
160873
160905
|
console.log(`[driver] ${sessionId} custom tool call: ${request2.name} (${request2.tool_use_id})`);
|
|
160874
160906
|
appendEvent2(sessionId, {
|
|
@@ -160913,8 +160945,8 @@ async function writeToolBridgeResponse(sessionId, content) {
|
|
|
160913
160945
|
pendingToolBridgeCalls.delete(sessionId);
|
|
160914
160946
|
}
|
|
160915
160947
|
var gd, pendingToolBridgeCalls;
|
|
160916
|
-
var
|
|
160917
|
-
"../agent-sdk/dist/chunk-
|
|
160948
|
+
var init_chunk_DAVYI5H4 = __esm({
|
|
160949
|
+
"../agent-sdk/dist/chunk-DAVYI5H4.js"() {
|
|
160918
160950
|
"use strict";
|
|
160919
160951
|
init_chunk_PJZ5TQYW();
|
|
160920
160952
|
init_chunk_AU4NAQGA();
|
|
@@ -160923,7 +160955,7 @@ var init_chunk_SG2PUHZG = __esm({
|
|
|
160923
160955
|
init_chunk_72BKGVBE();
|
|
160924
160956
|
init_chunk_TPPLYCJF();
|
|
160925
160957
|
init_chunk_E7DD7F7J();
|
|
160926
|
-
|
|
160958
|
+
init_chunk_N76ZVITA();
|
|
160927
160959
|
init_chunk_5IGBMS2U();
|
|
160928
160960
|
init_chunk_MHBLVGRF();
|
|
160929
160961
|
init_chunk_3NK6YTA5();
|
|
@@ -213361,7 +213393,7 @@ var init_chunk_3MQ2FWXS = __esm({
|
|
|
213361
213393
|
}
|
|
213362
213394
|
});
|
|
213363
213395
|
|
|
213364
|
-
// ../agent-sdk/dist/chunk-
|
|
213396
|
+
// ../agent-sdk/dist/chunk-3FDE3BPB.js
|
|
213365
213397
|
function markStopping() {
|
|
213366
213398
|
stopping = true;
|
|
213367
213399
|
}
|
|
@@ -213447,11 +213479,11 @@ async function evictIdleSessions() {
|
|
|
213447
213479
|
}
|
|
213448
213480
|
}
|
|
213449
213481
|
var sweeping, stopping;
|
|
213450
|
-
var
|
|
213451
|
-
"../agent-sdk/dist/chunk-
|
|
213482
|
+
var init_chunk_3FDE3BPB = __esm({
|
|
213483
|
+
"../agent-sdk/dist/chunk-3FDE3BPB.js"() {
|
|
213452
213484
|
"use strict";
|
|
213453
213485
|
init_chunk_LAWTTG2E();
|
|
213454
|
-
|
|
213486
|
+
init_chunk_N76ZVITA();
|
|
213455
213487
|
init_chunk_MHBLVGRF();
|
|
213456
213488
|
init_chunk_3NK6YTA5();
|
|
213457
213489
|
init_chunk_WPK4ZPMG();
|
|
@@ -213466,7 +213498,7 @@ var init_chunk_ESSEO2YM = __esm({
|
|
|
213466
213498
|
}
|
|
213467
213499
|
});
|
|
213468
213500
|
|
|
213469
|
-
// ../agent-sdk/dist/chunk-
|
|
213501
|
+
// ../agent-sdk/dist/chunk-34EB622U.js
|
|
213470
213502
|
function installShutdownHandlers() {
|
|
213471
213503
|
if (g13.__caShutdownInstalled) return;
|
|
213472
213504
|
g13.__caShutdownInstalled = true;
|
|
@@ -213509,10 +213541,10 @@ async function shutdown(signal) {
|
|
|
213509
213541
|
process.exit(0);
|
|
213510
213542
|
}
|
|
213511
213543
|
var g13, shuttingDown;
|
|
213512
|
-
var
|
|
213513
|
-
"../agent-sdk/dist/chunk-
|
|
213544
|
+
var init_chunk_34EB622U = __esm({
|
|
213545
|
+
"../agent-sdk/dist/chunk-34EB622U.js"() {
|
|
213514
213546
|
"use strict";
|
|
213515
|
-
|
|
213547
|
+
init_chunk_3FDE3BPB();
|
|
213516
213548
|
init_chunk_6POQAFEC();
|
|
213517
213549
|
init_chunk_UYTSKFGK();
|
|
213518
213550
|
init_client();
|
|
@@ -213852,7 +213884,7 @@ var init_file_sync = __esm({
|
|
|
213852
213884
|
init_chunk_PIJKJNGB();
|
|
213853
213885
|
init_chunk_H7UKW666();
|
|
213854
213886
|
init_chunk_L2RX552S();
|
|
213855
|
-
|
|
213887
|
+
init_chunk_NQVRZAIX();
|
|
213856
213888
|
init_chunk_E7DD7F7J();
|
|
213857
213889
|
init_chunk_MHBLVGRF();
|
|
213858
213890
|
init_chunk_ZVXIZ2JD();
|
|
@@ -215613,7 +215645,7 @@ var init_rate_limit = __esm({
|
|
|
215613
215645
|
}
|
|
215614
215646
|
});
|
|
215615
215647
|
|
|
215616
|
-
// ../agent-sdk/dist/chunk-
|
|
215648
|
+
// ../agent-sdk/dist/chunk-LMNFIJ6M.js
|
|
215617
215649
|
import path10 from "path";
|
|
215618
215650
|
async function ensureInitialized() {
|
|
215619
215651
|
if (g15.__caInitPromise) return g15.__caInitPromise;
|
|
@@ -215835,18 +215867,18 @@ async function rebuildContainerPool() {
|
|
|
215835
215867
|
}
|
|
215836
215868
|
}
|
|
215837
215869
|
var g15;
|
|
215838
|
-
var
|
|
215839
|
-
"../agent-sdk/dist/chunk-
|
|
215870
|
+
var init_chunk_LMNFIJ6M = __esm({
|
|
215871
|
+
"../agent-sdk/dist/chunk-LMNFIJ6M.js"() {
|
|
215840
215872
|
"use strict";
|
|
215841
|
-
|
|
215873
|
+
init_chunk_DAVYI5H4();
|
|
215842
215874
|
init_chunk_2PPB644A();
|
|
215843
215875
|
init_chunk_GVPJL3XS();
|
|
215844
215876
|
init_chunk_N3QIXC2B();
|
|
215845
215877
|
init_chunk_USYY3L7G();
|
|
215846
215878
|
init_chunk_3MQ2FWXS();
|
|
215847
|
-
|
|
215848
|
-
|
|
215849
|
-
|
|
215879
|
+
init_chunk_34EB622U();
|
|
215880
|
+
init_chunk_3FDE3BPB();
|
|
215881
|
+
init_chunk_N76ZVITA();
|
|
215850
215882
|
init_chunk_MHBLVGRF();
|
|
215851
215883
|
init_chunk_3NK6YTA5();
|
|
215852
215884
|
init_chunk_YPXI7Q2M();
|
|
@@ -215864,7 +215896,7 @@ var init_chunk_OE6FNM5F = __esm({
|
|
|
215864
215896
|
}
|
|
215865
215897
|
});
|
|
215866
215898
|
|
|
215867
|
-
// ../agent-sdk/dist/chunk-
|
|
215899
|
+
// ../agent-sdk/dist/chunk-RH4GKU52.js
|
|
215868
215900
|
async function routeWrap(request2, handler) {
|
|
215869
215901
|
const startedAt = Date.now();
|
|
215870
215902
|
let status = 500;
|
|
@@ -215908,13 +215940,13 @@ async function routeWrap(request2, handler) {
|
|
|
215908
215940
|
function jsonOk(body, status = 200) {
|
|
215909
215941
|
return Response.json(body, { status });
|
|
215910
215942
|
}
|
|
215911
|
-
var
|
|
215912
|
-
"../agent-sdk/dist/chunk-
|
|
215943
|
+
var init_chunk_RH4GKU52 = __esm({
|
|
215944
|
+
"../agent-sdk/dist/chunk-RH4GKU52.js"() {
|
|
215913
215945
|
"use strict";
|
|
215914
215946
|
init_chunk_D2XITRN6();
|
|
215915
215947
|
init_chunk_WQARLGBG();
|
|
215916
215948
|
init_chunk_HVUWXUUI();
|
|
215917
|
-
|
|
215949
|
+
init_chunk_LMNFIJ6M();
|
|
215918
215950
|
init_chunk_3MQ2FWXS();
|
|
215919
215951
|
init_chunk_EZYKRG4W();
|
|
215920
215952
|
}
|
|
@@ -216044,14 +216076,14 @@ var init_dist2 = __esm({
|
|
|
216044
216076
|
init_chunk_2N2KL4KM();
|
|
216045
216077
|
init_chunk_7GG3FEK2();
|
|
216046
216078
|
init_chunk_C6AXM3M7();
|
|
216047
|
-
|
|
216079
|
+
init_chunk_RH4GKU52();
|
|
216048
216080
|
init_chunk_D2XITRN6();
|
|
216049
216081
|
init_chunk_WQARLGBG();
|
|
216050
216082
|
init_chunk_JCW3ZRES();
|
|
216051
216083
|
init_chunk_W6WKXFHN();
|
|
216052
216084
|
init_chunk_HVUWXUUI();
|
|
216053
|
-
|
|
216054
|
-
|
|
216085
|
+
init_chunk_LMNFIJ6M();
|
|
216086
|
+
init_chunk_DAVYI5H4();
|
|
216055
216087
|
init_chunk_PJZ5TQYW();
|
|
216056
216088
|
init_chunk_AU4NAQGA();
|
|
216057
216089
|
init_chunk_H6TQGV4L();
|
|
@@ -216065,10 +216097,10 @@ var init_dist2 = __esm({
|
|
|
216065
216097
|
init_chunk_L5RW66H5();
|
|
216066
216098
|
init_chunk_USYY3L7G();
|
|
216067
216099
|
init_chunk_3MQ2FWXS();
|
|
216068
|
-
|
|
216069
|
-
|
|
216100
|
+
init_chunk_34EB622U();
|
|
216101
|
+
init_chunk_3FDE3BPB();
|
|
216070
216102
|
init_chunk_LAWTTG2E();
|
|
216071
|
-
|
|
216103
|
+
init_chunk_N76ZVITA();
|
|
216072
216104
|
init_chunk_4XXQAVKE();
|
|
216073
216105
|
init_chunk_5IGBMS2U();
|
|
216074
216106
|
init_chunk_5ZFOKZGR();
|
|
@@ -216143,7 +216175,7 @@ var init_dist2 = __esm({
|
|
|
216143
216175
|
}
|
|
216144
216176
|
});
|
|
216145
216177
|
|
|
216146
|
-
// ../agent-sdk/dist/chunk-
|
|
216178
|
+
// ../agent-sdk/dist/chunk-KKCLTWG7.js
|
|
216147
216179
|
function handleWhoami(request2) {
|
|
216148
216180
|
return routeWrap(request2, async ({ auth }) => {
|
|
216149
216181
|
return jsonOk({
|
|
@@ -216154,14 +216186,14 @@ function handleWhoami(request2) {
|
|
|
216154
216186
|
});
|
|
216155
216187
|
});
|
|
216156
216188
|
}
|
|
216157
|
-
var
|
|
216158
|
-
"../agent-sdk/dist/chunk-
|
|
216189
|
+
var init_chunk_KKCLTWG7 = __esm({
|
|
216190
|
+
"../agent-sdk/dist/chunk-KKCLTWG7.js"() {
|
|
216159
216191
|
"use strict";
|
|
216160
|
-
|
|
216192
|
+
init_chunk_RH4GKU52();
|
|
216161
216193
|
}
|
|
216162
216194
|
});
|
|
216163
216195
|
|
|
216164
|
-
// ../agent-sdk/dist/chunk-
|
|
216196
|
+
// ../agent-sdk/dist/chunk-ENGKR2JT.js
|
|
216165
216197
|
function handleCreateSkill(request2) {
|
|
216166
216198
|
return routeWrap(request2, async () => {
|
|
216167
216199
|
throw new ApiError(
|
|
@@ -216180,15 +216212,15 @@ function handleDeleteSkill(request2, _id) {
|
|
|
216180
216212
|
);
|
|
216181
216213
|
});
|
|
216182
216214
|
}
|
|
216183
|
-
var
|
|
216184
|
-
"../agent-sdk/dist/chunk-
|
|
216215
|
+
var init_chunk_ENGKR2JT = __esm({
|
|
216216
|
+
"../agent-sdk/dist/chunk-ENGKR2JT.js"() {
|
|
216185
216217
|
"use strict";
|
|
216186
|
-
|
|
216218
|
+
init_chunk_RH4GKU52();
|
|
216187
216219
|
init_chunk_EZYKRG4W();
|
|
216188
216220
|
}
|
|
216189
216221
|
});
|
|
216190
216222
|
|
|
216191
|
-
// ../agent-sdk/dist/chunk-
|
|
216223
|
+
// ../agent-sdk/dist/chunk-V5HWHJ4P.js
|
|
216192
216224
|
function resolveFeedUrl() {
|
|
216193
216225
|
return process.env.SKILLS_FEED_URL || readSetting("skills_feed_url") || DEFAULT_FEED_URL;
|
|
216194
216226
|
}
|
|
@@ -216203,6 +216235,34 @@ function buildSortedViews(items) {
|
|
|
216203
216235
|
newest: [...items].sort((a, b2) => new Date(b2.firstSeenAt).getTime() - new Date(a.firstSeenAt).getTime())
|
|
216204
216236
|
};
|
|
216205
216237
|
}
|
|
216238
|
+
function normalizeFeed(raw2) {
|
|
216239
|
+
const r = raw2;
|
|
216240
|
+
const updatedAt = typeof r.updatedAt === "string" ? r.updatedAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
216241
|
+
if (Array.isArray(r.topAllTime)) {
|
|
216242
|
+
return {
|
|
216243
|
+
title: typeof r.title === "string" ? r.title : "Skills",
|
|
216244
|
+
updatedAt,
|
|
216245
|
+
topAllTime: r.topAllTime,
|
|
216246
|
+
topTrending: r.topTrending ?? r.topAllTime,
|
|
216247
|
+
topHot: r.topHot ?? r.topAllTime
|
|
216248
|
+
};
|
|
216249
|
+
}
|
|
216250
|
+
const allTime = r.allTime ?? r.items ?? r.skills;
|
|
216251
|
+
const providerId = typeof r.providerId === "string" ? r.providerId : "skills.sh";
|
|
216252
|
+
if (Array.isArray(allTime) && allTime.length > 0) {
|
|
216253
|
+
const mapped = allTime.slice(0, 50).map((s) => ({
|
|
216254
|
+
id: s.skillId ?? s.id ?? `${s.source}/${s.name}`,
|
|
216255
|
+
title: s.name ?? s.title ?? s.skillId,
|
|
216256
|
+
source: s.source ?? "",
|
|
216257
|
+
installs: s.installs ?? s.installsAllTime ?? 0,
|
|
216258
|
+
link: s.link ?? `https://github.com/${s.source}`,
|
|
216259
|
+
providerId: s.providerId ?? providerId,
|
|
216260
|
+
description: s.description ?? ""
|
|
216261
|
+
}));
|
|
216262
|
+
return { title: "Skills", updatedAt, topAllTime: mapped, topTrending: mapped, topHot: mapped };
|
|
216263
|
+
}
|
|
216264
|
+
return { title: "Skills", updatedAt, topAllTime: [], topTrending: [], topHot: [] };
|
|
216265
|
+
}
|
|
216206
216266
|
async function fetchFeed() {
|
|
216207
216267
|
const headers3 = {};
|
|
216208
216268
|
if (feedCache.etag) headers3["If-None-Match"] = feedCache.etag;
|
|
@@ -216212,7 +216272,7 @@ async function fetchFeed() {
|
|
|
216212
216272
|
return feedCache.data;
|
|
216213
216273
|
}
|
|
216214
216274
|
const etag = res.headers.get("etag");
|
|
216215
|
-
const data = await res.json();
|
|
216275
|
+
const data = normalizeFeed(await res.json());
|
|
216216
216276
|
feedCache.data = data;
|
|
216217
216277
|
feedCache.fetchedAt = Date.now();
|
|
216218
216278
|
feedCache.etag = etag;
|
|
@@ -216234,13 +216294,31 @@ function getFeed() {
|
|
|
216234
216294
|
}
|
|
216235
216295
|
function normalizeIndex(raw2) {
|
|
216236
216296
|
const r = raw2;
|
|
216297
|
+
const updatedAt = typeof r.updatedAt === "string" ? r.updatedAt : (/* @__PURE__ */ new Date(0)).toISOString();
|
|
216237
216298
|
const items = r.items ?? r.skills;
|
|
216238
|
-
|
|
216239
|
-
|
|
216240
|
-
updatedAt: typeof
|
|
216241
|
-
|
|
216242
|
-
|
|
216243
|
-
|
|
216299
|
+
if (Array.isArray(items) && items.length > 0 && typeof items[0] === "object" && "installsAllTime" in items[0]) {
|
|
216300
|
+
const count2 = r.count ?? r.totalSkills;
|
|
216301
|
+
return { updatedAt, count: typeof count2 === "number" ? count2 : items.length, items };
|
|
216302
|
+
}
|
|
216303
|
+
const allTime = r.allTime ?? items;
|
|
216304
|
+
const providerId = typeof r.providerId === "string" ? r.providerId : "skills.sh";
|
|
216305
|
+
if (Array.isArray(allTime) && allTime.length > 0) {
|
|
216306
|
+
const mapped = allTime.map((s) => ({
|
|
216307
|
+
id: s.skillId ?? s.id ?? `${s.source}/${s.name}`,
|
|
216308
|
+
providerId: s.providerId ?? providerId,
|
|
216309
|
+
source: s.source ?? "",
|
|
216310
|
+
skillId: s.skillId ?? s.name ?? s.id,
|
|
216311
|
+
title: s.name ?? s.title ?? s.skillId,
|
|
216312
|
+
link: s.link ?? `https://github.com/${s.source}`,
|
|
216313
|
+
installsAllTime: s.installs ?? s.installsAllTime ?? 0,
|
|
216314
|
+
installsTrending: s.installs ?? s.installsTrending ?? 0,
|
|
216315
|
+
installsHot: s.installs ?? s.installsHot ?? 0,
|
|
216316
|
+
firstSeenAt: s.firstSeenAt ?? "",
|
|
216317
|
+
description: s.description ?? ""
|
|
216318
|
+
}));
|
|
216319
|
+
return { updatedAt, count: mapped.length, items: mapped };
|
|
216320
|
+
}
|
|
216321
|
+
return { updatedAt, count: 0, items: [] };
|
|
216244
216322
|
}
|
|
216245
216323
|
async function fetchIndex() {
|
|
216246
216324
|
const controller = new AbortController();
|
|
@@ -216383,8 +216461,8 @@ async function getSources() {
|
|
|
216383
216461
|
})).sort((a, b2) => b2.totalInstalls - a.totalInstalls);
|
|
216384
216462
|
}
|
|
216385
216463
|
var DEFAULT_FEED_URL, DEFAULT_INDEX_URL, FEED_TTL_MS, INDEX_TTL_MS, INDEX_FETCH_TIMEOUT_MS, feedCache, indexCache, sortedViews;
|
|
216386
|
-
var
|
|
216387
|
-
"../agent-sdk/dist/chunk-
|
|
216464
|
+
var init_chunk_V5HWHJ4P = __esm({
|
|
216465
|
+
"../agent-sdk/dist/chunk-V5HWHJ4P.js"() {
|
|
216388
216466
|
"use strict";
|
|
216389
216467
|
init_chunk_V7MTIMPB();
|
|
216390
216468
|
DEFAULT_FEED_URL = "https://www.agentstep.com/v1/skills/feed";
|
|
@@ -216398,7 +216476,7 @@ var init_chunk_P3PHXVMA = __esm({
|
|
|
216398
216476
|
}
|
|
216399
216477
|
});
|
|
216400
216478
|
|
|
216401
|
-
// ../agent-sdk/dist/chunk-
|
|
216479
|
+
// ../agent-sdk/dist/chunk-YBZJHDSE.js
|
|
216402
216480
|
async function handleGetSkillsCatalog(request2) {
|
|
216403
216481
|
return routeWrap(request2, async ({ request: req }) => {
|
|
216404
216482
|
const url2 = new URL(req.url);
|
|
@@ -216454,11 +216532,11 @@ async function handleGetSkillsFeed(request2) {
|
|
|
216454
216532
|
return jsonOk(feed);
|
|
216455
216533
|
});
|
|
216456
216534
|
}
|
|
216457
|
-
var
|
|
216458
|
-
"../agent-sdk/dist/chunk-
|
|
216535
|
+
var init_chunk_YBZJHDSE = __esm({
|
|
216536
|
+
"../agent-sdk/dist/chunk-YBZJHDSE.js"() {
|
|
216459
216537
|
"use strict";
|
|
216460
|
-
|
|
216461
|
-
|
|
216538
|
+
init_chunk_V5HWHJ4P();
|
|
216539
|
+
init_chunk_RH4GKU52();
|
|
216462
216540
|
}
|
|
216463
216541
|
});
|
|
216464
216542
|
|
|
@@ -216518,7 +216596,7 @@ var init_chunk_23UKWXJH = __esm({
|
|
|
216518
216596
|
}
|
|
216519
216597
|
});
|
|
216520
216598
|
|
|
216521
|
-
// ../agent-sdk/dist/chunk-
|
|
216599
|
+
// ../agent-sdk/dist/chunk-32XS3Y6P.js
|
|
216522
216600
|
async function prepareSessionStream(request2, sessionId) {
|
|
216523
216601
|
try {
|
|
216524
216602
|
await ensureInitialized();
|
|
@@ -216611,14 +216689,14 @@ data: ${JSON.stringify(evt)}
|
|
|
216611
216689
|
}
|
|
216612
216690
|
});
|
|
216613
216691
|
}
|
|
216614
|
-
var
|
|
216615
|
-
"../agent-sdk/dist/chunk-
|
|
216692
|
+
var init_chunk_32XS3Y6P = __esm({
|
|
216693
|
+
"../agent-sdk/dist/chunk-32XS3Y6P.js"() {
|
|
216616
216694
|
"use strict";
|
|
216617
216695
|
init_chunk_L2RX552S();
|
|
216618
216696
|
init_chunk_23UKWXJH();
|
|
216619
216697
|
init_chunk_WQARLGBG();
|
|
216620
216698
|
init_chunk_JCW3ZRES();
|
|
216621
|
-
|
|
216699
|
+
init_chunk_LMNFIJ6M();
|
|
216622
216700
|
init_chunk_E7DD7F7J();
|
|
216623
216701
|
init_chunk_MHBLVGRF();
|
|
216624
216702
|
init_chunk_3NK6YTA5();
|
|
@@ -216628,7 +216706,7 @@ var init_chunk_RTGJJN7P = __esm({
|
|
|
216628
216706
|
}
|
|
216629
216707
|
});
|
|
216630
216708
|
|
|
216631
|
-
// ../agent-sdk/dist/chunk-
|
|
216709
|
+
// ../agent-sdk/dist/chunk-RP6WQ4IH.js
|
|
216632
216710
|
function handleCreateTenant(request2) {
|
|
216633
216711
|
return routeWrap(request2, async ({ auth, request: req }) => {
|
|
216634
216712
|
requireFeature("tenancy", "multi-tenancy");
|
|
@@ -216727,13 +216805,13 @@ function handleArchiveTenant(request2, id) {
|
|
|
216727
216805
|
});
|
|
216728
216806
|
}
|
|
216729
216807
|
var CreateBody, PatchBody;
|
|
216730
|
-
var
|
|
216731
|
-
"../agent-sdk/dist/chunk-
|
|
216808
|
+
var init_chunk_RP6WQ4IH = __esm({
|
|
216809
|
+
"../agent-sdk/dist/chunk-RP6WQ4IH.js"() {
|
|
216732
216810
|
"use strict";
|
|
216733
216811
|
init_chunk_23UKWXJH();
|
|
216734
216812
|
init_chunk_KLN6HPYM();
|
|
216735
216813
|
init_chunk_2N2KL4KM();
|
|
216736
|
-
|
|
216814
|
+
init_chunk_RH4GKU52();
|
|
216737
216815
|
init_chunk_AR2TM7CR();
|
|
216738
216816
|
init_chunk_EZYKRG4W();
|
|
216739
216817
|
init_zod();
|
|
@@ -216747,7 +216825,7 @@ var init_chunk_EUPHOI5T = __esm({
|
|
|
216747
216825
|
}
|
|
216748
216826
|
});
|
|
216749
216827
|
|
|
216750
|
-
// ../agent-sdk/dist/chunk-
|
|
216828
|
+
// ../agent-sdk/dist/chunk-LZFB3HRK.js
|
|
216751
216829
|
function handleListThreads(request2, sessionId) {
|
|
216752
216830
|
return routeWrap(request2, async ({ auth }) => {
|
|
216753
216831
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
@@ -216775,11 +216853,11 @@ function handleListThreads(request2, sessionId) {
|
|
|
216775
216853
|
});
|
|
216776
216854
|
});
|
|
216777
216855
|
}
|
|
216778
|
-
var
|
|
216779
|
-
"../agent-sdk/dist/chunk-
|
|
216856
|
+
var init_chunk_LZFB3HRK = __esm({
|
|
216857
|
+
"../agent-sdk/dist/chunk-LZFB3HRK.js"() {
|
|
216780
216858
|
"use strict";
|
|
216781
216859
|
init_chunk_23UKWXJH();
|
|
216782
|
-
|
|
216860
|
+
init_chunk_RH4GKU52();
|
|
216783
216861
|
init_chunk_3NK6YTA5();
|
|
216784
216862
|
init_chunk_6POQAFEC();
|
|
216785
216863
|
init_chunk_EZYKRG4W();
|
|
@@ -216829,7 +216907,7 @@ var init_chunk_6GP5IKXE = __esm({
|
|
|
216829
216907
|
}
|
|
216830
216908
|
});
|
|
216831
216909
|
|
|
216832
|
-
// ../agent-sdk/dist/chunk-
|
|
216910
|
+
// ../agent-sdk/dist/chunk-JWH4OIBP.js
|
|
216833
216911
|
function buildSpanTree(events2) {
|
|
216834
216912
|
const nodes = /* @__PURE__ */ new Map();
|
|
216835
216913
|
const openStarts = /* @__PURE__ */ new Map();
|
|
@@ -217013,18 +217091,18 @@ function handleExportTrace(request2, traceId) {
|
|
|
217013
217091
|
return jsonOk(result, result.ok ? 200 : 502);
|
|
217014
217092
|
});
|
|
217015
217093
|
}
|
|
217016
|
-
var
|
|
217017
|
-
"../agent-sdk/dist/chunk-
|
|
217094
|
+
var init_chunk_JWH4OIBP = __esm({
|
|
217095
|
+
"../agent-sdk/dist/chunk-JWH4OIBP.js"() {
|
|
217018
217096
|
"use strict";
|
|
217019
217097
|
init_chunk_6GP5IKXE();
|
|
217020
|
-
|
|
217098
|
+
init_chunk_RH4GKU52();
|
|
217021
217099
|
init_chunk_GVPJL3XS();
|
|
217022
217100
|
init_chunk_TH7WJLZC();
|
|
217023
217101
|
init_chunk_EZYKRG4W();
|
|
217024
217102
|
}
|
|
217025
217103
|
});
|
|
217026
217104
|
|
|
217027
|
-
// ../agent-sdk/dist/chunk-
|
|
217105
|
+
// ../agent-sdk/dist/chunk-3XGUMXGR.js
|
|
217028
217106
|
async function handleGetUI(opts) {
|
|
217029
217107
|
let body = HTML_TEMPLATE;
|
|
217030
217108
|
const scripts = [];
|
|
@@ -217053,8 +217131,8 @@ async function handleGetUI(opts) {
|
|
|
217053
217131
|
});
|
|
217054
217132
|
}
|
|
217055
217133
|
var HTML_TEMPLATE, UI_VERSION;
|
|
217056
|
-
var
|
|
217057
|
-
"../agent-sdk/dist/chunk-
|
|
217134
|
+
var init_chunk_3XGUMXGR = __esm({
|
|
217135
|
+
"../agent-sdk/dist/chunk-3XGUMXGR.js"() {
|
|
217058
217136
|
"use strict";
|
|
217059
217137
|
HTML_TEMPLATE = `<!DOCTYPE html>
|
|
217060
217138
|
<html lang="en" class="dark">
|
|
@@ -217512,7 +217590,7 @@ If you want to hide the \\\`\${t.titleName}\\\`, you can wrap it with our Visual
|
|
|
217512
217590
|
|
|
217513
217591
|
For more information, see https://radix-ui.com/primitives/docs/components/\${t.docsSlug}\`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ige="DialogDescriptionWarning",Dge=({contentRef:e,descriptionId:t})=>{const r=\`Warning: Missing \\\`Description\\\` or \\\`aria-describedby={undefined}\\\` for {\${Tq(Ige).contentName}}.\`;return x.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Lge=xq,zge=Sq,Fge=Eq,Bge=Cq,$ge=Symbol.for("react.lazy"),bb=ah[" use ".trim().toString()];function Uge(e){return typeof e=="object"&&e!==null&&"then"in e}function Aq(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$ge&&"_payload"in e&&Uge(e._payload)}function Hge(e){const t=qge(e),n=x.forwardRef((r,i)=>{let{children:o,...a}=r;Aq(o)&&typeof bb=="function"&&(o=bb(o._payload));const l=x.Children.toArray(o),u=l.find(Kge);if(u){const f=u.props.children,d=l.map(h=>h===u?x.Children.count(f)>1?x.Children.only(null):x.isValidElement(f)?f.props.children:null:h);return m.jsx(t,{...a,ref:i,children:x.isValidElement(f)?x.cloneElement(f,void 0,d):null})}return m.jsx(t,{...a,ref:i,children:o})});return n.displayName=\`\${e}.Slot\`,n}function qge(e){const t=x.forwardRef((n,r)=>{let{children:i,...o}=n;if(Aq(i)&&typeof bb=="function"&&(i=bb(i._payload)),x.isValidElement(i)){const a=Wge(i),l=Yge(o,i.props);return i.type!==x.Fragment&&(l.ref=r?fc(r,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return t.displayName=\`\${e}.SlotClone\`,t}var Vge=Symbol("radix.slottable");function Kge(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vge}function Yge(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...l)=>{const u=o(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Wge(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gge=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wc=Gge.reduce((e,t)=>{const n=Hge(\`Primitive.\${t}\`),r=x.forwardRef((i,o)=>{const{asChild:a,...l}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(u,{...l,ref:o})});return r.displayName=\`Primitive.\${t}\`,{...e,[t]:r}},{}),Hp='[cmdk-group=""]',CC='[cmdk-group-items=""]',Xge='[cmdk-group-heading=""]',Nq='[cmdk-item=""]',Tz=\`\${Nq}:not([aria-disabled="true"])\`,SO="cmdk-item-select",fd="data-value",Qge=(e,t,n)=>Xpe(e,t,n),Rq=x.createContext(void 0),Fg=()=>x.useContext(Rq),Pq=x.createContext(void 0),mA=()=>x.useContext(Pq),Mq=x.createContext(void 0),Iq=x.forwardRef((e,t)=>{let n=dd(()=>{var $,R;return{search:"",value:(R=($=e.value)!=null?$:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=dd(()=>new Set),i=dd(()=>new Map),o=dd(()=>new Map),a=dd(()=>new Set),l=Dq(e),{label:u,children:f,value:d,onValueChange:h,filter:g,shouldFilter:v,loop:b,disablePointerSelection:w=!1,vimBindings:S=!0,...E}=e,k=Cs(),O=Cs(),j=Cs(),A=x.useRef(null),T=lve();$u(()=>{if(d!==void 0){let $=d.trim();n.current.value=$,N.emit()}},[d]),$u(()=>{T(6,U)},[]);let N=x.useMemo(()=>({subscribe:$=>(a.current.add($),()=>a.current.delete($)),snapshot:()=>n.current,setState:($,R,X)=>{var W,Z,oe,ie;if(!Object.is(n.current[$],R)){if(n.current[$]=R,$==="search")L(),D(),T(1,q);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let J=document.getElementById(j);J?J.focus():(W=document.getElementById(k))==null||W.focus()}if(T(7,()=>{var J;n.current.selectedItemId=(J=H())==null?void 0:J.id,N.emit()}),X||T(5,U),((Z=l.current)==null?void 0:Z.value)!==void 0){let J=R??"";(ie=(oe=l.current).onValueChange)==null||ie.call(oe,J);return}}N.emit()}},emit:()=>{a.current.forEach($=>$())}}),[]),P=x.useMemo(()=>({value:($,R,X)=>{var W;R!==((W=o.current.get($))==null?void 0:W.value)&&(o.current.set($,{value:R,keywords:X}),n.current.filtered.items.set($,F(R,X)),T(2,()=>{D(),N.emit()}))},item:($,R)=>(r.current.add($),R&&(i.current.has(R)?i.current.get(R).add($):i.current.set(R,new Set([$]))),T(3,()=>{L(),D(),n.current.value||q(),N.emit()}),()=>{o.current.delete($),r.current.delete($),n.current.filtered.items.delete($);let X=H();T(4,()=>{L(),X?.getAttribute("id")===$&&q(),N.emit()})}),group:$=>(i.current.has($)||i.current.set($,new Set),()=>{o.current.delete($),i.current.delete($)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:j,labelId:O,listInnerRef:A}),[]);function F($,R){var X,W;let Z=(W=(X=l.current)==null?void 0:X.filter)!=null?W:Qge;return $?Z($,n.current.search,R):0}function D(){if(!n.current.search||l.current.shouldFilter===!1)return;let $=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let Z=i.current.get(W),oe=0;Z.forEach(ie=>{let J=$.get(ie);oe=Math.max(J,oe)}),R.push([W,oe])});let X=A.current;B().sort((W,Z)=>{var oe,ie;let J=W.getAttribute("id"),se=Z.getAttribute("id");return((oe=$.get(se))!=null?oe:0)-((ie=$.get(J))!=null?ie:0)}).forEach(W=>{let Z=W.closest(CC);Z?Z.appendChild(W.parentElement===Z?W:W.closest(\`\${CC} > *\`)):X.appendChild(W.parentElement===X?W:W.closest(\`\${CC} > *\`))}),R.sort((W,Z)=>Z[1]-W[1]).forEach(W=>{var Z;let oe=(Z=A.current)==null?void 0:Z.querySelector(\`\${Hp}[\${fd}="\${encodeURIComponent(W[0])}"]\`);oe?.parentElement.appendChild(oe)})}function q(){let $=B().find(X=>X.getAttribute("aria-disabled")!=="true"),R=$?.getAttribute(fd);N.setState("value",R||void 0)}function L(){var $,R,X,W;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Z=0;for(let oe of r.current){let ie=(R=($=o.current.get(oe))==null?void 0:$.value)!=null?R:"",J=(W=(X=o.current.get(oe))==null?void 0:X.keywords)!=null?W:[],se=F(ie,J);n.current.filtered.items.set(oe,se),se>0&&Z++}for(let[oe,ie]of i.current)for(let J of ie)if(n.current.filtered.items.get(J)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=Z}function U(){var $,R,X;let W=H();W&&((($=W.parentElement)==null?void 0:$.firstChild)===W&&((X=(R=W.closest(Hp))==null?void 0:R.querySelector(Xge))==null||X.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function H(){var $;return($=A.current)==null?void 0:$.querySelector(\`\${Nq}[aria-selected="true"]\`)}function B(){var $;return Array.from((($=A.current)==null?void 0:$.querySelectorAll(Tz))||[])}function z($){let R=B()[$];R&&N.setState("value",R.getAttribute(fd))}function V($){var R;let X=H(),W=B(),Z=W.findIndex(ie=>ie===X),oe=W[Z+$];(R=l.current)!=null&&R.loop&&(oe=Z+$<0?W[W.length-1]:Z+$===W.length?W[0]:W[Z+$]),oe&&N.setState("value",oe.getAttribute(fd))}function Q($){let R=H(),X=R?.closest(Hp),W;for(;X&&!W;)X=$>0?ave(X,Hp):sve(X,Hp),W=X?.querySelector(Tz);W?N.setState("value",W.getAttribute(fd)):V($)}let G=()=>z(B().length-1),I=$=>{$.preventDefault(),$.metaKey?G():$.altKey?Q(1):V(1)},K=$=>{$.preventDefault(),$.metaKey?z(0):$.altKey?Q(-1):V(-1)};return x.createElement(wc.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:$=>{var R;(R=E.onKeyDown)==null||R.call(E,$);let X=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||X))switch($.key){case"n":case"j":{S&&$.ctrlKey&&I($);break}case"ArrowDown":{I($);break}case"p":case"k":{S&&$.ctrlKey&&K($);break}case"ArrowUp":{K($);break}case"Home":{$.preventDefault(),z(0);break}case"End":{$.preventDefault(),G();break}case"Enter":{$.preventDefault();let W=H();if(W){let Z=new Event(SO);W.dispatchEvent(Z)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:uve},u),bw(e,$=>x.createElement(Pq.Provider,{value:N},x.createElement(Rq.Provider,{value:P},$))))}),Zge=x.forwardRef((e,t)=>{var n,r;let i=Cs(),o=x.useRef(null),a=x.useContext(Mq),l=Fg(),u=Dq(e),f=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;$u(()=>{if(!f)return l.item(i,a?.id)},[f]);let d=Lq(i,o,[e.value,e.children,o],e.keywords),h=mA(),g=dc(T=>T.value&&T.value===d.current),v=dc(T=>f||l.filter()===!1?!0:T.search?T.filtered.items.get(i)>0:!0);x.useEffect(()=>{let T=o.current;if(!(!T||e.disabled))return T.addEventListener(SO,b),()=>T.removeEventListener(SO,b)},[v,e.onSelect,e.disabled]);function b(){var T,N;w(),(N=(T=u.current).onSelect)==null||N.call(T,d.current)}function w(){h.setState("value",d.current,!0)}if(!v)return null;let{disabled:S,value:E,onSelect:k,forceMount:O,keywords:j,...A}=e;return x.createElement(wc.div,{ref:fc(o,t),...A,id:i,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:b},e.children)}),Jge=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,a=Cs(),l=x.useRef(null),u=x.useRef(null),f=Cs(),d=Fg(),h=dc(v=>i||d.filter()===!1?!0:v.search?v.filtered.groups.has(a):!0);$u(()=>d.group(a),[]),Lq(a,l,[e.value,e.heading,u]);let g=x.useMemo(()=>({id:a,forceMount:i}),[i]);return x.createElement(wc.div,{ref:fc(l,t),...o,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&x.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),bw(e,v=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},x.createElement(Mq.Provider,{value:g},v))))}),eve=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=x.useRef(null),o=dc(a=>!a.search);return!n&&!o?null:x.createElement(wc.div,{ref:fc(i,t),...r,"cmdk-separator":"",role:"separator"})}),tve=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,o=mA(),a=dc(f=>f.search),l=dc(f=>f.selectedItemId),u=Fg();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(wc.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:i?e.value:a,onChange:f=>{i||o.setState("search",f.target.value),n?.(f.target.value)}})}),nve=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=x.useRef(null),a=x.useRef(null),l=dc(f=>f.selectedItemId),u=Fg();return x.useEffect(()=>{if(a.current&&o.current){let f=a.current,d=o.current,h,g=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let v=f.offsetHeight;d.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return g.observe(f),()=>{cancelAnimationFrame(h),g.unobserve(f)}}},[]),x.createElement(wc.div,{ref:fc(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},bw(e,f=>x.createElement("div",{ref:fc(a,u.listInnerRef),"cmdk-list-sizer":""},f)))}),rve=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:a,...l}=e;return x.createElement(Lge,{open:n,onOpenChange:r},x.createElement(zge,{container:a},x.createElement(Fge,{"cmdk-overlay":"",className:i}),x.createElement(Bge,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Iq,{ref:t,...l}))))}),ive=x.forwardRef((e,t)=>dc(n=>n.filtered.count===0)?x.createElement(wc.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ove=x.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return x.createElement(wc.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},bw(e,a=>x.createElement("div",{"aria-hidden":!0},a)))}),Th=Object.assign(Iq,{List:nve,Item:Zge,Input:tve,Group:Jge,Separator:eve,Dialog:rve,Empty:ive,Loading:ove});function ave(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function sve(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Dq(e){let t=x.useRef(e);return $u(()=>{t.current=e}),t}var $u=typeof window>"u"?x.useEffect:x.useLayoutEffect;function dd(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function dc(e){let t=mA(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function Lq(e,t,n,r=[]){let i=x.useRef(),o=Fg();return $u(()=>{var a;let l=(()=>{var f;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(f=d.current.textContent)==null?void 0:f.trim():i.current}})(),u=r.map(f=>f.trim());o.value(e,l,u),(a=t.current)==null||a.setAttribute(fd,l),i.current=l}),i}var lve=()=>{let[e,t]=x.useState(),n=dd(()=>new Map);return $u(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,i)=>{n.current.set(r,i),t({})}};function cve(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function bw({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(cve(t),{ref:t.ref},n(t.props.children)):n(t)}var uve={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function ww({className:e,...t}){return m.jsx("textarea",{"data-slot":"textarea",className:Ne("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function fve({className:e,...t}){return m.jsx("div",{"data-slot":"input-group",role:"group",className:Ne("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}const dve=Rg("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function hve({className:e,align:t="inline-start",...n}){return m.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ne(dve({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}function pve({className:e,...t}){return m.jsx(Th,{"data-slot":"command",className:Ne("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function mve({className:e,...t}){return m.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:m.jsxs(fve,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[m.jsx(Th.Input,{"data-slot":"command-input",className:Ne("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),m.jsx(hve,{children:m.jsx(ow,{className:"size-4 shrink-0 opacity-50"})})]})})}function gve({className:e,...t}){return m.jsx(Th.List,{"data-slot":"command-list",className:Ne("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function vve({className:e,...t}){return m.jsx(Th.Empty,{"data-slot":"command-empty",className:Ne("py-6 text-center text-sm",e),...t})}function yve({className:e,...t}){return m.jsx(Th.Group,{"data-slot":"command-group",className:Ne("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function xve({className:e,children:t,...n}){return m.jsxs(Th.Item,{"data-slot":"command-item",className:Ne("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",e),...n,children:[t,m.jsx(Aa,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function bve(e){return Bn({queryKey:["models",e??"all"],queryFn:()=>Xe(\`/models\${e?\`?engine=\${e}\`:""}\`),select:t=>t.data,staleTime:14400*1e3})}const wve={anthropic:"Anthropic",openai:"OpenAI",google:"Google",ollama:"Ollama (local)",openrouter:"OpenRouter",unknown:"Other"},Sve=["anthropic","openai","google","ollama","openrouter","unknown"];function Eve(e){const t={};for(const n of e){const r=n.provider;t[r]||(t[r]=[]),t[r].push(n)}for(const n of Object.values(t))n.sort((r,i)=>(i.context_window??0)-(r.context_window??0));return Sve.filter(n=>t[n]).map(n=>[n,t[n]])}function Cve(e){return e?e>=1e6?\`\${(e/1e6).toFixed(1)}M\`:e>=1e3?\`\${Math.round(e/1e3)}K\`:String(e):""}function gA({engine:e,value:t,onChange:n}){const{data:r,isLoading:i,isError:o}=bve(e),[a,l]=x.useState(!1);if(o)return m.jsx(en,{value:t,onChange:g=>n(g.target.value),placeholder:"Enter model ID",className:"h-10 w-full text-foreground"});const u=g=>g.engines[e]??g.id,f=r?.find(g=>u(g)===t||g.id===t),d=f?u(f):t||"Select a model",h=r?Eve(r):[];return m.jsxs(Fpe,{open:a,onOpenChange:l,children:[m.jsxs(Bpe,{role:"combobox","aria-expanded":a,className:Ne("flex h-10 w-full items-center justify-between rounded-lg border border-border bg-background px-2.5 text-sm text-foreground","hover:bg-muted dark:border-input dark:bg-input/30 dark:hover:bg-input/50"),children:[m.jsxs("span",{className:"truncate flex items-center gap-1.5",children:[d,f?.local&&m.jsx(an,{className:"bg-lime-400/15 text-lime-400 border-lime-400/30 text-[10px] px-1.5 py-0 h-4",children:"Local"})]}),m.jsx(xue,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),m.jsx($pe,{className:"w-80 p-0",align:"start",children:m.jsxs(pve,{children:[m.jsx(mve,{placeholder:"Search models..."}),m.jsxs(gve,{className:"max-h-[300px]",children:[m.jsx(vve,{children:i?"Loading models...":"No models found."}),h.map(([g,v])=>m.jsx(yve,{heading:wve[g]??g,children:v.map(b=>{const w=u(b),S=w===t||b.id===t,E=Cve(b.context_window);return m.jsxs(xve,{value:\`\${b.provider} \${b.id} \${w}\`,"data-checked":S||void 0,onSelect:()=>{n(w),l(!1)},className:"flex w-full items-center justify-between",children:[m.jsx("span",{className:"truncate flex-1 min-w-0",children:w}),m.jsxs("span",{className:"shrink-0 flex items-center gap-1.5 ml-2",children:[b.local&&m.jsx(an,{className:"bg-lime-400/15 text-lime-400 border-lime-400/30 text-[10px] px-1.5 py-0 h-4",children:"Local"}),E&&m.jsx("span",{className:"text-xs text-muted-foreground",children:E})]})]},\`\${b.provider}-\${b.id}\`)})},g))]})]})})]})}function _ve({open:e,onOpenChange:t}){const n=S8(),[r,i]=x.useState(""),[o,a]=x.useState("claude"),[l,u]=x.useState(Qd.claude[0]);async function f(){if(r.trim())try{await n.mutateAsync({name:r.trim(),engine:o,model:l}),i(""),qe.success("Agent created"),t(!1)}catch(d){const h=d?.body?.error?.message||(d instanceof Error?d.message:"Failed to create agent");qe.error(h)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New agent"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"My Agent",value:r,onChange:d=>i(d.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Engine"}),m.jsxs(To,{value:o,onValueChange:d=>{d&&(a(d),u(Qd[d]?.[0]??""))},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(jh,{})}),m.jsx(No,{children:uA.map(d=>m.jsx(ai,{value:d,children:d},d))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Model"}),m.jsx(gA,{engine:o,value:l,onChange:u})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:f,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Sc({title:e,description:t,actionLabel:n,onAction:r}){return m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:e}),m.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t})]}),n&&r&&m.jsxs(Fe,{variant:"secondary",size:"sm",onClick:r,className:"gap-1.5",children:[m.jsx(bc,{className:"size-3.5"}),n]})]})}function kve(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Ove(){const{data:e}=Hs(),t=Wde(),n=Bs(),r=u=>n({to:"/agents/$id",params:{id:u}}),[i,o]=x.useState(!1),[a,l]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Agents",description:"Create and manage autonomous agents.",actionLabel:"New agent",onAction:()=>o(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Model"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(u=>m.jsxs(yn,{className:"cursor-pointer",onClick:()=>r(u.id),children:[m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[u.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:u.name}),m.jsx(Ue,{className:"font-mono text-xs text-muted-foreground",children:u.model}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:kve(u.created_at)}),m.jsx(Ue,{onClick:f=>f.stopPropagation(),children:m.jsxs(D8,{children:[m.jsx(L8,{render:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground"}),children:m.jsx(i8,{className:"size-4"})}),m.jsxs(z8,{align:"end",children:[m.jsxs(gO,{onSelect:()=>setTimeout(()=>r(u.id),0),children:[m.jsx(o8,{className:"mr-2 size-3.5"})," Edit"]}),m.jsxs(gO,{className:"text-destructive",onSelect:()=>l({id:u.id,name:u.name}),children:[m.jsx(Mi,{className:"mr-2 size-3.5"})," Delete"]})]})]})})]},u.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No agents yet. Create one to get started."}),m.jsx(_ve,{open:i,onOpenChange:o}),m.jsx(bh,{open:!!a,onOpenChange:u=>!u&&l(null),children:m.jsxs(wh,{children:[m.jsxs(Sh,{children:[m.jsxs(Ch,{children:["Delete ",a?.name,"?"]}),m.jsx(_h,{children:"This action cannot be undone."})]}),m.jsxs(Eh,{children:[m.jsx(Oh,{children:"Cancel"}),m.jsx(kh,{variant:"destructive",onClick:()=>{a&&t.mutate(a.id),l(null)},children:"Delete"})]})]})})]})}const zq=x.createContext(void 0);function vA(){const e=x.useContext(zq);if(e===void 0)throw new Error(Xt(64));return e}let jve=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const yA={tabActivationDirection:e=>({[jve.activationDirection]:e})},Tve=x.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:o,orientation:a="horizontal",render:l,value:u,style:f,...d}=t,h=Object.hasOwn(t,"defaultValue"),g=x.useRef([]),[v,b]=x.useState(()=>new Map),[w,S]=zu({controlled:u,default:i,name:"Tabs",state:"value"}),E=u!==void 0,[k,O]=x.useState(()=>new Map),j=x.useCallback(R=>{if(R===void 0)return null;for(const[X,W]of k.entries())if(W!=null&&R===(W.value??W.index))return X;return null},[k]),[A,T]=x.useState(()=>({previousValue:w,tabActivationDirection:"none"})),{previousValue:N,tabActivationDirection:P}=A;let F=P,D=!1;N!==w&&(F=Az(N,w,a,k),D=N!=null&&w!=null&&j(w)==null);const q=D?N:w,L=N!==q||P!==F;Pe(()=>{L&&T({previousValue:q,tabActivationDirection:F})},[q,L,F]);const U=Le((R,X)=>{const W=Az(w,R,a,k);X.activationDirection=W,o?.(R,X),!X.isCanceled&&S(R)}),H=Le((R,X)=>{b(W=>{if(W.get(R)===X)return W;const Z=new Map(W);return Z.set(R,X),Z})}),B=Le((R,X)=>{b(W=>{if(!W.has(R)||W.get(R)!==X)return W;const Z=new Map(W);return Z.delete(R),Z})}),z=x.useCallback(R=>v.get(R),[v]),V=x.useCallback(R=>{for(const X of k.values())if(R===X?.value)return X?.id},[k]),Q=x.useMemo(()=>({getTabElementBySelectedValue:j,getTabIdByPanelValue:V,getTabPanelIdByValue:z,onValueChange:U,orientation:a,registerMountedTabPanel:H,setTabMap:O,unregisterMountedTabPanel:B,tabActivationDirection:F,value:w}),[j,V,z,U,a,H,O,B,F,w]),G=x.useMemo(()=>{for(const R of k.values())if(R!=null&&R.value===w)return R},[k,w]),I=x.useMemo(()=>{for(const R of k.values())if(R!=null&&!R.disabled)return R.value},[k]);Pe(()=>{if(E||k.size===0)return;const R=G?.disabled,X=G==null&&w!==null;if(h&&R&&w===i||!R&&!X)return;const Z=I??null;w!==Z&&(S(Z),T(oe=>oe.tabActivationDirection==="none"?oe:{...oe,tabActivationDirection:"none"}))},[i,I,h,E,G,S,k,w]);const $=vt("div",t,{state:{orientation:a,tabActivationDirection:F},ref:n,props:d,stateAttributesMapping:yA});return m.jsx(zq.Provider,{value:Q,children:m.jsx(Ig,{elementsRef:g,children:$})})});function Az(e,t,n,r){if(e==null||t==null)return"none";let i=null,o=null;for(const[u,f]of r.entries()){if(f==null)continue;const d=f.value??f.index;if(e===d&&(i=u),t===d&&(o=u),i!=null&&o!=null)break}if(i==null||o==null)return i!==o&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?n==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const a=i.getBoundingClientRect(),l=o.getBoundingClientRect();if(n==="horizontal"){if(l.left<a.left)return"left";if(l.left>a.left)return"right"}else{if(l.top<a.top)return"up";if(l.top>a.top)return"down"}return"none"}const Fq="data-composite-item-active",Bq=x.createContext(void 0);function Ave(){const e=x.useContext(Bq);if(e===void 0)throw new Error(Xt(65));return e}const Nve=x.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:o,value:a,id:l,nativeButton:u=!0,style:f,...d}=t,{value:h,getTabPanelIdByValue:g,orientation:v}=vA(),{activateOnFocus:b,highlightedTabIndex:w,onTabActivation:S,registerTabResizeObserverElement:E,setHighlightedTabIndex:k,tabsListElement:O}=Ave(),j=Br(l),A=x.useMemo(()=>({disabled:i,id:j,value:a}),[i,j,a]),{compositeProps:T,compositeRef:N,index:P}=P8({metadata:A}),F=a===h,D=x.useRef(!1),q=x.useRef(null);x.useEffect(()=>{const $=q.current;if($)return E($)},[E]),Pe(()=>{if(D.current){D.current=!1;return}if(!(F&&P>-1&&w!==P))return;const $=O;if($!=null){const R=Oi(jt($));if(R&<($,R))return}i||k(P)},[F,P,w,k,i,O]);const{getButtonProps:L,buttonRef:U}=Zo({disabled:i,native:u,focusableWhenDisabled:!0}),H=g(a),B=x.useRef(!1),z=x.useRef(!1);function V($){F||i||S(a,ct(Wo,$.nativeEvent,void 0,{activationDirection:"none"}))}function Q($){F||(P>-1&&!i&&k(P),!i&&b&&(!B.current||B.current&&z.current)&&S(a,ct(Wo,$.nativeEvent,void 0,{activationDirection:"none"})))}function G($){if(F||i)return;B.current=!0;function R(){B.current=!1,z.current=!1}(!$.button||$.button===0)&&(z.current=!0,jt($.currentTarget).addEventListener("pointerup",R,{once:!0}))}return vt("button",t,{state:{disabled:i,active:F,orientation:v},ref:[n,U,N,q],props:[T,{role:"tab","aria-controls":H,"aria-selected":F,id:j,onClick:V,onFocus:Q,onPointerDown:G,[Fq]:F?"":void 0,onKeyDownCapture(){D.current=!0}},d,L]})});let Rve=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=Ns.startingStyle]="startingStyle",e[e.endingStyle=Ns.endingStyle]="endingStyle",e})({});const Pve={...yA,...$s},Mve=x.forwardRef(function(t,n){const{className:r,value:i,render:o,keepMounted:a=!1,style:l,...u}=t,{value:f,getTabIdByPanelValue:d,orientation:h,tabActivationDirection:g,registerMountedTabPanel:v,unregisterMountedTabPanel:b}=vA(),w=Br(),S=x.useMemo(()=>({id:w,value:i}),[w,i]),{ref:E,index:k}=Mg({metadata:S}),O=i===f,{mounted:j,transitionStatus:A,setMounted:T}=ph(O),N=!j,P=d(i),F={hidden:N,orientation:h,tabActivationDirection:g,transitionStatus:A},D=x.useRef(null),q=vt("div",t,{state:F,ref:[n,E,D],props:[{"aria-labelledby":P,hidden:N,id:w,role:"tabpanel",tabIndex:O?0:-1,inert:Ag(!O),[Rve.index]:k},u],stateAttributesMapping:Pve});return Qo({open:O,ref:D,onComplete(){O||T(!1)}}),Pe(()=>{if(!(N&&!a)&&w!=null)return v(i,w),()=>{b(i,w)}},[N,a,i,w,v,b]),a||j?q:null}),Ive=[];function Dve(e){const{itemSizes:t,cols:n=1,loopFocus:r=!0,onLoop:i,dense:o=!1,orientation:a="both",direction:l,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:d,enableHomeAndEndKeys:h=!1,stopEventPropagation:g=!1,disabledIndices:v,modifierKeys:b=Ive}=e,[w,S]=x.useState(0),E=n>1,k=x.useRef(null),O=Po(k,d),j=x.useRef([]),A=x.useRef(!1),T=u??w,N=Le((q,L=!1)=>{if((f??S)(q),L){const U=j.current[q];JL(k.current,U,l,a)}}),P=Le(q=>{if(q.size===0||A.current)return;A.current=!0;const L=Array.from(q.keys()),U=L.find(B=>B?.hasAttribute(Fq))??null,H=U?L.indexOf(U):-1;H!==-1&&N(H),JL(k.current,U,l,a)}),F=Le((q,L,U)=>i?i?.(q,L,U,j):U),D=x.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:O,onFocus(q){const L=k.current,U=Sr(q.nativeEvent);!L||U==null||!ZL(U)||U.setSelectionRange(0,U.value.length??0)},onKeyDown(q){const L=h?Jfe:h8;if(!L.has(q.key)||Lve(q,b)||!k.current)return;const H=l==="rtl",B=H?Fu:ec,z={horizontal:B,vertical:vs,both:B}[a],V=H?ec:Fu,Q={horizontal:V,vertical:Jl,both:V}[a],G=Sr(q.nativeEvent);if(G!=null&&ZL(G)&&!mO(G)){const Z=G.selectionStart,oe=G.selectionEnd,ie=G.value??"";if(Z==null||q.shiftKey||Z!==oe||q.key!==Q&&Z<ie.length||q.key!==z&&Z>0)return}let I=T;const K=Dx(j,v),$=sO(j,v);if(E){const Z=t||Array.from({length:j.current.length},()=>({width:1,height:1})),oe=FU(Z,n,o),ie=oe.findIndex(se=>se!=null&&!Es(j.current,se,v)),J=oe.reduce((se,xe,ne)=>xe!=null&&!Es(j.current,xe,v)?ne:se,-1);I=oe[zU(oe.map(se=>se!=null?j.current[se]:null),{event:q,orientation:a,loopFocus:r,onLoop:F,cols:n,disabledIndices:$U([...v||j.current.map((se,xe)=>Es(j.current,xe)?xe:void 0),void 0],oe),minIndex:ie,maxIndex:J,prevIndex:BU(T>$?K:T,Z,oe,n,q.key===vs?"bl":q.key===ec?"tr":"tl"),rtl:H})]}const R={horizontal:[B],vertical:[vs],both:[B,vs]}[a],X={horizontal:[V],vertical:[Jl],both:[V,Jl]}[a],W=E?L:{horizontal:h?Qfe:f8,vertical:h?Zfe:d8,both:L}[a];h&&(q.key===vh?I=K:q.key===yh&&(I=$)),I===T&&(R.includes(q.key)||X.includes(q.key))&&(r&&I===$&&R.includes(q.key)?(I=K,i&&(I=i(q,T,I,j))):r&&I===K&&X.includes(q.key)?(I=$,i&&(I=i(q,T,I,j))):I=Kr(j.current,{startingIndex:I,decrement:X.includes(q.key),disabledIndices:v})),I!==T&&!zm(j.current,I)&&(g&&q.stopPropagation(),W.has(q.key)&&q.preventDefault(),N(I,!0),queueMicrotask(()=>{j.current[I]?.focus()}))}}),[n,o,l,v,j,h,T,E,t,r,i,F,O,b,N,a,g]);return x.useMemo(()=>({props:D,highlightedIndex:T,onHighlightedIndexChange:N,elementsRef:j,disabledIndices:v,onMapChange:P,relayKeyboardEvent:D.onKeyDown}),[D,T,N,j,v,P])}function Lve(e,t){for(const n of ide.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function zve(e){const{render:t,className:n,style:r,refs:i=sc,props:o=sc,state:a=Wn,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:d,dense:h,itemSizes:g,loopFocus:v,onLoop:b,cols:w,enableHomeAndEndKeys:S,onMapChange:E,stopEventPropagation:k=!0,rootRef:O,disabledIndices:j,modifierKeys:A,highlightItemOnHover:T=!1,tag:N="div",...P}=e,F=tf(),{props:D,highlightedIndex:q,onHighlightedIndexChange:L,elementsRef:U,onMapChange:H,relayKeyboardEvent:B}=Dve({itemSizes:g,cols:w,loopFocus:v,onLoop:b,dense:h,orientation:d,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:O,stopEventPropagation:k,enableHomeAndEndKeys:S,direction:F,disabledIndices:j,modifierKeys:A}),z=vt(N,e,{state:a,ref:i,props:[D,...o,P],stateAttributesMapping:l}),V=x.useMemo(()=>({highlightedIndex:q,onHighlightedIndexChange:L,highlightItemOnHover:T,relayKeyboardEvent:B}),[q,L,T,B]);return m.jsx(s8.Provider,{value:V,children:m.jsx(Ig,{elementsRef:U,onMapChange:Q=>{E?.(Q),H(Q)},children:z})})}const Fve=x.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:o=!0,render:a,style:l,...u}=t,{onValueChange:f,orientation:d,value:h,setTabMap:g,tabActivationDirection:v}=vA(),[b,w]=x.useState(0),[S,E]=x.useState(null),k=x.useRef(new Set),O=x.useRef(new Set),j=x.useRef(null),A=Le(()=>{k.current.forEach(L=>{L()})});x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const L=new ResizeObserver(()=>{k.current.size&&A()});return j.current=L,S&&L.observe(S),O.current.forEach(U=>{L.observe(U)}),()=>{L.disconnect(),j.current=null}},[S,A]);const T=Le(L=>(k.current.add(L),()=>{k.current.delete(L)})),N=Le(L=>(O.current.add(L),j.current?.observe(L),()=>{O.current.delete(L),j.current?.unobserve(L)})),P=Le((L,U)=>{L!==h&&f(L,U)}),F={orientation:d,tabActivationDirection:v},D={"aria-orientation":d==="vertical"?"vertical":void 0,role:"tablist"},q=x.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:b,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:N,onTabActivation:P,setHighlightedTabIndex:w,tabsListElement:S}),[r,b,T,N,P,w,S]);return m.jsx(Bq.Provider,{value:q,children:m.jsx(zve,{render:a,className:i,style:l,state:F,refs:[n,E],props:[D,u],stateAttributesMapping:yA,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:o,orientation:d,onHighlightedIndexChange:w,onMapChange:g,disabledIndices:sc})})});function Bve({className:e,orientation:t="horizontal",...n}){return m.jsx(Tve,{"data-slot":"tabs","data-orientation":t,className:Ne("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const $ve=Rg("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Uve({className:e,variant:t="default",...n}){return m.jsx(Fve,{"data-slot":"tabs-list","data-variant":t,className:Ne($ve({variant:t}),e),...n})}function ex({className:e,...t}){return m.jsx(Nve,{"data-slot":"tabs-trigger",className:Ne("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function tx({className:e,...t}){return m.jsx(Mve,{"data-slot":"tabs-content",className:Ne("flex-1 text-sm outline-none",e),...t})}const $q=x.createContext(void 0);function Hve(){const e=x.useContext($q);if(e===void 0)throw new Error(Xt(63));return e}let Nz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Uq={...YT,checked(e){return e?{[Nz.checked]:""}:{[Nz.unchecked]:""}}};function qve(e,t,n,r=!0,i){const[o,a]=x.useState(),l=Br(i?\`\${i}-label\`:void 0),u=e??t??o;return Pe(()=>{const f=e||t||!r?void 0:Vve(n.current,l);o!==f&&a(f)}),u}function Vve(e,t){const n=Kve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Kve(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const i=e.nextElementSibling;if(i&&i.htmlFor===n)return i}const r=e.labels;return r&&r[0]}const Yve=x.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:o,"aria-labelledby":a,form:l,id:u,inputRef:f,name:d,nativeButton:h=!1,onCheckedChange:g,readOnly:v=!1,required:b=!1,disabled:w=!1,render:S,uncheckedValue:E,value:k,style:O,...j}=t,{clearErrors:A}=l8(),{state:T,setTouched:N,setDirty:P,validityData:F,setFilled:D,setFocused:q,shouldValidateOnChange:L,validationMode:U,disabled:H,name:B,validation:z}=gh(),{labelId:V}=sw(),Q=H||w,G=B??d,I=Le(g),K=x.useRef(null),$=Po(K,f,z.inputRef),R=x.useRef(null),X=Br(),W=lw({id:u,implicit:!1,controlRef:R}),Z=h?void 0:W,[oe,ie]=zu({controlled:r,default:!!o,name:"Switch",state:"checked"});WT(R,{id:X,value:oe}),Pe(()=>{K.current&&D(K.current.checked)},[K,D]),JT(oe,()=>{A(G),P(oe!==F.initialValue),D(oe),L()?z.commit(oe):z.commit(oe,!0)});const{getButtonProps:J,buttonRef:se}=Zo({disabled:Q,native:h}),xe=qve(a,V,K,!h,Z),ne={id:h?W:X,role:"switch","aria-checked":oe,"aria-readonly":v||void 0,"aria-required":b||void 0,"aria-labelledby":xe,onFocus(){Q||q(!0)},onBlur(){const Ee=K.current;!Ee||Q||(N(!0),q(!1),U==="onBlur"&&z.commit(Ee.checked))},onClick(Ee){v||Q||(Ee.preventDefault(),K.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Ee.shiftKey,ctrlKey:Ee.ctrlKey,altKey:Ee.altKey,metaKey:Ee.metaKey})))}},ke=x.useMemo(()=>Mo({checked:oe,disabled:Q,form:l,id:Z,name:G,required:b,style:G?PU:hT,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:$,onChange(Ee){if(Ee.nativeEvent.defaultPrevented)return;if(v){Ee.preventDefault();return}const Oe=Ee.currentTarget.checked,Re=ct(Wo,Ee.nativeEvent);I?.(Oe,Re),!Re.isCanceled&&ie(Oe)},onFocus(){R.current?.focus()}},z.getInputValidationProps,k!==void 0?{value:k}:Wn),[oe,Q,l,$,Z,G,I,v,b,ie,z,k]),Ce=x.useMemo(()=>({...T,checked:oe,disabled:Q,readOnly:v,required:b}),[T,oe,Q,v,b]),Be=vt("span",t,{state:Ce,ref:[n,R,se],props:[ne,z.getValidationProps,j,J],stateAttributesMapping:Uq});return m.jsxs($q.Provider,{value:Ce,children:[Be,!oe&&G&&E!==void 0&&m.jsx("input",{type:"hidden",form:l,name:G,value:E}),m.jsx("input",{...ke,suppressHydrationWarning:!0})]})}),Wve=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{state:l}=gh(),u=Hve(),f={...l,...u};return vt("span",t,{state:f,ref:n,stateAttributesMapping:Uq,props:a})});function Rz({className:e,size:t="default",...n}){return m.jsx(Yve,{"data-slot":"switch","data-size":t,className:Ne("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:m.jsx(Wve,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function Gve({agent:e}){const t=Pg(),[n,r]=x.useState(e.name),[i,o]=x.useState(e.engine),[a,l]=x.useState(e.model),[u,f]=x.useState(e.system||""),[d,h]=x.useState(e.threads_enabled??!1),[g,v]=x.useState(e.confirmation_mode??!1),b=n!==e.name||i!==e.engine||a!==e.model||u!==(e.system||"")||d!==(e.threads_enabled??!1)||g!==(e.confirmation_mode??!1);async function w(){try{await t.mutateAsync({id:e.id,name:n,engine:i,model:a,system:u||void 0,threads_enabled:d,confirmation_mode:g}),qe.success("Agent updated")}catch{qe.error("Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-5",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{htmlFor:"agent-name",className:"text-sm text-foreground",children:"Name"}),m.jsx(en,{id:"agent-name",value:n,onChange:S=>r(S.target.value),className:"text-foreground"})]}),m.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Engine"}),m.jsxs(To,{value:i,onValueChange:S=>{S&&(o(S),l(Qd[S]?.[0]??""))},children:[m.jsx(Ao,{className:"text-foreground",children:m.jsx(jh,{})}),m.jsx(No,{children:uA.map(S=>m.jsx(ai,{value:S,children:S},S))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Model"}),m.jsx(gA,{engine:i,value:a,onChange:l})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{htmlFor:"agent-system",className:"text-sm text-foreground",children:"System Prompt"}),m.jsx(ww,{id:"agent-system",value:u,onChange:S=>f(S.target.value),placeholder:"Optional system prompt for the agent...",className:"min-h-[120px] text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-4 rounded-lg border p-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Threads Enabled"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow agent to spawn child sessions"})]}),m.jsx(Rz,{checked:d,onCheckedChange:h})]}),m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Confirmation Mode"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Require confirmation before executing tools"})]}),m.jsx(Rz,{checked:g,onCheckedChange:v})]})]}),m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:w,disabled:!b||t.isPending,children:t.isPending?"Saving...":"Save Changes"})})]})}function fi({className:e,size:t="default",...n}){return m.jsx("div",{"data-slot":"card","data-size":t,className:Ne("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function _s({className:e,...t}){return m.jsx("div",{"data-slot":"card-header",className:Ne("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",e),...t})}function ks({className:e,...t}){return m.jsx("div",{"data-slot":"card-title",className:Ne("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function Xve({className:e,...t}){return m.jsx("div",{"data-slot":"card-description",className:Ne("text-sm text-muted-foreground",e),...t})}function Lr({className:e,...t}){return m.jsx("div",{"data-slot":"card-content",className:Ne("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Qve({className:e,...t}){return m.jsx("div",{"data-slot":"card-footer",className:Ne("flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",e),...t})}const Hq=x.createContext(void 0);function Sw(){const e=x.useContext(Hq);if(e===void 0)throw new Error(Xt(53));return e}let wb=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const nx=500,Pz=16;function Co(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[\`\${t}InlineStart\`])*2:parseFloat(r[\`\${t}\${i}Start\`])+parseFloat(r[\`\${t}\${i}End\`])}let Zve=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),Jf=(function(e){return e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const xA={hasOverflowX:e=>e?{[Jf.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Jf.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Jf.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Jf.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Jf.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Jf.overflowYEnd]:""}:null,cornerHidden:()=>null},Jve={x:0,y:0},Mz={width:0,height:0},eye={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},tye={x:!0,y:!0,corner:!0},nye=x.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:o,style:a,...l}=t,u=rye(o),f=Br(),d=Fn(),h=Fn(),{nonce:g,disableStyleElements:v}=Y8(),[b,w]=x.useState(!1),[S,E]=x.useState(!1),[k,O]=x.useState(!1),[j,A]=x.useState(!1),[T,N]=x.useState(!1),[P,F]=x.useState(Mz),[D,q]=x.useState(Mz),[L,U]=x.useState(eye),[H,B]=x.useState(tye),z=x.useRef(null),V=x.useRef(null),Q=x.useRef(null),G=x.useRef(null),I=x.useRef(null),K=x.useRef(null),$=x.useRef(null),R=x.useRef(!1),X=x.useRef(0),W=x.useRef(0),Z=x.useRef(0),oe=x.useRef(0),ie=x.useRef("vertical"),J=x.useRef(Jve),se=Le(_e=>{const de=_e.x-J.current.x,be=_e.y-J.current.y;J.current=_e,be!==0&&(O(!0),d.start(nx,()=>{O(!1)})),de!==0&&(E(!0),h.start(nx,()=>{E(!1)}))}),xe=Le(_e=>{_e.button===0&&(R.current=!0,X.current=_e.clientY,W.current=_e.clientX,ie.current=_e.currentTarget.getAttribute(Zve.orientation),V.current&&(Z.current=V.current.scrollTop,oe.current=V.current.scrollLeft),I.current&&ie.current==="vertical"&&I.current.setPointerCapture(_e.pointerId),K.current&&ie.current==="horizontal"&&K.current.setPointerCapture(_e.pointerId))}),ne=Le(_e=>{if(!R.current)return;const de=_e.clientY-X.current,be=_e.clientX-W.current;if(V.current){const ve=V.current.scrollHeight,pe=V.current.clientHeight,Ae=V.current.scrollWidth,ae=V.current.clientWidth;if(I.current&&Q.current&&ie.current==="vertical"){const me=Co(Q.current,"padding","y"),De=Co(I.current,"margin","y"),$e=I.current.offsetHeight,Ve=Q.current.offsetHeight-$e-me-De,dt=de/Ve;V.current.scrollTop=Z.current+dt*(ve-pe),_e.preventDefault(),O(!0),d.start(nx,()=>{O(!1)})}if(K.current&&G.current&&ie.current==="horizontal"){const me=Co(G.current,"padding","x"),De=Co(K.current,"margin","x"),$e=K.current.offsetWidth,Ve=G.current.offsetWidth-$e-me-De,dt=be/Ve;V.current.scrollLeft=oe.current+dt*(Ae-ae),_e.preventDefault(),E(!0),h.start(nx,()=>{E(!1)})}}}),ke=Le(_e=>{R.current=!1,I.current&&ie.current==="vertical"&&I.current.releasePointerCapture(_e.pointerId),K.current&&ie.current==="horizontal"&&K.current.releasePointerCapture(_e.pointerId)});function Ce(_e){A(_e.pointerType==="touch")}function Be(_e){if(Ce(_e),_e.pointerType!=="touch"){const de=lt(z.current,_e.target);w(de)}}const Ee=x.useMemo(()=>({scrolling:S||k,hasOverflowX:!H.x,hasOverflowY:!H.y,overflowXStart:L.xStart,overflowXEnd:L.xEnd,overflowYStart:L.yStart,overflowYEnd:L.yEnd,cornerHidden:H.corner}),[S,k,H.x,H.y,H.corner,L]),Oe={role:"presentation",onPointerEnter:Be,onPointerMove:Be,onPointerDown:Ce,onPointerLeave(){w(!1)},style:{position:"relative",[wb.scrollAreaCornerHeight]:\`\${P.height}px\`,[wb.scrollAreaCornerWidth]:\`\${P.width}px\`}},Re=vt("div",t,{state:Ee,ref:[n,z],props:[Oe,l],stateAttributesMapping:xA}),je=x.useMemo(()=>({handlePointerDown:xe,handlePointerMove:ne,handlePointerUp:ke,handleScroll:se,cornerSize:P,setCornerSize:F,thumbSize:D,setThumbSize:q,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:N,touchModality:j,cornerRef:$,scrollingX:S,setScrollingX:E,scrollingY:k,setScrollingY:O,hovering:b,setHovering:w,viewportRef:V,rootRef:z,scrollbarYRef:Q,scrollbarXRef:G,thumbYRef:I,thumbXRef:K,rootId:f,hiddenState:H,setHiddenState:B,overflowEdges:L,setOverflowEdges:U,viewportState:Ee,overflowEdgeThreshold:u}),[xe,ne,ke,se,P,D,T,j,S,E,k,O,b,w,f,H,L,Ee,u]);return m.jsxs(Hq.Provider,{value:je,children:[!v&&Bm.getElement(g),Re]})});function rye(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const iye=x.createContext(void 0);let Kl=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),Iz=!1;function oye(){Iz||R0||(typeof CSS<"u"&&"registerProperty"in CSS&&[Kl.scrollAreaOverflowXStart,Kl.scrollAreaOverflowXEnd,Kl.scrollAreaOverflowYStart,Kl.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),Iz=!0)}const aye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{viewportRef:l,scrollbarYRef:u,scrollbarXRef:f,thumbYRef:d,thumbXRef:h,cornerRef:g,cornerSize:v,setCornerSize:b,setThumbSize:w,rootId:S,setHiddenState:E,hiddenState:k,setHasMeasuredScrollbar:O,handleScroll:j,setHovering:A,setOverflowEdges:T,overflowEdges:N,overflowEdgeThreshold:P,scrollingX:F,scrollingY:D}=Sw(),q=tf(),L=x.useRef(!0),U=x.useRef([NaN,NaN,NaN,NaN]),H=Fn(),B=Fn(),z=Le(()=>{const $=l.current,R=u.current,X=f.current,W=d.current,Z=h.current,oe=g.current;if(!$)return;const ie=$.scrollHeight,J=$.scrollWidth,se=$.clientHeight,xe=$.clientWidth,ne=$.scrollTop,ke=$.scrollLeft,Ce=U.current,Be=Number.isNaN(Ce[0]);if(Ce[0]=se,Ce[1]=ie,Ce[2]=xe,Ce[3]=J,Be&&O(!0),ie===0||J===0)return;const Ee=sye($),Oe=Ee.y,Re=Ee.x,je=xe/J,_e=se/ie,de=Math.max(0,J-xe),be=Math.max(0,ie-se);let ve=0,pe=0;if(!Re){let ht=0;q==="rtl"?ht=va(-ke,0,de):ht=va(ke,0,de),ve=Xd(ht,de),pe=de-ve}const Ae=Oe?0:va(ne,0,be),ae=Oe?0:Xd(Ae,be),me=Oe?0:be-ae,De=Re?0:xe,$e=Oe?0:se;let Ve=0,dt=0;!Re&&!Oe&&(Ve=R?.offsetWidth||0,dt=X?.offsetHeight||0);const ze=v.width===0&&v.height===0,Ke=ze?Ve:0,tt=ze?dt:0,Tt=Co(X,"padding","x"),yt=Co(R,"padding","y"),Wt=Co(Z,"margin","x"),nt=Co(W,"margin","y"),Rt=De-Tt-Wt,zt=$e-yt-nt,Gt=X?Math.min(X.offsetWidth-Ke,Rt):Rt,Dn=R?Math.min(R.offsetHeight-tt,zt):zt,Qt=Math.max(Pz,Gt*je),Ze=Math.max(Pz,Dn*_e);if(w(ht=>ht.height===Ze&&ht.width===Qt?ht:{width:Qt,height:Ze}),R&&W){const ht=R.offsetHeight-Ze-yt-nt,En=ie-se,Bt=En===0?0:ne/En,rn=Math.min(ht,Math.max(0,Bt*ht));W.style.transform=\`translate3d(0,\${rn}px,0)\`}if(X&&Z){const ht=X.offsetWidth-Qt-Tt-Wt,En=J-xe,Bt=En===0?0:ke/En,rn=q==="rtl"?va(Bt*ht,-ht,0):va(Bt*ht,0,ht);Z.style.transform=\`translate3d(\${rn}px,0,0)\`}const At=[[Kl.scrollAreaOverflowXStart,ve],[Kl.scrollAreaOverflowXEnd,pe],[Kl.scrollAreaOverflowYStart,ae],[Kl.scrollAreaOverflowYEnd,me]];for(const[ht,En]of At)$.style.setProperty(ht,\`\${En}px\`);oe&&(Re||Oe?b({width:0,height:0}):!Re&&!Oe&&b({width:Ve,height:dt})),E(ht=>lye(ht,Ee));const Ft={xStart:!Re&&ve>P.xStart,xEnd:!Re&&pe>P.xEnd,yStart:!Oe&&ae>P.yStart,yEnd:!Oe&&me>P.yEnd};T(ht=>ht.xStart===Ft.xStart&&ht.xEnd===Ft.xEnd&&ht.yStart===Ft.yStart&&ht.yEnd===Ft.yEnd?ht:Ft)});Pe(()=>{l.current&&oye()},[l]),Pe(()=>{queueMicrotask(z)},[z,k,q]),Pe(()=>{l.current?.matches(":hover")&&A(!0)},[l,A]),x.useEffect(()=>{const $=l.current;if(typeof ResizeObserver>"u"||!$)return;let R=!1;const X=new ResizeObserver(()=>{if(!R){R=!0;const W=U.current;if(W[0]===$.clientHeight&&W[1]===$.scrollHeight&&W[2]===$.clientWidth&&W[3]===$.scrollWidth)return}z()});return X.observe($),B.start(0,()=>{const W=$.getAnimations({subtree:!0});W.length!==0&&Promise.allSettled(W.map(Z=>Z.finished)).then(z).catch(()=>{})}),()=>{X.disconnect(),B.clear()}},[z,l,B]);function V(){L.current=!1}const Q={role:"presentation",...S&&{"data-id":\`\${S}-viewport\`},tabIndex:k.x&&k.y?-1:0,className:Bm.className,style:{overflow:"scroll"},onScroll(){l.current&&(z(),L.current||j({x:l.current.scrollLeft,y:l.current.scrollTop}),H.start(100,()=>{L.current=!0}))},onWheel:V,onTouchMove:V,onPointerMove:V,onPointerEnter:V,onKeyDown:V},G=x.useMemo(()=>({scrolling:F||D,hasOverflowX:!k.x,hasOverflowY:!k.y,overflowXStart:N.xStart,overflowXEnd:N.xEnd,overflowYStart:N.yStart,overflowYEnd:N.yEnd,cornerHidden:k.corner}),[F,D,k.x,k.y,k.corner,N]),I=vt("div",t,{ref:[n,l],state:G,props:[Q,a],stateAttributesMapping:xA}),K=x.useMemo(()=>({computeThumbPosition:z}),[z]);return m.jsx(iye.Provider,{value:K,children:I})});function sye(e){const t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function lye(e,t){return e.y===t.y&&e.x===t.x&&e.corner===t.corner?e:t}const qq=x.createContext(void 0);function cye(){const e=x.useContext(qq);if(e===void 0)throw new Error(Xt(54));return e}let Sb=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const uye=x.forwardRef(function(t,n){const{render:r,className:i,orientation:o="vertical",keepMounted:a=!1,style:l,...u}=t,{hovering:f,scrollingX:d,scrollingY:h,hiddenState:g,overflowEdges:v,scrollbarYRef:b,scrollbarXRef:w,viewportRef:S,thumbYRef:E,thumbXRef:k,handlePointerDown:O,handlePointerUp:j,rootId:A,thumbSize:T,hasMeasuredScrollbar:N}=Sw(),P={hovering:f,scrolling:{horizontal:d,vertical:h}[o],orientation:o,hasOverflowX:!g.x,hasOverflowY:!g.y,overflowXStart:v.xStart,overflowXEnd:v.xEnd,overflowYStart:v.yStart,overflowYEnd:v.yEnd,cornerHidden:g.corner},F=tf(),D=!N&&!a;x.useEffect(()=>{const z=S.current,V=o==="vertical"?b.current:w.current;if(!V)return;function Q(G){if(!(!z||!V||G.ctrlKey)){if(G.preventDefault(),o==="vertical"){if(z.scrollTop===0&&G.deltaY<0)return}else if(z.scrollLeft===0&&G.deltaX<0)return;if(o==="vertical"){if(z.scrollTop===z.scrollHeight-z.clientHeight&&G.deltaY>0)return}else if(z.scrollLeft===z.scrollWidth-z.clientWidth&&G.deltaX>0)return;o==="vertical"?z.scrollTop+=G.deltaY:z.scrollLeft+=G.deltaX}}return kt(V,"wheel",Q,{passive:!1})},[o,w,b,S]);const q={...A&&{"data-id":\`\${A}-scrollbar\`},onPointerDown(z){if(z.button!==0)return;const V=Sr(z.nativeEvent),Q=o==="vertical"?E.current:k.current;if(!(Q&<(Q,V))&&S.current){if(E.current&&b.current&&o==="vertical"){const G=Co(E.current,"margin","y"),I=Co(b.current,"padding","y"),K=E.current.offsetHeight,$=b.current.getBoundingClientRect(),R=z.clientY-$.top-K/2-I+G/2,X=S.current.scrollHeight,W=S.current.clientHeight,Z=b.current.offsetHeight-K-I-G,ie=R/Z*(X-W);S.current.scrollTop=ie}if(k.current&&w.current&&o==="horizontal"){const G=Co(k.current,"margin","x"),I=Co(w.current,"padding","x"),K=k.current.offsetWidth,$=w.current.getBoundingClientRect(),R=z.clientX-$.left-K/2-I+G/2,X=S.current.scrollWidth,W=S.current.clientWidth,Z=w.current.offsetWidth-K-I-G,oe=R/Z;let ie;F==="rtl"?(ie=(1-oe)*(X-W),S.current.scrollLeft<=0&&(ie=-ie)):ie=oe*(X-W),S.current.scrollLeft=ie}O(z)}},onPointerUp:j,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:D?"hidden":void 0,...o==="vertical"&&{top:0,bottom:\`var(\${wb.scrollAreaCornerHeight})\`,insetInlineEnd:0,[Sb.scrollAreaThumbHeight]:\`\${T.height}px\`},...o==="horizontal"&&{insetInlineStart:0,insetInlineEnd:\`var(\${wb.scrollAreaCornerWidth})\`,bottom:0,[Sb.scrollAreaThumbWidth]:\`\${T.width}px\`}}},L=vt("div",t,{ref:[n,o==="vertical"?b:w],state:P,props:[q,u],stateAttributesMapping:xA}),U=x.useMemo(()=>({orientation:o}),[o]),H=o==="vertical"?g.y:g.x;return a||!H?m.jsx(qq.Provider,{value:U,children:L}):null}),fye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{thumbYRef:l,thumbXRef:u,handlePointerDown:f,handlePointerMove:d,handlePointerUp:h,setScrollingX:g,setScrollingY:v,hasMeasuredScrollbar:b}=Sw(),{orientation:w}=cye();return vt("div",t,{ref:[n,w==="vertical"?l:u],state:{orientation:w},props:[{onPointerDown:f,onPointerMove:d,onPointerUp(k){w==="vertical"&&v(!1),w==="horizontal"&&g(!1),h(k)},style:{visibility:b?void 0:"hidden",...w==="vertical"&&{height:\`var(\${Sb.scrollAreaThumbHeight})\`},...w==="horizontal"&&{width:\`var(\${Sb.scrollAreaThumbWidth})\`}}},a]})}),dye=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{cornerRef:l,cornerSize:u,hiddenState:f}=Sw(),d=vt("div",t,{ref:[n,l],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:u.width,height:u.height}},a]});return f.corner?null:d});function Vq({className:e,children:t,...n}){return m.jsxs(nye,{"data-slot":"scroll-area",className:Ne("relative",e),...n,children:[m.jsx(aye,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),m.jsx(hye,{}),m.jsx(dye,{})]})}function hye({className:e,orientation:t="vertical",...n}){return m.jsx(uye,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ne("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...n,children:m.jsx(fye,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function pye(e){const t=/^name:\\s*(.+)$/m.exec(e);if(t)return t[1].trim();const n=e.match(/^#\\s+(.+)$/m);return n?n[1].trim().toLowerCase().replace(/\\s+/g,"-"):null}async function bA(e){const t=e.indexOf("@");let n,r,i;if(t!==-1){const a=e.slice(0,t);i=e.slice(t+1),[n,r]=a.split("/")}else{const a=e.split("/");n=a[0],r=a[1]}if(!n||!r)throw new Error("Invalid format. Use owner/repo or owner/repo@skill-name");const o=i?[\`https://raw.githubusercontent.com/\${n}/\${r}/main/skills/\${i}/SKILL.md\`,\`https://raw.githubusercontent.com/\${n}/\${r}/main/\${i}/SKILL.md\`]:[\`https://raw.githubusercontent.com/\${n}/\${r}/main/SKILL.md\`,\`https://raw.githubusercontent.com/\${n}/\${r}/main/skills/SKILL.md\`];for(const a of o)try{const l=await fetch(a);if(l.ok){const u=await l.text();return{name:i||pye(u)||r,source:e,content:u,installed_at:new Date().toISOString()}}}catch{continue}throw new Error(\`Could not find SKILL.md for "\${e}"\`)}function mye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function gye(e){return e>=1e6?\`\${(e/1e6).toFixed(1)}M\`:e>=1e3?\`\${(e/1e3).toFixed(1)}k\`:String(e)}function vye({agent:e}){const t=Pg(),[n,r]=x.useState(!1),[i,o]=x.useState(null),a=e.skills??[],[l,u]=x.useState(""),[f,d]=x.useState(""),[h,g]=x.useState("allTime"),[v,b]=x.useState(null),[w,S]=x.useState(null),[E,k]=x.useState(!1),[O,j]=x.useState([]),[A,T]=x.useState(null);x.useEffect(()=>{const U=setTimeout(()=>d(l),300);return()=>clearTimeout(U)},[l]),x.useEffect(()=>{Xe("/skills/sources?limit=20").then(U=>j(U.data??[])).catch(()=>{})},[]),x.useEffect(()=>{Xe("/skills/stats").then(T).catch(()=>{})},[]);const N=x.useCallback((U=0)=>{k(!0);const H=new URLSearchParams;f&&H.set("q",f),v&&H.set("source",v),H.set("sort",h),H.set("limit","30"),H.set("offset",String(U)),Xe(\`/skills?\${H}\`).then(B=>{S(U===0?B:z=>z?{...B,skills:[...z.skills,...B.skills]}:B)}).catch(()=>{}).finally(()=>k(!1))},[f,v,h]);x.useEffect(()=>{N(0)},[N]);async function P(U){try{await t.mutateAsync({id:e.id,skills:a.filter(H=>H.name!==U)}),qe.success(\`Removed skill "\${U}"\`)}catch{qe.error("Failed to remove skill")}}async function F(U){try{await t.mutateAsync({id:e.id,skills:[...a,U]}),qe.success(\`Installed skill "\${U.name}"\`),r(!1)}catch{qe.error("Failed to install skill")}}async function D(U){if(a.some(H=>H.name===U.title)){qe.error(\`Skill "\${U.title}" is already installed\`);return}o(U.id);try{const H=U.id.split("/");let B;H.length>=3?B=\`\${H[0]}/\${H[1]}@\${H.slice(2).join("/")}\`:B=U.id;const z=await bA(B);await F(z)}catch(H){qe.error(H instanceof Error?H.message:"Failed to install skill")}finally{o(null)}}const q=new Set(a.map(U=>U.name)),L=w&&w.offset+w.skills.length<w.total;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("div",{children:[m.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Installed Skills (",a.length,")"]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Give your agent domain expertise with skill files."})]}),m.jsxs(Fe,{variant:"outline",size:"sm",className:"gap-1.5 text-foreground",onClick:()=>r(!0),children:[m.jsx(bc,{className:"size-3.5"}),"Add from GitHub"]})]}),a.length===0?m.jsx("div",{className:"rounded-lg border border-dashed p-6 text-center",children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No skills installed. Browse the catalog below or add from GitHub."})}):m.jsx("div",{className:"grid gap-3",children:a.map(U=>m.jsxs(fi,{children:[m.jsx(_s,{className:"pb-2",children:m.jsxs("div",{className:"flex items-start justify-between",children:[m.jsxs("div",{children:[m.jsx(ks,{className:"text-sm",children:U.name}),m.jsx(Xve,{className:"font-mono text-xs",children:U.source})]}),U.installed_at&&m.jsx("span",{className:"text-xs text-muted-foreground",children:mye(U.installed_at)})]})}),m.jsx(Lr,{className:"pb-2",children:m.jsxs("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground max-h-32 overflow-y-auto whitespace-pre-wrap",children:[U.content.slice(0,500),U.content.length>500?"...":""]})}),m.jsx(Qve,{children:m.jsxs(Fe,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>P(U.name),children:[m.jsx(Mi,{className:"mr-1.5 size-3.5"}),"Remove"]})})]},U.name))}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"flex items-center justify-between",children:m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:"Skills Catalog"}),A&&A.indexLoaded&&m.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[A.totalSkills.toLocaleString()," skills from"," ",A.totalOwners.toLocaleString()," authors"]})]})}),m.jsxs("div",{className:"relative",children:[m.jsx(ow,{className:"absolute left-2.5 top-2.5 size-3.5 text-muted-foreground"}),m.jsx(en,{placeholder:"Search 72k+ skills...",value:l,onChange:U=>u(U.target.value),className:"h-9 pl-8 text-sm text-foreground"})]}),m.jsx("div",{className:"flex flex-col gap-2",children:m.jsx("div",{className:"flex gap-1.5",children:["allTime","trending","hot","newest"].map(U=>m.jsx("button",{onClick:()=>g(U),className:\`rounded-full px-2.5 py-0.5 text-[11px] font-medium transition-colors \${h===U?"bg-lime-400/20 text-lime-400":"bg-muted text-muted-foreground hover:text-foreground"}\`,children:U==="allTime"?"All Time":U==="trending"?"Trending":U==="hot"?"Hot":"Newest"},U))})}),w&&m.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[w.total.toLocaleString()," results",E&&" \xB7 Loading..."]}),m.jsx("div",{className:"grid grid-cols-2 gap-2",children:w?.skills.map(U=>{const H=q.has(U.title),B=i===U.id,z=h==="trending"?U.installsTrending:h==="hot"?U.installsHot:U.installsAllTime;return m.jsxs("button",{disabled:H||B,onClick:()=>D(U),className:\`flex flex-col items-start gap-1 rounded-lg border px-3 py-2.5 text-left transition-colors \${H?"border-lime-400/30 bg-lime-400/5 opacity-60":"border-border hover:border-muted-foreground/50"}\`,children:[m.jsxs("div",{className:"flex items-center gap-2 w-full",children:[m.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:U.title}),m.jsxs(an,{variant:"outline",className:"ml-auto shrink-0 text-[10px] px-1.5 py-0",children:[m.jsx(Wd,{className:"size-2.5 mr-0.5"}),gye(z)]})]}),m.jsx("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:U.source}),H&&m.jsx("span",{className:"text-[10px] text-lime-400",children:"Installed"}),B&&m.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Installing..."})]},U.id)})}),L&&m.jsxs(Fe,{variant:"outline",size:"sm",className:"mx-auto gap-1.5 text-foreground",onClick:()=>N(w.offset+w.skills.length),disabled:E,children:[m.jsx(Ng,{className:"size-3.5"}),E?"Loading...":"Load more"]}),w&&w.skills.length===0&&!E&&m.jsxs("p",{className:"py-4 text-center text-xs text-muted-foreground",children:["No skills found",l?\` for "\${l}"\`:""]})]}),m.jsx(yye,{open:n,onOpenChange:r,existingNames:a.map(U=>U.name),onInstall:F})]})}function yye({open:e,onOpenChange:t,existingNames:n,onInstall:r}){const[i,o]=x.useState(""),[a,l]=x.useState(!1),[u,f]=x.useState(null),[d,h]=x.useState("");function g(){o(""),f(null),h(""),l(!1)}async function v(){h(""),f(null),l(!0);try{const b=await bA(i.trim());n.includes(b.name)?h(\`Skill "\${b.name}" is already installed\`):f(b)}catch(b){h(b instanceof Error?b.message:"Failed to fetch skill")}finally{l(!1)}}return m.jsx(ea,{open:e,onOpenChange:b=>{b||g(),t(b)},children:m.jsxs(za,{className:"max-w-lg border-border bg-card",children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"Add Skill from GitHub"})}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"GitHub Source"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(en,{placeholder:"owner/repo or owner/repo@skill-name",value:i,onChange:b=>o(b.target.value),className:"flex-1 text-foreground",onKeyDown:b=>{b.key==="Enter"&&i.trim()&&v()}}),m.jsx(Fe,{variant:"outline",className:"text-foreground",onClick:v,disabled:!i.trim()||a,children:a?"Fetching...":"Fetch"})]}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetches SKILL.md from the GitHub repository"})]}),d&&m.jsx("p",{className:"text-sm text-destructive",children:d}),u&&m.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border p-4",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-sm font-medium text-foreground",children:u.name}),m.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:u.source})]}),m.jsx(Vq,{className:"max-h-48",children:m.jsxs("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground whitespace-pre-wrap",children:[u.content.slice(0,2e3),u.content.length>2e3?\`
|
|
217514
217592
|
...\`:""]})}),m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:()=>r(u),children:"Install Skill"})]})]})]})})}function xye({agent:e}){const t=Pg(),[n,r]=x.useState(e.webhook_url||""),[i,o]=x.useState((e.webhook_events??[]).join(", ")),[a,l]=x.useState((e.callable_agents??[]).join(", ")),u=n!==(e.webhook_url||"")||i!==(e.webhook_events??[]).join(", ")||a!==(e.callable_agents??[]).join(", ");async function f(){try{await t.mutateAsync({id:e.id,webhook_url:n||void 0,webhook_events:i?i.split(",").map(d=>d.trim()).filter(Boolean):void 0,callable_agents:a?a.split(",").map(d=>d.trim()).filter(Boolean):void 0}),qe.success("Agent updated")}catch{qe.error("Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[e.tools&&e.tools.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Tools"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.tools.map((d,h)=>m.jsx(an,{variant:"outline",className:"text-xs",children:typeof d=="string"?d:d?.name??JSON.stringify(d)},h))})]}),e.mcp_servers&&e.mcp_servers.length>0&&m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"MCP Servers"}),m.jsx("pre",{className:"rounded bg-muted p-3 text-xs text-muted-foreground max-h-48 overflow-y-auto",children:JSON.stringify(e.mcp_servers,null,2)})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Webhook"}),m.jsx(en,{placeholder:"https://example.com/webhook",value:n,onChange:d=>r(d.target.value),className:"text-foreground"}),m.jsx(en,{placeholder:"Events (comma-separated): session.created, turn.complete",value:i,onChange:d=>o(d.target.value),className:"text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-sm text-foreground",children:"Callable Agents"}),m.jsx(en,{placeholder:"Agent IDs (comma-separated)",value:a,onChange:d=>l(d.target.value),className:"text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents this agent can spawn as child sessions"})]}),u&&m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:f,disabled:t.isPending,children:t.isPending?"Saving...":"Save Changes"})})]})}function bye({agent:e}){const t=Pg(),[n,r]=x.useState("");x.useEffect(()=>{const o={};for(const[a,l]of Object.entries(e))["id","created_at","updated_at","version"].includes(a)||(o[a]=l);r(JSON.stringify(o,null,2))},[e]);async function i(){try{const o=JSON.parse(n);await t.mutateAsync({id:e.id,...o}),qe.success("Agent updated")}catch(o){qe.error(o instanceof SyntaxError?"Invalid JSON":"Failed to update agent")}}return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("p",{className:"text-xs text-muted-foreground",children:"Edit the full agent configuration as JSON."}),m.jsx(ww,{value:n,onChange:o=>r(o.target.value),className:"min-h-[400px] font-mono text-xs text-foreground leading-relaxed border-border bg-muted focus-visible:ring-ring"}),m.jsx("div",{className:"flex justify-end",children:m.jsx(Fe,{className:"bg-cta-gradient text-black font-medium hover:opacity-90",onClick:i,disabled:t.isPending,children:t.isPending?"Saving...":"Save"})})]})}function wye(){const e=bn(i=>i.selectedAgentId),t=Bs(),{data:n,isLoading:r}=tA(e);return r||!n?null:m.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center gap-3 border-b px-6 py-3",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>t({to:"/agents"}),children:m.jsx(QH,{className:"size-4"})}),m.jsxs("div",{className:"flex-1",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:n.name}),m.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.engine," / ",n.model]})]}),m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsx("div",{children:m.jsxs(Bve,{defaultValue:"config",children:[m.jsxs(Uve,{children:[m.jsx(ex,{value:"config",children:"Config"}),m.jsx(ex,{value:"skills",children:"Skills"}),m.jsx(ex,{value:"advanced",children:"Advanced"}),m.jsx(ex,{value:"edit",children:"Edit"})]}),m.jsx(tx,{value:"config",className:"mt-6",children:m.jsx(Gve,{agent:n})}),m.jsx(tx,{value:"skills",className:"mt-6",children:m.jsx(vye,{agent:n})}),m.jsx(tx,{value:"advanced",className:"mt-6",children:m.jsx(xye,{agent:n})}),m.jsx(tx,{value:"edit",className:"mt-6",children:m.jsx(bye,{agent:n})})]})})})]})}const Sye={SPRITE_TOKEN:"sprite_token",E2B_API_KEY:"e2b_api_key",VERCEL_TOKEN:"vercel_token",DAYTONA_API_KEY:"daytona_api_key",FLY_API_TOKEN:"fly_api_token",MODAL_TOKEN_ID:"modal_token_id"};function Eye({open:e,onOpenChange:t}){const n=E8(),[r,i]=x.useState(""),[o,a]=x.useState("docker"),[l,u]=x.useState(""),f=Q8[o],d=!!f;async function h(){if(r.trim())try{if(d&&l.trim()){const g=Sye[f.key];g&&await Xe("/settings",{method:"PUT",body:JSON.stringify({key:g,value:l.trim()})})}await n.mutateAsync({name:r.trim(),config:{provider:o}}),i(""),u(""),qe.success("Environment created"),t(!1)}catch(g){const b=g?.body?.error?.message||(g instanceof Error?g.message:"Failed to create");qe.error(b)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"Add environment"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:r,onChange:g=>i(g.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Provider"}),m.jsxs(To,{value:o,onValueChange:g=>{g&&(a(g),u(""))},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(jh,{})}),m.jsxs(No,{children:[m.jsxs(fz,{children:[m.jsx(dz,{children:"Local"}),$m.map(g=>m.jsx(ai,{value:g,children:g},g))]}),m.jsxs(fz,{children:[m.jsx(dz,{children:"Cloud"}),Tu.map(g=>m.jsx(ai,{value:g,children:g},g))]})]})]})]}),d&&m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:f.label}),m.jsx(en,{type:"password",placeholder:f.placeholder,value:l,onChange:g=>u(g.target.value),className:"w-full font-mono text-foreground"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Saved to server settings for provider access."})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:h,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Cye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function _ye(){const{data:e}=rf(),t=Gde(),[n,r]=x.useState(!1);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Environments",description:"Configuration for containers and code execution.",actionLabel:"Add environment",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Provider"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(i=>m.jsxs(yn,{children:[m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[i.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:i.name}),m.jsx(Ue,{className:"font-mono text-xs text-muted-foreground",children:i.config?.provider||"unknown"}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:Ne("text-xs",i.state==="ready"?"border-lime-400/20 bg-lime-400/10 text-lime-400":"text-muted-foreground"),children:i.state})}),m.jsx(Ue,{className:"text-muted-foreground",children:Cye(i.created_at)}),m.jsx(Ue,{children:m.jsxs(D8,{children:[m.jsx(L8,{render:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground"}),children:m.jsx(i8,{className:"size-4"})}),m.jsx(z8,{align:"end",children:m.jsxs(gO,{className:"text-destructive",onSelect:()=>t.mutate(i.id),children:[m.jsx(Mi,{className:"mr-2 size-3.5"})," Delete"]})})]})})]},i.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No environments yet."}),m.jsx(Eye,{open:n,onOpenChange:r})]})}function wA(e){const t=e?\`/vaults?agent_id=\${e}&limit=50\`:"/vaults?limit=50";return Bn({queryKey:["vaults",e??"all"],queryFn:()=>Xe(t),select:n=>n.data})}function kye(e){return Bn({queryKey:["vaults",e,"entries"],queryFn:()=>Xe(\`/vaults/\${e}/entries\`),enabled:!!e,select:t=>t.data})}function Kq(){const e=hn();return Nn({mutationFn:t=>Xe("/vaults",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Oye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/vaults/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["vaults"]})})}function Yq(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n,value:r})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"PUT",body:JSON.stringify({value:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function jye(){const e=hn();return Nn({mutationFn:({vaultId:t,key:n})=>Xe(\`/vaults/\${t}/entries/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["vaults",n.vaultId,"entries"]})})}function Tye(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Aye(){const{data:e}=wA(),t=Oye(),[n,r]=x.useState(null),[i,o]=x.useState(!1),[a,l]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Credential vaults",description:"Manage credential vaults that provide agents with access to APIs and services.",actionLabel:"New vault",onAction:()=>o(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[140px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Entries"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(u=>m.jsx(Rye,{vault:u,expanded:n===u.id,onToggle:()=>r(n===u.id?null:u.id),onDelete:()=>l({id:u.id,name:u.name})},u.id))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No vaults yet. Create one to store API keys and credentials."}),m.jsx(Nye,{open:i,onOpenChange:o}),m.jsx(bh,{open:!!a,onOpenChange:u=>!u&&l(null),children:m.jsxs(wh,{children:[m.jsxs(Sh,{children:[m.jsxs(Ch,{children:['Delete vault "',a?.name,'"?']}),m.jsx(_h,{children:"This will permanently delete the vault and all its entries. This action cannot be undone."})]}),m.jsxs(Eh,{children:[m.jsx(Oh,{children:"Cancel"}),m.jsx(kh,{variant:"destructive",onClick:()=>{a&&t.mutate(a.id),l(null)},children:"Delete"})]})]})})]})}function Nye({open:e,onOpenChange:t}){const n=Kq(),{data:r}=Hs(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){if(!(!i.trim()||!a))try{await n.mutateAsync({name:i.trim(),agent_id:a}),o(""),l(""),qe.success("Vault created"),t(!1)}catch(f){const d=f?.body?.error?.message||(f instanceof Error?f.message:"Failed to create vault");qe.error(d)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New vault"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"default",value:i,onChange:f=>o(f.target.value),className:"w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:a,onValueChange:f=>{f&&l(f)},children:[m.jsx(Ao,{className:"w-full text-foreground",children:m.jsx(jh,{placeholder:"Select an agent"})}),m.jsx(No,{children:r?.map(f=>m.jsx(ai,{value:f.id,children:f.name},f.id))})]})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||!a||n.isPending,children:"Create"})]})]})]})})}function Rye({vault:e,expanded:t,onToggle:n,onDelete:r}){return m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:n,children:[m.jsx(Ue,{children:m.jsx(nw,{className:Ne("size-3.5 text-muted-foreground transition-transform",t&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[e.id.slice(0,16),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:e.name}),m.jsx(Ue,{children:m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:"Active"})}),m.jsx(Ue,{className:"text-muted-foreground",children:e.entry_count}),m.jsx(Ue,{className:"text-muted-foreground",children:Tye(e.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:i=>{i.stopPropagation(),r()},children:m.jsx(Mi,{className:"size-3.5"})})})]}),t&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:7,className:"bg-muted/50 p-4",children:m.jsx(Pye,{vaultId:e.id})})})]})}function Pye({vaultId:e}){const{data:t}=kye(e),n=Yq(),r=jye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({vaultId:e,key:i.trim(),value:a.trim()}),o(""),l(""),qe.success("Entry added"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-center gap-3 rounded-md bg-background px-3 py-2",children:[m.jsx("span",{className:"font-mono text-xs text-lime-400/60",children:f.key}),m.jsxs("span",{className:"flex-1 truncate font-mono text-xs text-muted-foreground",children:[f.value.slice(0,8),"...",f.value.slice(-4)]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({vaultId:e,key:f.key}),children:m.jsx(Mi,{className:"size-3"})})]},f.key)),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(en,{placeholder:"Key",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(en,{placeholder:"Value",type:"password",value:a,onChange:f=>l(f.target.value),className:"h-8 w-full font-mono text-xs text-foreground"}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})}function Mye(e){const t="/files?limit=100";return Bn({queryKey:["files","all"],queryFn:()=>Xe(t),select:n=>n.data})}function Iye(){const e=hn();return Nn({mutationFn:async t=>{const n=new FormData;n.append("file",t);const r=bn.getState().apiKey,i=await fetch("/v1/files",{method:"POST",headers:{"x-api-key":r},body:n});if(!i.ok){const o=await i.json().catch(()=>({error:{message:"Upload failed"}}));throw new Error(o.error?.message||\`Upload failed (\${i.status})\`)}return i.json()},onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}function Dye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/files/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["files"]})})}async function Lye(e,t){const n=bn.getState().apiKey,r=await fetch(\`/v1/files/\${e}/content\`,{headers:{"x-api-key":n}});if(!r.ok)throw new Error("Download failed");const i=await r.blob(),o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o)}function zye(){return Bn({queryKey:["saved-repositories"],queryFn:async()=>{const e=await Xe("/settings/saved_repositories");if(!e.value)return[];try{return JSON.parse(e.value)}catch{return[]}}})}function Fye(){const e=hn();return Nn({mutationFn:async t=>{await Xe("/settings",{method:"PUT",body:JSON.stringify({key:"saved_repositories",value:JSON.stringify(t)})})},onSuccess:()=>e.invalidateQueries({queryKey:["saved-repositories"]})})}function EO(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Dz(e){return e>=1024*1024?\`\${(e/(1024*1024)).toFixed(1)} MB\`:e>=1024?\`\${(e/1024).toFixed(1)} KB\`:\`\${e} B\`}function Bye(){const{data:e}=Mye(),{data:t}=mw(),n=Iye(),r=Dye(),i=x.useRef(null),[o,a]=x.useState(null),l=new Map;t?.forEach(v=>{l.set(v.id,{title:v.title??v.id.slice(0,20),agent:v.agent?.id?.slice(0,16)??""})});const u=new Map,f=[];e?.forEach(v=>{if(v.scope?.id){const b=u.get(v.scope.id)??[];b.push(v),u.set(v.scope.id,b)}else f.push(v)});async function d(v){const b=v.target.files?.[0];if(b)try{await n.mutateAsync(b),qe.success(\`"\${b.name}" uploaded\`)}catch(w){qe.error(w instanceof Error?w.message:"Upload failed")}finally{i.current&&(i.current.value="")}}async function h(v,b){try{await Lye(v,b)}catch{qe.error("Download failed")}}const g=e?.length??0;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Files",description:\`\${g} file\${g!==1?"s":""} across \${u.size} session\${u.size!==1?"s":""}\`,actionLabel:"Upload file",onAction:()=>i.current?.click()}),m.jsx("input",{ref:i,type:"file",className:"hidden",onChange:d}),g===0?m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(gb,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No files yet"}),m.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Files created by agents during sessions will appear here"})]}):m.jsxs("div",{className:"flex flex-col gap-6",children:[Array.from(u.entries()).map(([v,b])=>{const w=l.get(v);return m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(UT,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:w?.title??v.slice(0,24)}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[v.slice(0,20),"..."]}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[b.length," file",b.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:b.map(S=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:S.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Dz(S.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:S.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:EO(S.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[S.downloadable&&m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(S.id,S.filename),children:m.jsx(Wd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:S.id,filename:S.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},S.id))})})]},v)}),f.length>0&&m.jsxs("div",{className:"rounded-lg border border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-4 py-2",children:[m.jsx(gb,{className:"size-3.5 text-muted-foreground"}),m.jsx("span",{className:"text-xs font-medium text-foreground",children:"Uploaded (no session)"}),m.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length," file",f.length!==1?"s":""]})]}),m.jsx(eo,{children:m.jsx(to,{children:f.map(v=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-medium text-foreground",children:v.filename}),m.jsx(Ue,{className:"text-muted-foreground text-xs",children:Dz(v.size_bytes)}),m.jsx(Ue,{className:"font-mono text-[10px] text-muted-foreground",children:v.mime_type}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:EO(v.created_at)}),m.jsx(Ue,{className:"w-[80px]",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:text-foreground",onClick:()=>h(v.id,v.filename),children:m.jsx(Wd,{className:"size-3.5"})}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>a({id:v.id,filename:v.filename}),children:m.jsx(Mi,{className:"size-3.5"})})]})})]},v.id))})})]})]}),m.jsx(bh,{open:!!o,onOpenChange:v=>!v&&a(null),children:m.jsxs(wh,{children:[m.jsxs(Sh,{children:[m.jsxs(Ch,{children:['Delete "',o?.filename,'"?']}),m.jsx(_h,{children:"This will permanently delete the file."})]}),m.jsxs(Eh,{children:[m.jsx(Oh,{children:"Cancel"}),m.jsx(kh,{variant:"destructive",onClick:()=>{o&&r.mutate(o.id,{onSuccess:()=>qe.success("File deleted"),onError:()=>qe.error("Failed to delete")}),a(null)},children:"Delete"})]})]})})]})}function $ye(){const{data:e}=zye(),t=Fye(),[n,r]=x.useState(!1),[i,o]=x.useState(""),[a,l]=x.useState("main");async function u(){if(!i.trim())return;const d=e??[],h={url:i.trim(),branch:a.trim()||"main",added_at:new Date().toISOString()};try{await t.mutateAsync([...d,h]),qe.success("Repository saved"),o(""),l("main"),r(!1)}catch{qe.error("Failed to save repository")}}async function f(d){const h=e??[];try{await t.mutateAsync(h.filter(g=>g.url!==d)),qe.success("Repository removed")}catch{qe.error("Failed to remove repository")}}return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Repositories",description:"Save repository URLs for agents to clone during sessions.",actionLabel:"Add repository",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"URL"}),m.jsx(et,{children:"Branch"}),m.jsx(et,{children:"Added"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(d=>m.jsxs(yn,{children:[m.jsx(Ue,{className:"font-mono text-xs text-foreground",children:d.url}),m.jsx(Ue,{children:m.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[m.jsx(WL,{className:"size-3"}),d.branch]})}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:EO(d.added_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:()=>f(d.url),children:m.jsx(Mi,{className:"size-3.5"})})})]},d.url))})]})}):m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center",children:[m.jsx(WL,{className:"size-8 text-muted-foreground/40"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories saved yet"})]}),m.jsx(ea,{open:n,onOpenChange:r,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"Add repository"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Repository URL"}),m.jsx(en,{placeholder:"https://github.com/org/repo",value:i,onChange:d=>o(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Branch"}),m.jsx(en,{placeholder:"main",value:a,onChange:d=>l(d.target.value),className:"w-full text-foreground",onKeyDown:d=>d.key==="Enter"&&u()})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:u,disabled:!i.trim()||t.isPending,children:"Add"})]})]})]})})]})}function Uye(){return Bn({queryKey:["memory-stores"],queryFn:()=>Xe("/memory_stores?limit=50"),select:e=>e.data})}function Hye(){const e=hn();return Nn({mutationFn:t=>Xe("/memory_stores",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function qye(){const e=hn();return Nn({mutationFn:t=>Xe(\`/memory_stores/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["memory-stores"]})})}function Vye(e){return Bn({queryKey:["memory-stores",e,"memories"],queryFn:()=>Xe(\`/memory_stores/\${e}/memories?limit=100\`),enabled:!!e,select:t=>t.data})}function Kye(){const e=hn();return Nn({mutationFn:({storeId:t,path:n,content:r})=>Xe(\`/memory_stores/\${t}/memories\`,{method:"POST",body:JSON.stringify({path:n,content:r})}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function Yye(){const e=hn();return Nn({mutationFn:({storeId:t,memoryId:n})=>Xe(\`/memory_stores/\${t}/memories/\${n}\`,{method:"DELETE"}),onSuccess:(t,n)=>e.invalidateQueries({queryKey:["memory-stores",n.storeId,"memories"]})})}function Wye(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function Gye(){const{data:e}=Uye(),t=qye(),[n,r]=x.useState(!1),[i,o]=x.useState(null);return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Memory stores",description:"Persistent key-value stores for agent memory.",actionLabel:"New store",onAction:()=>r(!0)}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-8"}),m.jsx(et,{className:"w-[160px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Description"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[50px]"})]})}),m.jsx(to,{children:e.map(a=>m.jsxs(m.Fragment,{children:[m.jsxs(yn,{className:"cursor-pointer",onClick:()=>o(i===a.id?null:a.id),children:[m.jsx(Ue,{children:m.jsx(nw,{className:Ne("size-3.5 text-muted-foreground transition-transform",i===a.id&&"rotate-90")})}),m.jsxs(Ue,{className:"font-mono text-xs text-muted-foreground",children:[a.id.slice(0,18),"..."]}),m.jsx(Ue,{className:"font-medium text-foreground",children:a.name}),m.jsx(Ue,{className:"text-muted-foreground",children:a.description||"\u2014"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Wye(a.created_at)}),m.jsx(Ue,{children:m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-7 text-red-400/40 hover:text-red-400",onClick:l=>{l.stopPropagation(),t.mutate(a.id)},children:m.jsx(Mi,{className:"size-3.5"})})})]},a.id),i===a.id&&m.jsx(yn,{children:m.jsx(Ue,{colSpan:6,className:"bg-muted/50 p-4",children:m.jsx(Qye,{storeId:a.id})})},\`\${a.id}-memories\`)]}))})]})}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No memory stores yet."}),m.jsx(Xye,{open:n,onOpenChange:r})]})}function Xye({open:e,onOpenChange:t}){const n=Hye(),[r,i]=x.useState(""),[o,a]=x.useState("");async function l(){r.trim()&&(await n.mutateAsync({name:r.trim(),description:o.trim()||void 0}),i(""),a(""),qe.success("Memory store created"),t(!1))}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{className:"text-foreground",children:"New memory store"})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-store",value:r,onChange:u=>i(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Description"}),m.jsx(en,{placeholder:"Optional description",value:o,onChange:u=>a(u.target.value),className:"w-full"})]}),m.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[m.jsx(Fe,{variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{className:"bg-cta-gradient text-black hover:opacity-90",onClick:l,disabled:!r.trim()||n.isPending,children:"Create"})]})]})]})})}function Qye({storeId:e}){const{data:t}=Vye(e),n=Kye(),r=Yye(),[i,o]=x.useState(""),[a,l]=x.useState("");async function u(){!i.trim()||!a.trim()||(await n.mutateAsync({storeId:e,path:i.trim(),content:a.trim()}),o(""),l(""),qe.success("Memory created"))}return m.jsxs("div",{className:"flex flex-col gap-2",children:[t?.map(f=>m.jsxs("div",{className:"flex items-start gap-3 rounded-md bg-background px-3 py-2",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"font-mono text-xs text-lime-400/60",children:f.path}),m.jsxs("p",{className:"mt-1 text-xs text-muted-foreground whitespace-pre-wrap break-all",children:[f.content.slice(0,200),f.content.length>200?"...":""]})]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-red-400/30 hover:text-red-400",onClick:()=>r.mutate({storeId:e,memoryId:f.id}),children:m.jsx(Mi,{className:"size-3"})})]},f.id)),m.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[m.jsx(en,{placeholder:"Path (e.g. notes/todo)",value:i,onChange:f=>o(f.target.value),className:"h-8 w-full font-mono text-xs"}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(ww,{placeholder:"Content",value:a,onChange:f=>l(f.target.value),className:"min-h-[60px] w-full text-xs",rows:2}),m.jsx(Fe,{size:"icon",className:"size-8 shrink-0 self-end bg-cta-gradient text-black hover:opacity-90",onClick:u,children:m.jsx(bc,{className:"size-3"})})]})]})]})}function Zye(){return Bn({queryKey:["tenants"],queryFn:async()=>{try{return(await Xe("/tenants")).data}catch(e){const t=e?.status;if(t===403||t===404)return[];throw e}},staleTime:3e4})}function Jye(){const e=hn();return Nn({mutationFn:t=>Xe("/tenants",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function exe(){const e=hn();return Nn({mutationFn:({id:t,name:n})=>Xe(\`/tenants/\${t}\`,{method:"PATCH",body:JSON.stringify({name:n})}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function txe(){const e=hn();return Nn({mutationFn:t=>Xe(\`/tenants/\${t}\`,{method:"DELETE"}),onSuccess:()=>e.invalidateQueries({queryKey:["tenants"]})})}function nxe(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);return r<24?\`\${r}h ago\`:\`\${Math.floor(r/24)}d ago\`}function rxe(){const{data:e,isLoading:t,error:n}=Zye(),[r,i]=x.useState(!1),[o,a]=x.useState(null),l=n?.status,u=!t&&n!=null,f=l===401;return m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx(Sc,{title:"Tenants",description:"Isolation boundary for agents, environments, vaults, sessions, and API keys. Only global admins can manage tenants.",actionLabel:e&&!u?"New tenant":void 0,onAction:()=>i(!0)}),u&&m.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-4",children:[m.jsx(r8,{className:"mt-0.5 size-4 text-muted-foreground"}),f?m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Your API key isn't valid. Check the ",m.jsx("code",{className:"font-mono text-xs",children:"x-api-key"}),"value (or the one stored in this browser via ",m.jsx("code",{className:"font-mono text-xs",children:"localStorage.ma-api-key"}),") matches a row in the ",m.jsx("code",{className:"font-mono text-xs",children:"api_keys"})," table. A common cause is more than one ",m.jsx("code",{className:"font-mono text-xs",children:"SEED_API_KEY"})," line in ",m.jsx("code",{className:"font-mono text-xs",children:".env"})," \u2014 only the last one takes effect in ",m.jsx("code",{className:"font-mono text-xs",children:"process.env"}),", but only the first was actually seeded."]}):m.jsx("p",{className:"text-sm text-muted-foreground",children:"Tenant management requires a global admin API key. Your key is scoped to a tenant and can manage only resources within it."})]}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{className:"w-[220px]",children:"ID"}),m.jsx(et,{children:"Name"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"}),m.jsx(et,{className:"w-[120px] text-right",children:"Actions"})]})}),m.jsx(to,{children:e.map(d=>m.jsx(ixe,{tenant:d,onArchive:()=>a(d)},d.id))})]})}):!u&&!t?m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No tenants yet. Create one to start isolating resources per team."}):null,m.jsx(oxe,{open:r,onOpenChange:i}),m.jsx(bh,{open:!!o,onOpenChange:d=>!d&&a(null),children:m.jsxs(wh,{children:[m.jsxs(Sh,{children:[m.jsxs(Ch,{children:['Archive tenant "',o?.name,'"?']}),m.jsx(_h,{children:"The tenant's existing resources (agents, environments, sessions, vaults, keys) stay in place but no new resources can be created under it. This action cannot be undone through the UI."})]}),m.jsxs(Eh,{children:[m.jsx(Oh,{children:"Cancel"}),m.jsx(axe,{tenant:o,onDone:()=>a(null)})]})]})})]})}function ixe({tenant:e,onArchive:t}){const[n,r]=x.useState(!1),[i,o]=x.useState(e.name),a=exe(),l=e.id==="tenant_default",u=!!e.archived_at;async function f(){if(!i.trim()||i===e.name){r(!1),o(e.name);return}try{await a.mutateAsync({id:e.id,name:i.trim()}),qe.success("Renamed"),r(!1)}catch(d){qe.error(d.message),o(e.name)}}return m.jsxs(yn,{children:[m.jsx(Ue,{children:m.jsx("code",{className:"text-xs text-muted-foreground",children:e.id})}),m.jsx(Ue,{children:n?m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(en,{autoFocus:!0,value:i,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f(),d.key==="Escape"&&(r(!1),o(e.name))},className:"h-8 text-sm"}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:f,children:m.jsx(Aa,{className:"size-4"})}),m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>{r(!1),o(e.name)},children:m.jsx(uc,{className:"size-4"})})]}):m.jsx("span",{className:"text-sm text-foreground",children:e.name})}),m.jsx(Ue,{children:u?m.jsx(an,{variant:"outline",className:"text-muted-foreground",children:"archived"}):l?m.jsx(an,{variant:"secondary",children:"default"}):m.jsx(an,{variant:"outline",className:"text-lime-500 border-lime-500/40",children:"active"})}),m.jsx(Ue,{className:"text-xs text-muted-foreground",children:nxe(e.created_at)}),m.jsx(Ue,{className:"text-right",children:!u&&m.jsxs("div",{className:"inline-flex gap-1",children:[m.jsx(Fe,{variant:"ghost",size:"icon",onClick:()=>r(!0),title:"Rename",children:m.jsx(o8,{className:"size-4"})}),!l&&m.jsx(Fe,{variant:"ghost",size:"icon",onClick:t,title:"Archive",children:m.jsx(nue,{className:"size-4 text-destructive"})})]})})]})}function oxe({open:e,onOpenChange:t}){const[n,r]=x.useState(""),[i,o]=x.useState(""),a=Jye();async function l(){if(n.trim())try{await a.mutateAsync({name:n.trim(),id:i.trim()||void 0}),qe.success("Tenant created"),r(""),o(""),t(!1)}catch(u){qe.error(u.message)}}return m.jsx(ea,{open:e,onOpenChange:t,children:m.jsxs(za,{children:[m.jsx(Fa,{children:m.jsx(Ba,{children:"New tenant"})}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsxs("div",{children:[m.jsx(wt,{htmlFor:"tenant-name",children:"Name"}),m.jsx(en,{id:"tenant-name",value:n,onChange:u=>r(u.target.value),placeholder:"acme",autoFocus:!0})]}),m.jsxs("div",{children:[m.jsxs(wt,{htmlFor:"tenant-id",children:["ID ",m.jsxs("span",{className:"text-muted-foreground",children:["(optional, must start with ",m.jsx("code",{className:"text-xs",children:"tenant_"}),")"]})]}),m.jsx(en,{id:"tenant-id",value:i,onChange:u=>o(u.target.value),placeholder:"tenant_acme"})]})]}),m.jsxs(vb,{children:[m.jsx(Fe,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),m.jsx(Fe,{onClick:l,disabled:!n.trim()||a.isPending,children:a.isPending?"Creating\u2026":"Create"})]})]})})}function axe({tenant:e,onDone:t}){const n=txe();async function r(){if(e)try{await n.mutateAsync(e.id),qe.success("Archived"),t()}catch(i){qe.error(i.message)}}return m.jsx(kh,{onClick:r,disabled:n.isPending,children:n.isPending?"Archiving\u2026":"Archive"})}function Wq(e){const{windowMs:t,groupBy:n="agent"}=e;return Bn({queryKey:["metrics","agent",t,n],queryFn:()=>{const r=Date.now(),i=r-t;return Xe(\`/metrics?group_by=\${n}&from=\${i}&to=\${r}\`)},refetchInterval:15e3})}function Gq(e){const{windowMinutes:t}=e;return Bn({queryKey:["metrics","api",t],queryFn:()=>Xe(\`/metrics/api?window_minutes=\${t}\`),refetchInterval:5e3})}function Xq({data:e,height:t=48,className:n,errors:r}){if(e.length===0)return m.jsx("div",{className:\`flex items-center justify-center text-xs text-muted-foreground/40 \${n??""}\`,style:{height:t},children:"no data"});const i=400,o=Math.max(...e,1),a=i/Math.max(e.length-1,1),l=e.map((d,h)=>\`\${(h*a).toFixed(1)},\${(t-d/o*(t-4)-2).toFixed(1)}\`).join(" "),u=\`M 0,\${t} L \${l} L \${i},\${t} Z\`,f=r?.map((d,h)=>{if(d===0)return null;const g=h*a,v=Math.max(2,d/o*(t-4));return m.jsx("rect",{x:g-1,y:t-v,width:2,height:v,fill:"currentColor",className:"text-destructive/70"},h)})??null;return m.jsxs("svg",{viewBox:\`0 0 \${i} \${t}\`,preserveAspectRatio:"none",className:\`w-full text-foreground \${n??""}\`,style:{height:t},children:[m.jsx("path",{d:u,className:"fill-primary/10"}),m.jsx("polyline",{points:l,fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-primary"}),f]})}function Eb({data:e,limit:t=8,formatValue:n=r=>r.toLocaleString()}){if(e.length===0)return m.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"no data"});const r=Math.max(...e.map(a=>a.value),1),i=e.slice(0,t),o=e.length-i.length;return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.map(a=>{const l=a.value/r*100;return m.jsxs("div",{className:"relative flex items-center text-xs",children:[m.jsx("div",{className:\`absolute inset-y-0 left-0 rounded-sm \${a.color??"bg-primary/10"}\`,style:{width:\`\${l}%\`}}),m.jsxs("div",{className:"relative z-10 flex w-full items-center justify-between gap-2 px-2 py-1",children:[m.jsx("span",{className:"truncate font-mono text-[11px] text-foreground",children:a.label}),m.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[n(a.value),a.subtitle&&m.jsx("span",{className:"ml-1.5 text-muted-foreground/60",children:a.subtitle})]})]})]},a.label)}),o>0&&m.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2",children:["+ ",o," more"]})]})}function Ir({label:e,value:t,loading:n,tone:r="neutral",info:i}){const o=t===0||t==="0"||t==="\u2014";let a="text-foreground";return o||(r==="warn"?a="text-amber-500":r==="danger"?a="text-red-500":r==="accent"&&(a="text-lime-400")),m.jsx(fi,{size:"sm",className:"h-full",children:m.jsxs(Lr,{className:"flex h-full flex-col",children:[m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),i&&m.jsxs(LT,{children:[m.jsx(zT,{render:l=>m.jsx("button",{...l,type:"button","aria-label":\`About \${e}\`,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors"}),children:m.jsx(HT,{className:"size-3"})}),m.jsx(FT,{children:i})]})]}),m.jsx("p",{className:\`mt-auto pt-1 font-mono text-lg tabular-nums \${a} \${n?"opacity-40":""}\`,children:typeof t=="number"?t.toLocaleString():t})]})})}function CO(e){return e===0?"$0.00":e<.01?\`$\${e.toFixed(4)}\`:e<1?\`$\${e.toFixed(3)}\`:\`$\${e.toFixed(2)}\`}function _C({label:e,value:t}){return m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{className:"text-center",children:[m.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),m.jsxs("p",{className:"mt-1 font-mono text-2xl tabular-nums text-foreground",children:[t!=null?\`\${Math.round(t)}\`:"\u2014",t!=null&&m.jsx("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:"ms"})]})]})})}function sxe(e){switch(e){case"end_turn":return"bg-emerald-500/15";case"error":return"bg-red-500/15";case"interrupted":return"bg-amber-500/15";case"custom_tool_call":return"bg-sky-500/15";default:return"bg-primary/10"}}function lxe({windowMinutes:e}){const{data:t}=Hs(),n=Wq({windowMs:e*6e4,groupBy:"agent"}),r=i=>t?.find(o=>o.id===i)?.name??i.slice(0,16)+"\u2026";return m.jsxs("div",{children:[m.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 md:grid-cols-4",children:[m.jsx(Ir,{label:"Sessions",value:n.data?.totals.session_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Turns",value:n.data?.totals.turn_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Tool calls",value:n.data?.totals.tool_call_count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Errors",value:n.data?.totals.error_count??0,loading:n.isLoading,tone:n.data&&n.data.totals.error_count>0?"warn":"neutral"}),m.jsx(Ir,{label:"Cost",value:CO(n.data?.totals.cost_usd??0),loading:n.isLoading}),m.jsx(Ir,{label:"Input tokens",value:n.data?.totals.input_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Output tokens",value:n.data?.totals.output_tokens??0,loading:n.isLoading}),m.jsx(Ir,{label:"Cache read",value:n.data?.totals.cache_read_input_tokens??0,loading:n.isLoading})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Stop reasons"})}),m.jsx(Lr,{children:m.jsx(Eb,{data:n.data?Object.entries(n.data.stop_reasons).map(([i,o])=>({label:i,value:o,color:sxe(i)})):[]})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Cost by agent"})}),m.jsx(Lr,{children:m.jsx(Eb,{data:n.data?.groups.filter(i=>i.cost_usd>0).map(i=>({label:r(i.key),value:i.cost_usd,subtitle:\`\${i.turn_count}t\`}))??[],formatValue:CO})})]}),m.jsxs(fi,{className:"md:col-span-2",children:[m.jsx(_s,{children:m.jsxs(ks,{className:"text-sm",children:["Tool-call latency",m.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(p50/p95/p99 over ",n.data?.tool_call_sample_count??0," samples)"]})]})}),m.jsx(Lr,{children:m.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[m.jsx(_C,{label:"p50",value:n.data?.tool_latency_p50_ms??null}),m.jsx(_C,{label:"p95",value:n.data?.tool_latency_p95_ms??null}),m.jsx(_C,{label:"p99",value:n.data?.tool_latency_p99_ms??null})]})})]})]})]})}function cxe(e){return e==null?"":new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function uxe({windowMinutes:e}){const t=Math.min(e,60),n=Gq({windowMinutes:t});return m.jsxs("div",{children:[m.jsx("div",{className:"mb-3 flex items-center justify-end",children:m.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["last ",t," min \xB7 in-process"]})}),m.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 md:grid-cols-5",children:[m.jsx(Ir,{label:"Requests",value:n.data?.totals.count??0,loading:n.isLoading}),m.jsx(Ir,{label:"Req / sec",value:(n.data?.totals.rps??0).toFixed(2),loading:n.isLoading}),m.jsx(Ir,{label:"p50",value:n.data?.totals.p50_ms!=null?\`\${Math.round(n.data.totals.p50_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"p95",value:n.data?.totals.p95_ms!=null?\`\${Math.round(n.data.totals.p95_ms)} ms\`:"\u2014",loading:n.isLoading}),m.jsx(Ir,{label:"Error rate",value:\`\${((n.data?.totals.error_rate??0)*100).toFixed(1)}%\`,loading:n.isLoading,tone:n.data&&n.data.totals.error_rate>.01?"warn":"neutral"})]}),m.jsxs(fi,{className:"mb-4",children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Requests per minute"})}),m.jsxs(Lr,{children:[m.jsx(Xq,{data:n.data?.timeline.map(r=>r.count)??[],errors:n.data?.timeline.map(r=>r.error_count)??[],height:96}),m.jsxs("div",{className:"mt-2 flex items-center justify-between text-[11px] text-muted-foreground",children:[m.jsx("span",{children:cxe(n.data?.timeline[0]?.minute_ms)}),m.jsx("span",{children:"now"})]})]})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"By route"})}),m.jsx(Lr,{children:m.jsx(Eb,{data:n.data?.routes.map(r=>({label:r.route,value:r.count,subtitle:r.p95_ms!=null?\`p95 \${Math.round(r.p95_ms)}ms\`:void 0}))??[],limit:10})})]}),m.jsxs(fi,{children:[m.jsx(_s,{children:m.jsx(ks,{className:"text-sm",children:"Status classes"})}),m.jsx(Lr,{children:m.jsx(Eb,{data:n.data?[{label:"2xx",value:n.data.totals.status_2xx,color:"bg-emerald-500/15"},{label:"3xx",value:n.data.totals.status_3xx,color:"bg-sky-500/15"},{label:"4xx",value:n.data.totals.status_4xx,color:"bg-amber-500/15"},{label:"5xx",value:n.data.totals.status_5xx,color:"bg-red-500/15"}].filter(r=>r.value>0):[]})})]})]})]})}const fxe=[{label:"15 min",minutes:15},{label:"1 hour",minutes:60},{label:"6 hours",minutes:360},{label:"24 hours",minutes:1440}];function dxe(){const e=bn(r=>r.dashboardWindowMinutes),t=bn(r=>r.setDashboardWindowMinutes),{tab:n}=sT({from:"/analytics"});return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Analytics"}),m.jsxs("div",{className:"flex items-center gap-1",children:[fxe.map(r=>m.jsx(Fe,{variant:e===r.minutes?"default":"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>t(r.minutes),children:r.label},r.minutes)),n==="api"&&e>60&&m.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(capped at 60 min)"})]})]}),n==="agents"?m.jsx(lxe,{windowMinutes:e}):m.jsx(uxe,{windowMinutes:e})]})}function SA({mode:e,onModeChange:t}){return m.jsxs("div",{className:"flex rounded-lg border border-border overflow-hidden",children:[m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="select"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("select"),children:"Use existing"}),m.jsx("button",{className:\`flex-1 px-3 py-1.5 text-sm font-medium transition-colors \${e==="create"?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"}\`,onClick:()=>t("create"),children:"Create new"})]})}function hxe({onNext:e}){const{data:t,isLoading:n,isError:r}=Hs(),i=!n&&!r&&t&&t.length>0,[o,a]=x.useState("create"),[l,u]=x.useState(""),[f,d]=x.useState("my-agent"),[h,g]=x.useState("claude"),[v,b]=x.useState(Qd.claude[0]);x.useEffect(()=>{n||a(i?"select":"create")},[n,i]);function w(){if(o==="select"){const S=t?.find(E=>E.id===l);if(!S){qe.error("Please select an agent");return}e({mode:"select",agent:{id:S.id,name:S.name,engine:S.engine,model:S.model}})}else{if(!f.trim()){qe.error("Agent name is required");return}if(t?.some(S=>S.name.toLowerCase()===f.trim().toLowerCase())){qe.error(\`Agent "\${f.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:f.trim(),engine:h,model:v}})}}return n?null:r?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load agents. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 1 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Agent"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing agent or create a new one."})]}),i&&m.jsx(SA,{mode:o,onModeChange:a}),o==="select"&&i&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Agent"}),m.jsxs(To,{value:l,onValueChange:S=>{S&&u(S)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:t?.find(S=>S.id===l)?.name??"Select an agent"})}),m.jsx(No,{children:t.map(S=>m.jsxs(ai,{value:S.id,children:[S.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",S.engine,")"]})]},S.id))})]})]})}),o==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-agent",value:f,onChange:S=>d(S.target.value),className:"h-10 w-full text-foreground"})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Engine"}),m.jsxs(To,{value:h,onValueChange:S=>{S&&(g(S),b(Qd[S]?.[0]??""))},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx(jh,{})}),m.jsx(No,{children:uA.map(S=>m.jsx(ai,{value:S,children:S},S))})]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Model"}),m.jsx(gA,{engine:h,value:v,onChange:b})]})]}),m.jsx(Fe,{className:"w-full h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:w,disabled:o==="select"&&!l,children:"Continue"})]})}function EA(){return Bn({queryKey:["provider-status"],queryFn:()=>Xe("/providers/status"),select:e=>e.data,refetchInterval:15e3,refetchOnWindowFocus:!0})}const pxe={anthropic:"anthropic.com",docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com"};function mxe({onNext:e,onBack:t,engine:n}){const{data:r,isLoading:i,isError:o}=rf(),{data:a}=EA(),l=n==="claude",u=r?.filter(A=>!(!(A.state==="ready"||A.state==="active"||A.state==="idle")||A.config?.provider==="anthropic"&&!l))??[],f=(r?.length??0)-u.length,d=!i&&!o&&(r?.length??0)>0,h=!i&&!o&&u.length>0,[g,v]=x.useState("create"),[b,w]=x.useState(""),[S,E]=x.useState("default"),[k,O]=x.useState("");x.useEffect(()=>{i||v(h?"select":"create")},[i,h]),x.useEffect(()=>{if(a&&!k){const T=[...$m,...Tu].filter(N=>N!=="anthropic"||l).find(N=>a[N]?.available);T&&O(T)}},[a,k,l]);function j(){if(g==="select"){const A=u.find(T=>T.id===b);if(!A){qe.error("Please select an environment");return}e({mode:"select",env:{id:A.id,name:A.name,provider:A.config?.provider||"unknown"}})}else{if(!S.trim()){qe.error("Environment name is required");return}if(!k){qe.error("Please select a provider");return}if(r?.some(A=>A.name.toLowerCase()===S.trim().toLowerCase())){qe.error(\`Environment "\${S.trim()}" already exists \u2014 pick a different name or select it\`);return}e({mode:"create",data:{name:S.trim(),provider:k}})}}return i?null:o?m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-4",children:[m.jsx("p",{className:"text-sm text-destructive",children:"Failed to load environments. Check that the server is running."}),m.jsx(Fe,{variant:"outline",onClick:()=>window.location.reload(),children:"Retry"})]}):m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 2 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Choose an Environment"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Select an existing environment or create a new one."})]}),f>0&&m.jsxs("p",{className:"text-xs text-muted-foreground rounded-md border border-amber-400/20 bg-amber-400/5 p-2",children:[f," existing environment",f>1?"s are":" is"," unavailable (unhealthy or incompatible with ",n??"this"," engine)."]}),d&&m.jsx(SA,{mode:g,onModeChange:v}),g==="select"&&!h&&d&&m.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No compatible environments for the ",n??"selected"," engine. Create a new one below."]}),g==="select"&&h&&m.jsx("div",{className:"flex flex-col gap-3",children:m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Environment"}),m.jsxs(To,{value:b,onValueChange:A=>{A&&w(A)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:u.find(A=>A.id===b)?.name??"Select an environment"})}),m.jsx(No,{children:u.map(A=>m.jsxs(ai,{value:A.id,children:[A.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",A.config?.provider||"unknown",")"]})]},A.id))})]})]})}),g==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Name"}),m.jsx(en,{placeholder:"my-env",value:S,onChange:A=>E(A.target.value),className:"h-10 w-full text-foreground"})]}),m.jsx(Lz,{label:"Local",providers:$m,providerStatus:a,selected:k,onSelect:O}),m.jsx(Lz,{label:"Cloud",providers:Tu.filter(A=>A!=="anthropic"||l),providerStatus:a,selected:k,onSelect:O,cloud:!0})]}),m.jsxs("div",{className:"flex gap-2",children:[t&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:t,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:j,disabled:g==="select"?!b:!S.trim()||!k,children:"Continue"})]})]})}function Lz({label:e,providers:t,providerStatus:n,selected:r,onSelect:i,cloud:o}){return m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:e}),m.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:t.map(a=>{const l=n?.[a],u=o?!0:l?.available??!0,f=r===a;return m.jsxs("button",{disabled:!u,onClick:()=>u&&i(a),className:\`relative flex flex-col items-center justify-center rounded-lg border px-2 py-2.5 text-center transition-colors \${f?"border-lime-400/50 bg-lime-400/10":u?"border-border hover:border-muted-foreground/50":"border-border opacity-40 cursor-not-allowed"}\`,children:[f&&m.jsx(Aa,{className:"absolute top-1 right-1 size-3 text-lime-400"}),!o&&!u&&l?.message&&m.jsxs(LT,{children:[m.jsx(zT,{render:m.jsx("div",{className:"absolute top-1 left-1 rounded-full p-0.5 text-muted-foreground hover:text-foreground",onClick:d=>d.stopPropagation()}),children:m.jsx(HT,{className:"size-3"})}),m.jsx(FT,{side:"top",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:l.message})})]}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${pxe[a]??""}&sz=32\`,alt:"",className:"size-4 mb-1"}),m.jsx("span",{className:\`text-xs font-medium \${f||u?"text-foreground":"text-muted-foreground"}\`,children:a}),o&&m.jsx("span",{className:"text-[10px] text-muted-foreground mt-0.5",children:"API key required"}),!o&&!u&&m.jsx("span",{className:"text-[10px] text-destructive/70 mt-0.5",children:"Unavailable"})]},a)})})]})}function gxe({engine:e,model:t,provider:n,agentId:r,agentName:i,hasExistingVaults:o,onNext:a,onSkip:l,onSelectVault:u,onBack:f}){const[d,h]=x.useState({}),[g,v]=x.useState(""),b=i?\`\${i}-vault\`:"my-vault",[w,S]=x.useState(b),{data:E}=wA(),k=r?(E??[]).filter(B=>B.agent_id===r):[],O=new Set,j=k.filter(B=>O.has(B.name)?!1:(O.add(B.name),!0)),A=[],T=new Set;n==="anthropic"&&(A.push({key:"ANTHROPIC_API_KEY",label:"Anthropic API Key (required for hosted execution)"}),T.add("ANTHROPIC_API_KEY"));const N=Cpe(e,t);N&&!T.has(N.key)&&(A.push(N),T.add(N.key));const P=Q8[n];P&&!T.has(P.key)&&A.push({key:P.key,label:P.label});const F=o||j.length>0,[D,q]=x.useState(F?"select":"create");if(x.useEffect(()=>{F&&q("select")},[F]),A.length===0)return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t&&!t.includes("/")&&!["claude-","gpt-","o1-","o3-","codex-","gemini-"].some(B=>t.startsWith(B))?"No API key required \u2014 this model runs locally via Ollama.":"No API keys needed for this combination."})]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:l,children:"Continue"})]})]});const L=w.trim(),U=D==="create"&&L.length>0&&k.some(B=>B.name===L);function H(){if(D==="select")if(o)l();else{if(!g)return;const B=j.find(z=>z.id===g)?.name??g;u?.(g,B)}else{if(!L||U)return;a(d,L)}}return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 3 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Secrets"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F?"Use existing secrets or enter new API keys.":"These keys will be stored securely in a vault."})]}),F&&m.jsx(SA,{mode:D,onModeChange:q}),D==="select"&&F&&m.jsx("div",{className:"flex flex-col gap-3",children:o?m.jsx("p",{className:"text-sm text-muted-foreground",children:"The agent's existing vault secrets will be used for this session."}):m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault"}),m.jsxs(To,{value:g,onValueChange:B=>{B&&v(B)},children:[m.jsx(Ao,{className:"h-10 w-full text-foreground",children:m.jsx("span",{className:"truncate",children:j.find(B=>B.id===g)?.name??"Select a vault"})}),m.jsx(No,{children:j.map(B=>m.jsxs(ai,{value:B.id,children:[B.name," ",m.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",B.entry_count," ",B.entry_count===1?"key":"keys",")"]})]},B.id))})]})]})}),D==="create"&&m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:"Vault name"}),m.jsx(en,{value:w,onChange:B=>S(B.target.value),placeholder:b,className:"h-10 w-full text-foreground border-border bg-muted text-sm placeholder:text-muted-foreground focus-visible:ring-ring"}),U&&m.jsxs("p",{className:"text-xs text-red-400",children:['A vault named "',L,'" already exists for this agent.']})]}),A.map(B=>m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(wt,{className:"text-xs text-muted-foreground",children:B.label}),m.jsx(en,{type:"password",placeholder:B.key==="ANTHROPIC_API_KEY"&&e==="claude"&&n!=="anthropic"?"ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN":B.key,value:d[B.key]||"",onChange:z=>h({...d,[B.key]:z.target.value}),className:"h-10 w-full text-foreground border-border bg-muted font-mono text-sm placeholder:text-muted-foreground focus-visible:ring-ring"})]},B.key))]}),m.jsxs("div",{className:"flex gap-2",children:[f&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:f,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:H,disabled:D==="select"&&!o&&!g||D==="create"&&(!L||U),children:"Continue"})]})]})}function vxe({agentName:e,envName:t,secretsLabel:n,onStart:r,loading:i,error:o,isExistingAgent:a,isExistingEnv:l,onBack:u}){return m.jsxs("div",{className:"w-full max-w-md flex flex-col gap-6",children:[m.jsxs("div",{children:[m.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-lime-400/60 mb-1",children:"Step 4 of 4"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Ready to Go"}),m.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Everything is configured. Start your first session."})]}),m.jsxs("div",{className:"rounded-xl ring-1 ring-border bg-card p-4 flex flex-col gap-3",children:[m.jsx(kC,{label:"Agent",value:e,tag:a?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(kC,{label:"Environment",value:t,tag:l?"existing":"new"}),m.jsx("div",{className:"border-t border-border"}),m.jsx(kC,{label:"Secrets",value:n,tag:n!=="none"?"existing":void 0})]}),o&&m.jsx("p",{className:"text-sm text-destructive",children:o}),m.jsxs("div",{className:"flex gap-2",children:[u&&m.jsx(Fe,{variant:"outline",className:"h-10 px-4 text-sm",onClick:u,disabled:i,children:"Back"}),m.jsx(Fe,{className:"flex-1 h-10 bg-cta-gradient text-sm font-medium text-black hover:opacity-90",onClick:r,disabled:i,children:i?m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx(rw,{className:"size-4 animate-spin"}),"Starting session..."]}):"Start Session"})]})]})}function kC({label:e,value:t,tag:n}){return m.jsxs("div",{className:"flex justify-between text-sm",children:[m.jsx("span",{className:"text-muted-foreground",children:e}),m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"font-medium text-foreground",children:t}),n&&m.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",n,")"]})]})]})}function Qq(){const[e,t]=x.useState(0),[n,r]=x.useState(null),[i,o]=x.useState(null),[a,l]=x.useState({}),[u,f]=x.useState(""),[d,h]=x.useState(null),[g,v]=x.useState([]),[b,w]=x.useState(!1),[S,E]=x.useState(null),[k,O]=x.useState(null),[j,A]=x.useState(null),T=S8(),N=E8(),P=Kq(),F=Yq(),D=C8(),q=Bs(),L=n?.mode==="select"?{name:n.agent.name,engine:n.agent.engine,model:n.agent.model}:n?.mode==="create"?n.data:{name:"",engine:"claude",model:""},U=i?.mode==="select"?{name:i.env.name,provider:i.env.provider}:i?.mode==="create"?i.data:{name:"",provider:"docker"},H=n?.mode==="select",B=i?.mode==="select";async function z($){if(r($),$.mode==="select")try{const X=(await Xe(\`/vaults?agent_id=\${$.agent.id}\`)).data.filter(W=>W.entry_count>0).map(W=>W.id);v(X)}catch{}else v([]);t(1)}function V($){o($),t(2)}function Q($,R){l($),f(R),h(null),t(3)}function G($,R){h({id:$,name:R}),l({}),t(3)}async function I(){if(!(!n||!i)){w(!0),E(null);try{let $;if(n.mode==="select")$=n.agent.id;else if(k)$=k;else{const oe=await T.mutateAsync(n.data);$=oe.id,O(oe.id)}let R;if(i.mode==="select")R=i.env.id;else if(j)R=j;else{const oe=await N.mutateAsync({name:i.data.name,config:{provider:i.data.provider}});R=oe.id,A(oe.id)}let X=[...g];if(d)X=[d.id];else{const oe=U.provider==="anthropic",ie=Object.entries(a).map(([J,se])=>[J,se.trim()]).filter(([,J])=>J.length>0).map(([J,se])=>{const xe=se.startsWith("sk-ant-oat");if(xe&&oe)throw new Error("OAuth tokens (sk-ant-oat) are not supported with the Anthropic provider. Use a regular API key (sk-ant-api03-...) instead.");return J==="ANTHROPIC_API_KEY"&&xe?["CLAUDE_CODE_OAUTH_TOKEN",se]:[J,se]});if(ie.length>0){let J;if(g.length>0)J=g[0];else{const se=u.trim()||"my-vault";try{const ne=(await Xe(\`/vaults?agent_id=\${$}\`)).data.find(ke=>ke.name===se);ne?J=ne.id:J=(await P.mutateAsync({name:se,agent_id:$})).id}catch{J=(await P.mutateAsync({name:\`\${se}-\${Date.now()}\`,agent_id:$})).id}}for(const[se,xe]of ie)await F.mutateAsync({vaultId:J,key:se,value:xe});X=[J]}}const W=await D.mutateAsync({agent_id:$,environment_id:R,vault_ids:X.length>0?X:void 0}),Z="as.first_session_shown";localStorage.getItem(Z)||(localStorage.setItem(Z,"1"),qe.success("Session started \u2014 try saying 'hi' in the chat.")),q({to:"/playground/$sessionId",params:{sessionId:W.id}})}catch($){const R=$?.body?.error?.message||($ instanceof Error?$.message:"Failed to start session");E(R),qe.error(R)}finally{w(!1)}}}function K(){if(d)return d.name;if(g.length>0)return"agent vault";const $=Object.entries(a).filter(([,R])=>R.trim());return $.length>0?\`\${$.length} key\${$.length>1?"s":""}\`:"none"}return m.jsxs("div",{className:"flex flex-1 items-center justify-center p-8",children:[e===0&&m.jsx(hxe,{onNext:z}),e===1&&m.jsx(mxe,{onNext:V,onBack:()=>t(0),engine:L.engine}),e===2&&m.jsx(gxe,{engine:L.engine,model:L.model,provider:U.provider,agentId:n?.mode==="select"?n.agent.id:null,agentName:L.name,hasExistingVaults:g.length>0,onNext:Q,onSkip:()=>t(3),onSelectVault:G,onBack:()=>t(1)}),e===3&&m.jsx(vxe,{agentName:L.name,envName:U.name,secretsLabel:K(),onStart:I,loading:b,error:S,isExistingAgent:H,isExistingEnv:B,onBack:()=>t(2)})]})}const yxe="0.4.16",xxe="https://github.com/agentstep/gateway",bxe={docker:"docker.com","apple-container":"apple.com",podman:"podman.io",sprites:"sprites.dev",e2b:"e2b.dev",vercel:"vercel.com",daytona:"daytona.io",fly:"fly.io",modal:"modal.com",anthropic:"anthropic.com"};function wxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function Sxe({apiKey:e}){const{data:t}=EA(),[n,r]=x.useState(!1),[i,o]=x.useState(!1),[a,l]=x.useState(!1),u=\`curl http://localhost:4000/v1/agents \\\\
|
|
217515
|
-
-H "x-api-key: \${e||"YOUR_API_KEY"}"\`;async function f(d,h){await navigator.clipboard.writeText(d),h==="key"?(o(!0),qe.success("API key copied"),setTimeout(()=>o(!1),2e3)):(l(!0),qe.success("Copied to clipboard"),setTimeout(()=>l(!1),2e3))}return m.jsxs("div",{className:"flex flex-col min-h-[calc(100vh-3rem)] mx-auto max-w-6xl w-full px-6 pt-16 pb-6",children:[m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start flex-1",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"size-2.5 rounded-full bg-lime-500 shrink-0"}),m.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight",children:"agentstep"})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-foreground leading-tight",children:"Run AI agents in sandboxed environments."}),m.jsx("p",{className:"text-base text-muted-foreground",children:"Start a session below, or use the API."})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[m.jsxs(ki,{to:"/quickstart",className:"inline-flex items-center h-10 px-5 rounded-lg bg-cta-gradient text-sm font-medium text-black hover:opacity-90 transition-opacity",children:[m.jsx(iw,{className:"size-4 mr-1.5"}),"Start Quickstart"]}),m.jsxs(ki,{to:"/docs",className:"inline-flex items-center h-10 px-5 rounded-lg ring-1 ring-foreground/10 text-sm font-medium text-foreground hover:bg-accent transition-colors",children:[m.jsx(ZH,{className:"size-4 mr-1.5"}),"View API Docs"]})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground font-mono",children:[m.jsx(rx,{num:"01",label:"Agent"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"02",label:"Environment"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"03",label:"Secrets"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"04",label:"Session"})]})]}),m.jsxs(fi,{className:"!py-0 divide-y divide-border",children:[m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Test it"}),m.jsx("button",{onClick:()=>f(u,"curl"),className:"text-muted-foreground hover:text-foreground transition-colors",children:a?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]}),m.jsx("pre",{className:"font-mono text-[11px] text-foreground bg-muted rounded px-2 py-2 whitespace-pre-wrap break-all select-all leading-relaxed",children:u})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Providers"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:[...$m,...Tu].map(d=>{const h=t?.[d],g=Tu.includes(d)?!0:h?.available??!0,v=Tu.includes(d);return m.jsxs("span",{title:h?.message??(v?"Configure API key to use":g?"Ready":"Not available"),className:\`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] ring-1 \${v?"ring-foreground/10 text-muted-foreground":g?"ring-lime-400/20 bg-lime-400/5 text-foreground":"ring-foreground/10 text-muted-foreground opacity-50"}\`,children:[!v&&m.jsx("span",{className:\`size-1.5 rounded-full \${g?"bg-lime-400":"bg-muted-foreground/40"}\`}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${bxe[d]??""}&sz=16\`,alt:"",className:"size-3"}),d]},d)})})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"API Key"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 font-mono text-[11px] text-foreground bg-muted rounded px-2 py-1.5 break-all select-all",children:e?n?e:wxe(e):"no key"}),m.jsx("button",{onClick:()=>r(d=>!d),className:"text-muted-foreground hover:text-foreground transition-colors",title:n?"Hide":"Reveal",children:n?m.jsx(BT,{className:"size-3.5"}):m.jsx($T,{className:"size-3.5"})}),m.jsx("button",{onClick:()=>e&&f(e,"key"),className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",disabled:!e,children:i?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]})]})]})]}),m.jsxs("div",{className:"mt-12 pt-6 flex items-center gap-4 text-[11px] text-muted-foreground",children:[m.jsx(ki,{to:"/docs",className:"hover:text-foreground transition-colors",children:"docs"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsx("a",{href:xxe,target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"github"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsxs("span",{className:"font-mono",children:["v",yxe]})]})]})}function rx({num:e,label:t}){return m.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[m.jsx("span",{className:"text-muted-foreground/60",children:e}),m.jsx("span",{className:"text-foreground",children:t})]})}function Exe(){return m.jsx("div",{className:"mx-auto max-w-6xl px-6 pt-16 pb-8",children:m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start animate-pulse",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"h-10 w-3/4 bg-muted rounded"}),m.jsx("div",{className:"h-5 w-1/2 bg-muted rounded"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsx("div",{className:"h-10 w-40 bg-muted rounded-lg"}),m.jsx("div",{className:"h-10 w-32 bg-muted rounded-lg"})]})]}),m.jsx("div",{className:"h-72 bg-muted rounded-xl"})]})})}function Cxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function _xe({apiKey:e}){const[t,n]=x.useState(!1),[r,i]=x.useState(!1);async function o(){e&&(await navigator.clipboard.writeText(e),i(!0),qe.success("API key copied"),setTimeout(()=>i(!1),2e3))}return m.jsx(fi,{size:"sm",className:"mt-2",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[m.jsx(qT,{className:"size-3.5"}),"API Key"]}),e?m.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-xs text-foreground break-all select-all",children:t?e:Cxe(e)}),m.jsx("button",{type:"button",onClick:()=>n(a=>!a),className:"text-muted-foreground hover:text-foreground transition-colors",title:t?"Hide":"Reveal",children:t?m.jsx(BT,{className:"size-3.5"}):m.jsx($T,{className:"size-3.5"})}),m.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:r?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]}):m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No API key found"})]})})}function kxe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Oxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}const zz="as.hero_dismissed",jxe=900*1e3,Fz=60;function Txe(){const e=Bs(),t=Hs(),n=mw(),r=rf(),[i,o]=x.useState(()=>localStorage.getItem(zz)==="1");x.useEffect(()=>{const H=()=>o(localStorage.getItem(zz)==="1");return window.addEventListener("storage",H),()=>window.removeEventListener("storage",H)},[]);const a=t.data,l=n.data,u=r.data,f=a?.length??0,d=u?.length??0,h=l?.length??0,g=l?.filter(H=>H.status==="active"||H.status==="running").length??0,v=l?.slice(0,20)??[],b=window.__MA_API_KEY__??"",w=!t.isPending&&!n.isPending&&!r.isPending,S=t.isError||n.isError||r.isError,E=w&&!S&&h===0,k=w&&!E,O=Wq({windowMs:jxe,groupBy:"agent"}),j=Gq({windowMinutes:Fz});if(!w&&!S)return m.jsx(Exe,{});if(E&&!i)return m.jsx(Sxe,{apiKey:b});const A=O.data?.totals,T=j.data?.totals,N=k&&(O.isPending||j.isPending),P=A?.turn_count??0,F=A?.error_count??0,D=A?.cost_usd??0,q=T?.count??0,L=F>5?"danger":F>0?"warn":"neutral",U=g>0?"accent":"neutral";return m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsxs("div",{className:"grid grid-cols-3 gap-6 h-full",children:[m.jsxs("div",{className:"col-span-2 flex flex-col gap-6 min-h-0",children:[m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[m.jsx(Ir,{label:"Active",value:g,tone:U,info:"Sessions currently running a turn. Counts sessions whose status is active or running."}),m.jsx(Ir,{label:"Turns / 15m",value:P,loading:N,info:"Agent turns completed in the last 15 minutes. A turn is one user-message \u2192 agent-response round (may include multiple tool calls)."}),m.jsx(Ir,{label:"Errors / 15m",value:F,tone:L,loading:N,info:"Agent turns that ended in an error stop reason over the last 15 minutes (separate from API 5xx errors)."}),m.jsx(Ir,{label:"Cost / 15m",value:CO(D),loading:N,info:"Estimated model cost accrued in the last 15 minutes, summed across all agents and sessions."})]}),m.jsx(ki,{to:"/analytics",search:{tab:"agents"},className:"block group",children:m.jsx(fi,{size:"sm",className:"transition-colors group-hover:ring-foreground/20",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:["Requests \u2014 last ",Fz," min"]}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[q.toLocaleString()," total"]})]}),m.jsx("div",{className:"mt-2",children:m.jsx(Xq,{data:j.data?.timeline.map(H=>H.count)??[],height:64})})]})})}),m.jsxs(fi,{className:"flex-1 flex flex-col min-h-0",children:[m.jsx(_s,{children:m.jsx(ks,{children:"Recent Activity"})}),m.jsx(Lr,{className:"flex-1 overflow-y-auto min-h-0",children:v.length>0?m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:v.map(H=>{const B=a?.find(z=>z.id===H.agent?.id)?.name??H.agent?.id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>e({to:"/playground/$sessionId",params:{sessionId:H.id}}),children:[m.jsx(Ue,{className:"font-medium",children:H.title??H.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-muted-foreground",children:B}),m.jsx(Ue,{children:Oxe(H.status)}),m.jsx(Ue,{className:"text-muted-foreground",children:kxe(H.created_at)})]},H.id)})})]}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No sessions yet."})})]})]}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Quick Actions"}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs(ki,{to:"/agents",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(bc,{className:"size-4"})}),"Create Agent"]}),m.jsxs(ki,{to:"/environments",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(aw,{className:"size-4"})}),"Add Environment"]}),m.jsxs(ki,{to:"/playground",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(iw,{className:"size-4"})}),"Open Playground"]}),m.jsxs(ki,{to:"/quickstart",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(Nfe,{className:"size-4"})}),"Quick Start"]})]}),m.jsx(_xe,{apiKey:b}),m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"System"}),m.jsxs(ki,{to:"/analytics",search:{tab:"agents"},className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-0.5",children:["View analytics",m.jsx(oue,{className:"size-3"})]})]}),m.jsxs("div",{className:"mt-2 flex flex-col gap-1 text-[11px] font-mono",children:[m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"requests"}),m.jsxs("span",{className:"text-foreground tabular-nums",children:[q.toLocaleString()," ",m.jsx("span",{className:"text-muted-foreground",children:"(60m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"errors"}),m.jsxs("span",{className:\`tabular-nums \${F>0?"text-amber-500":"text-foreground"}\`,children:[F," ",m.jsx("span",{className:"text-muted-foreground",children:"(15m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"agents"}),m.jsx("span",{className:"text-foreground tabular-nums",children:f})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"environments"}),m.jsx("span",{className:"text-foreground tabular-nums",children:d})]})]})]})})]})]})})}function Axe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Nxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Rxe(){const{data:e}=mw(),{data:t}=Hs(),{data:n}=rf(),r=Bs();return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-6",children:[m.jsx(Sc,{title:"Sessions",description:"View and manage agent sessions.",actionLabel:"New Session",onAction:()=>r({to:"/quickstart"})}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Environment"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:e.map(i=>{const o=t?.find(l=>l.id===i.agent?.id)?.name??i.agent?.id?.slice(0,8)??"\u2014",a=n?.find(l=>l.id===i.environment_id)?.name??i.environment_id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-accent/30",onClick:()=>r({to:"/playground/$sessionId",params:{sessionId:i.id}}),children:[m.jsx(Ue,{className:"font-medium text-foreground",children:i.title??i.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:o}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:a}),m.jsx(Ue,{children:Nxe(i.status)}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Axe(i.created_at)})]},i.id)})})]})}):m.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"No sessions yet."})]})}function Zq(e){return Bn({queryKey:["events",e],queryFn:()=>Xe(\`/sessions/\${e}/events?limit=500&order=asc\`),enabled:!!e,select:t=>t.data})}const ix={user:"bg-blue-400/10 text-blue-400 border-blue-400/20",agent:"bg-lime-400/10 text-lime-400 border-lime-400/20",error:"bg-red-400/10 text-red-400 border-red-400/20",status:"bg-amber-400/10 text-amber-400 border-amber-400/20"};function Pxe(e){return e.startsWith("user")?ix.user:e.startsWith("agent")?ix.agent:e.includes("error")?ix.error:e.includes("status")?ix.status:"bg-muted text-muted-foreground border-border"}function Mxe({event:e,prevEvent:t}){const[n,r]=x.useState(!1),{id:i,session_id:o,seq:a,type:l,processed_at:u,...f}=e,d=t?.processed_at?new Date(t.processed_at).getTime():0,h=e.processed_at?new Date(e.processed_at).getTime():0,g=d&&h?h-d:0,v=Ixe(e.type,e);return m.jsxs("div",{className:"border-b border-border",children:[m.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted overflow-hidden min-w-0",onClick:()=>r(!n),children:[m.jsx(nw,{className:Ne("size-3 shrink-0 text-muted-foreground/50 transition-transform",n&&"rotate-90")}),m.jsx("span",{className:"w-5 text-right font-mono text-xs text-muted-foreground",children:e.seq}),m.jsx(an,{variant:"outline",className:Ne("h-4 shrink-0 rounded px-1.5 font-mono text-xs font-medium whitespace-nowrap",Pxe(e.type)),children:e.type}),m.jsx("span",{className:"w-0 flex-1 truncate text-xs text-muted-foreground",children:v}),g>0&&m.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/50",children:["+",g,"ms"]})]}),n&&m.jsxs("div",{className:"relative border-t border-border bg-muted px-4 py-3",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(f,null,2)),children:m.jsx(Lu,{className:"size-3"})}),m.jsx("pre",{className:"whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-muted-foreground",children:JSON.stringify(f,null,2)})]})]})}function Ixe(e,t){if(e==="user.message"||e==="agent.message"){const n=t.content;if(n&&Array.isArray(n))return n.filter(i=>i.type==="text").map(i=>i.text).join("").slice(0,100);if(typeof t.text=="string")return t.text.slice(0,100)}if(e==="agent.tool_use")return t.name||"tool";if(e.includes("error"))return t.error?.message||"";if(e.includes("status")){const n=t.stop_reason;return n&&typeof n=="object"?n.type||"":n||""}return""}function Jq(){const e=bn(i=>i.activeSessionId),{data:t}=Zq(e),n=x.useRef(null),r=t??[];return x.useEffect(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[r.length]),e?m.jsxs("div",{className:"flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[m.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[r.length," events"]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(r,null,2)),children:m.jsx(Lu,{className:"size-3"})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.map((i,o)=>m.jsx(Mxe,{event:i,prevEvent:r[o-1]},i.id)),m.jsx("div",{ref:n})]})]}):m.jsx("p",{className:"p-3 text-xs text-muted-foreground/50",children:"No session selected"})}function Dxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Lxe({id:e}){const{data:t}=xh(e),{data:n}=Hs(),r=bn(o=>o.setActiveSessionId);x.useEffect(()=>{r(e)},[e,r]);const i=n?.find(o=>o.id===t?.agent?.id)?.name??t?.agent?.id?.slice(0,8)??"\u2014";return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-4",children:[m.jsx("div",{children:m.jsxs(ki,{to:"/sessions",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(QH,{className:"size-3.5"}),"All Sessions"]})}),m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t?.title??e.slice(0,12)+"\u2026"}),m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agent: ",m.jsx("span",{className:"text-foreground",children:i})]})]}),t&&Dxe(t.status)]}),m.jsx("div",{className:"rounded-lg border border-border overflow-hidden",style:{minHeight:400},children:m.jsx(Jq,{})})]})}const e9=x.createContext(void 0);function CA(){const e=x.useContext(e9);if(e===void 0)throw new Error(Xt(10));return e}const zxe={value:()=>null},Fxe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:u=!0,onValueChange:f,multiple:d=!1,orientation:h="vertical",value:g,defaultValue:v,style:b,...w}=t,S=tf(),E=x.useMemo(()=>{if(g===void 0)return v??[]},[g,v]),k=Le(f),O=x.useRef([]),[j,A]=zu({controlled:g,default:E,name:"Accordion",state:"value"}),T=Le((D,q)=>{const L=ct(Wo);if(d)if(q){const U=j.slice();if(U.push(D),k(U,L),L.isCanceled)return;A(U)}else{const U=j.filter(H=>H!==D);if(k(U,L),L.isCanceled)return;A(U)}else{const U=j[0]===D?[]:[D];if(k(U,L),L.isCanceled)return;A(U)}}),N=x.useMemo(()=>({value:j,disabled:o,orientation:h}),[j,o,h]),P=x.useMemo(()=>({accordionItemRefs:O,direction:S,disabled:o,handleValueChange:T,hiddenUntilFound:a??!1,keepMounted:l??!1,loopFocus:u,orientation:h,state:N,value:j}),[S,o,T,a,l,u,h,N,j]),F=vt("div",t,{state:N,ref:n,props:[{dir:S,role:"region"},w],stateAttributesMapping:zxe});return m.jsx(e9.Provider,{value:P,children:m.jsx(Ig,{elementsRef:O,children:F})})});function Bxe(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,o=t!==void 0,[a,l]=zu({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:f,transitionStatus:d}=ph(a,!0,!0),[h,g]=x.useState(a),[{height:v,width:b},w]=x.useState({height:void 0,width:void 0}),S=Br(),[E,k]=x.useState(),O=E??S,[j,A]=x.useState(!1),[T,N]=x.useState(!1),P=x.useRef(null),F=x.useRef(null),D=x.useRef(null),q=x.useRef(null),L=V0(q,!1),U=Le(H=>{const B=!a,z=ct(ja,H.nativeEvent);if(r(B,z),z.isCanceled)return;const V=q.current;F.current==="css-animation"&&V!=null&&V.style.removeProperty("animation-name"),!j&&!T&&(F.current!=null&&F.current!=="css-animation"&&!u&&B&&f(!0),F.current==="css-animation"&&(!h&&B&&g(!0),!u&&B&&f(!0))),l(B),F.current==="none"&&u&&!B&&f(!1)});return Pe(()=>{o&&F.current==="none"&&!a&&f(!1)},[o,a,t,f]),x.useMemo(()=>({abortControllerRef:P,animationTypeRef:F,disabled:i,handleTrigger:U,height:v,mounted:u,open:a,panelId:O,panelRef:q,runOnceAnimationsFinish:L,setDimensions:w,setHiddenUntilFound:A,setKeepMounted:N,setMounted:f,setOpen:l,setPanelIdState:k,setVisible:g,transitionDimensionRef:D,transitionStatus:d,visible:h,width:b}),[P,F,i,U,v,u,a,O,q,L,w,A,N,f,l,g,D,d,h,b])}const t9=x.createContext(void 0);function n9(){const e=x.useContext(t9);if(e===void 0)throw new Error(Xt(15));return e}const r9=x.createContext(void 0);function _A(){const e=x.useContext(r9);if(e===void 0)throw new Error(Xt(9));return e}let ym=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ns.startingStyle]="startingStyle",e[e.endingStyle=Ns.endingStyle]="endingStyle",e})({}),$xe=(function(e){return e.panelOpen="data-panel-open",e})({});const Uxe={[ym.open]:""},Hxe={[ym.closed]:""},qxe={open(e){return e?{[$xe.panelOpen]:""}:null}},Vxe={open(e){return e?Uxe:Hxe}};let Kxe=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const kA={...Vxe,index:e=>Number.isInteger(e)?{[Kxe.index]:String(e)}:null,...$s,value:()=>null},Yxe=x.forwardRef(function(t,n){const{className:r,disabled:i=!1,onOpenChange:o,render:a,value:l,style:u,...f}=t,{ref:d,index:h}=Mg(),g=Po(n,d),{disabled:v,handleValueChange:b,state:w,value:S}=CA(),E=Br(),k=l??E,O=i||v,j=x.useMemo(()=>{if(!S)return!1;for(let H=0;H<S.length;H+=1)if(S[H]===k)return!0;return!1},[S,k]),A=Le((H,B)=>{o?.(H,B),!B.isCanceled&&b(k,H)}),T=Bxe({open:j,onOpenChange:A,disabled:O}),N=x.useMemo(()=>({open:T.open,disabled:T.disabled,hidden:!T.mounted,transitionStatus:T.transitionStatus}),[T.open,T.disabled,T.mounted,T.transitionStatus]),P=x.useMemo(()=>({...T,onOpenChange:A,state:N}),[T,N,A]),F=x.useMemo(()=>({...w,index:h,disabled:O,open:j}),[O,h,j,w]),[D,q]=x.useState(Br()),L=x.useMemo(()=>({open:j,state:F,setTriggerId:q,triggerId:D}),[j,F,q,D]),U=vt("div",t,{state:F,ref:g,props:f,stateAttributesMapping:kA});return m.jsx(t9.Provider,{value:P,children:m.jsx(r9.Provider,{value:L,children:U})})}),Wxe=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{state:l}=_A();return vt("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:kA})}),Gxe=new Set([vs,Jl,ec,Fu,vh,yh]);function Xxe(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const i=t[r];if(!mO(i)){const o=i?.querySelector('[type="button"], [role="button"]');o&&!mO(o)&&n.push(o)}}return n}const Qxe=x.forwardRef(function(t,n){const{disabled:r,className:i,id:o,render:a,nativeButton:l=!0,style:u,...f}=t,{panelId:d,open:h,handleTrigger:g,disabled:v}=n9(),b=r??v,{getButtonProps:w,buttonRef:S}=Zo({disabled:b,focusableWhenDisabled:!0,native:l,composite:!0}),{accordionItemRefs:E,direction:k,loopFocus:O,orientation:j}=CA(),A=k==="rtl",T=j==="horizontal",{state:N,setTriggerId:P,triggerId:F}=_A();Pe(()=>(o&&P(o),()=>{P(void 0)}),[o,P]);const D=x.useMemo(()=>({"aria-controls":h?d:void 0,"aria-expanded":h,id:F,tabIndex:0,onClick:g,onKeyDown(L){if(!Gxe.has(L.key))return;_i(L);const U=Xxe(E),B=U.length-1;let z=-1;const V=U.indexOf(L.currentTarget);function Q(){O?z=V+1>B?0:V+1:z=Math.min(V+1,B)}function G(){O?z=V===0?B:V-1:z=V-1}switch(L.key){case vs:T||Q();break;case Jl:T||G();break;case ec:T&&(A?G():Q());break;case Fu:T&&(A?Q():G());break;case"Home":z=0;break;case"End":z=B;break}z>-1&&U[z].focus()}}),[E,g,F,T,A,O,h,d]);return vt("button",t,{state:N,ref:[n,S],props:[D,f,w],stateAttributesMapping:qxe})});let Zxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function Jxe(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:o,keepMounted:a,id:l,mounted:u,onOpenChange:f,open:d,panelRef:h,runOnceAnimationsFinish:g,setDimensions:v,setMounted:b,setOpen:w,setVisible:S,transitionDimensionRef:E,visible:k,width:O}=e,j=x.useRef(!1),A=x.useRef(null),T=x.useRef(d),N=x.useRef(d),P=Cg(),F=x.useMemo(()=>n.current==="css-animation"?!k:!d&&!u,[d,u,k,n]),D=Le(L=>{if(!L)return;if(n.current==null||E.current==null){const B=getComputedStyle(L),z=B.animationName!=="none"&&B.animationName!=="",V=B.transitionDuration!=="0s"&&B.transitionDuration!=="";z&&V||(B.animationName==="none"&&B.transitionDuration!=="0s"?n.current="css-transition":B.animationName!=="none"&&B.transitionDuration==="0s"?n.current="css-animation":n.current="none"),L.getAttribute(Zxe.orientation)==="horizontal"||B.transitionProperty.indexOf("width")>-1?E.current="width":E.current="height"}if(n.current!=="css-transition")return;(i===void 0||O===void 0)&&(v({height:L.scrollHeight,width:L.scrollWidth}),N.current&&L.style.setProperty("transition-duration","0s"));let U=-1,H=-1;return U=Vn.request(()=>{N.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})}),()=>{Vn.cancel(U),Vn.cancel(H)}}),q=Po(r,h,D);return Pe(()=>{if(n.current!=="css-transition")return;const L=h.current;if(!L)return;let U=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){const H={"justify-content":L.style.justifyContent,"align-items":L.style.alignItems,"align-content":L.style.alignContent,"justify-items":L.style.justifyItems};Object.keys(H).forEach(B=>{L.style.setProperty(B,"initial","important")}),!N.current&&!a&&L.setAttribute(ym.startingStyle,""),v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{Object.entries(H).forEach(([B,z])=>{z===""?L.style.removeProperty(B):L.style.setProperty(B,z)})})}else{if(L.scrollHeight===0&&L.scrollWidth===0)return;v({height:L.scrollHeight,width:L.scrollWidth});const H=new AbortController;t.current=H;const B=H.signal;let z=null;const V=ym.endingStyle;return z=new MutationObserver(Q=>{Q.some(I=>I.type==="attributes"&&I.attributeName===V)&&(z?.disconnect(),z=null,g(()=>{v({height:0,width:0}),L.style.removeProperty("content-visibility"),b(!1),t.current===H&&(t.current=null)},B))}),z.observe(L,{attributes:!0,attributeFilter:[V]}),()=>{z?.disconnect(),P.cancel(),t.current===H&&(H.abort(),t.current=null)}}return()=>{Vn.cancel(U)}},[t,n,P,o,a,u,d,h,g,v,b]),Pe(()=>{if(n.current!=="css-animation")return;const L=h.current;L&&(A.current=L.style.animationName||A.current,L.style.setProperty("animation-name","none"),v({height:L.scrollHeight,width:L.scrollWidth}),!T.current&&!j.current&&L.style.removeProperty("animation-name"),d?(t.current!=null&&(t.current.abort(),t.current=null),b(!0),S(!0)):(t.current=new AbortController,g(()=>{b(!1),S(!1),t.current=null},t.current.signal)))},[t,n,d,h,g,v,b,S,k]),Sg(()=>{const L=Vn.request(()=>{T.current=!1});return()=>Vn.cancel(L)}),Pe(()=>{if(!o)return;const L=h.current;if(!L)return;let U=-1,H=-1;return d&&j.current&&(L.style.transitionDuration="0s",v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{j.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})})),()=>{Vn.cancel(U),Vn.cancel(H)}},[o,d,h,v]),Pe(()=>{const L=h.current;L&&o&&F&&(L.setAttribute("hidden","until-found"),n.current==="css-transition"&&L.setAttribute(ym.startingStyle,""))},[o,F,n,h]),x.useEffect(function(){const U=h.current;if(!U)return;function H(B){j.current=!0,w(!0),f(!0,ct(Wo,B))}return kt(U,"beforematch",H)},[f,h,w]),x.useMemo(()=>({props:{hidden:F,id:l,ref:q}}),[F,l,q])}let Bz=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const ebe=x.forwardRef(function(t,n){const{className:r,hiddenUntilFound:i,keepMounted:o,id:a,render:l,style:u,...f}=t,{hiddenUntilFound:d,keepMounted:h}=CA(),{abortControllerRef:g,animationTypeRef:v,height:b,mounted:w,onOpenChange:S,open:E,panelId:k,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setHiddenUntilFound:T,setKeepMounted:N,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U,setPanelIdState:H,transitionStatus:B}=n9(),z=i??d,V=o??h;Pe(()=>{if(a)return H(a),()=>{H(void 0)}},[a,H]),Pe(()=>{T(z)},[T,z]),Pe(()=>{N(V)},[N,V]),Qo({open:E&&B==="idle",ref:O,onComplete(){E&&A({width:void 0,height:void 0})}});const{props:Q}=Jxe({abortControllerRef:g,animationTypeRef:v,externalRef:n,height:b,hiddenUntilFound:z,id:a??k,keepMounted:V,mounted:w,onOpenChange:S,open:E,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U}),{state:G,triggerId:I}=_A(),K=x.useMemo(()=>({...G,transitionStatus:B}),[G,B]),$=vt("div",t,{state:K,ref:[n,O],props:[Q,{"aria-labelledby":I,role:"region",style:{[Bz.accordionPanelHeight]:b===void 0?"auto":\`\${b}px\`,[Bz.accordionPanelWidth]:U===void 0?"auto":\`\${U}px\`}},f],stateAttributesMapping:kA});return V||z||w?$:null});function OA({className:e,...t}){return m.jsx(Fxe,{"data-slot":"accordion",className:Ne("flex w-full flex-col",e),...t})}function xm({className:e,...t}){return m.jsx(Yxe,{"data-slot":"accordion-item",className:Ne("not-last:border-b",e),...t})}function bm({className:e,children:t,...n}){return m.jsx(Wxe,{className:"flex",children:m.jsxs(Qxe,{"data-slot":"accordion-trigger",className:Ne("group/accordion-trigger relative flex flex-1 items-center justify-between py-2.5 text-left text-sm font-medium transition-colors outline-none hover:text-foreground focus-visible:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,m.jsx(Ng,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),m.jsx(n8,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function wm({className:e,children:t,...n}){return m.jsx(ebe,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:m.jsx("div",{className:Ne("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}function tbe(e){const t=hn(),n=x.useRef(null),r=x.useRef(0),i=x.useRef(1e3);x.useEffect(()=>{if(!e)return;r.current=0,i.current=1e3;function o(){n.current?.abort();const a=new AbortController;n.current=a;const l=bn.getState().apiKey,u=\`/v1/sessions/\${e}/events/stream?after_seq=\${r.current}\`;fetch(u,{signal:a.signal,headers:{"x-api-key":l}}).then(async f=>{if(!f.ok||!f.body){if(f.status===404){console.warn("[sse] session not found, stopping");return}throw new Error(\`SSE \${f.status}\`)}i.current=1e3;const d=f.body.getReader(),h=new TextDecoder;let g="";for(;;){const{done:v,value:b}=await d.read();if(v)break;g+=h.decode(b,{stream:!0});const w=g.split(\`
|
|
217593
|
+
-H "x-api-key: \${e||"YOUR_API_KEY"}"\`;async function f(d,h){await navigator.clipboard.writeText(d),h==="key"?(o(!0),qe.success("API key copied"),setTimeout(()=>o(!1),2e3)):(l(!0),qe.success("Copied to clipboard"),setTimeout(()=>l(!1),2e3))}return m.jsxs("div",{className:"flex flex-col min-h-[calc(100vh-3rem)] mx-auto max-w-6xl w-full px-6 pt-16 pb-6",children:[m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start flex-1",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"size-2.5 rounded-full bg-lime-500 shrink-0"}),m.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight",children:"agentstep"})]}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-foreground leading-tight",children:"Run AI agents in sandboxed environments."}),m.jsx("p",{className:"text-base text-muted-foreground",children:"Start a session below, or use the API."})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[m.jsxs(ki,{to:"/quickstart",className:"inline-flex items-center h-10 px-5 rounded-lg bg-cta-gradient text-sm font-medium text-black hover:opacity-90 transition-opacity",children:[m.jsx(iw,{className:"size-4 mr-1.5"}),"Start Quickstart"]}),m.jsxs(ki,{to:"/docs",className:"inline-flex items-center h-10 px-5 rounded-lg ring-1 ring-foreground/10 text-sm font-medium text-foreground hover:bg-accent transition-colors",children:[m.jsx(ZH,{className:"size-4 mr-1.5"}),"View API Docs"]})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted-foreground font-mono",children:[m.jsx(rx,{num:"01",label:"Agent"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"02",label:"Environment"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"03",label:"Secrets"}),m.jsx("span",{className:"text-muted-foreground/40",children:"\u2192"}),m.jsx(rx,{num:"04",label:"Session"})]})]}),m.jsxs(fi,{className:"!py-0 divide-y divide-border",children:[m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Test it"}),m.jsx("button",{onClick:()=>f(u,"curl"),className:"text-muted-foreground hover:text-foreground transition-colors",children:a?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]}),m.jsx("pre",{className:"font-mono text-[11px] text-foreground bg-muted rounded px-2 py-2 whitespace-pre-wrap break-all select-all leading-relaxed",children:u})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Providers"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:[...$m,...Tu].map(d=>{const h=t?.[d],g=Tu.includes(d)?!0:h?.available??!0,v=Tu.includes(d);return m.jsxs("span",{title:h?.message??(v?"Configure API key to use":g?"Ready":"Not available"),className:\`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] ring-1 \${v?"ring-foreground/10 text-muted-foreground":g?"ring-lime-400/20 bg-lime-400/5 text-foreground":"ring-foreground/10 text-muted-foreground opacity-50"}\`,children:[!v&&m.jsx("span",{className:\`size-1.5 rounded-full \${g?"bg-lime-400":"bg-muted-foreground/40"}\`}),m.jsx("img",{src:\`https://www.google.com/s2/favicons?domain=\${bxe[d]??""}&sz=16\`,alt:"",className:"size-3"}),d]},d)})})]}),m.jsxs(Lr,{className:"flex flex-col gap-2 py-4",children:[m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"API Key"}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 font-mono text-[11px] text-foreground bg-muted rounded px-2 py-1.5 break-all select-all",children:e?n?e:wxe(e):"no key"}),m.jsx("button",{onClick:()=>r(d=>!d),className:"text-muted-foreground hover:text-foreground transition-colors",title:n?"Hide":"Reveal",children:n?m.jsx(BT,{className:"size-3.5"}):m.jsx($T,{className:"size-3.5"})}),m.jsx("button",{onClick:()=>e&&f(e,"key"),className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",disabled:!e,children:i?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]})]})]})]}),m.jsxs("div",{className:"mt-12 pt-6 flex items-center gap-4 text-[11px] text-muted-foreground",children:[m.jsx(ki,{to:"/docs",className:"hover:text-foreground transition-colors",children:"docs"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsx("a",{href:xxe,target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"github"}),m.jsx("span",{className:"text-muted-foreground/30",children:"\xB7"}),m.jsxs("span",{className:"font-mono",children:["v",yxe]})]})]})}function rx({num:e,label:t}){return m.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[m.jsx("span",{className:"text-muted-foreground/60",children:e}),m.jsx("span",{className:"text-foreground",children:t})]})}function Exe(){return m.jsx("div",{className:"mx-auto max-w-6xl px-6 pt-16 pb-8",children:m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_360px] gap-8 items-start animate-pulse",children:[m.jsxs("div",{className:"flex flex-col gap-6",children:[m.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),m.jsxs("div",{className:"flex flex-col gap-3",children:[m.jsx("div",{className:"h-10 w-3/4 bg-muted rounded"}),m.jsx("div",{className:"h-5 w-1/2 bg-muted rounded"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsx("div",{className:"h-10 w-40 bg-muted rounded-lg"}),m.jsx("div",{className:"h-10 w-32 bg-muted rounded-lg"})]})]}),m.jsx("div",{className:"h-72 bg-muted rounded-xl"})]})})}function Cxe(e){return e.length<=10?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":\`\${e.slice(0,6)}\u2022\u2022\u2022\u2022\${e.slice(-4)}\`}function _xe({apiKey:e}){const[t,n]=x.useState(!1),[r,i]=x.useState(!1);async function o(){e&&(await navigator.clipboard.writeText(e),i(!0),qe.success("API key copied"),setTimeout(()=>i(!1),2e3))}return m.jsx(fi,{size:"sm",className:"mt-2",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[m.jsx(qT,{className:"size-3.5"}),"API Key"]}),e?m.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[m.jsx("code",{className:"flex-1 rounded bg-muted px-2 py-1.5 font-mono text-xs text-foreground break-all select-all",children:t?e:Cxe(e)}),m.jsx("button",{type:"button",onClick:()=>n(a=>!a),className:"text-muted-foreground hover:text-foreground transition-colors",title:t?"Hide":"Reveal",children:t?m.jsx(BT,{className:"size-3.5"}):m.jsx($T,{className:"size-3.5"})}),m.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground transition-colors",title:"Copy",children:r?m.jsx(Aa,{className:"size-3.5"}):m.jsx(Lu,{className:"size-3.5"})})]}):m.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No API key found"})]})})}function kxe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Oxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}const zz="as.hero_dismissed",jxe=900*1e3,Fz=60;function Txe(){const e=Bs(),t=Hs(),n=mw(),r=rf(),[i,o]=x.useState(()=>localStorage.getItem(zz)==="1");x.useEffect(()=>{const H=()=>o(localStorage.getItem(zz)==="1");return window.addEventListener("storage",H),()=>window.removeEventListener("storage",H)},[]);const a=t.data,l=n.data,u=r.data,f=a?.length??0,d=u?.length??0,h=l?.length??0,g=l?.filter(H=>H.status==="active"||H.status==="running").length??0,v=l?.slice(0,20)??[],b=window.__MA_API_KEY__??"",w=!t.isPending&&!n.isPending&&!r.isPending,S=t.isError||n.isError||r.isError,E=w&&!S&&h===0,k=w&&!E,O=Wq({windowMs:jxe,groupBy:"agent"}),j=Gq({windowMinutes:Fz});if(!w&&!S)return m.jsx(Exe,{});if(E&&!i)return m.jsx(Sxe,{apiKey:b});const A=O.data?.totals,T=j.data?.totals,N=k&&(O.isPending||j.isPending),P=A?.turn_count??0,F=A?.error_count??0,D=A?.cost_usd??0,q=T?.count??0,L=F>5?"danger":F>0?"warn":"neutral",U=g>0?"accent":"neutral";return m.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:m.jsxs("div",{className:"grid grid-cols-3 gap-6 h-full",children:[m.jsxs("div",{className:"col-span-2 flex flex-col gap-6 min-h-0",children:[m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[m.jsx(Ir,{label:"Active",value:g,tone:U,info:"Sessions currently running a turn. Counts sessions whose status is active or running."}),m.jsx(Ir,{label:"Turns / 15m",value:P,loading:N,info:"Agent turns completed in the last 15 minutes. A turn is one user-message \u2192 agent-response round (may include multiple tool calls)."}),m.jsx(Ir,{label:"Errors / 15m",value:F,tone:L,loading:N,info:"Agent turns that ended in an error stop reason over the last 15 minutes (separate from API 5xx errors)."}),m.jsx(Ir,{label:"Cost / 15m",value:CO(D),loading:N,info:"Estimated model cost accrued in the last 15 minutes, summed across all agents and sessions."})]}),m.jsx(ki,{to:"/analytics",search:{tab:"agents"},className:"block group",children:m.jsx(fi,{size:"sm",className:"transition-colors group-hover:ring-foreground/20",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:["Requests \u2014 last ",Fz," min"]}),m.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[q.toLocaleString()," total"]})]}),m.jsx("div",{className:"mt-2",children:m.jsx(Xq,{data:j.data?.timeline.map(H=>H.count)??[],height:64})})]})})}),m.jsxs(fi,{className:"flex-1 flex flex-col min-h-0",children:[m.jsx(_s,{children:m.jsx(ks,{children:"Recent Activity"})}),m.jsx(Lr,{className:"flex-1 overflow-y-auto min-h-0",children:v.length>0?m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:v.map(H=>{const B=a?.find(z=>z.id===H.agent?.id)?.name??H.agent?.id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>e({to:"/playground/$sessionId",params:{sessionId:H.id}}),children:[m.jsx(Ue,{className:"font-medium",children:H.title??H.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-muted-foreground",children:B}),m.jsx(Ue,{children:Oxe(H.status)}),m.jsx(Ue,{className:"text-muted-foreground",children:kxe(H.created_at)})]},H.id)})})]}):m.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No sessions yet."})})]})]}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Quick Actions"}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsxs(ki,{to:"/agents",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(bc,{className:"size-4"})}),"Create Agent"]}),m.jsxs(ki,{to:"/environments",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(aw,{className:"size-4"})}),"Add Environment"]}),m.jsxs(ki,{to:"/playground",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(iw,{className:"size-4"})}),"Open Playground"]}),m.jsxs(ki,{to:"/quickstart",className:"flex items-center gap-3 rounded-xl p-3 text-sm font-medium text-foreground ring-1 ring-foreground/10 hover:bg-accent transition-colors",children:[m.jsx("span",{className:"text-muted-foreground",children:m.jsx(Nfe,{className:"size-4"})}),"Quick Start"]})]}),m.jsx(_xe,{apiKey:b}),m.jsx(fi,{size:"sm",children:m.jsxs(Lr,{children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"System"}),m.jsxs(ki,{to:"/analytics",search:{tab:"agents"},className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-0.5",children:["View analytics",m.jsx(oue,{className:"size-3"})]})]}),m.jsxs("div",{className:"mt-2 flex flex-col gap-1 text-[11px] font-mono",children:[m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"requests"}),m.jsxs("span",{className:"text-foreground tabular-nums",children:[q.toLocaleString()," ",m.jsx("span",{className:"text-muted-foreground",children:"(60m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"errors"}),m.jsxs("span",{className:\`tabular-nums \${F>0?"text-amber-500":"text-foreground"}\`,children:[F," ",m.jsx("span",{className:"text-muted-foreground",children:"(15m)"})]})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"agents"}),m.jsx("span",{className:"text-foreground tabular-nums",children:f})]}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-muted-foreground",children:"environments"}),m.jsx("span",{className:"text-foreground tabular-nums",children:d})]})]})]})})]})]})})}function Axe(e){const t=typeof e=="string"?new Date(e).getTime():e,n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const i=Math.floor(r/60);return i<24?\`\${i}h ago\`:\`\${Math.floor(i/24)}d ago\`}function Nxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Rxe(){const{data:e}=mw(),{data:t}=Hs(),{data:n}=rf(),r=Bs();return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-6",children:[m.jsx(Sc,{title:"Sessions",description:"View and manage agent sessions.",actionLabel:"New Session",onAction:()=>r({to:"/quickstart"})}),e&&e.length>0?m.jsx("div",{className:"rounded-lg border border-border",children:m.jsxs(eo,{children:[m.jsx(Jo,{children:m.jsxs(yn,{children:[m.jsx(et,{children:"Title"}),m.jsx(et,{children:"Agent"}),m.jsx(et,{children:"Environment"}),m.jsx(et,{children:"Status"}),m.jsx(et,{children:"Created"})]})}),m.jsx(to,{children:e.map(i=>{const o=t?.find(l=>l.id===i.agent?.id)?.name??i.agent?.id?.slice(0,8)??"\u2014",a=n?.find(l=>l.id===i.environment_id)?.name??i.environment_id?.slice(0,8)??"\u2014";return m.jsxs(yn,{className:"cursor-pointer hover:bg-accent/30",onClick:()=>r({to:"/playground/$sessionId",params:{sessionId:i.id}}),children:[m.jsx(Ue,{className:"font-medium text-foreground",children:i.title??i.id.slice(0,12)+"\u2026"}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:o}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:a}),m.jsx(Ue,{children:Nxe(i.status)}),m.jsx(Ue,{className:"text-sm text-muted-foreground",children:Axe(i.created_at)})]},i.id)})})]})}):m.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"No sessions yet."})]})}function Zq(e){return Bn({queryKey:["events",e],queryFn:()=>Xe(\`/sessions/\${e}/events?limit=500&order=asc\`),enabled:!!e,select:t=>t.data})}const ix={user:"bg-blue-400/10 text-blue-400 border-blue-400/20",agent:"bg-lime-400/10 text-lime-400 border-lime-400/20",error:"bg-red-400/10 text-red-400 border-red-400/20",status:"bg-amber-400/10 text-amber-400 border-amber-400/20"};function Pxe(e){return e.startsWith("user")?ix.user:e.startsWith("agent")?ix.agent:e.includes("error")?ix.error:e.includes("status")?ix.status:"bg-muted text-muted-foreground border-border"}function Mxe({event:e,prevEvent:t}){const[n,r]=x.useState(!1),{id:i,session_id:o,seq:a,type:l,processed_at:u,...f}=e,d=t?.processed_at?new Date(t.processed_at).getTime():0,h=e.processed_at?new Date(e.processed_at).getTime():0,g=d&&h?h-d:0,v=Ixe(e.type,e);return m.jsxs("div",{className:"border-b border-border",children:[m.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted overflow-hidden min-w-0",onClick:()=>r(!n),children:[m.jsx(nw,{className:Ne("size-3 shrink-0 text-muted-foreground/50 transition-transform",n&&"rotate-90")}),m.jsx("span",{className:"w-5 text-right font-mono text-xs text-muted-foreground",children:e.seq}),m.jsx(an,{variant:"outline",className:Ne("h-4 shrink-0 rounded px-1.5 font-mono text-xs font-medium whitespace-nowrap",Pxe(e.type)),children:e.type}),m.jsx("span",{className:"w-0 flex-1 truncate text-xs text-muted-foreground",children:v}),g>0&&m.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/50",children:["+",g,"ms"]})]}),n&&m.jsxs("div",{className:"relative border-t border-border bg-muted px-4 py-3 overflow-hidden min-w-0",children:[m.jsx(Fe,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(f,null,2)),children:m.jsx(Lu,{className:"size-3"})}),m.jsx("pre",{className:"whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-muted-foreground",children:JSON.stringify(f,null,2)})]})]})}function Ixe(e,t){if(e==="user.message"||e==="agent.message"){const n=t.content;if(n&&Array.isArray(n))return n.filter(i=>i.type==="text").map(i=>i.text).join("").slice(0,100);if(typeof t.text=="string")return t.text.slice(0,100)}if(e==="agent.tool_use")return t.name||"tool";if(e.includes("error"))return t.error?.message||"";if(e.includes("status")){const n=t.stop_reason;return n&&typeof n=="object"?n.type||"":n||""}return""}function Jq(){const e=bn(i=>i.activeSessionId),{data:t}=Zq(e),n=x.useRef(null),r=t??[];return x.useEffect(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[r.length]),e?m.jsxs("div",{className:"flex flex-col overflow-hidden min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[m.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[r.length," events"]}),m.jsx(Fe,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>navigator.clipboard.writeText(JSON.stringify(r,null,2)),children:m.jsx(Lu,{className:"size-3"})})]}),m.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:[r.map((i,o)=>m.jsx(Mxe,{event:i,prevEvent:r[o-1]},i.id)),m.jsx("div",{ref:n})]})]}):m.jsx("p",{className:"p-3 text-xs text-muted-foreground/50",children:"No session selected"})}function Dxe(e){return e==="active"||e==="running"?m.jsx(an,{variant:"outline",className:"border-lime-400/20 bg-lime-400/10 text-lime-400 text-xs",children:e}):e==="error"||e==="failed"?m.jsx(an,{variant:"outline",className:"border-red-400/20 bg-red-400/10 text-red-400 text-xs",children:e}):m.jsx(an,{variant:"outline",className:"text-muted-foreground text-xs",children:e})}function Lxe({id:e}){const{data:t}=xh(e),{data:n}=Hs(),r=bn(o=>o.setActiveSessionId);x.useEffect(()=>{r(e)},[e,r]);const i=n?.find(o=>o.id===t?.agent?.id)?.name??t?.agent?.id?.slice(0,8)??"\u2014";return m.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-4",children:[m.jsx("div",{children:m.jsxs(ki,{to:"/sessions",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(QH,{className:"size-3.5"}),"All Sessions"]})}),m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t?.title??e.slice(0,12)+"\u2026"}),m.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agent: ",m.jsx("span",{className:"text-foreground",children:i})]})]}),t&&Dxe(t.status)]}),m.jsx("div",{className:"rounded-lg border border-border overflow-hidden",style:{minHeight:400},children:m.jsx(Jq,{})})]})}const e9=x.createContext(void 0);function CA(){const e=x.useContext(e9);if(e===void 0)throw new Error(Xt(10));return e}const zxe={value:()=>null},Fxe=x.forwardRef(function(t,n){const{render:r,className:i,disabled:o=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:u=!0,onValueChange:f,multiple:d=!1,orientation:h="vertical",value:g,defaultValue:v,style:b,...w}=t,S=tf(),E=x.useMemo(()=>{if(g===void 0)return v??[]},[g,v]),k=Le(f),O=x.useRef([]),[j,A]=zu({controlled:g,default:E,name:"Accordion",state:"value"}),T=Le((D,q)=>{const L=ct(Wo);if(d)if(q){const U=j.slice();if(U.push(D),k(U,L),L.isCanceled)return;A(U)}else{const U=j.filter(H=>H!==D);if(k(U,L),L.isCanceled)return;A(U)}else{const U=j[0]===D?[]:[D];if(k(U,L),L.isCanceled)return;A(U)}}),N=x.useMemo(()=>({value:j,disabled:o,orientation:h}),[j,o,h]),P=x.useMemo(()=>({accordionItemRefs:O,direction:S,disabled:o,handleValueChange:T,hiddenUntilFound:a??!1,keepMounted:l??!1,loopFocus:u,orientation:h,state:N,value:j}),[S,o,T,a,l,u,h,N,j]),F=vt("div",t,{state:N,ref:n,props:[{dir:S,role:"region"},w],stateAttributesMapping:zxe});return m.jsx(e9.Provider,{value:P,children:m.jsx(Ig,{elementsRef:O,children:F})})});function Bxe(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,o=t!==void 0,[a,l]=zu({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:f,transitionStatus:d}=ph(a,!0,!0),[h,g]=x.useState(a),[{height:v,width:b},w]=x.useState({height:void 0,width:void 0}),S=Br(),[E,k]=x.useState(),O=E??S,[j,A]=x.useState(!1),[T,N]=x.useState(!1),P=x.useRef(null),F=x.useRef(null),D=x.useRef(null),q=x.useRef(null),L=V0(q,!1),U=Le(H=>{const B=!a,z=ct(ja,H.nativeEvent);if(r(B,z),z.isCanceled)return;const V=q.current;F.current==="css-animation"&&V!=null&&V.style.removeProperty("animation-name"),!j&&!T&&(F.current!=null&&F.current!=="css-animation"&&!u&&B&&f(!0),F.current==="css-animation"&&(!h&&B&&g(!0),!u&&B&&f(!0))),l(B),F.current==="none"&&u&&!B&&f(!1)});return Pe(()=>{o&&F.current==="none"&&!a&&f(!1)},[o,a,t,f]),x.useMemo(()=>({abortControllerRef:P,animationTypeRef:F,disabled:i,handleTrigger:U,height:v,mounted:u,open:a,panelId:O,panelRef:q,runOnceAnimationsFinish:L,setDimensions:w,setHiddenUntilFound:A,setKeepMounted:N,setMounted:f,setOpen:l,setPanelIdState:k,setVisible:g,transitionDimensionRef:D,transitionStatus:d,visible:h,width:b}),[P,F,i,U,v,u,a,O,q,L,w,A,N,f,l,g,D,d,h,b])}const t9=x.createContext(void 0);function n9(){const e=x.useContext(t9);if(e===void 0)throw new Error(Xt(15));return e}const r9=x.createContext(void 0);function _A(){const e=x.useContext(r9);if(e===void 0)throw new Error(Xt(9));return e}let ym=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ns.startingStyle]="startingStyle",e[e.endingStyle=Ns.endingStyle]="endingStyle",e})({}),$xe=(function(e){return e.panelOpen="data-panel-open",e})({});const Uxe={[ym.open]:""},Hxe={[ym.closed]:""},qxe={open(e){return e?{[$xe.panelOpen]:""}:null}},Vxe={open(e){return e?Uxe:Hxe}};let Kxe=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const kA={...Vxe,index:e=>Number.isInteger(e)?{[Kxe.index]:String(e)}:null,...$s,value:()=>null},Yxe=x.forwardRef(function(t,n){const{className:r,disabled:i=!1,onOpenChange:o,render:a,value:l,style:u,...f}=t,{ref:d,index:h}=Mg(),g=Po(n,d),{disabled:v,handleValueChange:b,state:w,value:S}=CA(),E=Br(),k=l??E,O=i||v,j=x.useMemo(()=>{if(!S)return!1;for(let H=0;H<S.length;H+=1)if(S[H]===k)return!0;return!1},[S,k]),A=Le((H,B)=>{o?.(H,B),!B.isCanceled&&b(k,H)}),T=Bxe({open:j,onOpenChange:A,disabled:O}),N=x.useMemo(()=>({open:T.open,disabled:T.disabled,hidden:!T.mounted,transitionStatus:T.transitionStatus}),[T.open,T.disabled,T.mounted,T.transitionStatus]),P=x.useMemo(()=>({...T,onOpenChange:A,state:N}),[T,N,A]),F=x.useMemo(()=>({...w,index:h,disabled:O,open:j}),[O,h,j,w]),[D,q]=x.useState(Br()),L=x.useMemo(()=>({open:j,state:F,setTriggerId:q,triggerId:D}),[j,F,q,D]),U=vt("div",t,{state:F,ref:g,props:f,stateAttributesMapping:kA});return m.jsx(t9.Provider,{value:P,children:m.jsx(r9.Provider,{value:L,children:U})})}),Wxe=x.forwardRef(function(t,n){const{render:r,className:i,style:o,...a}=t,{state:l}=_A();return vt("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:kA})}),Gxe=new Set([vs,Jl,ec,Fu,vh,yh]);function Xxe(e){const{current:t}=e,n=[];for(let r=0;r<t.length;r+=1){const i=t[r];if(!mO(i)){const o=i?.querySelector('[type="button"], [role="button"]');o&&!mO(o)&&n.push(o)}}return n}const Qxe=x.forwardRef(function(t,n){const{disabled:r,className:i,id:o,render:a,nativeButton:l=!0,style:u,...f}=t,{panelId:d,open:h,handleTrigger:g,disabled:v}=n9(),b=r??v,{getButtonProps:w,buttonRef:S}=Zo({disabled:b,focusableWhenDisabled:!0,native:l,composite:!0}),{accordionItemRefs:E,direction:k,loopFocus:O,orientation:j}=CA(),A=k==="rtl",T=j==="horizontal",{state:N,setTriggerId:P,triggerId:F}=_A();Pe(()=>(o&&P(o),()=>{P(void 0)}),[o,P]);const D=x.useMemo(()=>({"aria-controls":h?d:void 0,"aria-expanded":h,id:F,tabIndex:0,onClick:g,onKeyDown(L){if(!Gxe.has(L.key))return;_i(L);const U=Xxe(E),B=U.length-1;let z=-1;const V=U.indexOf(L.currentTarget);function Q(){O?z=V+1>B?0:V+1:z=Math.min(V+1,B)}function G(){O?z=V===0?B:V-1:z=V-1}switch(L.key){case vs:T||Q();break;case Jl:T||G();break;case ec:T&&(A?G():Q());break;case Fu:T&&(A?Q():G());break;case"Home":z=0;break;case"End":z=B;break}z>-1&&U[z].focus()}}),[E,g,F,T,A,O,h,d]);return vt("button",t,{state:N,ref:[n,S],props:[D,f,w],stateAttributesMapping:qxe})});let Zxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function Jxe(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:o,keepMounted:a,id:l,mounted:u,onOpenChange:f,open:d,panelRef:h,runOnceAnimationsFinish:g,setDimensions:v,setMounted:b,setOpen:w,setVisible:S,transitionDimensionRef:E,visible:k,width:O}=e,j=x.useRef(!1),A=x.useRef(null),T=x.useRef(d),N=x.useRef(d),P=Cg(),F=x.useMemo(()=>n.current==="css-animation"?!k:!d&&!u,[d,u,k,n]),D=Le(L=>{if(!L)return;if(n.current==null||E.current==null){const B=getComputedStyle(L),z=B.animationName!=="none"&&B.animationName!=="",V=B.transitionDuration!=="0s"&&B.transitionDuration!=="";z&&V||(B.animationName==="none"&&B.transitionDuration!=="0s"?n.current="css-transition":B.animationName!=="none"&&B.transitionDuration==="0s"?n.current="css-animation":n.current="none"),L.getAttribute(Zxe.orientation)==="horizontal"||B.transitionProperty.indexOf("width")>-1?E.current="width":E.current="height"}if(n.current!=="css-transition")return;(i===void 0||O===void 0)&&(v({height:L.scrollHeight,width:L.scrollWidth}),N.current&&L.style.setProperty("transition-duration","0s"));let U=-1,H=-1;return U=Vn.request(()=>{N.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})}),()=>{Vn.cancel(U),Vn.cancel(H)}}),q=Po(r,h,D);return Pe(()=>{if(n.current!=="css-transition")return;const L=h.current;if(!L)return;let U=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){const H={"justify-content":L.style.justifyContent,"align-items":L.style.alignItems,"align-content":L.style.alignContent,"justify-items":L.style.justifyItems};Object.keys(H).forEach(B=>{L.style.setProperty(B,"initial","important")}),!N.current&&!a&&L.setAttribute(ym.startingStyle,""),v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{Object.entries(H).forEach(([B,z])=>{z===""?L.style.removeProperty(B):L.style.setProperty(B,z)})})}else{if(L.scrollHeight===0&&L.scrollWidth===0)return;v({height:L.scrollHeight,width:L.scrollWidth});const H=new AbortController;t.current=H;const B=H.signal;let z=null;const V=ym.endingStyle;return z=new MutationObserver(Q=>{Q.some(I=>I.type==="attributes"&&I.attributeName===V)&&(z?.disconnect(),z=null,g(()=>{v({height:0,width:0}),L.style.removeProperty("content-visibility"),b(!1),t.current===H&&(t.current=null)},B))}),z.observe(L,{attributes:!0,attributeFilter:[V]}),()=>{z?.disconnect(),P.cancel(),t.current===H&&(H.abort(),t.current=null)}}return()=>{Vn.cancel(U)}},[t,n,P,o,a,u,d,h,g,v,b]),Pe(()=>{if(n.current!=="css-animation")return;const L=h.current;L&&(A.current=L.style.animationName||A.current,L.style.setProperty("animation-name","none"),v({height:L.scrollHeight,width:L.scrollWidth}),!T.current&&!j.current&&L.style.removeProperty("animation-name"),d?(t.current!=null&&(t.current.abort(),t.current=null),b(!0),S(!0)):(t.current=new AbortController,g(()=>{b(!1),S(!1),t.current=null},t.current.signal)))},[t,n,d,h,g,v,b,S,k]),Sg(()=>{const L=Vn.request(()=>{T.current=!1});return()=>Vn.cancel(L)}),Pe(()=>{if(!o)return;const L=h.current;if(!L)return;let U=-1,H=-1;return d&&j.current&&(L.style.transitionDuration="0s",v({height:L.scrollHeight,width:L.scrollWidth}),U=Vn.request(()=>{j.current=!1,H=Vn.request(()=>{setTimeout(()=>{L.style.removeProperty("transition-duration")})})})),()=>{Vn.cancel(U),Vn.cancel(H)}},[o,d,h,v]),Pe(()=>{const L=h.current;L&&o&&F&&(L.setAttribute("hidden","until-found"),n.current==="css-transition"&&L.setAttribute(ym.startingStyle,""))},[o,F,n,h]),x.useEffect(function(){const U=h.current;if(!U)return;function H(B){j.current=!0,w(!0),f(!0,ct(Wo,B))}return kt(U,"beforematch",H)},[f,h,w]),x.useMemo(()=>({props:{hidden:F,id:l,ref:q}}),[F,l,q])}let Bz=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const ebe=x.forwardRef(function(t,n){const{className:r,hiddenUntilFound:i,keepMounted:o,id:a,render:l,style:u,...f}=t,{hiddenUntilFound:d,keepMounted:h}=CA(),{abortControllerRef:g,animationTypeRef:v,height:b,mounted:w,onOpenChange:S,open:E,panelId:k,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setHiddenUntilFound:T,setKeepMounted:N,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U,setPanelIdState:H,transitionStatus:B}=n9(),z=i??d,V=o??h;Pe(()=>{if(a)return H(a),()=>{H(void 0)}},[a,H]),Pe(()=>{T(z)},[T,z]),Pe(()=>{N(V)},[N,V]),Qo({open:E&&B==="idle",ref:O,onComplete(){E&&A({width:void 0,height:void 0})}});const{props:Q}=Jxe({abortControllerRef:g,animationTypeRef:v,externalRef:n,height:b,hiddenUntilFound:z,id:a??k,keepMounted:V,mounted:w,onOpenChange:S,open:E,panelRef:O,runOnceAnimationsFinish:j,setDimensions:A,setMounted:P,setOpen:F,setVisible:D,transitionDimensionRef:q,visible:L,width:U}),{state:G,triggerId:I}=_A(),K=x.useMemo(()=>({...G,transitionStatus:B}),[G,B]),$=vt("div",t,{state:K,ref:[n,O],props:[Q,{"aria-labelledby":I,role:"region",style:{[Bz.accordionPanelHeight]:b===void 0?"auto":\`\${b}px\`,[Bz.accordionPanelWidth]:U===void 0?"auto":\`\${U}px\`}},f],stateAttributesMapping:kA});return V||z||w?$:null});function OA({className:e,...t}){return m.jsx(Fxe,{"data-slot":"accordion",className:Ne("flex w-full flex-col",e),...t})}function xm({className:e,...t}){return m.jsx(Yxe,{"data-slot":"accordion-item",className:Ne("not-last:border-b",e),...t})}function bm({className:e,children:t,...n}){return m.jsx(Wxe,{className:"flex",children:m.jsxs(Qxe,{"data-slot":"accordion-trigger",className:Ne("group/accordion-trigger relative flex flex-1 items-center justify-between py-2.5 text-left text-sm font-medium transition-colors outline-none hover:text-foreground focus-visible:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,m.jsx(Ng,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),m.jsx(n8,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function wm({className:e,children:t,...n}){return m.jsx(ebe,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:m.jsx("div",{className:Ne("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}function tbe(e){const t=hn(),n=x.useRef(null),r=x.useRef(0),i=x.useRef(1e3);x.useEffect(()=>{if(!e)return;r.current=0,i.current=1e3;function o(){n.current?.abort();const a=new AbortController;n.current=a;const l=bn.getState().apiKey,u=\`/v1/sessions/\${e}/events/stream?after_seq=\${r.current}\`;fetch(u,{signal:a.signal,headers:{"x-api-key":l}}).then(async f=>{if(!f.ok||!f.body){if(f.status===404){console.warn("[sse] session not found, stopping");return}throw new Error(\`SSE \${f.status}\`)}i.current=1e3;const d=f.body.getReader(),h=new TextDecoder;let g="";for(;;){const{done:v,value:b}=await d.read();if(v)break;g+=h.decode(b,{stream:!0});const w=g.split(\`
|
|
217516
217594
|
\`);g=w.pop()||"";for(const S of w)if(S.startsWith("data:"))try{const E=JSON.parse(S.slice(5).trimStart());r.current=Math.max(r.current,E.seq),t.setQueryData(["events",e],k=>k?k.data.some(j=>j.seq===E.seq)?k:{data:[...k.data,E]}:{data:[E]}),E.type.startsWith("session.status")&&(t.invalidateQueries({queryKey:["sessions",e]}),t.invalidateQueries({queryKey:["sessions"]}))}catch{}}}).catch(f=>{a.signal.aborted||console.warn("[sse] disconnected:",f)}).finally(()=>{if(a.signal.aborted)return;const f=i.current;i.current=Math.min(f*2,3e4),setTimeout(o,f)})}return o(),()=>n.current?.abort()},[e,t])}function nbe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rbe=/^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u,ibe=/^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u,obe={};function $z(e,t){return(obe.jsx?ibe:rbe).test(e)}const abe=/[ \\t\\n\\f\\r]/g;function sbe(e){return typeof e=="object"?e.type==="text"?Uz(e.value):!1:Uz(e)}function Uz(e){return e.replace(abe,"")===""}class Bg{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Bg.prototype.normal={};Bg.prototype.property={};Bg.prototype.space=void 0;function i9(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Bg(n,r,t)}function _O(e){return e.toLowerCase()}class Ii{constructor(t,n){this.attribute=n,this.property=t}}Ii.prototype.attribute="";Ii.prototype.booleanish=!1;Ii.prototype.boolean=!1;Ii.prototype.commaOrSpaceSeparated=!1;Ii.prototype.commaSeparated=!1;Ii.prototype.defined=!1;Ii.prototype.mustUseProperty=!1;Ii.prototype.number=!1;Ii.prototype.overloadedBoolean=!1;Ii.prototype.property="";Ii.prototype.spaceSeparated=!1;Ii.prototype.space=void 0;let lbe=0;const _t=sf(),ir=sf(),kO=sf(),Me=sf(),Cn=sf(),Sd=sf(),Vi=sf();function sf(){return 2**++lbe}const OO=Object.freeze(Object.defineProperty({__proto__:null,boolean:_t,booleanish:ir,commaOrSpaceSeparated:Vi,commaSeparated:Sd,number:Me,overloadedBoolean:kO,spaceSeparated:Cn},Symbol.toStringTag,{value:"Module"})),OC=Object.keys(OO);class jA extends Ii{constructor(t,n,r,i){let o=-1;if(super(t,n),Hz(this,"space",i),typeof r=="number")for(;++o<OC.length;){const a=OC[o];Hz(this,OC[o],(r&OO[a])===OO[a])}}}jA.prototype.defined=!0;function Hz(e,t,n){n&&(e[t]=n)}function Ah(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new jA(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[_O(r)]=r,n[_O(o.attribute)]=r}return new Bg(t,n,e.space)}const o9=Ah({properties:{ariaActiveDescendant:null,ariaAtomic:ir,ariaAutoComplete:null,ariaBusy:ir,ariaChecked:ir,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:Cn,ariaCurrent:null,ariaDescribedBy:Cn,ariaDetails:null,ariaDisabled:ir,ariaDropEffect:Cn,ariaErrorMessage:null,ariaExpanded:ir,ariaFlowTo:Cn,ariaGrabbed:ir,ariaHasPopup:null,ariaHidden:ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cn,ariaLevel:Me,ariaLive:null,ariaModal:ir,ariaMultiLine:ir,ariaMultiSelectable:ir,ariaOrientation:null,ariaOwns:Cn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:ir,ariaReadOnly:ir,ariaRelevant:null,ariaRequired:ir,ariaRoleDescription:Cn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:ir,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function a9(e,t){return t in e?e[t]:t}function s9(e,t){return a9(e,t.toLowerCase())}const cbe=Ah({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sd,acceptCharset:Cn,accessKey:Cn,action:null,allow:null,allowFullScreen:_t,allowPaymentRequest:_t,allowUserMedia:_t,alt:null,as:null,async:_t,autoCapitalize:null,autoComplete:Cn,autoFocus:_t,autoPlay:_t,blocking:Cn,capture:null,charSet:null,checked:_t,cite:null,className:Cn,cols:Me,colSpan:null,content:null,contentEditable:ir,controls:_t,controlsList:Cn,coords:Me|Sd,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_t,defer:_t,dir:null,dirName:null,disabled:_t,download:kO,draggable:ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_t,formTarget:null,headers:Cn,height:Me,hidden:kO,high:Me,href:null,hrefLang:null,htmlFor:Cn,httpEquiv:Cn,id:null,imageSizes:null,imageSrcSet:null,inert:_t,inputMode:null,integrity:null,is:null,isMap:_t,itemId:null,itemProp:Cn,itemRef:Cn,itemScope:_t,itemType:Cn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_t,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:_t,muted:_t,name:null,nonce:null,noModule:_t,noValidate:_t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_t,optimum:Me,pattern:null,ping:Cn,placeholder:null,playsInline:_t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_t,referrerPolicy:null,rel:Cn,required:_t,reversed:_t,rows:Me,rowSpan:Me,sandbox:Cn,scope:null,scoped:_t,seamless:_t,selected:_t,shadowRootClonable:_t,shadowRootDelegatesFocus:_t,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:_t,useMap:null,value:ir,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_t,declare:_t,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:_t,noHref:_t,noShade:_t,noWrap:_t,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:ir,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_t,disableRemotePlayback:_t,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:s9}),ube=Ah({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vi,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:Cn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:_t,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sd,g2:Sd,glyphName:Sd,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Vi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vi,rev:Vi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vi,requiredFeatures:Vi,requiredFonts:Vi,requiredFormats:Vi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Vi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vi,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:a9}),l9=Ah({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),c9=Ah({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:s9}),u9=Ah({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),fbe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},dbe=/[A-Z]/g,qz=/-[a-z]/g,hbe=/^data[-\\w.:]+$/i;function pbe(e,t){const n=_O(t);let r=t,i=Ii;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hbe.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(qz,gbe);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!qz.test(o)){let a=o.replace(dbe,mbe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=jA}return new i(r,t)}function mbe(e){return"-"+e.toLowerCase()}function gbe(e){return e.charAt(1).toUpperCase()}const vbe=i9([o9,cbe,l9,c9,u9],"html"),TA=i9([o9,ube,l9,c9,u9],"svg");function ybe(e){return e.join(" ").trim()}var ed={},jC,Vz;function xbe(){if(Vz)return jC;Vz=1;var e=/\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g,t=/\\n/g,n=/^\\s*/,r=/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/,i=/^:\\s*/,o=/^((?:'(?:\\\\'|.)*?'|"(?:\\\\"|.)*?"|\\([^)]*?\\)|[^};])+)/,a=/^[;\\s]*/,l=/^\\s+|\\s+$/g,u=\`
|
|
217517
217595
|
\`,f="/",d="*",h="",g="comment",v="declaration";function b(S,E){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];E=E||{};var k=1,O=1;function j(H){var B=H.match(t);B&&(k+=B.length);var z=H.lastIndexOf(u);O=~z?H.length-z:O+H.length}function A(){var H={line:k,column:O};return function(B){return B.position=new T(H),F(),B}}function T(H){this.start=H,this.end={line:k,column:O},this.source=E.source}T.prototype.content=S;function N(H){var B=new Error(E.source+":"+k+":"+O+": "+H);if(B.reason=H,B.filename=E.source,B.line=k,B.column=O,B.source=S,!E.silent)throw B}function P(H){var B=H.exec(S);if(B){var z=B[0];return j(z),S=S.slice(z.length),B}}function F(){P(n)}function D(H){var B;for(H=H||[];B=q();)B!==!1&&H.push(B);return H}function q(){var H=A();if(!(f!=S.charAt(0)||d!=S.charAt(1))){for(var B=2;h!=S.charAt(B)&&(d!=S.charAt(B)||f!=S.charAt(B+1));)++B;if(B+=2,h===S.charAt(B-1))return N("End of comment missing");var z=S.slice(2,B-2);return O+=2,j(z),S=S.slice(B),O+=2,H({type:g,comment:z})}}function L(){var H=A(),B=P(r);if(B){if(q(),!P(i))return N("property missing ':'");var z=P(o),V=H({type:v,property:w(B[0].replace(e,h)),value:z?w(z[0].replace(e,h)):h});return P(a),V}}function U(){var H=[];D(H);for(var B;B=L();)B!==!1&&(H.push(B),D(H));return H}return F(),U()}function w(S){return S?S.replace(l,h):h}return jC=b,jC}var Kz;function bbe(){if(Kz)return ed;Kz=1;var e=ed&&ed.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ed,"__esModule",{value:!0}),ed.default=n;const t=e(xbe());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),l=typeof i=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:d}=u;l?i(f,d,u):d&&(o=o||{},o[f]=d)}),o}return ed}var qp={},Yz;function wbe(){if(Yz)return qp;Yz=1,Object.defineProperty(qp,"__esModule",{value:!0}),qp.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},a=function(f,d){return d.toUpperCase()},l=function(f,d){return"".concat(d,"-")},u=function(f,d){return d===void 0&&(d={}),o(f)?f:(f=f.toLowerCase(),d.reactCompat?f=f.replace(i,l):f=f.replace(r,l),f.replace(t,a))};return qp.camelCase=u,qp}var Vp,Wz;function Sbe(){if(Wz)return Vp;Wz=1;var e=Vp&&Vp.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(bbe()),n=wbe();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(a[(0,n.camelCase)(l,o)]=u)}),a}return r.default=r,Vp=r,Vp}var Ebe=Sbe();const Cbe=Xo(Ebe),f9=d9("end"),AA=d9("start");function d9(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function h9(e){const t=AA(e),n=f9(e);if(t&&n)return{start:t,end:n}}function Sm(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Gz(e.position):"start"in e||"end"in e?Gz(e):"line"in e||"column"in e?jO(e):""}function jO(e){return Xz(e&&e.line)+":"+Xz(e&&e.column)}function Gz(e){return jO(e&&e.start)+"-"+jO(e&&e.end)}function Xz(e){return e&&typeof e=="number"?e:1}class Zr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Sm(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Zr.prototype.file="";Zr.prototype.name="";Zr.prototype.reason="";Zr.prototype.message="";Zr.prototype.stack="";Zr.prototype.column=void 0;Zr.prototype.line=void 0;Zr.prototype.ancestors=void 0;Zr.prototype.cause=void 0;Zr.prototype.fatal=void 0;Zr.prototype.place=void 0;Zr.prototype.ruleId=void 0;Zr.prototype.source=void 0;const NA={}.hasOwnProperty,_be=new Map,kbe=/[A-Z]/g,Obe=new Set(["table","tbody","thead","tfoot","tr"]),jbe=new Set(["td","th"]),p9="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Tbe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected \`Fragment\` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected \`jsxDEV\` in options when \`development: true\`");r=Lbe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected \`jsx\` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected \`jsxs\` in production options");r=Dbe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?TA:vbe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=m9(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function m9(e,t,n){if(t.type==="element")return Abe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Nbe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Pbe(e,t,n);if(t.type==="mdxjsEsm")return Rbe(e,t);if(t.type==="root")return Mbe(e,t,n);if(t.type==="text")return Ibe(e,t)}function Abe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=TA,e.schema=i),e.ancestors.push(t);const o=v9(e,t.tagName,!1),a=zbe(e,t);let l=PA(e,t);return Obe.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!sbe(u):!0})),g9(e,a,o,t),RA(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Nbe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}qm(e,t.position)}function Rbe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);qm(e,t.position)}function Pbe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=TA,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:v9(e,t.name,!0),a=Fbe(e,t),l=PA(e,t);return g9(e,a,o,t),RA(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Mbe(e,t,n){const r={};return RA(r,PA(e,t)),e.create(t,e.Fragment,r,n)}function Ibe(e,t){return t.value}function g9(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function RA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Dbe(e,t,n){return r;function r(i,o,a,l){const f=Array.isArray(a.children)?n:t;return l?f(o,a,l):f(o,a)}}function Lbe(e,t){return n;function n(r,i,o,a){const l=Array.isArray(o.children),u=AA(r);return t(i,o,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function zbe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&NA.call(t.properties,i)){const o=Bbe(e,i,t.properties[i]);if(o){const[a,l]=o;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&jbe.has(t.tagName)?r=l:n[a]=l}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Fbe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else qm(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else qm(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function PA(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:_be;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const f=i.get(u)||0;a=u+"-"+f,i.set(u,f+1)}}const l=m9(e,o,a);l!==void 0&&n.push(l)}return n}function Bbe(e,t,n){const r=pbe(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?nbe(n):ybe(n)),r.property==="style"){let i=typeof n=="object"?n:$be(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Ube(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?fbe[r.property]||r.property:r.attribute,n]}}function $be(e,t){try{return Cbe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Zr("Cannot parse \`style\` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=p9+"#cannot-parse-style-attribute",i}}function v9(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const l=$z(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}r=a}else r=$z(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return NA.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);qm(e)}function qm(e,t){const n=new Zr("Cannot handle MDX estrees without \`createEvaluater\`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=p9+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Ube(e){const t={};let n;for(n in e)NA.call(e,n)&&(t[Hbe(n)]=e[n]);return t}function Hbe(e){let t=e.replace(kbe,qbe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qbe(e){return"-"+e.toLowerCase()}const TC={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Vbe={};function MA(e,t){const n=Vbe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return y9(e,r,i)}function y9(e,t,n){if(Kbe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Qz(e.children,t,n)}return Array.isArray(e)?Qz(e,t,n):""}function Qz(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=y9(e[i],t,n);return r.join("")}function Kbe(e){return!!(e&&typeof e=="object")}const Zz=document.createElement("i");function IA(e){const t="&"+e+";";Zz.innerHTML=t;const n=Zz.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qi(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function So(e,t){return e.length>0?(Qi(e,e.length,0,t),e):t}const Jz={}.hasOwnProperty;function x9(e){const t={};let n=-1;for(;++n<e.length;)Ybe(t,e[n]);return t}function Ybe(e,t){let n;for(n in t){const i=(Jz.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Jz.call(i,a)||(i[a]=[]);const l=o[a];Wbe(i[a],Array.isArray(l)?l:l?[l]:[])}}}function Wbe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Qi(e,0,0,r)}function b9(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function Yo(e){return e.replace(/[\\t\\n\\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const si=Ec(/[A-Za-z]/),Gr=Ec(/[\\dA-Za-z]/),Gbe=Ec(/[#-'*+\\--9=?A-Z^-~]/);function Cb(e){return e!==null&&(e<32||e===127)}const TO=Ec(/\\d/),Xbe=Ec(/[\\dA-Fa-f]/),Qbe=Ec(/[!-/:-@[-\`{-~]/);function ft(e){return e!==null&&e<-2}function Sn(e){return e!==null&&(e<0||e===32)}function Lt(e){return e===-2||e===-1||e===32}const Ew=Ec(/\\p{P}|\\p{S}/u),Uu=Ec(/\\s/);function Ec(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Nh(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Gr(e.charCodeAt(n+1))&&Gr(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const l=e.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(a=String.fromCharCode(o,l),i=1):a="\uFFFD"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(u){return Lt(u)?(e.enter(n),l(u)):t(u)}function l(u){return Lt(u)&&o++<i?(e.consume(u),l):(e.exit(n),t(u))}}const Zbe={tokenize:Jbe};function Jbe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),o(l)}function o(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ft(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),a)}}const e0e={tokenize:t0e},e4={tokenize:n0e};function t0e(e){const t=this,n=[];let r=0,i,o,a;return l;function l(O){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,u,f)(O)}return f(O)}function u(O){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const j=t.events.length;let A=j,T;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){T=t.events[A][1].end;break}E(r);let N=j;for(;N<t.events.length;)t.events[N][1].end={...T},N++;return Qi(t.events,A+1,0,t.events.slice(j)),t.events.length=N,f(O)}return l(O)}function f(O){if(r===n.length){if(!i)return g(O);if(i.currentConstruct&&i.currentConstruct.concrete)return b(O);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(e4,d,h)(O)}function d(O){return i&&k(),E(r),g(O)}function h(O){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,b(O)}function g(O){return t.containerState={},e.attempt(e4,v,b)(O)}function v(O){return r++,n.push([t.currentConstruct,t.containerState]),g(O)}function b(O){if(O===null){i&&k(),E(0),e.consume(O);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),w(O)}function w(O){if(O===null){S(e.exit("chunkFlow"),!0),E(0),e.consume(O);return}return ft(O)?(e.consume(O),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(O),w)}function S(O,j){const A=t.sliceStream(O);if(j&&A.push(null),O.previous=o,o&&(o.next=O),o=O,i.defineSkip(O.start),i.write(A),t.parser.lazy[O.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<a&&(!i.events[T][1].end||i.events[T][1].end.offset>a))return;const N=t.events.length;let P=N,F,D;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(F){D=t.events[P][1].end;break}F=!0}for(E(r),T=N;T<t.events.length;)t.events[T][1].end={...D},T++;Qi(t.events,P+1,0,t.events.slice(N)),t.events.length=T}}function E(O){let j=n.length;for(;j-- >O;){const A=n[j];t.containerState=A[1],A[0].exit.call(t,e)}n.length=O}function k(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function n0e(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Zd(e){if(e===null||Sn(e)||Uu(e))return 1;if(Ew(e))return 2}function Cw(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const AO={name:"attention",resolveAll:r0e,tokenize:i0e};function r0e(e,t){let n=-1,r,i,o,a,l,u,f,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},g={...e[n][1].start};t4(h,-u),t4(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=So(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=So(f,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),f=So(f,Cw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=So(f,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,f=So(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Qi(e,r-1,n-r+3,f),n=r+f.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function i0e(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Zd(r);let o;return a;function a(u){return o=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===o)return e.consume(u),l;const f=e.exit("attentionSequence"),d=Zd(u),h=!d||d===2&&i||n.includes(u),g=!i||i===2&&d||n.includes(r);return f._open=!!(o===42?h:h&&(i||!g)),f._close=!!(o===42?g:g&&(d||!h)),t(u)}}function t4(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const o0e={name:"autolink",tokenize:a0e};function a0e(e,t,n){let r=0;return i;function i(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return si(v)?(e.consume(v),a):v===64?n(v):f(v)}function a(v){return v===43||v===45||v===46||Gr(v)?(r=1,l(v)):f(v)}function l(v){return v===58?(e.consume(v),r=0,u):(v===43||v===45||v===46||Gr(v))&&r++<32?(e.consume(v),l):(r=0,f(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Cb(v)?n(v):(e.consume(v),u)}function f(v){return v===64?(e.consume(v),d):Gbe(v)?(e.consume(v),f):n(v)}function d(v){return Gr(v)?h(v):n(v)}function h(v){return v===46?(e.consume(v),r=0,d):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):g(v)}function g(v){if((v===45||Gr(v))&&r++<63){const b=v===45?g:h;return e.consume(v),b}return n(v)}}const $g={partial:!0,tokenize:s0e};function s0e(e,t,n){return r;function r(o){return Lt(o)?Yt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||ft(o)?t(o):n(o)}}const w9={continuation:{tokenize:c0e},exit:u0e,name:"blockQuote",tokenize:l0e};function l0e(e,t,n){const r=this;return i;function i(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Lt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function c0e(e,t,n){const r=this;return i;function i(a){return Lt(a)?Yt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(w9,t,n)(a)}}function u0e(e){e.exit("blockQuote")}const S9={name:"characterEscape",tokenize:f0e};function f0e(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Qbe(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const E9={name:"characterReference",tokenize:d0e};function d0e(e,t,n){const r=this;let i=0,o,a;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,a=Gr,d(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=Xbe,d):(e.enter("characterReferenceValue"),o=7,a=TO,d(h))}function d(h){if(h===59&&i){const g=e.exit("characterReferenceValue");return a===Gr&&!IA(r.sliceSerialize(g))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&i++<o?(e.consume(h),d):n(h)}}const n4={partial:!0,tokenize:p0e},r4={concrete:!0,name:"codeFenced",tokenize:h0e};function h0e(e,t,n){const r=this,i={partial:!0,tokenize:A};let o=0,a=0,l;return u;function u(T){return f(T)}function f(T){const N=r.events[r.events.length-1];return o=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(a++,e.consume(T),d):a<3?n(T):(e.exit("codeFencedFenceSequence"),Lt(T)?Yt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||ft(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(n4,w,j)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Lt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,v,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function v(T){return T===null||ft(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),b)}function w(T){return e.attempt(i,j,S)(T)}function S(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),E}function E(T){return o>0&&Lt(T)?Yt(e,k,"linePrefix",o+1)(T):k(T)}function k(T){return T===null||ft(T)?e.check(n4,w,j)(T):(e.enter("codeFlowValue"),O(T))}function O(T){return T===null||ft(T)?(e.exit("codeFlowValue"),k(T)):(e.consume(T),O)}function j(T){return e.exit("codeFenced"),t(T)}function A(T,N,P){let F=0;return D;function D(B){return T.enter("lineEnding"),T.consume(B),T.exit("lineEnding"),q}function q(B){return T.enter("codeFencedFence"),Lt(B)?Yt(T,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):L(B)}function L(B){return B===l?(T.enter("codeFencedFenceSequence"),U(B)):P(B)}function U(B){return B===l?(F++,T.consume(B),U):F>=a?(T.exit("codeFencedFenceSequence"),Lt(B)?Yt(T,H,"whitespace")(B):H(B)):P(B)}function H(B){return B===null||ft(B)?(T.exit("codeFencedFence"),N(B)):P(B)}}}function p0e(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const AC={name:"codeIndented",tokenize:g0e},m0e={partial:!0,tokenize:v0e};function g0e(e,t,n){const r=this;return i;function i(f){return e.enter("codeIndented"),Yt(e,o,"linePrefix",5)(f)}function o(f){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):ft(f)?e.attempt(m0e,a,u)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||ft(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function u(f){return e.exit("codeIndented"),t(f)}}function v0e(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Yt(e,o,"linePrefix",5)(a)}function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):ft(a)?i(a):n(a)}}const y0e={name:"codeText",previous:b0e,resolve:x0e,tokenize:w0e};function x0e(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function b0e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function w0e(e,t,n){let r=0,i,o;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(o=e.enter("codeTextSequence"),i=0,d(h)):ft(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||ft(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),f)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(o.type="codeTextData",f(h))}}class S0e{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index \`"+t+"\` in a splice buffer of size \`"+(this.left.length+this.right.length)+"\`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Kp(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Kp(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kp(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Kp(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kp(this.left,n.reverse())}}}function Kp(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function C9(e){const t={};let n=-1,r,i,o,a,l,u,f;const d=new S0e(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,E0e(d,n)),n=t[n],f=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=d.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return Qi(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!f}function E0e(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,u=[],f={};let d,h,g=-1,v=n,b=0,w=0;const S=[w];for(;v;){for(;e.get(++i)[1]!==v;);o.push(i),v._tokenizer||(d=r.sliceStream(v),v.next||d.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(w=g+1,S.push(w),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):S.pop(),g=S.length;g--;){const E=l.slice(S[g],S[g+1]),k=o.pop();u.push([k,k+E.length-1]),e.splice(k,2,E)}for(u.reverse(),g=-1;++g<u.length;)f[b+u[g][0]]=b+u[g][1],b+=u[g][1]-u[g][0]-1;return f}const C0e={resolve:k0e,tokenize:O0e},_0e={partial:!0,tokenize:j0e};function k0e(e){return C9(e),e}function O0e(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?o(l):ft(l)?e.check(_0e,a,o)(l):(e.consume(l),i)}function o(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function j0e(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Yt(e,o,"linePrefix")}function o(a){if(a===null||ft(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function _9(e,t,n,r,i,o,a,l,u){const f=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(E){return E===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(E),e.exit(o),g):E===null||E===32||E===41||Cb(E)?n(E):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(E))}function g(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(l),g(E)):E===null||E===60||ft(E)?n(E):(e.consume(E),E===92?b:v)}function b(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function w(E){return!d&&(E===null||E===41||Sn(E))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(E)):d<f&&E===40?(e.consume(E),d++,w):E===41?(e.consume(E),d--,w):E===null||E===32||E===40||Cb(E)?n(E):(e.consume(E),E===92?S:w)}function S(E){return E===40||E===41||E===92?(e.consume(E),w):w(E)}}function k9(e,t,n,r,i,o){const a=this;let l=0,u;return f;function f(v){return e.enter(r),e.enter(i),e.consume(v),e.exit(i),e.enter(o),d}function d(v){return l>999||v===null||v===91||v===93&&!u||v===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(e.exit(o),e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):ft(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||ft(v)||l++>999?(e.exit("chunkString"),d(v)):(e.consume(v),u||(u=!Lt(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(e.consume(v),l++,h):h(v)}}function O9(e,t,n,r,i,o){let a;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(i),e.consume(g),e.exit(i),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(i),e.consume(g),e.exit(i),e.exit(r),t):(e.enter(o),f(g))}function f(g){return g===a?(e.exit(o),u(a)):g===null?n(g):ft(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Yt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===a||g===null||ft(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?h:d)}function h(g){return g===a||g===92?(e.consume(g),d):d(g)}}function Em(e,t){let n;return r;function r(i){return ft(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Lt(i)?Yt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const T0e={name:"definition",tokenize:N0e},A0e={partial:!0,tokenize:R0e};function N0e(e,t,n){const r=this;let i;return o;function o(v){return e.enter("definition"),a(v)}function a(v){return k9.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function l(v){return i=Yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return Sn(v)?Em(e,f)(v):f(v)}function f(v){return _9(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function d(v){return e.attempt(A0e,h,h)(v)}function h(v){return Lt(v)?Yt(e,g,"whitespace")(v):g(v)}function g(v){return v===null||ft(v)?(e.exit("definition"),r.parser.defined.push(i),t(v)):n(v)}}function R0e(e,t,n){return r;function r(l){return Sn(l)?Em(e,i)(l):n(l)}function i(l){return O9(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return Lt(l)?Yt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const P0e={name:"hardBreakEscape",tokenize:M0e};function M0e(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return ft(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const I0e={name:"headingAtx",resolve:D0e,tokenize:L0e};function D0e(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Qi(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function L0e(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Sn(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||ft(d)?(e.exit("atxHeading"),t(d)):Lt(d)?Yt(e,l,"whitespace")(d):(e.enter("atxHeadingText"),f(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function f(d){return d===null||d===35||Sn(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),f)}}const z0e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],i4=["pre","script","style","textarea"],F0e={concrete:!0,name:"htmlFlow",resolveTo:U0e,tokenize:H0e},B0e={partial:!0,tokenize:V0e},$0e={partial:!0,tokenize:q0e};function U0e(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function H0e(e,t,n){const r=this;let i,o,a,l,u;return f;function f(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),g):R===47?(e.consume(R),o=!0,w):R===63?(e.consume(R),i=3,r.interrupt?t:I):si(R)?(e.consume(R),a=String.fromCharCode(R),S):n(R)}function g(R){return R===45?(e.consume(R),i=2,v):R===91?(e.consume(R),i=5,l=0,b):si(R)?(e.consume(R),i=4,r.interrupt?t:I):n(R)}function v(R){return R===45?(e.consume(R),r.interrupt?t:I):n(R)}function b(R){const X="CDATA[";return R===X.charCodeAt(l++)?(e.consume(R),l===X.length?r.interrupt?t:L:b):n(R)}function w(R){return si(R)?(e.consume(R),a=String.fromCharCode(R),S):n(R)}function S(R){if(R===null||R===47||R===62||Sn(R)){const X=R===47,W=a.toLowerCase();return!X&&!o&&i4.includes(W)?(i=1,r.interrupt?t(R):L(R)):z0e.includes(a.toLowerCase())?(i=6,X?(e.consume(R),E):r.interrupt?t(R):L(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?k(R):O(R))}return R===45||Gr(R)?(e.consume(R),a+=String.fromCharCode(R),S):n(R)}function E(R){return R===62?(e.consume(R),r.interrupt?t:L):n(R)}function k(R){return Lt(R)?(e.consume(R),k):D(R)}function O(R){return R===47?(e.consume(R),D):R===58||R===95||si(R)?(e.consume(R),j):Lt(R)?(e.consume(R),O):D(R)}function j(R){return R===45||R===46||R===58||R===95||Gr(R)?(e.consume(R),j):A(R)}function A(R){return R===61?(e.consume(R),T):Lt(R)?(e.consume(R),A):O(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),u=R,N):Lt(R)?(e.consume(R),T):P(R)}function N(R){return R===u?(e.consume(R),u=null,F):R===null||ft(R)?n(R):(e.consume(R),N)}function P(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Sn(R)?A(R):(e.consume(R),P)}function F(R){return R===47||R===62||Lt(R)?O(R):n(R)}function D(R){return R===62?(e.consume(R),q):n(R)}function q(R){return R===null||ft(R)?L(R):Lt(R)?(e.consume(R),q):n(R)}function L(R){return R===45&&i===2?(e.consume(R),z):R===60&&i===1?(e.consume(R),V):R===62&&i===4?(e.consume(R),K):R===63&&i===3?(e.consume(R),I):R===93&&i===5?(e.consume(R),G):ft(R)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(B0e,$,U)(R)):R===null||ft(R)?(e.exit("htmlFlowData"),U(R)):(e.consume(R),L)}function U(R){return e.check($0e,H,$)(R)}function H(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),B}function B(R){return R===null||ft(R)?U(R):(e.enter("htmlFlowData"),L(R))}function z(R){return R===45?(e.consume(R),I):L(R)}function V(R){return R===47?(e.consume(R),a="",Q):L(R)}function Q(R){if(R===62){const X=a.toLowerCase();return i4.includes(X)?(e.consume(R),K):L(R)}return si(R)&&a.length<8?(e.consume(R),a+=String.fromCharCode(R),Q):L(R)}function G(R){return R===93?(e.consume(R),I):L(R)}function I(R){return R===62?(e.consume(R),K):R===45&&i===2?(e.consume(R),I):L(R)}function K(R){return R===null||ft(R)?(e.exit("htmlFlowData"),$(R)):(e.consume(R),K)}function $(R){return e.exit("htmlFlow"),t(R)}}function q0e(e,t,n){const r=this;return i;function i(a){return ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function V0e(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt($g,t,n)}}const K0e={name:"htmlText",tokenize:Y0e};function Y0e(e,t,n){const r=this;let i,o,a;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),u}function u(I){return I===33?(e.consume(I),f):I===47?(e.consume(I),A):I===63?(e.consume(I),O):si(I)?(e.consume(I),P):n(I)}function f(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),o=0,b):si(I)?(e.consume(I),k):n(I)}function d(I){return I===45?(e.consume(I),v):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),g):ft(I)?(a=h,V(I)):(e.consume(I),h)}function g(I){return I===45?(e.consume(I),v):h(I)}function v(I){return I===62?z(I):I===45?g(I):h(I)}function b(I){const K="CDATA[";return I===K.charCodeAt(o++)?(e.consume(I),o===K.length?w:b):n(I)}function w(I){return I===null?n(I):I===93?(e.consume(I),S):ft(I)?(a=w,V(I)):(e.consume(I),w)}function S(I){return I===93?(e.consume(I),E):w(I)}function E(I){return I===62?z(I):I===93?(e.consume(I),E):w(I)}function k(I){return I===null||I===62?z(I):ft(I)?(a=k,V(I)):(e.consume(I),k)}function O(I){return I===null?n(I):I===63?(e.consume(I),j):ft(I)?(a=O,V(I)):(e.consume(I),O)}function j(I){return I===62?z(I):O(I)}function A(I){return si(I)?(e.consume(I),T):n(I)}function T(I){return I===45||Gr(I)?(e.consume(I),T):N(I)}function N(I){return ft(I)?(a=N,V(I)):Lt(I)?(e.consume(I),N):z(I)}function P(I){return I===45||Gr(I)?(e.consume(I),P):I===47||I===62||Sn(I)?F(I):n(I)}function F(I){return I===47?(e.consume(I),z):I===58||I===95||si(I)?(e.consume(I),D):ft(I)?(a=F,V(I)):Lt(I)?(e.consume(I),F):z(I)}function D(I){return I===45||I===46||I===58||I===95||Gr(I)?(e.consume(I),D):q(I)}function q(I){return I===61?(e.consume(I),L):ft(I)?(a=q,V(I)):Lt(I)?(e.consume(I),q):F(I)}function L(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,U):ft(I)?(a=L,V(I)):Lt(I)?(e.consume(I),L):(e.consume(I),H)}function U(I){return I===i?(e.consume(I),i=void 0,B):I===null?n(I):ft(I)?(a=U,V(I)):(e.consume(I),U)}function H(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Sn(I)?F(I):(e.consume(I),H)}function B(I){return I===47||I===62||Sn(I)?F(I):n(I)}function z(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function V(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),Q}function Q(I){return Lt(I)?Yt(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):G(I)}function G(I){return e.enter("htmlTextData"),a(I)}}const DA={name:"labelEnd",resolveAll:Q0e,resolveTo:Z0e,tokenize:J0e},W0e={tokenize:ewe},G0e={tokenize:twe},X0e={tokenize:nwe};function Q0e(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Qi(e,0,e.length,n),e}function Z0e(e,t){let n=e.length,r=0,i,o,a,l;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=So(l,e.slice(o+1,o+r+3)),l=So(l,[["enter",d,t]]),l=So(l,Cw(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),l=So(l,[["exit",d,t],e[a-2],e[a-1],["exit",f,t]]),l=So(l,e.slice(a+1)),l=So(l,[["exit",u,t]]),Qi(e,o,e.length,l),e}function J0e(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return l;function l(g){return o?o._inactive?h(g):(a=r.parser.defined.includes(Yo(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(W0e,d,a?d:h)(g):g===91?e.attempt(G0e,d,a?f:h)(g):a?d(g):h(g)}function f(g){return e.attempt(X0e,d,h)(g)}function d(g){return t(g)}function h(g){return o._balanced=!0,n(g)}}function ewe(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Sn(h)?Em(e,o)(h):o(h)}function o(h){return h===41?d(h):_9(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Sn(h)?Em(e,u)(h):d(h)}function l(h){return n(h)}function u(h){return h===34||h===39||h===40?O9(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function f(h){return Sn(h)?Em(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function twe(e,t,n){const r=this;return i;function i(l){return k9.call(r,e,o,a,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(Yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function nwe(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const rwe={name:"labelStartImage",resolveAll:DA.resolveAll,tokenize:iwe};function iwe(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const owe={name:"labelStartLink",resolveAll:DA.resolveAll,tokenize:awe};function awe(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const NC={name:"lineEnding",tokenize:swe};function swe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const Ux={name:"thematicBreak",tokenize:lwe};function lwe(e,t,n){let r=0,i;return o;function o(f){return e.enter("thematicBreak"),a(f)}function a(f){return i=f,l(f)}function l(f){return f===i?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||ft(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===i?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Lt(f)?Yt(e,l,"whitespace")(f):l(f))}}const wi={continuation:{tokenize:dwe},exit:pwe,name:"list",tokenize:fwe},cwe={partial:!0,tokenize:mwe},uwe={partial:!0,tokenize:hwe};function fwe(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:TO(v)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Ux,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return TO(v)&&++a<10?(e.consume(v),u):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check($g,r.interrupt?n:d,e.attempt(cwe,g,h))}function d(v){return r.containerState.initialBlankLine=!0,o++,g(v)}function h(v){return Lt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function dwe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check($g,i,o);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!Lt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(uwe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(wi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function hwe(e,t,n){const r=this;return Yt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function pwe(e){e.exit(this.containerState.type)}function mwe(e,t,n){const r=this;return Yt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Lt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const o4={name:"setextUnderline",resolveTo:gwe,tokenize:vwe};function gwe(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function vwe(e,t,n){const r=this;let i;return o;function o(f){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===i?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Lt(f)?Yt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ft(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const ywe={tokenize:xwe};function xwe(e){const t=this,n=e.attempt($g,r,e.attempt(this.parser.constructs.flowInitial,i,Yt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(C0e,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bwe={resolveAll:T9()},wwe=j9("string"),Swe=j9("text");function j9(e){return{resolveAll:T9(e==="text"?Ewe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,l);return a;function a(d){return f(d)?o(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return f(d)?(n.exit("data"),o(d)):(n.consume(d),u)}function f(d){if(d===null)return!0;const h=i[d];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function T9(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function Ewe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,l=0,u;for(;o--;){const f=i[o];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(f===-2)u=!0,l++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const Cwe={42:wi,43:wi,45:wi,48:wi,49:wi,50:wi,51:wi,52:wi,53:wi,54:wi,55:wi,56:wi,57:wi,62:w9},_we={91:T0e},kwe={[-2]:AC,[-1]:AC,32:AC},Owe={35:I0e,42:Ux,45:[o4,Ux],60:F0e,61:o4,95:Ux,96:r4,126:r4},jwe={38:E9,92:S9},Twe={[-5]:NC,[-4]:NC,[-3]:NC,33:rwe,38:E9,42:AO,60:[o0e,K0e],91:owe,92:[P0e,S9],93:DA,95:AO,96:y0e},Awe={null:[AO,bwe]},Nwe={null:[42,95]},Rwe={null:[]},Pwe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Nwe,contentInitial:_we,disable:Rwe,document:Cwe,flow:Owe,flowInitial:kwe,insideSpan:Awe,string:jwe,text:Twe},Symbol.toStringTag,{value:"Module"}));function Mwe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],l=[];const u={attempt:N(A),check:N(T),consume:k,enter:O,exit:j,interrupt:N(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:b,parser:e,previous:null,sliceSerialize:g,sliceStream:v,write:h};let d=t.tokenize.call(f,u);return t.resolveAll&&o.push(t),f;function h(q){return a=So(a,q),S(),a[a.length-1]!==null?[]:(P(t,0),f.events=Cw(o,f.events,f),f.events)}function g(q,L){return Dwe(v(q),L)}function v(q){return Iwe(a,q)}function b(){const{_bufferIndex:q,_index:L,line:U,column:H,offset:B}=r;return{_bufferIndex:q,_index:L,line:U,column:H,offset:B}}function w(q){i[q.line]=q.column,D()}function S(){let q;for(;r._index<a.length;){const L=a[r._index];if(typeof L=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<L.length;)E(L.charCodeAt(r._bufferIndex));else E(L)}}function E(q){d=d(q)}function k(q){ft(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,D()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=q}function O(q,L){const U=L||{};return U.type=q,U.start=b(),f.events.push(["enter",U,f]),l.push(U),U}function j(q){const L=l.pop();return L.end=b(),f.events.push(["exit",L,f]),L}function A(q,L){P(q,L.from)}function T(q,L){L.restore()}function N(q,L){return U;function U(H,B,z){let V,Q,G,I;return Array.isArray(H)?$(H):"tokenize"in H?$([H]):K(H);function K(Z){return oe;function oe(ie){const J=ie!==null&&Z[ie],se=ie!==null&&Z.null,xe=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(se)?se:se?[se]:[]];return $(xe)(ie)}}function $(Z){return V=Z,Q=0,Z.length===0?z:R(Z[Q])}function R(Z){return oe;function oe(ie){return I=F(),G=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?W():Z.tokenize.call(L?Object.assign(Object.create(f),L):f,u,X,W)(ie)}}function X(Z){return q(G,I),B}function W(Z){return I.restore(),++Q<V.length?R(V[Q]):z}}}function P(q,L){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&Qi(f.events,L,f.events.length-L,q.resolve(f.events.slice(L),f)),q.resolveTo&&(f.events=q.resolveTo(f.events,f))}function F(){const q=b(),L=f.previous,U=f.currentConstruct,H=f.events.length,B=Array.from(l);return{from:H,restore:z};function z(){r=q,f.previous=L,f.currentConstruct=U,f.events.length=H,l=B,D()}}function D(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Iwe(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function Dwe(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\\r";break}case-4:{a=\`
|
|
217518
217596
|
\`;break}case-3:{a=\`\\r
|
|
@@ -217600,11 +217678,11 @@ agentstep skills install \${n}
|
|
|
217600
217678
|
</body>
|
|
217601
217679
|
</html>
|
|
217602
217680
|
`;
|
|
217603
|
-
UI_VERSION = "
|
|
217681
|
+
UI_VERSION = "37596d78";
|
|
217604
217682
|
}
|
|
217605
217683
|
});
|
|
217606
217684
|
|
|
217607
|
-
// ../agent-sdk/dist/chunk-
|
|
217685
|
+
// ../agent-sdk/dist/chunk-Y6SFUNGO.js
|
|
217608
217686
|
function handleAddUpstreamKey(request2) {
|
|
217609
217687
|
return routeWrap(request2, async ({ auth, request: req }) => {
|
|
217610
217688
|
requireFeature("upstream_pool", "upstream key pool");
|
|
@@ -217696,15 +217774,15 @@ function handleDeleteUpstreamKey(request2, id) {
|
|
|
217696
217774
|
});
|
|
217697
217775
|
}
|
|
217698
217776
|
var AddBody, PatchBody2;
|
|
217699
|
-
var
|
|
217700
|
-
"../agent-sdk/dist/chunk-
|
|
217777
|
+
var init_chunk_Y6SFUNGO = __esm({
|
|
217778
|
+
"../agent-sdk/dist/chunk-Y6SFUNGO.js"() {
|
|
217701
217779
|
"use strict";
|
|
217702
217780
|
init_chunk_PIJKJNGB();
|
|
217703
217781
|
init_chunk_H7UKW666();
|
|
217704
217782
|
init_chunk_23UKWXJH();
|
|
217705
217783
|
init_chunk_KLN6HPYM();
|
|
217706
217784
|
init_chunk_2N2KL4KM();
|
|
217707
|
-
|
|
217785
|
+
init_chunk_RH4GKU52();
|
|
217708
217786
|
init_chunk_EZYKRG4W();
|
|
217709
217787
|
init_zod();
|
|
217710
217788
|
AddBody = external_exports.object({
|
|
@@ -217718,7 +217796,7 @@ var init_chunk_XMVAVJJJ = __esm({
|
|
|
217718
217796
|
}
|
|
217719
217797
|
});
|
|
217720
217798
|
|
|
217721
|
-
// ../agent-sdk/dist/chunk-
|
|
217799
|
+
// ../agent-sdk/dist/chunk-XWWLMJXT.js
|
|
217722
217800
|
function assertStoreTenant(auth, storeAgentId) {
|
|
217723
217801
|
if (storeAgentId == null) {
|
|
217724
217802
|
if (!auth.isGlobalAdmin) throw notFound("memory store not found");
|
|
@@ -217842,12 +217920,12 @@ function handleDeleteMemory(request2, storeId, memId) {
|
|
|
217842
217920
|
});
|
|
217843
217921
|
}
|
|
217844
217922
|
var CreateStoreSchema, CreateMemorySchema, UpdateMemorySchema;
|
|
217845
|
-
var
|
|
217846
|
-
"../agent-sdk/dist/chunk-
|
|
217923
|
+
var init_chunk_XWWLMJXT = __esm({
|
|
217924
|
+
"../agent-sdk/dist/chunk-XWWLMJXT.js"() {
|
|
217847
217925
|
"use strict";
|
|
217848
217926
|
init_chunk_23UKWXJH();
|
|
217849
217927
|
init_chunk_SUGSHXND();
|
|
217850
|
-
|
|
217928
|
+
init_chunk_RH4GKU52();
|
|
217851
217929
|
init_chunk_6POQAFEC();
|
|
217852
217930
|
init_chunk_EZYKRG4W();
|
|
217853
217931
|
init_zod();
|
|
@@ -217868,7 +217946,7 @@ var init_chunk_5KIHH7PU = __esm({
|
|
|
217868
217946
|
}
|
|
217869
217947
|
});
|
|
217870
217948
|
|
|
217871
|
-
// ../agent-sdk/dist/chunk-
|
|
217949
|
+
// ../agent-sdk/dist/chunk-FP4E3QUS.js
|
|
217872
217950
|
function zeroTotals() {
|
|
217873
217951
|
return {
|
|
217874
217952
|
session_count: 0,
|
|
@@ -218228,12 +218306,12 @@ function handleGetApiMetrics(request2) {
|
|
|
218228
218306
|
});
|
|
218229
218307
|
}
|
|
218230
218308
|
var BUCKET_MS, TOP_N, MAX_POINTS_PER_SERIES, MAX_TOTAL_CELLS;
|
|
218231
|
-
var
|
|
218232
|
-
"../agent-sdk/dist/chunk-
|
|
218309
|
+
var init_chunk_FP4E3QUS = __esm({
|
|
218310
|
+
"../agent-sdk/dist/chunk-FP4E3QUS.js"() {
|
|
218233
218311
|
"use strict";
|
|
218234
218312
|
init_chunk_23UKWXJH();
|
|
218235
218313
|
init_chunk_2N2KL4KM();
|
|
218236
|
-
|
|
218314
|
+
init_chunk_RH4GKU52();
|
|
218237
218315
|
init_chunk_D2XITRN6();
|
|
218238
218316
|
init_chunk_6POQAFEC();
|
|
218239
218317
|
init_chunk_EZYKRG4W();
|
|
@@ -218249,7 +218327,7 @@ var init_chunk_5FNWMFBA = __esm({
|
|
|
218249
218327
|
}
|
|
218250
218328
|
});
|
|
218251
218329
|
|
|
218252
|
-
// ../agent-sdk/dist/chunk-
|
|
218330
|
+
// ../agent-sdk/dist/chunk-2RSL5SO7.js
|
|
218253
218331
|
function handleListModels(request2) {
|
|
218254
218332
|
return routeWrap(request2, async ({ request: req }) => {
|
|
218255
218333
|
const url2 = new URL(req.url);
|
|
@@ -218260,11 +218338,11 @@ function handleListModels(request2) {
|
|
|
218260
218338
|
return jsonOk({ data: models });
|
|
218261
218339
|
});
|
|
218262
218340
|
}
|
|
218263
|
-
var
|
|
218264
|
-
"../agent-sdk/dist/chunk-
|
|
218341
|
+
var init_chunk_2RSL5SO7 = __esm({
|
|
218342
|
+
"../agent-sdk/dist/chunk-2RSL5SO7.js"() {
|
|
218265
218343
|
"use strict";
|
|
218266
218344
|
init_chunk_C46UG6GQ();
|
|
218267
|
-
|
|
218345
|
+
init_chunk_RH4GKU52();
|
|
218268
218346
|
}
|
|
218269
218347
|
});
|
|
218270
218348
|
|
|
@@ -218287,7 +218365,7 @@ var init_chunk_RDGOGAQ5 = __esm({
|
|
|
218287
218365
|
}
|
|
218288
218366
|
});
|
|
218289
218367
|
|
|
218290
|
-
// ../agent-sdk/dist/chunk-
|
|
218368
|
+
// ../agent-sdk/dist/chunk-2Z2KAPUL.js
|
|
218291
218369
|
async function checkLocalProvider(name) {
|
|
218292
218370
|
try {
|
|
218293
218371
|
const provider = await resolveContainerProvider(name);
|
|
@@ -218308,8 +218386,8 @@ function checkCloudProvider(name) {
|
|
|
218308
218386
|
if (config4.spriteToken) return { available: true };
|
|
218309
218387
|
}
|
|
218310
218388
|
return {
|
|
218311
|
-
available:
|
|
218312
|
-
message:
|
|
218389
|
+
available: true,
|
|
218390
|
+
message: `${envVar} not found in env or settings. Provide via vault_ids at session creation.`
|
|
218313
218391
|
};
|
|
218314
218392
|
}
|
|
218315
218393
|
async function handleGetProviderStatus(request2) {
|
|
@@ -218326,10 +218404,10 @@ async function handleGetProviderStatus(request2) {
|
|
|
218326
218404
|
});
|
|
218327
218405
|
}
|
|
218328
218406
|
var LOCAL_PROVIDERS, CLOUD_PROVIDERS, CLOUD_KEY_MAP;
|
|
218329
|
-
var
|
|
218330
|
-
"../agent-sdk/dist/chunk-
|
|
218407
|
+
var init_chunk_2Z2KAPUL = __esm({
|
|
218408
|
+
"../agent-sdk/dist/chunk-2Z2KAPUL.js"() {
|
|
218331
218409
|
"use strict";
|
|
218332
|
-
|
|
218410
|
+
init_chunk_RH4GKU52();
|
|
218333
218411
|
init_chunk_WPK4ZPMG();
|
|
218334
218412
|
init_chunk_V7MTIMPB();
|
|
218335
218413
|
LOCAL_PROVIDERS = ["docker", "apple-container", "podman"];
|
|
@@ -218345,7 +218423,7 @@ var init_chunk_XGASOCQ7 = __esm({
|
|
|
218345
218423
|
}
|
|
218346
218424
|
});
|
|
218347
218425
|
|
|
218348
|
-
// ../agent-sdk/dist/chunk-
|
|
218426
|
+
// ../agent-sdk/dist/chunk-V66YKIW6.js
|
|
218349
218427
|
function assertSessionTenant(auth, sessionId) {
|
|
218350
218428
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
218351
218429
|
if (row) {
|
|
@@ -218420,11 +218498,11 @@ function handleDeleteResource(request2, sessionId, resourceId) {
|
|
|
218420
218498
|
});
|
|
218421
218499
|
}
|
|
218422
218500
|
var MAX_RESOURCES_PER_SESSION, AddResourceSchema;
|
|
218423
|
-
var
|
|
218424
|
-
"../agent-sdk/dist/chunk-
|
|
218501
|
+
var init_chunk_V66YKIW6 = __esm({
|
|
218502
|
+
"../agent-sdk/dist/chunk-V66YKIW6.js"() {
|
|
218425
218503
|
"use strict";
|
|
218426
218504
|
init_chunk_23UKWXJH();
|
|
218427
|
-
|
|
218505
|
+
init_chunk_RH4GKU52();
|
|
218428
218506
|
init_chunk_E7DD7F7J();
|
|
218429
218507
|
init_chunk_3NK6YTA5();
|
|
218430
218508
|
init_chunk_5EKQBD2H();
|
|
@@ -218452,7 +218530,7 @@ var init_chunk_LZ2INBPL = __esm({
|
|
|
218452
218530
|
}
|
|
218453
218531
|
});
|
|
218454
218532
|
|
|
218455
|
-
// ../agent-sdk/dist/chunk-
|
|
218533
|
+
// ../agent-sdk/dist/chunk-DU7LSFQQ.js
|
|
218456
218534
|
import { createHash as createHash5 } from "crypto";
|
|
218457
218535
|
function anthropicHeaders(apiKey) {
|
|
218458
218536
|
return {
|
|
@@ -218609,8 +218687,8 @@ async function syncAndCreateSession(opts) {
|
|
|
218609
218687
|
return { remoteSessionId: remoteSession.id };
|
|
218610
218688
|
}
|
|
218611
218689
|
var ANTHROPIC_BASE2, BETA_HEADER3;
|
|
218612
|
-
var
|
|
218613
|
-
"../agent-sdk/dist/chunk-
|
|
218690
|
+
var init_chunk_DU7LSFQQ = __esm({
|
|
218691
|
+
"../agent-sdk/dist/chunk-DU7LSFQQ.js"() {
|
|
218614
218692
|
"use strict";
|
|
218615
218693
|
init_chunk_L2RX552S();
|
|
218616
218694
|
init_chunk_SV2B3P6B();
|
|
@@ -218745,7 +218823,7 @@ var init_vaults = __esm({
|
|
|
218745
218823
|
}
|
|
218746
218824
|
});
|
|
218747
218825
|
|
|
218748
|
-
// ../agent-sdk/dist/chunk-
|
|
218826
|
+
// ../agent-sdk/dist/chunk-EUINGLHA.js
|
|
218749
218827
|
function getAgentTenantId(id) {
|
|
218750
218828
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
218751
218829
|
return row?.tenant_id;
|
|
@@ -219192,20 +219270,20 @@ function parseMs(v2) {
|
|
|
219192
219270
|
return Number.isFinite(t2) ? t2 : void 0;
|
|
219193
219271
|
}
|
|
219194
219272
|
var ALLOWED_STATUSES, AgentRef, ResourceSchema, CreateSchema, UpdateSchema;
|
|
219195
|
-
var
|
|
219196
|
-
"../agent-sdk/dist/chunk-
|
|
219273
|
+
var init_chunk_EUINGLHA = __esm({
|
|
219274
|
+
"../agent-sdk/dist/chunk-EUINGLHA.js"() {
|
|
219197
219275
|
"use strict";
|
|
219198
|
-
|
|
219276
|
+
init_chunk_DU7LSFQQ();
|
|
219199
219277
|
init_chunk_L2RX552S();
|
|
219200
219278
|
init_chunk_23UKWXJH();
|
|
219201
219279
|
init_chunk_DC2UMEQH();
|
|
219202
219280
|
init_chunk_C6AXM3M7();
|
|
219203
|
-
|
|
219281
|
+
init_chunk_RH4GKU52();
|
|
219204
219282
|
init_chunk_JCW3ZRES();
|
|
219205
219283
|
init_chunk_H6TQGV4L();
|
|
219206
219284
|
init_chunk_E7DD7F7J();
|
|
219207
219285
|
init_chunk_LAWTTG2E();
|
|
219208
|
-
|
|
219286
|
+
init_chunk_N76ZVITA();
|
|
219209
219287
|
init_chunk_MHBLVGRF();
|
|
219210
219288
|
init_chunk_3NK6YTA5();
|
|
219211
219289
|
init_chunk_X6IQ57SC();
|
|
@@ -219260,7 +219338,7 @@ var init_chunk_7MXFGIBW = __esm({
|
|
|
219260
219338
|
}
|
|
219261
219339
|
});
|
|
219262
219340
|
|
|
219263
|
-
// ../agent-sdk/dist/chunk-
|
|
219341
|
+
// ../agent-sdk/dist/chunk-ZQXBHNEZ.js
|
|
219264
219342
|
function maskSecret(value) {
|
|
219265
219343
|
if (!value) return "";
|
|
219266
219344
|
if (value.length <= 12) return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
@@ -219295,10 +219373,10 @@ function handleGetSetting(request2, key) {
|
|
|
219295
219373
|
});
|
|
219296
219374
|
}
|
|
219297
219375
|
var NON_SECRET_KEYS, ALLOWED_KEYS, SECRET_KEYS;
|
|
219298
|
-
var
|
|
219299
|
-
"../agent-sdk/dist/chunk-
|
|
219376
|
+
var init_chunk_ZQXBHNEZ = __esm({
|
|
219377
|
+
"../agent-sdk/dist/chunk-ZQXBHNEZ.js"() {
|
|
219300
219378
|
"use strict";
|
|
219301
|
-
|
|
219379
|
+
init_chunk_RH4GKU52();
|
|
219302
219380
|
init_chunk_V7MTIMPB();
|
|
219303
219381
|
init_chunk_EZYKRG4W();
|
|
219304
219382
|
NON_SECRET_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -219340,7 +219418,7 @@ var init_chunk_R4Y34JIR = __esm({
|
|
|
219340
219418
|
}
|
|
219341
219419
|
});
|
|
219342
219420
|
|
|
219343
|
-
// ../agent-sdk/dist/chunk-
|
|
219421
|
+
// ../agent-sdk/dist/chunk-FOOH6SCB.js
|
|
219344
219422
|
function handleBatch(request2) {
|
|
219345
219423
|
return routeWrap(request2, async () => {
|
|
219346
219424
|
const body = await request2.json();
|
|
@@ -219367,11 +219445,11 @@ function handleBatch(request2) {
|
|
|
219367
219445
|
});
|
|
219368
219446
|
}
|
|
219369
219447
|
var OperationSchema, BatchSchema;
|
|
219370
|
-
var
|
|
219371
|
-
"../agent-sdk/dist/chunk-
|
|
219448
|
+
var init_chunk_FOOH6SCB = __esm({
|
|
219449
|
+
"../agent-sdk/dist/chunk-FOOH6SCB.js"() {
|
|
219372
219450
|
"use strict";
|
|
219373
219451
|
init_chunk_7GG3FEK2();
|
|
219374
|
-
|
|
219452
|
+
init_chunk_RH4GKU52();
|
|
219375
219453
|
init_chunk_EZYKRG4W();
|
|
219376
219454
|
init_zod();
|
|
219377
219455
|
OperationSchema = external_exports.object({
|
|
@@ -219385,7 +219463,7 @@ var init_chunk_ZJ6GX6LK = __esm({
|
|
|
219385
219463
|
}
|
|
219386
219464
|
});
|
|
219387
219465
|
|
|
219388
|
-
// ../agent-sdk/dist/chunk-
|
|
219466
|
+
// ../agent-sdk/dist/chunk-ZFJPOQSY.js
|
|
219389
219467
|
function getVaultTenantId(id) {
|
|
219390
219468
|
const row = getDb().prepare(`SELECT tenant_id FROM vaults WHERE id = ?`).get(id);
|
|
219391
219469
|
return row?.tenant_id;
|
|
@@ -219499,11 +219577,11 @@ function handleDeleteEntry(request2, vaultId, key) {
|
|
|
219499
219577
|
});
|
|
219500
219578
|
}
|
|
219501
219579
|
var CreateVaultSchema, PutEntrySchema;
|
|
219502
|
-
var
|
|
219503
|
-
"../agent-sdk/dist/chunk-
|
|
219580
|
+
var init_chunk_ZFJPOQSY = __esm({
|
|
219581
|
+
"../agent-sdk/dist/chunk-ZFJPOQSY.js"() {
|
|
219504
219582
|
"use strict";
|
|
219505
219583
|
init_chunk_23UKWXJH();
|
|
219506
|
-
|
|
219584
|
+
init_chunk_RH4GKU52();
|
|
219507
219585
|
init_chunk_ZVXIZ2JD();
|
|
219508
219586
|
init_chunk_ZTH5JRZG();
|
|
219509
219587
|
init_chunk_6POQAFEC();
|
|
@@ -219526,7 +219604,7 @@ var init_chunk_RAJOCFU5 = __esm({
|
|
|
219526
219604
|
}
|
|
219527
219605
|
});
|
|
219528
219606
|
|
|
219529
|
-
// ../agent-sdk/dist/chunk-
|
|
219607
|
+
// ../agent-sdk/dist/chunk-CHDQ3HIR.js
|
|
219530
219608
|
function handleCreateCredential(request2, vaultId) {
|
|
219531
219609
|
return routeWrap(request2, async ({ auth }) => {
|
|
219532
219610
|
loadVaultForCaller(auth, vaultId);
|
|
@@ -219659,11 +219737,11 @@ function handleDeleteCredential(request2, vaultId, credentialId) {
|
|
|
219659
219737
|
});
|
|
219660
219738
|
}
|
|
219661
219739
|
var TokenEndpointAuthSchema, OAuthRefreshSchema, StaticBearerAuthSchema, McpOauthAuthSchema, CreateCredentialSchema, UpdateStaticBearerAuthSchema, UpdateMcpOauthAuthSchema, UpdateAuthSchema, UpdateCredentialSchema;
|
|
219662
|
-
var
|
|
219663
|
-
"../agent-sdk/dist/chunk-
|
|
219740
|
+
var init_chunk_CHDQ3HIR = __esm({
|
|
219741
|
+
"../agent-sdk/dist/chunk-CHDQ3HIR.js"() {
|
|
219664
219742
|
"use strict";
|
|
219665
|
-
|
|
219666
|
-
|
|
219743
|
+
init_chunk_ZFJPOQSY();
|
|
219744
|
+
init_chunk_RH4GKU52();
|
|
219667
219745
|
init_chunk_L5RW66H5();
|
|
219668
219746
|
init_chunk_EZYKRG4W();
|
|
219669
219747
|
init_zod();
|
|
@@ -219813,7 +219891,7 @@ var init_chunk_F27XQZ2O = __esm({
|
|
|
219813
219891
|
}
|
|
219814
219892
|
});
|
|
219815
219893
|
|
|
219816
|
-
// ../agent-sdk/dist/chunk-
|
|
219894
|
+
// ../agent-sdk/dist/chunk-MXOG5SAO.js
|
|
219817
219895
|
function getEnvironmentTenantId2(id) {
|
|
219818
219896
|
const row = getDb().prepare(`SELECT tenant_id FROM environments WHERE id = ?`).get(id);
|
|
219819
219897
|
return row?.tenant_id;
|
|
@@ -219968,12 +220046,12 @@ function handleUpdateEnvironment(request2, id) {
|
|
|
219968
220046
|
});
|
|
219969
220047
|
}
|
|
219970
220048
|
var PackagesSchema, NetworkingSchema, ConfigSchema, CreateSchema2, UpdateSchema2;
|
|
219971
|
-
var
|
|
219972
|
-
"../agent-sdk/dist/chunk-
|
|
220049
|
+
var init_chunk_MXOG5SAO = __esm({
|
|
220050
|
+
"../agent-sdk/dist/chunk-MXOG5SAO.js"() {
|
|
219973
220051
|
"use strict";
|
|
219974
220052
|
init_chunk_23UKWXJH();
|
|
219975
220053
|
init_chunk_C6AXM3M7();
|
|
219976
|
-
|
|
220054
|
+
init_chunk_RH4GKU52();
|
|
219977
220055
|
init_chunk_JCW3ZRES();
|
|
219978
220056
|
init_chunk_E7DD7F7J();
|
|
219979
220057
|
init_chunk_WPK4ZPMG();
|
|
@@ -220035,7 +220113,7 @@ __export(driver_exports, {
|
|
|
220035
220113
|
var init_driver = __esm({
|
|
220036
220114
|
"../agent-sdk/dist/sessions/driver.js"() {
|
|
220037
220115
|
"use strict";
|
|
220038
|
-
|
|
220116
|
+
init_chunk_DAVYI5H4();
|
|
220039
220117
|
init_chunk_PJZ5TQYW();
|
|
220040
220118
|
init_chunk_AU4NAQGA();
|
|
220041
220119
|
init_chunk_H6TQGV4L();
|
|
@@ -220044,7 +220122,7 @@ var init_driver = __esm({
|
|
|
220044
220122
|
init_chunk_TPPLYCJF();
|
|
220045
220123
|
init_chunk_E7DD7F7J();
|
|
220046
220124
|
init_chunk_L5RW66H5();
|
|
220047
|
-
|
|
220125
|
+
init_chunk_N76ZVITA();
|
|
220048
220126
|
init_chunk_4XXQAVKE();
|
|
220049
220127
|
init_chunk_5IGBMS2U();
|
|
220050
220128
|
init_chunk_5ZFOKZGR();
|
|
@@ -220116,7 +220194,7 @@ var init_driver = __esm({
|
|
|
220116
220194
|
}
|
|
220117
220195
|
});
|
|
220118
220196
|
|
|
220119
|
-
// ../agent-sdk/dist/chunk-
|
|
220197
|
+
// ../agent-sdk/dist/chunk-W2NHS4IF.js
|
|
220120
220198
|
function assertSessionTenant2(auth, sessionId) {
|
|
220121
220199
|
const row = getDb().prepare(`SELECT tenant_id FROM sessions WHERE id = ?`).get(sessionId);
|
|
220122
220200
|
if (row) {
|
|
@@ -220643,17 +220721,17 @@ function handleListEvents(request2, sessionId) {
|
|
|
220643
220721
|
});
|
|
220644
220722
|
}
|
|
220645
220723
|
var teeLog, activeTees, MAX_TEE_REENTRIES, TextBlock2, UserMessage, UserInterrupt, UserToolConfirmation, UserCustomToolResult, UserDefineOutcome, UserEvent, BatchSchema2;
|
|
220646
|
-
var
|
|
220647
|
-
"../agent-sdk/dist/chunk-
|
|
220724
|
+
var init_chunk_W2NHS4IF = __esm({
|
|
220725
|
+
"../agent-sdk/dist/chunk-W2NHS4IF.js"() {
|
|
220648
220726
|
"use strict";
|
|
220649
220727
|
init_chunk_PIJKJNGB();
|
|
220650
220728
|
init_chunk_L2RX552S();
|
|
220651
220729
|
init_chunk_23UKWXJH();
|
|
220652
220730
|
init_chunk_DC2UMEQH();
|
|
220653
220731
|
init_chunk_SUGSHXND();
|
|
220654
|
-
|
|
220732
|
+
init_chunk_RH4GKU52();
|
|
220655
220733
|
init_chunk_JCW3ZRES();
|
|
220656
|
-
|
|
220734
|
+
init_chunk_DAVYI5H4();
|
|
220657
220735
|
init_chunk_2PPB644A();
|
|
220658
220736
|
init_chunk_E7DD7F7J();
|
|
220659
220737
|
init_chunk_LAWTTG2E();
|
|
@@ -220709,7 +220787,7 @@ var init_chunk_OANFCHIX = __esm({
|
|
|
220709
220787
|
}
|
|
220710
220788
|
});
|
|
220711
220789
|
|
|
220712
|
-
// ../agent-sdk/dist/chunk-
|
|
220790
|
+
// ../agent-sdk/dist/chunk-LAVHQCRP.js
|
|
220713
220791
|
function assertFileTenantByScope(auth, scopeType, scopeId) {
|
|
220714
220792
|
if (!scopeId || scopeType !== "session") {
|
|
220715
220793
|
if (!auth.isGlobalAdmin) throw notFound("file not found");
|
|
@@ -220844,30 +220922,30 @@ function handleDeleteFile(request2, fileId) {
|
|
|
220844
220922
|
return jsonOk(result);
|
|
220845
220923
|
});
|
|
220846
220924
|
}
|
|
220847
|
-
var
|
|
220848
|
-
"../agent-sdk/dist/chunk-
|
|
220925
|
+
var init_chunk_LAVHQCRP = __esm({
|
|
220926
|
+
"../agent-sdk/dist/chunk-LAVHQCRP.js"() {
|
|
220849
220927
|
"use strict";
|
|
220850
220928
|
init_chunk_STPT3SWU();
|
|
220851
|
-
|
|
220929
|
+
init_chunk_NQVRZAIX();
|
|
220852
220930
|
init_chunk_23UKWXJH();
|
|
220853
|
-
|
|
220931
|
+
init_chunk_RH4GKU52();
|
|
220854
220932
|
init_chunk_6POQAFEC();
|
|
220855
220933
|
init_chunk_EZYKRG4W();
|
|
220856
220934
|
init_client();
|
|
220857
220935
|
}
|
|
220858
220936
|
});
|
|
220859
220937
|
|
|
220860
|
-
// ../agent-sdk/dist/chunk-
|
|
220938
|
+
// ../agent-sdk/dist/chunk-HOIDGDU5.js
|
|
220861
220939
|
function handleGetLicense(request2) {
|
|
220862
220940
|
return routeWrap(request2, async () => {
|
|
220863
220941
|
return jsonOk(getLicenseInfo());
|
|
220864
220942
|
});
|
|
220865
220943
|
}
|
|
220866
|
-
var
|
|
220867
|
-
"../agent-sdk/dist/chunk-
|
|
220944
|
+
var init_chunk_HOIDGDU5 = __esm({
|
|
220945
|
+
"../agent-sdk/dist/chunk-HOIDGDU5.js"() {
|
|
220868
220946
|
"use strict";
|
|
220869
220947
|
init_chunk_2N2KL4KM();
|
|
220870
|
-
|
|
220948
|
+
init_chunk_RH4GKU52();
|
|
220871
220949
|
}
|
|
220872
220950
|
});
|
|
220873
220951
|
|
|
@@ -220886,7 +220964,7 @@ var init_models = __esm({
|
|
|
220886
220964
|
}
|
|
220887
220965
|
});
|
|
220888
220966
|
|
|
220889
|
-
// ../agent-sdk/dist/chunk-
|
|
220967
|
+
// ../agent-sdk/dist/chunk-ZYISLRS6.js
|
|
220890
220968
|
function getAgentTenantId3(id) {
|
|
220891
220969
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
220892
220970
|
return row?.tenant_id;
|
|
@@ -221055,11 +221133,11 @@ function handleDeleteAgent(request2, id) {
|
|
|
221055
221133
|
});
|
|
221056
221134
|
}
|
|
221057
221135
|
var SkillSchema, ToolSchema, McpServerSchema, ModelConfigSchema2, CreateSchema3, UpdateSchema3;
|
|
221058
|
-
var
|
|
221059
|
-
"../agent-sdk/dist/chunk-
|
|
221136
|
+
var init_chunk_ZYISLRS6 = __esm({
|
|
221137
|
+
"../agent-sdk/dist/chunk-ZYISLRS6.js"() {
|
|
221060
221138
|
"use strict";
|
|
221061
221139
|
init_chunk_23UKWXJH();
|
|
221062
|
-
|
|
221140
|
+
init_chunk_RH4GKU52();
|
|
221063
221141
|
init_chunk_JCW3ZRES();
|
|
221064
221142
|
init_chunk_E7DD7F7J();
|
|
221065
221143
|
init_chunk_ZTH5JRZG();
|
|
@@ -221158,7 +221236,7 @@ var init_chunk_65EDEMJI = __esm({
|
|
|
221158
221236
|
}
|
|
221159
221237
|
});
|
|
221160
221238
|
|
|
221161
|
-
// ../agent-sdk/dist/chunk-
|
|
221239
|
+
// ../agent-sdk/dist/chunk-HH4OXSOV.js
|
|
221162
221240
|
function toView3(row) {
|
|
221163
221241
|
return row;
|
|
221164
221242
|
}
|
|
@@ -221329,13 +221407,13 @@ function handleGetApiKeyActivity(request2, id) {
|
|
|
221329
221407
|
});
|
|
221330
221408
|
}
|
|
221331
221409
|
var ScopeSchema, PermissionsSchema, CreateBody2, PatchBody3;
|
|
221332
|
-
var
|
|
221333
|
-
"../agent-sdk/dist/chunk-
|
|
221410
|
+
var init_chunk_HH4OXSOV = __esm({
|
|
221411
|
+
"../agent-sdk/dist/chunk-HH4OXSOV.js"() {
|
|
221334
221412
|
"use strict";
|
|
221335
221413
|
init_chunk_23UKWXJH();
|
|
221336
221414
|
init_chunk_KLN6HPYM();
|
|
221337
221415
|
init_chunk_2N2KL4KM();
|
|
221338
|
-
|
|
221416
|
+
init_chunk_RH4GKU52();
|
|
221339
221417
|
init_chunk_USYY3L7G();
|
|
221340
221418
|
init_chunk_3NK6YTA5();
|
|
221341
221419
|
init_chunk_6POQAFEC();
|
|
@@ -221362,7 +221440,7 @@ var init_chunk_UCXLRDPI = __esm({
|
|
|
221362
221440
|
}
|
|
221363
221441
|
});
|
|
221364
221442
|
|
|
221365
|
-
// ../agent-sdk/dist/chunk-
|
|
221443
|
+
// ../agent-sdk/dist/chunk-QSUGIJWV.js
|
|
221366
221444
|
function parseMs2(v2) {
|
|
221367
221445
|
if (!v2) return void 0;
|
|
221368
221446
|
const n = Number(v2);
|
|
@@ -221414,12 +221492,12 @@ function handleListAudit(request2) {
|
|
|
221414
221492
|
});
|
|
221415
221493
|
}
|
|
221416
221494
|
var VALID_OUTCOMES;
|
|
221417
|
-
var
|
|
221418
|
-
"../agent-sdk/dist/chunk-
|
|
221495
|
+
var init_chunk_QSUGIJWV = __esm({
|
|
221496
|
+
"../agent-sdk/dist/chunk-QSUGIJWV.js"() {
|
|
221419
221497
|
"use strict";
|
|
221420
221498
|
init_chunk_23UKWXJH();
|
|
221421
221499
|
init_chunk_KLN6HPYM();
|
|
221422
|
-
|
|
221500
|
+
init_chunk_RH4GKU52();
|
|
221423
221501
|
init_chunk_EZYKRG4W();
|
|
221424
221502
|
VALID_OUTCOMES = /* @__PURE__ */ new Set(["success", "denied", "failure"]);
|
|
221425
221503
|
}
|
|
@@ -221525,43 +221603,43 @@ __export(handlers_exports, {
|
|
|
221525
221603
|
var init_handlers3 = __esm({
|
|
221526
221604
|
"../agent-sdk/dist/handlers/index.js"() {
|
|
221527
221605
|
"use strict";
|
|
221528
|
-
|
|
221529
|
-
|
|
221530
|
-
|
|
221531
|
-
|
|
221532
|
-
|
|
221533
|
-
|
|
221534
|
-
|
|
221535
|
-
|
|
221536
|
-
|
|
221537
|
-
|
|
221538
|
-
|
|
221539
|
-
|
|
221540
|
-
|
|
221606
|
+
init_chunk_KKCLTWG7();
|
|
221607
|
+
init_chunk_ENGKR2JT();
|
|
221608
|
+
init_chunk_YBZJHDSE();
|
|
221609
|
+
init_chunk_V5HWHJ4P();
|
|
221610
|
+
init_chunk_32XS3Y6P();
|
|
221611
|
+
init_chunk_RP6WQ4IH();
|
|
221612
|
+
init_chunk_LZFB3HRK();
|
|
221613
|
+
init_chunk_JWH4OIBP();
|
|
221614
|
+
init_chunk_3XGUMXGR();
|
|
221615
|
+
init_chunk_Y6SFUNGO();
|
|
221616
|
+
init_chunk_XWWLMJXT();
|
|
221617
|
+
init_chunk_FP4E3QUS();
|
|
221618
|
+
init_chunk_2RSL5SO7();
|
|
221541
221619
|
init_chunk_C46UG6GQ();
|
|
221542
221620
|
init_chunk_RDGOGAQ5();
|
|
221543
|
-
|
|
221544
|
-
|
|
221545
|
-
|
|
221546
|
-
|
|
221547
|
-
|
|
221548
|
-
|
|
221549
|
-
|
|
221550
|
-
|
|
221621
|
+
init_chunk_2Z2KAPUL();
|
|
221622
|
+
init_chunk_V66YKIW6();
|
|
221623
|
+
init_chunk_EUINGLHA();
|
|
221624
|
+
init_chunk_DU7LSFQQ();
|
|
221625
|
+
init_chunk_ZQXBHNEZ();
|
|
221626
|
+
init_chunk_FOOH6SCB();
|
|
221627
|
+
init_chunk_CHDQ3HIR();
|
|
221628
|
+
init_chunk_ZFJPOQSY();
|
|
221551
221629
|
init_chunk_F27XQZ2O();
|
|
221552
|
-
|
|
221553
|
-
|
|
221630
|
+
init_chunk_MXOG5SAO();
|
|
221631
|
+
init_chunk_W2NHS4IF();
|
|
221554
221632
|
init_chunk_PIJKJNGB();
|
|
221555
|
-
|
|
221556
|
-
|
|
221633
|
+
init_chunk_LAVHQCRP();
|
|
221634
|
+
init_chunk_HOIDGDU5();
|
|
221557
221635
|
init_chunk_6GP5IKXE();
|
|
221558
221636
|
init_chunk_H7UKW666();
|
|
221559
221637
|
init_chunk_STPT3SWU();
|
|
221560
|
-
|
|
221561
|
-
|
|
221562
|
-
|
|
221638
|
+
init_chunk_ZYISLRS6();
|
|
221639
|
+
init_chunk_HH4OXSOV();
|
|
221640
|
+
init_chunk_QSUGIJWV();
|
|
221563
221641
|
init_chunk_L2RX552S();
|
|
221564
|
-
|
|
221642
|
+
init_chunk_NQVRZAIX();
|
|
221565
221643
|
init_chunk_23UKWXJH();
|
|
221566
221644
|
init_chunk_4TKOEF6X();
|
|
221567
221645
|
init_chunk_D2TRWKVQ();
|
|
@@ -221573,14 +221651,14 @@ var init_handlers3 = __esm({
|
|
|
221573
221651
|
init_chunk_2N2KL4KM();
|
|
221574
221652
|
init_chunk_7GG3FEK2();
|
|
221575
221653
|
init_chunk_C6AXM3M7();
|
|
221576
|
-
|
|
221654
|
+
init_chunk_RH4GKU52();
|
|
221577
221655
|
init_chunk_D2XITRN6();
|
|
221578
221656
|
init_chunk_WQARLGBG();
|
|
221579
221657
|
init_chunk_JCW3ZRES();
|
|
221580
221658
|
init_chunk_W6WKXFHN();
|
|
221581
221659
|
init_chunk_HVUWXUUI();
|
|
221582
|
-
|
|
221583
|
-
|
|
221660
|
+
init_chunk_LMNFIJ6M();
|
|
221661
|
+
init_chunk_DAVYI5H4();
|
|
221584
221662
|
init_chunk_PJZ5TQYW();
|
|
221585
221663
|
init_chunk_AU4NAQGA();
|
|
221586
221664
|
init_chunk_H6TQGV4L();
|
|
@@ -221594,10 +221672,10 @@ var init_handlers3 = __esm({
|
|
|
221594
221672
|
init_chunk_L5RW66H5();
|
|
221595
221673
|
init_chunk_USYY3L7G();
|
|
221596
221674
|
init_chunk_3MQ2FWXS();
|
|
221597
|
-
|
|
221598
|
-
|
|
221675
|
+
init_chunk_34EB622U();
|
|
221676
|
+
init_chunk_3FDE3BPB();
|
|
221599
221677
|
init_chunk_LAWTTG2E();
|
|
221600
|
-
|
|
221678
|
+
init_chunk_N76ZVITA();
|
|
221601
221679
|
init_chunk_4XXQAVKE();
|
|
221602
221680
|
init_chunk_5IGBMS2U();
|
|
221603
221681
|
init_chunk_5ZFOKZGR();
|
|
@@ -236991,8 +237069,8 @@ import { join as join6 } from "node:path";
|
|
|
236991
237069
|
import { homedir as homedir3 } from "node:os";
|
|
236992
237070
|
function configDir() {
|
|
236993
237071
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
236994
|
-
if (xdg) return join6(xdg, "
|
|
236995
|
-
return join6(homedir3(), ".config", "
|
|
237072
|
+
if (xdg) return join6(xdg, "agentstep");
|
|
237073
|
+
return join6(homedir3(), ".config", "agentstep");
|
|
236996
237074
|
}
|
|
236997
237075
|
function configPath() {
|
|
236998
237076
|
return join6(configDir(), "config.yaml");
|