heyio 4.3.0 → 4.3.2
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/daemon/cli.js
CHANGED
|
@@ -80,7 +80,7 @@ var init_constants = __esm({
|
|
|
80
80
|
"packages/shared/dist/constants.js"() {
|
|
81
81
|
"use strict";
|
|
82
82
|
APP_NAME = "io";
|
|
83
|
-
APP_VERSION = "4.3.
|
|
83
|
+
APP_VERSION = "4.3.2";
|
|
84
84
|
API_PORT = 7777;
|
|
85
85
|
API_HOST = "0.0.0.0";
|
|
86
86
|
DEFAULT_MODEL = "gpt-4.1-mini";
|
|
@@ -2600,6 +2600,14 @@ async function markRead(id, db) {
|
|
|
2600
2600
|
}
|
|
2601
2601
|
return getInboxItem(id, database);
|
|
2602
2602
|
}
|
|
2603
|
+
async function deleteInboxItem(id, db) {
|
|
2604
|
+
const database = db ?? await getDatabase();
|
|
2605
|
+
const result = await database.execute({
|
|
2606
|
+
sql: "DELETE FROM inbox WHERE id = ?",
|
|
2607
|
+
args: [id]
|
|
2608
|
+
});
|
|
2609
|
+
return (result.rowsAffected ?? 0) > 0;
|
|
2610
|
+
}
|
|
2603
2611
|
function mapInboxItem(row) {
|
|
2604
2612
|
return {
|
|
2605
2613
|
id: asString(row.id),
|
|
@@ -36540,6 +36548,21 @@ var init_inbox2 = __esm({
|
|
|
36540
36548
|
});
|
|
36541
36549
|
}
|
|
36542
36550
|
});
|
|
36551
|
+
router3.delete("/api/inbox/:id", async (req, res) => {
|
|
36552
|
+
try {
|
|
36553
|
+
const deleted = await deleteInboxItem(req.params.id);
|
|
36554
|
+
if (!deleted) {
|
|
36555
|
+
res.status(404).json({ error: "Inbox item not found" });
|
|
36556
|
+
return;
|
|
36557
|
+
}
|
|
36558
|
+
res.status(204).end();
|
|
36559
|
+
} catch (error51) {
|
|
36560
|
+
res.status(500).json({
|
|
36561
|
+
error: "Failed to delete inbox item",
|
|
36562
|
+
details: error51 instanceof Error ? error51.message : "Unknown error"
|
|
36563
|
+
});
|
|
36564
|
+
}
|
|
36565
|
+
});
|
|
36543
36566
|
}
|
|
36544
36567
|
});
|
|
36545
36568
|
|
|
@@ -68221,8 +68244,12 @@ var init_types = __esm({
|
|
|
68221
68244
|
});
|
|
68222
68245
|
|
|
68223
68246
|
// packages/daemon/src/models/registry.ts
|
|
68247
|
+
function stripVendorPrefix(id) {
|
|
68248
|
+
const slashIndex = id.indexOf("/");
|
|
68249
|
+
return slashIndex >= 0 ? id.slice(slashIndex + 1) : id;
|
|
68250
|
+
}
|
|
68224
68251
|
function normalizeModelName(name) {
|
|
68225
|
-
return name.toLowerCase().replace(/^openai\s+/i, "").replace(/\s+/g, "-").replace(/[^a-z0-9.\-]/g, "").trim();
|
|
68252
|
+
return stripVendorPrefix(name).toLowerCase().replace(/^openai\s+/i, "").replace(/\s+/g, "-").replace(/[^a-z0-9.\-]/g, "").trim();
|
|
68226
68253
|
}
|
|
68227
68254
|
async function fetchCatalogIntoMap(modelMap, result, logger2) {
|
|
68228
68255
|
try {
|
|
@@ -68230,7 +68257,8 @@ async function fetchCatalogIntoMap(modelMap, result, logger2) {
|
|
|
68230
68257
|
result.catalogFetched = true;
|
|
68231
68258
|
for (const m of catalogModels) {
|
|
68232
68259
|
const key = normalizeModelName(m.id);
|
|
68233
|
-
|
|
68260
|
+
const id = stripVendorPrefix(m.id);
|
|
68261
|
+
modelMap.set(key, { id, displayName: m.displayName, available: true });
|
|
68234
68262
|
}
|
|
68235
68263
|
} catch (error51) {
|
|
68236
68264
|
const msg = error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -69871,7 +69899,7 @@ async function executeAgentTask(member, task, worktreePath, options2) {
|
|
|
69871
69899
|
try {
|
|
69872
69900
|
client2 = new CopilotClient3({ workingDirectory: worktreePath });
|
|
69873
69901
|
await client2.start();
|
|
69874
|
-
const model = member.model
|
|
69902
|
+
const model = member.model ? stripVendorPrefix(member.model) : await selectModelForTask(task.description);
|
|
69875
69903
|
const session = await client2.createSession({
|
|
69876
69904
|
model,
|
|
69877
69905
|
workingDirectory: worktreePath,
|
|
@@ -70288,7 +70316,7 @@ Return strict JSON:
|
|
|
70288
70316
|
try {
|
|
70289
70317
|
client2 = new CopilotClient5({ workingDirectory: worktreePath });
|
|
70290
70318
|
await client2.start();
|
|
70291
|
-
const model = qaMember.model
|
|
70319
|
+
const model = qaMember.model ? stripVendorPrefix(qaMember.model) : await selectModelForTask(`QA review: ${objective.description}`);
|
|
70292
70320
|
const session = await client2.createSession({
|
|
70293
70321
|
model,
|
|
70294
70322
|
workingDirectory: worktreePath,
|
|
@@ -70366,6 +70394,7 @@ var init_qa = __esm({
|
|
|
70366
70394
|
"use strict";
|
|
70367
70395
|
init_dist();
|
|
70368
70396
|
init_event_bus();
|
|
70397
|
+
init_registry();
|
|
70369
70398
|
init_model_selector();
|
|
70370
70399
|
init_roles();
|
|
70371
70400
|
init_store2();
|
|
@@ -70422,7 +70451,7 @@ Return strict JSON:
|
|
|
70422
70451
|
try {
|
|
70423
70452
|
client2 = new CopilotClient6();
|
|
70424
70453
|
await client2.start();
|
|
70425
|
-
const model = teamLead.model
|
|
70454
|
+
const model = teamLead.model ? stripVendorPrefix(teamLead.model) : await selectModelForTask(`Code review: ${objective.description}`);
|
|
70426
70455
|
const session = await client2.createSession({
|
|
70427
70456
|
model,
|
|
70428
70457
|
onPermissionRequest: approveAll6,
|
|
@@ -70459,6 +70488,7 @@ You are conducting a final coordination review before QA.`
|
|
|
70459
70488
|
var init_review = __esm({
|
|
70460
70489
|
"packages/daemon/src/execution/review.ts"() {
|
|
70461
70490
|
"use strict";
|
|
70491
|
+
init_registry();
|
|
70462
70492
|
init_model_selector();
|
|
70463
70493
|
init_roles();
|
|
70464
70494
|
}
|
|
@@ -71060,11 +71090,21 @@ async function handleAddSquadMember(rawArgs) {
|
|
|
71060
71090
|
if (!squad) {
|
|
71061
71091
|
throw new Error(`Squad ${squadId} was not found.`);
|
|
71062
71092
|
}
|
|
71093
|
+
let validatedModel = null;
|
|
71094
|
+
if (model) {
|
|
71095
|
+
validatedModel = stripVendorPrefix(model);
|
|
71096
|
+
const pricing = await getModelPricing(validatedModel);
|
|
71097
|
+
if (!pricing) {
|
|
71098
|
+
throw new Error(
|
|
71099
|
+
`Model "${model}" is not available. Use a model from the pricing database (e.g. gpt-4.1-mini, gpt-4.1, claude-sonnet-4, o4-mini). Omit the model field to use dynamic selection.`
|
|
71100
|
+
);
|
|
71101
|
+
}
|
|
71102
|
+
}
|
|
71063
71103
|
const member = await addMember(squadId, {
|
|
71064
71104
|
role,
|
|
71065
71105
|
name,
|
|
71066
71106
|
systemPrompt,
|
|
71067
|
-
model:
|
|
71107
|
+
model: validatedModel
|
|
71068
71108
|
});
|
|
71069
71109
|
eventBus.emit(EVENT_NAMES.SQUAD_MEMBER_UPDATED, { squadId, member });
|
|
71070
71110
|
return {
|
|
@@ -71182,10 +71222,22 @@ async function handleUpdateSquadMember(rawArgs) {
|
|
|
71182
71222
|
if (!member || member.squadId !== squadId) {
|
|
71183
71223
|
throw new Error(`Member ${memberId} was not found in squad ${squadId}.`);
|
|
71184
71224
|
}
|
|
71225
|
+
let validatedModel = void 0;
|
|
71226
|
+
if (model === "") {
|
|
71227
|
+
validatedModel = null;
|
|
71228
|
+
} else if (model) {
|
|
71229
|
+
validatedModel = stripVendorPrefix(model);
|
|
71230
|
+
const pricing = await getModelPricing(validatedModel);
|
|
71231
|
+
if (!pricing) {
|
|
71232
|
+
throw new Error(
|
|
71233
|
+
`Model "${model}" is not available. Use a model from the pricing database (e.g. gpt-4.1-mini, gpt-4.1, claude-sonnet-4, o4-mini). Set to empty string to clear and use dynamic selection.`
|
|
71234
|
+
);
|
|
71235
|
+
}
|
|
71236
|
+
}
|
|
71185
71237
|
const updated = await updateMember(memberId, {
|
|
71186
71238
|
role,
|
|
71187
71239
|
systemPrompt,
|
|
71188
|
-
model:
|
|
71240
|
+
model: validatedModel
|
|
71189
71241
|
});
|
|
71190
71242
|
if (!updated) {
|
|
71191
71243
|
throw new Error(`Failed to update member ${memberId}.`);
|
|
@@ -71275,6 +71327,7 @@ var init_squad2 = __esm({
|
|
|
71275
71327
|
init_event_bus();
|
|
71276
71328
|
init_instances2();
|
|
71277
71329
|
init_runner();
|
|
71330
|
+
init_models();
|
|
71278
71331
|
init_manager2();
|
|
71279
71332
|
init_store2();
|
|
71280
71333
|
execAsync8 = promisify8(exec8);
|
package/dist/daemon/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var init_constants = __esm({
|
|
|
79
79
|
"packages/shared/dist/constants.js"() {
|
|
80
80
|
"use strict";
|
|
81
81
|
APP_NAME = "io";
|
|
82
|
-
APP_VERSION = "4.3.
|
|
82
|
+
APP_VERSION = "4.3.2";
|
|
83
83
|
API_PORT = 7777;
|
|
84
84
|
API_HOST = "0.0.0.0";
|
|
85
85
|
DEFAULT_MODEL = "gpt-4.1-mini";
|
|
@@ -62783,8 +62783,12 @@ var init_types = __esm({
|
|
|
62783
62783
|
});
|
|
62784
62784
|
|
|
62785
62785
|
// packages/daemon/src/models/registry.ts
|
|
62786
|
+
function stripVendorPrefix(id) {
|
|
62787
|
+
const slashIndex = id.indexOf("/");
|
|
62788
|
+
return slashIndex >= 0 ? id.slice(slashIndex + 1) : id;
|
|
62789
|
+
}
|
|
62786
62790
|
function normalizeModelName(name) {
|
|
62787
|
-
return name.toLowerCase().replace(/^openai\s+/i, "").replace(/\s+/g, "-").replace(/[^a-z0-9.\-]/g, "").trim();
|
|
62791
|
+
return stripVendorPrefix(name).toLowerCase().replace(/^openai\s+/i, "").replace(/\s+/g, "-").replace(/[^a-z0-9.\-]/g, "").trim();
|
|
62788
62792
|
}
|
|
62789
62793
|
async function fetchCatalogIntoMap(modelMap, result, logger2) {
|
|
62790
62794
|
try {
|
|
@@ -62792,7 +62796,8 @@ async function fetchCatalogIntoMap(modelMap, result, logger2) {
|
|
|
62792
62796
|
result.catalogFetched = true;
|
|
62793
62797
|
for (const m of catalogModels) {
|
|
62794
62798
|
const key = normalizeModelName(m.id);
|
|
62795
|
-
|
|
62799
|
+
const id = stripVendorPrefix(m.id);
|
|
62800
|
+
modelMap.set(key, { id, displayName: m.displayName, available: true });
|
|
62796
62801
|
}
|
|
62797
62802
|
} catch (error51) {
|
|
62798
62803
|
const msg = error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -78220,6 +78225,14 @@ async function markRead(id, db) {
|
|
|
78220
78225
|
}
|
|
78221
78226
|
return getInboxItem(id, database);
|
|
78222
78227
|
}
|
|
78228
|
+
async function deleteInboxItem(id, db) {
|
|
78229
|
+
const database = db ?? await getDatabase();
|
|
78230
|
+
const result = await database.execute({
|
|
78231
|
+
sql: "DELETE FROM inbox WHERE id = ?",
|
|
78232
|
+
args: [id]
|
|
78233
|
+
});
|
|
78234
|
+
return (result.rowsAffected ?? 0) > 0;
|
|
78235
|
+
}
|
|
78223
78236
|
function mapInboxItem(row) {
|
|
78224
78237
|
return {
|
|
78225
78238
|
id: asString(row.id),
|
|
@@ -79193,6 +79206,21 @@ router3.put("/api/inbox/:id/read", async (req, res) => {
|
|
|
79193
79206
|
});
|
|
79194
79207
|
}
|
|
79195
79208
|
});
|
|
79209
|
+
router3.delete("/api/inbox/:id", async (req, res) => {
|
|
79210
|
+
try {
|
|
79211
|
+
const deleted = await deleteInboxItem(req.params.id);
|
|
79212
|
+
if (!deleted) {
|
|
79213
|
+
res.status(404).json({ error: "Inbox item not found" });
|
|
79214
|
+
return;
|
|
79215
|
+
}
|
|
79216
|
+
res.status(204).end();
|
|
79217
|
+
} catch (error51) {
|
|
79218
|
+
res.status(500).json({
|
|
79219
|
+
error: "Failed to delete inbox item",
|
|
79220
|
+
details: error51 instanceof Error ? error51.message : "Unknown error"
|
|
79221
|
+
});
|
|
79222
|
+
}
|
|
79223
|
+
});
|
|
79196
79224
|
function parsePositiveInteger3(value, fallback) {
|
|
79197
79225
|
const parsed = Number(value);
|
|
79198
79226
|
return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
|
|
@@ -82668,7 +82696,7 @@ async function executeAgentTask(member, task, worktreePath, options2) {
|
|
|
82668
82696
|
try {
|
|
82669
82697
|
client2 = new CopilotClient3({ workingDirectory: worktreePath });
|
|
82670
82698
|
await client2.start();
|
|
82671
|
-
const model = member.model
|
|
82699
|
+
const model = member.model ? stripVendorPrefix(member.model) : await selectModelForTask(task.description);
|
|
82672
82700
|
const session = await client2.createSession({
|
|
82673
82701
|
model,
|
|
82674
82702
|
workingDirectory: worktreePath,
|
|
@@ -83008,6 +83036,7 @@ init_dist();
|
|
|
83008
83036
|
import { exec as exec6 } from "node:child_process";
|
|
83009
83037
|
import { promisify as promisify6 } from "node:util";
|
|
83010
83038
|
import { CopilotClient as CopilotClient5, approveAll as approveAll5 } from "@github/copilot-sdk";
|
|
83039
|
+
init_registry();
|
|
83011
83040
|
var execAsync6 = promisify6(exec6);
|
|
83012
83041
|
var GIT_DIFF_MAX_BUFFER = 10 * 1024 * 1024;
|
|
83013
83042
|
function extractJsonObject2(content) {
|
|
@@ -83049,7 +83078,7 @@ Return strict JSON:
|
|
|
83049
83078
|
try {
|
|
83050
83079
|
client2 = new CopilotClient5({ workingDirectory: worktreePath });
|
|
83051
83080
|
await client2.start();
|
|
83052
|
-
const model = qaMember.model
|
|
83081
|
+
const model = qaMember.model ? stripVendorPrefix(qaMember.model) : await selectModelForTask(`QA review: ${objective.description}`);
|
|
83053
83082
|
const session = await client2.createSession({
|
|
83054
83083
|
model,
|
|
83055
83084
|
workingDirectory: worktreePath,
|
|
@@ -83123,6 +83152,7 @@ async function handleQARejection(objectiveId, feedback) {
|
|
|
83123
83152
|
}
|
|
83124
83153
|
|
|
83125
83154
|
// packages/daemon/src/execution/review.ts
|
|
83155
|
+
init_registry();
|
|
83126
83156
|
import { CopilotClient as CopilotClient6, approveAll as approveAll6 } from "@github/copilot-sdk";
|
|
83127
83157
|
function extractJsonObject3(content) {
|
|
83128
83158
|
const fenced = content.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
@@ -83170,7 +83200,7 @@ Return strict JSON:
|
|
|
83170
83200
|
try {
|
|
83171
83201
|
client2 = new CopilotClient6();
|
|
83172
83202
|
await client2.start();
|
|
83173
|
-
const model = teamLead.model
|
|
83203
|
+
const model = teamLead.model ? stripVendorPrefix(teamLead.model) : await selectModelForTask(`Code review: ${objective.description}`);
|
|
83174
83204
|
const session = await client2.createSession({
|
|
83175
83205
|
model,
|
|
83176
83206
|
onPermissionRequest: approveAll6,
|
|
@@ -83920,11 +83950,21 @@ async function handleAddSquadMember(rawArgs) {
|
|
|
83920
83950
|
if (!squad) {
|
|
83921
83951
|
throw new Error(`Squad ${squadId} was not found.`);
|
|
83922
83952
|
}
|
|
83953
|
+
let validatedModel = null;
|
|
83954
|
+
if (model) {
|
|
83955
|
+
validatedModel = stripVendorPrefix(model);
|
|
83956
|
+
const pricing = await getModelPricing(validatedModel);
|
|
83957
|
+
if (!pricing) {
|
|
83958
|
+
throw new Error(
|
|
83959
|
+
`Model "${model}" is not available. Use a model from the pricing database (e.g. gpt-4.1-mini, gpt-4.1, claude-sonnet-4, o4-mini). Omit the model field to use dynamic selection.`
|
|
83960
|
+
);
|
|
83961
|
+
}
|
|
83962
|
+
}
|
|
83923
83963
|
const member = await addMember(squadId, {
|
|
83924
83964
|
role,
|
|
83925
83965
|
name,
|
|
83926
83966
|
systemPrompt,
|
|
83927
|
-
model:
|
|
83967
|
+
model: validatedModel
|
|
83928
83968
|
});
|
|
83929
83969
|
eventBus.emit(EVENT_NAMES.SQUAD_MEMBER_UPDATED, { squadId, member });
|
|
83930
83970
|
return {
|
|
@@ -84042,10 +84082,22 @@ async function handleUpdateSquadMember(rawArgs) {
|
|
|
84042
84082
|
if (!member || member.squadId !== squadId) {
|
|
84043
84083
|
throw new Error(`Member ${memberId} was not found in squad ${squadId}.`);
|
|
84044
84084
|
}
|
|
84085
|
+
let validatedModel = void 0;
|
|
84086
|
+
if (model === "") {
|
|
84087
|
+
validatedModel = null;
|
|
84088
|
+
} else if (model) {
|
|
84089
|
+
validatedModel = stripVendorPrefix(model);
|
|
84090
|
+
const pricing = await getModelPricing(validatedModel);
|
|
84091
|
+
if (!pricing) {
|
|
84092
|
+
throw new Error(
|
|
84093
|
+
`Model "${model}" is not available. Use a model from the pricing database (e.g. gpt-4.1-mini, gpt-4.1, claude-sonnet-4, o4-mini). Set to empty string to clear and use dynamic selection.`
|
|
84094
|
+
);
|
|
84095
|
+
}
|
|
84096
|
+
}
|
|
84045
84097
|
const updated = await updateMember(memberId, {
|
|
84046
84098
|
role,
|
|
84047
84099
|
systemPrompt,
|
|
84048
|
-
model:
|
|
84100
|
+
model: validatedModel
|
|
84049
84101
|
});
|
|
84050
84102
|
if (!updated) {
|
|
84051
84103
|
throw new Error(`Failed to update member ${memberId}.`);
|
|
@@ -113,7 +113,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
113
113
|
${e}</tr>
|
|
114
114
|
`}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
|
|
115
115
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${yi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:r,tokens:n}){let i=this.parser.parseInline(n),a=tE(e);if(a===null)return i;e=a;let o='<a href="'+e+'"';return r&&(o+=' title="'+yi(r)+'"'),o+=">"+i+"</a>",o}image({href:e,title:r,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let a=tE(e);if(a===null)return yi(n);e=a;let o=`<img src="${e}" alt="${yi(n)}"`;return r&&(o+=` title="${yi(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:yi(e.text)}},Qw=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Gn=class Qb{constructor(e){bt(this,"options");bt(this,"renderer");bt(this,"textRenderer");this.options=e||Lo,this.options.renderer=this.options.renderer||new qf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qw}static parse(e,r){return new Qb(r).parse(e)}static parseInline(e,r){return new Qb(r).parseInline(e)}parse(e){var n,i;this.renderer.parser=this;let r="";for(let a=0;a<e.length;a++){let o=e[a];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[o.type]){let u=o,d=this.options.extensions.renderers[u.type].call({parser:this},u);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(u.type)){r+=d||"";continue}}let c=o;switch(c.type){case"space":{r+=this.renderer.space(c);break}case"hr":{r+=this.renderer.hr(c);break}case"heading":{r+=this.renderer.heading(c);break}case"code":{r+=this.renderer.code(c);break}case"table":{r+=this.renderer.table(c);break}case"blockquote":{r+=this.renderer.blockquote(c);break}case"list":{r+=this.renderer.list(c);break}case"checkbox":{r+=this.renderer.checkbox(c);break}case"html":{r+=this.renderer.html(c);break}case"def":{r+=this.renderer.def(c);break}case"paragraph":{r+=this.renderer.paragraph(c);break}case"text":{r+=this.renderer.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}parseInline(e,r=this.renderer){var i,a;this.renderer.parser=this;let n="";for(let o=0;o<e.length;o++){let c=e[o];if((a=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&a[c.type]){let d=this.options.extensions.renderers[c.type].call({parser:this},c);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){n+=d||"";continue}}let u=c;switch(u.type){case"escape":{n+=r.text(u);break}case"html":{n+=r.html(u);break}case"link":{n+=r.link(u);break}case"image":{n+=r.image(u);break}case"checkbox":{n+=r.checkbox(u);break}case"strong":{n+=r.strong(u);break}case"em":{n+=r.em(u);break}case"codespan":{n+=r.codespan(u);break}case"br":{n+=r.br(u);break}case"del":{n+=r.del(u);break}case"text":{n+=r.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}},Nf,Ec=(Nf=class{constructor(e){bt(this,"options");bt(this,"block");this.options=e||Lo}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Kn.lex:Kn.lexInline}provideParser(e=this.block){return e?Gn.parse:Gn.parseInline}},bt(Nf,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),bt(Nf,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Nf),H4=class{constructor(...t){bt(this,"defaults",Ww());bt(this,"options",this.setOptions);bt(this,"parse",this.parseMarkdown(!0));bt(this,"parseInline",this.parseMarkdown(!1));bt(this,"Parser",Gn);bt(this,"Renderer",qf);bt(this,"TextRenderer",Qw);bt(this,"Lexer",Kn);bt(this,"Tokenizer",Uf);bt(this,"Hooks",Ec);this.use(...t)}walkTokens(t,e){var n,i;let r=[];for(let a of t)switch(r=r.concat(e.call(this,a)),a.type){case"table":{let o=a;for(let c of o.header)r=r.concat(this.walkTokens(c.tokens,e));for(let c of o.rows)for(let u of c)r=r.concat(this.walkTokens(u.tokens,e));break}case"list":{let o=a;r=r.concat(this.walkTokens(o.items,e));break}default:{let o=a;(i=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(c=>{let u=o[c].flat(1/0);r=r.concat(this.walkTokens(u,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=e.renderers[i.name];a?e.renderers[i.name]=function(...o){let c=i.renderer.apply(this,o);return c===!1&&(c=a.apply(this,o)),c}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[i.level];a?a.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),r.renderer){let i=this.defaults.renderer||new qf(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,c=r.renderer[o],u=i[o];i[o]=(...d)=>{let p=c.apply(i,d);return p===!1&&(p=u.apply(i,d)),p||""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Uf(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,c=r.tokenizer[o],u=i[o];i[o]=(...d)=>{let p=c.apply(i,d);return p===!1&&(p=u.apply(i,d)),p}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Ec;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,c=r.hooks[o],u=i[o];Ec.passThroughHooks.has(a)?i[o]=d=>{if(this.defaults.async&&Ec.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await c.call(i,d);return u.call(i,f)})();let p=c.call(i,d);return u.call(i,p)}:i[o]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(i,d);return f===!1&&(f=await u.apply(i,d)),f})();let p=c.apply(i,d);return p===!1&&(p=u.apply(i,d)),p}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;n.walkTokens=function(o){let c=[];return c.push(a.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Kn.lex(t,e??this.defaults)}parser(t,e){return Gn.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},i={...this.defaults,...n},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,c=await(i.hooks?await i.hooks.provideLexer(t):t?Kn.lex:Kn.lexInline)(o,i),u=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let d=await(i.hooks?await i.hooks.provideParser(t):t?Gn.parse:Gn.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(d):d})().catch(a);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(t):t?Kn.lex:Kn.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let c=(i.hooks?i.hooks.provideParser(t):t?Gn.parse:Gn.parseInline)(o,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(t,e){return r=>{if(r.message+=`
|
|
116
|
-
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+yi(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Po=new H4;function it(t,e){return Po.parse(t,e)}it.options=it.setOptions=function(t){return Po.setOptions(t),it.defaults=Po.defaults,bP(it.defaults),it};it.getDefaults=Ww;it.defaults=Lo;it.use=function(...t){return Po.use(...t),it.defaults=Po.defaults,bP(it.defaults),it};it.walkTokens=function(t,e){return Po.walkTokens(t,e)};it.parseInline=Po.parseInline;it.Parser=Gn;it.parser=Gn.parse;it.Renderer=qf;it.TextRenderer=Qw;it.Lexer=Kn;it.lexer=Kn.lex;it.Tokenizer=Uf;it.Hooks=Ec;it.parse=it;it.options;it.setOptions;it.use;it.walkTokens;it.parseInline;Gn.parse;Kn.lex;Qt.registerLanguage("javascript",sP);Qt.registerLanguage("js",sP);Qt.registerLanguage("typescript",gP);Qt.registerLanguage("ts",gP);Qt.registerLanguage("python",lP);Qt.registerLanguage("py",lP);Qt.registerLanguage("rust",r4);Qt.registerLanguage("go",Y5);Qt.registerLanguage("json",t4);Qt.registerLanguage("yaml",vP);Qt.registerLanguage("yml",vP);Qt.registerLanguage("shell",Hw);Qt.registerLanguage("bash",Hw);Qt.registerLanguage("sh",Hw);Qt.registerLanguage("html",yP);Qt.registerLanguage("xml",yP);Qt.registerLanguage("css",X5);it.use({renderer:{heading({tokens:t,depth:e}){const r=t.map(a=>a.raw).join(""),n=`h${e}`;return`<${n} style="color:#D83333;font-size:${{1:"2em",2:"1.65em",3:"1.35em",4:"1.15em"}[e]??"1em"};font-weight:600;margin:1.1em 0 0.4em;line-height:1.4;text-transform:none;">${r}</${n}>`},code({text:t,lang:e}){let r;return e&&Qt.getLanguage(e)?r=Qt.highlight(t,{language:e}).value:r=Qt.highlightAuto(t).value,`<pre style="background:#161616;border:1px solid rgba(255,255,255,0.07);border-radius:10px;padding:0.9em 1.1em;overflow-x:auto;margin:0.8em 0;"><code class="hljs" style="background:none;border:none;padding:0;color:#d4d4d8;font-size:0.85em;">${r}</code></pre>`}}});function Mu({content:t,className:e=""}){const r=j.useMemo(()=>it.parse(t),[t]);return y.jsx("div",{className:`prose-io ${e}`,style:{color:"#d4d4d8",fontSize:"0.875rem",lineHeight:"1.7"},dangerouslySetInnerHTML:{__html:r}})}const aE="/api";let Co=null,ex=null;function W4(t){Co=t}function K4(t){ex=t}function CP(){return(Co==null?void 0:Co())??null}function jP(t){const[e="",r=""]=t.split("?");return{pathname:e,query:r?`?${r}`:""}}function G4(t){const e=Number(t.telegramUserId);return{apiPort:t.port,logLevel:t.logLevel,defaultModel:t.defaultModel,maxInstancesPerSquad:3,dataDir:"~/.io",timezone:"UTC",pricing:{refreshIntervalHours:t.pricingRefreshHours??24},telegram:{botToken:t.telegramToken,allowedChatIds:Number.isFinite(e)?[e]:[]},supabase:{projectUrl:t.supabaseUrl,anonKey:t.supabaseAnonKey},sessionResetThreshold:t.sessionResetThreshold}}function V4(t){return{...t,cron:t.cronExpression,lastRun:t.lastRunAt,nextRun:t.nextRunAt,targetType:t.targetType??"orchestrator",targetId:t.targetId??null}}function X4(t){var a;if(!t||typeof t!="object"||Array.isArray(t))return t;const e=t,r=e.telegram??{},n=e.supabase??{},i=Array.isArray(r.allowedChatIds)?r.allowedChatIds.filter(o=>typeof o=="number"):[];return{port:e.apiPort??e.port,logLevel:e.logLevel,defaultModel:e.defaultModel,telegramToken:r.botToken??e.telegramToken??null,telegramUserId:i.length>0?String(i[0]):e.telegramUserId??null,supabaseUrl:n.projectUrl??e.supabaseUrl??null,supabaseAnonKey:n.anonKey??e.supabaseAnonKey??null,sessionResetThreshold:e.sessionResetThreshold,pricingRefreshHours:((a=e.pricing)==null?void 0:a.refreshIntervalHours)??e.pricingRefreshHours}}function oE(t){if(!t||typeof t!="object"||Array.isArray(t))return t;const e=t;return{name:e.name,cronExpression:e.cronExpression??e.cron,prompt:e.prompt,enabled:e.enabled}}function Y4(t,e,r){const{pathname:n,query:i}=jP(t);let a=n,o=e,c=r;return n==="/config"&&(a="/settings",c=X4(r)),n==="/skills/discover"&&o==="GET"?{path:`${a}${i}`,method:o,body:c}:(/^\/inbox\/[^/]+\/read$/.test(n)&&(o="PUT",c={}),o==="PATCH"&&n.startsWith("/schedules/")&&(o="PUT",c=oE(r)),o==="POST"&&n==="/schedules"&&(c=oE(r)),{path:`${a}${i}`,method:o,body:c})}function J4(t,e){const{pathname:r}=jP(t);if(r==="/config"&&e&&typeof e=="object"&&"port"in e)return{config:G4(e)};if(r==="/squads"&&Array.isArray(e))return{squads:e};if(r==="/schedules"&&Array.isArray(e))return{schedules:e.map(n=>V4(n))};if(r==="/skills"&&Array.isArray(e))return{skills:e};if(r==="/skills/discover"&&Array.isArray(e))return{skills:e};if(r==="/inbox"&&e&&typeof e=="object"&&"data"in e){const n=e;return{entries:Array.isArray(n.data)?n.data:[]}}return e}async function fc(t,e){const{path:r,method:n,body:i}=Y4(t,(e==null?void 0:e.method)??"GET",e!=null&&e.body?JSON.parse(e.body):void 0),a=Co==null?void 0:Co(),o={"Content-Type":"application/json",...e==null?void 0:e.headers};a&&(o.Authorization=`Bearer ${a}`);const c={...e,method:n,headers:o,body:i==null?void 0:JSON.stringify(i)};let u=await fetch(`${aE}${r}`,c);if(u.status===401&&ex){const p=await ex();p&&(o.Authorization=`Bearer ${p}`,u=await fetch(`${aE}${r}`,{...c,headers:o}))}if(!u.ok){const p=await u.json().catch(()=>({error:u.statusText}));throw new Error(p.error??`Request failed: ${u.status}`)}const d=await u.json().catch(()=>null);return J4(t,d)}const Ge={get:t=>fc(t),post:(t,e)=>fc(t,{method:"POST",body:e==null?void 0:JSON.stringify(e)}),patch:(t,e)=>fc(t,{method:"PATCH",body:JSON.stringify(e)}),put:(t,e)=>fc(t,{method:"PUT",body:JSON.stringify(e)}),delete:t=>fc(t,{method:"DELETE"})},NP=j.createContext({timezone:"UTC"});function Z4({children:t}){const[e,r]=j.useState("UTC");return j.useEffect(()=>{Ge.get("/config").then(n=>{n.config.timezone&&r(n.config.timezone)}).catch(()=>{})},[]),y.jsx(NP.Provider,{value:{timezone:e},children:t})}function Fa(){return j.useContext(NP).timezone}const Q4=[{label:"UTC",value:"UTC"},{label:"Eastern Time (US)",value:"America/New_York"},{label:"Central Time (US)",value:"America/Chicago"},{label:"Mountain Time (US)",value:"America/Denver"},{label:"Pacific Time (US)",value:"America/Los_Angeles"},{label:"Alaska Time",value:"America/Anchorage"},{label:"Hawaii Time",value:"Pacific/Honolulu"},{label:"London (GMT/BST)",value:"Europe/London"},{label:"Central European",value:"Europe/Berlin"},{label:"Eastern European",value:"Europe/Bucharest"},{label:"India (IST)",value:"Asia/Kolkata"},{label:"China (CST)",value:"Asia/Shanghai"},{label:"Japan (JST)",value:"Asia/Tokyo"},{label:"Australia Eastern",value:"Australia/Sydney"},{label:"New Zealand",value:"Pacific/Auckland"},{label:"São Paulo",value:"America/Sao_Paulo"}];function Fs(t,e,r){if(!t)return"";try{return new Date(t).toLocaleString("en-US",{timeZone:e,month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...r})}catch{return new Date(t).toLocaleString()}}function cp(t,e,r){if(!t)return"";try{return new Date(t).toLocaleTimeString("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",...r})}catch{return new Date(t).toLocaleTimeString()}}function ez(t,e,r){if(!t)return"";try{return new Date(t).toLocaleDateString("en-US",{timeZone:e,month:"short",day:"numeric",...r})}catch{return new Date(t).toLocaleDateString()}}/**
|
|
116
|
+
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+yi(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Po=new H4;function it(t,e){return Po.parse(t,e)}it.options=it.setOptions=function(t){return Po.setOptions(t),it.defaults=Po.defaults,bP(it.defaults),it};it.getDefaults=Ww;it.defaults=Lo;it.use=function(...t){return Po.use(...t),it.defaults=Po.defaults,bP(it.defaults),it};it.walkTokens=function(t,e){return Po.walkTokens(t,e)};it.parseInline=Po.parseInline;it.Parser=Gn;it.parser=Gn.parse;it.Renderer=qf;it.TextRenderer=Qw;it.Lexer=Kn;it.lexer=Kn.lex;it.Tokenizer=Uf;it.Hooks=Ec;it.parse=it;it.options;it.setOptions;it.use;it.walkTokens;it.parseInline;Gn.parse;Kn.lex;Qt.registerLanguage("javascript",sP);Qt.registerLanguage("js",sP);Qt.registerLanguage("typescript",gP);Qt.registerLanguage("ts",gP);Qt.registerLanguage("python",lP);Qt.registerLanguage("py",lP);Qt.registerLanguage("rust",r4);Qt.registerLanguage("go",Y5);Qt.registerLanguage("json",t4);Qt.registerLanguage("yaml",vP);Qt.registerLanguage("yml",vP);Qt.registerLanguage("shell",Hw);Qt.registerLanguage("bash",Hw);Qt.registerLanguage("sh",Hw);Qt.registerLanguage("html",yP);Qt.registerLanguage("xml",yP);Qt.registerLanguage("css",X5);it.use({renderer:{heading({tokens:t,depth:e}){const r=t.map(a=>a.raw).join(""),n=`h${e}`;return`<${n} style="color:#D83333;font-size:${{1:"2em",2:"1.65em",3:"1.35em",4:"1.15em"}[e]??"1em"};font-weight:600;margin:1.1em 0 0.4em;line-height:1.4;text-transform:none;">${r}</${n}>`},code({text:t,lang:e}){let r;return e&&Qt.getLanguage(e)?r=Qt.highlight(t,{language:e}).value:r=Qt.highlightAuto(t).value,`<pre style="background:#161616;border:1px solid rgba(255,255,255,0.07);border-radius:10px;padding:0.9em 1.1em;overflow-x:auto;margin:0.8em 0;"><code class="hljs" style="background:none;border:none;padding:0;color:#d4d4d8;font-size:0.85em;">${r}</code></pre>`}}});function Mu({content:t,className:e=""}){const r=j.useMemo(()=>it.parse(t),[t]);return y.jsx("div",{className:`prose-io ${e}`,style:{color:"#d4d4d8",fontSize:"0.875rem",lineHeight:"1.7"},dangerouslySetInnerHTML:{__html:r}})}const aE="/api";let Co=null,ex=null;function W4(t){Co=t}function K4(t){ex=t}function CP(){return(Co==null?void 0:Co())??null}function jP(t){const[e="",r=""]=t.split("?");return{pathname:e,query:r?`?${r}`:""}}function G4(t){const e=Number(t.telegramUserId);return{apiPort:t.port,logLevel:t.logLevel,defaultModel:t.defaultModel,maxInstancesPerSquad:3,dataDir:"~/.io",timezone:"UTC",pricing:{refreshIntervalHours:t.pricingRefreshHours??24},telegram:{botToken:t.telegramToken,allowedChatIds:Number.isFinite(e)?[e]:[]},supabase:{projectUrl:t.supabaseUrl,anonKey:t.supabaseAnonKey},sessionResetThreshold:t.sessionResetThreshold}}function V4(t){return{...t,cron:t.cronExpression,lastRun:t.lastRunAt,nextRun:t.nextRunAt,targetType:t.targetType??"orchestrator",targetId:t.targetId??null}}function X4(t){var a;if(!t||typeof t!="object"||Array.isArray(t))return t;const e=t,r=e.telegram??{},n=e.supabase??{},i=Array.isArray(r.allowedChatIds)?r.allowedChatIds.filter(o=>typeof o=="number"):[];return{port:e.apiPort??e.port,logLevel:e.logLevel,defaultModel:e.defaultModel,telegramToken:r.botToken??e.telegramToken??null,telegramUserId:i.length>0?String(i[0]):e.telegramUserId??null,supabaseUrl:n.projectUrl??e.supabaseUrl??null,supabaseAnonKey:n.anonKey??e.supabaseAnonKey??null,sessionResetThreshold:e.sessionResetThreshold,pricingRefreshHours:((a=e.pricing)==null?void 0:a.refreshIntervalHours)??e.pricingRefreshHours}}function oE(t){if(!t||typeof t!="object"||Array.isArray(t))return t;const e=t;return{name:e.name,cronExpression:e.cronExpression??e.cron,prompt:e.prompt,enabled:e.enabled}}function Y4(t,e,r){const{pathname:n,query:i}=jP(t);let a=n,o=e,c=r;return n==="/config"&&(a="/settings",(o==="PATCH"||o==="PUT")&&(o="PUT",c=X4(r))),n==="/skills/discover"&&o==="GET"?{path:`${a}${i}`,method:o,body:c}:(/^\/inbox\/[^/]+\/read$/.test(n)&&(o="PUT",c={}),o==="PATCH"&&n.startsWith("/schedules/")&&(o="PUT",c=oE(r)),o==="POST"&&n==="/schedules"&&(c=oE(r)),{path:`${a}${i}`,method:o,body:c})}function J4(t,e){const{pathname:r}=jP(t);if(r==="/config"&&e&&typeof e=="object"&&"port"in e)return{config:G4(e)};if(r==="/squads"&&Array.isArray(e))return{squads:e};if(r==="/schedules"&&Array.isArray(e))return{schedules:e.map(n=>V4(n))};if(r==="/skills"&&Array.isArray(e))return{skills:e};if(r==="/skills/discover"&&Array.isArray(e))return{skills:e};if(r==="/inbox"&&e&&typeof e=="object"&&"data"in e){const n=e;return{entries:Array.isArray(n.data)?n.data:[]}}return e}async function fc(t,e){const{path:r,method:n,body:i}=Y4(t,(e==null?void 0:e.method)??"GET",e!=null&&e.body?JSON.parse(e.body):void 0),a=Co==null?void 0:Co(),o={"Content-Type":"application/json",...e==null?void 0:e.headers};a&&(o.Authorization=`Bearer ${a}`);const c={...e,method:n,headers:o,body:i==null?void 0:JSON.stringify(i)};let u=await fetch(`${aE}${r}`,c);if(u.status===401&&ex){const p=await ex();p&&(o.Authorization=`Bearer ${p}`,u=await fetch(`${aE}${r}`,{...c,headers:o}))}if(!u.ok){const p=await u.json().catch(()=>({error:u.statusText}));throw new Error(p.error??`Request failed: ${u.status}`)}const d=await u.json().catch(()=>null);return J4(t,d)}const Ge={get:t=>fc(t),post:(t,e)=>fc(t,{method:"POST",body:e==null?void 0:JSON.stringify(e)}),patch:(t,e)=>fc(t,{method:"PATCH",body:JSON.stringify(e)}),put:(t,e)=>fc(t,{method:"PUT",body:JSON.stringify(e)}),delete:t=>fc(t,{method:"DELETE"})},NP=j.createContext({timezone:"UTC"});function Z4({children:t}){const[e,r]=j.useState("UTC");return j.useEffect(()=>{Ge.get("/config").then(n=>{n.config.timezone&&r(n.config.timezone)}).catch(()=>{})},[]),y.jsx(NP.Provider,{value:{timezone:e},children:t})}function Fa(){return j.useContext(NP).timezone}const Q4=[{label:"UTC",value:"UTC"},{label:"Eastern Time (US)",value:"America/New_York"},{label:"Central Time (US)",value:"America/Chicago"},{label:"Mountain Time (US)",value:"America/Denver"},{label:"Pacific Time (US)",value:"America/Los_Angeles"},{label:"Alaska Time",value:"America/Anchorage"},{label:"Hawaii Time",value:"Pacific/Honolulu"},{label:"London (GMT/BST)",value:"Europe/London"},{label:"Central European",value:"Europe/Berlin"},{label:"Eastern European",value:"Europe/Bucharest"},{label:"India (IST)",value:"Asia/Kolkata"},{label:"China (CST)",value:"Asia/Shanghai"},{label:"Japan (JST)",value:"Asia/Tokyo"},{label:"Australia Eastern",value:"Australia/Sydney"},{label:"New Zealand",value:"Pacific/Auckland"},{label:"São Paulo",value:"America/Sao_Paulo"}];function Fs(t,e,r){if(!t)return"";try{return new Date(t).toLocaleString("en-US",{timeZone:e,month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...r})}catch{return new Date(t).toLocaleString()}}function cp(t,e,r){if(!t)return"";try{return new Date(t).toLocaleTimeString("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",...r})}catch{return new Date(t).toLocaleTimeString()}}function ez(t,e,r){if(!t)return"";try{return new Date(t).toLocaleDateString("en-US",{timeZone:e,month:"short",day:"numeric",...r})}catch{return new Date(t).toLocaleDateString()}}/**
|
|
117
117
|
* @license lucide-react v1.17.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
@@ -517,4 +517,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
517
517
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RM(t,e){if(t){if(typeof t=="string")return Nw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nw(t,e)}}function Gne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Vne(t){if(Array.isArray(t))return Nw(t)}function Nw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function RN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?RN(Object(r),!0).forEach(function(n){ze(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):RN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ze(t,e,r){return e=IM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function IM(t){var e=Xne(t,"string");return dl(e)=="symbol"?e:e+""}function Xne(t,e){if(dl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(dl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yne={xAxis:["bottom","top"],yAxis:["left","right"]},Jne={width:"100%",height:"100%"},$M={x:0,y:0};function jf(t){return t}var Zne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Qne=function(e,r,n,i){var a=r.find(function(p){return p&&p.index===n});if(a){if(e==="horizontal")return{x:a.coordinate,y:i.y};if(e==="vertical")return{x:i.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,c=i.radius;return ie(ie(ie({},i),wr(i.cx,i.cy,c,o)),{},{angle:o,radius:c})}var u=a.coordinate,d=i.angle;return ie(ie(ie({},i),wr(i.cx,i.cy,u,d)),{},{angle:d,radius:u})}return $M},Vp=function(e,r){var n=r.graphicalItems,i=r.dataStartIndex,a=r.dataEndIndex,o=(n??[]).reduce(function(c,u){var d=u.props.data;return d&&d.length?[].concat(fl(c),fl(d)):c},[]);return o.length>0?o:e&&e.length&&ge(i)&&ge(a)?e.slice(i,a+1):[]};function MM(t){return t==="number"?[0,"auto"]:void 0}var Pw=function(e,r,n,i){var a=e.graphicalItems,o=e.tooltipAxis,c=Vp(r,e);return n<0||!a||!a.length||n>=c.length?null:a.reduce(function(u,d){var p,f=(p=d.props.data)!==null&&p!==void 0?p:r;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var v=f===void 0?c:f;m=ih(v,o.dataKey,i)}else m=f&&f[n]||c[n];return m?[].concat(fl(u),[M$(d,m)]):u},[])},IN=function(e,r,n,i){var a=i||{x:e.chartX,y:e.chartY},o=Zne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=cY(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,m=Pw(e,r,p,f),v=Qne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:m,activeCoordinate:v}}return null},eie=function(e,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=e.stackOffset,v=R$(p,a);return n.reduce(function(b,w){var x,k=w.type.defaultProps!==void 0?ie(ie({},w.type.defaultProps),w.props):w.props,S=k.type,A=k.dataKey,C=k.allowDataOverflow,T=k.allowDuplicatedCategory,O=k.scale,P=k.ticks,R=k.includeHidden,I=k[o];if(b[I])return b;var H=Vp(e.data,{graphicalItems:i.filter(function(W){var re,fe=o in W.props?W.props[o]:(re=W.type.defaultProps)===null||re===void 0?void 0:re[o];return fe===I}),dataStartIndex:u,dataEndIndex:d}),z=H.length,q,G,X;Ane(k.domain,C,S)&&(q=Xx(k.domain,null,C),v&&(S==="number"||O!=="auto")&&(X=Lc(H,A,"category")));var Y=MM(S);if(!q||q.length===0){var K,Q=(K=k.domain)!==null&&K!==void 0?K:Y;if(A){if(q=Lc(H,A,S),S==="category"&&v){var U=eF(q);T&&U?(G=q,q=Fh(0,z)):T||(q=Vj(Q,q,w).reduce(function(W,re){return W.indexOf(re)>=0?W:[].concat(fl(W),[re])},[]))}else if(S==="category")T?q=q.filter(function(W){return W!==""&&!tt(W)}):q=Vj(Q,q,w).reduce(function(W,re){return W.indexOf(re)>=0||re===""||tt(re)?W:[].concat(fl(W),[re])},[]);else if(S==="number"){var J=pY(H,i.filter(function(W){var re,fe,de=o in W.props?W.props[o]:(re=W.type.defaultProps)===null||re===void 0?void 0:re[o],ve="hide"in W.props?W.props.hide:(fe=W.type.defaultProps)===null||fe===void 0?void 0:fe.hide;return de===I&&(R||!ve)}),A,a,p);J&&(q=J)}v&&(S==="number"||O!=="auto")&&(X=Lc(H,A,"category"))}else v?q=Fh(0,z):c&&c[I]&&c[I].hasStack&&S==="number"?q=m==="expand"?[0,1]:$$(c[I].stackGroups,u,d):q=P$(H,i.filter(function(W){var re=o in W.props?W.props[o]:W.type.defaultProps[o],fe="hide"in W.props?W.props.hide:W.type.defaultProps.hide;return re===I&&(R||!fe)}),S,p,!0);if(S==="number")q=Cw(f,q,I,a,P),Q&&(q=Xx(Q,q,C));else if(S==="category"&&Q){var M=Q,$=q.every(function(W){return M.indexOf(W)>=0});$&&(q=M)}}return ie(ie({},b),{},ze({},I,ie(ie({},k),{},{axisType:a,domain:q,categoricalDomain:X,duplicateDomain:G,originalDomain:(x=k.domain)!==null&&x!==void 0?x:Y,isCategorical:v,layout:p})))},{})},tie=function(e,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.layout,f=e.children,m=Vp(e.data,{graphicalItems:n,dataStartIndex:u,dataEndIndex:d}),v=m.length,b=R$(p,a),w=-1;return n.reduce(function(x,k){var S=k.type.defaultProps!==void 0?ie(ie({},k.type.defaultProps),k.props):k.props,A=S[o],C=MM("number");if(!x[A]){w++;var T;return b?T=Fh(0,v):c&&c[A]&&c[A].hasStack?(T=$$(c[A].stackGroups,u,d),T=Cw(f,T,A,a)):(T=Xx(C,P$(m,n.filter(function(O){var P,R,I=o in O.props?O.props[o]:(P=O.type.defaultProps)===null||P===void 0?void 0:P[o],H="hide"in O.props?O.props.hide:(R=O.type.defaultProps)===null||R===void 0?void 0:R.hide;return I===A&&!H}),"number",p),i.defaultProps.allowDataOverflow),T=Cw(f,T,A,a)),ie(ie({},x),{},ze({},A,ie(ie({axisType:a},i.defaultProps),{},{hide:!0,orientation:On(Yne,"".concat(a,".").concat(w%2),null),domain:T,originalDomain:C,isCategorical:b,layout:p})))}return x},{})},rie=function(e,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,c=r.stackGroups,u=r.dataStartIndex,d=r.dataEndIndex,p=e.children,f="".concat(i,"Id"),m=Tn(p,a),v={};return m&&m.length?v=eie(e,{axes:m,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=tie(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},nie=function(e){var r=Ra(e),n=Ki(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:P1(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Rh(r,n)}},$N=function(e){var r=e.children,n=e.defaultShowTooltip,i=sn(r,rl),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},iie=function(e){return!e||!e.length?!1:e.some(function(r){var n=Gi(r&&r.type);return n&&n.indexOf("Bar")>=0})},MN=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},aie=function(e,r){var n=e.props,i=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,c=e.yAxisMap,u=c===void 0?{}:c,d=n.width,p=n.height,f=n.children,m=n.margin||{},v=sn(f,rl),b=sn(f,Bs),w=Object.keys(u).reduce(function(T,O){var P=u[O],R=P.orientation;return!P.mirror&&!P.hide?ie(ie({},T),{},ze({},R,T[R]+P.width)):T},{left:m.left||0,right:m.right||0}),x=Object.keys(o).reduce(function(T,O){var P=o[O],R=P.orientation;return!P.mirror&&!P.hide?ie(ie({},T),{},ze({},R,On(T,"".concat(R))+P.height)):T},{top:m.top||0,bottom:m.bottom||0}),k=ie(ie({},x),w),S=k.bottom;v&&(k.bottom+=v.props.height||rl.defaultProps.height),b&&r&&(k=fY(k,i,n,r));var A=d-k.left-k.right,C=p-k.top-k.bottom;return ie(ie({brushBottom:S},k),{},{width:Math.max(A,0),height:Math.max(C,0)})},oie=function(e,r){if(r==="xAxis")return e[r].width;if(r==="yAxis")return e[r].height},DM=function(e){var r=e.chartName,n=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,u=e.axisComponents,d=e.legendContent,p=e.formatAxisMap,f=e.defaultProps,m=function(k,S){var A=S.graphicalItems,C=S.stackGroups,T=S.offset,O=S.updateId,P=S.dataStartIndex,R=S.dataEndIndex,I=k.barSize,H=k.layout,z=k.barGap,q=k.barCategoryGap,G=k.maxBarSize,X=MN(H),Y=X.numericAxisName,K=X.cateAxisName,Q=iie(A),U=[];return A.forEach(function(J,M){var $=Vp(k.data,{graphicalItems:[J],dataStartIndex:P,dataEndIndex:R}),W=J.type.defaultProps!==void 0?ie(ie({},J.type.defaultProps),J.props):J.props,re=W.dataKey,fe=W.maxBarSize,de=W["".concat(Y,"Id")],ve=W["".concat(K,"Id")],qe={},xe=u.reduce(function(cr,_t){var Sr=S["".concat(_t.axisType,"Map")],Ir=W["".concat(_t.axisType,"Id")];Sr&&Sr[Ir]||_t.axisType==="zAxis"||Mo();var ni=Sr[Ir];return ie(ie({},cr),{},ze(ze({},_t.axisType,ni),"".concat(_t.axisType,"Ticks"),Ki(ni)))},qe),ae=xe[K],Se=xe["".concat(K,"Ticks")],Me=C&&C[de]&&C[de].hasStack&&AY(J,C[de].stackGroups),oe=Gi(J.type).indexOf("Bar")>=0,rt=Rh(ae,Se),Fe=[],kt=Q&&uY({barSize:I,stackGroups:C,totalSize:oie(xe,K)});if(oe){var wt,Et,_r=tt(fe)?G:fe,Ut=(wt=(Et=Rh(ae,Se,!0))!==null&&Et!==void 0?Et:_r)!==null&&wt!==void 0?wt:0;Fe=dY({barGap:z,barCategoryGap:q,bandSize:Ut!==rt?Ut:rt,sizeList:kt[ve],maxBarSize:_r}),Ut!==rt&&(Fe=Fe.map(function(cr){return ie(ie({},cr),{},{position:ie(ie({},cr.position),{},{offset:cr.position.offset-Ut/2})})}))}var Rr=J&&J.type&&J.type.getComposedData;Rr&&U.push({props:ie(ie({},Rr(ie(ie({},xe),{},{displayedData:$,props:k,dataKey:re,item:J,bandSize:rt,barPosition:Fe,offset:T,stackedData:Me,layout:H,dataStartIndex:P,dataEndIndex:R}))),{},ze(ze(ze({key:J.key||"item-".concat(M)},Y,xe[Y]),K,xe[K]),"animationId",O)),childIndex:hF(J,k.children),item:J})}),U},v=function(k,S){var A=k.props,C=k.dataStartIndex,T=k.dataEndIndex,O=k.updateId;if(!lO({props:A}))return null;var P=A.children,R=A.layout,I=A.stackOffset,H=A.data,z=A.reverseStackOrder,q=MN(R),G=q.numericAxisName,X=q.cateAxisName,Y=Tn(P,n),K=SY(H,Y,"".concat(G,"Id"),"".concat(X,"Id"),I,z),Q=u.reduce(function(W,re){var fe="".concat(re.axisType,"Map");return ie(ie({},W),{},ze({},fe,rie(A,ie(ie({},re),{},{graphicalItems:Y,stackGroups:re.axisType===G&&K,dataStartIndex:C,dataEndIndex:T}))))},{}),U=aie(ie(ie({},Q),{},{props:A,graphicalItems:Y}),S==null?void 0:S.legendBBox);Object.keys(Q).forEach(function(W){Q[W]=p(A,Q[W],U,W.replace("Map",""),r)});var J=Q["".concat(X,"Map")],M=nie(J),$=m(A,ie(ie({},Q),{},{dataStartIndex:C,dataEndIndex:T,updateId:O,graphicalItems:Y,stackGroups:K,offset:U}));return ie(ie({formattedGraphicalItems:$,graphicalItems:Y,offset:U,stackGroups:K},M),Q)},b=(function(x){function k(S){var A,C,T;return zne(this,k),T=qne(this,k,[S]),ze(T,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(T,"accessibilityManager",new Ene),ze(T,"handleLegendBBoxUpdate",function(O){if(O){var P=T.state,R=P.dataStartIndex,I=P.dataEndIndex,H=P.updateId;T.setState(ie({legendBBox:O},v({props:T.props,dataStartIndex:R,dataEndIndex:I,updateId:H},ie(ie({},T.state),{},{legendBBox:O}))))}}),ze(T,"handleReceiveSyncEvent",function(O,P,R){if(T.props.syncId===O){if(R===T.eventEmitterSymbol&&typeof T.props.syncMethod!="function")return;T.applySyncEvent(P)}}),ze(T,"handleBrushChange",function(O){var P=O.startIndex,R=O.endIndex;if(P!==T.state.dataStartIndex||R!==T.state.dataEndIndex){var I=T.state.updateId;T.setState(function(){return ie({dataStartIndex:P,dataEndIndex:R},v({props:T.props,dataStartIndex:P,dataEndIndex:R,updateId:I},T.state))}),T.triggerSyncEvent({dataStartIndex:P,dataEndIndex:R})}}),ze(T,"handleMouseEnter",function(O){var P=T.getMouseInfo(O);if(P){var R=ie(ie({},P),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var I=T.props.onMouseEnter;Je(I)&&I(R,O)}}),ze(T,"triggeredAfterMouseMove",function(O){var P=T.getMouseInfo(O),R=P?ie(ie({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};T.setState(R),T.triggerSyncEvent(R);var I=T.props.onMouseMove;Je(I)&&I(R,O)}),ze(T,"handleItemMouseEnter",function(O){T.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),ze(T,"handleItemMouseLeave",function(){T.setState(function(){return{isTooltipActive:!1}})}),ze(T,"handleMouseMove",function(O){O.persist(),T.throttleTriggeredAfterMouseMove(O)}),ze(T,"handleMouseLeave",function(O){T.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};T.setState(P),T.triggerSyncEvent(P);var R=T.props.onMouseLeave;Je(R)&&R(P,O)}),ze(T,"handleOuterEvent",function(O){var P=fF(O),R=On(T.props,"".concat(P));if(P&&Je(R)){var I,H;/.*touch.*/i.test(P)?H=T.getMouseInfo(O.changedTouches[0]):H=T.getMouseInfo(O),R((I=H)!==null&&I!==void 0?I:{},O)}}),ze(T,"handleClick",function(O){var P=T.getMouseInfo(O);if(P){var R=ie(ie({},P),{},{isTooltipActive:!0});T.setState(R),T.triggerSyncEvent(R);var I=T.props.onClick;Je(I)&&I(R,O)}}),ze(T,"handleMouseDown",function(O){var P=T.props.onMouseDown;if(Je(P)){var R=T.getMouseInfo(O);P(R,O)}}),ze(T,"handleMouseUp",function(O){var P=T.props.onMouseUp;if(Je(P)){var R=T.getMouseInfo(O);P(R,O)}}),ze(T,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),ze(T,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseDown(O.changedTouches[0])}),ze(T,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&T.handleMouseUp(O.changedTouches[0])}),ze(T,"handleDoubleClick",function(O){var P=T.props.onDoubleClick;if(Je(P)){var R=T.getMouseInfo(O);P(R,O)}}),ze(T,"handleContextMenu",function(O){var P=T.props.onContextMenu;if(Je(P)){var R=T.getMouseInfo(O);P(R,O)}}),ze(T,"triggerSyncEvent",function(O){T.props.syncId!==void 0&&Wb.emit(Kb,T.props.syncId,O,T.eventEmitterSymbol)}),ze(T,"applySyncEvent",function(O){var P=T.props,R=P.layout,I=P.syncMethod,H=T.state.updateId,z=O.dataStartIndex,q=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)T.setState(ie({dataStartIndex:z,dataEndIndex:q},v({props:T.props,dataStartIndex:z,dataEndIndex:q,updateId:H},T.state)));else if(O.activeTooltipIndex!==void 0){var G=O.chartX,X=O.chartY,Y=O.activeTooltipIndex,K=T.state,Q=K.offset,U=K.tooltipTicks;if(!Q)return;if(typeof I=="function")Y=I(U,O);else if(I==="value"){Y=-1;for(var J=0;J<U.length;J++)if(U[J].value===O.activeLabel){Y=J;break}}var M=ie(ie({},Q),{},{x:Q.left,y:Q.top}),$=Math.min(G,M.x+M.width),W=Math.min(X,M.y+M.height),re=U[Y]&&U[Y].value,fe=Pw(T.state,T.props.data,Y),de=U[Y]?{x:R==="horizontal"?U[Y].coordinate:$,y:R==="horizontal"?W:U[Y].coordinate}:$M;T.setState(ie(ie({},O),{},{activeLabel:re,activeCoordinate:de,activePayload:fe,activeTooltipIndex:Y}))}else T.setState(O)}),ze(T,"renderCursor",function(O){var P,R=T.state,I=R.isTooltipActive,H=R.activeCoordinate,z=R.activePayload,q=R.offset,G=R.activeTooltipIndex,X=R.tooltipAxisBandSize,Y=T.getTooltipEventType(),K=(P=O.props.active)!==null&&P!==void 0?P:I,Q=T.props.layout,U=O.key||"_recharts-cursor";return D.createElement(Pne,{key:U,activeCoordinate:H,activePayload:z,activeTooltipIndex:G,chartName:r,element:O,isActive:K,layout:Q,offset:q,tooltipAxisBandSize:X,tooltipEventType:Y})}),ze(T,"renderPolarAxis",function(O,P,R){var I=On(O,"type.axisType"),H=On(T.state,"".concat(I,"Map")),z=O.type.defaultProps,q=z!==void 0?ie(ie({},z),O.props):O.props,G=H&&H[q["".concat(I,"Id")]];return j.cloneElement(O,ie(ie({},G),{},{className:ot(I,G.className),key:O.key||"".concat(P,"-").concat(R),ticks:Ki(G,!0)}))}),ze(T,"renderPolarGrid",function(O){var P=O.props,R=P.radialLines,I=P.polarAngles,H=P.polarRadius,z=T.state,q=z.radiusAxisMap,G=z.angleAxisMap,X=Ra(q),Y=Ra(G),K=Y.cx,Q=Y.cy,U=Y.innerRadius,J=Y.outerRadius;return j.cloneElement(O,{polarAngles:Array.isArray(I)?I:Ki(Y,!0).map(function(M){return M.coordinate}),polarRadius:Array.isArray(H)?H:Ki(X,!0).map(function(M){return M.coordinate}),cx:K,cy:Q,innerRadius:U,outerRadius:J,key:O.key||"polar-grid",radialLines:R})}),ze(T,"renderLegend",function(){var O=T.state.formattedGraphicalItems,P=T.props,R=P.children,I=P.width,H=P.height,z=T.props.margin||{},q=I-(z.left||0)-(z.right||0),G=j$({children:R,formattedGraphicalItems:O,legendWidth:q,legendContent:d});if(!G)return null;var X=G.item,Y=PN(G,Rne);return j.cloneElement(X,ie(ie({},Y),{},{chartWidth:I,chartHeight:H,margin:z,onBBoxUpdate:T.handleLegendBBoxUpdate}))}),ze(T,"renderTooltip",function(){var O,P=T.props,R=P.children,I=P.accessibilityLayer,H=sn(R,ln);if(!H)return null;var z=T.state,q=z.isTooltipActive,G=z.activeCoordinate,X=z.activePayload,Y=z.activeLabel,K=z.offset,Q=(O=H.props.active)!==null&&O!==void 0?O:q;return j.cloneElement(H,{viewBox:ie(ie({},K),{},{x:K.left,y:K.top}),active:Q,label:Y,payload:Q?X:[],coordinate:G,accessibilityLayer:I})}),ze(T,"renderBrush",function(O){var P=T.props,R=P.margin,I=P.data,H=T.state,z=H.offset,q=H.dataStartIndex,G=H.dataEndIndex,X=H.updateId;return j.cloneElement(O,{key:O.key||"_recharts-brush",onChange:Ef(T.handleBrushChange,O.props.onChange),data:I,x:ge(O.props.x)?O.props.x:z.left,y:ge(O.props.y)?O.props.y:z.top+z.height+z.brushBottom-(R.bottom||0),width:ge(O.props.width)?O.props.width:z.width,startIndex:q,endIndex:G,updateId:"brush-".concat(X)})}),ze(T,"renderReferenceElement",function(O,P,R){if(!O)return null;var I=T,H=I.clipPathId,z=T.state,q=z.xAxisMap,G=z.yAxisMap,X=z.offset,Y=O.type.defaultProps||{},K=O.props,Q=K.xAxisId,U=Q===void 0?Y.xAxisId:Q,J=K.yAxisId,M=J===void 0?Y.yAxisId:J;return j.cloneElement(O,{key:O.key||"".concat(P,"-").concat(R),xAxis:q[U],yAxis:G[M],viewBox:{x:X.left,y:X.top,width:X.width,height:X.height},clipPathId:H})}),ze(T,"renderActivePoints",function(O){var P=O.item,R=O.activePoint,I=O.basePoint,H=O.childIndex,z=O.isRange,q=[],G=P.props.key,X=P.item.type.defaultProps!==void 0?ie(ie({},P.item.type.defaultProps),P.item.props):P.item.props,Y=X.activeDot,K=X.dataKey,Q=ie(ie({index:H,dataKey:K,cx:R.x,cy:R.y,r:4,fill:i_(P.item),strokeWidth:2,stroke:"#fff",payload:R.payload,value:R.value},at(Y,!1)),ah(Y));return q.push(k.renderActiveDot(Y,Q,"".concat(G,"-activePoint-").concat(H))),I?q.push(k.renderActiveDot(Y,ie(ie({},Q),{},{cx:I.x,cy:I.y}),"".concat(G,"-basePoint-").concat(H))):z&&q.push(null),q}),ze(T,"renderGraphicChild",function(O,P,R){var I=T.filterFormatItem(O,P,R);if(!I)return null;var H=T.getTooltipEventType(),z=T.state,q=z.isTooltipActive,G=z.tooltipAxis,X=z.activeTooltipIndex,Y=z.activeLabel,K=T.props.children,Q=sn(K,ln),U=I.props,J=U.points,M=U.isRange,$=U.baseLine,W=I.item.type.defaultProps!==void 0?ie(ie({},I.item.type.defaultProps),I.item.props):I.item.props,re=W.activeDot,fe=W.hide,de=W.activeBar,ve=W.activeShape,qe=!!(!fe&&q&&Q&&(re||de||ve)),xe={};H!=="axis"&&Q&&Q.props.trigger==="click"?xe={onClick:Ef(T.handleItemMouseEnter,O.props.onClick)}:H!=="axis"&&(xe={onMouseLeave:Ef(T.handleItemMouseLeave,O.props.onMouseLeave),onMouseEnter:Ef(T.handleItemMouseEnter,O.props.onMouseEnter)});var ae=j.cloneElement(O,ie(ie({},I.props),xe));function Se(_t){return typeof G.dataKey=="function"?G.dataKey(_t.payload):null}if(qe)if(X>=0){var Me,oe;if(G.dataKey&&!G.allowDuplicatedCategory){var rt=typeof G.dataKey=="function"?Se:"payload.".concat(G.dataKey.toString());Me=ih(J,rt,Y),oe=M&&$&&ih($,rt,Y)}else Me=J==null?void 0:J[X],oe=M&&$&&$[X];if(ve||de){var Fe=O.props.activeIndex!==void 0?O.props.activeIndex:X;return[j.cloneElement(O,ie(ie(ie({},I.props),xe),{},{activeIndex:Fe})),null,null]}if(!tt(Me))return[ae].concat(fl(T.renderActivePoints({item:I,activePoint:Me,basePoint:oe,childIndex:X,isRange:M})))}else{var kt,wt=(kt=T.getItemByXY(T.state.activeCoordinate))!==null&&kt!==void 0?kt:{graphicalItem:ae},Et=wt.graphicalItem,_r=Et.item,Ut=_r===void 0?O:_r,Rr=Et.childIndex,cr=ie(ie(ie({},I.props),xe),{},{activeIndex:Rr});return[j.cloneElement(Ut,cr),null,null]}return M?[ae,null,null]:[ae,null]}),ze(T,"renderCustomized",function(O,P,R){return j.cloneElement(O,ie(ie({key:"recharts-customized-".concat(R)},T.props),T.state))}),ze(T,"renderMap",{CartesianGrid:{handler:jf,once:!0},ReferenceArea:{handler:T.renderReferenceElement},ReferenceLine:{handler:jf},ReferenceDot:{handler:T.renderReferenceElement},XAxis:{handler:jf},YAxis:{handler:jf},Brush:{handler:T.renderBrush,once:!0},Bar:{handler:T.renderGraphicChild},Line:{handler:T.renderGraphicChild},Area:{handler:T.renderGraphicChild},Radar:{handler:T.renderGraphicChild},RadialBar:{handler:T.renderGraphicChild},Scatter:{handler:T.renderGraphicChild},Pie:{handler:T.renderGraphicChild},Funnel:{handler:T.renderGraphicChild},Tooltip:{handler:T.renderCursor,once:!0},PolarGrid:{handler:T.renderPolarGrid,once:!0},PolarAngleAxis:{handler:T.renderPolarAxis},PolarRadiusAxis:{handler:T.renderPolarAxis},Customized:{handler:T.renderCustomized}}),T.clipPathId="".concat((A=S.id)!==null&&A!==void 0?A:Bu("recharts"),"-clip"),T.throttleTriggeredAfterMouseMove=jI(T.triggeredAfterMouseMove,(C=S.throttleDelay)!==null&&C!==void 0?C:1e3/60),T.state={},T}return Wne(k,x),Une(k,[{key:"componentDidMount",value:function(){var A,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var A=this.props,C=A.children,T=A.data,O=A.height,P=A.layout,R=sn(C,ln);if(R){var I=R.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var H=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,z=Pw(this.state,T,I,H),q=this.state.tooltipTicks[I].coordinate,G=(this.state.offset.top+O)/2,X=P==="horizontal",Y=X?{x:q,y:G}:{y:q,x:G},K=this.state.formattedGraphicalItems.find(function(U){var J=U.item;return J.type.name==="Scatter"});K&&(Y=ie(ie({},Y),K.props.points[I].tooltipPosition),z=K.props.points[I].tooltipPayload);var Q={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:H,activePayload:z,activeCoordinate:Y};this.setState(Q),this.renderCursor(R),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(A,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==A.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==A.margin){var T,O;this.accessibilityManager.setDetails({offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(A){yx([sn(A.children,ln)],[sn(this.props.children,ln)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var A=sn(this.props.children,ln);if(A&&typeof A.props.shared=="boolean"){var C=A.props.shared?"axis":"item";return c.indexOf(C)>=0?C:a}return a}},{key:"getMouseInfo",value:function(A){if(!this.container)return null;var C=this.container,T=C.getBoundingClientRect(),O=QW(T),P={chartX:Math.round(A.pageX-O.left),chartY:Math.round(A.pageY-O.top)},R=T.width/C.offsetWidth||1,I=this.inRange(P.chartX,P.chartY,R);if(!I)return null;var H=this.state,z=H.xAxisMap,q=H.yAxisMap,G=this.getTooltipEventType(),X=IN(this.state,this.props.data,this.props.layout,I);if(G!=="axis"&&z&&q){var Y=Ra(z).scale,K=Ra(q).scale,Q=Y&&Y.invert?Y.invert(P.chartX):null,U=K&&K.invert?K.invert(P.chartY):null;return ie(ie({},P),{},{xValue:Q,yValue:U},X)}return X?ie(ie({},P),X):null}},{key:"inRange",value:function(A,C){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,P=A/T,R=C/T;if(O==="horizontal"||O==="vertical"){var I=this.state.offset,H=P>=I.left&&P<=I.left+I.width&&R>=I.top&&R<=I.top+I.height;return H?{x:P,y:R}:null}var z=this.state,q=z.angleAxisMap,G=z.radiusAxisMap;if(q&&G){var X=Ra(q);return Jj({x:P,y:R},X)}return null}},{key:"parseEventsOfWrapper",value:function(){var A=this.props.children,C=this.getTooltipEventType(),T=sn(A,ln),O={};T&&C==="axis"&&(T.props.trigger==="click"?O={onClick:this.handleClick}:O={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=ah(this.props,this.handleOuterEvent);return ie(ie({},P),O)}},{key:"addListener",value:function(){Wb.on(Kb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Wb.removeListener(Kb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(A,C,T){for(var O=this.state.formattedGraphicalItems,P=0,R=O.length;P<R;P++){var I=O[P];if(I.item===A||I.props.key===A.key||C===Gi(I.item.type)&&T===I.childIndex)return I}return null}},{key:"renderClipPath",value:function(){var A=this.clipPathId,C=this.state.offset,T=C.left,O=C.top,P=C.height,R=C.width;return D.createElement("defs",null,D.createElement("clipPath",{id:A},D.createElement("rect",{x:T,y:O,height:P,width:R})))}},{key:"getXScales",value:function(){var A=this.state.xAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),P=O[0],R=O[1];return ie(ie({},C),{},ze({},P,R.scale))},{}):null}},{key:"getYScales",value:function(){var A=this.state.yAxisMap;return A?Object.entries(A).reduce(function(C,T){var O=NN(T,2),P=O[0],R=O[1];return ie(ie({},C),{},ze({},P,R.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(A){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(A){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[A])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(A){var C=this.state,T=C.formattedGraphicalItems,O=C.activeItem;if(T&&T.length)for(var P=0,R=T.length;P<R;P++){var I=T[P],H=I.props,z=I.item,q=z.type.defaultProps!==void 0?ie(ie({},z.type.defaultProps),z.props):z.props,G=Gi(z.type);if(G==="Bar"){var X=(H.data||[]).find(function(U){return xQ(A,U)});if(X)return{graphicalItem:I,payload:X}}else if(G==="RadialBar"){var Y=(H.data||[]).find(function(U){return Jj(A,U)});if(Y)return{graphicalItem:I,payload:Y}}else if(Up(I,O)||qp(I,O)||Eu(I,O)){var K=uee({graphicalItem:I,activeTooltipItem:O,itemData:q.data}),Q=q.activeIndex===void 0?K:q.activeIndex;return{graphicalItem:ie(ie({},I),{},{childIndex:Q}),payload:Eu(I,O)?q.data[K]:I.props.data[K]}}}return null}},{key:"render",value:function(){var A=this;if(!lO(this))return null;var C=this.props,T=C.children,O=C.className,P=C.width,R=C.height,I=C.style,H=C.compact,z=C.title,q=C.desc,G=PN(C,Ine),X=at(G,!1);if(H)return D.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},D.createElement(bx,Is({},X,{width:P,height:R,title:z,desc:q}),this.renderClipPath(),uO(T,this.renderMap)));if(this.props.accessibilityLayer){var Y,K;X.tabIndex=(Y=this.props.tabIndex)!==null&&Y!==void 0?Y:0,X.role=(K=this.props.role)!==null&&K!==void 0?K:"application",X.onKeyDown=function(U){A.accessibilityManager.keyboardEvent(U)},X.onFocus=function(){A.accessibilityManager.focus()}}var Q=this.parseEventsOfWrapper();return D.createElement(fN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},D.createElement("div",Is({className:ot("recharts-wrapper",O),style:ie({position:"relative",cursor:"default",width:P,height:R},I)},Q,{ref:function(J){A.container=J}}),D.createElement(bx,Is({},X,{width:P,height:R,title:z,desc:q,style:Jne}),this.renderClipPath(),uO(T,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(j.Component);ze(b,"displayName",r),ze(b,"defaultProps",ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ze(b,"getDerivedStateFromProps",function(x,k){var S=x.dataKey,A=x.data,C=x.children,T=x.width,O=x.height,P=x.layout,R=x.stackOffset,I=x.margin,H=k.dataStartIndex,z=k.dataEndIndex;if(k.updateId===void 0){var q=$N(x);return ie(ie(ie({},q),{},{updateId:0},v(ie(ie({props:x},q),{},{updateId:0}),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:P,prevStackOffset:R,prevMargin:I,prevChildren:C})}if(S!==k.prevDataKey||A!==k.prevData||T!==k.prevWidth||O!==k.prevHeight||P!==k.prevLayout||R!==k.prevStackOffset||!zs(I,k.prevMargin)){var G=$N(x),X={chartX:k.chartX,chartY:k.chartY,isTooltipActive:k.isTooltipActive},Y=ie(ie({},IN(k,A,P)),{},{updateId:k.updateId+1}),K=ie(ie(ie({},G),X),Y);return ie(ie(ie({},K),v(ie({props:x},K),k)),{},{prevDataKey:S,prevData:A,prevWidth:T,prevHeight:O,prevLayout:P,prevStackOffset:R,prevMargin:I,prevChildren:C})}if(!yx(C,k.prevChildren)){var Q,U,J,M,$=sn(C,rl),W=$&&(Q=(U=$.props)===null||U===void 0?void 0:U.startIndex)!==null&&Q!==void 0?Q:H,re=$&&(J=(M=$.props)===null||M===void 0?void 0:M.endIndex)!==null&&J!==void 0?J:z,fe=W!==H||re!==z,de=!tt(A),ve=de&&!fe?k.updateId:k.updateId+1;return ie(ie({updateId:ve},v(ie(ie({props:x},k),{},{updateId:ve,dataStartIndex:W,dataEndIndex:re}),k)),{},{prevChildren:C,dataStartIndex:W,dataEndIndex:re})}return null}),ze(b,"renderActiveDot",function(x,k,S){var A;return j.isValidElement(x)?A=j.cloneElement(x,k):Je(x)?A=x(k):A=D.createElement(o_,k),D.createElement(Xt,{className:"recharts-active-dot",key:S},A)});var w=j.forwardRef(function(k,S){return D.createElement(b,Is({},k,{ref:S}))});return w.displayName=b.displayName,w},sie=DM({chartName:"LineChart",GraphicalChild:Gu,axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM}),Rw=DM({chartName:"BarChart",GraphicalChild:ta,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ua},{axisType:"yAxis",AxisComp:qa}],formatAxisMap:rM});const np={backgroundColor:"#1e1e1e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#e4e0dc",fontSize:"11px",fontFamily:"JetBrains Mono, monospace"};function Rt(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.round(t))}function Zn(t){return`$${t.toFixed(2)}`}function Ma({label:t,value:e,sub:r,accent:n}){return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-5 py-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mb-1",children:t}),y.jsx("p",{className:`text-xl font-mono font-medium ${n?"text-[#E43A9C]":"text-zinc-100"}`,children:e}),r&&y.jsx("p",{className:"text-[10px] font-mono text-zinc-600 mt-0.5",children:r})]})}const lie={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function cie({tabs:t,active:e,onChange:r}){return y.jsx("div",{className:"flex gap-0 border-b border-white/[0.06] mb-5",children:t.map(n=>y.jsx("button",{type:"button",onClick:()=>r(n),className:`px-4 py-2 text-[11px] font-mono transition-colors border-b-2 -mb-px cursor-pointer ${e===n?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:lie[n]??n},n))})}function uie({records:t,totals:e}){const r=e.totalInputTokens+e.totalOutputTokens,n=new Map;for(const o of t){const c=o.squadId??"__io__",u=o.squadName??(o.squadId?`${o.squadId.slice(0,8)} (deleted)`:"IO Orchestrator"),d=n.get(c)??{name:u,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=o.inputTokens,d.outputTokens+=o.outputTokens,d.calls+=1,d.cost+=o.estimatedCostUsd??0,n.set(c,d)}const i=Array.from(n.values()).sort((o,c)=>c.cost-o.cost),a=i.map(o=>({name:o.name.length>12?`${o.name.slice(0,12)}…`:o.name,cost:Number.parseFloat(o.cost.toFixed(2)),tokens:Math.round((o.inputTokens+o.outputTokens)/1e3)}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"Total Tokens",value:Rt(r),sub:`${Rt(e.totalInputTokens)} in · ${Rt(e.totalOutputTokens)} out`}),y.jsx(Ma,{label:"Total Cost",value:Zn(e.totalCostUsd),accent:!0}),y.jsx(Ma,{label:"API Calls",value:Rt(e.callCount),sub:"across all entities"}),y.jsx(Ma,{label:"Avg Cost / Call",value:e.callCount>0?Zn(e.totalCostUsd/e.callCount):"$0.00",sub:`over ${e.callCount} calls`})]}),y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost by entity"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Rw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`$${o}`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`$${o.toFixed(2)}`,"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens by entity (k)"}),a.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Rw,{data:a,barCategoryGap:"35%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"name",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:o=>`${o}k`,width:40}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:o=>[`${o}k`,"Tokens"]}),y.jsx(ta,{dataKey:"tokens",fill:"url(#tokenGrad)",radius:[6,6,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"tokenGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#818cf8"}),y.jsx("stop",{offset:"100%",stopColor:"#6366f1",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Entity","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsxs("tbody",{children:[i.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name)),y.jsxs("tr",{className:"bg-[#1a1a1a]",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-200 font-medium",children:"Total"}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:Rt(e.totalInputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:Rt(e.totalOutputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:e.callCount}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C] font-medium",children:Zn(e.totalCostUsd)})]})]})]})})]})}function die({records:t}){const[e,r]=j.useState([]),[n,i]=j.useState("cost"),[a,o]=j.useState("desc");function c(f){f===n?o(m=>m==="asc"?"desc":"asc"):(i(f),o("desc"))}const u=j.useMemo(()=>{const f=new Map;for(const v of t){if(!v.squadId)continue;const b=f.get(v.squadId)??{id:v.squadId,name:v.squadName??`${v.squadId.slice(0,8)} (deleted)`,agents:new Map,inputTokens:0,outputTokens:0,calls:0,cost:0};b.inputTokens+=v.inputTokens,b.outputTokens+=v.outputTokens,b.calls+=1,b.cost+=v.estimatedCostUsd??0;const w=`${v.agentRole??"unknown"}:${v.model}`,x=b.agents.get(w)??{role:v.agentRole??"unknown",model:v.model,inputTokens:0,outputTokens:0,calls:0,cost:0};x.inputTokens+=v.inputTokens,x.outputTokens+=v.outputTokens,x.calls+=1,x.cost+=v.estimatedCostUsd??0,b.agents.set(w,x),f.set(v.squadId,b)}return[...Array.from(f.values())].sort((v,b)=>{const w=v[n],x=b[n],k=typeof w=="string"?w.localeCompare(x):w-x;return a==="desc"?-k:k})},[t,n,a]),d=f=>r(m=>m.includes(f)?m.filter(v=>v!==f):[...m,f]),p=[{key:"name",label:"Squad"},{key:"inputTokens",label:"In"},{key:"outputTokens",label:"Out"},{key:"calls",label:"Calls"},{key:"cost",label:"Cost"}];return u.length===0?y.jsx("div",{className:"text-center py-12 text-zinc-700 text-[11px] font-mono",children:"No squad usage data"}):y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-1 px-1 mb-1",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 mr-1",children:"sort by"}),p.map(f=>y.jsxs("button",{type:"button",onClick:()=>c(f.key),className:`flex items-center gap-0.5 px-2 py-1 rounded-lg text-[10px] font-mono transition-colors ${n===f.key?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400 hover:bg-white/[0.04]"}`,style:n===f.key?{background:"rgba(228,58,156,0.1)"}:void 0,children:[f.label,n===f.key&&y.jsx("span",{className:"text-[9px]",children:a==="desc"?"↓":"↑"})]},f.key))]}),u.map(f=>{const m=e.includes(f.id),v=Array.from(f.agents.values());return y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl overflow-hidden",children:[y.jsxs("button",{type:"button",onClick:()=>d(f.id),className:"w-full flex items-center gap-3 px-4 py-3.5 hover:bg-white/[0.02] transition-colors text-left cursor-pointer",children:[y.jsx("div",{className:`transition-transform ${m?"rotate-90":""}`,children:y.jsx(e1,{className:"w-3.5 h-3.5 text-zinc-600"})}),y.jsx("span",{className:"text-sm font-mono text-zinc-100 flex-1",children:f.name}),y.jsxs("div",{className:"flex items-center gap-6 text-[11px] font-mono",children:[y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"in"}),Rt(f.inputTokens)]}),y.jsxs("span",{className:"text-zinc-500 hidden sm:block",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"out"}),Rt(f.outputTokens)]}),y.jsxs("span",{className:"text-zinc-500",children:[y.jsx("span",{className:"text-zinc-700 mr-1",children:"calls"}),f.calls]}),y.jsx("span",{className:"text-[#E43A9C] font-medium w-16 text-right",children:Zn(f.cost)})]})]}),m&&y.jsx("div",{className:"border-t border-white/[0.05]",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"bg-[#191919]",children:["Agent","Model","Input","Output","Calls","Cost"].map(b=>y.jsx("th",{className:`text-left px-4 py-2 text-zinc-700 font-medium ${b==="Cost"?"text-right":""}`,children:b},b))})}),y.jsx("tbody",{children:v.map(b=>y.jsxs("tr",{className:"border-t border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-2.5 text-zinc-300",children:b.role}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-600",children:b.model}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:Rt(b.inputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:Rt(b.outputTokens)}),y.jsx("td",{className:"px-4 py-2.5 text-zinc-500",children:b.calls}),y.jsx("td",{className:"px-4 py-2.5 text-right text-[#E43A9C]",children:Zn(b.cost)})]},b.role))})]})})]},f.id)})]})}function fie({records:t}){const e=j.useMemo(()=>{const n=new Map;for(const i of t){const a=`${i.squadId??"io"}:${i.agentRole??"orchestrator"}:${i.model}`,o=n.get(a)??{name:i.agentRole??"orchestrator",squad:i.squadName??(i.squadId?i.squadId.slice(0,8):"IO"),model:i.model,inputTokens:0,outputTokens:0,calls:0,cost:0};o.inputTokens+=i.inputTokens,o.outputTokens+=i.outputTokens,o.calls+=1,o.cost+=i.estimatedCostUsd??0,n.set(a,o)}return Array.from(n.values()).sort((i,a)=>a.cost-i.cost)},[t]),r=e.reduce((n,i)=>n+i.cost,0);return y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Agent","Squad","Model","Input","Output","Calls","Cost","% of total"].map(n=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${n==="Cost"?"text-right":""}`,children:n},n))})}),y.jsx("tbody",{children:e.map(n=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:n.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.squad}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:n.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(n.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(n.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:n.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(n.cost)}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-16 h-1.5 rounded-full bg-[#252525] overflow-hidden",children:y.jsx("div",{className:"h-full bg-[#E43A9C] rounded-full",style:{width:`${r>0?n.cost/r*100:0}%`}})}),y.jsx("span",{className:"text-zinc-600 text-[10px]",children:r>0?`${(n.cost/r*100).toFixed(1)}%`:"0%"})]})})]},`${n.squad}:${n.name}`))})]})})}function hie({records:t}){const e=j.useMemo(()=>t.filter(o=>!o.squadId),[t]),r=j.useMemo(()=>{const o=new Map;for(const c of e){const u=`${c.agentRole??"orchestrator"}:${c.model}`,d=o.get(u)??{name:c.agentRole??"orchestrator",model:c.model,inputTokens:0,outputTokens:0,calls:0,cost:0};d.inputTokens+=c.inputTokens,d.outputTokens+=c.outputTokens,d.calls+=1,d.cost+=c.estimatedCostUsd??0,o.set(u,d)}return Array.from(o.values()).sort((c,u)=>u.cost-c.cost)},[e]),n=e.reduce((o,c)=>o+c.inputTokens,0),i=e.reduce((o,c)=>o+c.outputTokens,0),a=e.reduce((o,c)=>o+(c.estimatedCostUsd??0),0);return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[y.jsx(Ma,{label:"IO Tokens",value:Rt(n+i),sub:`${Rt(n)} in · ${Rt(i)} out`}),y.jsx(Ma,{label:"IO Cost",value:Zn(a),accent:!0}),y.jsx(Ma,{label:"IO Calls",value:Rt(e.length)}),y.jsx(Ma,{label:"IO Roles",value:String(r.length)})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Role","Model","Input","Output","Calls","Cost"].map(o=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${o==="Cost"?"text-right":""}`,children:o},o))})}),y.jsx("tbody",{children:r.map(o=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:o.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:o.model}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(o.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(o.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:o.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(o.cost)})]},o.name))})]})})]})}function pie({records:t}){const e=Fa(),r=j.useMemo(()=>{const i=new Map;for(const a of t){const o=a.timestamp.slice(0,10),c=i.get(o)??{date:o,inputTokens:0,outputTokens:0,cost:0,calls:0};c.inputTokens+=a.inputTokens,c.outputTokens+=a.outputTokens,c.cost+=a.estimatedCostUsd??0,c.calls+=1,i.set(o,c)}return Array.from(i.values()).sort((a,o)=>a.date.localeCompare(o.date))},[t]),n=r.map(i=>({...i,label:ez(i.date,e),tokens:i.inputTokens+i.outputTokens}));return y.jsxs("div",{className:"space-y-5",children:[y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Tokens per day"}),n.length>0?y.jsx(gh,{width:"100%",height:220,children:y.jsxs(sie,{data:n,children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:Rt,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Rt(i),"Tokens"]}),y.jsx(Gu,{type:"monotone",dataKey:"tokens",stroke:"#E43A9C",strokeWidth:2,dot:!1})]})}):y.jsx("div",{className:"h-[220px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsx("p",{className:"text-[11px] font-mono text-zinc-500 mb-3",children:"Cost per day"}),n.length>0?y.jsx(gh,{width:"100%",height:180,children:y.jsxs(Rw,{data:n,barCategoryGap:"20%",children:[y.jsx(ju,{vertical:!1,stroke:"rgba(255,255,255,0.04)"}),y.jsx(Ua,{dataKey:"label",tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1}),y.jsx(qa,{tick:{fill:"#52525b",fontSize:10,fontFamily:"JetBrains Mono, monospace"},axisLine:!1,tickLine:!1,tickFormatter:i=>`$${i.toFixed(2)}`,width:44}),y.jsx(ln,{contentStyle:np,cursor:{fill:"rgba(255,255,255,0.03)"},formatter:i=>[Zn(i),"Cost"]}),y.jsx(ta,{dataKey:"cost",fill:"url(#costGradTl)",radius:[4,4,0,0]}),y.jsx("defs",{children:y.jsxs("linearGradient",{id:"costGradTl",x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"#E43A9C"}),y.jsx("stop",{offset:"100%",stopColor:"#D83333",stopOpacity:.7})]})})]})}):y.jsx("div",{className:"h-[180px] flex items-center justify-center text-zinc-700 text-[11px] font-mono",children:"No data"})]}),y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:y.jsxs("table",{className:"w-full text-[11px] font-mono",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06] bg-[#1a1a1a]",children:["Date","Input","Output","Calls","Cost"].map(i=>y.jsx("th",{className:`text-left px-4 py-2.5 text-zinc-600 font-medium ${i==="Cost"?"text-right":""}`,children:i},i))})}),y.jsx("tbody",{children:r.map(i=>y.jsxs("tr",{className:"border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors",children:[y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:i.date}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(i.inputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:Rt(i.outputTokens)}),y.jsx("td",{className:"px-4 py-3 text-zinc-500",children:i.calls}),y.jsx("td",{className:"px-4 py-3 text-right text-[#E43A9C]",children:Zn(i.cost)})]},i.date))})]})})]})}function mie(){const[t,e]=j.useState("summary"),[r,n]=j.useState(null),[i,a]=j.useState("14d"),o=["summary","by squad","by agent","io","timeline"];if(j.useEffect(()=>{const u=new Date;i==="7d"?u.setDate(u.getDate()-7):i==="14d"?u.setDate(u.getDate()-14):i==="30d"?u.setDate(u.getDate()-30):u.setDate(u.getDate()-1),Ge.get(`/usage?since=${u.toISOString()}`).then(n).catch(()=>{})},[i]),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600 font-mono text-[11px]",children:"Loading..."});const c=i==="1d"?"Today":`Last ${i}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsxs("div",{className:"flex items-start justify-between mb-5 gap-4 flex-wrap",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Usage"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:c})]}),y.jsx("div",{className:"flex gap-1 p-1 rounded-xl bg-white/[0.03] border border-white/[0.07]",children:["1d","7d","14d","30d"].map(u=>y.jsx("button",{type:"button",onClick:()=>a(u),className:`px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors cursor-pointer ${i===u?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-400"}`,style:i===u?{background:"rgba(228,58,156,0.12)"}:void 0,children:u},u))})]}),y.jsx(cie,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx(uie,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(die,{records:r.records}),t==="by agent"&&y.jsx(fie,{records:r.records}),t==="io"&&y.jsx(hie,{records:r.records}),t==="timeline"&&y.jsx(pie,{records:r.records})]})}function LM(t){return[...t].sort((e,r)=>e.isDir!==r.isDir?e.isDir?-1:1:e.name.localeCompare(r.name)).map(e=>({...e,children:LM(e.children)}))}function gie(t){const e=[];for(const r of t){const n=r.path.split("/").filter(Boolean);let i=e,a="";if(r.isDir){for(const o of n){a=a?`${a}/${o}`:o;let c=i.find(u=>u.path===a);c||(c={name:o,path:a,isDir:!0,children:[]},i.push(c)),i=c.children}continue}for(const[o,c]of n.entries()){const u=o===n.length-1;a=a?`${a}/${c}`:c;let d=i.find(p=>p.path===a);d||(d={name:u&&r.name||c,path:a,isDir:!u,children:[]},i.push(d)),i=d.children}}return LM(e)}function zM(t,e){return e?t.flatMap(r=>{const n=r.name.toLowerCase().includes(e)||r.path.toLowerCase().includes(e);if(!r.isDir)return n?[r]:[];if(n)return[r];const i=zM(r.children,e);return i.length?[{...r,children:i}]:[]}):t}function Iw(t){const e=new Set;for(const r of t)if(r.isDir){e.add(r.path);for(const n of Iw(r.children))e.add(n)}return e}function yie(t){const e=t.split("/").filter(Boolean),r=[];let n="";for(const i of e.slice(0,-1))n=n?`${n}/${i}`:i,r.push(n);return r}function BM({node:t,depth:e,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u}){const d=r===t.path,p=t.isDir&&(n.has(t.path)||i.has(t.path)),f=12+e*16,m=t.isDir&&["io","shared","squads","templates"].includes(t.path);return t.isDir?y.jsxs("div",{children:[y.jsxs("div",{className:"flex w-full items-center group rounded-lg py-2 pr-3 text-left text-[11px] font-mono text-zinc-400 transition-colors hover:bg-white/[0.04] hover:text-zinc-200",style:{paddingLeft:f},children:[y.jsxs("button",{type:"button",onClick:()=>a(t.path),className:"flex items-center gap-2 flex-1 min-w-0",children:[y.jsx(e1,{size:14,className:`shrink-0 transition-transform ${p?"rotate-90":""}`}),p?y.jsx(zz,{size:14,className:"shrink-0 text-zinc-500"}):y.jsx(Uz,{size:14,className:"shrink-0 text-zinc-500"}),y.jsx("span",{className:"truncate",children:t.name})]}),y.jsxs("div",{className:"flex items-center gap-0.5",children:[!m&&y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),u(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-red-500/20 transition-opacity text-zinc-600 hover:text-red-400",title:`Delete ${t.name}`,children:y.jsx(Da,{size:12})}),y.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),c(t.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-white/[0.08] transition-opacity text-zinc-600 hover:text-zinc-300",title:`Add page to ${t.name}`,children:y.jsx(i1,{size:12})})]})]}),p&&y.jsx("div",{children:t.children.map(v=>y.jsx(BM,{node:v,depth:e+1,selectedPage:r,expandedPaths:n,autoExpandedPaths:i,onToggle:a,onSelect:o,onAddToFolder:c,onDeleteFolder:u},v.path))})]}):y.jsxs("button",{type:"button",onClick:()=>o(t.path),className:`flex w-full items-center gap-2 rounded-lg py-2 pr-3 text-left text-[11px] font-mono transition-colors ${d?"border-l-2 border-[#E43A9C] bg-[#E43A9C]/10 text-[#E43A9C]":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-300"}`,style:{paddingLeft:f},children:[y.jsx(Dz,{size:14,className:"shrink-0"}),y.jsx("span",{className:"truncate",children:t.name})]})}function vie(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(""),[o,c]=j.useState(!1),[u,d]=j.useState(""),[p,f]=j.useState(""),[m,v]=j.useState(""),[b,w]=j.useState(new Set),[x,k]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null),T=j.useCallback(async()=>{try{const M=await Ge.get("/wiki/pages");e(M.map($=>({name:$.title||$.path.split("/").pop()||$.path,path:$.path,title:$.title,isDir:$.isDir})))}catch{e([])}},[]);j.useEffect(()=>{T()},[T]);const O=j.useMemo(()=>gie(t),[t]),P=m.trim().toLowerCase(),R=j.useMemo(()=>zM(O,P),[O,P]),I=j.useMemo(()=>{const M=P?Iw(R):new Set;if(r)for(const $ of yie(r))M.add($);return M},[R,P,r]),H=r?(function M($){for(const W of $){if(W.path===r)return W;const re=M(W.children);if(re)return re}return null})(R):null,z=(H==null?void 0:H.name)??(r?r.split("/").pop()??"":"");j.useEffect(()=>{const M=Iw(O);w($=>new Set([...$,...M]))},[O]);async function q(M){try{const $=await Ge.get(`/wiki/pages/${M}`);a($.content),d($.content),n($.path||M),c(!1)}catch{Qe.error("Failed to load page")}}s1({onEvent:M=>{(M.type==="connected"||M.type===Fc.WIKI_UPDATED)&&T()}});async function G(){if(r)try{await Ge.put(`/wiki/pages/${r}`,{content:u}),a(u),c(!1),Qe.success("Page saved")}catch{Qe.error("Failed to save page")}}async function X(){if(r)try{await Ge.delete(`/wiki/pages/${r}`),Qe.success("Page deleted"),n(null),a(""),d(""),c(!1),await T()}catch{Qe.error("Failed to delete page")}}function Y(M){f(`${M}/`),setTimeout(()=>{const $=C.current;$&&($.focus(),$.setSelectionRange($.value.length,$.value.length))},0)}function K(M){A(M)}async function Q(){if(S)try{await Ge.delete(`/wiki/directories/${S}`),Qe.success(`Deleted ${S}`),(r!=null&&r.startsWith(`${S}/`)||r===S)&&(n(null),a(""),d(""),c(!1)),await T()}catch{Qe.error("Failed to delete directory")}finally{A(null)}}async function U(){let M=p.trim().replace(/^\/+|\/+$/g,"");if(!M)return;M=M.replace(/\.md$/i,"");const $=M.startsWith("io/")||M.startsWith("shared/")||M.startsWith("squads/")?M:`shared/${M}`,W=$.split("/").pop()??$;k(!0);try{await Ge.post("/wiki/pages",{path:$,title:W,content:`# ${W}
|
|
518
518
|
|
|
519
519
|
`,tags:[]}),Qe.success("Page created"),f(""),await T(),await q($)}catch{Qe.error("Failed to create page")}finally{k(!1)}}function J(M){w($=>{const W=new Set($);return W.has(M)?W.delete(M):W.add(M),W})}return y.jsxs("div",{className:"flex h-full",children:[y.jsxs("div",{className:"flex h-full w-64 flex-col border-r border-white/[0.07] bg-[#181818]",children:[y.jsx("div",{className:"border-b border-white/[0.07] p-3",children:y.jsxs("div",{className:"relative",children:[y.jsx(zP,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-zinc-600"}),y.jsx("input",{type:"text",value:m,onChange:M=>v(M.target.value),placeholder:"Search pages...",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] py-2 pl-8 pr-3 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-3",children:R.length>0?R.map(M=>y.jsx(BM,{node:M,depth:0,selectedPage:r,expandedPaths:b,autoExpandedPaths:I,onToggle:J,onSelect:q,onAddToFolder:Y,onDeleteFolder:K},M.path)):y.jsx("p",{className:"py-4 text-center font-mono text-[11px] text-zinc-700",children:"No pages found"})}),y.jsx("div",{className:"border-t border-white/[0.07] p-3",children:y.jsxs("div",{className:"space-y-2",children:[y.jsx("input",{ref:C,type:"text",value:p,onChange:M=>f(M.target.value),onKeyDown:M=>{M.key==="Enter"&&U(),M.key==="Escape"&&f("")},placeholder:"folder/new-page",className:"w-full rounded-lg border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-[11px] font-mono text-zinc-300 outline-none placeholder:text-zinc-700 focus:border-[#E43A9C]/50"}),y.jsx(Ba,{onClick:U,disabled:!p.trim()||x,className:"w-full justify-center px-3 py-2",children:x?y.jsxs(y.Fragment,{children:[y.jsx($s,{size:13,className:"animate-spin"})," Creating..."]}):y.jsxs(y.Fragment,{children:[y.jsx(i1,{size:13})," Add Page"]})})]})})]}),y.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:r?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-white/[0.07] px-6",children:[y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate font-mono text-sm text-zinc-100",children:z}),y.jsx("p",{className:"truncate font-mono text-[11px] text-zinc-500",children:r})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[o?y.jsxs(y.Fragment,{children:[y.jsxs(Ba,{onClick:G,className:"px-3 py-1.5",children:[y.jsx(dp,{size:12})," Save"]}),y.jsx(wi,{onClick:()=>{c(!1),d(i)},className:"px-3 py-1.5",children:"Cancel"})]}):y.jsxs(wi,{onClick:()=>{c(!0),d(i)},className:"px-3 py-1.5",children:[y.jsx(Hf,{size:12})," Edit"]}),y.jsxs(Gf,{onClick:X,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o?y.jsx("textarea",{value:u,onChange:M=>d(M.target.value),className:"h-full min-h-[320px] w-full resize-none rounded-xl border border-white/[0.07] bg-[#181818] p-4 font-mono text-sm text-zinc-300 outline-none focus:border-[#E43A9C]/50"}):y.jsx("div",{className:"mx-auto max-w-4xl",children:y.jsx("div",{className:"prose-io text-sm text-zinc-300",dangerouslySetInnerHTML:{__html:it.parse(i)}})})})]}):y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(RP,{size:48,className:"mx-auto mb-3 text-zinc-800"}),y.jsx("p",{className:"font-mono text-[11px] text-zinc-700",children:"Select a page to view"})]})})}),S&&y.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:y.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-white/[0.07] bg-[#1a1a1a] p-6 shadow-2xl",children:[y.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-100",children:"Delete directory?"}),y.jsxs("p",{className:"mb-4 text-xs text-zinc-400",children:["This will permanently delete"," ",y.jsx("span",{className:"font-mono text-zinc-200",children:S})," and all its contents."]}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx(wi,{onClick:()=>A(null),className:"px-3 py-1.5",children:"Cancel"}),y.jsxs(Gf,{onClick:Q,className:"px-3 py-1.5",children:[y.jsx(Da,{size:12})," Delete"]})]})]})})]})}function bie({children:t}){const{session:e,supabase:r,loading:n}=yp();return n?y.jsx("div",{className:"min-h-screen flex items-center justify-center text-[var(--color-muted-foreground)]",children:"Loading..."}):r?e?y.jsx(y.Fragment,{children:t}):y.jsx(Dq,{}):y.jsx(y.Fragment,{children:t})}function xie(){const{pathname:t}=ti(),e=t==="/"||t==="/chat"||t.startsWith("/chat/");return y.jsxs(y.Fragment,{children:[y.jsx(jL,{children:y.jsxs(Yr,{element:y.jsx(Rq,{}),children:[y.jsx(Yr,{index:!0,element:y.jsx(Iq,{})}),y.jsx(Yr,{path:"squads",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name/instances/:instanceId",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"squads/:name/agents/:role",element:y.jsx(yf,{})}),y.jsx(Yr,{path:"feed",element:y.jsx(Mq,{})}),y.jsx(Yr,{path:"skills",element:y.jsx(n9,{})}),y.jsx(Yr,{path:"schedules",element:y.jsx(Bq,{})}),y.jsx(Yr,{path:"wiki",element:y.jsx(vie,{})}),y.jsx(Yr,{path:"settings",element:y.jsx(Hq,{})}),y.jsx(Yr,{path:"usage",element:y.jsx(mie,{})}),y.jsx(Yr,{path:"*",element:y.jsx(OL,{to:"/",replace:!0})})]})}),!e&&y.jsx($B,{})]})}function wie(){return y.jsx(zU,{children:y.jsx(bie,{children:y.jsx(Z4,{children:y.jsx(IB,{children:y.jsx(xie,{})})})})})}OD.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsxs(e5,{children:[y.jsx(wie,{}),y.jsx(D5,{theme:"dark",position:"bottom-right"})]})}));
|
|
520
|
-
//# sourceMappingURL=index-
|
|
520
|
+
//# sourceMappingURL=index-BBx9hgnQ.js.map
|
package/dist/web/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap"
|
|
12
12
|
/>
|
|
13
13
|
<title>IO</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BBx9hgnQ.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/index-Ba4ocVp3.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|