tide-commander 1.68.0 → 1.69.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/dist/assets/{BossLogsModal-BAAom9o2.js → BossLogsModal-CMDdkhTL.js} +1 -1
- package/dist/assets/{BossSpawnModal-toDplDkF.js → BossSpawnModal-C7lw2Wzh.js} +1 -1
- package/dist/assets/{ControlsModal-D03U6gmX.js → ControlsModal-BtJJYkcM.js} +1 -1
- package/dist/assets/{DockerLogsModal-BNSsrzrl.js → DockerLogsModal-Lw19ZQVz.js} +1 -1
- package/dist/assets/{EmbeddedEditor-BYhdfoCE.js → EmbeddedEditor-UwKqvTkJ.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-myZ2ZrcR.js → GmailOAuthSetup-BOlxzJ7D.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-CcXj76ys.js → GoogleOAuthSetup-DYvaSFQp.js} +1 -1
- package/dist/assets/{IframeModal-Dz7GP3Cv.js → IframeModal-DRJROx67.js} +1 -1
- package/dist/assets/{IntegrationsPanel-BcuHSs4k.js → IntegrationsPanel-Bp1O-I5s.js} +2 -2
- package/dist/assets/{LogViewerModal-xUgsZ9ej.js → LogViewerModal-BIlhbii5.js} +1 -1
- package/dist/assets/{MonitoringModal-C2Y2xSlC.js → MonitoringModal-CuDrTaVn.js} +1 -1
- package/dist/assets/{PM2LogsModal-_jrHQUo9.js → PM2LogsModal-C1VLY7hc.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-ChVg52z-.js → RestoreArchivedAreaModal-ObvIYj2V.js} +1 -1
- package/dist/assets/{Scene2DCanvas-B3W853kK.js → Scene2DCanvas-BM_GFevb.js} +1 -1
- package/dist/assets/{SceneManager-B18djKZB.js → SceneManager-FeZQ9HI1.js} +1 -1
- package/dist/assets/{SkillsPanel-H1LGmiQa.js → SkillsPanel-CtFwVaQj.js} +2 -2
- package/dist/assets/{SpawnModal-C6jHLOqe.js → SpawnModal-37ChIpU2.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-D7SFd1PQ.js → SubordinateAssignmentModal-aDkxc3YR.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-BHydg20p.js → TriggerManagerPanel-CQxcjiJu.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-CV2Uyz3q.js → WorkflowEditorPanel-D_8Bnuzv.js} +1 -1
- package/dist/assets/{index-6yiJ4K77.js → index-9Bftos7u.js} +6 -6
- package/dist/assets/{index-DGiQZp-V.js → index-BIkn0arf.js} +3 -3
- package/dist/assets/{index-9QRHHhjy.js → index-BMayWtlQ.js} +1 -1
- package/dist/assets/{index-C46pFKRu.js → index-BYR78OCI.js} +1 -1
- package/dist/assets/index-Br8WLiXq.js +1 -0
- package/dist/assets/index-CX4tk_vI.js +1 -0
- package/dist/assets/index-D8fn_Wjl.js +1 -0
- package/dist/assets/index-DDfjGtDT.css +1 -0
- package/dist/assets/{index-DajufGc7.js → index-K0KrIo24.js} +1 -1
- package/dist/assets/{index-CSfdM2wC.js → index-YH8hJh62.js} +2 -2
- package/dist/assets/{main-Cqo-Awpr.js → main--_0rf6yB.js} +75 -75
- package/dist/assets/main-BXDdkAuE.css +1 -0
- package/dist/assets/{web-Df6f3cdZ.js → web-BuuzpQy3.js} +1 -1
- package/dist/assets/{web-C8dPHvwd.js → web-Dn-wQDim.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/src/packages/server/claude/runner.js +58 -7
- package/dist/src/packages/server/services/runtime-command-execution.js +37 -4
- package/dist/src/packages/shared/agent-types.js +5 -0
- package/package.json +1 -1
- package/dist/assets/index-BUHCV_MS.js +0 -1
- package/dist/assets/index-Bymy4ZcD.js +0 -1
- package/dist/assets/index-CbwV9efF.css +0 -1
- package/dist/assets/index-CvN92QjN.js +0 -1
- package/dist/assets/main-PqjE2LNi.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b_ as a}from"./main
|
|
1
|
+
import{b_ as a}from"./main--_0rf6yB.js";import{ImpactStyle as i,NotificationType as r}from"./index-YH8hJh62.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class h extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{h as HapticsWeb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b_ as s}from"./main
|
|
1
|
+
import{b_ as s}from"./main--_0rf6yB.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class l extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{l as LocalNotificationsWeb};
|
package/dist/index.html
CHANGED
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />
|
|
23
23
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png" />
|
|
24
24
|
<title>Tide Commander</title>
|
|
25
|
-
<script type="module" crossorigin src="/assets/main
|
|
25
|
+
<script type="module" crossorigin src="/assets/main--_0rf6yB.js"></script>
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react--Eh9ivFN.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/vendor-three-Chj50gSY.js">
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
28
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BXDdkAuE.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="app"></div>
|
|
@@ -128,6 +128,22 @@ export class ClaudeRunner {
|
|
|
128
128
|
this.callbacks.onError(agentId, error.message);
|
|
129
129
|
});
|
|
130
130
|
this.bus.on('runner.watchdog_missing_process', ({ agentId, activeProcess }) => {
|
|
131
|
+
// If the process (tmux session or pipe process) exited after completing
|
|
132
|
+
// its turn (turnState='waiting_for_input') and has queued messages, treat
|
|
133
|
+
// it the same as a clean turn-end exit in process_closed: respawn with
|
|
134
|
+
// session resume, delivering the queued message as the new prompt.
|
|
135
|
+
// This is the tmux analogue of the cleanTurnEnd branch in process_closed.
|
|
136
|
+
// Without this, codex/opencode agents in tmux mode silently lose queued
|
|
137
|
+
// messages because the tmux launcher PID doesn't emit 'close' events —
|
|
138
|
+
// the watchdog is the only signal we get when the session dies.
|
|
139
|
+
const queuedCount = this.messageQueue.get(agentId)?.length ?? 0;
|
|
140
|
+
if (activeProcess.turnState === 'waiting_for_input'
|
|
141
|
+
&& queuedCount > 0
|
|
142
|
+
&& activeProcess.lastRequest) {
|
|
143
|
+
log.log(`🔁 [WATCHDOG] Agent ${agentId}: session died after turn complete with ${queuedCount} queued message(s), respawning to deliver`);
|
|
144
|
+
this.respawnWithQueuedMessage(agentId, activeProcess);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
131
147
|
this.restartPolicy.maybeAutoRestart(agentId, activeProcess, null, null);
|
|
132
148
|
});
|
|
133
149
|
// Track turn state transitions based on events
|
|
@@ -232,6 +248,9 @@ export class ClaudeRunner {
|
|
|
232
248
|
supportsStdin() {
|
|
233
249
|
return this.backend.requiresStdinInput();
|
|
234
250
|
}
|
|
251
|
+
closesStdinAfterPrompt() {
|
|
252
|
+
return this.backend.shouldCloseStdinAfterPrompt?.() === true;
|
|
253
|
+
}
|
|
235
254
|
setAutoRestart(enabled) {
|
|
236
255
|
this.autoRestartEnabled = enabled;
|
|
237
256
|
log.log(`🔄 Auto-restart ${enabled ? 'enabled' : 'disabled'}`);
|
|
@@ -286,8 +305,24 @@ export class ClaudeRunner {
|
|
|
286
305
|
log.error(`❌ [SEND_MESSAGE] No active process for agent ${agentId}`);
|
|
287
306
|
return false;
|
|
288
307
|
}
|
|
289
|
-
// tmux mode: send via tmux send-keys
|
|
308
|
+
// tmux mode: send via tmux send-keys — EXCEPT for backends that close stdin
|
|
309
|
+
// after the initial prompt (codex). Those are launched as `cat <file> | codex`
|
|
310
|
+
// so codex's stdin is the pipe, NOT the tmux pane. Once cat hits EOF, codex
|
|
311
|
+
// gets EOF; tmux send-keys would write to a pane codex isn't reading. We must
|
|
312
|
+
// queue those messages and deliver them via respawn-with-session-resume
|
|
313
|
+
// triggered by the watchdog_missing_process handler when the session dies.
|
|
314
|
+
// Also queue mid-turn messages for all backends — send-keys mid-turn is
|
|
315
|
+
// unreliable and can interfere with the current prompt being processed.
|
|
290
316
|
if (activeProcess.tmuxSession) {
|
|
317
|
+
const tmuxTurnState = activeProcess.turnState || 'processing';
|
|
318
|
+
const tmuxBackendClosesStdin = this.backend.shouldCloseStdinAfterPrompt?.() === true;
|
|
319
|
+
if (tmuxTurnState === 'processing' || tmuxBackendClosesStdin) {
|
|
320
|
+
const queue = this.messageQueue.get(agentId) ?? [];
|
|
321
|
+
queue.push(message);
|
|
322
|
+
this.messageQueue.set(agentId, queue);
|
|
323
|
+
log.log(`📋 [QUEUE-TMUX] Agent ${agentId}: queued message (turnState=${tmuxTurnState}, closesStdin=${tmuxBackendClosesStdin}, queue=${queue.length}, ${message.length} chars)`);
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
291
326
|
const stdinInput = this.backend.formatStdinInput(message);
|
|
292
327
|
log.log(`📨 [SEND_MESSAGE] Agent ${agentId} (tmux mode), sending via tmux send-keys (${stdinInput.length} chars)`);
|
|
293
328
|
const ok = sendToTmux(agentId, stdinInput);
|
|
@@ -298,17 +333,23 @@ export class ClaudeRunner {
|
|
|
298
333
|
}
|
|
299
334
|
const turnState = activeProcess.turnState || 'processing';
|
|
300
335
|
const messageLen = message.length;
|
|
336
|
+
const backendClosesStdin = this.backend.shouldCloseStdinAfterPrompt?.() === true;
|
|
301
337
|
// Queue mid-turn messages BEFORE any stdin-writability check. Writing to the OS
|
|
302
338
|
// stdin pipe mid-turn is unreliable on all backends (async callback + possible
|
|
303
|
-
// pipe close), and backends like opencode explicitly close stdin after the
|
|
304
|
-
// prompt so there is nothing to write to at all.
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
|
|
339
|
+
// pipe close), and backends like codex/opencode explicitly close stdin after the
|
|
340
|
+
// initial prompt so there is nothing to write to at all. For stdin-closed backends
|
|
341
|
+
// we queue regardless of turnState — there is a race window between step_complete
|
|
342
|
+
// (turnState flips to 'waiting_for_input') and process exit where direct stdin
|
|
343
|
+
// write would fail, the fallthrough path SIGINTs the old process, and the
|
|
344
|
+
// respawn-with-queue path is skipped (cleanTurnEnd requires a clean exit).
|
|
345
|
+
// The queue is the source of truth; drain happens after the current turn ends
|
|
346
|
+
// (via stdin for stdin-open backends, or via session-resume respawn for
|
|
347
|
+
// stdin-closed ones).
|
|
348
|
+
if (turnState === 'processing' || backendClosesStdin) {
|
|
308
349
|
const queue = this.messageQueue.get(agentId) ?? [];
|
|
309
350
|
queue.push(message);
|
|
310
351
|
this.messageQueue.set(agentId, queue);
|
|
311
|
-
log.log(`📋 [QUEUE] Agent ${agentId}
|
|
352
|
+
log.log(`📋 [QUEUE] Agent ${agentId}: queued message for post-turn delivery (turnState=${turnState}, closesStdin=${backendClosesStdin}, queue=${queue.length}, ${messageLen} chars)`);
|
|
312
353
|
return true;
|
|
313
354
|
}
|
|
314
355
|
// Agent is waiting for input: send directly via stdin (immediate processing)
|
|
@@ -364,6 +405,16 @@ export class ClaudeRunner {
|
|
|
364
405
|
if (!queue || queue.length === 0)
|
|
365
406
|
return;
|
|
366
407
|
if (activeProcess.tmuxSession) {
|
|
408
|
+
// For stdin-closing backends in tmux mode (codex): the process was launched
|
|
409
|
+
// as `cat <file> | codex` so codex's stdin is the pipe, not the tmux pane.
|
|
410
|
+
// Once the initial file is consumed codex gets EOF; tmux send-keys would
|
|
411
|
+
// write to a pane codex isn't reading. Leave the message in the queue and
|
|
412
|
+
// let the runner.watchdog_missing_process handler respawn with session
|
|
413
|
+
// resume when the codex process exits and the tmux session dies.
|
|
414
|
+
if (this.backend.shouldCloseStdinAfterPrompt?.() === true) {
|
|
415
|
+
log.log(`⏸️ [QUEUE-DRAIN] Agent ${agentId}: tmux + stdin-closed backend, deferring delivery to respawn after session exit (${queue.length} queued)`);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
367
418
|
const nextMessage = queue.shift();
|
|
368
419
|
if (queue.length === 0)
|
|
369
420
|
this.messageQueue.delete(agentId);
|
|
@@ -68,6 +68,33 @@ export function createRuntimeCommandExecution(deps) {
|
|
|
68
68
|
throw new Error(`Runtime provider not initialized: ${agent.provider}`);
|
|
69
69
|
}
|
|
70
70
|
const processRunning = runner.isRunning(agentId);
|
|
71
|
+
// For backends that close stdin after the initial prompt (codex, opencode),
|
|
72
|
+
// a new user prompt arriving mid-turn should INTERRUPT the current work and
|
|
73
|
+
// RESTART the session with the new prompt — not wait for the current turn
|
|
74
|
+
// to finish and then deliver the queued message via session-resume (which
|
|
75
|
+
// is the default queue-based behavior for these backends).
|
|
76
|
+
//
|
|
77
|
+
// Safe for tmux mode: runner.stop() routes through
|
|
78
|
+
// src/packages/server/claude/runner/process-lifecycle.ts:281-284 which
|
|
79
|
+
// calls killTmuxSession — this destroys only the agent's detached tmux
|
|
80
|
+
// session (created by spawnInTmux), NOT the user's own pane/window. The
|
|
81
|
+
// subsequent executeCommand spawns a fresh tmux session for the new turn.
|
|
82
|
+
//
|
|
83
|
+
// clearQueue=true is intentional: user is replacing whatever was pending
|
|
84
|
+
// with this new command, so any queued messages from prior mid-turn sends
|
|
85
|
+
// are stale and must be dropped.
|
|
86
|
+
const backendClosesStdin = runner.closesStdinAfterPrompt?.() === true;
|
|
87
|
+
if (processRunning && backendClosesStdin && !forceNewSession) {
|
|
88
|
+
const turnState = runner.getTurnState?.(agentId);
|
|
89
|
+
if (turnState !== 'waiting_for_input') {
|
|
90
|
+
log.log(`[sendCommand] Agent ${agentId} (${agent.provider}): mid-turn prompt (turnState=${turnState ?? 'unknown'}) — interrupting current work and restarting session with new prompt`);
|
|
91
|
+
emitOutput(agentId, '🛑 [System] Interrupting current work to process new prompt…', false, undefined, 'system-interrupt-restart');
|
|
92
|
+
await runner.stop(agentId, true);
|
|
93
|
+
agentService.updateAgent(agentId, { taskCount: (agent.taskCount || 0) + 1 });
|
|
94
|
+
await executeCommand(agentId, command, systemPrompt, forceNewSession, customAgent);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
71
98
|
if (processRunning && !forceNewSession) {
|
|
72
99
|
if (runner.supportsStdin()) {
|
|
73
100
|
const turnState = runner.getTurnState?.(agentId) || 'unknown';
|
|
@@ -87,10 +114,16 @@ export function createRuntimeCommandExecution(deps) {
|
|
|
87
114
|
}
|
|
88
115
|
agentService.updateAgent(agentId, updateData);
|
|
89
116
|
// Only start the stdin watchdog when the message was written directly to stdin
|
|
90
|
-
// (i.e. the agent was idle/waiting_for_input
|
|
91
|
-
// (turnState === 'processing'),
|
|
92
|
-
//
|
|
93
|
-
|
|
117
|
+
// (i.e. the agent was idle/waiting_for_input on a stdin-open backend).
|
|
118
|
+
// When the agent was mid-turn (turnState === 'processing'), or the backend
|
|
119
|
+
// closes stdin after the initial prompt (codex/opencode), the runner queues
|
|
120
|
+
// the message and delivers it via the step_complete handler or the
|
|
121
|
+
// respawn-on-close path — no watchdog needed since delivery is guaranteed.
|
|
122
|
+
// Starting the watchdog here would cause double-execution for stdin-closed
|
|
123
|
+
// backends because the watchdog's onRespawn path and the queue-drain path
|
|
124
|
+
// would both deliver the same command.
|
|
125
|
+
const backendClosesStdin = runner.closesStdinAfterPrompt?.() === true;
|
|
126
|
+
if (turnState !== 'processing' && !backendClosesStdin) {
|
|
94
127
|
startStdinWatchdog({
|
|
95
128
|
agentId,
|
|
96
129
|
command,
|
|
@@ -17,6 +17,11 @@ export const PERMISSION_MODES = {
|
|
|
17
17
|
interactive: { label: 'Interactive', description: 'Ask for approval before sensitive operations' },
|
|
18
18
|
};
|
|
19
19
|
export const CODEX_MODELS = {
|
|
20
|
+
'gpt-5.5': {
|
|
21
|
+
label: 'GPT-5.5',
|
|
22
|
+
description: 'Next-generation frontier model with advanced reasoning and coding',
|
|
23
|
+
icon: '✨',
|
|
24
|
+
},
|
|
20
25
|
'gpt-5.4': {
|
|
21
26
|
label: 'GPT-5.4',
|
|
22
27
|
description: 'Latest frontier model with advanced reasoning and coding',
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f,I as H,a3 as He,K as Je,$ as Xe,bB as Ze,r as A,s as se,bC as be,Z as fe,u as Ce}from"./main-Cqo-Awpr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function q(t){return Array.isArray?Array.isArray(t):Pe(t)==="[object Array]"}function qe(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function et(t){return t==null?"":qe(t)}function X(t){return typeof t=="string"}function $e(t){return typeof t=="number"}function tt(t){return t===!0||t===!1||st(t)&&Pe(t)=="[object Boolean]"}function Te(t){return typeof t=="object"}function st(t){return Te(t)&&t!==null}function O(t){return t!=null}function me(t){return!t.trim().length}function Pe(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const nt="Incorrect 'index' type",rt=t=>`Invalid value for key ${t}`,it=t=>`Pattern length exceeds max of ${t}.`,ct=t=>`Missing ${t} property in key`,ot=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class at{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=Ke(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ke(t){let e=null,s=null,n=null,r=1,i=null;if(X(t)||q(t))n=t,e=Se(t),s=pe(t);else{if(!ve.call(t,"name"))throw new Error(ct("name"));const c=t.name;if(n=c,ve.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(ot(c));e=Se(c),s=pe(c),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function Se(t){return q(t)?t:t.split(".")}function pe(t){return q(t)?t.join("."):t}function ut(t,e){let s=[],n=!1;const r=(i,c,a)=>{if(O(i))if(!c[a])s.push(i);else{let u=c[a];const l=i[u];if(!O(l))return;if(a===c.length-1&&(X(l)||$e(l)||tt(l)))s.push(et(l));else if(q(l)){n=!0;for(let h=0,d=l.length;h<d;h+=1)r(l[h],c,a+1)}else c.length&&r(l,c,a+1)}};return r(t,X(e)?e.split("."):e,0),n?s:s[0]}const lt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ht={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},dt={location:0,threshold:.6,distance:100},ft={useExtendedSearch:!1,getFn:ut,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...ht,...lt,...dt,...ft};const mt=/[^ ]+/g;function pt(t=1,e=3){const s=new Map,n=Math.pow(10,e);return{get(r){const i=r.match(mt).length;if(s.has(i))return s.get(i);const c=1/Math.pow(i,.5*t),a=parseFloat(Math.round(c*n)/n);return s.set(i,a),a},clear(){s.clear()}}}class we{constructor({getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=pt(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();X(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!O(e)||me(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let c=r.getFn?r.getFn(e):this.getFn(e,r.path);if(O(c)){if(q(c)){let a=[];const u=[{nestedArrIndex:-1,value:c}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(O(h))if(X(h)&&!me(h)){let d={v:h,i:l,n:this.norm.get(h)};a.push(d)}else q(h)&&h.forEach((d,m)=>{u.push({nestedArrIndex:m,value:d})})}n.$[i]=a}else if(X(c)&&!me(c)){let a={v:c,n:this.norm.get(c)};n.$[i]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Oe(t,e,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const r=new we({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(Ke)),r.setSources(e),r.create(),r}function gt(t,{getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:r}=t,i=new we({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function le(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=p.distance,ignoreLocation:i=p.ignoreLocation}={}){const c=e/t.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function At(t=[],e=p.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let a=t[i];a&&n===-1?n=i:!a&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}const ne=32;function yt(t,e,s,{location:n=p.location,distance:r=p.distance,threshold:i=p.threshold,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(e.length>ne)throw new Error(it(ne));const h=e.length,d=t.length,m=Math.max(0,Math.min(n,d));let g=i,y=m;const b=a>1||u,k=b?Array(d):[];let S;for(;(S=t.indexOf(e,y))>-1;){let x=le(e,{currentLocation:S,expectedLocation:m,distance:r,ignoreLocation:l});if(g=Math.min(x,g),y=S+h,b){let E=0;for(;E<h;)k[S+E]=1,E+=1}}y=-1;let _=[],W=1,z=h+d;const re=1<<h-1;for(let x=0;x<h;x+=1){let E=0,I=z;for(;E<I;)le(e,{errors:x,currentLocation:m+I,expectedLocation:m,distance:r,ignoreLocation:l})<=g?E=I:z=I,I=Math.floor((z-E)/2+E);z=I;let $=Math.max(1,m-I+1),T=c?d:Math.min(m+I,d)+h,V=Array(T+2);V[T+1]=(1<<x)-1;for(let N=T;N>=$;N-=1){let Z=N-1,ae=s[t.charAt(Z)];if(b&&(k[Z]=+!!ae),V[N]=(V[N+1]<<1|1)&ae,x&&(V[N]|=(_[N+1]|_[N])<<1|1|_[N+1]),V[N]&re&&(W=le(e,{errors:x,currentLocation:Z,expectedLocation:m,distance:r,ignoreLocation:l}),W<=g)){if(g=W,y=Z,y<=m)break;$=Math.max(1,2*m-y)}}if(le(e,{errors:x+1,currentLocation:m,expectedLocation:m,distance:r,ignoreLocation:l})>g)break;_=V}const G={isMatch:y>=0,score:Math.max(.001,W)};if(b){const x=At(k,a);x.length?u&&(G.indices=x):G.isMatch=!1}return G}function xt(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}const he=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class ze{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?he(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const d=(g,y)=>{this.chunks.push({pattern:g,alphabet:xt(g),startIndex:y})},m=this.pattern.length;if(m>ne){let g=0;const y=m%ne,b=m-y;for(;g<b;)d(this.pattern.substr(g,ne),g),g+=ne;if(y){const k=m-ne;d(this.pattern.substr(k),k)}}else d(this.pattern,0)}searchIn(e){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern===e){let b={isMatch:!0,score:0};return r&&(b.indices=[[0,e.length-1]]),b}const{location:i,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let d=[],m=0,g=!1;this.chunks.forEach(({pattern:b,alphabet:k,startIndex:S})=>{const{isMatch:_,score:W,indices:z}=yt(e,b,k,{location:i+S,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:h});_&&(g=!0),m+=W,_&&z&&(d=[...d,...z])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=d),y}}class ee{constructor(e){this.pattern=e}static isMultiMatch(e){return ke(e,this.multiRegex)}static isSingleMatch(e){return ke(e,this.singleRegex)}search(){}}function ke(t,e){const s=t.match(e);return s?s[1]:null}class Et extends ee{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ct extends ee{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class wt extends ee{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ft extends ee{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Mt extends ee{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class It extends ee{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Qe extends ee{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class We extends ee{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n;const r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}const ge=[Et,We,wt,Ft,It,Mt,Ct,Qe],Ne=ge.length,Dt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Bt="|";function bt(t,e={}){return t.split(Bt).map(s=>{let n=s.trim().split(Dt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=n.length;i<c;i+=1){const a=n[i];let u=!1,l=-1;for(;!u&&++l<Ne;){const h=ge[l];let d=h.isMultiMatch(a);d&&(r.push(new h(d,e)),u=!0)}if(!u)for(l=-1;++l<Ne;){const h=ge[l];let d=h.isSingleMatch(a);if(d){r.push(new h(d,e));break}}}return r})}const vt=new Set([Qe.type,We.type]);class St{constructor(e,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:r=p.includeMatches,minMatchCharLength:i=p.minMatchCharLength,ignoreLocation:c=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:c,location:u,threshold:l,distance:h},e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern=e,this.query=bt(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?he(e):e;let c=0,a=[],u=0;for(let l=0,h=s.length;l<h;l+=1){const d=s[l];a.length=0,c=0;for(let m=0,g=d.length;m<g;m+=1){const y=d[m],{isMatch:b,indices:k,score:S}=y.search(e);if(b){if(c+=1,u+=S,n){const _=y.constructor.type;vt.has(_)?a=[...a,...k]:a.push(k)}}else{u=0,c=0,a.length=0;break}}if(c){let m={isMatch:!0,score:u/c};return n&&(m.indices=a),m}}return{isMatch:!1,score:1}}}const Ae=[];function kt(...t){Ae.push(...t)}function ye(t,e){for(let s=0,n=Ae.length;s<n;s+=1){let r=Ae[s];if(r.condition(t,e))return new r(t,e)}return new ze(t,e)}const de={AND:"$and",OR:"$or"},xe={PATH:"$path",PATTERN:"$val"},Ee=t=>!!(t[de.AND]||t[de.OR]),Nt=t=>!!t[xe.PATH],jt=t=>!q(t)&&Te(t)&&!Ee(t),je=t=>({[de.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Ve(t,e,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const c=Nt(r);if(!c&&i.length>1&&!Ee(r))return n(je(r));if(jt(r)){const u=c?r[xe.PATH]:i[0],l=c?r[xe.PATTERN]:r[u];if(!X(l))throw new Error(rt(u));const h={keyId:pe(u),pattern:l};return s&&(h.searcher=ye(l,e)),h}let a={children:[],operator:i[0]};return i.forEach(u=>{const l=r[u];q(l)&&l.forEach(h=>{a.children.push(n(h))})}),a};return Ee(t)||(t=je(t)),n(t)}function Rt(t,{ignoreFieldNorm:e=p.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:c})=>{const a=r?r.weight:null;n*=Math.pow(c===0&&a?Number.EPSILON:c,(a||1)*(e?1:i))}),s.score=n})}function _t(t,e){const s=t.matches;e.matches=[],O(s)&&s.forEach(n=>{if(!O(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let c={indices:r,value:i};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function Lt(t,e){e.score=t.score}function $t(t,e,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const r=[];return s&&r.push(_t),n&&r.push(Lt),t.map(i=>{const{idx:c}=i,a={item:e[c],refIndex:c};return r.length&&r.forEach(u=>{u(i,a)}),a})}class J{constructor(e,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new at(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof we))throw new Error(nt);this._myIndex=s||Oe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){O(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:c,ignoreFieldNorm:a}=this.options;let u=X(e)?X(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Rt(u,{ignoreFieldNorm:a}),i&&u.sort(c),$e(s)&&s>-1&&(u=u.slice(0,s)),$t(u,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const s=ye(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=s.searchIn(i);u&&r.push({item:i,idx:c,matches:[{score:l,value:i,norm:a,indices:h}]})}),r}_searchLogical(e){const s=Ve(e,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:d,searcher:m}=a,g=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(u,d),searcher:m});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let d=0,m=a.children.length;d<m;d+=1){const g=a.children[d],y=n(g,u,l);if(y.length)h.push(...y);else if(a.operator===de.AND)return[]}return h},r=this._myIndex.records,i={},c=[];return r.forEach(({$:a,i:u})=>{if(O(a)){let l=n(s,a,u);l.length&&(i[u]||(i[u]={idx:u,item:a,matches:[]},c.push(i[u])),l.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),c}_searchObjectList(e){const s=ye(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:c,i:a})=>{if(!O(c))return;let u=[];n.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:c[h],searcher:s}))}),u.length&&i.push({idx:a,item:c,matches:u})}),i}_findMatches({key:e,value:s,searcher:n}){if(!O(s))return[];let r=[];if(q(s))s.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=n.searchIn(i);u&&r.push({score:l,key:e,value:i,idx:c,norm:a,indices:h})});else{const{v:i,n:c}=s,{isMatch:a,score:u,indices:l}=n.searchIn(i);a&&r.push({score:u,key:e,value:i,norm:c,indices:l})}return r}}J.version="7.1.0";J.createIndex=Oe;J.parseIndex=gt;J.config=p;J.parseQuery=Ve;kt(St);const Re={".ts":"file-code",".tsx":"atom",".js":"file-code",".jsx":"atom",".py":"file-code",".rs":"file-code",".go":"file-code",".md":"file-text",".json":"clipboard",".yaml":"gear",".yml":"gear",".css":"palette",".scss":"palette",".html":"globe",".sql":"database",".sh":"terminal",".env":"lock",".toml":"gear",".lock":"lock",default:"file-text"};function Tt(t){switch(t){case"scout":return"class-scout";case"builder":return"class-builder";case"debugger":return"class-debugger";case"architect":return"class-architect";case"warrior":return"class-warrior";case"support":return"class-support";case"boss":return"class-boss";default:return"class-default"}}function Pt(t,e=16){var r;const s="."+(((r=t.split(".").pop())==null?void 0:r.toLowerCase())??""),n=Re[s]||Re.default;return f.jsx(H,{name:n,size:e})}function Kt(t,e=16){return f.jsx(H,{name:Tt(t),size:e,weight:"fill"})}function Ue(t){const e=Math.floor(t/1e3),s=Math.floor(e/60),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Jt(t){const s=Date.now()-t;return Ue(s)}function _e(t){switch(t){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"modified-file":return"Changed";case"building":return"Server";default:return t}}const Le=["command","agent","building","area","modified-file"];function Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=He(),d=Je(),m=Xe(),g=Ze(),y=A.useRef(e);y.current=e;const b=A.useRef(s);b.current=s;const k=A.useRef(n);k.current=n;const S=A.useRef(r);S.current=r;const _=A.useRef(i);_.current=i;const W=A.useRef(c);W.current=c;const z=A.useRef(a);z.current=a;const re=A.useRef(u);re.current=u;const G=A.useRef(l);G.current=l;const[x,E]=A.useState(""),[I,$]=A.useState(0);A.useEffect(()=>{t&&(E(""),$(0))},[t]);const T=se.getShortcuts(),V=A.useMemo(()=>{if(!t)return[];const o=T.find(F=>F.id==="spawn-agent"),w=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:o?be(o):"Alt+N",icon:f.jsx(H,{name:"plus",size:16}),action:()=>{y.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:w?be(w):"Ctrl+K",icon:f.jsx(H,{name:"dashboard",size:16}),action:()=>{y.current(),k.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:f.jsx(H,{name:"gear",size:16}),action:()=>{y.current(),S.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:f.jsx(H,{name:"chart-line",size:16}),action:()=>{var F;y.current(),(F=G.current)==null||F.call(G)}}]},[t,T]),oe=A.useMemo(()=>t?Array.from(h.values()).map(o=>{const w=(g||[]).filter(K=>K.agentId===o.id).map(K=>K.filePath),F=[...new Set(w)],M=F.map(K=>K.split("/").pop()||K),v=[];o.lastAssignedTask&&v.push(o.lastAssignedTask);const j=`${o.class} • ${o.status} • ${o.cwd}`;let D=`${o.name} ${j}`;M.length>0&&(D+=` ${M.join(" ")} ${F.join(" ")}`),v.length>0&&(D+=` ${v.join(" ")}`);const P=Date.now()-o.lastActivity;let Q;return o.lastAssignedTask&&(o.lastAssignedTask.length>150?Q=o.lastAssignedTask.slice(0,150)+"...":Q=o.lastAssignedTask),{id:`agent-${o.id}`,type:"agent",title:o.name,subtitle:j,lastUserInput:Q,timeAway:P,icon:Kt(o.class),_searchText:D,_modifiedFiles:F,_userQueries:v,action:()=>{y.current(),se.selectAgent(o.id),se.requestTerminalExpand()}}}):[],[t,h,g]),N=A.useMemo(()=>t?Array.from(d.values()).map(o=>{var w;return{id:`area-${o.id}`,type:"area",title:o.name,subtitle:`${o.assignedAgentIds.length} agents • ${((w=o.directories)==null?void 0:w.length)||0} folders`,icon:f.jsx(H,{name:"map",size:16}),action:()=>{y.current(),se.selectArea(o.id)}}}):[],[t,d]),Z=A.useMemo(()=>t?Array.from(m.values()).filter(o=>o.type==="server"||o.type==="boss"||o.type==="database").map(o=>{var D,P,Q,K;const w=o.status==="running"?"#4ade80":o.status==="stopped"?"#f87171":"#facc15",F=o.type==="boss"?"crown":o.type==="database"?"database":"desktop";let v=`${o.type==="boss"?"Boss":o.type==="database"?"Database":"Server"} • ${o.status}`;if(o.type==="database"&&((P=(D=o.database)==null?void 0:D.connections)!=null&&P.length)){const L=o.database.connections[0];v+=` • ${L.engine} @ ${L.host}`}else o.cwd&&(v+=` • ${o.cwd}`);let j=`${o.name} ${o.type} ${o.status} ${o.cwd||""} ${((Q=o.pm2)==null?void 0:Q.name)||""}`;if(o.type==="database"&&((K=o.database)!=null&&K.connections))for(const L of o.database.connections)j+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${o.id}`,type:"building",title:o.name,subtitle:v,icon:f.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[f.jsx(H,{name:"status-pending",size:10,weight:"fill",color:w}),f.jsx(H,{name:F,size:16})]}),_searchText:j,action:()=>{var L;y.current(),o.type==="boss"?z.current(o.id):o.type==="database"?re.current(o.id):(L=o.pm2)!=null&&L.enabled&&W.current(o.id)}}}):[],[t,m]),ae=A.useMemo(()=>{if(!t)return[];const o=g||[],w=new Set,F=[];for(const M of o){if(w.has(M.filePath))continue;w.add(M.filePath);const v=M.filePath.split("/").pop()||M.filePath,j=M.action==="created"?"Created":M.action==="modified"?"Modified":M.action==="deleted"?"Deleted":"Read";if(F.push({id:`modified-${M.filePath}-${M.timestamp}`,type:"modified-file",title:v,subtitle:`${j} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?f.jsx(H,{name:"trash",size:16}):Pt(M.filePath),action:()=>{y.current();const D=Array.from(se.getState().areas.values());for(const P of D)for(const Q of P.directories||[])if(M.filePath.startsWith(Q)){se.setFileViewerPath(M.filePath),_.current(P.id);return}se.selectAgent(M.agentId)}}),F.length>=50)break}return F},[t,g]),Fe=A.useMemo(()=>new J(oe,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[oe]),Me=A.useMemo(()=>new J(V,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[V]),Ie=A.useMemo(()=>new J(N,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[N]),De=A.useMemo(()=>new J(ae,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ae]),Be=A.useMemo(()=>new J(Z,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Z]),U=A.useMemo(()=>{if(!x.trim()){const C=[];C.push(...Z);const B=[...oe].sort((R,Y)=>{const ie=R.timeAway??0,ce=Y.timeAway??0;return ie-ce});C.push(...B),C.push(...V.slice(0,2)),C.push(...N.slice(0,2));const te={};return Le.forEach((R,Y)=>{te[R]=Y}),C.sort((R,Y)=>(te[R.type]??999)-(te[Y.type]??999)),C}const o=x.toLowerCase(),w=Fe.search(x).slice(0,8),F=Me.search(x).slice(0,3),M=Ie.search(x).slice(0,2),v=De.search(x).slice(0,3),j=Be.search(x).filter(C=>{const B=C.score??1;return`${C.item.title} ${C.item.subtitle||""} ${C.item._searchText||""}`.toLowerCase().includes(o)||B<=.2}).slice(0,4),D=[],P=[],Q=[];for(const C of w){const B={...C.item};if(B._modifiedFiles&&B._modifiedFiles.length>0){const R=B._modifiedFiles.filter(Y=>{var ue;const ie=((ue=Y.split("/").pop())==null?void 0:ue.toLowerCase())||"",ce=Y.toLowerCase();return ie.includes(o)||ce.includes(o)});R.length>0&&(B.matchedFiles=R)}if(B._userQueries&&B._userQueries.length>0){const R=B._userQueries.find(Y=>Y.toLowerCase().includes(o));if(R)if(R.length>200){const ie=R.toLowerCase().indexOf(o),ce=Math.max(0,ie-60),ue=Math.min(R.length,ie+o.length+100);B.matchedQuery=(ce>0?"...":"")+R.slice(ce,ue)+(ue<R.length?"...":"")}else B.matchedQuery=R}const te=B.title.toLowerCase();te===o||te.startsWith(o)?P.push(B):Q.push(B)}const K=(C,B)=>(C.timeAway??Number.POSITIVE_INFINITY)-(B.timeAway??Number.POSITIVE_INFINITY);P.sort(K),Q.sort(K);for(const C of P)D.push(C);for(const C of j)D.push(C.item);for(const C of Q)D.push(C);for(const C of F)D.push(C.item);for(const C of M)D.push(C.item);for(const C of v)D.push(C.item);const L={};return Le.forEach((C,B)=>{L[C]=B}),D.sort((C,B)=>(L[C.type]??999)-(L[B.type]??999)),D},[x,Fe,Me,Ie,De,Be,V,oe,N,Z]);A.useEffect(()=>{I>=U.length&&$(Math.max(0,U.length-1))},[U.length,I]);const Ye=A.useCallback(o=>{if(o.altKey&&!o.ctrlKey&&!o.metaKey&&(o.key==="p"||o.key==="n"||o.key==="P"||o.key==="N")){o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopImmediatePropagation();const w=o.key.toLowerCase();$(w==="p"?F=>F>0?F-1:U.length-1:F=>F<U.length-1?F+1:0);return}switch(o.key){case"Escape":o.preventDefault(),y.current();break;case"ArrowUp":o.preventDefault(),$(w=>w>0?w-1:U.length-1);break;case"ArrowDown":o.preventDefault(),$(w=>w<U.length-1?w+1:0);break;case"Enter":o.preventDefault(),U[I]&&U[I].action();break}},[U,I]),Ge=A.useCallback((o,w)=>{if(!w||!o)return o;const F=o.toLowerCase(),M=w.toLowerCase(),v=[];let j=0,D=F.indexOf(M),P=0;for(;D!==-1;)D>j&&v.push(o.slice(j,D)),v.push(fe.createElement("mark",{key:P++,className:"spotlight-highlight"},o.slice(D,D+w.length))),j=D+w.length,D=F.indexOf(M,j);return j<o.length&&v.push(o.slice(j)),v.length>0?fe.createElement(fe.Fragment,null,...v):o},[]);return{query:x,setQuery:E,selectedIndex:I,setSelectedIndex:$,results:U,handleKeyDown:Ye,highlightMatch:Ge}}const zt=A.forwardRef(function({query:e,onQueryChange:s,onKeyDown:n,onResetSelection:r},i){const{t:c}=Ce(["common"]);return f.jsxs("div",{className:"spotlight-input-wrapper",children:[f.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),f.jsx("input",{ref:i,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:a=>{s(a.target.value),r()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),f.jsxs("div",{className:"spotlight-input-hints",children:[f.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Qt=A.memo(function({result:e,isSelected:s,query:n,highlightMatch:r,onClick:i,onMouseEnter:c}){const a=e.activityText||e.matchedFiles&&e.matchedFiles.length>0||e.matchedQuery;return f.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${e.activityText?"has-activity":""}`,onClick:i,onMouseEnter:c,role:"option","aria-selected":s,children:[f.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:e.icon}),f.jsxs("div",{className:"spotlight-item-content",children:[f.jsxs("div",{className:"spotlight-item-header",children:[f.jsx("span",{className:"spotlight-item-title",children:r(e.title,n)}),f.jsx("span",{className:`spotlight-item-type ${e.type}`,"aria-label":_e(e.type),children:_e(e.type)})]}),e.subtitle&&f.jsx("span",{className:"spotlight-item-subtitle",children:r(e.subtitle,n)}),e.activityText&&f.jsx("span",{className:"spotlight-item-activity",children:r(e.activityText,n)}),a&&f.jsxs("div",{className:"spotlight-item-details",children:[e.matchedFiles&&e.matchedFiles.length>0&&f.jsx("span",{className:"spotlight-item-files",children:e.matchedFiles.map((u,l)=>f.jsxs("span",{className:"file-badge",children:[l>0&&f.jsx("span",{className:"file-separator",children:"•"}),r(u.split("/").pop()||u,n)]},u))}),e.matchedQuery&&f.jsx("span",{className:"spotlight-item-query",children:r(e.matchedQuery,n)})]}),e.timeAway!==void 0&&f.jsx("span",{className:"spotlight-item-time",children:f.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Ue(e.timeAway)]})}),e.lastUserInput&&!e.matchedQuery&&f.jsxs("span",{className:"spotlight-item-last-input",children:['"',r(e.lastUserInput,n),'"']})]})]})}),Wt=A.forwardRef(function({results:e,selectedIndex:s,query:n,highlightMatch:r,onSelectIndex:i},c){const{t:a}=Ce(["terminal"]),u=A.useRef(!1);A.useEffect(()=>{u.current=!1},[e]),A.useEffect(()=>{const d=typeof c=="function"?null:c==null?void 0:c.current;if(!d)return;const m=()=>{u.current=!0};return d.addEventListener("mousemove",m),()=>{d.removeEventListener("mousemove",m)}},[c,e]);const l={command:a("terminal:spotlight.categories.commands"),agent:a("terminal:spotlight.categories.agents"),building:a("terminal:spotlight.categories.infrastructure"),area:a("terminal:spotlight.categories.areas"),"modified-file":a("terminal:spotlight.categories.modifiedFiles")},h=A.useMemo(()=>{const d=[];let m=null,g=[];return e.forEach((y,b)=>{y.type!==m&&(m!==null&&g.length>0&&d.push([m,g]),m=y.type,g=[]),g.push({result:y,index:b})}),m!==null&&g.length>0&&d.push([m,g]),d},[e]);return A.useEffect(()=>{if(!c||typeof c=="function")return;const d=c.current;if(!d)return;const m=d.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,c]),e.length===0?f.jsx("div",{className:"spotlight-results",ref:c,children:f.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):f.jsx("div",{className:"spotlight-results",ref:c,children:h.map(([d,m])=>f.jsxs("div",{children:[h.length>1&&f.jsx("div",{className:"spotlight-category-header",children:l[d]||d}),m.map(({result:g,index:y})=>f.jsx(Qt,{result:g,isSelected:y===s,query:n,highlightMatch:r,onClick:()=>g.action(),onMouseEnter:()=>{u.current&&i(y)}},g.id))]},d))})}),Vt=A.memo(function(){const{t:e}=Ce(["terminal"]);return f.jsxs("div",{className:"spotlight-footer",children:[f.jsxs("div",{className:"spotlight-footer-left",children:[f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"↑"}),f.jsx("kbd",{children:"↓"})," ",f.jsx("kbd",{children:"Alt+N"}),f.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]})]}),f.jsx("div",{className:"spotlight-footer-right",children:f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Ut=768;function Xt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=A.useRef(null),d=A.useRef(null),m=A.useRef(null),g=A.useRef(0),{query:y,setQuery:b,selectedIndex:k,setSelectedIndex:S,results:_,handleKeyDown:W,highlightMatch:z}=Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=_.length,A.useEffect(()=>{t&&setTimeout(()=>{var x;(x=h.current)==null||x.focus()},50)},[t]),A.useEffect(()=>{if(!t)return;const x=window.visualViewport;if(!x||window.innerWidth>Ut)return;const E=()=>{const I=d.current;I&&(I.style.height=`${x.height}px`,I.style.top=`${x.offsetTop}px`)};return E(),x.addEventListener("resize",E),x.addEventListener("scroll",E),()=>{x.removeEventListener("resize",E),x.removeEventListener("scroll",E);const I=d.current;I&&(I.style.height="",I.style.top="")}},[t]),A.useEffect(()=>{if(!t)return;const x=E=>{if(E.key==="Escape"){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),e();return}if(E.altKey&&!E.ctrlKey&&!E.metaKey&&(E.key==="n"||E.key==="p"||E.key==="N"||E.key==="P")){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const I=E.key.toLowerCase(),$=g.current;S(I==="p"?T=>T>0?T-1:$-1:T=>T<$-1?T+1:0);return}};return window.addEventListener("keydown",x,{capture:!0}),()=>{window.removeEventListener("keydown",x,{capture:!0})}},[t,e]);const re=A.useCallback(x=>{x.target===x.currentTarget&&e()},[e]),G=A.useCallback(()=>{S(0)},[S]);return t?f.jsx("div",{ref:d,className:"spotlight-overlay",onClick:re,children:f.jsxs("div",{className:"spotlight-modal",children:[f.jsx(zt,{ref:h,query:y,onQueryChange:b,onKeyDown:W,onResetSelection:G}),f.jsx(Wt,{ref:m,results:_,selectedIndex:k,query:y,highlightMatch:z,onSelectIndex:S}),f.jsx(Vt,{})]})}):null}export{Re as FILE_ICON_NAMES,Xt as Spotlight,Vt as SpotlightFooter,zt as SpotlightInput,Qt as SpotlightItem,Wt as SpotlightResults,Ue as formatDuration,Jt as formatRelativeTime,Kt as getAgentIcon,Pt as getFileIconFromPath,_e as getTypeLabel,Ot as useSpotlightSearch};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as Ye,B as Je,r as n,C as Ge,S as w,E as Ve,G as Le,H as Y,J as Qe,s as g,K as We,L as et,v as tt,w as at,j as e,M as nt,N as Ue,O as Xe,P as st,U as rt,V as lt,W as it,X as ot,Y as ct,Z as dt,_ as pt,$ as mt,a0 as ut,a1 as ht,a2 as ft,a3 as gt,I as u,a4 as _t,a5 as xt,a6 as bt,a7 as wt,a8 as jt,a9 as Nt,aa as vt,ab as Ct}from"./main-Cqo-Awpr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const kt=["simple","chat","advanced"],At={simple:"Simple",chat:"Chat",advanced:"Advanced"},yt={simple:"○",chat:"◐",advanced:"◉"},St={simple:"Simple view — clean messages only",chat:"Chat view — assistant replies (no tool calls)",advanced:"Advanced view — everything including tools"},He="flat-clear-context";function Et(h){const c=h.split("/").filter(Boolean);return c.length===0?h:c.slice(-2).join("/")}function Mt(h){if(h.provider==="codex"){const H=h.codexModel||"gpt-5.3-codex",k=Nt[H];return{model:(k==null?void 0:k.label)||H}}if(h.provider==="opencode")return{model:h.opencodeModel||"opencode"};const c=h.model||"sonnet",_=Ct[c],C=h.effort,S=C?vt[C]:void 0;return{model:(_==null?void 0:_.label)||c,effort:S==null?void 0:S.label}}function It(h,c){if(c.type==="rectangle"&&c.width&&c.height){const _=c.width/2,C=c.height/2;return h.x>=c.center.x-_&&h.x<=c.center.x+_&&h.z>=c.center.z-C&&h.z<=c.center.z+C}if(c.type==="circle"&&c.radius){const _=h.x-c.center.x,C=h.z-c.center.z;return _*_+C*C<=c.radius*c.radius}return!1}const zt=dt.memo(function({agentId:c,terminalViewMode:_,onTerminalViewModeChange:C,inspectorOpen:S,onToggleInspector:H,onImageClick:k,onFileClick:J,onBashClick:Q,onViewMarkdown:pe,onRequestClearSubordinates:me,onOpenBuilding:ee,keyboard:te,canNavigateBack:ue,canNavigateForward:he,onNavigateBack:P,onNavigateForward:ae,agentInfoOpen:ne,onToggleAgentInfo:Ae}){var j,N,q,de;const p=pt(c),I=mt(),O=n.useRef(null),se=n.useRef(null);n.useEffect(()=>{const t=se.current;if(!t)return;const r=i=>{i.button===3?(i.preventDefault(),i.stopPropagation(),P()):i.button===4&&(i.preventDefault(),i.stopPropagation(),ae())},l=i=>{(i.button===3||i.button===4)&&i.preventDefault()};return t.addEventListener("mouseup",r),t.addEventListener("mousedown",l),()=>{t.removeEventListener("mouseup",r),t.removeEventListener("mousedown",l)}},[P,ae]);const z=We(),re=n.useMemo(()=>{if(!p)return null;const t=new Set,r=[];for(const l of z.values())l.archived||l.directories.length===0||l.assignedAgentIds.includes(c)&&(t.add(l.id),r.push(l));for(const l of z.values())l.archived||l.directories.length===0||t.has(l.id)||It({x:p.position.x,z:p.position.z},l)&&(t.add(l.id),r.push(l));return r.length===0?null:r.flatMap(l=>l.directories.filter(i=>i&&i.trim().length>0).map(i=>({areaId:l.id,areaName:l.name,dir:i})))},[p,c,z]),{branches:le,fetchRemote:fe,fetchingDirs:ge}=ut(re),W=n.useMemo(()=>{var l;const t=g.getAreaForAgent(c);if(!t)return[];const r=[];for(const i of I.values())i.type==="terminal"&&g.isPositionInArea(i.position,t)&&r.push({id:i.id,name:i.name,hasUrl:!!((l=i.terminalStatus)!=null&&l.url)});return r},[c,I]),_e=n.useMemo(()=>{var l;const t=g.getAreaForAgent(c);if(!t)return[];const r=[];for(const i of I.values())i.type==="server"&&((l=i.pm2)!=null&&l.enabled)&&g.isPositionInArea(i.position,t)&&r.push({id:i.id,name:i.name});return r},[c,I]),xe=n.useMemo(()=>{const t=g.getAreaForAgent(c);if(!t)return[];const r=[];for(const l of I.values())l.type==="database"&&l.database&&g.isPositionInArea(l.position,t)&&r.push({id:l.id,name:l.name});return r},[c,I]),[,ye]=n.useReducer(t=>t+1,0),U=((j=O.current)==null?void 0:j.search.searchMode)??!1,Se=n.useCallback(()=>{var t;(t=O.current)==null||t.search.toggleSearch(),ye()},[]),be=ht(),f=be.isPending(He),[A,y]=n.useState(null),E=A?I.get(A):null,{height:we,onResizeStart:Ee}=ft(),[L,je]=n.useState(()=>Le(w.GIT_PANEL_OPEN,!1)),[B,F]=n.useState(()=>Le(w.BUILDINGS_PANEL_OPEN,!1)),R=n.useCallback(()=>{je(t=>{const r=!t;return Y(w.GIT_PANEL_OPEN,r),r})},[]),X=n.useCallback(()=>{F(t=>{const r=!t;return Y(w.BUILDINGS_PANEL_OPEN,r),r})},[]),Me=n.useCallback(()=>{je(!1),Y(w.GIT_PANEL_OPEN,!1)},[]),Ie=n.useCallback(()=>{F(!1),Y(w.BUILDINGS_PANEL_OPEN,!1)},[]),Ne=gt();n.useEffect(()=>{if(!A)return;W.some(r=>r.id===A)||y(null)},[A,W]);const[D,G]=n.useState(!1),ie=n.useRef(null);if(n.useEffect(()=>{if(!D)return;const t=r=>{ie.current&&!ie.current.contains(r.target)&&G(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[D]),!p)return e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-chat__placeholder",children:[e.jsx("span",{className:"flat-chat__placeholder-icon",children:"💬"}),e.jsx("span",{className:"flat-chat__placeholder-text",children:"Select an agent to start chatting"})]})});const M=p.contextStats,oe=!!M,ve=M?M.totalTokens:p.contextUsed||0,ce=M?M.contextWindow:p.contextLimit||2e5,ze=M?M.usedPercent:Math.round(ve/ce*100),T=Math.max(0,Math.min(100,ze)),Re=Math.max(0,100-T),$=T>=80?"#ff4a4a":T>=60?"#ff9e4a":T>=40?"#ffd700":"#4aff9e",Ce=(ve/1e3).toFixed(1),a=(ce/1e3).toFixed(1),s=p.cwd,o=s?Et(s):null,d=((N=p.subordinateIds)==null?void 0:N.length)||0,K=d>0;return e.jsxs("div",{ref:se,className:`flat-terminal-wrapper ${L||B?"flat-terminal-wrapper--with-side-panel":""}`,children:[e.jsxs("div",{className:"flat-terminal-wrapper__header",children:[e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__header-main ${ne?"flat-terminal-wrapper__header-main--active":""}`,onClick:Ae,title:ne?"Hide agent info":"Show agent info","aria-pressed":ne,children:[e.jsx(Ue,{agent:p,size:28}),e.jsxs("span",{className:"flat-terminal-wrapper__header-info",children:[e.jsx("span",{className:"flat-terminal-wrapper__header-name",children:p.name}),e.jsx("span",{className:"flat-terminal-wrapper__header-status",style:{color:Xe(p.status)},children:p.status})]}),p.taskLabel&&e.jsxs("span",{className:"flat-terminal-wrapper__header-task",title:p.taskLabel,children:["📋 ",p.taskLabel]}),e.jsxs("span",{className:"flat-terminal-wrapper__header-model",children:[e.jsx("img",{src:p.provider==="codex"?"/assets/codex.png":p.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:p.provider,className:"flat-terminal-wrapper__header-provider-icon",title:p.provider==="codex"?"Codex Agent":p.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),(()=>{const{model:t,effort:r}=Mt(p);return e.jsxs("span",{className:"flat-terminal-wrapper__header-model-chip",title:r?`Model: ${t} · Effort: ${r}`:`Model: ${t}`,children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-name",children:t}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-sep","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"flat-terminal-wrapper__header-model-effort",children:r})]})]})})()]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__header-meta",children:[e.jsx("div",{className:"flat-terminal-wrapper__view-mode",role:"group","aria-label":"Message view mode",children:kt.map(t=>e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__view-mode-btn ${_===t?"flat-terminal-wrapper__view-mode-btn--active":""}`,onClick:()=>C(t),title:St[t],"aria-pressed":_===t,children:[e.jsx("span",{className:"flat-terminal-wrapper__view-mode-icon","aria-hidden":"true",children:yt[t]}),e.jsx("span",{className:"flat-terminal-wrapper__view-mode-label",children:At[t]})]},t))}),e.jsxs("div",{className:"flat-terminal-wrapper__actions",role:"group","aria-label":"Terminal actions",children:[e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:P,disabled:!ue,title:"Back to previous agent","aria-label":"Back to previous agent",children:e.jsx(u,{name:"arrow-left",size:14})}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:ae,disabled:!he,title:"Forward to next agent","aria-label":"Forward to next agent",children:e.jsx(u,{name:"arrow-right",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${U?"flat-terminal-wrapper__action-btn--active":""}`,onClick:Se,title:U?"Close search":"Search messages","aria-pressed":U,children:e.jsx(u,{name:U?"cross":"search",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn flat-terminal-wrapper__action-btn--danger ${f?"flat-terminal-wrapper__action-btn--confirm":""}`,onClick:()=>be.handleClick(He,()=>{var t;g.clearContext(c),(t=O.current)==null||t.historyLoader.clearHistory()}),title:f?"Click again to confirm clear context":"Clear context",children:e.jsx(u,{name:f?"question":"clear",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${L?"flat-terminal-wrapper__action-btn--active":""}`,onClick:R,title:L?"Hide git panel":"Show git changes","aria-pressed":L,children:e.jsx(u,{name:"git-branch",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${B?"flat-terminal-wrapper__action-btn--active":""}`,onClick:X,title:B?"Hide buildings panel":"Show area buildings","aria-pressed":B,children:e.jsx(u,{name:"buildings",size:14})}),e.jsxs("div",{className:"flat-terminal-wrapper__more",ref:ie,children:[e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${D?"flat-terminal-wrapper__action-btn--active":""}`,onClick:()=>G(t=>!t),title:"More actions","aria-expanded":D,children:"⋮"}),D&&e.jsxs("div",{className:"flat-terminal-wrapper__more-menu",role:"menu",children:[e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item",onClick:()=>{g.collapseContext(c),G(!1)},disabled:p.status!=="idle",title:p.status!=="idle"?"Agent must be idle to collapse context":"Collapse context",children:[e.jsx(u,{name:"package",size:14}),e.jsx("span",{children:"Collapse context"})]}),K&&e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{me(c,d),G(!1)},children:[e.jsx(u,{name:"crown",size:14}),e.jsxs("span",{children:["Clear ",d," subordinate",d===1?"":"s"]})]}),e.jsx("div",{className:"flat-terminal-wrapper__more-divider"}),e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{g.killAgent(c),G(!1)},children:[e.jsx(u,{name:"cross",size:14}),e.jsx("span",{children:"Remove agent"})]})]})]})]}),e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__inspector-toggle ${S?"flat-terminal-wrapper__inspector-toggle--active":""}`,onClick:H,title:S?"Hide inspector panel":"Show inspector panel","aria-label":S?"Hide inspector panel":"Show inspector panel","aria-pressed":S,children:[e.jsx("span",{className:"flat-terminal-wrapper__inspector-icon","aria-hidden":"true",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"}),e.jsx("line",{x1:"10",y1:"2.5",x2:"10",y2:"13.5"})]})}),e.jsx("span",{className:"flat-terminal-wrapper__inspector-label",children:"Inspector"})]}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__close",onClick:()=>g.deselectAll(),title:"Close chat","aria-label":"Close chat",children:e.jsx(u,{name:"cross",size:14})})]})]}),e.jsx(_t,{ref:O,agentId:c,agent:p,viewMode:_,isOpen:!0,onImageClick:k,onFileClick:J,onBashClick:Q,onViewMarkdown:pe,keyboard:te,hasModalOpen:!1}),E&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Ee,role:"separator","aria-orientation":"horizontal","aria-label":"Resize embedded terminal"}),e.jsxs("div",{className:"flat-bottom-panel",role:"region","aria-label":`Embedded terminal: ${E.name}`,style:{height:we},children:[e.jsxs("div",{className:"flat-bottom-panel__header",children:[e.jsxs("span",{className:"flat-bottom-panel__title",children:[e.jsx(u,{name:"terminal",size:12}),e.jsx("span",{children:E.name}),!((q=E.terminalStatus)!=null&&q.url)&&e.jsx("span",{className:"flat-bottom-panel__muted",children:"(starting...)"})]}),e.jsx("button",{type:"button",className:"flat-bottom-panel__close",onClick:()=>y(null),title:"Close embedded terminal","aria-label":"Close embedded terminal",children:e.jsx(u,{name:"cross",size:12})})]}),e.jsx("div",{className:"flat-bottom-panel__body",children:(de=E.terminalStatus)!=null&&de.url?e.jsx(xt,{terminalUrl:E.terminalStatus.url,visible:!0}):e.jsx("div",{className:"flat-bottom-panel__placeholder",children:"Starting terminal..."})})]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__statusbar",role:"contentinfo",children:[p.isDetached&&e.jsxs("span",{className:"flat-terminal-wrapper__detached",title:"Reattaching session...",children:[e.jsx(u,{name:"refresh",size:12}),e.jsx("span",{children:"Reattaching"})]}),s&&o&&e.jsxs("span",{className:"flat-terminal-wrapper__cwd",title:s,onClick:()=>g.setFileViewerPath(s),children:[e.jsx("span",{className:"flat-terminal-wrapper__cwd-icon",children:e.jsx(u,{name:"folder",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__cwd-text",children:o})]}),re&&re.map(({areaId:t,areaName:r,dir:l})=>{const i=le.get(l),V=ge.has(l),Z=l.split("/").filter(Boolean).pop()||l;return e.jsxs("span",{className:"flat-terminal-wrapper__area-dir",title:`${r}: ${l}${i?` (${i.branch}${i.ahead?` ↑${i.ahead}`:""}${i.behind?` ↓${i.behind}`:""})`:""}`,onClick:()=>g.openFileExplorerForAreaFolder(t,l),children:[e.jsx(u,{name:"folder-open",size:12}),e.jsx("span",{className:"flat-terminal-wrapper__area-dir-name",children:Z}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flat-terminal-wrapper__area-dir-branch",children:[e.jsx(u,{name:"git-branch",size:10})," ",i.branch]}),i.ahead>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-ahead",title:`${i.ahead} ahead`,children:[e.jsx(u,{name:"arrow-up",size:9}),i.ahead]}),i.behind>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-behind",title:`${i.behind} behind`,children:[e.jsx(u,{name:"arrow-down",size:9}),i.behind]}),e.jsx("span",{className:`flat-terminal-wrapper__area-fetch ${V?"flat-terminal-wrapper__area-fetch--fetching":""}`,title:"Git fetch",onClick:x=>{x.stopPropagation(),fe(l)},children:e.jsx(u,{name:V?"hourglass":"download",size:12})})]})]},`${t}:${l}`)}),e.jsxs("span",{className:"flat-terminal-wrapper__context",onClick:()=>g.setContextModalAgentId(c),title:oe?`Context usage: ${Ce}k / ${a}k tokens (${T}% used). Click to view stats.`:"Click to fetch context stats",children:[e.jsx("span",{className:"flat-terminal-wrapper__context-icon",children:e.jsx(u,{name:"dashboard",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__context-label",children:"Ctx:"}),e.jsx("span",{className:"flat-terminal-wrapper__context-bar",children:e.jsx("span",{className:"flat-terminal-wrapper__context-bar-fill",style:{width:`${T}%`,backgroundColor:$}})}),e.jsxs("span",{className:"flat-terminal-wrapper__context-tokens",style:{color:$},children:[Ce,"k/",a,"k"]}),e.jsxs("span",{className:"flat-terminal-wrapper__context-free",children:["(",Re,"% free)"]}),!oe&&e.jsx("span",{className:"flat-terminal-wrapper__context-warning",title:"No context stats yet",children:e.jsx(u,{name:"warn",size:12})})]}),e.jsx("div",{className:"flat-terminal-wrapper__statusbar-spacer","aria-hidden":"true"}),W.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area terminals",children:W.map(t=>{const r=A===t.id;return e.jsx("button",{type:"button",className:`flat-terminal-wrapper__building-btn ${r?"flat-terminal-wrapper__building-btn--active":""} ${t.hasUrl?"":"flat-terminal-wrapper__building-btn--offline"}`,title:`${r?"Hide":"Show"} terminal: ${t.name}${t.hasUrl?"":" (starting...)"}`,onClick:()=>{if(r){y(null);return}t.hasUrl||g.sendBuildingCommand(t.id,"start"),y(t.id)},children:e.jsx(u,{name:"terminal",size:14})},t.id)})}),_e.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area PM2 logs",children:_e.map(t=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open logs: ${t.name}`,onClick:()=>ee(t.id),children:e.jsx(u,{name:"scroll",size:14})},t.id))}),xe.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area databases",children:xe.map(t=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open database: ${t.name}`,onClick:()=>ee(t.id),children:e.jsx(u,{name:"hard-drives",size:14})},t.id))}),e.jsx("div",{className:"flat-terminal-wrapper__theme",children:e.jsx(bt,{})})]}),L&&e.jsx(wt,{agentId:c,agents:Ne,onClose:Me,branchInfoMap:le,fetchRemote:fe,fetchingDirs:ge}),B&&e.jsx(jt,{agentId:c,onClose:Ie})]})});function Pt({onAgentClick:h,onBuildingClick:c,onBuildingDoubleClick:_,onOpenSpawnModal:C,onOpenBossSpawnModal:S,onOpenAreaModal:H}){const k=Ye(),J=Je(),[Q,pe]=n.useState(null),[me,ee]=n.useState(null),[te,ue]=n.useState(null),[he,P]=n.useState(!1),ae=n.useCallback(()=>{P(a=>!a)},[]),ne=n.useCallback(()=>{P(!1)},[]),[Ae,p]=n.useState(()=>{const a=Ge(w.VIEW_MODE);return a==="simple"||a==="chat"||a==="advanced"?a:"simple"}),I=n.useCallback(a=>{p(a),Ve(w.VIEW_MODE,a)},[]);n.useEffect(()=>{const a=s=>{if(s.key!==w.VIEW_MODE)return;const o=s.newValue;(o==="simple"||o==="chat"||o==="advanced")&&p(o)};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]);const[O,se]=n.useState(()=>Le(w.FLAT_INSPECTOR_OPEN,!1)),[z,re]=n.useState(()=>Ge(w.FLAT_INSPECTOR_VIEW)==="tracking"?"tracking":"agent"),le=n.useCallback(a=>{re(a),Ve(w.FLAT_INSPECTOR_VIEW,a)},[]),fe=n.useCallback(()=>{se(a=>{const s=!a;return Y(w.FLAT_INSPECTOR_OPEN,s),s})},[]),ge=n.useCallback(()=>{se(!1),Y(w.FLAT_INSPECTOR_OPEN,!1)},[]),W=Qe(),_e=n.useCallback((a,s)=>{pe({url:a,name:s})},[]),xe=n.useCallback((a,s)=>{ee({command:a,output:s,isLive:!1})},[]),ye=n.useCallback((a,s)=>{g.setFileViewerPath(a,s)},[]),U=n.useCallback(a=>{},[]),Se=n.useCallback((a,s)=>{ue({agentId:a,count:s})},[]),be=n.useCallback(a=>{_?_(a):c(a)},[c,_]),f=n.useMemo(()=>J.size>0?Array.from(J)[0]:null,[J]);n.useEffect(()=>{P(!1)},[f]);const A=n.useRef([]),y=n.useRef(-1),E=n.useRef(!1),we=n.useRef(null),[Ee,L]=n.useState(!1),[je,B]=n.useState(!1),F=n.useMemo(()=>new Set(k.map(a=>a.id)),[k]),R=n.useCallback(()=>{const a=A.current,s=y.current;L(s>0),B(s>=0&&s<a.length-1)},[]),X=n.useCallback(a=>{const s=A.current;if(s.length===0)return;let o=y.current+a;for(;o>=0&&o<s.length;){const d=s[o];if(F.has(d)){E.current=!0,y.current=o,R(),g.selectAgent(d);return}o+=a}},[F,R]),Me=n.useCallback(()=>X(-1),[X]),Ie=n.useCallback(()=>X(1),[X]);n.useEffect(()=>{if(!f){A.current=[],y.current=-1,R();return}if(we.current=f,E.current){E.current=!1,R();return}const a=A.current,s=y.current;if(s>=0&&a[s]===f){R();return}const o=s<a.length-1?a.slice(0,s+1):a.slice();o.push(f),o.length>100&&o.shift(),A.current=o,y.current=o.length-1,R()},[f,R]);const Ne=n.useCallback(a=>{h(a)},[h]),D=f??"",G=n.useCallback(()=>{},[]),ie=n.useCallback(a=>{Ne(a)},[Ne]),M=O&&!!f,oe=n.useRef(null);n.useEffect(()=>{if(f)return;const a=s=>{if(s.key!==" "&&s.key!=="Backspace")return;const o=s.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;const d=we.current;!d||!F.has(d)||(s.preventDefault(),g.selectAgent(d))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[f,F]);const[ve,ce]=n.useState(new Set),ze=n.useCallback(a=>{ce(s=>{const o=new Set(s);return o.has(a)?o.delete(a):o.add(a),o})},[]),T=We(),[Re]=et(),$=n.useMemo(()=>{const a=new Map,s=[];for(const t of k){const r=g.getAreaForAgent(t.id);if(!tt((r==null?void 0:r.id)??null))continue;if(!r||r.archived){s.push(t);continue}const l=a.get(r.id);l?l.push(t):a.set(r.id,[t])}const o=[];for(const[,t]of T){if(t.archived||!at(t.id))continue;const r=a.get(t.id);r&&r.length>0&&o.push({area:t,agents:r})}s.length>0&&o.push({area:{id:"__unassigned__",name:"Unassigned",color:"#6272a4",center:{x:0,z:0},type:"circle",radius:0,directories:[],archived:!1,assignedAgentIds:[],zIndex:0},agents:s});const d=o.filter(t=>t.area.id!=="__unassigned__"),K=o.filter(t=>t.area.id==="__unassigned__");let j=1,N=1;const q=new Map;if(d.length>1){let t=1/0,r=-1/0,l=1/0,i=-1/0;for(const x of d)t=Math.min(t,x.area.center.x),r=Math.max(r,x.area.center.x),l=Math.min(l,x.area.center.z),i=Math.max(i,x.area.center.z);const V=r-t||1,Z=i-l||1;if(d.length<=4){j=d.length,N=1;const x=[...d].sort((b,Te)=>b.area.center.x-Te.area.center.x);for(let b=0;b<x.length;b++)q.set(x[b].area.id,{row:1,col:b+1})}else{const x=[...d].sort((m,v)=>m.area.center.x-v.area.center.x),b=[];for(let m=1;m<x.length;m++)b.push(x[m].area.center.x-x[m-1].area.center.x);const Te=b.reduce((m,v)=>m+v,0)/b.length||1;let Be=1;for(const m of b)m>Te*1.3&&Be++;j=Math.max(2,Math.min(Be,d.length));const $e=[...d].sort((m,v)=>m.area.center.z-v.area.center.z),ke=[];for(let m=1;m<$e.length;m++)ke.push($e[m].area.center.z-$e[m-1].area.center.z);const Ke=ke.reduce((m,v)=>m+v,0)/ke.length||1;let Fe=1;for(const m of ke)m>Ke*1.3&&Fe++;N=Math.max(2,Math.min(Fe,d.length)),j=Math.max(j,Math.ceil(d.length/N)),N=Math.max(N,Math.ceil(d.length/j));const qe=V/j,Ze=Z/N,De=new Set;for(const m of d){let v=Math.min(j-1,Math.max(0,Math.floor((m.area.center.x-t)/qe))),Pe=Math.min(N-1,Math.max(0,Math.floor((m.area.center.z-l)/Ze))),Oe=`${Pe},${v}`;for(;De.has(Oe)&&v<j-1;)v++,Oe=`${Pe},${v}`;De.add(Oe),q.set(m.area.id,{row:Pe+1,col:v+1})}}}const de=t=>{t.sort((r,l)=>{var V,Z,x,b;const i=(((V=r.position)==null?void 0:V.z)??0)-(((Z=l.position)==null?void 0:Z.z)??0);return i!==0?i:(((x=r.position)==null?void 0:x.x)??0)-(((b=l.position)==null?void 0:b.x)??0)})};for(const t of d)de(t.agents);for(const t of K)de(t.agents);return{groups:[...d,...K],gridCols:j,gridRows:N,positions:q}},[k,T,Re]),Ce=n.useCallback(a=>{const s=new Set($.groups.map(o=>o.area.id));s.delete(a),ce(s),requestAnimationFrame(()=>{const o=oe.current;if(!o)return;const d=o.querySelector(`[data-area-id="${a}"]`);if(!d)return;const K=o.getBoundingClientRect(),N=d.getBoundingClientRect().top-K.top+o.scrollTop-8;o.scrollTo({top:Math.max(0,N),behavior:"smooth"})})},[$]);return e.jsxs("div",{className:`flat-view ${M?"flat-view--with-inspector":""}`,children:[e.jsxs("div",{className:"flat-middle",children:[e.jsxs("div",{className:"flat-middle__header",children:[e.jsx("h2",{className:"flat-middle__title",children:"👥 Agents"}),e.jsxs("div",{className:"flat-middle__actions",children:[e.jsx("button",{className:"flat-cta-btn flat-cta-btn--agent",onClick:C,title:"Create new agent",children:"+ Agent"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--boss",onClick:S,title:"Create new boss agent",children:"+ Boss"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--area",onClick:H,title:"Create new area",children:"+ Area"})]})]}),e.jsx("div",{className:"flat-middle__content",children:e.jsx(nt,{activeAgentId:D,onClose:G,onSelectAgent:ie,collapsedAreas:ve,onToggleArea:ze,agentListRef:oe})})]}),e.jsx("div",{className:"flat-right",children:f?e.jsx(zt,{agentId:f,terminalViewMode:Ae,onTerminalViewModeChange:I,inspectorOpen:O,onToggleInspector:fe,onImageClick:_e,onFileClick:ye,onBashClick:xe,onViewMarkdown:U,onRequestClearSubordinates:Se,onOpenBuilding:be,keyboard:W,canNavigateBack:Ee,canNavigateForward:je,onNavigateBack:Me,onNavigateForward:Ie,agentInfoOpen:he,onToggleAgentInfo:ae}):e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-empty-overview",children:[e.jsxs("div",{className:"flat-empty-overview__header",children:[e.jsx("span",{className:"flat-empty-overview__title",children:"🗺️ Areas"}),e.jsx("span",{className:"flat-empty-overview__hint",children:"Click an area to focus it, or an agent to chat"})]}),e.jsx("div",{className:"flat-empty-overview__grid",style:{gridTemplateColumns:`repeat(${$.gridCols}, 1fr)`},children:$.groups.length===0?e.jsx("div",{className:"flat-empty-overview__empty",children:e.jsx("span",{children:"No areas or agents yet"})}):$.groups.map(a=>{const s=a.area.id,o=$.positions.get(s);return e.jsxs("div",{className:"flat-empty-area-card",style:{"--area-color":a.area.color,gridRow:o==null?void 0:o.row,gridColumn:o==null?void 0:o.col},children:[e.jsxs("button",{type:"button",className:"flat-empty-area-card__header",onClick:()=>Ce(s),title:`Focus ${a.area.name} in left panel`,children:[e.jsx("span",{className:"flat-empty-area-card__color",style:{background:a.area.color}}),e.jsx("span",{className:"flat-empty-area-card__name",children:a.area.name}),e.jsx("span",{className:"flat-empty-area-card__count",children:a.agents.length})]}),e.jsx("div",{className:"flat-empty-area-card__agents",children:a.agents.map(d=>e.jsxs("button",{type:"button",className:`flat-empty-agent-chip ${d.status}`,onClick:()=>h(d.id),title:`Open chat with ${d.name}`,children:[e.jsx(Ue,{agent:d,size:16}),e.jsx("span",{className:"flat-empty-agent-chip__name",children:d.name}),e.jsx("span",{className:"flat-empty-agent-chip__dot",style:{backgroundColor:Xe(d.status)}})]},d.id))})]},s)})})]})})}),M&&f&&e.jsxs("aside",{className:"flat-inspector","aria-label":"Inspector panel",children:[e.jsxs("div",{className:"flat-inspector__header",children:[e.jsxs("div",{className:"flat-inspector__tabs",role:"tablist","aria-label":"Inspector view",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":z==="agent",className:`flat-inspector__tab ${z==="agent"?"flat-inspector__tab--active":""}`,onClick:()=>le("agent"),children:"Agent"}),e.jsx("button",{type:"button",role:"tab","aria-selected":z==="tracking",className:`flat-inspector__tab ${z==="tracking"?"flat-inspector__tab--active":""}`,onClick:()=>le("tracking"),children:"Tracking"})]}),e.jsx("button",{type:"button",className:"flat-inspector__close",onClick:ge,title:"Close inspector","aria-label":"Close inspector",children:"✕"})]}),e.jsx("div",{className:"flat-inspector__body",children:z==="tracking"?e.jsx(st,{activeAgentId:f??"",onSelectAgent:a=>h(a)}):(()=>{const a=k.find(s=>s.id===f);return a?e.jsx(rt,{agent:a,onFocusAgent:s=>h(s),onKillAgent:s=>g.killAgent(s)}):e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Agent not found"})})})()})]}),Q&&e.jsx(lt,{url:Q.url,name:Q.name,onClose:()=>pe(null)}),me&&e.jsx(it,{state:me,onClose:()=>ee(null)}),te&&e.jsx(ot,{action:"clear-subordinates",selectedAgentId:te.agentId,subordinateCount:te.count,onClose:()=>ue(null),onClearHistory:()=>{}}),e.jsx(ct,{agent:f?k.find(a=>a.id===f)??null:null,isOpen:he&&!!f,onClose:ne})]})}export{Pt as FlatView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.app.view-mode-flat .guake-terminal{display:none}.flat-view{display:grid;grid-template-columns:1fr 1fr;height:100%;width:100%;background:#282a36;overflow:hidden;padding-left:64px;box-sizing:border-box;transition:grid-template-columns .25s ease}.flat-view--with-inspector{grid-template-columns:1fr 1fr 320px}.flat-middle{display:flex;flex-direction:column;background:#282a36;border-right:1px solid rgba(255,255,255,.06);overflow:hidden;min-width:280px}.flat-middle__header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;gap:12px}.flat-middle__title{font-size:14px;font-weight:600;color:#f8f8f2;margin:0}.flat-middle__actions{display:flex;gap:6px;flex-shrink:0}.flat-middle__content{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px}.flat-middle__content::-webkit-scrollbar{width:6px}.flat-middle__content::-webkit-scrollbar-track{background:transparent}.flat-middle__content::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-middle__content::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-cta-btn{padding:4px 10px;font-size:11px;font-weight:500;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.flat-cta-btn--agent{background:#50fa7b26;color:#50fa7b}.flat-cta-btn--agent:hover{background:#50fa7b40}.flat-cta-btn--boss{background:#ffd70026;color:gold}.flat-cta-btn--boss:hover{background:#ffd70040}.flat-cta-btn--building{background:#8be9fd26;color:#8be9fd}.flat-cta-btn--building:hover{background:#8be9fd40}.flat-cta-btn--area{background:#bd93f926;color:#bd93f9}.flat-cta-btn--area:hover{background:#bd93f940}.flat-middle .agent-overview-panel{position:relative;inset:auto;width:100%;height:100%;border-right:none;flex:1;min-height:0;z-index:auto}.flat-middle .agent-overview-panel .aop-row-controls .close-btn{display:none}.flat-middle__content:has(>.agent-overview-panel){padding:0;overflow:hidden}.flat-right{display:flex;flex-direction:column;background:#21222c;overflow:hidden}.flat-chat{display:flex;flex-direction:column;height:100%}.flat-chat--empty{align-items:center;justify-content:center}.flat-chat__placeholder{display:flex;flex-direction:column;align-items:center;gap:12px;color:#6272a4}.flat-chat__placeholder-icon{font-size:48px;opacity:.5}.flat-chat__placeholder-text{font-size:14px}.flat-empty-overview{display:flex;flex-direction:column;height:100%;padding:12px 16px;gap:10px;overflow-y:auto}.flat-empty-overview::-webkit-scrollbar{width:6px}.flat-empty-overview::-webkit-scrollbar-track{background:transparent}.flat-empty-overview::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-empty-overview::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-empty-overview__header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-shrink:0}.flat-empty-overview__title{font-size:13px;font-weight:600;color:#f8f8f2}.flat-empty-overview__hint{font-size:11px;color:#6272a4}.flat-empty-overview__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;align-content:start}@media(max-width:768px){.flat-empty-overview__grid{grid-template-columns:1fr}}.flat-empty-overview__empty{grid-column:1/-1;display:flex;align-items:center;justify-content:center;padding:40px;color:#6272a4;font-size:13px}.flat-empty-area-card{display:flex;flex-direction:column;background:#363848;border:1px solid rgba(255,255,255,.06);border-radius:8px;overflow:hidden;transition:border-color .15s ease,box-shadow .15s ease}.flat-empty-area-card:hover{border-color:#ffffff1a;box-shadow:0 2px 8px #00000040}.flat-empty-area-card__header{display:flex;align-items:center;gap:6px;padding:6px 8px;background:transparent;border:none;cursor:pointer;width:100%;text-align:left;color:#f8f8f2;font-size:12px;font-weight:600;transition:background .15s ease}.flat-empty-area-card__header:hover{background:#ffffff0a}.flat-empty-area-card__color{width:8px;height:8px;border-radius:50%;flex-shrink:0}.flat-empty-area-card__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flat-empty-area-card__count{font-size:10px;font-weight:500;color:#6272a4;background:#ffffff0f;padding:1px 5px;border-radius:8px;flex-shrink:0}.flat-empty-area-card__caret{font-size:10px;color:#6272a4;flex-shrink:0;width:12px;text-align:center}.flat-empty-area-card__agents{display:flex;flex-wrap:wrap;gap:4px;padding:0 8px 8px}.flat-empty-agent-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0}.flat-empty-agent-chip:hover{background:#ffffff14;border-color:#ffffff1f;color:#f8f8f2}.flat-empty-agent-chip.working .flat-empty-agent-chip__dot{animation:flat-empty-agent-working-pulse 1.8s ease-out infinite;transform-origin:center}@keyframes flat-empty-agent-working-pulse{0%{transform:scale(1);box-shadow:0 0 #4a9eff99}70%{transform:scale(1.15);box-shadow:0 0 0 5px #4a9eff00}to{transform:scale(1);box-shadow:0 0 #4a9eff00}}@media(prefers-reduced-motion:reduce){.flat-empty-agent-chip.working .flat-empty-agent-chip__dot{animation:none}}.flat-empty-agent-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-empty-agent-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-terminal-wrapper{display:flex;flex-direction:column;height:100%;min-height:0;position:relative;background:#21222c;overflow:hidden;--guake-side-panel-width: 380px}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel){margin-right:var(--guake-side-panel-width);transition:margin-right .2s ease}.flat-terminal-wrapper__header{display:flex;flex-direction:row;align-items:center;gap:12px;padding:6px 12px;border-bottom:1px solid rgba(255,255,255,.06);background:#1e1f29;flex-shrink:0;min-height:40px}.flat-terminal-wrapper__header-main{display:flex;align-items:center;gap:10px;min-width:0;flex:1 1 auto;overflow:hidden;padding:4px 6px;margin:0;background:transparent;border:1px solid transparent;border-radius:8px;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__header-main:hover{background:#ffffff0a;border-color:#ffffff0f}.flat-terminal-wrapper__header-main--active{background:#bd93f92e;border-color:#bd93f973}.flat-terminal-wrapper__header-main--active:hover{background:#bd93f942}.flat-terminal-wrapper__header-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex:0 0 auto;flex-wrap:nowrap}.flat-terminal-wrapper__statusbar{display:flex;align-items:center;gap:10px;padding:6px 12px;flex-shrink:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.06);min-height:32px;box-sizing:border-box}.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__cwd,.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__context{background:transparent;border-color:#ffffff0a}.flat-terminal-wrapper__statusbar-spacer{flex:1 1 auto}.flat-terminal-wrapper__buildings{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__building-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__building-btn:hover{color:#f8f8f2;background:#ffffff14}.flat-terminal-wrapper__building-btn--offline{color:#ffb86cbf}.flat-terminal-wrapper__building-btn--offline:hover{color:#ffb86c}.flat-terminal-wrapper__building-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__building-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__detached{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;font-size:11px;font-weight:500;color:#ffb86c;background:#ffb86c1f;border:1px solid rgba(255,184,108,.35);border-radius:10px;animation:blink 1.6s ease-in-out infinite}.flat-terminal-wrapper__area-dir{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:11px;font-family:SF Mono,Menlo,Consolas,monospace;color:#9a9caa;background:#ffffff08;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;max-width:240px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__area-dir:hover{background:#ffffff14;color:#f8f8f2;border-color:#ffffff24}.flat-terminal-wrapper__area-dir-name{overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__area-dir-branch{display:inline-flex;align-items:center;gap:3px;color:#8be9fd;opacity:.85}.flat-terminal-wrapper__branch-ahead{display:inline-flex;align-items:center;color:#50fa7b}.flat-terminal-wrapper__branch-behind{display:inline-flex;align-items:center;color:#ffb86c}.flat-terminal-wrapper__area-fetch{display:inline-flex;align-items:center;padding:1px 3px;border-radius:4px;color:#6272a4;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__area-fetch:hover{background:#ffffff14;color:#f8f8f2}.flat-terminal-wrapper__area-fetch--fetching{animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__context-label{color:#6272a4;margin-right:2px}.flat-terminal-wrapper__context-free{color:#6272a4;font-size:10px}.flat-terminal-wrapper__actions{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__action-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:24px;padding:0;font-size:12px;line-height:1;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__action-btn:hover:not(:disabled){color:#f8f8f2;background:#ffffff0f}.flat-terminal-wrapper__action-btn:disabled{opacity:.35;cursor:not-allowed}.flat-terminal-wrapper__action-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__action-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__action-btn--danger{color:#ff5555d9}.flat-terminal-wrapper__action-btn--danger:hover{color:#f55;background:#ff55551f}.flat-terminal-wrapper__action-btn--confirm{color:#f55;background:#ff55552e;box-shadow:0 0 0 1px #ff555580;animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__more{position:relative;display:inline-flex}.flat-terminal-wrapper__more-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:220px;padding:4px;background:#363848;border:1px solid rgba(255,255,255,.08);border-radius:8px;box-shadow:0 8px 28px #00000073;z-index:100}.flat-terminal-wrapper__more-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 10px;font-size:12px;color:#f8f8f2;background:transparent;border:none;border-radius:6px;cursor:pointer;text-align:left;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__more-item:hover:not(:disabled){background:#ffffff0f}.flat-terminal-wrapper__more-item:disabled{opacity:.45;cursor:not-allowed}.flat-terminal-wrapper__more-item--danger{color:#ff5555e6}.flat-terminal-wrapper__more-item--danger:hover:not(:disabled){color:#f55;background:#ff55551f}.flat-terminal-wrapper__more-divider{height:1px;margin:4px 2px;background:#ffffff0f}.flat-terminal-wrapper__header-info{display:flex;flex-direction:row;align-items:baseline;gap:8px;min-width:0;overflow:hidden}.flat-terminal-wrapper__header-name{font-size:13px;font-weight:600;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-status{font-size:10px;text-transform:capitalize;flex-shrink:0}.flat-terminal-wrapper__header-task{font-size:11px;color:#6272a4;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:2px 8px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);flex-shrink:1}.flat-terminal-wrapper__header-model{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-width:0}.flat-terminal-wrapper__header-provider-icon{width:16px;height:16px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-terminal-wrapper__header-model-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:10px;font-family:SF Mono,Menlo,Consolas,monospace;font-weight:600;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:999px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;line-height:1.4}.flat-terminal-wrapper__header-model-name{color:#f8f8f2;text-transform:lowercase;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-model-sep{opacity:.6}.flat-terminal-wrapper__header-model-effort{color:#bd93f9;text-transform:lowercase}.flat-terminal-wrapper__cwd{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;max-width:240px;transition:background .15s ease,border-color .15s ease,color .15s ease}.flat-terminal-wrapper__cwd:hover{background:#ffffff14;border-color:#ffffff24;color:#f8f8f2}.flat-terminal-wrapper__cwd-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__cwd-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:SF Mono,Menlo,Consolas,monospace}.flat-terminal-wrapper__context{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__context:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__context-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__context-bar{position:relative;width:56px;height:5px;border-radius:3px;background:#ffffff14;overflow:hidden}.flat-terminal-wrapper__context-bar-fill{position:absolute;left:0;top:0;height:100%;border-radius:3px;transition:width .2s ease,background-color .2s ease}.flat-terminal-wrapper__context-tokens{font-family:SF Mono,Menlo,Consolas,monospace;font-size:11px;font-weight:600;font-variant-numeric:tabular-nums}.flat-terminal-wrapper__context-warning{font-size:11px;opacity:.8}.flat-terminal-wrapper__view-mode{display:inline-flex;align-items:center;padding:2px;gap:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__view-mode-btn{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:8px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__view-mode-btn:hover{color:#f8f8f2;background:#ffffff0a}.flat-terminal-wrapper__view-mode-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f980,0 1px 3px #00000040}.flat-terminal-wrapper__view-mode-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__view-mode-icon{font-size:13px;line-height:1}.flat-terminal-wrapper__view-mode-label{line-height:1}.flat-terminal-wrapper__theme{display:inline-flex;align-items:center}.flat-terminal-wrapper__theme .theme-selector-trigger{padding:4px 9px;font-size:11px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06)}.flat-terminal-wrapper__theme .theme-selector-trigger:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__inspector-toggle:hover{color:#f8f8f2;background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle--active{color:#f8f8f2;background:#bd93f938;border-color:#bd93f98c;box-shadow:0 0 0 1px #bd93f959,0 1px 3px #00000040}.flat-terminal-wrapper__inspector-toggle--active:hover{background:#bd93f952}.flat-terminal-wrapper__inspector-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}.flat-terminal-wrapper__inspector-label{line-height:1}.flat-terminal-wrapper__close{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;color:#6272a4;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__close:hover{color:#f55;background:#ff55551f;border-color:#f556}@media(max-width:1100px){.flat-terminal-wrapper__view-mode-label,.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__cwd{max-width:160px}}.flat-terminal-wrapper .guake-output{flex:1 1 auto;min-height:0;overflow-y:auto;padding:14px 18px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar{width:6px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-track{background:transparent}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-terminal-wrapper .guake-input-container{position:relative;flex-shrink:0;border-top:1px solid rgba(255,255,255,.06);background:#1e1f29}.flat-terminal-wrapper .guake-search-bar,.flat-terminal-wrapper .atp-search-bar{position:sticky;top:0;z-index:10;background:#1e1f29}.flat-terminal-wrapper .guake-handle,.flat-terminal-wrapper .guake-side-panel-resize,.flat-terminal-wrapper .atp-resize-handle{display:none}.flat-terminal-wrapper .compacting-indicator{padding:12px;margin:8px}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}.flat-inspector{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:#1e1f29;border-left:1px solid rgba(255,255,255,.06);overflow:hidden;animation:flat-inspector-slide-in .22s ease}.flat-inspector__header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.06);background:#21222c;flex-shrink:0}.flat-inspector__tabs{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#00000040;border:1px solid rgba(255,255,255,.06);border-radius:6px}.flat-inspector__tab{padding:4px 10px;font-size:12px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:4px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-inspector__tab:hover{color:#f8f8f2}.flat-inspector__tab--active{color:#f8f8f2;background:#ffffff14}.flat-inspector__close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:13px;color:#6272a4;background:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-inspector__close:hover{color:#f8f8f2;background:#ffffff0f;border-color:#ffffff1a}.flat-inspector__body{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column}.flat-inspector__body .unit-panel{flex:1 1 auto;min-height:0;min-width:0;padding:10px}.flat-inspector__empty{display:flex;align-items:center;justify-content:center;flex:1;color:#6272a4;font-size:13px}@keyframes flat-inspector-slide-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media(max-width:1024px){.flat-view,.flat-view--with-inspector{grid-template-columns:1fr}.flat-right,.flat-inspector{display:none}}@media(min-width:1400px){.flat-view{grid-template-columns:minmax(280px,400px) 1fr}.flat-view--with-inspector{grid-template-columns:minmax(280px,400px) 1fr 360px}}.flat-bottom-panel{display:flex;flex-direction:column;flex-shrink:0;height:250px;min-height:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.08);overflow:hidden}.flat-bottom-panel__header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 10px;background:#21222c;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;min-height:28px}.flat-bottom-panel__title{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-bottom-panel__muted{color:#6272a4;font-weight:400;font-size:10px}.flat-bottom-panel__close{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-bottom-panel__close:hover{color:#f8f8f2;background:#ffffff14}.flat-bottom-panel__body{flex:1 1 auto;min-height:0;display:flex;background:#282a36}.flat-bottom-panel__body>*{flex:1 1 auto;min-height:0}.flat-bottom-panel__placeholder{flex:1 1 auto;display:flex;align-items:center;justify-content:center;color:#6272a4;font-size:12px}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Z as as,u as ts,ac as vs,ad as bs,ae as zs,j as s,I as F,N as Is,af as $s,ag as Es,ah as Ds,ai as Ms,r as c,aj as Ls,a3 as Ss,$ as Xs,K as Ps,B as Rs,ak as Ys,al as Gs,am as Us,an as ms,ao as _s,s as M,ap as Fs,n as U}from"./main-Cqo-Awpr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fs=as.memo(({agent:a,isSelected:A,isKeyboardFocused:L=!1,onSelect:S,onDoubleClick:n,onChat:g,onFocus:h,onKill:w,onDragStart:X})=>{const{t:x}=ts(["dashboard","common"]),P=vs().has(a.id),N=bs(a.status),Z=zs(a),j=Ms(Z),I=a.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(F,{name:"task",size:12})," ",a.taskLabel]}):a.currentTask||a.lastAssignedTask,m=a.status==="idle"&&a.lastActivity>0,[,B]=as.useState(0);return as.useEffect(()=>{if(!m)return;const b=window.setInterval(()=>B(T=>T+1),15e3);return()=>window.clearInterval(b)},[m]),s.jsxs("div",{className:`dash-card dash-card--${N} ${A?"dash-card--selected":""} ${L?"dash-card--keyboard-focused":""}`,"data-agent-id":a.id,onClick:S,onDoubleClick:b=>{b.stopPropagation(),n()},onDragStart:b=>{X==null||X(a),b.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[s.jsxs("div",{className:"dash-card__row1",children:[s.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${N}`}),s.jsx("span",{className:"dash-card__name",children:a.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Is,{agent:a,size:14})," ",a.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${a.provider}`,children:[s.jsx(F,{name:a.provider==="codex"||a.provider==="opencode"?"status-pending":"robot",size:11,weight:a.provider==="codex"||a.provider==="opencode"?"fill":"regular",color:a.provider==="codex"?"#a16207":a.provider==="opencode"?"#4ade80":void 0})," ",a.provider]}),P&&s.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),s.jsxs("div",{className:"dash-card__row2",children:[s.jsx("span",{className:`dash-card__status dash-card__status--${N}`,children:P?"Unseen":a.status}),s.jsxs("div",{className:"dash-card__context",children:[s.jsx("div",{className:"dash-card__context-bar",children:s.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${j}`,style:{width:`${Z}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[Z,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:a.cwd,children:[s.jsx(F,{name:"folder",size:11})," ",a.cwd.split("/").pop()||a.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ds(a.lastActivity)},title:Es(a.lastActivity),children:[s.jsx(F,{name:"status-waiting-input",size:10})," ",$s(a.lastActivity)]})]}),I&&s.jsx("div",{className:"dash-card__row4",children:s.jsx("span",{className:"dash-card__task",children:I})}),s.jsxs("div",{className:"dash-card__actions",children:[g&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:b=>{b.stopPropagation(),g()},title:x("cards.openTerminal"),children:x("cards.chat")}),w&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:b=>{b.stopPropagation(),w()},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});fs.displayName="AgentCard";const ws=({buildings:a,onSelectBuilding:A})=>{const{t:L}=ts(["dashboard"]),S=c.useMemo(()=>Array.from(a.values()).sort((n,g)=>n.name.localeCompare(g.name)),[a]);return s.jsxs("div",{className:"dashboard-view__buildings",children:[s.jsxs("div",{className:"dashboard-view__buildings-header",children:[s.jsx("span",{className:"dashboard-view__buildings-title",children:L("buildings.title")}),s.jsx("span",{className:"dashboard-view__buildings-count",children:S.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:S.map(n=>{const g=bs(n.status),h=Ls(n.type);return s.jsxs("button",{className:`dash-pill dash-pill--${g}`,onClick:()=>A==null?void 0:A(n.id),title:`${n.name} (${n.type}) - ${n.status}`,children:[s.jsx("span",{className:"dash-pill__icon",children:s.jsx(F,{name:h,size:14})}),s.jsx("span",{className:"dash-pill__name",children:n.name}),s.jsx("span",{className:`dash-pill__dot dash-pill__dot--${g}`})]},n.id)})})]})};ws.displayName="BuildingPills";function Ks({onSelectAgent:a,onFocusAgent:A,onKillAgent:L,onSelectBuilding:S,onOpenTerminal:n,onFocusZone:g}){const{t:h}=ts(["dashboard","common"]),w=Ss(),X=Xs(),x=Ps(),rs=Rs(),P=vs(),[N,Z]=c.useState(""),[j,I]=c.useState("all"),[m,B]=c.useState("zone"),[b,T]=c.useState(new Set),[k,J]=c.useState(null),[ps,K]=c.useState(null),[R,Q]=c.useState(!1),[p,H]=c.useState(null),W=c.useMemo(()=>{const e=Array.from(w.values());return{total:e.length,working:e.filter(i=>i.status==="working"||i.status==="waiting"||i.status==="waiting_permission").length,idle:e.filter(i=>i.status==="idle").length,error:e.filter(i=>i.status==="error"||i.status==="offline"||i.status==="orphaned").length}},[w]),ns=c.useMemo(()=>m==="zone"?Ys(w,x):m==="status"?Gs(w,P):Us(w),[w,x,m,P]),V=c.useMemo(()=>{const e=N.toLowerCase().trim(),i=ns.map(l=>({...l,agents:l.agents.filter(_=>{if(j==="working"){if(_.status!=="working"&&_.status!=="waiting"&&_.status!=="waiting_permission")return!1}else if(j==="error"&&_.status!=="error"&&_.status!=="offline"&&_.status!=="orphaned")return!1;return!(e&&!_.name.toLowerCase().includes(e)&&!_.class.toLowerCase().includes(e))})}));return m==="zone"?i:i.filter(l=>l.agents.length>0)},[ns,j,N,m]),O=c.useCallback(e=>e.area?`area:${e.area.id}`:`${m}:${e.label}`,[m]),C=c.useMemo(()=>{const e=[];return V.forEach(i=>{const l=O(i);if(b.has(l))return;const _=m==="status"?ms(i.agents,{prioritizeRecentlyIdle:!0}):_s(i.agents);e.push(..._)}),e},[V,b,m,O]),gs=c.useCallback(e=>{T(i=>{const l=new Set(i);return l.has(e)?l.delete(e):l.add(e),l})},[]),xs=c.useCallback(e=>{n==null||n(e)},[n]),js=c.useCallback(e=>{J(e)},[]),Ns=c.useCallback((e,i)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",K(i)},[]),ks=c.useCallback(()=>{K(null)},[]),Cs=c.useCallback(e=>{if(!k)return;if(e===null){const $=M.getState(),t=Array.from($.areas.values()).find(r=>r.assignedAgentIds.includes(k.id));t&&M.unassignAgentFromArea(k.id,t.id),J(null),K(null);return}const i=x.get(e);if(!i)return;const l=Array.from(w.values()),_=Fs(i,l,k.position);M.updateAgent({...k,position:{...k.position,x:_.x,z:_.z}}),M.assignAgentToArea(k.id,e),J(null),K(null)},[k,x,w]);return c.useEffect(()=>{if(C.length===0){Q(!1),H(null);return}R&&(!p||!C.some(e=>e.id===p))&&(H(C[0].id),a==null||a(C[0].id))},[C,R,p,a]),c.useEffect(()=>{const e=t=>t instanceof HTMLElement?t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable:!1,i=t=>t instanceof HTMLElement?!!t.closest(".guake-terminal")||t.classList.contains("guake-input")||t.classList.contains("agent-panel-input"):!1,l=t=>{const r=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(z=>z.dataset.agentId===t);r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},_=(t,r)=>{var ds,os,cs,ls,us,hs;const z=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(d=>{const u=d.dataset.agentId;if(!u)return null;const y=d.getBoundingClientRect();return{id:u,centerX:y.left+y.width/2,centerY:y.top+y.height/2,height:y.height}}).filter(d=>d!==null).sort((d,u)=>d.centerY-u.centerY||d.centerX-u.centerX);if(z.length===0)return t;const ss=z.reduce((d,u)=>d+u.height,0)/z.length,es=Math.max(18,ss*.6),f=[];for(const d of z){const u=f[f.length-1];if(!u){f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}]);continue}const y=u.reduce((ys,As)=>ys+As.centerY,0)/u.length;Math.abs(d.centerY-y)<=es?u.push({id:d.id,centerX:d.centerX,centerY:d.centerY}):f.push([{id:d.id,centerX:d.centerX,centerY:d.centerY}])}f.forEach(d=>d.sort((u,y)=>u.centerX-y.centerX));const Y=f.findIndex(d=>d.some(u=>u.id===t));if(Y===-1)return((os=(ds=f[0])==null?void 0:ds[0])==null?void 0:os.id)??t;const E=f[Y],v=E.findIndex(d=>d.id===t);if(v===-1)return((ls=(cs=f[0])==null?void 0:cs[0])==null?void 0:ls.id)??t;if(r==="left")return((us=E[Math.max(0,v-1)])==null?void 0:us.id)??t;if(r==="right")return((hs=E[Math.min(E.length-1,v+1)])==null?void 0:hs.id)??t;const q=r==="up"?Math.max(0,Y-1):Math.min(f.length-1,Y+1),o=f[q],G=E[v].centerX;let D=o[0],is=Math.abs(D.centerX-G);for(const d of o){const u=Math.abs(d.centerX-G);u<is&&(D=d,is=u)}return(D==null?void 0:D.id)??t},$=t=>{const r=M.getShortcuts(),z=r.find(o=>o.id==="dashboard-selector-toggle"),ss=r.find(o=>o.id==="dashboard-vim-left"),es=r.find(o=>o.id==="dashboard-vim-down"),f=r.find(o=>o.id==="dashboard-vim-up"),Y=r.find(o=>o.id==="dashboard-vim-right"),E=r.find(o=>o.id==="open-terminal"),v=M.getState();if(e(t.target))if(!v.terminalOpen&&i(t.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(U(t,z)){if(C.length===0)return;t.preventDefault(),t.stopPropagation(),Q(!0),H(o=>{const G=o&&C.some(D=>D.id===o)?o:C[0].id;return a==null||a(G),window.setTimeout(()=>l(G),0),G});return}const q=U(t,ss)||t.key==="ArrowLeft"?"left":U(t,es)||t.key==="ArrowDown"?"down":U(t,f)||t.key==="ArrowUp"?"up":U(t,Y)||t.key==="ArrowRight"?"right":null;if(q&&R&&p){t.preventDefault(),t.stopPropagation();const o=_(p,q);o!==p&&(H(o),a==null||a(o),window.setTimeout(()=>l(o),0));return}if(U(t,E)){if(v.terminalOpen)return;if(R&&p&&v.agents.has(p)){t.preventDefault(),n==null||n(p);return}if(v.selectedAgentIds.size===1){t.preventDefault();const o=Array.from(v.selectedAgentIds)[0];n==null||n(o);return}if(v.lastSelectedAgentId&&v.agents.has(v.lastSelectedAgentId)){t.preventDefault(),n==null||n(v.lastSelectedAgentId);return}}};return document.addEventListener("keydown",$,!0),()=>document.removeEventListener("keydown",$,!0)},[C,R,p,n,a]),c.useEffect(()=>{const e=document.activeElement;e instanceof HTMLElement&&e.closest(".guake-terminal")&&!M.getState().terminalOpen&&e.blur()},[]),s.jsxs("div",{className:"dashboard-view",children:[s.jsxs("div",{className:"dashboard-view__topbar",children:[s.jsxs("div",{className:"dashboard-view__metrics",children:[s.jsxs("button",{className:`dashboard-view__metric-btn ${j==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.total}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:labels.agents")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${j==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("working"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.working}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.working")})]}),s.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.idle}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.idle")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${j==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("error"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.error}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.error")})]})]}),s.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:h("searchPlaceholder"),value:N,onChange:e=>Z(e.target.value)})]}),s.jsxs("div",{className:"dashboard-view__grouping",children:[s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>B("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>B("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>B("activity"),children:h("grouping.byActivity")})]}),s.jsxs("div",{className:"dashboard-view__content",children:[V.map(e=>{const i=O(e),l=b.has(i),_=m==="status"?ms(e.agents,{prioritizeRecentlyIdle:!0}):_s(e.agents),$=e.agents.filter(r=>r.status==="working"||r.status==="waiting"||r.status==="waiting_permission").length,t=e.agents.filter(r=>P.has(r.id)).length;return s.jsxs("div",{className:`dashboard-view__zone ${ps===(e.area?e.area.id:null)&&k?"dashboard-view__zone--drag-over":""}`,onDragOver:r=>Ns(r,e.area?e.area.id:null),onDragLeave:ks,onDrop:()=>Cs(e.area?e.area.id:null),children:[s.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>gs(i),children:[s.jsxs("div",{className:"dashboard-view__zone-left",children:[s.jsx("span",{className:`dashboard-view__zone-chevron ${l?"dashboard-view__zone-chevron--collapsed":""}`,children:s.jsx(F,{name:"caret-down",size:12})}),s.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:e.color}}),s.jsx("span",{className:"dashboard-view__zone-name",children:e.label}),s.jsxs("span",{className:"dashboard-view__zone-count",children:[h("agentCount",{count:e.agents.length}),$>0&&s.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",$," ",h("working")]}),t>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",t," Unseen"]})]})]}),e.area&&g&&s.jsx("button",{className:"dashboard-view__zone-focus",onClick:r=>{r.stopPropagation(),g(e.area.id)},title:h("focusZone"),children:h("focusZone")})]}),!l&&s.jsx("div",{className:"dashboard-view__zone-grid",children:_.map(r=>s.jsx(fs,{agent:r,isSelected:rs.has(r.id),isKeyboardFocused:R&&p===r.id,onSelect:()=>{a==null||a(r.id),Q(!0),H(r.id)},onDoubleClick:()=>xs(r.id),onChat:()=>n==null?void 0:n(r.id),onFocus:A?()=>A(r.id):void 0,onKill:L?()=>L(r.id):void 0,onDragStart:js},r.id))})]},i)}),V.length===0&&s.jsx("div",{className:"dashboard-view__empty",children:N?h("noAgentsMatching",{search:N}):h("noAgentsSpawned")}),X.size>0&&s.jsx(ws,{buildings:X,onSelectBuilding:S})]})]})}export{Ks as DashboardView};
|