agent-relay-server 0.124.0 → 0.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/openapi.json +1 -1
- package/package.json +2 -2
- package/public/assets/{MessageBubble-SQK8-Mzp.js → MessageBubble-BYeYFteG.js} +2 -2
- package/public/assets/{MessageBubble-SQK8-Mzp.js.map → MessageBubble-BYeYFteG.js.map} +1 -1
- package/public/assets/{PlanGraphPanel-CS-aow4S.js → PlanGraphPanel-iAXvkZKW.js} +2 -2
- package/public/assets/{PlanGraphPanel-CS-aow4S.js.map → PlanGraphPanel-iAXvkZKW.js.map} +1 -1
- package/public/assets/{activity-W31XvhC2.js → activity-Du9SRJt5.js} +2 -2
- package/public/assets/{activity-W31XvhC2.js.map → activity-Du9SRJt5.js.map} +1 -1
- package/public/assets/agent-profiles-DXDQnrlH.js +2 -0
- package/public/assets/{agent-profiles-DXysA9To.js.map → agent-profiles-DXDQnrlH.js.map} +1 -1
- package/public/assets/{agent-type-icon-BxUopALO.js → agent-type-icon-B3i0rndK.js} +2 -2
- package/public/assets/{agent-type-icon-BxUopALO.js.map → agent-type-icon-B3i0rndK.js.map} +1 -1
- package/public/assets/{agents-B5GRNRnN.js → agents-CWOdKrxP.js} +2 -2
- package/public/assets/{agents-B5GRNRnN.js.map → agents-CWOdKrxP.js.map} +1 -1
- package/public/assets/{analytics-DqAuUAwX.js → analytics-YcY59Hv9.js} +2 -2
- package/public/assets/{analytics-DqAuUAwX.js.map → analytics-YcY59Hv9.js.map} +1 -1
- package/public/assets/{automation-DYlgHYcb.js → automation-CItTse7F.js} +2 -2
- package/public/assets/{automation-DYlgHYcb.js.map → automation-CItTse7F.js.map} +1 -1
- package/public/assets/{branch-state-badge-Mf0Ow77K.js → branch-state-badge-QjTktTYj.js} +2 -2
- package/public/assets/{branch-state-badge-Mf0Ow77K.js.map → branch-state-badge-QjTktTYj.js.map} +1 -1
- package/public/assets/{channels-DVRkVeky.js → channels-BSFTsbhT.js} +2 -2
- package/public/assets/{channels-DVRkVeky.js.map → channels-BSFTsbhT.js.map} +1 -1
- package/public/assets/chat-CRzFSFWe.js +2 -0
- package/public/assets/chat-CRzFSFWe.js.map +1 -0
- package/public/assets/{connectors-Cqubkw9C.js → connectors-C7d5dlYz.js} +2 -2
- package/public/assets/{connectors-Cqubkw9C.js.map → connectors-C7d5dlYz.js.map} +1 -1
- package/public/assets/{display-GFbGUG0O.js → display-aTnwsqQh.js} +3 -3
- package/public/assets/{display-GFbGUG0O.js.map → display-aTnwsqQh.js.map} +1 -1
- package/public/assets/{formatted-body-BYQ-SPtj.js → formatted-body-BuLfVMeD.js} +3 -3
- package/public/assets/{formatted-body-BYQ-SPtj.js.map → formatted-body-BuLfVMeD.js.map} +1 -1
- package/public/assets/{formatted-body-impl-L1EMnNW6.js → formatted-body-impl-DO-8giS6.js} +2 -2
- package/public/assets/{formatted-body-impl-L1EMnNW6.js.map → formatted-body-impl-DO-8giS6.js.map} +1 -1
- package/public/assets/index-C9X_0QBt.css +2 -0
- package/public/assets/index-De1tR7J4.js +26 -0
- package/public/assets/index-De1tR7J4.js.map +1 -0
- package/public/assets/{insights-DwZxq1Dn.js → insights-Ci3VuA5Y.js} +2 -2
- package/public/assets/{insights-DwZxq1Dn.js.map → insights-Ci3VuA5Y.js.map} +1 -1
- package/public/assets/{integrations-9G5TJnnU.js → integrations-BboxWQQD.js} +2 -2
- package/public/assets/{integrations-9G5TJnnU.js.map → integrations-BboxWQQD.js.map} +1 -1
- package/public/assets/{maintenance-COcmUDnf.js → maintenance-CO1miJIJ.js} +2 -2
- package/public/assets/{maintenance-COcmUDnf.js.map → maintenance-CO1miJIJ.js.map} +1 -1
- package/public/assets/{managed-agents-D9-dgMeX.js → managed-agents-r4oYK3Fm.js} +2 -2
- package/public/assets/{managed-agents-D9-dgMeX.js.map → managed-agents-r4oYK3Fm.js.map} +1 -1
- package/public/assets/{markdown-preview-impl-DH372bL-.js → markdown-preview-impl-5CCM9iyL.js} +2 -2
- package/public/assets/{markdown-preview-impl-DH372bL-.js.map → markdown-preview-impl-5CCM9iyL.js.map} +1 -1
- package/public/assets/{memory-B9hRK8sk.js → memory-BJJS07W-.js} +2 -2
- package/public/assets/{memory-B9hRK8sk.js.map → memory-BJJS07W-.js.map} +1 -1
- package/public/assets/{messages-BHkHlXzF.js → messages-RT_dfEsL.js} +2 -2
- package/public/assets/{messages-BHkHlXzF.js.map → messages-RT_dfEsL.js.map} +1 -1
- package/public/assets/{orchestrators-CXy3SDSn.js → orchestrators-8hyl8hW1.js} +2 -2
- package/public/assets/{orchestrators-CXy3SDSn.js.map → orchestrators-8hyl8hW1.js.map} +1 -1
- package/public/assets/{overview-D2yRyCQq.js → overview-CUJ9QmW_.js} +2 -2
- package/public/assets/{overview-D2yRyCQq.js.map → overview-CUJ9QmW_.js.map} +1 -1
- package/public/assets/{pairs-5tXdHylI.js → pairs-CzkzMGZq.js} +2 -2
- package/public/assets/{pairs-5tXdHylI.js.map → pairs-CzkzMGZq.js.map} +1 -1
- package/public/assets/{projects-CquHTMo1.js → projects-CAuLWBU5.js} +2 -2
- package/public/assets/{projects-CquHTMo1.js.map → projects-CAuLWBU5.js.map} +1 -1
- package/public/assets/{prompt-settings-Bn5mmi9w.js → prompt-settings-BnB90R7F.js} +2 -2
- package/public/assets/{prompt-settings-Bn5mmi9w.js.map → prompt-settings-BnB90R7F.js.map} +1 -1
- package/public/assets/{registry-C3sB7qv5.js → registry-B8TInqru.js} +2 -2
- package/public/assets/{registry-C3sB7qv5.js.map → registry-B8TInqru.js.map} +1 -1
- package/public/assets/{security-CmD-YE-_.js → security-DG_VVZUW.js} +2 -2
- package/public/assets/{security-CmD-YE-_.js.map → security-DG_VVZUW.js.map} +1 -1
- package/public/assets/{select-C0UlhK2k.js → select-BJ8G38_V.js} +2 -2
- package/public/assets/{select-C0UlhK2k.js.map → select-BJ8G38_V.js.map} +1 -1
- package/public/assets/{settings-DrqMG5nG.js → settings-CK_T9z5w.js} +4 -4
- package/public/assets/{settings-DrqMG5nG.js.map → settings-CK_T9z5w.js.map} +1 -1
- package/public/assets/{store-zFLzd0Jd.js → store-Dl9Z8YUS.js} +4 -4
- package/public/assets/{store-zFLzd0Jd.js.map → store-Dl9Z8YUS.js.map} +1 -1
- package/public/assets/{tasks-ChQjtXHu.js → tasks-Briui9Mp.js} +2 -2
- package/public/assets/{tasks-ChQjtXHu.js.map → tasks-Briui9Mp.js.map} +1 -1
- package/public/assets/{teams-itjNlDLp.js → teams-Ck4EVV3R.js} +2 -2
- package/public/assets/{teams-itjNlDLp.js.map → teams-Ck4EVV3R.js.map} +1 -1
- package/public/assets/{terminal-viewer-impl-B9M6s2vB.js → terminal-viewer-impl-66ZjVN1v.js} +2 -2
- package/public/assets/{terminal-viewer-impl-B9M6s2vB.js.map → terminal-viewer-impl-66ZjVN1v.js.map} +1 -1
- package/public/assets/{types-CRptbSYh.js → types-BqeSkWrv.js} +2 -2
- package/public/assets/{types-CRptbSYh.js.map → types-BqeSkWrv.js.map} +1 -1
- package/public/assets/{user-avatar-kYPfLgXp.js → user-avatar-BOy9o2xK.js} +2 -2
- package/public/assets/{user-avatar-kYPfLgXp.js.map → user-avatar-BOy9o2xK.js.map} +1 -1
- package/public/assets/{work-queue-Kw0uMkEF.js → work-queue-CnghFRG2.js} +2 -2
- package/public/assets/{work-queue-Kw0uMkEF.js.map → work-queue-CnghFRG2.js.map} +1 -1
- package/public/assets/{workspaces-CR6f7G0R.js → workspaces-BzmQnzSm.js} +2 -2
- package/public/assets/{workspaces-CR6f7G0R.js.map → workspaces-BzmQnzSm.js.map} +1 -1
- package/public/index.html +7 -7
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/plugins/claude/hooks/relay-status.sh +11 -1
- package/runner/plugins/claude/hooks/stop.sh +6 -1
- package/runner/plugins/claude/hooks/user-prompt-submit.sh +6 -1
- package/runner/src/adapter.ts +5 -1
- package/runner/src/adapters/claude-transcript.ts +52 -58
- package/runner/src/adapters/codex-agent-message-capture.ts +8 -36
- package/runner/src/adapters/codex.ts +30 -12
- package/runner/src/control-server.ts +9 -4
- package/runner/src/response-capture-report.ts +4 -1
- package/runner/src/runner-core.ts +75 -33
- package/src/agent-lifecycle-events.ts +8 -0
- package/src/bus.ts +0 -24
- package/src/db/agents.ts +15 -1
- package/src/db/messages.ts +114 -43
- package/src/maintenance/jobs.ts +8 -2
- package/src/mcp/tools-workspace.ts +4 -0
- package/src/routes/agents.ts +0 -4
- package/src/services/send-message.ts +7 -18
- package/src/services/shutdown-agent.ts +6 -0
- package/src/services/task-entity.ts +4 -0
- package/src/services/transient-agent-reaper.ts +40 -1
- package/src/services/work-finality.ts +25 -0
- package/public/assets/agent-profiles-DXysA9To.js +0 -2
- package/public/assets/chat-Clz6qOtn.js +0 -2
- package/public/assets/chat-Clz6qOtn.js.map +0 -1
- package/public/assets/index-0uIGXT14.js +0 -25
- package/public/assets/index-0uIGXT14.js.map +0 -1
- package/public/assets/index-DOJ7KidA.css +0 -2
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import { canonicalHumanAgentId, isHumanAgentId, isMechanicalMessageKind, isRecord, isReservedAgentId, isTurnFinalSession } from "agent-relay-sdk";
|
|
25
25
|
import {
|
|
26
26
|
ValidationError,
|
|
27
|
-
flushDeferredLineageReport,
|
|
28
27
|
getAgent,
|
|
29
28
|
getMessage,
|
|
30
29
|
latestInboundMessage,
|
|
@@ -228,28 +227,18 @@ function prepareSendMessage(input: SendMessageInput, ctx: AuthContext, opts: Sen
|
|
|
228
227
|
return { receipt, suppressedParent: suppressResultsOnlyAck(input) };
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
/**
|
|
232
|
-
* #1037 — the child transitioned out of busy (idle/awaiting-input). Deliver its deferred turn-final
|
|
233
|
-
* report-up (a quiet child's last turn, held back so mid-work narration never reached the spawner)
|
|
234
|
-
* and fan it out over SSE. No-op when nothing was deferred. Driven off the bus turn-end edge.
|
|
235
|
-
*/
|
|
236
|
-
export function flushIdleLineageReport(childId: string): void {
|
|
237
|
-
const promoted = flushDeferredLineageReport(childId);
|
|
238
|
-
if (promoted?.created) emitNewMessages([promoted.message]);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
230
|
/** How far back the startup sweep re-scans for held-but-lost turn-final captures (#1040). A report
|
|
242
|
-
* is only ever
|
|
231
|
+
* is only ever held while its work window is open, so any capture lost across a restart is recent;
|
|
243
232
|
* a day is a generous ceiling that still bounds the scan. */
|
|
244
233
|
const LINEAGE_STARTUP_SWEEP_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
245
234
|
|
|
246
235
|
/**
|
|
247
|
-
* #1040 — startup re-promotion sweep.
|
|
248
|
-
*
|
|
249
|
-
* promotion for recent final response captures:
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
236
|
+
* #1040/#1084 — startup re-promotion sweep. The held-turn-final group (db/messages.ts) is an
|
|
237
|
+
* in-memory Map, so a relay restart drops it. The captures are persisted, though, so re-run
|
|
238
|
+
* promotion for recent final response captures: this just REBUILDS the held group (an
|
|
239
|
+
* already-forwarded capture is a no-op via its idempotency key; a `verbose` child's capture is
|
|
240
|
+
* delivered immediately, as it always is). Delivery to the spawner still only ever happens via an
|
|
241
|
+
* explicit work-finality signal (markAgentWorkFinal) — this sweep never flushes on its own.
|
|
253
242
|
*/
|
|
254
243
|
export function sweepDeferredLineageReportsOnStartup(now: number = Date.now()): { promoted: number; scanned: number } {
|
|
255
244
|
const captures = listRecentFinalResponseCaptures(now - LINEAGE_STARTUP_SWEEP_WINDOW_MS);
|
|
@@ -37,6 +37,7 @@ import { createCommand } from "../commands-db";
|
|
|
37
37
|
import { emitCommandEvent } from "../command-events";
|
|
38
38
|
import { listManagedOrchestratorsForAgent } from "../orchestrator-lookup";
|
|
39
39
|
import { emitActivityEvent, emitAgentStatus } from "../sse";
|
|
40
|
+
import { markAgentWorkFinal } from "./work-finality";
|
|
40
41
|
import { stringValue } from "agent-relay-sdk";
|
|
41
42
|
import type { AuthContext } from "./auth-context";
|
|
42
43
|
import type { AgentCard, Command } from "../types";
|
|
@@ -211,6 +212,11 @@ export function shutdownAgent(input: ShutdownAgentInput, ctx: AuthContext): Shut
|
|
|
211
212
|
},
|
|
212
213
|
});
|
|
213
214
|
emitCommandEvent(command, "command.requested");
|
|
215
|
+
// #1084 — an explicit shutdown is a platform-owned teardown signal: close the target's work
|
|
216
|
+
// window now rather than let a held final group die silently with the process. `edge-fallback`
|
|
217
|
+
// is the closest fit in the closed source enum — there is no cleaner workspace-ready/task-done
|
|
218
|
+
// signal backing an arbitrary teardown (which may target an agent with neither).
|
|
219
|
+
if (targetAgentId) markAgentWorkFinal(targetAgentId, "edge-fallback");
|
|
214
220
|
|
|
215
221
|
// Lifecycle indicator — uniform across transports. The MCP path previously skipped
|
|
216
222
|
// this, so an MCP-initiated shutdown left the agent with no "shutting down" signal in
|
|
@@ -44,6 +44,7 @@ import { emitRelayEvent } from "../events";
|
|
|
44
44
|
import { routeNotification } from "../notification-router";
|
|
45
45
|
import { isAgentExitDoneWhen, stageSatisfiesDoneWhen } from "./task-done-when";
|
|
46
46
|
import { autoSubscribeTaskCoordinator, emitTaskSemanticNotification, taskTransitionForStage, taskTransitionForStatus } from "./task-semantic-events";
|
|
47
|
+
import { markAgentWorkFinal } from "./work-finality";
|
|
47
48
|
|
|
48
49
|
type CreateTaskEntityInput = CreateDeliverableTaskInput & {
|
|
49
50
|
issueRefs?: string[];
|
|
@@ -140,6 +141,9 @@ export function setTaskEntityStatus(id: number, input: SetTaskStatusInput): Task
|
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
143
|
if (isTerminalTaskStatus(detail.status)) removeSubscriptionsForTask(detail.id);
|
|
144
|
+
// #1084 — a task reaching `done` is an explicit, platform-owned completion signal for its
|
|
145
|
+
// owning agent's work window: close it, forwarding only the held final group.
|
|
146
|
+
if (before?.status !== "done" && detail.status === "done") markAgentWorkFinal(detail.ownerAgentId, "task-done");
|
|
143
147
|
return detail;
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -8,6 +8,7 @@ import { relayToken } from "../config";
|
|
|
8
8
|
import { workspaceOwnerOrchestrator } from "../workspace-host";
|
|
9
9
|
import { TERMINAL_WORKSPACE_STATUSES } from "../workspace-phase";
|
|
10
10
|
import { finalizeEphemeralTasksOnReap } from "./task-entity";
|
|
11
|
+
import { markAgentWorkFinal } from "./work-finality";
|
|
11
12
|
import type { AgentCard, Command, WorkspaceGitState, WorkspaceRecord } from "../types";
|
|
12
13
|
|
|
13
14
|
// The single home for "dispose a transient/one-shot agent" — the canonical `agent.shutdown`
|
|
@@ -38,6 +39,10 @@ export function requestTransientAgentShutdown(agent: AgentCard, opts: TransientS
|
|
|
38
39
|
});
|
|
39
40
|
emitRelayEvent({ type: "command.requested", source: command.source, subject: command.id, data: { command } });
|
|
40
41
|
emitRelayEvent({ type: "agent.exited", source: "server", subject: agent.id, data: { agentId: agent.id, parent: agent.spawnedBy, reason: opts.reason, workspaceId: opts.workspaceId, workspaceStatus: opts.workspaceStatus } });
|
|
42
|
+
// #1084 — reaping a transient agent always follows a verified-complete land/idle-grace check
|
|
43
|
+
// (the caller only reaches here once `land.complete`/gates-passed holds), so it is a genuine
|
|
44
|
+
// teardown completion signal: close its work window, forwarding only the held final group.
|
|
45
|
+
markAgentWorkFinal(agent.id, "edge-fallback");
|
|
41
46
|
// #645 — persist a clean terminal marker so the #634 heartbeat-gap watchdog reads this benign
|
|
42
47
|
// completion as a terminus (not a silent death) once the reaped worker stops heartbeating.
|
|
43
48
|
recordTerminalEvent({ agentId: agent.id, reason: opts.reason, kind: "agent.exited", epoch: agent.epoch, createdAt: now });
|
|
@@ -67,6 +72,20 @@ export function resetTransientTrackerForTests(): void {
|
|
|
67
72
|
transientTracker.clear();
|
|
68
73
|
}
|
|
69
74
|
|
|
75
|
+
// #1084 HIGH crash-final-loss fix-forward — a persistent (or autonomous) worker never enters the
|
|
76
|
+
// transient reap path above (it keeps running; land-and-continue). Its held work-final ring would
|
|
77
|
+
// otherwise only ever flush on an eventual explicit teardown (shutdownAgent) — hours away, or never,
|
|
78
|
+
// for a long-lived agent that simply idles after reporting in. This mirrors the SAME idle-grace
|
|
79
|
+
// mechanics as the transient tracker (aligned on `transientGraceMs`, not trigger-happy: a coordinator
|
|
80
|
+
// steer resets the clock the moment the agent goes busy again, exactly like `transientTracker`), but
|
|
81
|
+
// only ever calls `markAgentWorkFinal` — it never shuts the agent down.
|
|
82
|
+
const persistentIdleFinalityMs = () => envMsOrDefault("AGENT_RELAY_PERSISTENT_IDLE_FINALITY_MS", 2 * 60 * 1000);
|
|
83
|
+
const persistentIdleTracker = new Map<string, { firstIdleAt: number; lastFlushedAt?: number }>();
|
|
84
|
+
|
|
85
|
+
export function resetPersistentIdleTrackerForTests(): void {
|
|
86
|
+
persistentIdleTracker.clear();
|
|
87
|
+
}
|
|
88
|
+
|
|
70
89
|
// How many commits the agent's branch has ahead of its base. Returns null when
|
|
71
90
|
// the check can't run (missing fields, host/probe failure) — callers treat null as
|
|
72
91
|
// "unknown" and preserve the safe #614 hold-pending bias: only 0 is fast-reaped.
|
|
@@ -234,9 +253,28 @@ export async function reapTransientAgents(): Promise<Record<string, unknown>> {
|
|
|
234
253
|
const now = Date.now();
|
|
235
254
|
const grace = transientGraceMs();
|
|
236
255
|
const maxLandWait = transientMaxLandWaitMs();
|
|
256
|
+
const persistentGrace = persistentIdleFinalityMs();
|
|
237
257
|
const seen = new Set<string>();
|
|
258
|
+
const seenPersistent = new Set<string>();
|
|
259
|
+
const persistentFinalsFlushed: string[] = [];
|
|
238
260
|
const reaped: string[] = [], held: string[] = [], waiting: string[] = [];
|
|
239
261
|
for (const agent of listAgents()) {
|
|
262
|
+
if (agent.lifecycle === "persistent") {
|
|
263
|
+
// No parent means no held ring can ever be flushed to anyone (flushWorkFinalReports
|
|
264
|
+
// requires a spawner) — skip tracking it at all rather than churn the map every scan.
|
|
265
|
+
if (!agent.spawnedBy) continue;
|
|
266
|
+
seenPersistent.add(agent.id);
|
|
267
|
+
if (reapProtected(agent)) { persistentIdleTracker.delete(agent.id); continue; }
|
|
268
|
+
if (completedProviderTurns(agent) === 0) { persistentIdleTracker.delete(agent.id); continue; }
|
|
269
|
+
const persistentEntry = persistentIdleTracker.get(agent.id) ?? { firstIdleAt: now };
|
|
270
|
+
persistentIdleTracker.set(agent.id, persistentEntry);
|
|
271
|
+
const persistentIdleForMs = now - persistentEntry.firstIdleAt;
|
|
272
|
+
if (persistentIdleForMs < persistentGrace || persistentEntry.lastFlushedAt) continue;
|
|
273
|
+
persistentEntry.lastFlushedAt = now;
|
|
274
|
+
markAgentWorkFinal(agent.id, "edge-fallback");
|
|
275
|
+
persistentFinalsFlushed.push(agent.id);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
240
278
|
if (agent.lifecycle !== "transient") continue;
|
|
241
279
|
seen.add(agent.id);
|
|
242
280
|
// A held agent (rate-limit hold #286, or any provider-blocked state) reads as
|
|
@@ -282,5 +320,6 @@ export async function reapTransientAgents(): Promise<Record<string, unknown>> {
|
|
|
282
320
|
reaped.push(agent.id);
|
|
283
321
|
}
|
|
284
322
|
for (const key of transientTracker.keys()) if (!seen.has(key)) transientTracker.delete(key);
|
|
285
|
-
|
|
323
|
+
for (const key of persistentIdleTracker.keys()) if (!seenPersistent.has(key)) persistentIdleTracker.delete(key);
|
|
324
|
+
return { scanned: seen.size, waiting, held, reaped, tracked: transientTracker.size, persistentFinalsFlushed };
|
|
286
325
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// #1084 (Part D of #1079) — the work-window finality service. A "work-final" is a RELAY-LEVEL
|
|
2
|
+
// mark anchored to explicit completion signals the platform already owns: `relay_workspace_ready`
|
|
3
|
+
// (src/mcp/tools-workspace.ts), a task's execution status reaching `done` (src/services/task-entity.ts),
|
|
4
|
+
// and agent teardown/reap (src/services/shutdown-agent.ts). It is deliberately NOT anchored to a
|
|
5
|
+
// per-turn busy→idle bus edge — that heuristic is exactly what produced the false-final flood this
|
|
6
|
+
// issue supersedes (#1078/#1058/#1032/#976): a child idling briefly between two subtasks is
|
|
7
|
+
// indistinguishable, on the wire, from a child that just finished.
|
|
8
|
+
//
|
|
9
|
+
// markAgentWorkFinal is the single entry point every anchor calls. It closes the child's held
|
|
10
|
+
// turn-final group (db/messages.ts flushWorkFinalReports) as ONE work-final unit and fans the
|
|
11
|
+
// result out over SSE: newly-forwarded chat reports as `message.new` (the coordinator's inbox), and
|
|
12
|
+
// the original already-rendered session captures as `message.finalized` (so a bubble the dashboard
|
|
13
|
+
// showed as ordinary mid-turn narration can be retroactively upgraded once its window closes).
|
|
14
|
+
import type { MessageWorkFinalitySource } from "agent-relay-sdk";
|
|
15
|
+
import { flushWorkFinalReports, type WorkFinalFlushResult } from "../db/messages.ts";
|
|
16
|
+
import { emitMessageFinalized, emitNewMessages } from "../sse.ts";
|
|
17
|
+
|
|
18
|
+
export function markAgentWorkFinal(agentId: string | undefined | null, source: MessageWorkFinalitySource): WorkFinalFlushResult {
|
|
19
|
+
if (!agentId) return { forwarded: [], finalizedOriginals: [] };
|
|
20
|
+
const result = flushWorkFinalReports(agentId, source);
|
|
21
|
+
const created = result.forwarded.filter((entry) => entry.created).map((entry) => entry.message);
|
|
22
|
+
if (created.length > 0) emitNewMessages(created);
|
|
23
|
+
for (const original of result.finalizedOriginals) emitMessageFinalized(original);
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{H as t,Jt as n,K as r,Yt as i,g as a,gr as o,mt as s,on as c,p as l,rr as u,tn as d}from"./lucide-react-CoU_Xts2.js";import{t as f}from"./store-zFLzd0Jd.js";import{d as p,g as m,m as h}from"./types-CRptbSYh.js";import{t as g}from"./badge-XEru6wto.js";import{t as _}from"./button-C3CQSr4p.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./index-0uIGXT14.js";var w=e(o(),1),T=u();function E(e){let t=h(),n=e.provider??``;return n&&n!==`any`&&t.includes(n)?n:t[0]??n}function D(e){if(Array.isArray(e))return e.map(D);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n===`files`&&Array.isArray(r)?t[n]=r.map(e=>{if(e&&typeof e==`object`&&typeof e.content==`string`){let t=e.content;return{...e,content:`<${t.length} chars elided>`}}return D(e)}):t[n]=D(r);return t}return e}function O({profile:e,open:t,onOpenChange:n}){let r=f(e=>e.apiCall),[i,a]=(0,w.useState)(()=>E(e)),[o,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[g,O]=(0,w.useState)(null),k=(0,w.useCallback)(async t=>{c(!0),u(null);try{O((await r(`GET`,`/agent-profiles/${encodeURIComponent(e.name)}/resolved?provider=${t}`)).profile)}catch(e){O(null),u(p(e))}finally{c(!1)}},[r,e.name]);(0,w.useEffect)(()=>{if(t){let t=E(e);a(t),k(t)}},[t,e,k]);function A(e){e!==i&&(a(e),k(e))}function j(){if(!g)return;let t=new Blob([JSON.stringify(g,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.name}.${i}.resolved.json`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}let M=g?JSON.stringify(D(g),null,2):``;return(0,T.jsx)(C,{open:t,onOpenChange:n,children:(0,T.jsxs)(b,{className:`max-w-3xl`,children:[(0,T.jsxs)(v,{children:[(0,T.jsxs)(x,{className:`font-mono text-sm`,children:[e.name,` — resolved projection`]}),(0,T.jsxs)(S,{children:[`The fully-resolved agent-profile projection (`,(0,T.jsx)(`code`,{children:`withResolvedProvisioning`}),`) for the selected provider. File contents are elided below; download the full JSON for the complete bundle.`]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Provider`}),(0,T.jsx)(`div`,{className:`flex items-center gap-1`,children:h().map(e=>(0,T.jsx)(_,{variant:e===i?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs`,disabled:o,onClick:()=>A(e),children:m(e)},e))}),(0,T.jsx)(`div`,{className:`flex-1`}),(0,T.jsxs)(_,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:o||!g,onClick:j,children:[(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),`Download full JSON`]})]}),(0,T.jsx)(`div`,{className:`min-h-[16rem] overflow-auto rounded-md border border-border bg-muted/30 p-3`,children:o?(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),`Resolving projection…`]}):l?(0,T.jsx)(`div`,{className:`text-xs text-destructive`,children:l}):g?(0,T.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed`,children:M}):(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No projection available.`})}),(0,T.jsx)(y,{children:(0,T.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>n(!1),children:`Close`})})]})})}var k={host:`text-emerald-400 bg-emerald-500/10`,minimal:`text-amber-400 bg-amber-500/10`,isolated:`text-red-400 bg-red-500/10`,vanilla:`text-fuchsia-400 bg-fuchsia-500/10`};function A({relay:e}){return(0,T.jsx)(`div`,{className:`flex items-center gap-1`,children:[{key:`ctx`,on:e.context},{key:`skl`,on:e.skills},{key:`plg`,on:e.plugins},{key:`stl`,on:e.statusLine}].map(e=>(0,T.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.on?`bg-emerald-400`:`bg-muted-foreground/30`}`,title:`${e.key}: ${e.on?`on`:`off`}`},e.key))})}function j({profile:e}){let t=f(e=>e.openProfileModal),o=f(e=>e.deleteProfile),s=e.builtIn===!0,[l,u]=(0,w.useState)(!1);return(0,T.jsxs)(`div`,{className:`group flex flex-col gap-3 rounded-lg border border-border bg-card p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":!0,children:e.icon?.trim()||`•`}),(0,T.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),s&&(0,T.jsx)(g,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`}),e.overridden&&(0,T.jsx)(g,{variant:`outline`,className:`text-[10px] border-amber-500/30 bg-amber-500/10 text-amber-400`,children:`Overridden`})]}),e.description&&(0,T.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity`,children:[(0,T.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`View`,onClick:()=>t(`view`,e),children:(0,T.jsx)(i,{className:`h-3.5 w-3.5`})}),(0,T.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Edit`,onClick:()=>t(`edit`,e),children:(0,T.jsx)(r,{className:`h-3.5 w-3.5`})}),(0,T.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Duplicate`,onClick:()=>t(`duplicate`,e),children:(0,T.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,T.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Resolved projection`,onClick:()=>u(!0),children:(0,T.jsx)(n,{className:`h-3.5 w-3.5`})}),(!s||e.overridden)&&(0,T.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 text-destructive`,title:s?`Reset to default`:`Delete`,onClick:()=>o(e),children:(0,T.jsx)(a,{className:`h-3.5 w-3.5`})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,T.jsx)(g,{variant:`outline`,className:k[e.base]||``,children:e.base}),(0,T.jsx)(g,{variant:`outline`,children:e.provider||`any`}),(0,T.jsxs)(g,{variant:`outline`,children:[`fs: `,e.permissions.filesystem]}),e.permissions.mode&&(0,T.jsx)(g,{variant:`outline`,children:e.permissions.mode})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Relay `,(0,T.jsx)(A,{relay:e.relay})]}),(0,T.jsxs)(`span`,{children:[`MCP: `,e.mcp.mode]}),(0,T.jsxs)(`span`,{children:[`Hooks: `,e.hooks.mode]}),e.instructions.globalInstructions===`ignore`&&(0,T.jsx)(`span`,{className:`text-amber-400`,children:`global: ignore`}),Object.keys(e.env||{}).length>0&&(0,T.jsxs)(`span`,{children:[Object.keys(e.env).length,` env vars`]})]}),(0,T.jsx)(O,{profile:e,open:l,onOpenChange:u})]})}function M(){let e=f(e=>e.agentProfiles),n=f(e=>e.openProfileModal),r=e.filter(e=>e.builtIn),i=e.filter(e=>!e.builtIn);return(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,T.jsx)(l,{className:`h-5 w-5 text-primary`}),`Agent Profiles`]}),(0,T.jsx)(g,{variant:`outline`,children:e.length}),(0,T.jsx)(`div`,{className:`flex-1`}),(0,T.jsxs)(_,{size:`sm`,className:`gap-1`,onClick:()=>n(`create`),children:[(0,T.jsx)(t,{className:`h-3.5 w-3.5`}),`Create Profile`]})]}),r.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Built-in`}),(0,T.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,T.jsx)(j,{profile:e},e.name))})]}),i.length>0&&(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Custom`}),(0,T.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(e=>(0,T.jsx)(j,{profile:e},e.name))})]}),e.length===0&&(0,T.jsx)(`div`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`No agent profiles found. Create one to configure agent behavior.`})]})}export{M as AgentProfilesView};
|
|
2
|
-
//# sourceMappingURL=agent-profiles-DXysA9To.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,A as n,B as r,C as i,Cn as a,En as o,Ft as s,Gn as c,H as l,Hn as u,Ht as d,K as f,Qt as p,Rn as m,Sn as h,Tn as g,Wt as _,Xn as v,Y as y,Yt as b,Zn as x,_ as S,a as C,an as w,c as T,cr as E,et as D,gr as O,gt as ee,ir as te,j as ne,jt as re,l as ie,lt as ae,mn as oe,mr as se,mt as ce,ot as le,qn as ue,r as de,rr as fe,rt as pe,tn as me,tr as he,tt as ge,ut as _e,v as ve,wn as k,xn as ye,zt as be}from"./lucide-react-CoU_Xts2.js";import{t as xe}from"./react-dom-BQICbUuF.js";import{a as Se,b as Ce,g as we,o as Te,p as Ee,s as De,t as A,v as Oe,y as ke}from"./store-zFLzd0Jd.js";import{_ as Ae,g as je,m as Me,s as Ne}from"./types-CRptbSYh.js";import{A as Pe,E as Fe,K as Ie,M as Le,W as Re,X as ze,Y as Be,Z as Ve,a as He,d as j,h as Ue,k as We,o as Ge,q as Ke,r as qe,v as Je,z as Ye}from"./display-GFbGUG0O.js";import{t as Xe}from"./badge-XEru6wto.js";import{t as M}from"./button-C3CQSr4p.js";import{t as Ze}from"./input-CXMbJ848.js";import{t as Qe}from"./copy-button-Bil2CjzT.js";import{t as $e}from"./agent-type-icon-BxUopALO.js";import{t as et}from"./formatted-body-BYQ-SPtj.js";import{B as tt,C as nt,F as rt,H as it,K as at,L as ot,N as st,O as ct,Ot as lt,R as ut,S as dt,T as ft,V as pt,W as mt,_ as ht,_t as gt,at as _t,b as vt,c as yt,ct as bt,d as xt,et as St,f as Ct,g as wt,gt as Tt,h as Et,ht as Dt,it as Ot,k as kt,lt as At,m as jt,mt as Mt,n as Nt,nt as Pt,o as Ft,ot as It,p as Lt,pt as Rt,s as zt,st as Bt,t as Vt,u as Ht,ut as Ut,v as Wt,w as Gt,x as Kt,xt as qt,y as Jt}from"./index-0uIGXT14.js";import{t as Yt}from"./use-keyboard-viewport-CAa7IQTm.js";import{t as Xt}from"./MessageBubble-SQK8-Mzp.js";import{i as Zt,n as Qt,r as $t,t as en}from"./branch-state-badge-Mf0Ow77K.js";import{n as tn,r as nn,t as rn}from"./PlanGraphPanel-CS-aow4S.js";var N=e(O(),1);function an(e,t,n,r,i){if(i.includes(e))return!1;if(r.includes(e)||n)return!0;let a=t[e];return!!(a&&Ne(a.spawnedBy??``))}function on(){let e=A(e=>e.agents),t=A(e=>e.agentsById),n=A(e=>e.showBuiltIns),r=A(e=>e.showOffline),i=A(e=>e.chatAgentSearch),a=A(e=>e.chatAgentProviderFilter),o=A(e=>e.chatAgentStatusFilter),s=A(e=>e.chatAgentTagFilter),c=A(e=>e.chatAgentCapFilter),l=A(e=>e.chatAgentHostFilter),u=A(e=>e.chatAgentSort),d=A(e=>e.chatAgentSortDir),f=A(e=>e.managedPolicies),p=A(e=>e.feedObserveAll),m=A(e=>e.coordinatorFollows),h=A(e=>e.coordinatorMutes),g=qt();return(0,N.useMemo)(()=>{let _=new Set(g.map(e=>e.peer)),v=ze(e,n,f);if(r||(v=v.filter(e=>e.status!==`offline`)),v=p?v.filter(e=>!h.includes(e.id)):v.filter(e=>an(e.id,t,_.has(e.id),m,h)),i){let e=i.toLowerCase();v=v.filter(t=>t.id.toLowerCase().includes(e)||(t.name||``).toLowerCase().includes(e)||(t.label||``).toLowerCase().includes(e)||(t.tags||[]).some(t=>t.toLowerCase().includes(e))||(t.capabilities||[]).some(t=>t.toLowerCase().includes(e)))}a&&(v=v.filter(e=>Ge(e)===a)),o&&(v=v.filter(e=>e.status===o)),s&&(v=v.filter(e=>(e.tags||[]).includes(s))),c&&(v=v.filter(e=>(e.capabilities||[]).includes(c))),l&&(v=v.filter(e=>(e.machine||``)===l));let y=d===`desc`?-1:1;return[...v].sort((e,t)=>u===`name`?j(e).localeCompare(j(t))*y:u===`lastSeen`?ct(Ke(e.lastSeen),Ke(t.lastSeen),y)||j(e).localeCompare(j(t)):((Ve[e.status]??9)-(Ve[t.status]??9))*y||j(e).localeCompare(j(t)))},[e,t,n,r,f,i,a,o,s,c,l,u,d,p,m,h,g])}var P=fe(),sn=[{re:/`([^`]+)`/,recurse:!1,wrap:(e,t)=>(0,P.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-[0.9em]`,children:e},t)},{re:/\*\*([^*]+)\*\*/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`strong`,{className:`font-semibold text-foreground/90`,children:e},t)},{re:/__([^_]+)__/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`strong`,{className:`font-semibold text-foreground/90`,children:e},t)},{re:/~~([^~]+)~~/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`s`,{children:e},t)},{re:/\*([^*]+)\*/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`em`,{children:e},t)},{re:/_([^_]+)_/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`em`,{children:e},t)},{re:/\[([^\]]+)\]\([^)]+\)/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`span`,{className:`underline decoration-dotted underline-offset-2`,children:e},t)}];function cn(e,t=`i`){let n=null;for(let t of sn){let r=t.re.exec(e);r&&r[1]&&(n===null||r.index<n.index)&&(n={index:r.index,length:r[0].length,inner:r[1],pattern:t})}if(!n)return[e];let r=[];n.index>0&&r.push(e.slice(0,n.index));let i=n.pattern.recurse?cn(n.inner,`${t}x`):n.inner;r.push(n.pattern.wrap(i,`${t}m`));let a=e.slice(n.index+n.length);return a&&r.push(...cn(a,`${t}r`)),r}function ln({threads:e,onSelectAgent:t}){let n=A(e=>e.set),r=A(e=>e.openInboxThread),o=A(e=>e.openAgentSpawn),d=A(e=>e.selectedInboxThread),f=A(e=>e.chatAgentSearch),p=A(e=>e.chatAgentSort),_=A(e=>e.chatAgentSortDir),y=A(e=>e.chatAgentProviderFilter),x=A(e=>e.chatAgentStatusFilter),S=A(e=>e.chatAgentTagFilter),C=A(e=>e.chatAgentCapFilter),T=A(e=>e.chatAgentHostFilter),E=A(e=>e.chatAgentGroupBy),D=A(e=>e.chatAgentFiltersCollapsed),O=A(e=>e.agentsById),ee=A(e=>e.chatCollapsedChildren),te=A(e=>e.toggleChatChildrenCollapsed),re=A(e=>e.feedObserveAll),ie=A(e=>e.setFeedObserveAll),ae=A(e=>e.coordinatorFollows),oe=A(e=>e.coordinatorMutes),se=A(e=>e.toggleCoordinatorFollow),ce=A(e=>e.toggleCoordinatorMute),le=Ee(),ue=on(),de=(0,N.useMemo)(()=>new Set(ee),[ee]),fe=(0,N.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.peer,n);return t},[e]),pe=(0,N.useMemo)(()=>{if(p!==`lastMessage`)return ue;let e=_===`desc`?-1:1;return[...ue].sort((t,n)=>ct(it(fe.get(t.id)),it(fe.get(n.id)),e)||j(t).localeCompare(j(n)))},[ue,p,_,fe]),me=(0,N.useMemo)(()=>[...new Set(ue.flatMap(e=>e.tags||[]))],[ue]),ge=(0,N.useMemo)(()=>[...new Set(ue.flatMap(e=>Be(e.capabilities||[])))],[ue]),_e=lt(),k=(0,N.useMemo)(()=>{if(E!==`project`)return null;let e=new Map;for(let t of pe){let n=It(t)||`No project`,r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[pe,E]),be=[y,x,S,C,T].filter(Boolean).length,xe=(0,N.useMemo)(()=>at(pe,O,le),[pe,O,le]);function Se(e){r(e,fe.get(e)?.messages),t?.(e)}function Ce(e){let{agent:t}=e;if(e.depth===1&&e.parent&&de.has(e.parent.id))return null;let n=fe.get(t.id),r=n?.attention.unread||0,i=qe(t),o=n?.previewMessage,s=st(n)||it(n),c=d===t.id,l=Bt(t),f=It(t),p=l.Icon,m=e.parent?j(e.parent):t.spawnedBy,h=e.children.length,_=e.depth===0&&h>0,v=de.has(t.id),y=oe.includes(t.id),b=ae.includes(t.id);return(0,P.jsxs)(`li`,{className:he(`relative group`,e.depth===1&&`pl-4`),children:[e.depth===1&&(0,P.jsx)(`div`,{className:`absolute left-2 top-3.5 text-muted-foreground/55`,children:(0,P.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,P.jsxs)(`div`,{className:`absolute right-1.5 top-1.5 z-10 hidden items-center gap-0.5 rounded-md border border-border/60 bg-popover/95 px-0.5 py-0.5 shadow-sm backdrop-blur-sm group-hover:flex`,children:[(0,P.jsx)(`button`,{type:`button`,title:b?`Unfollow (stop pinning into scoped view)`:`Follow (keep visible even in scoped view)`,onClick:e=>{e.stopPropagation(),se(t.id)},className:he(`rounded p-1 transition-colors`,b?`text-primary bg-primary/15 hover:bg-primary/25`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:(0,P.jsx)(ve,{className:`h-3 w-3`})}),(0,P.jsx)(`button`,{type:`button`,title:y?`Unmute`:`Mute (hide from all views)`,onClick:e=>{e.stopPropagation(),ce(t.id)},className:he(`rounded p-1 transition-colors`,y?`text-orange-400 bg-orange-500/15 hover:bg-orange-500/25`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:(0,P.jsx)(u,{className:`h-3 w-3`})})]}),(0,P.jsxs)(`button`,{className:he(`w-full text-left px-3 py-2.5 flex items-start gap-2.5 hover:bg-muted/50 transition-colors border-b border-border/50`,e.depth===1&&`bg-muted/15`,c&&`bg-muted/60`,y&&`opacity-50`),onClick:()=>Se(t.id),children:[(0,P.jsxs)(`div`,{className:`relative shrink-0 mt-0.5`,children:[(0,P.jsx)($e,{agent:t}),(0,P.jsx)(bt,{agent:t,now:le,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-1 mb-0.5`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0`,children:[(0,P.jsx)(Qt,{profile:$t(t),className:`text-xs shrink-0`}),(0,P.jsx)(`span`,{className:`text-xs font-medium truncate`,children:j(t)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 transition-opacity group-hover:opacity-0`,children:[b&&(0,P.jsx)(ve,{className:`h-3 w-3 text-primary`,"aria-label":`Followed`}),s>0&&(0,P.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,title:Ue(s),children:Ie(le,s)}),r>0&&(0,P.jsx)(Xe,{className:`bg-red-500 text-white text-[11px] font-semibold leading-none tabular-nums min-w-[18px] h-[18px] flex items-center justify-center shrink-0 px-1 rounded-full`,children:r}),!r&&i&&(0,P.jsx)(Xe,{className:`bg-amber-500 text-black min-w-[18px] h-[18px] flex items-center justify-center shrink-0 px-1 rounded-full`,title:`Needs response`,children:(0,P.jsx)(ye,{className:`h-3 w-3`})})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{title:l.title,className:`inline-flex shrink-0`,children:(0,P.jsx)(p,{className:he(`h-3 w-3`,l.iconColor)})}),(0,P.jsx)(`span`,{className:`truncate`,children:f||l.label}),_t(t)&&(0,P.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,P.jsx)(Ot,{context:t.context,expected:!0,size:18})})]}),e.depth===0&&t.spawnedBy&&m&&(0,P.jsx)(`div`,{className:`mb-0.5`,children:(0,P.jsx)(Xe,{variant:`outline`,className:`max-w-full text-[9px] h-4 px-1.5 text-muted-foreground`,children:(0,P.jsxs)(`span`,{className:`truncate`,children:[`spawned by `,m]})})}),o&&(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:[o.from===`user`?`You: `:``,cn(Le(o).replace(/\s+/g,` `))]})]})]}),_&&(0,P.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),te(t.id)},className:`flex w-full items-center gap-1.5 border-b border-border/50 bg-muted/20 py-1 pl-8 pr-3 text-[10px] text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground`,"aria-expanded":!v,title:v?`Show ${h} child ${h===1?`agent`:`agents`}`:`Hide children`,children:[v?(0,P.jsx)(a,{className:`h-3.5 w-3.5 shrink-0`}):(0,P.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`}),(0,P.jsxs)(`span`,{className:`font-medium`,children:[h,` child `,h===1?`agent`:`agents`]})]})]},t.id)}return(0,P.jsxs)(`div`,{className:`flex flex-col h-full border-r border-border min-w-0`,children:[(0,P.jsxs)(`div`,{className:`p-3 border-b border-border space-y-2`,children:[(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(ne,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none`}),(0,P.jsx)(Ze,{placeholder:`Search agents...`,value:f,onChange:e=>n({chatAgentSearch:e.target.value}),className:`pl-8 h-7 text-xs`})]}),(0,P.jsxs)(`div`,{className:`flex h-7 items-center rounded-md border border-border bg-background p-0.5 text-xs`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ie(!1),title:`Show only conversations where you're in the audience (agents you spawned or messaged)`,"aria-pressed":!re,className:he(`flex h-full flex-1 items-center justify-center gap-1.5 rounded-[5px] transition-colors`,re?`text-muted-foreground hover:text-foreground`:`bg-primary/15 text-primary font-medium`),children:[(0,P.jsx)(s,{className:`h-3.5 w-3.5`}),`Scoped`]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ie(!0),title:`Show every agent conversation, including agent-to-agent chatter`,"aria-pressed":re,className:he(`flex h-full flex-1 items-center justify-center gap-1.5 rounded-[5px] transition-colors`,re?`bg-primary/15 text-primary font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(b,{className:`h-3.5 w-3.5`}),`All`]})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n({chatAgentFiltersCollapsed:!D}),className:`sm:hidden flex w-full items-center justify-between h-6 px-1.5 text-xs rounded-md border border-border bg-background text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,P.jsx)(i,{className:`w-3.5 h-3.5`}),`Filters & sort`,be>0&&(0,P.jsx)(Xe,{className:`bg-primary/20 text-primary text-[10px] h-4 min-w-4 px-1 flex items-center justify-center`,children:be})]}),D?(0,P.jsx)(g,{className:`w-3.5 h-3.5`}):(0,P.jsx)(h,{className:`w-3.5 h-3.5`})]}),(0,P.jsxs)(`div`,{className:he(`space-y-2`,D?`hidden`:`block`,`sm:block`),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,P.jsxs)(`select`,{value:p,onChange:e=>n({chatAgentSort:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:`status`,children:`By status`}),(0,P.jsx)(`option`,{value:`name`,children:`By name`}),(0,P.jsx)(`option`,{value:`lastSeen`,children:`By last seen`}),(0,P.jsx)(`option`,{value:`lastMessage`,children:`By last activity`})]}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-xs`,onClick:()=>n({chatAgentSortDir:_===`asc`?`desc`:`asc`}),children:_===`asc`?(0,P.jsx)(c,{className:`w-3.5 h-3.5`}):(0,P.jsx)(v,{className:`w-3.5 h-3.5`})})]}),(0,P.jsxs)(`select`,{value:E,onChange:e=>n({chatAgentGroupBy:e.target.value}),className:`w-full h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`No grouping`}),(0,P.jsx)(`option`,{value:`project`,children:`Group by project`})]}),(0,P.jsxs)(`div`,{className:`flex gap-1`,children:[(0,P.jsxs)(`select`,{value:y,onChange:e=>n({chatAgentProviderFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All types`}),Me().map(e=>(0,P.jsx)(`option`,{value:e,children:je(e)},e)),(0,P.jsx)(`option`,{value:`agent`,children:`Agent`}),(0,P.jsx)(`option`,{value:`user`,children:`User`})]}),(0,P.jsxs)(`select`,{value:x,onChange:e=>n({chatAgentStatusFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All status`}),(0,P.jsx)(`option`,{value:`online`,children:`Online`}),(0,P.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,P.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,P.jsx)(`option`,{value:`offline`,children:`Offline`})]}),_e.length>1&&(0,P.jsxs)(`select`,{value:T,onChange:e=>n({chatAgentHostFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All hosts`}),_e.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]}),(me.length>0||ge.length>0)&&(0,P.jsxs)(`div`,{className:`flex gap-1`,children:[me.length>0&&(0,P.jsxs)(`select`,{value:S,onChange:e=>n({chatAgentTagFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All tags`}),me.map(e=>(0,P.jsxs)(`option`,{value:e,children:[`#`,e]},e))]}),ge.length>0&&(0,P.jsxs)(`select`,{value:C,onChange:e=>n({chatAgentCapFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All caps`}),ge.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2.5 border-b border-border px-3 py-2 text-left transition-colors hover:bg-muted/50`,onClick:o,children:[(0,P.jsx)(`div`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-dashed border-primary/50 bg-primary/10 text-primary`,children:(0,P.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`text-xs font-medium`,children:`New Agent`}),(0,P.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:`Spawn a fresh chat agent`})]})]}),(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:pe.length===0?!re&&!f&&be===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center px-6`,children:[(0,P.jsx)(ve,{className:`w-8 h-8 text-muted-foreground/40 mb-3`}),(0,P.jsx)(`p`,{className:`text-xs font-medium text-foreground/80`,children:`No conversations in your audience`}),(0,P.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Agents you spawn or message show up here.`}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ie(!0),className:`mt-3 inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground`,children:[(0,P.jsx)(b,{className:`h-3.5 w-3.5`}),` Show all agents`]})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center px-4`,children:[(0,P.jsx)(m,{className:`w-8 h-8 text-muted-foreground/40 mb-2`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agents match filters`})]}):k?k.map(([e,t])=>(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-1.5 border-b border-border/50 bg-background/95 px-3 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground backdrop-blur`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:e}),(0,P.jsx)(`span`,{className:`text-muted-foreground/50`,children:t.length})]}),(0,P.jsx)(`ul`,{children:at(t,O,le).map(Ce)})]},e)):(0,P.jsx)(`ul`,{children:xe.map(Ce)})})]})}var un=[{name:`/reply`,source:`skill`,description:`Reply to a relay message by id`,argumentHint:`<messageId> <body>`},{name:`/message`,source:`skill`,description:`Send a relay message to an agent, label, tag, or broadcast`,argumentHint:`<target> <body>`},{name:`/pair`,source:`skill`,description:`Start or manage a two-agent pair session`},{name:`/react`,source:`skill`,description:`Add a reaction to a relay message`,argumentHint:`<messageId> <emoji>`},{name:`/read-message`,source:`skill`,description:`Fetch a full relay message by id`,argumentHint:`<messageId>`},{name:`/send-claimable`,source:`skill`,description:`Enqueue a claimable work item for one agent to claim`},{name:`/status`,source:`skill`,description:`Show this agent's relay status`},{name:`/tags`,source:`skill`,description:`List or update this agent's relay tags`},{name:`/label`,source:`skill`,description:`Read, set, or clear this agent's relay label`},{name:`/disconnect`,source:`skill`,description:`End the current relay pair session`}],dn={"/clear":{description:`Clear conversation history and free up context`},"/compact":{description:`Compact the conversation to reclaim context`,argumentHint:`[instructions]`},"/model":{description:`Switch the active model`,argumentHint:`[model]`},"/help":{description:`Show help`},"/new":{description:`Start a new thread`}};function fn(e){return[...((e?Ae(e):void 0)?.slashCommands??[]).map(e=>({name:e,source:`builtin`,...dn[e]})),...un]}function pn({agentId:e,className:t}){let n=A(t=>t.presenceByAgent[e]),r=A(e=>e.usersById),i=se(),a=(n??[]).filter(e=>e.clientId!==i);if(a.length===0)return null;let o=Array.from(new Set(a.map(e=>Je(e.userId,r)))),s=a.some(e=>e.typing),c=o.length===1?o[0]:`${o.length} viewers`,l=s?f:b;return(0,P.jsxs)(`span`,{title:`${o.join(`, `)}${s?` · typing`:` · viewing`}`,className:he(`inline-flex items-center gap-1 rounded-full bg-muted/40 px-2 py-0.5 text-[11px] text-muted-foreground`,t),children:[(0,P.jsx)(l,{className:he(`h-3 w-3 shrink-0`,s&&`text-emerald-400`)}),(0,P.jsxs)(`span`,{className:`truncate max-w-[12ch]`,children:[c,s&&o.length===1?` is typing…`:``]})]})}function mn({selectedInboxThread:e,agent:n,now:i,blockedState:a,thread:o,exportableThread:s,importedHistory:c,showBackButton:l,onBack:u,openAgentDetail:f,openWorkspaceFocus:m,voiceTtsEnabled:h,setVoiceTtsEnabled:g,canOpenTerminal:_,terminalOpening:v,handleOpenTerminal:y,canInterrupt:b,interruptAgent:x,canCompact:C,canClearContext:w,canShutdown:E,openConfirm:O,workspaceAction:ee,doAgentAction:te,openFilesForAgent:se,forkFromAgent:ce,markInboxThreadUnread:le,markInboxThreadRead:de,exportThread:fe,onOpenSearch:pe}){return(0,P.jsxs)(`div`,{className:`flex items-center justify-between px-3 md:px-4 py-2.5 md:py-3 border-b border-border shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 md:gap-2.5 min-w-0`,children:[l&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,onClick:u,className:`shrink-0 -ml-1`,children:(0,P.jsx)(ue,{className:`w-4 h-4`})}),(0,P.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 md:gap-2.5 min-w-0 hover:opacity-80 transition-opacity`,onClick:()=>n&&f(n),disabled:!n,children:[(0,P.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,P.jsx)($e,{agent:n}),(0,P.jsx)(bt,{agent:n,now:i,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,P.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,P.jsxs)(`p`,{className:`flex items-center gap-1 text-sm font-medium truncate`,children:[n&&(0,P.jsx)(Qt,{profile:$t(n),className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n?j(n):e})]}),n&&(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[a?`blocked: ${a.label}`:n.status,n.machine&&` · ${n.machine}`,typeof n.meta?.cwd==`string`&&n.meta.cwd&&` · ${Re(n.meta.cwd,1)}`]})]})]}),n&&(0,P.jsx)(Pt,{agent:n,compact:!0,className:`hidden @4xl/chat:flex shrink-0`}),n&&_t(n)&&(0,P.jsx)(Ot,{context:n.context,expected:!0}),n?.branchState&&n.branchWorkspaceId&&(0,P.jsx)(en,{state:n.branchState,className:`shrink-0`,onClick:()=>void m(n.branchWorkspaceId)}),o?.attention.unread?(0,P.jsxs)(Xe,{className:`bg-red-500/20 text-red-400 text-xs shrink-0 hidden @2xl/chat:flex`,children:[o.attention.unread,` unread`]}):null,n&&(0,P.jsx)(pn,{agentId:n.id,className:`shrink-0 hidden @3xl/chat:inline-flex`})]}),(0,P.jsx)(`div`,{className:`flex items-center gap-0.5 md:gap-1 shrink-0`,children:n&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Qe,{value:n.id,label:`Copy agent ID`,size:`icon-sm`}),pe&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Search this chat`,onClick:pe,children:(0,P.jsx)(ne,{className:`w-3.5 h-3.5`})}),Ce.available&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:h?`Speaking agent responses aloud — click to mute (engine & voice in Settings)`:`Speak agent responses aloud (active chat) — engine & voice in Settings`,className:h?`text-primary`:``,onClick:()=>g(!h),children:h?(0,P.jsx)(ie,{className:`w-3.5 h-3.5`}):(0,P.jsx)(T,{className:`w-3.5 h-3.5`})}),_&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,disabled:v,title:`Terminal`,onClick:()=>void y(),children:(0,P.jsx)(S,{className:`w-3.5 h-3.5`})}),b&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-red-400 hover:text-red-300`,title:`Interrupt`,onClick:x,children:(0,P.jsx)(oe,{className:`w-3.5 h-3.5`})}),(n.branchState===`changes`||n.branchState===`idle`)&&n.branchWorkspaceId&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex text-amber-400 hover:text-amber-300`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>O(`Mark Workspace Ready`,`Mark ${j(n)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>ee(n.branchWorkspaceId,`ready`)),children:(0,P.jsx)(d,{className:`w-3.5 h-3.5`})}),C&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Compact`,onClick:()=>O(`Compact Agent`,`Compact context for ${j(n)}?`,()=>te(n,`compact`)),children:(0,P.jsx)(D,{className:`w-3.5 h-3.5`})}),w&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Clear context`,onClick:()=>O(`Clear Context`,`Clear context for ${j(n)}?`,()=>te(n,`clearContext`)),children:(0,P.jsx)(p,{className:`w-3.5 h-3.5`})}),E&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Shutdown`,onClick:()=>O(`Shutdown Agent`,`Shutdown ${j(n)}?`,()=>te(n,`shutdown`)),children:(0,P.jsx)(r,{className:`w-3.5 h-3.5`})}),n&&typeof n.meta?.cwd==`string`&&n.meta.cwd&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Open ${n.meta.cwd} in Files`,onClick:()=>void se(n),children:(0,P.jsx)(be,{className:`w-3.5 h-3.5`})}),n&&o&&o.messages.length>0&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Fork — spawn new agent with this chat history`,onClick:()=>ce(n.id,o.messages),children:(0,P.jsx)(re,{className:`w-3.5 h-3.5`})}),o&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark unread`,onClick:()=>le(e),children:(0,P.jsx)(ae,{className:`w-3.5 h-3.5`})}),o&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark read`,onClick:()=>de(o.peer,o.messages),children:(0,P.jsx)(_e,{className:`w-3.5 h-3.5`})}),s&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Export thread`,onClick:()=>fe({...s,importedHistory:c},`json`),children:(0,P.jsx)(me,{className:`w-3.5 h-3.5`})}),(0,P.jsxs)(Rt,{children:[(0,P.jsx)(gt,{asChild:!0,children:(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`@4xl/chat:hidden`,children:(0,P.jsx)(t,{className:`w-3.5 h-3.5`})})}),(0,P.jsxs)(Mt,{align:`end`,children:[_&&(0,P.jsxs)(Dt,{disabled:v,onClick:()=>void y(),children:[(0,P.jsx)(S,{className:`w-3.5 h-3.5`}),`Terminal`]}),b&&(0,P.jsxs)(Dt,{onClick:x,children:[(0,P.jsx)(oe,{className:`w-3.5 h-3.5`}),`Interrupt`]}),(n.branchState===`changes`||n.branchState===`idle`)&&n.branchWorkspaceId&&(0,P.jsxs)(Dt,{onClick:()=>O(`Mark Workspace Ready`,`Mark ${j(n)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>ee(n.branchWorkspaceId,`ready`)),children:[(0,P.jsx)(d,{className:`w-3.5 h-3.5`}),`Mark Ready`]}),C&&(0,P.jsxs)(Dt,{onClick:()=>O(`Compact Agent`,`Compact context for ${j(n)}?`,()=>te(n,`compact`)),children:[(0,P.jsx)(D,{className:`w-3.5 h-3.5`}),`Compact`]}),w&&(0,P.jsxs)(Dt,{onClick:()=>O(`Clear Context`,`Clear context for ${j(n)}?`,()=>te(n,`clearContext`)),children:[(0,P.jsx)(p,{className:`w-3.5 h-3.5`}),`Clear Context`]}),E&&(0,P.jsxs)(Dt,{onClick:()=>O(`Shutdown Agent`,`Shutdown ${j(n)}?`,()=>te(n,`shutdown`)),children:[(0,P.jsx)(r,{className:`w-3.5 h-3.5`}),`Shutdown`]}),n&&typeof n.meta?.cwd==`string`&&n.meta.cwd&&(0,P.jsxs)(Dt,{onClick:()=>void se(n),children:[(0,P.jsx)(be,{className:`w-3.5 h-3.5`}),`Open Files`]}),n&&o&&o.messages.length>0&&(0,P.jsxs)(Dt,{onClick:()=>ce(n.id,o.messages),children:[(0,P.jsx)(re,{className:`w-3.5 h-3.5`}),`Fork`]}),(_||C||w||E)&&(0,P.jsx)(Tt,{}),o&&(0,P.jsxs)(Dt,{onClick:()=>le(e),children:[(0,P.jsx)(ae,{className:`w-3.5 h-3.5`}),`Mark Unread`]}),o&&(0,P.jsxs)(Dt,{onClick:()=>de(o.peer,o.messages),children:[(0,P.jsx)(_e,{className:`w-3.5 h-3.5`}),`Mark Read`]}),s&&(0,P.jsxs)(Dt,{onClick:()=>fe({...s,importedHistory:c},`json`),children:[(0,P.jsx)(me,{className:`w-3.5 h-3.5`}),`Download`]})]})]})]})})]})}function hn({query:e,position:t,total:n,onQueryChange:r,onNext:i,onPrev:a,onClose:o}){let s=(0,N.useRef)(null),c=e.trim().length>0,l=c&&n===0;function u(e){if(e.key===`Escape`){e.preventDefault(),o();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?a():i())}return(0,P.jsxs)(`section`,{className:`flex shrink-0 items-center gap-2 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(ne,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(Ze,{ref:s,autoFocus:!0,value:e,onChange:e=>r(e.target.value),onKeyDown:u,placeholder:`Search this chat…`,"aria-label":`Search this chat`,className:`h-7 flex-1 text-sm`}),(0,P.jsx)(`span`,{className:`shrink-0 tabular-nums text-xs `+(l?`text-red-400`:`text-muted-foreground`),children:c?l?`No results`:`${t}/${n}`:``}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Previous match (Shift+Enter)`,disabled:n===0,onClick:a,children:(0,P.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Next match (Enter)`,disabled:n===0,onClick:i,children:(0,P.jsx)(g,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Close search (Esc)`,onClick:o,children:(0,P.jsx)(C,{className:`h-3.5 w-3.5`})})]})]})}function gn({matches:e,activeIndex:t,onAccept:n,onHover:r}){return e.length===0?null:(0,P.jsx)(`div`,{className:`absolute bottom-full left-3 right-3 md:left-4 md:right-4 mb-2 z-20 max-h-64 overflow-auto rounded-xl border border-border bg-popover shadow-lg`,children:e.map((e,i)=>(0,P.jsxs)(`button`,{onMouseDown:t=>{t.preventDefault(),n(e)},onMouseEnter:()=>r(i),className:he(`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm`,i===t?`bg-accent`:`hover:bg-accent/50`),children:[(0,P.jsx)(`span`,{className:`font-medium shrink-0`,children:e.name}),e.argumentHint&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e.argumentHint}),e.description&&(0,P.jsx)(`span`,{className:`ml-auto truncate text-xs text-muted-foreground/70`,children:e.description})]},e.name))})}function _n({value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:i,className:a}){let o=(0,N.useRef)(null);return(0,N.useEffect)(()=>{let e=o.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,200)+`px`)},[e]),(0,N.useEffect)(()=>{let e=window.visualViewport;if(!e)return;function t(){let e=o.current;!e||document.activeElement!==e||requestAnimationFrame(()=>{e.scrollIntoView({block:`nearest`,behavior:`smooth`})})}return e.addEventListener(`resize`,t),()=>e.removeEventListener(`resize`,t)},[]),(0,P.jsx)(`textarea`,{ref:o,value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:i,rows:1,className:he(`w-full resize-none rounded-xl border border-border bg-background px-3.5 py-2.5 text-sm`,`placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`min-h-[42px] max-h-[200px] overflow-y-auto`,a)})}function vn({item:e,onRemove:t}){let[n,r]=(0,N.useState)(!1),i=!!(e.previewUrl&&!e.error);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,disabled:!i,onClick:()=>r(!0),className:`group/pending relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded bg-muted disabled:cursor-default`,title:i?`Preview image`:e.fileName,children:e.previewUrl?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`h-full w-full object-cover`}),(0,P.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/pending:bg-black/30 transition-colors`,children:(0,P.jsx)(de,{className:`h-3.5 w-3.5 text-white opacity-0 group-hover/pending:opacity-100 transition-opacity drop-shadow-md`})})]}):e.error?(0,P.jsx)(ye,{className:`h-4 w-4 text-red-400`}):e.uploading?(0,P.jsx)(ce,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,P.jsx)(_,{className:`h-4 w-4 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`p`,{className:`truncate font-medium`,children:e.fileName}),(0,P.jsx)(`p`,{className:he(`truncate text-muted-foreground`,e.error&&`text-red-400`),children:e.error||(e.uploading?`Uploading`:kt(e.size))})]}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Remove attachment`,onClick:t,children:(0,P.jsx)(C,{className:`h-3.5 w-3.5`})})]}),e.previewUrl&&(0,P.jsx)(Vt,{open:n,onOpenChange:r,children:(0,P.jsxs)(Nt,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,P.jsx)(Ft,{className:`sr-only`,children:e.fileName}),(0,P.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,P.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`absolute top-2 right-2 rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,P.jsx)(C,{className:`w-4 h-4`})})]})]})})]})}function yn({draft:e,placeholder:t,chatSending:r,disabled:i,hasPendingUploads:a,readyAttachmentCount:o,pendingAttachments:s,micAvailable:c,micState:l,slashMatches:u,slashActiveIndex:d,onDraftChange:f,onKeyDown:p,onPaste:m,onUploadFiles:h,onRemovePendingAttachment:g,onSend:_,onAcceptSlash:v,onSlashHover:b,onStartPtt:x,onStopPtt:S,footerText:C}){let w=(0,N.useRef)(null),[T,E]=(0,N.useState)(!1),D=!e.trim()&&o===0||a||r||i;return(0,P.jsxs)(`div`,{className:he(`relative shrink-0 border-t border-border px-3 md:px-4 py-2.5 md:py-3 safe-area-bottom`,T&&`bg-primary/5 ring-1 ring-primary/40`),onDragOver:e=>{e.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:e=>{e.preventDefault(),E(!1),h(e.dataTransfer.files)},children:[s.length>0&&(0,P.jsx)(`div`,{className:`mb-2 grid gap-2 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(vn,{item:e,onRemove:()=>g(e.id)},e.id))}),(0,P.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&h(e.target.files),e.currentTarget.value=``}}),(0,P.jsx)(gn,{matches:u,activeIndex:d,onAccept:v,onHover:b}),(0,P.jsxs)(`div`,{className:`hidden md:flex items-end gap-2`,children:[(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:r,onClick:()=>w.current?.click(),className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,P.jsx)(y,{className:`w-4 h-4`})}),(0,P.jsx)(_n,{value:e,onChange:e=>f(e.target.value),onKeyDown:p,onPaste:m,placeholder:t,className:`flex-1`}),c&&(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:l===`recording`?`Release to transcribe`:`Hold to talk`,disabled:r||l===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),x()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}S()},className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px] ${l===`recording`?`text-red-400 animate-pulse`:``}`,children:l===`transcribing`?(0,P.jsx)(ce,{className:`w-4 h-4 animate-spin`}):(0,P.jsx)(ge,{className:`w-4 h-4`})}),(0,P.jsx)(M,{size:`icon`,disabled:D,onClick:_,className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,P.jsx)(n,{className:`w-4 h-4`})})]}),(0,P.jsxs)(`div`,{className:`md:hidden space-y-2`,children:[(0,P.jsx)(_n,{value:e,onChange:e=>f(e.target.value),onKeyDown:p,onPaste:m,placeholder:t,className:`w-full`}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:r,onClick:()=>w.current?.click(),className:`rounded-xl h-9 w-9`,children:(0,P.jsx)(y,{className:`w-4 h-4`})}),c&&(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:l===`recording`?`Release to transcribe`:`Hold to talk`,disabled:r||l===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),x()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}S()},className:`rounded-xl h-9 w-9 ${l===`recording`?`text-red-400 animate-pulse`:``}`,children:l===`transcribing`?(0,P.jsx)(ce,{className:`w-4 h-4 animate-spin`}):(0,P.jsx)(ge,{className:`w-4 h-4`})})]}),(0,P.jsx)(M,{size:`icon`,disabled:D,onClick:_,className:`rounded-xl h-9 w-9`,children:(0,P.jsx)(n,{className:`w-4 h-4`})})]})]}),C&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1.5 hidden md:block`,children:C})]})}var bn=e(xe(),1);function xn({preview:e,error:t,onReadError:n,onMouseEnter:r,onMouseLeave:i}){let{anchor:a}=e,o=Math.min(560,window.innerWidth-24),s=Math.min(380,window.innerHeight-24),c=Math.max(12,Math.min(a.left,window.innerWidth-o-12));return(0,bn.createPortal)((0,P.jsxs)(`div`,{className:`fixed z-50 flex flex-col overflow-hidden rounded-lg border border-border bg-background shadow-xl`,style:{top:window.innerHeight-a.bottom>=s+8?a.bottom+8:a.top-8-s>=12?a.top-8-s:Math.max(12,window.innerHeight-s-12),left:c,width:o,height:s},onMouseEnter:r,onMouseLeave:i,children:[(0,P.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-border px-2.5`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium text-muted-foreground`,children:e.path}),t&&(0,P.jsx)(`span`,{className:`max-w-[12rem] truncate text-[11px] text-red-400`,children:t}),(0,P.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:`click to pin`})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:e.type===`directory`?(0,P.jsx)(At,{orchestratorId:e.orchestratorId,selectedPath:e.path,onReadError:n}):(0,P.jsx)(Ut,{orchestratorId:e.orchestratorId,selectedPath:e.path,line:e.line,onReadError:n})})]}),document.body)}var Sn=[];function Cn(e){return A(t=>t.chatStatusEvents[e]??Sn)}function wn(e,t){let n=(0,N.useRef)(!1);(0,N.useEffect)(()=>{if(!e)return;n.current||=(window.history.pushState({chatGuard:!0},``),!0);function r(e){(e.state?.chatGuard!==void 0||!n.current)&&(window.history.pushState({chatGuard:!0},``),t())}function i(e){e.preventDefault()}return window.addEventListener(`popstate`,r),window.addEventListener(`beforeunload`,i),()=>{window.removeEventListener(`popstate`,r),window.removeEventListener(`beforeunload`,i)}},[e,t]),(0,N.useEffect)(()=>{!e&&n.current&&(n.current=!1)},[e])}function Tn(e,t){let n=e.toLowerCase(),r=t.trim().toLowerCase();return r?n.includes(r)?!0:/\s/.test(r)||r.length<4?!1:En(n,r):!1}function En(e,t,n=4){let r=0,i=-1;for(let a=0;a<e.length&&r<t.length;a+=1)if(e[a]===t[r]){if(i!==-1&&a-i-1>n)return!1;i=a,r+=1}return r===t.length}function Dn(e,t){let n=t.trim();if(!n)return[];let r=[];for(let t of e){let e=ft(t);e&&Tn(e,n)&&r.push(Gt(t))}return r}function On(e){let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(0),s=(0,N.useMemo)(()=>t?Dn(e,r):[],[t,r,e]),c=(0,N.useMemo)(()=>new Set(s),[s]),l=s.length,u=l?Math.min(a,l-1):0,d=l?s[u]??null:null,f=(0,N.useCallback)(()=>n(!0),[]),p=(0,N.useCallback)(()=>{n(!1),i(``),o(0)},[]),m=(0,N.useCallback)(e=>{i(e),o(0)},[]),h=(0,N.useCallback)(()=>{o(e=>l?(e+1)%l:0)},[l]),g=(0,N.useCallback)(()=>{o(e=>l?(e-1+l)%l:0)},[l]);return{open:t,query:r,matchKeys:s,matchKeySet:c,total:l,position:l?u+1:0,currentKey:d,openSearch:f,close:p,setQuery:m,next:h,prev:g}}var kn=1e4;function An(e,t){let n=A(e=>e.announcePresence),r=(0,N.useRef)(t);r.current=t,(0,N.useEffect)(()=>{if(!e)return;n(e,r.current);let t=setInterval(()=>{n(e,r.current)},kn);return()=>{clearInterval(t),n(e,!1,!0)}},[e,n]),(0,N.useEffect)(()=>{e&&n(e,t)},[e,t,n])}var jn=0,Mn=1,Nn=2,Pn=4;function Fn(e){return()=>e}function In(e){e()}function Ln(e,t){return n=>e(t(n))}function Rn(e,t){return()=>e(t)}function zn(e,t){return n=>e(t,n)}function Bn(e){return e!==void 0}function Vn(...e){return()=>{e.map(In)}}function Hn(){}function Un(e,t){return t(e),e}function Wn(e,t){return t(e)}function F(...e){return e}function I(e,t){return e(Mn,t)}function L(e,t){e(jn,t)}function Gn(e){e(Nn)}function R(e){return e(Pn)}function z(e,t){return I(e,zn(t,jn))}function Kn(e,t){let n=e(Mn,e=>{n(),t(e)});return n}function qn(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Jn(e,t){return e===t}function B(e=Jn){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function V(e){return t=>n=>{e(n)&&t(n)}}function H(e){return t=>Ln(t,e)}function Yn(e){return t=>()=>{t(e)}}function U(e,...t){let n=$n(...t);return((t,r)=>{switch(t){case Nn:Gn(e);return;case Mn:return I(e,n(r))}})}function Xn(e,t){return n=>r=>{n(t=e(t,r))}}function Zn(e){return t=>n=>{e>0?e--:t(n)}}function Qn(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function W(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;I(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function $n(...e){return t=>e.reduceRight(Wn,t)}function er(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case Mn:return a?n===a?void 0:(r(),n=a,t=I(e,a),t):(r(),Hn);case Nn:r(),n=null;return}}}function G(e){let t=e,n=K();return((e,r)=>{switch(e){case jn:t=r;break;case Mn:r(t);break;case Pn:return t}return n(e,r)})}function tr(e,t){return Un(G(t),t=>z(e,t))}function K(){let e=[];return((t,n)=>{switch(t){case jn:e.slice().forEach(e=>{e(n)});return;case Nn:e.splice(0,e.length);return;case Mn:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function nr(e){return Un(K(),t=>z(e,t))}function q(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:rr(),singleton:n}}var rr=()=>Symbol();function ir(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function ar(...e){let t=K(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;I(e,e=>{n[a]=e,r|=o,r===i&&L(t,n)})}),function(e,a){switch(e){case Nn:Gn(t);return;case Mn:return r===i&&a(n),I(t,a)}}}function J(e,t=Jn){return U(e,B(t))}function or(...e){return function(t,n){switch(t){case Nn:return;case Mn:return Vn(...e.map(e=>I(e,n)))}}}var sr={DEBUG:0,INFO:1,WARN:2,ERROR:3},cr={[sr.DEBUG]:`debug`,[sr.ERROR]:`error`,[sr.INFO]:`log`,[sr.WARN]:`warn`},lr=()=>typeof globalThis>`u`?window:globalThis,ur=q(()=>{let e=G(sr.ERROR);return{log:G((t,n,r=sr.INFO)=>{r>=(lr().VIRTUOSO_LOG_LEVEL??R(e))&&console[cr[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),dr=new WeakMap;function fr(e){return`self`in e?e.document.documentElement:e}function pr(e){let t=fr(e),n=dr.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return dr.set(t,r),r}function mr(e){dr.delete(fr(e))}function hr(e,t){return pr(e)?-t:t}var gr=hr;function _r(e,t){return hr(e,t)}function vr(e,t,n){return yr(e,t,n).callbackRef}function yr(e,t,n){let r=N.useRef(null),i=e=>{},a=N.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function br(e,t,n,r,i,a,o,s,c){return yr(N.useCallback(n=>{let c=xr(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?gr(o,o.scrollLeft):o.scrollTop:u?s?gr(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?gr(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?Sr(`column-gap`,getComputedStyle(n).columnGap,i):Sr(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function xr(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},sr.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function Sr(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,sr.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Cr(e,t,n){let r=N.useRef(null),i=N.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=yr(i,!0,n),s=N.useCallback(()=>{i(o.current)},[i,o]);return N.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var wr=q(()=>{let e=K(),t=K(),n=G(0),r=K(),i=G(0),a=K(),o=K(),s=G(0),c=G(0),l=G(0),u=G(0),d=K(),f=K(),p=G(!1),m=G(!1),h=G(!1);return z(U(e,H(({scrollTop:e})=>e)),t),z(U(e,H(({scrollHeight:e})=>e)),o),z(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),Tr={lvl:0};function Er(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function Y(e){return e===Tr}function Dr(e,t){if(!Y(e))return t===e.k?e.v:t<e.k?Dr(e.l,t):Dr(e.r,t)}function Or(e,t,n=`k`){if(Y(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=Or(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Or(e.l,t,n)}function kr(e,t,n){return Y(e)?Br(t,n,1):t===e.k?Ir(e,{k:t,v:n}):t<e.k?Vr(Ir(e,{l:kr(e.l,t,n)})):Vr(Ir(e,{r:kr(e.r,t,n)}))}function Ar(){return Tr}function jr(e,t,n){if(Y(e))return[];let r=Or(e,t)[0];return Wr(Pr(e,r,n))}function Mr(e,t){if(Y(e))return Tr;let{k:n,l:r,r:i}=e;if(t===n){if(Y(r))return i;if(Y(i))return r;let[t,n]=zr(r);return Fr(Ir(e,{k:t,l:Lr(r),v:n}))}return Fr(t<n?Ir(e,{l:Mr(r,t)}):Ir(e,{r:Mr(i,t)}))}function Nr(e){return Y(e)?[]:[...Nr(e.l),{k:e.k,v:e.v},...Nr(e.r)]}function Pr(e,t,n){if(Y(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(Pr(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(Pr(a,t,n))),s}function Fr(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Rr(t))return Hr(Ir(e,{lvl:n-1}));if(!Y(t)&&!Y(t.r))return Ir(t.r,{l:Ir(t,{r:t.r.l}),lvl:n,r:Ir(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(Rr(e))return Ur(Ir(e,{lvl:n-1}));if(!Y(r)&&!Y(r.l)){let t=r.l,i=Rr(t)?r.lvl-1:r.lvl;return Ir(t,{l:Ir(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:Ur(Ir(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function Ir(e,t){return Br(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function Lr(e){return Y(e.r)?e.l:Fr(Ir(e,{r:Lr(e.r)}))}function Rr(e){return Y(e)||e.lvl>e.r.lvl}function zr(e){return Y(e.r)?[e.k,e.v]:zr(e.r)}function Br(e,t,n,r=Tr,i=Tr){return{k:e,l:r,lvl:n,r:i,v:t}}function Vr(e){return Ur(Hr(e))}function Hr(e){let{l:t}=e;return!Y(t)&&t.lvl===e.lvl?Ir(t,{r:Ir(e,{l:t.r})}):e}function Ur(e){let{lvl:t,r:n}=e;return!Y(n)&&!Y(n.r)&&n.lvl===t&&n.r.lvl===t?Ir(n,{l:Ir(e,{r:n.l}),lvl:t+1}):e}function Wr(e){return Er(e,({k:e,v:t})=>({index:e,value:t}))}function Gr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Kr(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var qr=q(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function Jr(e,t,n){return e[Yr(e,t,n)]}function Yr(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function Xr(e,t,n,r){let i=Yr(e,t,r),a=Yr(e,n,r,i);return e.slice(i,a+1)}function Zr(e,t){return Math.round(e.getBoundingClientRect()[t])}function Qr(e){return!Y(e.groupOffsetTree)}function $r({index:e},t){return t===e?0:t<e?-1:1}function ei(){return{groupIndices:[],groupOffsetTree:Ar(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ar()}}function ti(e,t){let n=Y(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),Y(e)){e=kr(e,0,i);continue}let o=jr(e,a-1,t+1);if(o.some(pi(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Mr(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=kr(e,t+1,a));c&&(e=kr(e,a,i))}return[e,n]}function ni(e){return typeof e.groupIndex<`u`}function ri({offset:e},t){return t===e?0:t<e?-1:1}function ii(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=Jr(t,e,$r),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function ai(e,t){if(!Qr(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function oi(e,t,n){if(ni(e))return t.groupIndices[e.groupIndex]+1;let r=ai(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function si(e,t,n,r=0){return r>0&&(t=Math.max(t,Jr(e,r,$r).offset)),Er(Xr(e,t,n,ri),fi)}function ci(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,sr.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Y(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>kr(kr(t,n,e),n+1,r),o)}else [o,s]=ti(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=di(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>kr(e,t,ii(t,d,i)),Ar()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function li(e){return Nr(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function ui(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function di(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=Yr(i,t-1,$r),s=i[c].offset;let e=Or(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===Or(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of jr(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function fi(e){return{index:e.index,value:e}}function pi(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var mi={offsetHeight:`height`,offsetWidth:`width`},hi=q(([{log:e},{recalcInProgress:t}])=>{let n=K(),r=K(),i=tr(r,0),a=K(),o=K(),s=G(0),c=G([]),l=G(void 0),u=G(void 0),d=G(void 0),f=G(void 0),p=G((e,t)=>Zr(e,mi[t])),m=G(void 0),h=G(0),g=ei(),_=tr(U(n,W(c,e,h),Xn(ci,g),B()),g),v=tr(U(c,B(),Xn((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),H(({prev:e})=>e)),[]);z(U(c,V(e=>e.length>0),W(_,h),H(([e,t,n])=>{let r=e.reduce((e,r,i)=>kr(e,r,ii(r,t.offsetTree,n)||i),Ar());return{...t,groupIndices:e,groupOffsetTree:r}})),_),z(U(r,W(_),V(([e,{lastIndex:t}])=>e<t),H(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),z(l,u);let y=tr(U(l,H(e=>e===void 0)),!0);z(U(u,V(e=>e!==void 0&&Y(R(_).sizeTree)),H(e=>{let t=R(d),n=R(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),z(U(f,V(e=>e!==void 0&&e.length>0&&Y(R(_).sizeTree)),H(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),z(U(c,W(d,u),V(([,e,t])=>e!==void 0&&t!==void 0),H(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=nr(U(n,W(_),Xn(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),H(e=>e.changed)));I(U(s,Xn((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),H(e=>e.diff)),e=>{let{groupIndices:n}=R(_);if(e>0)L(t,!0),L(a,e+ui(e,n));else if(e<0){let t=R(v);t.length>0&&(e-=ui(-e,t)),L(o,e)}}),I(U(s,W(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},sr.ERROR)});let x=nr(a);z(U(a,W(_),H(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Dr(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=Nr(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Nr(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=nr(U(o,W(_,h),H(([e,{offsetTree:t},n])=>ii(-e,t,n))));return z(U(o,W(_,h),H(([e,t,n])=>{if(t.groupIndices.length>0){if(Y(t.sizeTree))return t;let r=Ar(),i=R(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=Nr(t.sizeTree).reduce((t,{k:n,v:r})=>kr(t,Math.max(0,n+e),r),r),a!==-e){let n=Dr(t.sizeTree,s);r=kr(r,0,n);let i=Or(t.sizeTree,-e+1)[1];r=kr(r,1,i)}return{...t,sizeTree:r,...di(t.offsetTree,0,r,n)}}let r=Nr(t.sizeTree).reduce((t,{k:n,v:r})=>kr(t,Math.max(0,n+e),r),Ar());return{...t,sizeTree:r,...di(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},F(ur,qr),{singleton:!0});function gi(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var _i=q(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=K(),o=K(),s=nr(U(a,H(gi)));return z(U(s,H(e=>e.totalCount)),n),z(U(s,H(e=>e.groupIndices)),e),z(U(ar(i,t,r),V(([e,t])=>Qr(t)),H(([e,t,n])=>Or(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),B(),H(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},F(hi,wr)),vi=q(([{log:e}])=>{let t=G(!1),n=nr(U(t,V(e=>e),B()));return I(t,t=>{t&&R(e)(`props updated`,{},sr.DEBUG)}),{didMount:n,propsReady:t}},F(ur),{singleton:!0}),yi=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function bi(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!yi)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var xi=q(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=K(),m=K(),h=G(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),L(c,!1)}return z(U(p,W(n,d,r,h,s,o,f),W(e,a,i),H(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=bi(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=oi(b,n,w),E=ii(T,n.offsetTree,d)+o;x===`end`?(E+=f+Or(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+Or(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},sr.DEBUG),L(p,e)):(L(m,!0),l(`list did not change, scroll successful`,{},sr.DEBUG))};if(y(),S===`smooth`){let e=!1;v=I(t,t=>{e||=t}),g=Kn(u,()=>{D(e)})}else g=Kn(U(t,Si(150)),D);return _=setTimeout(()=>{y()},1200),L(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},sr.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},F(hi,wr,ur),{singleton:!0});function Si(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Ci(e,t){e===0?t():requestAnimationFrame(()=>{Ci(e-1,t)})}function wi(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Ti=q(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=G(!0),c=G(0),l=G(!0);return z(U(o,W(c),V(([e,t])=>t!==0),Yn(!1)),s),z(U(o,W(c),V(([e,t])=>t!==0),Yn(!1)),l),I(U(ar(t,o),W(s,n,e,l),V(([[,e],t,{sizeTree:n},r,i])=>e&&(!Y(n)||Bn(r))&&!t&&!i),W(c)),([,e])=>{Kn(i,()=>{L(l,!0)}),Ci(4,()=>{Kn(r,()=>{L(s,!0)}),L(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},F(hi,wr,xi,vi),{singleton:!0});function Ei(e,t){return Math.abs(e-t)<1.01}var Di=`up`,Oi=`down`,ki=`none`,Ai={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ji=0,Mi=q(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=G(!1),s=G(!0),c=K(),l=K(),u=G(4),d=G(ji),f=tr(U(or(U(J(i),Zn(1),Yn(!0)),U(J(i),Zn(1),Yn(!1),qn(100))),B()),!1),p=tr(U(or(U(n,Yn(!0)),U(n,Yn(!1),qn(200))),B()),!1);z(U(ar(J(i),J(d)),H(([e,t])=>e<=t),B()),s),z(U(s,Qn(50)),l);let m=nr(U(ar(r,J(a),J(t),J(e),J(u)),Xn((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},Ai),B((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=tr(U(r,Xn((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Ei(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),V(e=>e.changed),H(e=>e.jump)),0);z(U(m,H(e=>e.atBottom)),o),z(U(o,Qn(50)),c);let g=G(Oi);z(U(r,H(({scrollTop:e})=>e),B(),Xn((e,t)=>R(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Di:Oi,prevScrollTop:t},{direction:Oi,prevScrollTop:0}),H(e=>e.direction)),g),z(U(r,Qn(50),Yn(ki)),g);let _=G(0);return z(U(f,V(e=>!e),Yn(0)),_),z(U(i,Qn(100),W(f),V(([e,t])=>t),Xn(([e,t],[n])=>[t,n],[0,0]),H(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},F(wr)),Ni=`top`,Pi=`bottom`,Fi=`none`;function Ii(e,t,n){return typeof e==`number`?n===Di&&t===Ni||n===Oi&&t===Pi?e:0:n===Di?t===Ni?e.main:e.reverse:t===Pi?e.main:e.reverse}function Li(e,t){return typeof e==`number`?e:e[t]??0}var Ri=q(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=K(),o=G(0),s=G(0),c=G(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:tr(U(ar(J(r),J(i),J(n),J(a,Kr),J(c),J(o),J(t),J(e),J(s)),H(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=Fi,m=Li(l,Ni),h=Li(l,Pi);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=Di),i<e-f+t+h&&(p=Oi),p===Fi?null:[Math.max(u-n-Ii(a,Ni,p)-m,0),u-f-s+t+Ii(a,Pi,p)+h]}),V(e=>e!==null),B(Kr)),[0,0])}},F(wr),{singleton:!0});function zi(e,t,n){if(Qr(t)){let r=ai(e,t);return[{index:Or(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var Bi={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Vi(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:Ui(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:Ui(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function Hi(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=wi(t,s);return Vi(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function Ui(e,t,n){if(e.length===0)return[];if(!Qr(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=jr(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function Wi(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var Gi=q(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=G([]),g=G(0),_=K(),v=G(0);z(a.topItemsIndexes,h);let y=tr(U(ar(p,m,J(c,Kr),J(i),J(r),J(l),u,J(h),J(t),J(n),J(v),e),V(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),H(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=R(g);if(n===0)return{...Bi,totalCount:n};if(e===0&&t===0)return m===0?{...Bi,totalCount:n}:Hi(m,i,r,s,c,u||[]);if(Y(p))return m>0?null:Vi(zi(wi(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of jr(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return Vi([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=si(f,e,t,_);if(v.length===0)return null;let y=n-1,b=Un([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=Wi(l,Ni),S=Wi(l,Pi);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=jr(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=jr(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return Vi(b,h,n,c,d,s)}),V(e=>e!==null),B()),Bi);z(U(e,V(Bn),H(e=>e?.length)),i),z(U(y,H(e=>e.topListHeight)),d),z(d,s),z(U(y,H(e=>[e.top,e.bottom])),o),z(U(y,H(e=>e.items)),_);let b=nr(U(y,V(({items:e})=>e.length>0),W(i,e),V(([{items:e},t])=>e[e.length-1].originalIndex===t-1),H(([,e,t])=>[e-1,t]),B(Kr),H(([e])=>e))),x=nr(U(y,Qn(200),V(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),H(({items:e})=>e[0].index),B()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:nr(U(y,V(({items:e})=>e.length>0),H(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),B(Gr))),startReached:x,topItemsIndexes:h,...f}},F(hi,_i,Ri,Ti,xi,Mi,vi,qr),{singleton:!0}),Ki=q(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=K(),o=tr(U(ar(n,e,r,t,i),H(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return z(J(o),a),{totalListHeight:o,totalListHeightChanged:a}},F(wr,Gi),{singleton:!0}),qi=q(([{viewportHeight:e},{totalListHeight:t}])=>{let n=G(!1);return{alignToBottom:n,paddingTopAddition:tr(U(ar(n,e,t),V(([e])=>e),H(([,e,t])=>Math.max(0,e-t)),Qn(0),B()),0)}},F(wr,Ki),{singleton:!0}),Ji=q(()=>({context:G(null)})),Yi=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,Xi=q(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=K();return z(U(u,W(t,c,n,a,i,r,s),W(e),H(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=Yi,done:d,...f}=e,p=oi(e,t,r-1),m=ii(p,t.offsetTree,l)+i+a,h=m+Or(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&Kn(U(o,V(e=>!e),Zn(R(o)?1:2)),d),_}),V(e=>e!==null)),l),{scrollIntoView:u}},F(hi,wr,xi,Gi,ur),{singleton:!0});function Zi(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var Qi=(e,t)=>typeof e==`function`?Zi(e(t)):t&&Zi(e),$i=q(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=G(!1),h=K(),g=null;function _(e){L(o,{align:`end`,behavior:e,index:`LAST`})}I(U(ar(U(J(t),Zn(1)),c),W(J(m),a,s,d),H(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=Qi(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),V(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),R(n)===void 0?g=Kn(e,()=>{R(u)(`following output to `,{totalCount:r},sr.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{R(u)(`following output to `,{totalCount:r},sr.DEBUG),_(t)})});function v(e){let t=Kn(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(R(u)(`scrolling to bottom due to increased size`,{},sr.DEBUG),_(`auto`))});setTimeout(t,100)}I(U(ar(J(m),t,l),V(([e,,t])=>e!==!1&&t),Xn(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),V(({refreshed:e})=>e),W(m,t)),([,e])=>{R(s)&&v(e!==!1)}),I(h,()=>{v(R(m)!==!1)}),I(ar(J(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=G(null),b=K();return z(or(U(J(r),H(e=>e?.length??0)),U(J(t))),b),I(U(ar(U(b,Zn(1)),c),W(J(y),s,d,f),H(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),V(e=>!!e),Qn(0)),t=>{g!==null&&(g(),g=null),R(n)===void 0?g=Kn(e,()=>{R(u)(`scrolling into view`,{}),L(p,t),g=null}):requestAnimationFrame(()=>{R(u)(`scrolling into view`,{}),L(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},F(hi,Mi,xi,Ti,vi,ur,wr,Ji,Xi)),ea=q(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(z(U(s,W(a),V(([,e])=>e!==0),W(i,r,t,n,e),H(([[,e],t,n,r,i,a=[]])=>Hi(e,t,n,r,i,a))),o),{}),F(hi,Ti,Gi,vi),{singleton:!0}),ta=q(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=G(0);return I(U(e,W(r),V(([,e])=>e!==0),H(([,e])=>({top:e}))),e=>{Kn(U(n,Zn(1),V(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{L(t,e)})})}),{initialScrollTop:r}},F(vi,wr,Gi),{singleton:!0}),na=q(([{scrollVelocity:e}])=>{let t=G(!1),n=K(),r=G(!1);return z(U(e,W(r,t,n),V(([e,t])=>t!==!1&&t!==void 0),H(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),B()),t),I(U(ar(t,e,n),W(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},F(Mi),{singleton:!0}),ra=q(([{scrollContainerState:e,scrollTo:t}])=>{let n=K(),r=K(),i=K(),a=G(!1),o=G(void 0);return z(U(ar(n,r),H(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),z(U(t,W(r),H(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},F(wr)),ia=q(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=K(),u=G(void 0),d=G(null),f=G(null);return z(s,d),z(c,f),I(U(l,W(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=li(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),z(U(u,V(Bn),H(aa)),i),z(U(a,W(u),V(([,e])=>e!==void 0),B(),H(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},F(hi,wr,Ti,vi,ra));function aa(e){return{align:`start`,index:0,offset:e.scrollTop}}var oa=q(([{topItemsIndexes:e}])=>{let t=G(0);return z(U(t,V(e=>e>=0),H(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},F(Gi));function sa(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var ca=sa(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),la=q(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:ee,...te}=b;return z(ee,T.scrollSeekRangeChanged),z(U(T.windowViewportRect,H(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:ee,...te,...T,..._,sizes:u,...v}},F(hi,Ti,wr,ia,$i,Gi,xi,q(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=nr(U(c,W(o),Xn(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),V(([e])=>e!==0),W(r,s,n,i,p,m),V(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===Di),H(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},sr.DEBUG),e))));function g(n){n>0?(L(t,{behavior:`auto`,top:-n}),L(e,0)):(L(e,0),L(t,{behavior:`auto`,top:-n}))}return I(U(h,W(e,a)),([t,n,r])=>{r&&ca()?L(e,n-t):g(-t)}),I(U(ar(tr(a,!1),e,m),V(([e,t,n])=>!e&&!n&&t!==0),H(([e,t])=>t),Qn(1)),g),z(U(d,H(e=>({top:-e}))),t),I(U(l,W(f,u),H(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=Dr(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{L(e,n),requestAnimationFrame(()=>{L(t,{top:n}),requestAnimationFrame(()=>{L(e,0),L(m,!1)})})}),{deviation:e}},F(wr,Mi,Gi,hi,ur,qr)),oa,_i,q(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),F(Ri,ea,vi,na,Ki,ta,qi,ra,Xi,ur,Ji))));function ua(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var da=typeof document<`u`?N.useLayoutEffect:N.useEffect;function fa(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=N.createContext({});function c(e,n){e.propsReady!==void 0&&L(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];L(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];L(i,n[r])}e.propsReady!==void 0&&L(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];L(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=er(e[t.events[r]]),n),{})}return{Component:N.forwardRef(function(t,a){let{children:d,...f}=t,[p]=N.useState(()=>Un(ir(e),e=>{c(e,f)})),[m]=N.useState(Rn(u,p));da(()=>{for(let e of o)e in f&&I(m[e],f[e]);return()=>{Object.values(m).map(Gn)}},[f,m,p]),da(()=>{c(p,f)}),N.useImperativeHandle(a,Fn(l(p)));let h=n;return(0,P.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,P.jsx)(h,{...ua([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=N.useContext(s)[e];da(()=>I(n,t),[t,n])},useEmitterValue:e=>{let t=N.useContext(s)[e],n=N.useCallback(e=>I(t,e),[t]);return N.useSyncExternalStore(n,()=>R(t),()=>R(t))},usePublisher:e=>{let t=N.useContext(s);return N.useCallback(n=>{L(t[e],n)},[t,e])}}}var pa=N.createContext(void 0),ma=N.createContext(void 0),ha=`-webkit-sticky`,ga=`sticky`,_a=sa(()=>{if(typeof document>`u`)return ga;let e=document.createElement(`div`);return e.style.position=ha,e.style.position===ha?ha:ga}),va=typeof document<`u`?N.useLayoutEffect:N.useEffect;function ya(e){return`self`in e}function ba(e){return`body`in e}function xa(e,t,n,r=Hn,i,a){let o=N.useRef(null),s=N.useRef(null),c=N.useRef(null),l=N.useCallback(n=>{let r,i,o,l=n.target;if(ba(l)||ya(l)){let e=ya(l)?l:l.defaultView;o=a===!0?gr(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?gr(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():bn.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);N.useEffect(()=>{let e=i||o.current;return mr(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{mr(e),r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;ya(r)?(u=Math.max(Zr(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?gr(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=Zr(r,a===!0?`width`:`height`),d=a===!0?gr(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,Ei(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:_r(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:_r(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Sa(e){return e}var Ca=q(([e,t])=>({...e,...t}),F(la,q(()=>{let e=G(e=>`Item ${e}`),t=G(e=>`Group ${e}`),n=G({}),r=G(Sa),i=G(`div`),a=G(Hn),o=(e,t=null)=>tr(U(n,H(t=>t[e]),B()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),wa=({height:e})=>(0,P.jsx)(`div`,{style:{height:e}}),Ta={overflowAnchor:`none`,position:_a(),zIndex:1},Ea={overflowAnchor:`none`},Da={...Ea,display:`inline-block`,height:`100%`},Oa=N.memo(function({showTopList:e=!1}){let t=Z(`listState`),n=Wa(`sizeRanges`),r=Z(`useWindowScroll`),i=Z(`customScrollParent`),a=Wa(`windowScrollContainerState`),o=Wa(`scrollContainerState`),s=i||r?a:o,c=Z(`itemContent`),l=Z(`context`),u=Z(`groupContent`),d=Z(`trackItemSizes`),f=Z(`itemSize`),p=Z(`log`),m=Wa(`gap`),h=Z(`horizontalDirection`),{callbackRef:g}=br(n,f,d,e?Hn:s,p,m,i,h,Z(`skipAnimationFrameInResizeObserver`)),[_,v]=N.useState(0);Ua(`deviation`,e=>{_!==e&&v(e)});let y=Z(`EmptyPlaceholder`),b=Z(`ScrollSeekPlaceholder`)??wa,x=Z(`ListComponent`),S=Z(`ItemComponent`),C=Z(`GroupComponent`),w=Z(`computeItemKey`),T=Z(`isSeeking`),E=Z(`groupIndices`).length>0,D=Z(`alignToBottom`),O=Z(`initialItemFinalLocationReached`),ee=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?D?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,P.jsx)(y,{...X(y,l)}):(0,P.jsx)(x,{...X(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:ee,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,N.createElement)(b,{...X(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,N.createElement)(C,{...X(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Ta},u(e.index,l)):(0,N.createElement)(S,{...X(S,l),...Pa(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?Da:Ea},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),ka={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Aa={outline:`none`,overflowX:`auto`,position:`relative`},ja=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),Ma=(e,t,n=0)=>({...ja(e),position:t?`relative`:`absolute`,top:t?-n:0}),Na={position:_a(),top:0,width:`100%`,zIndex:1};function X(e,t){if(typeof e!=`string`)return{context:t}}function Pa(e,t){return{item:typeof e==`string`?void 0:t}}var Fa=N.memo(function(){let e=Z(`HeaderComponent`),t=Wa(`headerHeight`),n=Z(`HeaderFooterTag`),r=vr(N.useMemo(()=>e=>{t(Zr(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),Ia=N.memo(function(){let e=Z(`FooterComponent`),t=Wa(`footerHeight`),n=Z(`HeaderFooterTag`),r=vr(N.useMemo(()=>e=>{t(Zr(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})});function La({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=xa(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,P.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Aa:ka,...i},tabIndex:0,...o,...X(c,a),children:r})})}function Ra({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=N.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=xa(s,l,c,t(`scrollerRef`),f);return va(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,P.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...X(c,a),children:r})})}var za=({children:e})=>{let t=N.useContext(pa),n=Wa(`viewportHeight`),r=Wa(`fixedItemHeight`),i=Z(`alignToBottom`),a=Z(`horizontalDirection`),o=vr(N.useMemo(()=>Ln(n,e=>Zr(e,a?`width`:`height`)),[n,a]),!0,Z(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:ja(i),children:e})},Ba=({children:e})=>{let t=N.useContext(pa),n=Wa(`windowViewportRect`),r=Wa(`fixedItemHeight`),i=Z(`customScrollParent`),a=Z(`useWindowScroll`),o=Z(`topListHeight`),s=Cr(n,i,Z(`skipAnimationFrameInResizeObserver`)),c=Z(`alignToBottom`);return N.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:Ma(c,a,o),children:e})},Va=({children:e})=>{let t=Z(`TopItemListComponent`)??`div`,n=Z(`headerHeight`);return(0,P.jsx)(t,{style:{...Na,marginTop:`${n}px`},...X(t,Z(`context`)),children:e})},{Component:Ha,useEmitter:Ua,useEmitterValue:Z,usePublisher:Wa}=fa(Ca,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},N.memo(function(e){let t=Z(`useWindowScroll`),n=Z(`topItemsIndexes`).length>0,r=Z(`customScrollParent`),i=Z(`context`);return(0,P.jsxs)(r||t?Ka:Ga,{...e,context:i,children:[n&&(0,P.jsx)(Va,{children:(0,P.jsx)(Oa,{showTopList:!0})}),(0,P.jsxs)(r||t?Ba:za,{children:[(0,P.jsx)(Fa,{}),(0,P.jsx)(Oa,{}),(0,P.jsx)(Ia,{})]})]})})),Ga=La({useEmitter:Ua,useEmitterValue:Z,usePublisher:Wa}),Ka=Ra({useEmitter:Ua,useEmitterValue:Z,usePublisher:Wa}),qa=Ha,Ja=q(([e,t])=>({...e,...t}),F(la,q(()=>{let e=G(e=>(0,P.jsxs)(`td`,{children:[`Item $`,e]})),t=G(null),n=G(e=>(0,P.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=G(null),i=G(null),a=G({}),o=G(Sa),s=G(Hn),c=(e,t=null)=>tr(U(a,H(t=>t[e]),B()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),Ya=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{height:e}})}),Xa=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),Za={overflowAnchor:`none`},Qa={position:_a(),zIndex:2,overflowAnchor:`none`},$a=N.memo(function({showTopList:e=!1}){let t=Q(`listState`),n=Q(`computeItemKey`),r=Q(`firstItemIndex`),i=Q(`context`),a=Q(`isSeeking`),o=Q(`fixedHeaderHeight`),s=Q(`groupIndices`).length>0,c=Q(`itemContent`),l=Q(`groupContent`),u=Q(`ScrollSeekPlaceholder`)??Ya,d=Q(`GroupComponent`),f=Q(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,N.createElement)(u,{...X(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,N.createElement)(d,{...X(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...Qa,top:o}},l(t.index,i)):(0,N.createElement)(f,{...X(f,i),...Pa(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...Qa,top:o+g}:Za},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),eo=N.memo(function(){let e=Q(`listState`),t=Q(`topItemsIndexes`).length>0,n=ao(`sizeRanges`),r=Q(`useWindowScroll`),i=Q(`customScrollParent`),a=ao(`windowScrollContainerState`),o=ao(`scrollContainerState`),s=i||r?a:o,c=Q(`trackItemSizes`),{callbackRef:l,ref:u}=br(n,Q(`itemSize`),c,s,Q(`log`),void 0,i,!1,Q(`skipAnimationFrameInResizeObserver`)),[d,f]=N.useState(0);io(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=Q(`EmptyPlaceholder`),m=Q(`FillerRow`)??Xa,h=Q(`TableBodyComponent`),g=Q(`paddingTopAddition`),_=Q(`statefulTotalCount`),v=Q(`context`);if(_===0&&p!=null)return(0,P.jsx)(p,{...X(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,P.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,P.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,P.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...X(h,v),children:[S,t&&(0,P.jsx)($a,{showTopList:!0}),(0,P.jsx)($a,{}),C]})}),to=({children:e})=>{let t=N.useContext(pa),n=ao(`viewportHeight`),r=ao(`fixedItemHeight`),i=vr(N.useMemo(()=>Ln(n,e=>Zr(e,`height`)),[n]),!0,Q(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:ja(!1),children:e})},no=({children:e})=>{let t=N.useContext(pa),n=ao(`windowViewportRect`),r=ao(`fixedItemHeight`),i=Q(`customScrollParent`),a=Q(`useWindowScroll`),o=Cr(n,i,Q(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:Ma(!1,a),children:e})},{Component:ro,useEmitter:io,useEmitterValue:Q,usePublisher:ao}=fa(Ja,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},N.memo(function(e){let t=Q(`useWindowScroll`),n=Q(`customScrollParent`),r=ao(`fixedHeaderHeight`),i=ao(`fixedFooterHeight`),a=Q(`fixedHeaderContent`),o=Q(`fixedFooterContent`),s=Q(`context`),c=vr(N.useMemo(()=>Ln(r,e=>Zr(e,`height`)),[r]),!0,Q(`skipAnimationFrameInResizeObserver`)),l=vr(N.useMemo(()=>Ln(i,e=>Zr(e,`height`)),[i]),!0,Q(`skipAnimationFrameInResizeObserver`)),u=n||t?so:oo,d=n||t?no:to,f=Q(`TableComponent`),p=Q(`TableHeadComponent`),m=Q(`TableFooterComponent`),h=a?(0,P.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...X(p,s),children:a()},`TableHead`):null,g=o?(0,P.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...X(m,s),children:o()},`TableFoot`):null;return(0,P.jsx)(u,{...e,...X(u,s),children:(0,P.jsx)(d,{children:(0,P.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...X(f,s),children:[h,(0,P.jsx)(eo,{},`TableBody`),g]})})})})),oo=La({useEmitter:io,useEmitterValue:Q,usePublisher:ao}),so=Ra({useEmitter:io,useEmitterValue:Q,usePublisher:ao}),co={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},lo={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:uo,floor:fo,max:po,min:mo,round:ho}=Math;function go(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function _o(e){return{...lo,items:e}}function vo(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function yo(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var bo=q(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=G(0),C=G(0),w=G(co),T=G({height:0,width:0}),E=G({height:0,width:0}),D=K(),O=K(),ee=G(0),te=G(null),ne=G({column:0,row:0}),re=K(),ie=K(),ae=G(!1),oe=G(0),se=G(!0),ce=G(!1),le=G(!1);I(U(m,W(oe),V(([e,t])=>t!==0)),()=>{L(se,!1)}),I(U(ar(m,se,E,T,oe,ce),V(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{L(ce,!0),Ci(1,()=>{L(D,e)}),Kn(U(l),()=>{L(t,[0,0]),L(se,!0)})}),z(U(ie,V(e=>e!=null&&e.scrollTop>0),Yn(0)),C),I(U(m,W(ie),V(([,e])=>e!=null)),([,e])=>{e&&(L(T,e.viewport),L(E,e.item),L(ne,e.gap),e.scrollTop>0&&(L(ae,!0),Kn(U(l,Zn(1)),e=>{L(ae,!1)}),L(c,{top:e.scrollTop})))}),z(U(T,H(({height:e})=>e)),d),z(U(ar(J(T,vo),J(E,vo),J(ne,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),J(l)),H(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),re),z(U(ar(J(S),r,J(ne,yo),J(E,vo),J(T,vo),J(te),J(C),J(ae),J(se),J(oe)),V(([,,,,,,,e])=>!e),H(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return co;if(p===0){let t=wi(l,e);return _o(go(t,t+Math.max(s-1,0),o))}let h=xo(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*fo((t+d)/(f+d)),_=h*uo((n+d)/(f+d))-1,_=mo(e-1,po(_,h-1)),g=mo(_,po(0,g))):(g=0,_=-1);let v=go(g,_,o),{bottom:y,top:b}=So(a,r,i,v),x=uo(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),z(U(te,V(e=>e!==null),H(e=>e.length)),S),z(U(ar(T,E,w,ne),V(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),H(([e,t,{items:n},r])=>{let{bottom:i,top:a}=So(e,r,t,n);return[a,i]}),B(Kr)),t);let ue=G(!1);z(U(l,W(ue),H(([e,t])=>t||e!==0)),ue);let de=nr(U(ar(w,S),V(([{items:e}])=>e.length>0),W(ue),V(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),H(([[,e]])=>e-1),B())),fe=nr(U(J(w),V(({items:e})=>e.length>0&&e[0].index===0),Yn(0),B())),pe=nr(U(J(w),W(ae),V(([{items:e},t])=>e.length>0&&!t),H(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),B(Gr),Qn(0)));z(pe,p.scrollSeekRangeChanged),z(U(D,W(T,E,S,ne),H(([e,t,n,r,i])=>{let a=bi(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=po(0,l,mo(r-1,l));let u=Co(t,i,n,l);return o===`end`?u=ho(u-t.height+n.height):o===`center`&&(u=ho(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let me=tr(U(w,H(e=>e.offsetBottom+e.bottom)),0);return z(U(b,H(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:te,deviation:ee,footerHeight:i,gap:ne,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:ie,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:le,initialTopMostItemIndex:oe,totalListHeight:me,...f,endReached:de,propsReady:h,rangeChanged:pe,startReached:fe,stateChanged:re,stateRestoreInProgress:ae,...x}},F(Ri,wr,Mi,na,vi,ra,ur));function xo(e,t,n){return po(1,fo((e+n)/(fo(t)+n)))}function So(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Co(e,t,n,r[0].index);return{bottom:Co(e,t,n,r[r.length-1].index)+i,top:a}}function Co(e,t,n,r){let i=fo(r/xo(e.width,n.width,t.column)),a=i*n.height+po(0,i-1)*t.row;return a>0?a+t.row:a}var wo=q(([e,t])=>({...e,...t}),F(bo,q(()=>{let e=G(e=>`Item ${e}`),t=G({}),n=G(null),r=G(`virtuoso-grid-item`),i=G(`virtuoso-grid-list`),a=G(Sa),o=G(`div`),s=G(Hn),c=(e,n=null)=>tr(U(t,H(t=>t[e]),B()),n),l=G(!1),u=G(!1);return z(J(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),To=N.memo(function(){let e=$(`gridState`),t=$(`listClassName`),n=$(`itemClassName`),r=$(`itemContent`),i=$(`computeItemKey`),a=$(`isSeeking`),o=Mo(`scrollHeight`),s=$(`ItemComponent`),c=$(`ListComponent`),l=$(`ScrollSeekPlaceholder`),u=$(`context`),d=Mo(`itemDimensions`),f=Mo(`gap`),p=$(`log`),m=$(`stateRestoreInProgress`),h=Mo(`reportReadyState`),g=vr(N.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:Fo(`column-gap`,getComputedStyle(e).columnGap,p),row:Fo(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return va(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,P.jsx)(c,{className:t,ref:g,...X(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,P.jsx)(l,{...X(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,N.createElement)(s,{...X(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),Eo=N.memo(function(){let e=$(`HeaderComponent`),t=Mo(`headerHeight`),n=$(`headerFooterTag`),r=vr(N.useMemo(()=>e=>{t(Zr(e,`height`))},[t]),!0,!1),i=$(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),Do=N.memo(function(){let e=$(`FooterComponent`),t=Mo(`footerHeight`),n=$(`headerFooterTag`),r=vr(N.useMemo(()=>e=>{t(Zr(e,`height`))},[t]),!0,!1),i=$(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),Oo=({children:e})=>{let t=N.useContext(ma),n=Mo(`itemDimensions`),r=Mo(`viewportDimensions`),i=vr(N.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,P.jsx)(`div`,{ref:i,style:ja(!1),children:e})},ko=({children:e})=>{let t=N.useContext(ma),n=Mo(`windowViewportRect`),r=Mo(`itemDimensions`),i=$(`customScrollParent`),a=$(`useWindowScroll`),o=Cr(n,i,!1);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,P.jsx)(`div`,{ref:o,style:Ma(!1,a),children:e})},{Component:Ao,useEmitter:jo,useEmitterValue:$,usePublisher:Mo}=fa(wo,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},N.memo(function({...e}){let t=$(`useWindowScroll`),n=$(`customScrollParent`),r=n||t?Po:No,i=n||t?ko:Oo,a=$(`context`);return(0,P.jsx)(r,{...e,...X(r,a),children:(0,P.jsxs)(i,{children:[(0,P.jsx)(Eo,{}),(0,P.jsx)(To,{}),(0,P.jsx)(Do,{})]})})})),No=La({useEmitter:jo,useEmitterValue:$,usePublisher:Mo}),Po=Ra({useEmitter:jo,useEmitterValue:$,usePublisher:Mo});function Fo(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,sr.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Io({agentId:e,approval:t}){let n=A(e=>e.sendPermissionDecision),[r,i]=(0,N.useState)(null);if(!t)return null;if(t.questions&&t.questions.length)return(0,P.jsx)(zo,{agentId:e,approval:t,questions:t.questions});let a=t,o=t.choices.length?t.choices:[{id:`approve`,label:`Approve`},{id:`deny`,label:`Deny`}];async function s(t){if(!r){i(t.id);try{await n(e,a.id,t.id)}finally{i(null)}}}let c=t.kind===`plan`;return(0,P.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,P.jsx)(`div`,{className:`max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c?(0,P.jsx)(ee,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}):(0,P.jsx)(ye,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-100`,children:t.title}),t.body&&(c?(0,P.jsx)(`div`,{className:`mt-2 max-h-72 overflow-auto rounded-md bg-background/60 p-2.5 text-xs leading-relaxed`,children:(0,P.jsx)(et,{text:t.body,rawBody:t.body,className:`leading-relaxed`})}):(0,P.jsx)(`pre`,{className:`mt-2 max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/80 p-2 font-mono text-xs leading-relaxed text-muted-foreground`,children:t.body})),(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.map(e=>(0,P.jsxs)(M,{size:`sm`,variant:e.id===`deny`||e.id===`abort`?`outline`:`default`,disabled:!!r,onClick:()=>void s(e),className:`h-7 px-2 text-xs`,children:[r===e.id&&(0,P.jsx)(ce,{className:`mr-1.5 h-3 w-3 animate-spin`}),e.label]},e.id))})]})]})})})}function Lo(e){return e?e.otherActive&&e.other.trim()?!0:e.labels.length>0:!1}function Ro(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function zo({agentId:e,approval:t,questions:n}){let r=A(e=>e.sendPermissionDecision),[i,s]=(0,N.useState)(0),[c,l]=(0,N.useState)({}),[u,d]=(0,N.useState)(null),f=n[Math.min(i,n.length-1)],p=c[i];if(!f)return null;let m=!!f.multiSelect,h=n.length,g=i===h-1,_=Lo(p),v=n.every((e,t)=>Lo(c[t])),y=!!u;function b(e){l(t=>{let n=t[i]??{labels:[],other:``,otherActive:!1};return{...t,[i]:{...n,...e}}})}function x(e){if(m){let t=p?.labels.includes(e);b({labels:t?(p?.labels??[]).filter(t=>t!==e):[...p?.labels??[],e]})}else b({labels:[e],otherActive:!1})}function S(){b(m?{otherActive:!p?.otherActive}:{labels:[],otherActive:!0})}async function C(){if(!(!v||y)){d(`answer`);try{let i={};n.forEach((e,t)=>{let n=c[t];n&&(i[e.question]=Ro(n))}),await r(e,t.id,`answer`,i)}finally{d(null)}}}async function w(){if(!y){d(`dismiss`);try{await r(e,t.id,`deny`)}finally{d(null)}}}let T=!!p?.otherActive;return(0,P.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,P.jsxs)(`div`,{className:`w-full max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(le,{className:`h-4 w-4 shrink-0 text-amber-400`}),(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-100`,children:t.title}),h>1&&(0,P.jsxs)(Xe,{variant:`outline`,className:`ml-auto h-5 px-1.5 text-[10px] text-muted-foreground`,children:[i+1,` / `,h]})]}),(0,P.jsxs)(`div`,{className:`mt-3`,children:[f.header&&(0,P.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-amber-700 dark:text-amber-300/80`,children:f.header}),(0,P.jsx)(`div`,{className:`mt-0.5 text-sm text-foreground whitespace-pre-wrap break-words`,children:f.question}),m&&(0,P.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Select all that apply`}),(0,P.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:[f.options.map(e=>{let t=!!p?.labels.includes(e.label);return(0,P.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>x(e.label),className:he(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,t?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,y&&`opacity-60`),children:[(0,P.jsx)(`span`,{className:he(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,m?`rounded`:`rounded-full`,t?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:t&&(0,P.jsx)(o,{className:`h-3 w-3`})}),(0,P.jsxs)(`span`,{className:`min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),e.description&&(0,P.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.label)}),(0,P.jsxs)(`button`,{type:`button`,disabled:y,onClick:S,className:he(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,T?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,y&&`opacity-60`),children:[(0,P.jsx)(`span`,{className:he(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,m?`rounded`:`rounded-full`,T?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:T&&(0,P.jsx)(o,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:`Other…`})]}),T&&(0,P.jsx)(mt,{autoFocus:!0,rows:2,disabled:y,value:p?.other??``,onChange:e=>b({other:e.target.value,otherActive:!0}),placeholder:`Type your answer`,className:`mt-1 text-sm`})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[i>0&&(0,P.jsxs)(M,{size:`sm`,variant:`outline`,disabled:y,onClick:()=>s(e=>e-1),className:`h-7 px-2 text-xs`,children:[(0,P.jsx)(k,{className:`mr-1 h-3 w-3`}),`Back`]}),g?(0,P.jsxs)(M,{size:`sm`,disabled:y||!v,onClick:()=>void C(),className:`h-7 px-2 text-xs`,children:[u===`answer`&&(0,P.jsx)(ce,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Send answer`,h>1?`s`:``]}):(0,P.jsxs)(M,{size:`sm`,disabled:y||!_,onClick:()=>s(e=>e+1),className:`h-7 px-2 text-xs`,children:[`Next`,(0,P.jsx)(a,{className:`ml-1 h-3 w-3`})]}),(0,P.jsxs)(M,{size:`sm`,variant:`ghost`,disabled:y,onClick:()=>void w(),className:`ml-auto h-7 px-2 text-xs text-muted-foreground`,children:[u===`dismiss`&&(0,P.jsx)(ce,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Dismiss`]})]})]})})}var Bo=1e6,Vo=`px-3 md:px-4`;function Ho({context:e}){if(!e)return null;let{agentId:t,busy:n,pendingApproval:r,blockedLabel:i,canInterrupt:a,onInterrupt:o}=e,s=n&&!r;return!r&&!s?null:(0,P.jsxs)(`div`,{className:`${Vo} pb-3 md:pb-4`,children:[r&&(0,P.jsx)(Io,{agentId:t,approval:r},r.id),s&&(0,P.jsx)(Ht,{blockedLabel:i,onInterrupt:a?o:void 0})]})}function Uo(e){let t=e.findIndex(e=>e.type!==`date`&&e.type!==`created`),n=t>=0?t:0,r=e[n];return{key:r?Gt(r):null,index:n}}function Wo(e,t){let[n,r]=(0,N.useState)(()=>Bo-t.length),i=(0,N.useRef)({agentId:e,anchor:Uo(t)});return(0,N.useLayoutEffect)(()=>{let n=Uo(t),a=i.current;r(n=>{if(a.agentId!==e)return Bo-t.length;if(!a.anchor.key)return n;let r=t.findIndex(e=>Gt(e)===a.anchor.key)-a.anchor.index;return r>0?n-r:n}),i.current={agentId:e,anchor:n}},[e,t]),n}function Go({agentId:e,agentStatus:t,timeline:n,hasMore:r,loading:i,loadedInitial:a,showReasoning:o,pendingApproval:s,blockedLabel:c,canInterrupt:l,searchActive:u,searchCurrentKey:d,searchMatchKeys:f,onAtBottomChange:p,onScrollerRef:m,onLoadOlder:h,onInterrupt:g,onOpenReferencedPath:_,onPreviewReferencedPath:v,onPreviewReferencedPathEnd:y}){let b=(0,N.useRef)(null),S=(0,N.useRef)(null),[C,w]=(0,N.useState)(!0),T=t===`busy`,[E,D]=(0,N.useState)(T);(0,N.useLayoutEffect)(()=>{if(T){D(!0);return}let e=setTimeout(()=>D(!1),600);return()=>clearTimeout(e)},[T]);let O=Wo(e,n),ee=n.length>0?n[n.length-1]:null,te=ee?Gt(ee):null,ne=(ee?.type===`message`||ee?.type===`initial-prompt`)&&ee.msg.from===`user`,re=(0,N.useRef)(n);re.current=n;let ie=(0,N.useRef)(i);ie.current=i;let ae=(0,N.useRef)(a);ae.current=a;let oe=(0,N.useRef)(O);oe.current=O;let se=(0,N.useRef)(e);se.current=e;let le=(0,N.useRef)(!1),ue=(0,N.useCallback)(()=>{le.current||(le.current=!0,requestAnimationFrame(()=>{le.current=!1;let e=S.current;if(!e)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-item-index]`));for(let e of n){let n=e.getBoundingClientRect();if(n.bottom>t+1){let r=Number(e.getAttribute(`data-item-index`))-oe.current,i=re.current[r],a=i?nt(i):null;De(se.current,{stick:!1,topKey:i?Gt(i):null,...a?{anchorMessageId:a.messageId,anchorEndMessageId:a.endMessageId}:{},offset:Math.max(0,Math.round(t-n.top))});return}}}))},[]),de=(0,N.useRef)(null);if(de.current===null){let t=Se(e),r=-1;t&&!t.stick&&(t.topKey||t.anchorMessageId!==void 0)&&(r=dt(n,{topKey:t.topKey,messageId:t.anchorMessageId,endMessageId:t.anchorEndMessageId})),de.current=r>=0?r:Math.max(0,n.length-1)}let fe=(0,N.useRef)(te),me=(0,N.useRef)(e);me.current!==e&&(me.current=e,fe.current=te);let ge=fe.current?n.findIndex(e=>Gt(e)===fe.current):-1,_e=!C&&ge>=0?n.slice(ge+1).filter(e=>e.type===`message`&&e.msg.from!==`user`).length:0;(0,N.useLayoutEffect)(()=>{C&&(fe.current=te)},[C,te]);let ve=(0,N.useRef)(C);ve.current=C;let k=(0,N.useRef)(Se(e)?.stick??!0),ye=(0,N.useRef)(!1),be=(0,N.useRef)(!1),xe=(0,N.useRef)(null),Ce=(0,N.useRef)(0),we=(0,N.useRef)(0),Ee=(0,N.useCallback)(()=>{we.current=performance.now()+150},[]),A=(0,N.useCallback)(()=>{Ee(),b.current?.scrollToIndex({index:`LAST`,align:`end`});let e=performance.now(),t=0,n=!1,r=!1,i=()=>{if(n||!k.current)return;let a=S.current;if(a){let e=a.scrollHeight-a.clientHeight-a.scrollTop,t=a.scrollHeight-a.clientHeight>64;if(e<=64&&t&&(r=!0,ye.current=!0),r&&e>300)return;Ee(),a.scrollTo({top:a.scrollHeight,behavior:`auto`})}performance.now()-e>800||(t=requestAnimationFrame(i))};return t=requestAnimationFrame(i),()=>{n=!0,cancelAnimationFrame(t)}},[Ee]);(0,N.useLayoutEffect)(()=>{if(ne&&(k.current=!0,De(se.current,{stick:!0,topKey:null,offset:0})),k.current)return A()},[te,ne,A]),(0,N.useLayoutEffect)(()=>{let e=null,t=!1;return Te().then(()=>{if(t)return;let n=Se(se.current);if(!n||n.stick||!n.topKey&&n.anchorMessageId===void 0)return;k.current=!1;let r={topKey:n.topKey,messageId:n.anchorMessageId,endMessageId:n.anchorEndMessageId},i=n.offset,a=0,o=!1,s=0,c=-1,l=0,u=performance.now();be.current=!0;let d=()=>{o=!0,cancelAnimationFrame(a),be.current=!1,xe.current===d&&(xe.current=null)};e=d,xe.current=d;let f=()=>{if(o)return;let e=dt(re.current,r),t=performance.now();if(e>=0&&(s===0&&(s=t),Ee(),b.current?.scrollToIndex({index:e,align:`start`,offset:i})),s===0){let e=S.current,n=e?e.scrollHeight:re.current.length,r=ie.current||!ae.current||re.current.length===0;(r||n!==c)&&(c=n,l=r?0:t);let i=l>0&&t-l>=1200,o=t-u>=3e4;!i&&!o?a=requestAnimationFrame(f):d();return}t-s<800?a=requestAnimationFrame(f):d()};a=requestAnimationFrame(f)}),()=>{t=!0,e?.()}},[Ee]);let Oe=s?.id;(0,N.useLayoutEffect)(()=>{if(!E&&!Oe||!k.current)return;let e=0,t=performance.now(),n=()=>{let r=S.current;r&&k.current&&r.scrollHeight-r.clientHeight-r.scrollTop>2&&(Ee(),r.scrollTo({top:r.scrollHeight,behavior:`auto`})),performance.now()-t<300&&(e=requestAnimationFrame(n))};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[E,Oe,Ee]),(0,N.useLayoutEffect)(()=>{if(!u||!d)return;let e=re.current.findIndex(e=>Gt(e)===d);e<0||(k.current=!1,Ee(),b.current?.scrollToIndex({index:e,align:`center`}))},[u,d,Ee]);let ke=(0,N.useRef)(null),Ae=(0,N.useCallback)(e=>{let t=e instanceof HTMLElement?e:null;if(S.current=t,m?.(t),ke.current?.(),ke.current=null,!t)return;Ce.current=t.scrollTop;let n=()=>{k.current=!1,xe.current?.()},r=()=>{let e=t.scrollTop,n=t.scrollHeight-t.clientHeight-e,r=performance.now()<we.current;n<=64?be.current||(k.current||De(se.current,{stick:!0,topKey:null,offset:0}),k.current=!0,xe.current?.()):!r&&e<Ce.current-1&&(k.current=!1,xe.current?.()),Ce.current=e,!k.current&&!be.current&&ue()},i=e=>{xe.current?.(),e.deltaY<0&&n()},a=0,o=e=>{a=e.touches[0]?.clientY??0},s=e=>{let t=(e.touches[0]?.clientY??0)-a;Math.abs(t)>6&&xe.current?.(),t>6&&n()};t.addEventListener(`scroll`,r,{passive:!0}),t.addEventListener(`wheel`,i,{passive:!0}),t.addEventListener(`touchstart`,o,{passive:!0}),t.addEventListener(`touchmove`,s,{passive:!0}),ke.current=()=>{t.removeEventListener(`scroll`,r),t.removeEventListener(`wheel`,i),t.removeEventListener(`touchstart`,o),t.removeEventListener(`touchmove`,s)}},[m,ue]),je=(0,N.useCallback)(e=>{w(e),e&&!be.current&&(k.current=!0),p?.(e)},[p]),Me=(0,N.useCallback)(()=>{!r||i||h()},[r,i,h]),Ne=(0,N.useCallback)(()=>{fe.current=te,k.current=!0,De(e,{stick:!0,topKey:null,offset:0}),A()},[e,te,A]),Pe=(0,N.useMemo)(()=>function(){return(0,P.jsx)(`div`,{className:Vo,children:(0,P.jsx)(Ko,{hasMore:r,loading:i,loadedInitial:a,hasItems:n.length>0})})},[r,a,i,n]),Fe=(0,N.useMemo)(()=>({agentId:e,busy:E,pendingApproval:s,blockedLabel:c,canInterrupt:l,onInterrupt:g}),[e,E,c,l,g,s]),Ie=(0,N.useMemo)(()=>function(){return(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center text-center`,children:[i?(0,P.jsx)(ce,{className:`mb-2 h-5 w-5 animate-spin text-muted-foreground`}):(0,P.jsx)(pe,{className:`mb-2 h-8 w-8 text-zinc-600`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading messages`:`No messages yet`})]})},[i]),Le=(0,N.useMemo)(()=>({Header:Pe,Footer:Ho,EmptyPlaceholder:Ie}),[Ie,Pe]);return(0,P.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,P.jsx)(qa,{ref:b,scrollerRef:Ae,className:`h-full py-3 md:py-4`,style:{height:`100%`,overflowX:`hidden`,overscrollBehavior:`contain`},context:Fe,data:n,firstItemIndex:O,initialTopMostItemIndex:de.current??Math.max(0,n.length-1),computeItemKey:(e,t)=>Gt(t),itemContent:(t,r)=>{let i=u?Gt(r):``,a=u&&f?.has(i),s=a&&i===d,c=t-O,l=r.type===`message`||r.type===`initial-prompt`?r.msg.from:null,p=n[c+1],m=p?.type===`message`||p?.type===`initial-prompt`?p.msg.from:null,h=l!==null&&l!==m;return(0,P.jsx)(`div`,{className:Vo,children:(0,P.jsx)(`div`,{className:he(a&&`rounded-xl ring-1 ring-amber-400/40 transition-shadow`,s&&`ring-2 ring-amber-400 bg-amber-400/5`),children:(0,P.jsx)(qo,{entry:r,agentId:e,showReasoning:o,showAvatar:h,onOpenReferencedPath:_,onPreviewReferencedPath:v,onPreviewReferencedPathEnd:y})})})},components:Le,startReached:Me,atBottomStateChange:je,atBottomThreshold:64,followOutput:()=>k.current?`auto`:!1,totalListHeightChanged:()=>{if(!k.current)return;let e=S.current;if(!e)return;let t=e.scrollHeight-e.clientHeight-e.scrollTop;t>=0&&t<=240&&(Ee(),e.scrollTo({top:e.scrollHeight,behavior:`auto`}))},increaseViewportBy:{top:600,bottom:600}},e),!C&&n.length>0&&(0,P.jsxs)(M,{type:`button`,size:`sm`,variant:`secondary`,className:`absolute bottom-3 right-4 z-20 h-8 gap-1.5 rounded-full border border-border/70 bg-background/95 px-3 text-xs shadow-lg backdrop-blur`,onClick:Ne,children:[(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),`Latest`,_e>0&&(0,P.jsx)(`span`,{className:`ml-0.5 min-w-4 rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-medium leading-none text-primary-foreground`,children:_e>99?`99+`:_e})]})]})}function Ko({hasMore:e,loading:t,loadedInitial:n,hasItems:r}){return t?(0,P.jsxs)(`div`,{className:`flex items-center justify-center gap-2 pb-3 text-xs text-muted-foreground`,children:[(0,P.jsx)(ce,{className:`h-3.5 w-3.5 animate-spin`}),(0,P.jsx)(`span`,{children:`Loading earlier messages`})]}):!e&&n&&r?(0,P.jsxs)(`div`,{className:`flex items-center justify-center gap-2 pb-3 text-xs text-muted-foreground/70`,children:[(0,P.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,P.jsx)(`span`,{children:`Beginning of conversation`}),(0,P.jsx)(`div`,{className:`h-px flex-1 bg-border`})]}):null}function qo({entry:e,agentId:t,showReasoning:n,showAvatar:r,onOpenReferencedPath:i,onPreviewReferencedPath:a,onPreviewReferencedPathEnd:o}){let s=A(e=>e.agentsById[t]?.issueRepo);return e.type===`message`?(0,P.jsx)(Xt,{msg:e.msg,peer:t,showAvatar:r,onOpenReferencedPath:i,onPreviewReferencedPath:a,onPreviewReferencedPathEnd:o}):e.type===`initial-prompt`?(0,P.jsx)(Et,{msg:e.msg,issueRepo:s}):e.type===`notice`?(0,P.jsx)(wt,{msg:e.msg}):e.type===`relay-injection`?(0,P.jsx)(Wt,{entry:e}):e.type===`prompt-resolution`?(0,P.jsx)(ht,{entry:e}):e.type===`agent-action`?(0,P.jsx)(yt,{entry:e}):e.type===`activity`?(0,P.jsx)(zt,{steps:e.steps,showReasoning:n,issueRepo:s}):e.type===`import-boundary`?(0,P.jsx)(Lt,{history:e.history}):e.type===`imported-message`?(0,P.jsx)(jt,{entry:e.entry,sourceLabel:e.history.sourceAgentLabel||e.history.sourcePeerId,issueRepo:s}):e.type===`status`?(0,P.jsx)(Jt,{event:e.event}):e.type===`date`?(0,P.jsx)(Ct,{date:e.date}):(0,P.jsx)(xt,{timestamp:e.timestamp})}var Jo=[],Yo=15e3;function Xo(e){return e.kind===`session`&&e.payload?.session?.type===`prompt`}function Zo(e){let t=e.filter(e=>e.kind===`chat`&&e.from===`user`);return t.length?e.filter(e=>{if(!Xo(e)||e.from!==`user`)return!0;let n=We(e).trim();if(!n)return!0;let r=Ke(e.createdAt);return!t.some(e=>We(e).trim()===n&&Math.abs(Ke(e.createdAt)-r)<=Yo)}):e}function Qo({threads:e,onBack:t,showBackButton:n}){let r=A(e=>e.selectedInboxThread),i=A(e=>e.selectedInboxThread?e.agentsById[e.selectedInboxThread]:void 0)||null,a=A(e=>e.inboxDrafts),o=Ee(),s=A(e=>e.sendChatMessage),c=A(e=>e.openFilesAt),l=A(e=>e.openFilesForAgent),u=A(e=>e.openAgentDetail),d=A(e=>e.chatSending),f=A(e=>e.markInboxThreadRead),p=A(e=>e.markInboxThreadUnread),m=A(e=>e.setReplyDraft),h=A(e=>e.exportThread),g=A(e=>e.doAgentAction),_=A(e=>e.workspaceAction),v=A(e=>e.openWorkspaceFocus),y=A(e=>e.forkFromAgent),b=A(e=>e.chatHistoryImports),x=A(e=>e.agentChatByAgent[e.selectedInboxThread]),S=x?.messages??Jo,w=A(e=>e.loadOlder),T=A(e=>e.openConfirm),D=A(e=>e.showError),O=A(e=>e.orchestrators),ee=A(e=>e.fetchOrchestrators),ne=A(e=>e.showReasoning),re=A(e=>e.voiceTtsEnabled),ie=A(e=>e.setVoiceTtsEnabled),ae=A(e=>e.voiceInputMode),oe=A(e=>e.plansByThread);(0,N.useRef)(null);let se=(0,N.useRef)(null),[ce,le]=(0,N.useState)(`idle`),ue=(0,N.useRef)([]),[de,fe]=(0,N.useState)([]),[me,he]=(0,N.useState)(!1),[ge,_e]=(0,N.useState)(null),[ve,k]=(0,N.useState)(null),[ye,be]=(0,N.useState)(``),xe=(0,N.useRef)(null),Se=(0,N.useRef)(0),[Te,De]=(0,N.useState)(null),Ae=Cn(r),je=(0,N.useMemo)(()=>e.find(e=>e.peer===r)||null,[e,r]),Me=(0,N.useMemo)(()=>Zo(S.filter(e=>Pe(r,e)&&!Fe(e)).sort((e,t)=>e.id-t.id)),[S,r]),Ne=typeof i?.meta?.lifecycleAction==`string`&&i.meta.lifecycleAction.startsWith(`finalizing-`),{terminalOpen:Ie,terminalTarget:Le,terminalOpening:Re,openTerminal:ze,closeTerminal:Be}=Zt(i?.id),Ve=typeof i?.meta?.spawnRequestId==`string`?i.meta.spawnRequestId:``,Ue=(0,N.useMemo)(()=>b.filter(e=>e.targetAgentId===r||!!(Ve&&e.targetSpawnRequestId===Ve)),[Ve,b,r]),We=Ye(i),Ge=We?.pendingApproval,Ke=(0,N.useMemo)(()=>{if(!r||!je&&Me.length===0)return null;let e=Me[Me.length-1]??je?.lastMessage??null,t=je?.previewMessage&&Me.some(e=>e.id===je.previewMessage?.id)?je.previewMessage:e;return{id:je?.id??r,peer:r,messages:Me,lastMessage:e,previewMessage:t,attention:je?.attention??{unread:0,needsHumanResponse:!1,score:0},archived:je?.archived??!1,draft:je?.draft??``}},[r,je,Me]),qe=Ke||(Ue.length>0?{peer:r,messages:[],importedHistory:Ue}:null),Je=a[r]||``,Xe=typeof i?.meta?.tmuxSession==`string`&&i.meta.tmuxSession.trim()?i.meta.tmuxSession:null,Ze=Xe?O.find(e=>e.managedAgents?.some(e=>e.agentId===i.id||e.tmuxSession===Xe))??null:null,Qe=!!(Xe&&Ze?.status===`online`&&i?.providerCapabilities?.terminal?.live?.read),$e=!!(Qe&&i?.providerCapabilities?.terminal?.live?.write),et=i?.providerCapabilities?.terminal?.attach?.create===!0,nt=Qe||et,it=He(i,`compact`),at=He(i,`clearContext`),st=He(i,`shutdown`),ct=He(i,`interrupt`),lt=()=>{i&&g(i,`interrupt`)},[dt,ft]=(0,N.useState)(0),[mt,ht]=(0,N.useState)(!1),gt=i?.providerCapabilities?.liveSession?.slashCommands===!0,_t=i?.providerCapabilities?.model?.provider??(typeof i?.meta?.provider==`string`?i.meta.provider:void 0),yt=gt&&!mt&&/^\/\S*$/.test(Je)?fn(_t).filter(e=>e.name.toLowerCase().startsWith(Je.toLowerCase())):[],bt=yt.length?Math.min(dt,yt.length-1):0;function xt(e){m(r,`${e.name} `),ft(0)}function Ct(e){m(r,e),mt&&ht(!1),ft(0)}let wt=de.some(e=>e.uploading),Tt=de.filter(e=>e.artifact),Et=Je.trim().length>0||de.length>0;An(i?.id??``,Je.trim().length>0),wn(Et,(0,N.useCallback)(()=>{},[])),ue.current=de,(0,N.useEffect)(()=>()=>{tt(ue.current)},[]),(0,N.useEffect)(()=>{i?.meta?.tmuxSession&&O.length===0&&ee()},[i?.id,i?.meta?.tmuxSession,O.length]),(0,N.useEffect)(()=>()=>{xe.current!==null&&window.clearTimeout(xe.current)},[]);let Dt=typeof i?.spawnedBy==`string`?i.spawnedBy:void 0,Ot=A(e=>Dt?e.agentsById[Dt]?.meta?.provider:void 0),kt=!!(x?.loadedInitial&&!x.hasMore),jt=(0,N.useMemo)(()=>Kt(Me,Ae,i?.createdAt,Ue,{...Dt?{spawnedBy:{agentId:Dt,provider:Ot}}:{},initialPromptComplete:kt}),[Me,Ae,i?.createdAt,Ue,Dt,Ot,kt]),Mt=(0,N.useMemo)(()=>ut(i,Me,Ke?.lastMessage,oe),[i,Ke?.lastMessage,oe,Me]),Nt=On(jt),Pt=(0,N.useCallback)(()=>{!r||!x?.hasMore||x.loading||w(r)},[x?.hasMore,x?.loading,w,r]),Ft=(0,N.useCallback)(()=>{xe.current!==null&&(window.clearTimeout(xe.current),xe.current=null)},[]),It=(0,N.useCallback)(async e=>{let t=rt(O,e);if(!t)return null;try{let n=await te(`GET`,`/orchestrators/${encodeURIComponent(t.id)}/files/stat?path=${encodeURIComponent(e)}`);return{orchestratorId:t.id,path:n.path,type:n.type}}catch{return null}},[O]),Lt=(0,N.useCallback)((e,t,n)=>{if(!pt()||!n)return;let r=++Se.current;It(e).then(e=>{Se.current===r&&e&&(Ft(),k({...e,line:t||0,anchor:n}),be(``))})},[Ft,It]),Rt=(0,N.useCallback)(()=>{Se.current+=1,Ft(),xe.current=window.setTimeout(()=>{k(null)},250)},[Ft]),zt=(0,N.useCallback)((e,t)=>{It(e).then(n=>{if(!n){D(`File Not Found`,e);return}if(pt()){Se.current+=1,Ft(),k(null),_e({...n,line:t||0}),be(``);return}n.type===`directory`?c({orchestratorId:n.orchestratorId,path:n.path,overlay:!0}):c({orchestratorId:n.orchestratorId,path:ot(n.path),selectedPath:n.path,line:t,overlay:!0})})},[Ft,c,It,D]);function Bt(){_e(null),be(``)}async function Vt(e){let t=Array.from(e).filter(e=>e.size>0);if(!t.length)return;let n=t.map(e=>({id:`${Date.now()}-${e.name}-${Math.random().toString(16).slice(2)}`,fileName:e.name,size:e.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,uploading:!0}));fe(e=>[...e,...n]);for(let e=0;e<t.length;e+=1){let r=t[e],i=n[e];try{let e=await E(`/artifacts`,r,{filename:r.name,sensitivity:`normal`});fe(t=>t.map(t=>t.id===i.id?{...t,artifact:e,uploading:!1}:t))}catch(e){fe(t=>t.map(t=>t.id===i.id?{...t,error:e.message,uploading:!1}:t))}}}function Ht(e){fe(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})}function Wt(){tt(de),fe([])}function Gt(){if(!Je.trim()&&Tt.length===0||!r||d||wt||Ne)return;let e=Tt.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));s(Je,{peer:r,lastMessage:Ke?.lastMessage||null},e),Wt()}function qt(e){if(yt.length){if(e.key===`ArrowDown`){e.preventDefault(),ft(e=>Math.min(e+1,yt.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),ft(e=>Math.max(e-1,0));return}if(e.key===`Escape`){e.preventDefault(),ht(!0);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=yt[bt];t&&xt(t);return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Gt())}function Jt(e){let t=Array.from(e.clipboardData.files).filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),Vt(t))}async function Yt(){if(!Oe||ce!==`idle`||!r)return;Ce.bargeIn();let e=new we;try{await e.start(),se.current=e,le(`recording`)}catch(e){se.current=null,le(`idle`),D(`Microphone unavailable`,e?.message||`Could not access the microphone.`)}}async function Xt(){let e=se.current;if(!(!e||ce!==`recording`)){se.current=null,le(`transcribing`);try{let t=await e.stop();if(!t)return;let n=await ke(t);if(!n)return;let i=Je?`${Je} ${n}`:n;if(ae===`autosend`&&!d&&!wt){let e=Tt.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));s(i,{peer:r,lastMessage:Ke?.lastMessage||null},e),Wt()}else m(r,i)}catch(e){D(`Transcription failed`,e?.message||`Could not transcribe audio.`)}finally{le(`idle`)}}}return r?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex h-full min-w-0`,children:[(0,P.jsxs)(`div`,{className:`@container/chat flex h-full min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(mn,{selectedInboxThread:r,agent:i,now:o,blockedState:We,thread:Ke,exportableThread:qe,importedHistory:Ue,showBackButton:n,onBack:t,openAgentDetail:u,openWorkspaceFocus:v,voiceTtsEnabled:re,setVoiceTtsEnabled:ie,canOpenTerminal:nt,terminalOpening:Re,handleOpenTerminal:ze,canInterrupt:ct,interruptAgent:lt,canCompact:it,canClearContext:at,canShutdown:st,openConfirm:T,workspaceAction:_,doAgentAction:g,openFilesForAgent:l,forkFromAgent:y,markInboxThreadUnread:p,markInboxThreadRead:f,exportThread:h,onOpenSearch:Nt.openSearch}),(0,P.jsx)(rn,{threadId:Mt&&`threadId`in Mt?Mt.threadId:null,teamId:Mt&&`teamId`in Mt?Mt.teamId:void 0,channel:Mt?.channel}),r&&(0,P.jsx)(tn,{agentId:r}),Nt.open&&(0,P.jsx)(hn,{query:Nt.query,position:Nt.position,total:Nt.total,onQueryChange:Nt.setQuery,onNext:Nt.next,onPrev:Nt.prev,onClose:Nt.close}),(0,P.jsx)(vt,{scrollEl:Te,timeline:jt}),(0,P.jsx)(Go,{agentId:r,agentStatus:i?.status,timeline:jt,hasMore:x?.hasMore??!1,loading:x?.loading??!1,loadedInitial:x?.loadedInitial??!1,showReasoning:ne,pendingApproval:Ge,blockedLabel:We?.label,canInterrupt:ct,searchActive:Nt.open,searchCurrentKey:Nt.currentKey,searchMatchKeys:Nt.matchKeySet,onScrollerRef:De,onLoadOlder:Pt,onInterrupt:lt,onOpenReferencedPath:zt,onPreviewReferencedPath:Lt,onPreviewReferencedPathEnd:Rt}),(0,P.jsx)(yn,{draft:Je,placeholder:`Message ${i?j(i):r}…`,chatSending:d,disabled:Ne,hasPendingUploads:wt,readyAttachmentCount:Tt.length,pendingAttachments:de,micAvailable:Oe,micState:ce,slashMatches:yt,slashActiveIndex:bt,onDraftChange:Ct,onKeyDown:qt,onPaste:Jt,onUploadFiles:e=>{Vt(e)},onRemovePendingAttachment:Ht,onSend:Gt,onAcceptSlash:xt,onSlashHover:ft,onStartPtt:()=>{Yt()},onStopPtt:()=>{Xt()},footerText:Ne?`${i?j(i):`Agent`} is wrapping up (${(i?.meta?.lifecycleAction).slice(11)}) — messaging paused`:`Enter to send · Shift+Enter for newline`})]}),ge&&(0,P.jsxs)(`aside`,{className:`hidden h-full w-[min(44vw,720px)] min-w-[360px] shrink-0 flex-col border-l border-border bg-background xl:flex`,children:[(0,P.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 text-xs font-medium text-muted-foreground`,children:`File preview`}),ye&&(0,P.jsx)(`span`,{className:`max-w-[18rem] truncate text-xs text-red-400`,children:ye}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Close preview`,onClick:Bt,children:(0,P.jsx)(C,{className:`h-3.5 w-3.5`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:ge.type===`directory`?(0,P.jsx)(At,{orchestratorId:ge.orchestratorId,selectedPath:ge.path,onReadError:be}):(0,P.jsx)(Ut,{orchestratorId:ge.orchestratorId,selectedPath:ge.path,line:ge.line,onReadError:be})})]})]}),ve&&(0,P.jsx)(xn,{preview:ve,error:ye,onReadError:be,onMouseEnter:Ft,onMouseLeave:Rt}),Le&&(0,P.jsx)(St,{open:Ie,onOpenChange:Be,orchestratorId:Le.orchestratorId,session:Le.session,interactive:Le.interactive||$e,canWrite:$e})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4`,children:[(0,P.jsx)(pe,{className:`w-12 h-12 text-zinc-600 mb-3`}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Select an agent to start chatting`})]})}function $o(){let e=A(e=>e.inboxDrafts),t=A(e=>e.agentsById),n=A(e=>e.set);(0,N.useEffect)(()=>{let r=Object.keys(e);if(r.length===0)return;let i=r.filter(e=>!t[e]&&e!==`user`);if(i.length===0)return;let a=setTimeout(()=>{let e=A.getState().agentsById,t={...A.getState().inboxDrafts},r=!1;for(let n of i)e[n]||(delete t[n],r=!0);r&&n({inboxDrafts:t})},3e4);return()=>clearTimeout(a)},[])}function es(e,t){(0,N.useEffect)(()=>{if(typeof window>`u`||!e||!window.matchMedia(`(max-width: 767px)`).matches)return;window.history.pushState({chatOpen:!0},``);function n(e){e.state?.chatOpen||t()}return window.addEventListener(`popstate`,n),()=>{window.removeEventListener(`popstate`,n),window.history.state?.chatOpen&&window.history.back()}},[e,t])}function ts(){let e=qt(),t=A(e=>e.selectedInboxThread),n=A(e=>e.set),r=A(e=>e.loadAgentChat),i=A(e=>e.agentsById),a=!!t,o=nn();$o(),(0,N.useEffect)(()=>{t&&r(t)},[t,r]),(0,N.useEffect)(()=>{t&&(i[t]||n({selectedInboxThread:``}))},[t,i,n]);let s=(0,N.useCallback)(()=>{n({selectedInboxThread:``})},[n]);return es(a,s),(0,P.jsx)(`div`,{className:`flex h-full min-h-0`,children:o?(0,P.jsx)(`div`,{className:`flex w-full overflow-hidden`,children:a?(0,P.jsx)(ns,{children:(0,P.jsx)(Qo,{threads:e,onBack:s,showBackButton:!0},t||`empty`)}):(0,P.jsx)(`div`,{className:`w-full flex flex-col overflow-hidden`,children:(0,P.jsx)(ln,{threads:e})})}):(0,P.jsxs)(`div`,{className:`flex w-full`,children:[(0,P.jsx)(`div`,{className:`w-1/3 min-w-[240px] max-w-xs flex flex-col overflow-hidden`,children:(0,P.jsx)(ln,{threads:e})}),(0,P.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:(0,P.jsx)(Qo,{threads:e},t||`empty`)})]})})}function ns({children:e}){let t=Yt();return(0,P.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-40 flex flex-col bg-background pt-[var(--sat)]`,style:{height:t?`${t}px`:`100dvh`},children:e})}export{ts as ChatView};
|
|
2
|
-
//# sourceMappingURL=chat-Clz6qOtn.js.map
|