@jefuriiij/synthra 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +2 -0
- package/dist/cli/index.js +680 -632
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/index.js +322 -90
- package/dist/dashboard/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var init_package = __esm({
|
|
|
18
18
|
"package.json"() {
|
|
19
19
|
package_default = {
|
|
20
20
|
name: "@jefuriiij/synthra",
|
|
21
|
-
version: "0.
|
|
21
|
+
version: "0.17.0",
|
|
22
22
|
publishConfig: {
|
|
23
23
|
access: "public"
|
|
24
24
|
},
|
|
@@ -116,6 +116,258 @@ init_package();
|
|
|
116
116
|
import { serve } from "@hono/node-server";
|
|
117
117
|
import { Hono } from "hono";
|
|
118
118
|
|
|
119
|
+
// src/cli/doctor-command.ts
|
|
120
|
+
import { readFile as readFile2, stat } from "fs/promises";
|
|
121
|
+
import { homedir } from "os";
|
|
122
|
+
import { join as join2, resolve } from "path";
|
|
123
|
+
import spawn from "cross-spawn";
|
|
124
|
+
|
|
125
|
+
// src/graph/types.ts
|
|
126
|
+
var SCHEMA_VERSION = 2;
|
|
127
|
+
|
|
128
|
+
// src/hooks/claude-md.ts
|
|
129
|
+
import { readFile, writeFile } from "fs/promises";
|
|
130
|
+
import { basename, dirname } from "path";
|
|
131
|
+
var POLICY_VERSION = 9;
|
|
132
|
+
var POLICY_BEGIN = `<!-- synthra-policy v${POLICY_VERSION} BEGIN -->`;
|
|
133
|
+
var POLICY_END = `<!-- synthra-policy v${POLICY_VERSION} END -->`;
|
|
134
|
+
var ANY_BLOCK_RE = /<!--\s*synthra-policy\s+v\d+\s+BEGIN\s*-->[\s\S]*?<!--\s*synthra-policy\s+v\d+\s+END\s*-->\s*/g;
|
|
135
|
+
function stripPolicyBlock(content) {
|
|
136
|
+
return content.replace(ANY_BLOCK_RE, "");
|
|
137
|
+
}
|
|
138
|
+
function policyBlock() {
|
|
139
|
+
return [
|
|
140
|
+
POLICY_BEGIN,
|
|
141
|
+
"## Synthra context policy",
|
|
142
|
+
"",
|
|
143
|
+
"Synthra has pre-loaded structured context into this session and exposes",
|
|
144
|
+
"the project's code graph through MCP tools. **Prefer these tools over",
|
|
145
|
+
"Grep / Glob / Read** \u2014 they are faster, cheaper, and already filtered",
|
|
146
|
+
"to relevant files.",
|
|
147
|
+
"",
|
|
148
|
+
"> **Tool namespace.** Synthra's MCP tools are exposed as",
|
|
149
|
+
"> `mcp__synthra__graph_continue`, `mcp__synthra__graph_read`, and",
|
|
150
|
+
"> `mcp__synthra__graph_register_edit`. **Short names will NOT resolve**",
|
|
151
|
+
"> in ToolSearch or invocation \u2014 always use the full namespaced form.",
|
|
152
|
+
"> If the tools are deferred, load their schemas with ToolSearch:",
|
|
153
|
+
"> `select:mcp__synthra__graph_continue,mcp__synthra__graph_read,mcp__synthra__graph_register_edit,mcp__synthra__find_symbol,mcp__synthra__route_task`.",
|
|
154
|
+
"> Below, short names (`graph_continue` etc.) appear in prose for",
|
|
155
|
+
"> readability only.",
|
|
156
|
+
"",
|
|
157
|
+
"### Tools",
|
|
158
|
+
"",
|
|
159
|
+
"- **`graph_continue(query)`** \u2014 returns a `Confidence` label, the list",
|
|
160
|
+
" of relevant `Files`, and signatures + top function bodies for those",
|
|
161
|
+
" files. Your default first move when you need project context.",
|
|
162
|
+
"- **`graph_read(target)`** \u2014 fetch source. Prefer the",
|
|
163
|
+
' `"file/path.ts::SymbolName"` form over a bare file path \u2014 reading one',
|
|
164
|
+
" symbol is ~50 tokens, reading a whole file is thousands.",
|
|
165
|
+
"- **`graph_register_edit(files)`** \u2014 after you edit files, call this so",
|
|
166
|
+
" subsequent turns weight your changes and avoid stale snapshots.",
|
|
167
|
+
"- **`find_symbol(name)`** \u2014 **reuse-first**: before writing a new helper,",
|
|
168
|
+
" util, or function, call this to check whether one already exists. If it",
|
|
169
|
+
" returns matches, reuse or extend them instead of re-implementing; only",
|
|
170
|
+
' "no match \u2014 safe to create" means it is genuinely new.',
|
|
171
|
+
"- **`route_task(task)`** \u2014 **delegate-first**: before starting a multi-step",
|
|
172
|
+
" implementation task, ask which installed subagent/skill fits it. Plan on",
|
|
173
|
+
" the primary model, then hand execution to the recommended subagent on a",
|
|
174
|
+
" cheaper model (sonnet \u2248 5\xD7 cheaper than opus). Synthra may also inject a",
|
|
175
|
+
" `[Synthra route]` hint on your prompt \u2014 treat it the same way.",
|
|
176
|
+
"",
|
|
177
|
+
"### When to call `graph_continue` \u2014 and when to skip",
|
|
178
|
+
"",
|
|
179
|
+
"**Call `graph_continue` only when you do NOT already know the relevant",
|
|
180
|
+
"files.**",
|
|
181
|
+
"",
|
|
182
|
+
"Call it when:",
|
|
183
|
+
"- This is the first message of a new task or conversation",
|
|
184
|
+
"- The task shifts to a different area of the codebase",
|
|
185
|
+
"- You need files you haven't seen yet in this session",
|
|
186
|
+
"",
|
|
187
|
+
"**Skip `graph_continue` when:**",
|
|
188
|
+
"- You already identified the relevant files earlier in this conversation",
|
|
189
|
+
"- You are doing follow-up work on files already read (verify, refactor,",
|
|
190
|
+
" test, docs, cleanup, commit)",
|
|
191
|
+
"- The task is pure text (commit message, explanation, summary)",
|
|
192
|
+
"",
|
|
193
|
+
"If skipping, go directly to",
|
|
194
|
+
'`mcp__synthra__graph_read("file.ts::symbol")` on what you already know.',
|
|
195
|
+
"",
|
|
196
|
+
"### Confidence caps",
|
|
197
|
+
"",
|
|
198
|
+
"When `graph_continue` returns:",
|
|
199
|
+
"",
|
|
200
|
+
"- **`Confidence: high`** \u2192 Stop. Do NOT Grep, Glob, or further explore",
|
|
201
|
+
" for this query. The graph already has it.",
|
|
202
|
+
"- **`Confidence: medium`** \u2192 Read the listed `Files` directly via",
|
|
203
|
+
' `mcp__synthra__graph_read("file::symbol")` *before* trying Grep. The',
|
|
204
|
+
" graph has narrowed the search space \u2014 use it, don't bypass it.",
|
|
205
|
+
"- **`Confidence: low`** \u2192 You may use Grep / Glob, but the PreToolUse",
|
|
206
|
+
" hook may still block redundant calls.",
|
|
207
|
+
"",
|
|
208
|
+
"### Reading code",
|
|
209
|
+
"",
|
|
210
|
+
"- **Always use `file::symbol` notation** with `graph_read`. Whole-file",
|
|
211
|
+
" reads should be rare \u2014 only when you genuinely need the full file.",
|
|
212
|
+
"- If `graph_continue`'s `Files` list contains a `::` entry, pass it",
|
|
213
|
+
" verbatim to `graph_read`.",
|
|
214
|
+
"- **Large file?** Don't read it in successive line-range chunks \u2014 call",
|
|
215
|
+
" `mcp__synthra__graph_continue` or",
|
|
216
|
+
' `mcp__synthra__graph_read("file::symbol")` to pull the one symbol you',
|
|
217
|
+
" need. Chunked whole-file Reads are exactly the cost `graph_read`",
|
|
218
|
+
" exists to avoid.",
|
|
219
|
+
"",
|
|
220
|
+
"### Editing a file",
|
|
221
|
+
"",
|
|
222
|
+
"Claude Code's `Edit` tool (and `Write` when overwriting) only accepts a",
|
|
223
|
+
"file that was opened with the **`Read` tool** \u2014 a `graph_read` slice does",
|
|
224
|
+
'not count, and editing such a file fails with *"File has not been read',
|
|
225
|
+
'yet."* So before editing a file you only know through `graph_read`: take',
|
|
226
|
+
"the line range from its header (e.g. `\u2026::handler (L120-168)`), `Read` that",
|
|
227
|
+
"file with a matching `offset`/`limit`, then `Edit`. That satisfies the",
|
|
228
|
+
"gate while keeping the read small \u2014 don't whole-file `Read` unless the",
|
|
229
|
+
"edit spans most of the file.",
|
|
230
|
+
"",
|
|
231
|
+
"### Don'ts",
|
|
232
|
+
"",
|
|
233
|
+
"- Don't Grep / Glob before calling `graph_continue` when required \u2014 the",
|
|
234
|
+
" PreToolUse hook may block it.",
|
|
235
|
+
"- Don't call `graph_continue` more than once per turn.",
|
|
236
|
+
"- Don't read whole files when a symbol-level read would suffice.",
|
|
237
|
+
"",
|
|
238
|
+
"### Resuming a session",
|
|
239
|
+
"",
|
|
240
|
+
'At session start the primer may begin with a **"Since you were last here"**',
|
|
241
|
+
"digest \u2014 recent commits, files touched, open next-steps, and recent",
|
|
242
|
+
"decisions carried over from the previous session. **Trust it.** It is the",
|
|
243
|
+
"cheapest possible orientation: do NOT re-run `graph_continue` or Grep just",
|
|
244
|
+
'to rediscover "what were we doing / what changed" \u2014 that work is already',
|
|
245
|
+
"done. For the concrete next steps,",
|
|
246
|
+
'`mcp__synthra__context_recall({kind:"next"})` returns them verbatim. Only',
|
|
247
|
+
"reach for fresh retrieval when the task moves beyond what the digest",
|
|
248
|
+
"covers.",
|
|
249
|
+
"",
|
|
250
|
+
"### Session-end resume note",
|
|
251
|
+
"",
|
|
252
|
+
`When the user signals they're done (e.g. "bye", "wrap up", "done"),`,
|
|
253
|
+
"persist the resume state by calling `context_remember` once per bullet.",
|
|
254
|
+
"Synthra re-renders `.synthra/CONTEXT.md` from those entries at session",
|
|
255
|
+
"end \u2014 do **NOT** write to `CONTEXT.md` directly, it is a derived view",
|
|
256
|
+
"and direct edits are overwritten by the Stop hook.",
|
|
257
|
+
"",
|
|
258
|
+
"Use these `kind` values:",
|
|
259
|
+
"",
|
|
260
|
+
'- **`kind: "task"`** \u2014 what is being worked on right now (1 entry)',
|
|
261
|
+
'- **`kind: "decision"`** \u2014 non-obvious choices made this session (max 3)',
|
|
262
|
+
'- **`kind: "next"`** \u2014 concrete next steps (max 3)',
|
|
263
|
+
"",
|
|
264
|
+
'Tag entries with the relevant area (`tags: ["auth"]`) and the files',
|
|
265
|
+
'they touch (`files: ["src/auth.ts"]`) so later `context_recall` queries',
|
|
266
|
+
"can filter. Keep each `text` to 1\u20132 sentences.",
|
|
267
|
+
"",
|
|
268
|
+
"_This block is managed by Synthra. Edits inside the BEGIN/END markers",
|
|
269
|
+
"are overwritten on every `syn .` run._",
|
|
270
|
+
"",
|
|
271
|
+
POLICY_END
|
|
272
|
+
].join("\n");
|
|
273
|
+
}
|
|
274
|
+
function onboardingSkeleton(projectName) {
|
|
275
|
+
return [
|
|
276
|
+
`# ${projectName}`,
|
|
277
|
+
"",
|
|
278
|
+
"> Onboarding notes for AI coding agents. Synthra's graph already knows the",
|
|
279
|
+
"> code's *structure* (files, symbols, imports) \u2014 this file is for what the",
|
|
280
|
+
"> graph can't infer: how to run the project, its conventions, and the",
|
|
281
|
+
"> decisions behind them. Keep it lean and current; delete prompts you don't need.",
|
|
282
|
+
"",
|
|
283
|
+
"## Build & test",
|
|
284
|
+
"",
|
|
285
|
+
"- TODO: install deps / build",
|
|
286
|
+
"- TODO: run tests / lint / typecheck",
|
|
287
|
+
"- TODO: run the app locally",
|
|
288
|
+
"",
|
|
289
|
+
"## Conventions",
|
|
290
|
+
"",
|
|
291
|
+
"- TODO: code style, naming, file layout the agent should follow",
|
|
292
|
+
"",
|
|
293
|
+
"## Key decisions",
|
|
294
|
+
"",
|
|
295
|
+
'- TODO: non-obvious choices and *why* ("we use X not Y because \u2026")',
|
|
296
|
+
"",
|
|
297
|
+
"## Gotchas",
|
|
298
|
+
"",
|
|
299
|
+
`- TODO: traps, footguns, "don't touch X without Y"`,
|
|
300
|
+
"",
|
|
301
|
+
"_Tip: run `/init` in Claude Code to auto-draft the sections above, then trim",
|
|
302
|
+
"to the durable bits. Synthra manages its own block below \u2014 leave it._",
|
|
303
|
+
""
|
|
304
|
+
].join("\n");
|
|
305
|
+
}
|
|
306
|
+
async function patchClaudeMd(path, projectName) {
|
|
307
|
+
let existing;
|
|
308
|
+
try {
|
|
309
|
+
existing = await readFile(path, "utf8");
|
|
310
|
+
} catch {
|
|
311
|
+
existing = null;
|
|
312
|
+
}
|
|
313
|
+
const block = policyBlock();
|
|
314
|
+
if (existing === null) {
|
|
315
|
+
const name = projectName || basename(dirname(path)) || "this project";
|
|
316
|
+
await writeFile(path, onboardingSkeleton(name) + "\n" + block + "\n", "utf8");
|
|
317
|
+
return { created: true, updated: false, skipped: false };
|
|
318
|
+
}
|
|
319
|
+
const stripped = existing.replace(ANY_BLOCK_RE, "");
|
|
320
|
+
const base = stripped.replace(/\s+$/, "");
|
|
321
|
+
const desired = base.length ? `${base}
|
|
322
|
+
|
|
323
|
+
${block}
|
|
324
|
+
` : `${block}
|
|
325
|
+
`;
|
|
326
|
+
if (desired === existing) {
|
|
327
|
+
return { created: false, updated: false, skipped: true };
|
|
328
|
+
}
|
|
329
|
+
await writeFile(path, desired, "utf8");
|
|
330
|
+
return { created: false, updated: true, skipped: false };
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// src/shared/config.ts
|
|
334
|
+
function num(name, fallback) {
|
|
335
|
+
const v = process.env[name];
|
|
336
|
+
if (!v) return fallback;
|
|
337
|
+
const n = Number(v);
|
|
338
|
+
return Number.isFinite(n) ? n : fallback;
|
|
339
|
+
}
|
|
340
|
+
function str(name, fallback) {
|
|
341
|
+
return process.env[name] ?? fallback;
|
|
342
|
+
}
|
|
343
|
+
function loadConfig() {
|
|
344
|
+
return {
|
|
345
|
+
hardMaxReadChars: num("SYN_HARD_MAX_READ_CHARS", 4e3),
|
|
346
|
+
gateHintMaxChars: num("SYN_GATE_HINT_CHARS", 1200),
|
|
347
|
+
readDepsMaxChars: num("SYN_READ_DEPS_CHARS", 900),
|
|
348
|
+
turnReadBudgetChars: num("SYN_TURN_READ_BUDGET_CHARS", 18e3),
|
|
349
|
+
fallbackMaxCallsPerTurn: num("SYN_FALLBACK_MAX_CALLS_PER_TURN", 1),
|
|
350
|
+
retrieveCacheTtlSec: num("SYN_RETRIEVE_CACHE_TTL_SEC", 900),
|
|
351
|
+
// Auto-reindex: re-run the incremental scan + swap the in-memory graph this
|
|
352
|
+
// many ms after the last source-file change, so graph reads never go stale
|
|
353
|
+
// mid-session. Set SYN_NO_AUTOREINDEX to disable entirely.
|
|
354
|
+
reindexDebounceMs: num("SYN_REINDEX_DEBOUNCE_MS", 1e3),
|
|
355
|
+
autoReindex: !process.env.SYN_NO_AUTOREINDEX,
|
|
356
|
+
// Observe-only: log codebase-exploration Bash commands (grep/cat/find …) so
|
|
357
|
+
// the terminal bypass of the Moat can be measured. Never blocks. Opt out
|
|
358
|
+
// with SYN_NO_BASH_OBSERVE.
|
|
359
|
+
bashObserve: !process.env.SYN_NO_BASH_OBSERVE,
|
|
360
|
+
// The Dispatcher: per-prompt routing hints (best-fit agent/skill/model).
|
|
361
|
+
// Silent unless the top agent clears routeMinScore. SYN_NO_ROUTE disables.
|
|
362
|
+
route: !process.env.SYN_NO_ROUTE,
|
|
363
|
+
routeMinScore: num("SYN_ROUTE_MIN_SCORE", 3),
|
|
364
|
+
mcpPort: process.env.SYN_MCP_PORT ? num("SYN_MCP_PORT", 0) : null,
|
|
365
|
+
dashboardPort: num("SYN_DASHBOARD_PORT", 8901),
|
|
366
|
+
logLevel: str("SYN_LOG_LEVEL", "info"),
|
|
367
|
+
claudeBin: str("SYN_CLAUDE_BIN", "claude")
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
119
371
|
// src/shared/logger.ts
|
|
120
372
|
var LEVEL_PRIORITY = {
|
|
121
373
|
debug: 10,
|
|
@@ -140,6 +392,238 @@ var log = {
|
|
|
140
392
|
error: (m, ...a) => emit("error", m, ...a)
|
|
141
393
|
};
|
|
142
394
|
|
|
395
|
+
// src/shared/paths.ts
|
|
396
|
+
import { join } from "path";
|
|
397
|
+
function resolvePaths(projectRoot) {
|
|
398
|
+
const graphDir = join(projectRoot, ".synthra-graph");
|
|
399
|
+
const contextDir = join(projectRoot, ".synthra");
|
|
400
|
+
const claudeDir = join(projectRoot, ".claude");
|
|
401
|
+
return {
|
|
402
|
+
projectRoot,
|
|
403
|
+
graphDir,
|
|
404
|
+
contextDir,
|
|
405
|
+
infoGraph: join(graphDir, "info_graph.json"),
|
|
406
|
+
symbolIndex: join(graphDir, "symbol_index.json"),
|
|
407
|
+
sessionState: join(graphDir, "session.json"),
|
|
408
|
+
activityLog: join(graphDir, "activity.jsonl"),
|
|
409
|
+
tokenLog: join(graphDir, "token_log.jsonl"),
|
|
410
|
+
gateLog: join(graphDir, "gate_log.jsonl"),
|
|
411
|
+
bashLog: join(graphDir, "bash_log.jsonl"),
|
|
412
|
+
routeLog: join(graphDir, "route_log.jsonl"),
|
|
413
|
+
toolLog: join(graphDir, "tool_log.jsonl"),
|
|
414
|
+
accessLog: join(graphDir, "access_log.jsonl"),
|
|
415
|
+
learnStore: join(graphDir, "learn_store.json"),
|
|
416
|
+
parseCache: join(graphDir, "parse_cache.json"),
|
|
417
|
+
mcpPort: join(graphDir, "mcp_port"),
|
|
418
|
+
mcpServerLog: join(graphDir, "mcp_server.log"),
|
|
419
|
+
mcpServerErrLog: join(graphDir, "mcp_server.err.log"),
|
|
420
|
+
contextStore: join(contextDir, "context-store.json"),
|
|
421
|
+
contextMd: join(contextDir, "CONTEXT.md"),
|
|
422
|
+
branchesDir: join(contextDir, "branches"),
|
|
423
|
+
claudeDir,
|
|
424
|
+
claudeSettings: join(claudeDir, "settings.local.json"),
|
|
425
|
+
claudeHooksDir: join(claudeDir, "hooks"),
|
|
426
|
+
claudeMd: join(projectRoot, "CLAUDE.md"),
|
|
427
|
+
gitignore: join(projectRoot, ".gitignore")
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/cli/doctor-command.ts
|
|
432
|
+
var ICON = { ok: "\u2705", warn: "\u26A0\uFE0F", fail: "\u274C" };
|
|
433
|
+
function binWorks(bin, args) {
|
|
434
|
+
return new Promise((res) => {
|
|
435
|
+
let proc;
|
|
436
|
+
try {
|
|
437
|
+
proc = spawn(bin, args, { stdio: "ignore" });
|
|
438
|
+
} catch {
|
|
439
|
+
res(false);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
proc.on("error", () => res(false));
|
|
443
|
+
proc.on("exit", (code) => res(code === 0));
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
async function exists(path) {
|
|
447
|
+
try {
|
|
448
|
+
await stat(path);
|
|
449
|
+
return true;
|
|
450
|
+
} catch {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
async function runDoctorChecks(projectRoot) {
|
|
455
|
+
const paths = resolvePaths(projectRoot);
|
|
456
|
+
const cfg = loadConfig();
|
|
457
|
+
const checks = [];
|
|
458
|
+
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
459
|
+
checks.push(
|
|
460
|
+
nodeMajor >= 18 ? { status: "ok", label: "Node", detail: `v${process.versions.node}` } : {
|
|
461
|
+
status: "fail",
|
|
462
|
+
label: "Node",
|
|
463
|
+
detail: `v${process.versions.node} \u2014 Synthra needs Node >= 18`
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
const hasJq = await binWorks("jq", ["--version"]);
|
|
467
|
+
if (process.platform === "win32") {
|
|
468
|
+
checks.push({
|
|
469
|
+
status: "ok",
|
|
470
|
+
label: "jq",
|
|
471
|
+
detail: hasJq ? "present (not required \u2014 Windows uses .ps1 hooks)" : "not required on Windows (.ps1 hooks)"
|
|
472
|
+
});
|
|
473
|
+
} else {
|
|
474
|
+
checks.push(
|
|
475
|
+
hasJq ? { status: "ok", label: "jq", detail: "present" } : {
|
|
476
|
+
status: "warn",
|
|
477
|
+
label: "jq",
|
|
478
|
+
detail: "missing \u2014 Stop/PreToolUse bash hooks silently no-op (no token logging or gating). Install jq (brew/apt)."
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
const hasClaude = await binWorks(cfg.claudeBin, ["--version"]);
|
|
483
|
+
checks.push(
|
|
484
|
+
hasClaude ? { status: "ok", label: "claude CLI", detail: `'${cfg.claudeBin}' on PATH` } : {
|
|
485
|
+
status: "warn",
|
|
486
|
+
label: "claude CLI",
|
|
487
|
+
detail: `'${cfg.claudeBin}' not found \u2014 MCP registration + IDE need it (set SYN_CLAUDE_BIN to override).`
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
if (!await exists(paths.infoGraph)) {
|
|
491
|
+
checks.push({
|
|
492
|
+
status: "warn",
|
|
493
|
+
label: "Graph",
|
|
494
|
+
detail: "no info_graph.json \u2014 run `syn .` (or `syn scan`) here."
|
|
495
|
+
});
|
|
496
|
+
} else {
|
|
497
|
+
try {
|
|
498
|
+
const graph = JSON.parse(await readFile2(paths.infoGraph, "utf8"));
|
|
499
|
+
const parts = [`${graph.symbol_count} symbols`, `${graph.file_count} files`];
|
|
500
|
+
let status = "ok";
|
|
501
|
+
const ageMs = Date.now() - Date.parse(graph.generated_at);
|
|
502
|
+
if (Number.isFinite(ageMs))
|
|
503
|
+
parts.push(`scanned ${Math.max(0, Math.round(ageMs / 6e4))}m ago`);
|
|
504
|
+
if (graph.schema_version !== SCHEMA_VERSION) {
|
|
505
|
+
status = "warn";
|
|
506
|
+
parts.push(`schema v${graph.schema_version} \u2260 v${SCHEMA_VERSION} (auto-rescans on serve)`);
|
|
507
|
+
}
|
|
508
|
+
if (graph.symbol_count === 0) {
|
|
509
|
+
status = "warn";
|
|
510
|
+
parts.push("0 symbols \u2014 unsupported language or nothing indexed");
|
|
511
|
+
}
|
|
512
|
+
checks.push({ status, label: "Graph", detail: parts.join(" \xB7 ") });
|
|
513
|
+
} catch {
|
|
514
|
+
checks.push({
|
|
515
|
+
status: "warn",
|
|
516
|
+
label: "Graph",
|
|
517
|
+
detail: "info_graph.json unreadable \u2014 re-run `syn scan`."
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
checks.push(
|
|
522
|
+
await exists(join2(projectRoot, ".mcp.json")) ? {
|
|
523
|
+
status: "ok",
|
|
524
|
+
label: "MCP registration",
|
|
525
|
+
detail: ".mcp.json present (IDE can see graph_* tools)"
|
|
526
|
+
} : {
|
|
527
|
+
status: "warn",
|
|
528
|
+
label: "MCP registration",
|
|
529
|
+
detail: "no .mcp.json \u2014 the IDE extension won't see Synthra's tools; run `syn .`."
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
if (!await exists(paths.claudeMd)) {
|
|
533
|
+
checks.push({
|
|
534
|
+
status: "warn",
|
|
535
|
+
label: "CLAUDE.md policy",
|
|
536
|
+
detail: "no CLAUDE.md \u2014 run `syn .` to scaffold + inject the policy block."
|
|
537
|
+
});
|
|
538
|
+
} else {
|
|
539
|
+
const md = await readFile2(paths.claudeMd, "utf8");
|
|
540
|
+
if (md.includes(`synthra-policy v${POLICY_VERSION} BEGIN`)) {
|
|
541
|
+
checks.push({
|
|
542
|
+
status: "ok",
|
|
543
|
+
label: "CLAUDE.md policy",
|
|
544
|
+
detail: `policy block v${POLICY_VERSION}`
|
|
545
|
+
});
|
|
546
|
+
} else {
|
|
547
|
+
const m = md.match(/synthra-policy v(\d+) BEGIN/);
|
|
548
|
+
checks.push({
|
|
549
|
+
status: "warn",
|
|
550
|
+
label: "CLAUDE.md policy",
|
|
551
|
+
detail: m ? `policy block is v${m[1]}, current is v${POLICY_VERSION} \u2014 re-run \`syn .\` to refresh.` : "no synthra-policy block \u2014 run `syn .`."
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (!await exists(paths.claudeSettings)) {
|
|
556
|
+
checks.push({
|
|
557
|
+
status: "warn",
|
|
558
|
+
label: "Hooks",
|
|
559
|
+
detail: "no .claude/settings.local.json \u2014 run `syn .` to install hooks."
|
|
560
|
+
});
|
|
561
|
+
} else {
|
|
562
|
+
const s = await readFile2(paths.claudeSettings, "utf8");
|
|
563
|
+
checks.push(
|
|
564
|
+
s.includes("synthra-hook=true") ? { status: "ok", label: "Hooks", detail: "registered in .claude/settings.local.json" } : {
|
|
565
|
+
status: "warn",
|
|
566
|
+
label: "Hooks",
|
|
567
|
+
detail: "settings.local.json present but no Synthra hooks \u2014 run `syn .`."
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
return checks;
|
|
572
|
+
}
|
|
573
|
+
function redactHome(text, home = homedir()) {
|
|
574
|
+
if (!home) return text;
|
|
575
|
+
const variants = [home, home.replace(/\\/g, "/"), home.replace(/\//g, "\\")];
|
|
576
|
+
let out = text;
|
|
577
|
+
for (const v of new Set(variants)) {
|
|
578
|
+
out = out.split(v).join("~");
|
|
579
|
+
}
|
|
580
|
+
return out;
|
|
581
|
+
}
|
|
582
|
+
function buildDiagnosticReport(checks, info) {
|
|
583
|
+
const lines = [
|
|
584
|
+
"### Synthra diagnostic report",
|
|
585
|
+
"",
|
|
586
|
+
`- Synthra: v${info.version}`,
|
|
587
|
+
`- OS: ${info.platform} ${info.arch}`,
|
|
588
|
+
`- Node: v${info.node}`,
|
|
589
|
+
`- claude bin: ${redactHome(info.claudeBin)}`,
|
|
590
|
+
""
|
|
591
|
+
];
|
|
592
|
+
for (const c of checks) {
|
|
593
|
+
lines.push(`- ${ICON[c.status]} **${c.label}** \u2014 ${redactHome(c.detail)}`);
|
|
594
|
+
}
|
|
595
|
+
return lines.join("\n");
|
|
596
|
+
}
|
|
597
|
+
async function doctorCommand(rawPath, opts = {}) {
|
|
598
|
+
const projectRoot = resolve(rawPath);
|
|
599
|
+
const checks = await runDoctorChecks(projectRoot);
|
|
600
|
+
if (opts.report) {
|
|
601
|
+
console.log(
|
|
602
|
+
buildDiagnosticReport(checks, {
|
|
603
|
+
version: opts.version ?? "unknown",
|
|
604
|
+
platform: process.platform,
|
|
605
|
+
arch: process.arch,
|
|
606
|
+
node: process.versions.node,
|
|
607
|
+
claudeBin: loadConfig().claudeBin
|
|
608
|
+
})
|
|
609
|
+
);
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
log.info("");
|
|
613
|
+
log.info(` Synthra doctor \u2014 ${projectRoot}`);
|
|
614
|
+
log.info("");
|
|
615
|
+
for (const c of checks) {
|
|
616
|
+
log.info(` ${ICON[c.status]} ${c.label.padEnd(18)}${c.detail}`);
|
|
617
|
+
}
|
|
618
|
+
const warn = checks.filter((c) => c.status === "warn").length;
|
|
619
|
+
const fail = checks.filter((c) => c.status === "fail").length;
|
|
620
|
+
log.info("");
|
|
621
|
+
log.info(
|
|
622
|
+
fail === 0 && warn === 0 ? " All checks passed." : ` ${fail} failed \xB7 ${warn} warning(s).`
|
|
623
|
+
);
|
|
624
|
+
log.info("");
|
|
625
|
+
}
|
|
626
|
+
|
|
143
627
|
// src/server/port.ts
|
|
144
628
|
import { createServer } from "net";
|
|
145
629
|
var PORT_RANGE_START = 8080;
|
|
@@ -160,14 +644,14 @@ function isFree(port) {
|
|
|
160
644
|
}
|
|
161
645
|
|
|
162
646
|
// src/dashboard/arsenal.ts
|
|
163
|
-
import { readFile, readdir } from "fs/promises";
|
|
164
|
-
import { homedir } from "os";
|
|
165
|
-
import { basename, dirname, join } from "path";
|
|
647
|
+
import { readFile as readFile3, readdir } from "fs/promises";
|
|
648
|
+
import { homedir as homedir2 } from "os";
|
|
649
|
+
import { basename as basename2, dirname as dirname2, join as join3 } from "path";
|
|
166
650
|
var DESC_MAX = 300;
|
|
167
651
|
var TOOLS_MAX = 200;
|
|
168
652
|
async function readText(path) {
|
|
169
653
|
try {
|
|
170
|
-
return await
|
|
654
|
+
return await readFile3(path, "utf8");
|
|
171
655
|
} catch {
|
|
172
656
|
return null;
|
|
173
657
|
}
|
|
@@ -243,7 +727,7 @@ function agentItem(fm, fallbackName, scope, source) {
|
|
|
243
727
|
}
|
|
244
728
|
async function scanSkillsDir(dir, scope, source, out) {
|
|
245
729
|
for (const name of await listNames(dir)) {
|
|
246
|
-
const md = await readText(
|
|
730
|
+
const md = await readText(join3(dir, name, "SKILL.md"));
|
|
247
731
|
if (md === null) continue;
|
|
248
732
|
out.push(skillItem(parseFrontmatter(md), name, scope, source));
|
|
249
733
|
}
|
|
@@ -251,9 +735,9 @@ async function scanSkillsDir(dir, scope, source, out) {
|
|
|
251
735
|
async function scanAgentsDir(dir, scope, source, out) {
|
|
252
736
|
for (const file of await listNames(dir)) {
|
|
253
737
|
if (!file.endsWith(".md")) continue;
|
|
254
|
-
const md = await readText(
|
|
738
|
+
const md = await readText(join3(dir, file));
|
|
255
739
|
if (md === null) continue;
|
|
256
|
-
out.push(agentItem(parseFrontmatter(md),
|
|
740
|
+
out.push(agentItem(parseFrontmatter(md), basename2(file, ".md"), scope, source));
|
|
257
741
|
}
|
|
258
742
|
}
|
|
259
743
|
function mcpItemsFrom(json, scope, source) {
|
|
@@ -284,33 +768,33 @@ function sortItems(items) {
|
|
|
284
768
|
}
|
|
285
769
|
var cache = null;
|
|
286
770
|
var CACHE_TTL_MS = 15e3;
|
|
287
|
-
async function computeArsenal(projectRoot, homeDir =
|
|
771
|
+
async function computeArsenal(projectRoot, homeDir = homedir2()) {
|
|
288
772
|
const key = `${projectRoot}\0${homeDir}`;
|
|
289
773
|
const now = Date.now();
|
|
290
774
|
if (cache && cache.key === key && now - cache.at < CACHE_TTL_MS) return cache.data;
|
|
291
|
-
const homeClaude =
|
|
292
|
-
const projClaude =
|
|
775
|
+
const homeClaude = join3(homeDir, ".claude");
|
|
776
|
+
const projClaude = join3(projectRoot, ".claude");
|
|
293
777
|
const skills = [];
|
|
294
778
|
const agents = [];
|
|
295
779
|
const mcp = [];
|
|
296
|
-
await scanSkillsDir(
|
|
297
|
-
await scanSkillsDir(
|
|
298
|
-
await scanAgentsDir(
|
|
299
|
-
await scanAgentsDir(
|
|
300
|
-
mcp.push(...mcpItemsFrom(await readJson(
|
|
780
|
+
await scanSkillsDir(join3(projClaude, "skills"), "project", void 0, skills);
|
|
781
|
+
await scanSkillsDir(join3(homeClaude, "skills"), "personal", void 0, skills);
|
|
782
|
+
await scanAgentsDir(join3(projClaude, "agents"), "project", void 0, agents);
|
|
783
|
+
await scanAgentsDir(join3(homeClaude, "agents"), "personal", void 0, agents);
|
|
784
|
+
mcp.push(...mcpItemsFrom(await readJson(join3(projectRoot, ".mcp.json")), "project", void 0));
|
|
301
785
|
mcp.push(
|
|
302
786
|
...mcpItemsFrom(
|
|
303
|
-
(await readJson(
|
|
787
|
+
(await readJson(join3(homeDir, ".claude.json")))?.mcpServers,
|
|
304
788
|
"personal",
|
|
305
789
|
void 0
|
|
306
790
|
)
|
|
307
791
|
);
|
|
308
792
|
const installedRaw = await readJson(
|
|
309
|
-
|
|
793
|
+
join3(homeClaude, "plugins", "installed_plugins.json")
|
|
310
794
|
);
|
|
311
795
|
const pluginsMap = installedRaw?.plugins ?? installedRaw ?? {};
|
|
312
796
|
const settings = await readJson(
|
|
313
|
-
|
|
797
|
+
join3(homeClaude, "settings.json")
|
|
314
798
|
);
|
|
315
799
|
const enabledMap = settings?.enabledPlugins ?? {};
|
|
316
800
|
let pluginCount = 0;
|
|
@@ -322,35 +806,35 @@ async function computeArsenal(projectRoot, homeDir = homedir()) {
|
|
|
322
806
|
const enabled = enabledMap[pluginKey] !== false;
|
|
323
807
|
const root = entry.installPath;
|
|
324
808
|
const manifest = await readJson(
|
|
325
|
-
|
|
809
|
+
join3(root, ".claude-plugin", "plugin.json")
|
|
326
810
|
);
|
|
327
811
|
const agentFiles = /* @__PURE__ */ new Set();
|
|
328
|
-
for (const f of await listNames(
|
|
329
|
-
if (f.endsWith(".md")) agentFiles.add(
|
|
812
|
+
for (const f of await listNames(join3(root, "agents"))) {
|
|
813
|
+
if (f.endsWith(".md")) agentFiles.add(join3(root, "agents", f));
|
|
330
814
|
}
|
|
331
|
-
for (const rel of manifest?.agents ?? []) agentFiles.add(
|
|
815
|
+
for (const rel of manifest?.agents ?? []) agentFiles.add(join3(root, rel));
|
|
332
816
|
const pAgents = [];
|
|
333
817
|
for (const file of agentFiles) {
|
|
334
818
|
const md = await readText(file);
|
|
335
819
|
if (md !== null)
|
|
336
|
-
pAgents.push(agentItem(parseFrontmatter(md),
|
|
820
|
+
pAgents.push(agentItem(parseFrontmatter(md), basename2(file, ".md"), "plugin", pluginName));
|
|
337
821
|
}
|
|
338
822
|
const skillMds = /* @__PURE__ */ new Set();
|
|
339
|
-
for (const name of await listNames(
|
|
340
|
-
skillMds.add(
|
|
823
|
+
for (const name of await listNames(join3(root, "skills"))) {
|
|
824
|
+
skillMds.add(join3(root, "skills", name, "SKILL.md"));
|
|
341
825
|
}
|
|
342
826
|
for (const rel of manifest?.skills ?? []) {
|
|
343
|
-
skillMds.add(rel.endsWith(".md") ?
|
|
827
|
+
skillMds.add(rel.endsWith(".md") ? join3(root, rel) : join3(root, rel, "SKILL.md"));
|
|
344
828
|
}
|
|
345
829
|
const pSkills = [];
|
|
346
830
|
for (const md of skillMds) {
|
|
347
831
|
const text = await readText(md);
|
|
348
832
|
if (text !== null)
|
|
349
833
|
pSkills.push(
|
|
350
|
-
skillItem(parseFrontmatter(text),
|
|
834
|
+
skillItem(parseFrontmatter(text), basename2(dirname2(md)), "plugin", pluginName)
|
|
351
835
|
);
|
|
352
836
|
}
|
|
353
|
-
const pMcp = mcpItemsFrom(await readJson(
|
|
837
|
+
const pMcp = mcpItemsFrom(await readJson(join3(root, ".mcp.json")), "plugin", pluginName);
|
|
354
838
|
for (const it of [...pSkills, ...pAgents, ...pMcp]) it.enabled = enabled;
|
|
355
839
|
skills.push(...pSkills);
|
|
356
840
|
agents.push(...pAgents);
|
|
@@ -380,11 +864,11 @@ async function computeArsenal(projectRoot, homeDir = homedir()) {
|
|
|
380
864
|
}
|
|
381
865
|
|
|
382
866
|
// src/dashboard/delta.ts
|
|
383
|
-
import { readFile as
|
|
867
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
384
868
|
|
|
385
869
|
// src/learn/store.ts
|
|
386
|
-
import { appendFile, mkdir, readFile as
|
|
387
|
-
import { dirname as
|
|
870
|
+
import { appendFile, mkdir, readFile as readFile4, writeFile as writeFile2 } from "fs/promises";
|
|
871
|
+
import { dirname as dirname3 } from "path";
|
|
388
872
|
|
|
389
873
|
// src/learn/usage.ts
|
|
390
874
|
var LEARN_SCHEMA_VERSION = 1;
|
|
@@ -451,7 +935,7 @@ function recomputeFromLog(events) {
|
|
|
451
935
|
// src/learn/store.ts
|
|
452
936
|
async function readLearnStore(path) {
|
|
453
937
|
try {
|
|
454
|
-
const raw = await
|
|
938
|
+
const raw = await readFile4(path, "utf8");
|
|
455
939
|
const parsed = JSON.parse(raw);
|
|
456
940
|
if (parsed.schema_version !== LEARN_SCHEMA_VERSION || typeof parsed.files !== "object" || parsed.files === null) {
|
|
457
941
|
return emptyStore();
|
|
@@ -467,14 +951,14 @@ async function readLearnStore(path) {
|
|
|
467
951
|
}
|
|
468
952
|
async function writeLearnStore(path, store) {
|
|
469
953
|
try {
|
|
470
|
-
await mkdir(
|
|
471
|
-
await
|
|
954
|
+
await mkdir(dirname3(path), { recursive: true });
|
|
955
|
+
await writeFile2(path, JSON.stringify(store, null, 2) + "\n", "utf8");
|
|
472
956
|
} catch {
|
|
473
957
|
}
|
|
474
958
|
}
|
|
475
959
|
async function readAccessLog(path) {
|
|
476
960
|
try {
|
|
477
|
-
const raw = await
|
|
961
|
+
const raw = await readFile4(path, "utf8");
|
|
478
962
|
const out = [];
|
|
479
963
|
for (const line of raw.split("\n")) {
|
|
480
964
|
const t = line.trim();
|
|
@@ -493,47 +977,11 @@ async function readAccessLog(path) {
|
|
|
493
977
|
}
|
|
494
978
|
}
|
|
495
979
|
async function appendAccess(path, ev) {
|
|
496
|
-
try {
|
|
497
|
-
await mkdir(
|
|
498
|
-
await appendFile(path, JSON.stringify(ev) + "\n", "utf8");
|
|
499
|
-
} catch {
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// src/shared/paths.ts
|
|
504
|
-
import { join as join2 } from "path";
|
|
505
|
-
function resolvePaths(projectRoot) {
|
|
506
|
-
const graphDir = join2(projectRoot, ".synthra-graph");
|
|
507
|
-
const contextDir = join2(projectRoot, ".synthra");
|
|
508
|
-
const claudeDir = join2(projectRoot, ".claude");
|
|
509
|
-
return {
|
|
510
|
-
projectRoot,
|
|
511
|
-
graphDir,
|
|
512
|
-
contextDir,
|
|
513
|
-
infoGraph: join2(graphDir, "info_graph.json"),
|
|
514
|
-
symbolIndex: join2(graphDir, "symbol_index.json"),
|
|
515
|
-
sessionState: join2(graphDir, "session.json"),
|
|
516
|
-
activityLog: join2(graphDir, "activity.jsonl"),
|
|
517
|
-
tokenLog: join2(graphDir, "token_log.jsonl"),
|
|
518
|
-
gateLog: join2(graphDir, "gate_log.jsonl"),
|
|
519
|
-
bashLog: join2(graphDir, "bash_log.jsonl"),
|
|
520
|
-
routeLog: join2(graphDir, "route_log.jsonl"),
|
|
521
|
-
toolLog: join2(graphDir, "tool_log.jsonl"),
|
|
522
|
-
accessLog: join2(graphDir, "access_log.jsonl"),
|
|
523
|
-
learnStore: join2(graphDir, "learn_store.json"),
|
|
524
|
-
parseCache: join2(graphDir, "parse_cache.json"),
|
|
525
|
-
mcpPort: join2(graphDir, "mcp_port"),
|
|
526
|
-
mcpServerLog: join2(graphDir, "mcp_server.log"),
|
|
527
|
-
mcpServerErrLog: join2(graphDir, "mcp_server.err.log"),
|
|
528
|
-
contextStore: join2(contextDir, "context-store.json"),
|
|
529
|
-
contextMd: join2(contextDir, "CONTEXT.md"),
|
|
530
|
-
branchesDir: join2(contextDir, "branches"),
|
|
531
|
-
claudeDir,
|
|
532
|
-
claudeSettings: join2(claudeDir, "settings.local.json"),
|
|
533
|
-
claudeHooksDir: join2(claudeDir, "hooks"),
|
|
534
|
-
claudeMd: join2(projectRoot, "CLAUDE.md"),
|
|
535
|
-
gitignore: join2(projectRoot, ".gitignore")
|
|
536
|
-
};
|
|
980
|
+
try {
|
|
981
|
+
await mkdir(dirname3(path), { recursive: true });
|
|
982
|
+
await appendFile(path, JSON.stringify(ev) + "\n", "utf8");
|
|
983
|
+
} catch {
|
|
984
|
+
}
|
|
537
985
|
}
|
|
538
986
|
|
|
539
987
|
// src/shared/pricing.ts
|
|
@@ -568,25 +1016,25 @@ function estimateCostUsd(usage) {
|
|
|
568
1016
|
}
|
|
569
1017
|
|
|
570
1018
|
// src/shared/project-registry.ts
|
|
571
|
-
import { mkdir as mkdir2, readFile as
|
|
572
|
-
import { homedir as
|
|
573
|
-
import { basename as
|
|
574
|
-
var REGISTRY_DIR =
|
|
575
|
-
var REGISTRY_PATH =
|
|
576
|
-
var
|
|
1019
|
+
import { mkdir as mkdir2, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
|
|
1020
|
+
import { homedir as homedir3 } from "os";
|
|
1021
|
+
import { basename as basename3, dirname as dirname4, join as join4 } from "path";
|
|
1022
|
+
var REGISTRY_DIR = join4(homedir3(), ".synthra");
|
|
1023
|
+
var REGISTRY_PATH = join4(REGISTRY_DIR, "projects.json");
|
|
1024
|
+
var SCHEMA_VERSION2 = 1;
|
|
577
1025
|
async function readRegistry() {
|
|
578
1026
|
try {
|
|
579
|
-
const raw = await
|
|
1027
|
+
const raw = await readFile5(REGISTRY_PATH, "utf8");
|
|
580
1028
|
const parsed = JSON.parse(raw);
|
|
581
|
-
if (!Array.isArray(parsed.projects)) return { schema_version:
|
|
582
|
-
return { schema_version: parsed.schema_version ??
|
|
1029
|
+
if (!Array.isArray(parsed.projects)) return { schema_version: SCHEMA_VERSION2, projects: [] };
|
|
1030
|
+
return { schema_version: parsed.schema_version ?? SCHEMA_VERSION2, projects: parsed.projects };
|
|
583
1031
|
} catch {
|
|
584
|
-
return { schema_version:
|
|
1032
|
+
return { schema_version: SCHEMA_VERSION2, projects: [] };
|
|
585
1033
|
}
|
|
586
1034
|
}
|
|
587
1035
|
async function writeRegistry(registry) {
|
|
588
|
-
await mkdir2(
|
|
589
|
-
await
|
|
1036
|
+
await mkdir2(dirname4(REGISTRY_PATH), { recursive: true });
|
|
1037
|
+
await writeFile3(REGISTRY_PATH, JSON.stringify(registry, null, 2) + "\n", "utf8");
|
|
590
1038
|
}
|
|
591
1039
|
async function recordProject(projectRoot) {
|
|
592
1040
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -594,11 +1042,11 @@ async function recordProject(projectRoot) {
|
|
|
594
1042
|
const existing = registry.projects.find((p) => p.path === projectRoot);
|
|
595
1043
|
if (existing) {
|
|
596
1044
|
existing.last_seen = now;
|
|
597
|
-
existing.name =
|
|
1045
|
+
existing.name = basename3(projectRoot);
|
|
598
1046
|
} else {
|
|
599
1047
|
registry.projects.push({
|
|
600
1048
|
path: projectRoot,
|
|
601
|
-
name:
|
|
1049
|
+
name: basename3(projectRoot),
|
|
602
1050
|
first_seen: now,
|
|
603
1051
|
last_seen: now
|
|
604
1052
|
});
|
|
@@ -610,16 +1058,16 @@ async function recordProject(projectRoot) {
|
|
|
610
1058
|
}
|
|
611
1059
|
async function forgetProject(projectRoot, registryPath = REGISTRY_PATH) {
|
|
612
1060
|
try {
|
|
613
|
-
const raw = await
|
|
1061
|
+
const raw = await readFile5(registryPath, "utf8");
|
|
614
1062
|
const parsed = JSON.parse(raw);
|
|
615
1063
|
const projects = Array.isArray(parsed.projects) ? parsed.projects : [];
|
|
616
1064
|
const filtered = projects.filter((p) => p.path !== projectRoot);
|
|
617
1065
|
if (filtered.length === projects.length) return false;
|
|
618
1066
|
const next = {
|
|
619
|
-
schema_version: parsed.schema_version ??
|
|
1067
|
+
schema_version: parsed.schema_version ?? SCHEMA_VERSION2,
|
|
620
1068
|
projects: filtered
|
|
621
1069
|
};
|
|
622
|
-
await
|
|
1070
|
+
await writeFile3(registryPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
623
1071
|
return true;
|
|
624
1072
|
} catch {
|
|
625
1073
|
return false;
|
|
@@ -645,7 +1093,7 @@ function topHotFiles(store, nowMs, limit = 8) {
|
|
|
645
1093
|
}
|
|
646
1094
|
async function readJsonl(path) {
|
|
647
1095
|
try {
|
|
648
|
-
const text = await
|
|
1096
|
+
const text = await readFile6(path, "utf8");
|
|
649
1097
|
return text.split(/\r?\n/).filter((l) => l.length > 0).map((l) => {
|
|
650
1098
|
try {
|
|
651
1099
|
return JSON.parse(l);
|
|
@@ -657,7 +1105,7 @@ async function readJsonl(path) {
|
|
|
657
1105
|
return [];
|
|
658
1106
|
}
|
|
659
1107
|
}
|
|
660
|
-
function
|
|
1108
|
+
function basename4(p) {
|
|
661
1109
|
const parts = p.split(/[\\/]/);
|
|
662
1110
|
return parts[parts.length - 1] || p;
|
|
663
1111
|
}
|
|
@@ -758,7 +1206,7 @@ function dedupeTokens(entries) {
|
|
|
758
1206
|
async function computeDashboardData(activePaths, recentN = 500) {
|
|
759
1207
|
const registered = await listProjects();
|
|
760
1208
|
const activePath = activePaths.projectRoot;
|
|
761
|
-
const activeName =
|
|
1209
|
+
const activeName = basename4(activePath);
|
|
762
1210
|
const knownPaths = new Set(registered.map((p) => p.path));
|
|
763
1211
|
const allEntries = [
|
|
764
1212
|
...registered.map((p) => ({ path: p.path, name: p.name, last_seen: p.last_seen }))
|
|
@@ -878,7 +1326,7 @@ async function computeDashboardData(activePaths, recentN = 500) {
|
|
|
878
1326
|
}
|
|
879
1327
|
|
|
880
1328
|
// src/dashboard/built/index.html
|
|
881
|
-
var built_default = '<!doctype html>\n<html lang="en" class="dark">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Synthra \xB7 Dashboard</title>\n <link rel="icon" href="/favicon.svg" type="image/svg+xml" />\n <link rel="preconnect" href="https://fonts.googleapis.com" />\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />\n <link\n href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap"\n rel="stylesheet"\n />\n <script type="module" crossorigin>(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){for(var t=0;t<e.length;t++)e[t]()}function m(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function h(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var g=1<<24,_=1024,v=2048,y=4096,b=8192,ee=16384,x=32768,te=1<<25,ne=65536,re=1<<19,ie=1<<20,ae=1<<25,oe=65536,se=1<<21,ce=1<<22,le=1<<23,ue=Symbol(`$state`),de=Symbol(`legacy props`),fe=Symbol(``),pe=Symbol(`attributes`),me=Symbol(`class`),he=Symbol(`style`),ge=Symbol(`text`),_e=Symbol(`form reset`),ve=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ye=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function be(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function xe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Se(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ce(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function we(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Te(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ee(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function De(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Oe(){throw Error(`https://svelte.dev/e/set_context_after_init`)}function ke(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ae(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function je(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Me(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ne={},S=Symbol(`uninitialized`),Pe=`http://www.w3.org/1999/xhtml`,Fe=`http://www.w3.org/2000/svg`,Ie=`@attach`;function Le(){console.warn(`https://svelte.dev/e/derived_inert`)}function Re(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ze(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Be(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var C=!1;function Ve(e){C=e}var w;function He(e){if(e===null)throw Re(),Ne;return w=e}function Ue(){return He(wn(w))}function T(e){if(C){if(wn(w)!==null)throw Re(),Ne;w=e}}function We(e=1){if(C){for(var t=e,n=w;t--;)n=wn(n);w=n}}function Ge(e=!0){for(var t=0,n=w;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=wn(n);e&&n.remove(),n=i}}function Ke(e){if(!e||e.nodeType!==8)throw Re(),Ne;return e.data}function qe(e){return e===this.v}function Je(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ye(e){return!Je(e,this.v)}var Xe=!1,Ze=!1;function Qe(){Ze=!0}var E=null;function $e(e){E=e}function et(e){return at(`getContext`).get(e)}function tt(e,t){let n=at(`setContext`);if(Xe){var r=B.f;!z&&r&32&&!E.i||Oe()}return n.set(e,t),t}function nt(e){return at(`hasContext`).has(e)}function rt(){return at(`getAllContexts`)}function D(e,t=!1,n){E={p:E,i:!1,c:null,e:null,s:e,x:null,r:B,l:Ze&&!t?{s:null,u:null,$:[]}:null}}function O(e){var t=E,n=t.e;if(n!==null){t.e=null;for(var r of n)Bn(r)}return e!==void 0&&(t.x=e),t.i=!0,E=t.p,e??{}}function it(){return!Ze||E!==null&&E.l===null}function at(e){return E===null&&be(e),E.c??=new Map(ot(E)||void 0)}function ot(e){let t=e.p;for(;t!==null;){let e=t.c;if(e!==null)return e;t=t.p}return null}var st=[];function ct(){var e=st;st=[],p(e)}function lt(e){if(st.length===0&&!Ht){var t=st;queueMicrotask(()=>{t===st&&ct()})}st.push(e)}function ut(){for(;st.length>0;)ct()}function dt(e){var t=B;if(t===null)return z.f|=le,e;if(!(t.f&32768)&&!(t.f&4))throw e;ft(e,t)}function ft(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}var pt=~(v|y|_);function k(e,t){e.f=e.f&pt|t}function mt(e){e.f&512||e.deps===null?k(e,_):k(e,y)}function ht(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=oe,ht(t.deps))}function gt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ht(e.deps),k(e,_)}var _t=!1,vt=!1;function yt(e){var t=vt;try{return vt=!1,[e(),vt]}finally{vt=t}}function bt(e){let t=0,n=cn(0),r;return()=>{Ln()&&(V(n),Kn(()=>(t===0&&(r=Nr(()=>e(()=>fn(n)))),t+=1,()=>{lt(()=>{--t,t===0&&(r?.(),r=void 0,fn(n))})})))}}var xt=ne|re;function St(e,t,n,r){new Ct(e,t,n,r)}var Ct=class{parent;is_pending=!1;transform_error;#e;#t=C?w:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=bt(()=>(this.#m=cn(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=B;t.b=this,t.f|=128,n(e)},this.parent=B.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=qn(()=>{if(C){let e=this.#t;Ue();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},xt),C&&(this.#e=w)}#g(){try{this.#a=Yn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Yn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Yn(()=>e(this.#e)),lt(()=>{var e=this.#c=document.createDocumentFragment(),t=Sn();e.append(t),this.#a=this.#x(()=>Yn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,tr(this.#o,()=>{this.#o=null}),this.#b(j))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Yn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ar(this.#a,e);let t=this.#n.pending;this.#o=Yn(()=>t(this.#e))}else this.#b(j)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){gt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=B,n=z,r=E;fr(this.#i),dr(this.#i),$e(this.#i.ctx);try{return Jt.ensure(),e()}catch(e){return dt(e),null}finally{fr(t),dr(n),$e(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&tr(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,lt(()=>{this.#d=!1,this.#m&&un(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),V(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;j?.is_fork?(this.#a&&j.skip_effect(this.#a),this.#o&&j.skip_effect(this.#o),this.#s&&j.skip_effect(this.#s),j.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(R(this.#a),null),this.#o&&=(R(this.#o),null),this.#s&&=(R(this.#s),null),C&&(He(this.#t),We(),He(Ge()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){Be();return}r=!0,i&&Me(),this.#s!==null&&tr(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){ft(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Yn(()=>{var t=B;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return ft(e,this.#i.parent),null}}))};lt(()=>{var t;try{t=this.transform_error(e)}catch(e){ft(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ft(e,this.#i&&this.#i.parent)):o(t)})}};function wt(e,t,n,r){let i=it()?Ot:jt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=B,c=Tt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){ft(e,s)}Et()}}var d=Dt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>At(e))).then(u).catch(e=>ft(e,s)).finally(d)}l?l.then(()=>{c(),f(),Et()}):f()}function Tt(){var e=B,t=z,n=E,r=j;return function(i=!0){fr(e),dr(t),$e(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Et(e=!0){fr(null),dr(null),$e(null),e&&j?.deactivate()}function Dt(){var e=B,t=e.b,n=j,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Ot(e){var t=2|v;return B!==null&&(B.f|=re),{ctx:E,deps:null,effects:null,equals:qe,f:t,fn:e,reactions:null,rv:0,v:S,wv:0,parent:B,ac:null}}var kt=Symbol(`obsolete`);function At(e,t,n){let r=B;r===null&&xe();var i=void 0,a=cn(S),o=!z,s=new Set;return Gn(()=>{var t=B,n=m();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ve&&n.reject(e)}).finally(Et)}catch(e){n.reject(e),Et()}var c=j;if(o){if(t.f&32768)var l=Dt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(kt);else for(let e of s.values())e.reject(kt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==kt&&(c.activate(),t?(a.f|=le,un(a,t)):(a.f&8388608&&(a.f^=le),un(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Rn(()=>{for(let e of s)e.reject(kt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function A(e){let t=Ot(e);return Xe||mr(t),t}function jt(e){let t=Ot(e);return t.equals=Ye,t}function Mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)R(t[n])}}function Nt(e){var t,n=B,r=e.parent;if(!cr&&r!==null&&e.v!==S&&r.f&24576)return Le(),e.v;fr(r);try{e.f&=~oe,Mt(e),t=Er(e)}finally{fr(n)}return t}function Pt(e){var t=Nt(e);if(!e.equals(t)&&(e.wv=Cr(),(!j?.is_fork||e.deps===null)&&(j===null?e.v=t:(j.capture(e,t,!0),zt?.capture(e,t,!0)),e.deps===null))){k(e,_);return}cr||(Bt===null?mt(e):(Ln()||j?.is_fork)&&Bt.set(e,t))}function Ft(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ve),t.fn!==null&&(t.teardown=f),t.ac=null,Or(t,0),Zn(t))}function It(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&kr(t)}var Lt=null,Rt=null,j=null,zt=null,Bt=null,Vt=null,Ht=!1,Ut=!1,Wt=null,Gt=null,Kt=0,qt=1,Jt=class e{id=qt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){Rt===null?Lt=Rt=this:(Rt.#n=this,this.#t=Rt),Rt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)k(r,v),t(r);for(r of n.m)k(r,y),t(r)}this.#p.add(e)}#g(){this.#e=!0,Kt++>1e3&&(this.#S(),Xt());for(let e of this.#u)this.#d.delete(e),k(e,v),this.schedule(e);for(let e of this.#d)k(e,y),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Wt=[],r=[],i=Gt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw rn(e),this.#h()||this.discard(),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Wt=null,Gt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)nn(e,t);i.length>0&&j.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),zt=this,Qt(r),Qt(n),zt=null,this.#s?.resolve();var s=j;if(this.#a===0&&(this.#c.length===0||s!==null)&&(this.#S(),Xe&&(this.#x(),j=s)),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=_;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=_:i&4?t.push(r):Xe&&i&16777224?n.push(r):wr(r)&&(i&16&&this.#d.add(r),kr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),k(i,v),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),j=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)gt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==S&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),Bt?.set(e,t)),this.is_fork||(e.v=t)}activate(){j=this}deactivate(){j=null,Bt=null}flush(){try{Ut=!0,j=this,this.#g()}finally{Kt=0,Vt=null,Wt=null,Gt=null,Ut=!1,j=null,Bt=null,on.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(kt);this.#S(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}#x(){for(let u=Lt;u!==null;u=u.#n){var e=u.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(u.current.has(r)){var n=u.current.get(r)[0];if(e&&i!==n)u.current.set(r,[i,a]);else continue}t.push(r)}if(e)for(let[e,t]of this.async_deriveds){let n=u.async_deriveds.get(e);n&&t.promise.then(n.resolve).catch(n.reject)}var r=[...u.current.keys()].filter(e=>!u.current.get(e)[1]);if(!(!u.#e||r.length===0)){var i=r.filter(e=>!this.current.has(e));if(i.length===0)e&&u.discard();else if(t.length>0){if(e)for(let e of this.#p)u.unskip_effect(e,e=>{e.f&4194320?u.schedule(e):u.#b([e])});u.activate();var a=new Set,o=new Map;for(var s of t)$t(s,i,a,o);o=new Map;var c=[...u.current].filter(([e,t])=>{let n=this.current.get(e);return n?n[0]!==t[0]||n[1]!==t[1]:!0}).map(([e])=>e);if(c.length>0)for(let e of this.#l)!(e.f&155648)&&en(e,c,o)&&(e.f&4194320?(k(e,v),u.schedule(e)):u.#u.add(e));if(u.#c.length>0&&!u.#m){u.apply();for(var l of u.#c)u.#_(l,[],[]);u.#c=[]}u.deactivate()}}}}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,lt(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=m()).promise}static ensure(){if(j===null){let t=j=new e;!Ut&&!Ht&<(()=>{t.#e||t.flush()})}return j}apply(){if(!Xe||!this.is_fork&&this.#t===null&&this.#n===null){Bt=null;return}Bt=new Map;for(let[e,[t]]of this.current)Bt.set(e,t);for(let t=Lt;t!==null;t=t.#n)if(!(t===this||t.is_fork)){var e=!1;if(t.id<this.id){for(let[n,[,r]]of t.current)if(!r&&this.current.has(n)){e=!0;break}}if(!e)for(let[e,n]of t.previous)Bt.has(e)||Bt.set(e,n)}}schedule(e){if(Vt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Wt!==null&&t===B&&(Xe||(z===null||!(z.f&2))&&!_t))return;if(n&96){if(!(n&1024))return;t.f^=_}}this.#c.push(t)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null?Lt=t:e.#n=t,t===null?Rt=e:t.#t=e,this.linked=!1}}};function Yt(e){var t=Ht;Ht=!0;try{var n;for(e&&(j!==null&&!j.is_fork&&j.flush(),n=e());;){if(ut(),j===null)return n;j.flush()}}finally{Ht=t}}function Xt(){try{Ee()}catch(e){ft(e,Vt)}}var Zt=null;function Qt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&wr(r)&&(Zt=new Set,kr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&er(r),Zt?.size>0)){on.clear();for(let e of Zt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Zt.has(n)&&(Zt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||kr(n)}}Zt.clear()}}Zt=null}}function $t(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?$t(i,t,n,r):e&4194320&&!(e&2048)&&en(i,t,r)&&(k(i,v),tn(i))}}function en(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&en(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function tn(e){j.schedule(e)}function nn(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),k(e,_);for(var n=e.first;n!==null;)nn(n,t),n=n.next}}function rn(e){k(e,_);for(var t=e.first;t!==null;)rn(t),t=t.next}var an=new Set,on=new Map,sn=!1;function cn(e,t){return{f:0,v:e,reactions:null,equals:qe,rv:0,wv:0}}function M(e,t){let n=cn(e,t);return mr(n),n}function ln(e,t=!1,n=!0){let r=cn(e);return t||(r.equals=Ye),Ze&&n&&E!==null&&E.l!==null&&(E.l.s??=[]).push(r),r}function N(e,t,n=!1){return z!==null&&(!ur||z.f&131072)&&it()&&z.f&4325394&&(pr===null||!pr.has(e))&&je(),un(e,n?mn(t):t,Gt)}function un(e,t,n=null){if(!e.equals(t)){on.set(e,cr?t:e.v);var r=Jt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Nt(t),Bt===null&&mt(t)}e.wv=Cr(),pn(e,v,n),it()&&B!==null&&B.f&1024&&!(B.f&96)&&(_r===null?vr([e]):_r.push(e)),!r.is_fork&&an.size>0&&!sn&&dn()}return t}function dn(){sn=!1;for(let e of an){e.f&1024&&k(e,y);let t;try{t=wr(e)}catch{t=!0}t&&kr(e)}an.clear()}function fn(e){N(e,e.v+1)}function pn(e,t,n){var r=e.reactions;if(r!==null)for(var i=it(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===B)){var l=(c&v)===0;if(l&&k(s,t),c&131072)an.add(s);else if(c&2){var u=s;Bt?.delete(u),c&65536||(c&512&&(B===null||!(B.f&2097152))&&(s.f|=oe),pn(u,y,n))}else if(l){var d=s;c&16&&Zt!==null&&Zt.add(d),n===null?tn(d):n.push(d)}}}}function mn(t){if(typeof t!=`object`||!t||ue in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=M(0),u=null,d=xr,f=e=>{if(xr===d)return e();var t=z,n=xr;dr(null),Sr(d);var r=e();return dr(t),Sr(n),r};return i&&r.set(`length`,M(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&ke();var i=r.get(t);return i===void 0?f(()=>{var e=M(n.value,u);return r.set(t,e),e}):N(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>M(S,u));r.set(t,e),fn(o)}}else N(n,S),fn(o);return!0},get(e,n,i){if(n===ue)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>M(mn(s?e[n]:S),u)),r.set(n,o)),o!==void 0){var c=V(o);return c===S?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=V(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==S)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ue)return!0;var n=r.get(t),i=n!==void 0&&n.v!==S||Reflect.has(e,t);return(n!==void 0||B!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>M(i?mn(e[t]):S,u)),r.set(t,n)),V(n)===S)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>M(S,u)),r.set(d+``,p)):N(p,S)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>M(void 0,u)),N(c,mn(n)),r.set(t,c));else{l=c.v!==S;var m=f(()=>mn(n));N(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&N(g,_+1)}fn(o)}return!0},ownKeys(e){V(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==S});for(var[n,i]of r)i.v!==S&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ae()}})}function hn(e){try{if(typeof e==`object`&&e&&ue in e)return e[ue]}catch{}return e}function gn(e,t){return Object.is(hn(e),hn(t))}new Set([`copyWithin`,`fill`,`pop`,`push`,`reverse`,`shift`,`sort`,`splice`,`unshift`]);var _n,vn,yn,bn;function xn(){if(_n===void 0){_n=window,vn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;yn=a(t,`firstChild`).get,bn=a(t,`nextSibling`).get,u(e)&&(e[me]=void 0,e[pe]=null,e[he]=void 0,e.__e=void 0),u(n)&&(n[ge]=void 0)}}function Sn(e=``){return document.createTextNode(e)}function Cn(e){return yn.call(e)}function wn(e){return bn.call(e)}function P(e,t){if(!C)return Cn(e);var n=Cn(w);if(n===null)n=w.appendChild(Sn());else if(t&&n.nodeType!==3){var r=Sn();return n?.before(r),He(r),r}return t&&On(n),He(n),n}function F(e,t=!1){if(!C){var n=Cn(e);return n instanceof Comment&&n.data===``?wn(n):n}if(t){if(w?.nodeType!==3){var r=Sn();return w?.before(r),He(r),r}On(w)}return w}function I(e,t=1,n=!1){let r=C?w:e;for(var i;t--;)i=r,r=wn(r);if(!C)return r;if(n){if(r?.nodeType!==3){var a=Sn();return r===null?i?.after(a):r.before(a),He(a),a}On(r)}return He(r),r}function Tn(e){e.textContent=``}function En(){return!Xe||Zt!==null?!1:(B.f&x)!==0}function Dn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function On(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function kn(e,t){if(t){let t=document.body;e.autofocus=!0,lt(()=>{document.activeElement===t&&e.focus()})}}var An=!1;function jn(){An||(An=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[_e]?.()})},{capture:!0}))}function Mn(e){var t=z,n=B;dr(null),fr(null);try{return e()}finally{dr(t),fr(n)}}function Nn(e,t,n,r=n){e.addEventListener(t,()=>Mn(n));let i=e[_e];i?e[_e]=()=>{i(),r(!0)}:e[_e]=()=>r(!0),jn()}function Pn(e){B===null&&(z===null&&Te(e),we()),cr&&Ce(e)}function Fn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function In(e,t){var n=B;n!==null&&n.f&8192&&(e|=b);var r={ctx:E,deps:null,nodes:null,f:e|v|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};j?.register_created_effect(r);var i=r;if(e&4)Wt===null?Jt.ensure().schedule(r):Wt.push(r);else if(t!==null){try{kr(r)}catch(e){throw R(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ne))}if(i!==null&&(i.parent=n,n!==null&&Fn(i,n),z!==null&&z.f&2&&!(e&64))){var a=z;(a.effects??=[]).push(i)}return r}function Ln(){return z!==null&&!ur}function Rn(e){let t=In(8,null);return k(t,_),t.teardown=e,t}function zn(e){Pn(`$effect`);var t=B.f;if(!z&&t&32&&E!==null&&!E.i){var n=E;(n.e??=[]).push(e)}else return Bn(e)}function Bn(e){return In(4|ie,e)}function Vn(e){return Pn(`$effect.pre`),In(8|ie,e)}function Hn(e){Jt.ensure();let t=In(64|re,e);return()=>{R(t)}}function Un(e){Jt.ensure();let t=In(64|re,e);return(e={})=>new Promise(n=>{e.outro?tr(t,()=>{R(t),n(void 0)}):(R(t),n(void 0))})}function Wn(e){return In(4,e)}function Gn(e){return In(ce|re,e)}function Kn(e,t=0){return In(8|t,e)}function L(e,t=[],n=[],r=[]){wt(r,t,n,t=>{In(8,()=>{e(...t.map(V))})})}function qn(e,t=0){return In(16|t,e)}function Jn(e,t=0){return In(g|t,e)}function Yn(e){return In(32|re,e)}function Xn(e){var t=e.teardown;if(t!==null){let e=cr,n=z;lr(!0),dr(null);try{t.call(null)}finally{lr(e),dr(n)}}}function Zn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Mn(()=>{e.abort(ve)});var r=n.next;n.f&64?n.parent=null:R(n,t),n=r}}function Qn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||R(t),t=n}}function R(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&($n(e.nodes.start,e.nodes.end),n=!0),e.f|=te,Zn(e,t&&!n),Or(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Xn(e),e.f^=te,e.f|=ee;var i=e.parent;i!==null&&i.first!==null&&er(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function $n(e,t){for(;e!==null;){var n=e===t?null:wn(e);e.remove(),e=n}}function er(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function tr(e,t,n=!0){var r=[];nr(e,r,!0);var i=()=>{n&&R(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function nr(e,t,n){if(!(e.f&8192)){e.f^=b;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;nr(i,t,o?n:!1)}i=a}}}function rr(e){ir(e,!0)}function ir(e,t){if(e.f&8192){e.f^=b,e.f&1024||(k(e,v),Jt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;ir(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function ar(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:wn(n);t.append(n),n=i}}var or=null,sr=!1,cr=!1;function lr(e){cr=e}var z=null,ur=!1;function dr(e){z=e}var B=null;function fr(e){B=e}var pr=null;function mr(e){z!==null&&(!Xe||z.f&2)&&(pr??=new Set).add(e)}var hr=null,gr=0,_r=null;function vr(e){_r=e}var yr=1,br=0,xr=br;function Sr(e){xr=e}function Cr(){return++yr}function wr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~oe),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(wr(a)&&Pt(a),a.wv>e.wv)return!0}t&512&&Bt===null&&k(e,_)}return!1}function Tr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Xe&&pr!==null&&pr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Tr(a,t,!1):t===a&&(n?k(a,v):a.f&1024&&k(a,y),tn(a))}}function Er(e){var t=hr,n=gr,r=_r,i=z,a=pr,o=E,s=ur,c=xr,l=e.f;hr=null,gr=0,_r=null,z=l&96?null:e,pr=null,$e(e.ctx),ur=!1,xr=++br,e.ac!==null&&(Mn(()=>{e.ac.abort(ve)}),e.ac=null);try{e.f|=se;var u=e.fn,d=u();e.f|=x;var f=e.deps,p=j?.is_fork;if(hr!==null){var m;if(p||Or(e,gr),f!==null&&gr>0)for(f.length=gr+hr.length,m=0;m<hr.length;m++)f[gr+m]=hr[m];else e.deps=f=hr;if(Ln()&&e.f&512)for(m=gr;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&gr<f.length&&(Or(e,gr),f.length=gr);if(it()&&_r!==null&&!ur&&f!==null&&!(e.f&6146))for(m=0;m<_r.length;m++)Tr(_r[m],e);if(i!==null&&i!==e){if(br++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=br;if(t!==null)for(let e of t)e.rv=br;_r!==null&&(r===null?r=_r:r.push(..._r))}return e.f&8388608&&(e.f^=le),d}catch(e){return dt(e)}finally{e.f^=se,hr=t,gr=n,_r=r,z=i,pr=a,$e(o),ur=s,xr=c}}function Dr(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(hr===null||!n.call(hr,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~oe),s.v!==S&&mt(s),Ft(s),Or(s,0)}}function Or(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Dr(e,n[r])}function kr(e){var t=e.f;if(!(t&16384)){k(e,_);var n=B,r=sr;B=e,sr=!0;try{t&16777232?Qn(e):Zn(e),Xn(e);var i=Er(e);e.teardown=typeof i==`function`?i:null,e.wv=yr}finally{sr=r,B=n}}}async function Ar(){if(Xe)return new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),Yt()}function V(e){var t=(e.f&2)!=0;if(or?.add(e),z!==null&&!ur&&!(B!==null&&B.f&16384)&&(pr===null||!pr.has(e))){var r=z.deps;if(z.f&2097152)e.rv<br&&(e.rv=br,hr===null&&r!==null&&r[gr]===e?gr++:hr===null?hr=[e]:hr.push(e));else{z.deps??=[],n.call(z.deps,e)||z.deps.push(e);var i=e.reactions;i===null?e.reactions=[z]:n.call(i,z)||i.push(z)}}if(cr&&on.has(e))return on.get(e);if(t){var a=e;if(cr){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Mr(a))&&(o=Nt(a)),on.set(a,o),o}var s=(a.f&512)==0&&!ur&&z!==null&&(sr||(z.f&512)!=0),c=(a.f&x)===0;wr(a)&&(s&&(a.f|=512),Pt(a)),s&&!c&&(It(a),jr(a))}if(Bt?.has(e))return Bt.get(e);if(e.f&8388608)throw e.v;return e.v}function jr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(It(t),jr(t))}function Mr(e){if(e.v===S)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(on.has(t)||t.f&2&&Mr(t))return!0;return!1}function Nr(e){var t=ur;try{return ur=!0,e()}finally{ur=t}}function Pr(){return Symbol(Ie)}function Fr(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var Ir=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function Lr(e){return Ir.includes(e)}var Rr=`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`),zr={formnovalidate:`formNoValidate`,ismap:`isMap`,nomodule:`noModule`,playsinline:`playsInline`,readonly:`readOnly`,defaultvalue:`defaultValue`,defaultchecked:`defaultChecked`,srcobject:`srcObject`,novalidate:`noValidate`,allowfullscreen:`allowFullscreen`,disablepictureinpicture:`disablePictureInPicture`,disableremoteplayback:`disableRemotePlayback`};function Br(e){return e=e.toLowerCase(),zr[e]??e}[...Rr];var Vr=[`touchstart`,`touchmove`];function Hr(e){return Vr.includes(e)}var Ur=[`textarea`,`script`,`style`,`title`];function Wr(e){return Ur.includes(e)}var Gr=Symbol(`events`),Kr=new Set,qr=new Set;function Jr(e,t,n,r={}){function i(e){if(r.capture||$r.call(t,e),!e.cancelBubble)return Mn(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?lt(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Yr(e,t,n,r={}){var i=Jr(t,e,n,r);return()=>{e.removeEventListener(t,i,r)}}function Xr(e,t,n){(t[Gr]??={})[e]=n}function Zr(e){for(var t=0;t<e.length;t++)Kr.add(e[t]);for(var n of qr)n(e)}var Qr=null;function $r(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;Qr=e;var s=0,c=Qr===e&&e[Gr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[Gr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=z,f=B;dr(null),fr(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[Gr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Gr]=t,delete e.currentTarget,dr(d),fr(f)}}}var ei=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ti(e){return ei?.createHTML(e)??e}function ni(e){var t=Dn(`template`);return t.innerHTML=ti(e.replaceAll(`<!>`,`\\x3C!---->`)),t.content}function ri(e,t){var n=B;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function H(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(C)return ri(w,null),w;i===void 0&&(i=ni(a?e:`<!>`+e),n||(i=Cn(i)));var t=r||vn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Cn(t),s=t.lastChild;ri(o,s)}else ri(t,t);return t}}function ii(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=(t&1)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(C)return ri(w,null),w;if(!o){var e=Cn(ni(a));if(i)for(o=document.createDocumentFragment();Cn(e);)o.appendChild(Cn(e));else o=Cn(e)}var t=o.cloneNode(!0);if(i){var n=Cn(t),r=t.lastChild;ri(n,r)}else ri(t,t);return t}}function ai(e,t){return ii(e,t,`svg`)}function oi(e=``){if(!C){var t=Sn(e+``);return ri(t,t),t}var n=w;return n.nodeType===3?On(n):(n.before(n=Sn()),He(n)),ri(n,n),n}function U(){if(C)return ri(w,null),w;var e=document.createDocumentFragment(),t=document.createComment(``),n=Sn();return e.append(t,n),ri(t,n),e}function W(e,t){if(C){var n=B;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=w),Ue();return}e!==null&&e.before(t)}function si(){if(C&&w&&w.nodeType===8&&w.textContent?.startsWith(`$`)){let e=w.textContent.substring(1);return Ue(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function G(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ge]??=e.nodeValue)&&(e[ge]=n,e.nodeValue=`${n}`)}function ci(e,t){return ui(e,t)}var li=new Map;function ui(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){xn();var l=void 0,u=Un(()=>{var s=n??t.appendChild(Sn());St(s,{pending:()=>{}},t=>{D({});var n=E;if(o&&(n.c=o),a&&(i.$$events=a),C&&ri(t,null),l=e(t,i)||{},C&&(B.nodes.end=w,w===null||w.nodeType!==8||w.data!==`]`))throw Re(),Ne;O()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=Hr(r);for(let e of[t,document]){var a=li.get(e);a===void 0&&(a=new Map,li.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,$r,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(Kr)),qr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=li.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,$r),r.delete(e),r.size===0&&li.delete(n)):r.set(e,i)}qr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return di.set(l,u),l}var di=new WeakMap;function fi(e,t){let n=di.get(e);return n?(di.delete(e),n(t)):Promise.resolve()}var pi=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)rr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(rr(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(R(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ar(r,t),t.append(Sn()),this.#n.set(e,{effect:r,fragment:t})}else R(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),tr(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(R(n.effect),this.#n.delete(e))};ensure(e,t){var n=j,r=En();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=Sn();i.append(a),this.#n.set(e,{effect:Yn(()=>t(a)),fragment:i})}else this.#t.set(e,Yn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else C&&(this.anchor=w),this.#a(n)}};function K(e,t,n=!1){var r;C&&(r=w,Ue());var i=new pi(e),a=n?ne:0;function o(e,t){if(C){var n=Ke(r);if(e!==parseInt(n.substring(1))){var a=Ge();He(a),i.anchor=a,Ve(!1),i.ensure(e,t),Ve(!0);return}}i.ensure(e,t)}qn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var mi=Symbol(`NaN`);function hi(e,t,n){C&&Ue();var r=new pi(e),i=!it();qn(()=>{var e=t();e!==e&&(e=mi),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function gi(e,t){return t}function _i(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];tr(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;vi(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=i.length===0&&n!==null;if(l){var u=n,d=u.parentNode;Tn(d),d.append(u),e.items.clear()}vi(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function vi(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ae,ar(a,document.createDocumentFragment())):R(t[i],n)}}var yi;function q(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=C?He(Cn(u)):u.appendChild(Sn())}C&&Ue();var d=null,f=jt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,xi(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ae,Ci(d,null,c)):rr(d):tr(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:qn(()=>{p=V(f);var e=p.length;let t=!1;C&&Ke(c)===`[!`!=(e===0)&&(c=Ge(),He(c),Ve(!1),t=!0);for(var r=new Set,u=j,v=En(),y=0;y<e;y+=1){C&&w.nodeType===8&&w.data===`]`&&(c=w,t=!0,Ve(!1));var b=p[y],ee=a(b,y),x=h?null:l.get(ee);x?(x.v&&un(x.v,b),x.i&&un(x.i,y),v&&u.unskip_effect(x.e)):(x=Si(l,h?c:yi??=Sn(),b,ee,y,o,n,i),h||(x.e.f|=ae),l.set(ee,x)),r.add(ee)}if(e===0&&s&&!d&&(h?d=Yn(()=>s(c)):(d=Yn(()=>s(yi??=Sn())),d.f|=ae)),e>r.size&&Se(``,``,``),C&&e>0&&He(Ge()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&Ve(!0),V(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,C&&(c=w)}function bi(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function xi(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=bi(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(rr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432)if(_.f^=ae,_===l)Ci(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),wi(e,d,_),wi(e,_,y),Ci(_,y,n),d=_,p=[],m=[],l=bi(d.next);continue}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],ee;d=b.prev;var x=p[0],te=p[p.length-1];for(ee=0;ee<p.length;ee+=1)Ci(p[ee],b,n);for(ee=0;ee<m.length;ee+=1)u.delete(m[ee]);wi(e,x.prev,te.next),wi(e,d,x),wi(e,te,b),l=b,d=te,--v,p=[],m=[]}else u.delete(_),Ci(_,l,n),wi(e,_.prev,_.next),wi(e,_,d===null?e.effect.first:d.next),wi(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=bi(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=bi(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(vi(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var ne=[];if(u!==void 0)for(_ of u)_.f&8192||ne.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&ne.push(l),l=bi(l.next);var re=ne.length;if(re>0){var ie=i&4&&s===0?n:null;if(o){for(v=0;v<re;v+=1)ne[v].nodes?.a?.measure();for(v=0;v<re;v+=1)ne[v].nodes?.a?.fix()}_i(e,ne,ie)}}o&<(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Si(e,t,n,r,i,a,o,s){var c=o&1?o&16?cn(n):ln(n,!1,!1):null,l=o&2?cn(i):null;return{v:c,i:l,e:Yn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ci(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=wn(r);if(a.before(r),r===i)return;r=o}}function wi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function J(e,t,...n){var r=new pi(e);qn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},ne)}function Ti(e,t,n){var r;C&&(r=w,Ue());var i=new pi(e);qn(()=>{var e=t()??null;if(C&&Ke(r)===`[`!=(e!==null)){var a=Ge();He(a),i.anchor=a,Ve(!1),i.ensure(e,e&&(t=>n(t,e))),Ve(!0);return}i.ensure(e,e&&(t=>n(t,e)))},ne)}function Ei(e,t,n,r,i,a){let o=C;C&&Ue();var s=null;C&&w.nodeType===1&&(s=w,Ue());var c=C?w:e,l=new pi(c,!1);qn(()=>{let e=t()||null;var a=i?i():n||e===`svg`?Fe:void 0;if(e===null){l.ensure(null,null);return}return l.ensure(e,t=>{if(e){if(s=C?s:Dn(e,a),ri(s,s),r){var n=null;C&&Wr(e)&&s.append(n=document.createComment(``));var i=C?Cn(s):s.appendChild(Sn());C&&(i===null?Ve(!1):He(i)),r(s,i),n?.remove()}B.nodes.end=s,t.before(s)}C&&He(t)}),()=>{}},ne),Rn(()=>{}),o&&(Ve(!0),He(c))}function Di(e,t){var n=void 0,r;Jn(()=>{n!==(n=t())&&(r&&=(R(r),null),n&&(r=Yn(()=>{Wn(()=>n(e))})))})}function Oi(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Oi(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ki(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Oi(e))&&(r&&(r+=` `),r+=t);return r}function Ai(e){return typeof e==`object`?ki(e):e??``}var ji=[...` \n\\r\\f\\xA0\\v\uFEFF`];function Mi(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ji.includes(r[o-1]))&&(s===r.length||ji.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Ni(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Pi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Fi(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Pi)),i&&c.push(...Object.keys(i).map(Pi));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`\'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Pi(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Ni(r)),i&&(n+=Ni(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ii(e,t,n,r,i,a){var o=e[me];if(C||o!==n||o===void 0){var s=Mi(n,r,a);(!C||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[me]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Li(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Ri(e,t,n,r){var i=e[he];if(C||i!==t){var a=Fi(t,r);(!C||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[he]=t}else r&&(Array.isArray(r)?(Li(e,n?.[0],r[0]),Li(e,n?.[1],r[1],`important`)):Li(e,n,r));return r}function zi(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return ze();for(var i of t.options)i.selected=n.includes(Vi(i));return}for(i of t.options)if(gn(Vi(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function Bi(e){var t=new MutationObserver(()=>{zi(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),Rn(()=>{t.disconnect()})}function Vi(e){return`__value`in e?e.__value:e.value}var Hi=Symbol(`class`),Ui=Symbol(`style`),Wi=Symbol(`is custom element`),Gi=Symbol(`is html`),Ki=ye?`link`:`LINK`,qi=ye?`input`:`INPUT`,Ji=ye?`option`:`OPTION`,Yi=ye?`select`:`SELECT`;function Xi(e){if(C){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Qi(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Qi(e,`checked`,null),e.checked=r}}};e[_e]=n,lt(n),jn()}}function Zi(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function Qi(e,t,n,r){var i=ta(e);C&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Ki)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[fe]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ra(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function $i(e,t,n,r,i=!1,a=!1){if(C&&i&&e.nodeName===qi){var o=e;(o.type===`checkbox`?`defaultChecked`:`defaultValue`)in n||Xi(o)}var s=ta(e),c=s[Wi],l=!s[Gi];let u=C&&c;u&&Ve(!1);var d=t||{},f=e.nodeName===Ji;for(var p in t)p in n||(n[p]=null);n.class?n.class=Ai(n.class):(r||n[Hi])&&(n.class=null),n[Ui]&&(n.style??=null);var m=ra(e);if(e.nodeName===qi&&`type`in n&&(`value`in n||`__value`in n)){var h=n.type;(h!==d.type||h===void 0&&e.hasAttribute(`type`))&&(d.type=h,Qi(e,`type`,h,a))}for(let i in n){let o=n[i];if(f&&i===`value`&&o==null){e.value=e.__value=``,d[i]=o;continue}if(i===`class`){Ii(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,o,r,t?.[Hi],n[Hi]),d[i]=o,d[Hi]=n[Hi];continue}if(i===`style`){Ri(e,o,t?.[Ui],n[Ui]),d[i]=o,d[Ui]=n[Ui];continue}var g=d[i];if(!(o===g&&!(o===void 0&&e.hasAttribute(i)))){d[i]=o;var _=i[0]+i[1];if(_!==`$$`)if(_===`on`){let t={},n=`$$`+i,r=i.slice(2);var v=Lr(r);if(Fr(r)&&(r=r.slice(0,-7),t.capture=!0),!v&&g){if(o!=null)continue;e.removeEventListener(r,d[n],t),d[n]=null}if(v)Xr(r,e,o),Zr([r]);else if(o!=null){function a(e){d[i].call(this,e)}d[n]=Jr(r,e,a,t)}}else if(i===`style`)Qi(e,i,o);else if(i===`autofocus`)kn(e,!!o);else if(!c&&(i===`__value`||i===`value`&&o!=null))e.value=e.__value=o;else if(i===`selected`&&f)Zi(e,o);else{var y=i;l||(y=Br(y));var b=y===`defaultValue`||y===`defaultChecked`;if(o==null&&!c&&!b)if(s[i]=null,y===`value`||y===`checked`){let n=e,r=t===void 0;if(y===`value`){let e=n.defaultValue;n.removeAttribute(y),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i);else b||m.includes(y)&&(c||typeof o!=`string`)?(e[y]=o,y in s&&(s[y]=S)):typeof o!=`function`&&Qi(e,y,o,a)}}}return u&&Ve(!0),d}function ea(e,t,n=[],r=[],i=[],a,o=!1,s=!1){wt(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===Yi,l=!1;if(Jn(()=>{var u=t(...n.map(V)),d=$i(e,r,u,a,o,s);l&&c&&`value`in u&&zi(e,u.value);for(let e of Object.getOwnPropertySymbols(i))u[e]||R(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var f=u[t];t.description===`@attach`&&(!r||f!==r[t])&&(i[t]&&R(i[t]),i[t]=Yn(()=>Di(e,()=>f))),d[t]=f}r=d}),c){var u=e;Wn(()=>{zi(u,r.value,!0),Bi(u)})}l=!0})}function ta(e){return e[pe]??={[Wi]:e.nodeName.includes(`-`),[Gi]:e.namespaceURI===Pe}}var na=new Map;function ra(e){var t=e.getAttribute(`is`)||e.nodeName,n=na.get(t);if(n)return n;na.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.push(s);i=l(i)}return n}function ia(e,t,n=t){var r=new WeakSet;Nn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=aa(e)?oa(a):a,n(a),j!==null&&r.add(j),await Ar(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(C&&e.defaultValue!==e.value||Nr(t)==null&&e.value)&&(n(aa(e)?oa(e.value):e.value),j!==null&&r.add(j)),Kn(()=>{var n=t();if(e===document.activeElement){var i=Xe?zt:j;if(r.has(i))return}aa(e)&&n===oa(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function aa(e){var t=e.type;return t===`number`||t===`range`}function oa(e){return e===``?null:+e}var sa={get(e,t){if(!e.exclude.has(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.has(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.has(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.has(t))}};function ca(e,t,n){return new Proxy({props:e,exclude:t},sa)}var la={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ue||t===de)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function ua(...e){return new Proxy({props:e},la)}function Y(e,t,n,r){var i=!Ze||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=void 0,d=()=>s&&i?(u??=Ot(r),V(u)):(l&&(l=!1,c=s?Nr(r):r),c);let f;if(o){var p=ue in e||de in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=yt(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&De(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?Ot:jt)(()=>(v=!1,g()));o&&V(y);var b=B;return(function(e,t){if(arguments.length>0){let n=t?V(y):i&&o?mn(e):e;return N(y,n),v=!0,c!==void 0&&(c=n),e}return cr&&v||b.f&16384?y.v:V(y)})}function da(e){E===null&&be(`onMount`),Ze&&E.l!==null?fa(E).m.push(e):zn(()=>{let t=Nr(e);if(typeof t==`function`)return t})}function fa(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var X=new class{#e=M(null);get data(){return V(this.#e)}set data(e){N(this.#e,e,!0)}#t=M(null);get arsenal(){return V(this.#t)}set arsenal(e){N(this.#t,e,!0)}#n=M(`connecting`);get status(){return V(this.#n)}set status(e){N(this.#n,e,!0)}#r=M(``);get clock(){return V(this.#r)}set clock(e){N(this.#r,e,!0)}#i=M(`overview`);get view(){return V(this.#i)}set view(e){N(this.#i,e,!0)}#a=M(!1);get arsenalLoading(){return V(this.#a)}set arsenalLoading(e){N(this.#a,e,!0)}#o=!1;#s=null;async tick(){try{let e=await fetch(`/data`);if(!e.ok)throw Error(`HTTP ${e.status}`);this.data=await e.json(),this.status=`live`,this.clock=new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{this.status=`offline`}}start(){this.tick(),this.#s=setInterval(()=>void this.tick(),1e4)}stop(){this.#s&&clearInterval(this.#s)}async loadArsenal(e=!1){if(!(this.#o&&!e)){this.arsenalLoading=!0;try{let e=await fetch(`/arsenal`);e.ok&&(this.arsenal=await e.json(),this.#o=!0)}catch{}finally{this.arsenalLoading=!1}}}go(e){this.view=e,e===`arsenal`&&this.loadArsenal()}};function Z(e){return typeof e!=`number`||!Number.isFinite(e)?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function pa(e){return typeof e!=`number`||!Number.isFinite(e)?`$0.00`:`$${e.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function ma(e){if(!e)return`\u2014`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`\u2014`;let n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function ha(e){if(!e)return`unknown`;let t=e.toLowerCase();return t===`<synthetic>`?`unknown`:t.includes(`fable`)?`fable`:t.includes(`opus`)?`opus`:t.includes(`sonnet`)?`sonnet`:t.includes(`haiku`)?`haiku`:`unknown`}function ga(e){return!e||e===`<synthetic>`?`synthetic`:e.replace(/^claude-/,``)}function _a(e){if(!e)return``;let t=e.split(/[/\\\\]/).filter(Boolean);return t.length<=2?t.join(`/`):`\u2026/${t.slice(-2).join(`/`)}`}var va=[220,75,20,155,285,330,250,45];function ya(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return`oklch(72% 0.15 ${va[t%va.length]})`}var ba={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},xa=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Sa=Symbol(`lucide-context`),Ca=()=>et(Sa),wa=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),Ta=ai(`<svg><!><!></svg>`);function Ea(e,t){D(t,!0);let n=Ca()??{},r=Y(t,`color`,19,()=>n.color??`currentColor`),i=Y(t,`size`,19,()=>n.size??24),a=Y(t,`strokeWidth`,19,()=>n.strokeWidth??2),o=Y(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),s=Y(t,`iconNode`,19,()=>[]),c=ca(t,wa),l=A(()=>o()?Number(a())*24/Number(i()):a());var u=Ta();ea(u,e=>({...ba,...e,...c,width:i(),height:i(),stroke:r(),"stroke-width":V(l),class:[`lucide-icon lucide`,n.class,t.name&&`lucide-${t.name}`,t.class]}),[()=>!t.children&&!xa(c)&&{"aria-hidden":`true`}]);var d=P(u);q(d,17,s,gi,(e,t)=>{var n=A(()=>h(V(t),2));let r=()=>V(n)[0],i=()=>V(n)[1];var a=U();Ei(F(a),r,!0,(e,t)=>{ea(e,()=>({...i()}))}),W(e,a)}),J(I(d),()=>t.children??f),T(u),W(e,u),O()}var Da=new Set([`$$slots`,`$$events`,`$$legacy`]);function Oa(e,t){let n=ca(t,Da),r=[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`}]];Ea(e,ua({name:`layout-dashboard`},()=>n,{get iconNode(){return r}}))}var ka=new Set([`$$slots`,`$$events`,`$$legacy`]);function Aa(e,t){let n=ca(t,ka),r=[[`polyline`,{points:`14.5 17.5 3 6 3 3 6 3 17.5 14.5`}],[`line`,{x1:`13`,x2:`19`,y1:`19`,y2:`13`}],[`line`,{x1:`16`,x2:`20`,y1:`16`,y2:`20`}],[`line`,{x1:`19`,x2:`21`,y1:`21`,y2:`19`}],[`polyline`,{points:`14.5 6.5 18 3 21 3 21 6 17.5 9.5`}],[`line`,{x1:`5`,x2:`9`,y1:`14`,y2:`18`}],[`line`,{x1:`7`,x2:`4`,y1:`17`,y2:`20`}],[`line`,{x1:`3`,x2:`5`,y1:`19`,y2:`21`}]];Ea(e,ua({name:`swords`},()=>n,{get iconNode(){return r}}))}var ja=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ma(e,t){let n=ca(t,ja),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];Ea(e,ua({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var Na=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pa(e,t){let n=ca(t,Na),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];Ea(e,ua({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Fa=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ia(e,t){let n=ca(t,Fa),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]];Ea(e,ua({name:`panel-left`},()=>n,{get iconNode(){return r}}))}var La=H(`<div class="min-w-0"><div class="font-serif text-lg leading-none text-foreground">Synth<em>ra</em></div> <div class="font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground">Dashboard</div></div>`),Ra=H(`<span class="font-mono text-sm text-muted-foreground"> </span>`),za=H(`<span> </span>`),Ba=H(`<button><!> <!></button>`),Va=H(`<span>FAQ</span>`),Ha=H(`<div class="flex flex-col gap-1 rounded-lg bg-sidebar-accent/40 p-2.5"><div class="font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground">Active</div> <div class="truncate font-mono text-sm text-sidebar-foreground"> </div> <div class="mt-1 flex items-center justify-between font-mono text-[10px] text-muted-foreground"><span> </span> <span>v__SYN_VERSION__</span></div></div>`),Ua=H(`<span class="text-xs">Collapse</span>`),Wa=H(`<aside><div class="flex items-center gap-2.5 px-1 py-2"><div class="grid size-8 shrink-0 place-items-center rounded-lg bg-primary/90 font-serif text-lg italic text-primary-foreground">S</div> <!></div> <div><span></span> <!></div> <div class="my-1 h-px bg-sidebar-border"></div> <nav class="flex flex-col gap-1"><!> <button title="FAQ"><!> <!></button></nav> <div class="flex-1"></div> <!> <button title="Toggle sidebar"><!> <!></button></aside>`);function Ga(e,t){D(t,!0);let n=M(!1),r=typeof window<`u`&&window.location.port||`8901`,i=[{id:`overview`,label:`Overview`,icon:Oa},{id:`arsenal`,label:`Arsenal`,icon:Aa},{id:`commands`,label:`Commands`,icon:Ma}];var a=Wa(),o=P(a),s=I(P(o),2),c=e=>{W(e,La())};K(s,e=>{V(n)||e(c)}),T(o);var l=I(o,2),u=P(l);let d;var f=I(u,2),p=e=>{var t=Ra(),n=P(t,!0);T(t),L(()=>G(n,X.status===`live`?`live \xB7 ${X.clock}`:X.status)),W(e,t)};K(f,e=>{V(n)||e(p)}),T(l);var m=I(l,4),h=P(m);q(h,17,()=>i,e=>e.id,(e,t)=>{var r=Ba(),i=P(r);Ti(i,()=>V(t).icon,(e,t)=>{t(e,{class:`size-4 shrink-0`})});var a=I(i,2),o=e=>{var n=za(),r=P(n,!0);T(n),L(()=>G(r,V(t).label)),W(e,n)};K(a,e=>{V(n)||e(o)}),T(r),L(()=>{Qi(r,`title`,V(t).label),Ii(r,1,`flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm transition-colors `+(X.view===V(t).id?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-sidebar-foreground/75 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground`)+(V(n)?` justify-center`:``))}),Xr(`click`,r,()=>X.go(V(t).id)),W(e,r)});var g=I(h,2),_=P(g);Pa(_,{class:`size-4 shrink-0`});var v=I(_,2),y=e=>{W(e,Va())};K(v,e=>{V(n)||e(y)}),T(g),T(m);var b=I(m,4),ee=e=>{var t=Ha(),n=I(P(t),2),i=P(n,!0);T(n);var a=I(n,2),o=P(a),s=P(o);T(o),We(2),T(a),T(t),L(()=>{Qi(n,`title`,X.data?.active?.project_root??`\u2014`),G(i,X.data?.active?.project_name??`\u2014`),G(s,`port ${r??``}`)}),W(e,t)};K(b,e=>{V(n)||e(ee)});var x=I(b,2),te=P(x);Ia(te,{class:`size-4 shrink-0`});var ne=I(te,2),re=e=>{W(e,Ua())};K(ne,e=>{V(n)||e(re)}),T(x),T(a),L(()=>{Ii(a,1,`flex h-screen shrink-0 flex-col gap-1 border-r border-sidebar-border bg-sidebar p-3 transition-[width] duration-200 `+(V(n)?`w-[64px] items-center`:`w-[248px]`)),Ii(l,1,`flex items-center gap-2 rounded-md px-2 py-1.5 `+(V(n)?`justify-center`:``)),d=Ii(u,1,`size-2 shrink-0 rounded-full `+(X.status===`live`?`bg-[var(--c-fable)]`:X.status===`offline`?`bg-destructive`:`bg-muted-foreground`),null,d,{"animate-pulse":X.status===`live`}),Ii(g,1,`flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm text-sidebar-foreground/75 transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground `+(V(n)?`justify-center`:``)),Ii(x,1,`mt-1 flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground `+(V(n)?`justify-center`:``))}),Xr(`click`,g,function(...e){t.onFaq?.apply(this,e)}),Xr(`click`,x,()=>N(n,!V(n))),W(e,a),O()}Zr([`click`]),Qe();var Ka=H(`<div class="flex flex-col gap-1 bg-card/70 p-4"><span class="font-mono text-xs uppercase tracking-[0.12em] text-muted-foreground"> </span> <span class="font-mono text-2xl tabular-nums text-foreground"> </span></div>`),qa=H(`<div class="grid grid-cols-2 gap-px overflow-hidden rounded-xl border bg-border sm:grid-cols-3 lg:grid-cols-5"></div>`);function Ja(e,t){D(t,!0);let n=A(()=>{let e=X.data?.global;return[{label:`Turns`,v:e?.total_turns??0},{label:`\u2193 Input`,v:e?.total_input_tokens??0},{label:`\u2191 Output`,v:e?.total_output_tokens??0},{label:`\u27F2 Cache R`,v:e?.total_cache_read??0},{label:`\uFF0B Cache W`,v:e?.total_cache_create??0}]});var r=qa();q(r,21,()=>V(n),e=>e.label,(e,t)=>{var n=Ka(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a),T(n),L(e=>{G(i,V(t).label),G(o,e)},[()=>Z(V(t).v)]),W(e,n)}),T(r),W(e,r),O()}var Ya=H(`<span class="font-mono text-[10px] uppercase tracking-[0.12em] text-muted-foreground"> </span>`),Xa=H(`<header class="flex items-baseline justify-between gap-3"><span class="font-mono text-xs uppercase tracking-[0.14em] text-muted-foreground"> </span> <!></header>`),Za=H(`<section><!> <!></section>`);function Qa(e,t){let n=Y(t,`class`,3,``);var r=Za(),i=P(r),a=e=>{var n=Xa(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=e=>{var n=Ya(),r=P(n,!0);T(n),L(()=>G(r,t.meta)),W(e,n)};K(a,e=>{t.meta&&e(o)}),T(n),L(()=>G(i,t.title)),W(e,n)};K(i,e=>{t.title&&e(a)}),J(I(i,2),()=>t.children??f),T(r),L(()=>Ii(r,1,`flex h-full min-h-0 flex-col gap-3 rounded-xl border bg-card/55 p-4 transition-colors hover:bg-card/80 `+n())),W(e,r)}var $a=H(`<div class="flex flex-col gap-3"><div><div class="font-mono text-3xl text-[var(--money)]"> </div> <div class="font-mono text-sm text-muted-foreground"> </div></div> <div class="flex h-2 overflow-hidden rounded-full bg-border"><div class="h-full bg-muted-foreground/40"></div> <div class="h-full bg-[var(--money)]"></div></div> <div class="flex justify-between font-mono text-xs text-muted-foreground"><span>you paid <b class="text-foreground"> </b></span> <span>baseline <b class="text-foreground"> </b></span></div> <div class="rounded-md border border-dashed border-border px-3 py-2 text-center font-mono text-xs text-muted-foreground"><b class="text-foreground"> </b> blocks \xD7 <b class="text-foreground">500</b> tokens \xD7 <b class="text-foreground">$3</b>/M = <b class="text-[var(--money)]"> </b></div></div>`);function eo(e,t){D(t,!0);let n=A(()=>{let e=X.data?.global,t=e?.blocked_count??0,n=t*500*3/1e6,r=e?.estimated_cost_usd??0,i=r+n;return{blocks:t,money:n,paid:r,baseline:i,pct:i>0?n/i*100:0,tokens:e?.estimated_tokens_saved??0,paidWidth:i>0?r/i*100:100}});{let t=A(()=>`${V(n).pct.toFixed(1)}% off \xB7 floor`);Qa(e,{title:`Synthra savings`,get meta(){return V(t)},children:(e,t)=>{var r=$a(),i=P(r),a=P(i),o=P(a,!0);T(a);var s=I(a,2),c=P(s);T(s),T(i);var l=I(i,2),u=P(l),d=I(u,2);T(l);var f=I(l,2),p=P(f),m=I(P(p)),h=P(m,!0);T(m),T(p);var g=I(p,2),_=I(P(g)),v=P(_,!0);T(_),T(g),T(f);var y=I(f,2),b=P(y),ee=P(b,!0);T(b);var x=I(b,6),te=P(x,!0);T(x),T(y),T(r),L((e,t,r,i,a)=>{G(o,e),G(c,`${t??``} tokens avoided`),Ri(u,`width:${V(n).paidWidth}%`),Ri(d,`width:${100-V(n).paidWidth}%`),G(h,r),G(v,i),G(ee,V(n).blocks),G(te,a)},[()=>pa(V(n).money),()=>Z(V(n).tokens),()=>pa(V(n).paid),()=>pa(V(n).baseline),()=>pa(V(n).money)]),W(e,r)},$$slots:{default:!0}})}O()}var to=H(`<div class="font-mono text-3xl text-[var(--money)]"> </div> <div class="mt-1 flex flex-col gap-1 font-mono text-sm text-muted-foreground"><div class="flex justify-between"><span>Tokens (in+out)</span><span class="text-foreground"> </span></div> <div class="flex justify-between"><span>Avg / turn</span><span class="text-foreground"> </span></div></div>`,1);function no(e,t){D(t,!0);let n=A(()=>{let e=X.data?.global,t=e?.total_turns??0,n=e?.estimated_cost_usd??0;return{cost:n,tokens:(e?.total_input_tokens??0)+(e?.total_output_tokens??0),avg:t>0?n/t:0}});Qa(e,{title:`Total spend`,meta:`all time`,children:(e,t)=>{var r=to(),i=F(r),a=P(i,!0);T(i);var o=I(i,2),s=P(o),c=I(P(s)),l=P(c,!0);T(c),T(s);var u=I(s,2),d=I(P(u)),f=P(d,!0);T(d),T(u),T(o),L((e,t,n)=>{G(a,e),G(l,t),G(f,n)},[()=>pa(V(n).cost),()=>Z(V(n).tokens),()=>pa(V(n).avg)]),W(e,r)},$$slots:{default:!0}}),O()}var ro=ai(`<circle cx="70" cy="70" r="52" fill="none" stroke-width="14"></circle>`),io=H(`<div class="flex items-center gap-2 font-mono text-sm"><span class="size-2 rounded-sm"></span> <span class="flex-1 text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span> <span class="w-9 text-right tabular-nums text-muted-foreground"> </span></div>`),ao=H(`<div class="text-sm text-muted-foreground">No turns yet.</div>`),oo=H(`<div class="flex items-center gap-4"><div class="relative size-[116px] shrink-0"><svg viewBox="0 0 140 140" class="size-full -rotate-90"><circle cx="70" cy="70" r="52" fill="none" stroke="var(--border)" stroke-width="14"></circle><!></svg> <div class="absolute inset-0 grid place-items-center"><div class="text-center"><div class="font-mono text-2xl text-foreground"> </div> <div class="font-mono text-[10px] uppercase text-muted-foreground">turns</div></div></div></div> <div class="flex min-w-0 flex-1 flex-col gap-1.5"></div></div>`);function so(e,t){D(t,!0);let n=[{fam:`fable`,label:`Fable`,color:`var(--c-fable)`},{fam:`opus`,label:`Opus`,color:`var(--c-opus)`},{fam:`sonnet`,label:`Sonnet`,color:`var(--c-sonnet)`},{fam:`haiku`,label:`Haiku`,color:`var(--c-haiku)`},{fam:`unknown`,label:`Other`,color:`var(--c-unknown)`}],r=2*Math.PI*52,i=A(()=>{let e={fable:0,opus:0,sonnet:0,haiku:0,unknown:0};for(let t of X.data?.projects??[])for(let[n,r]of Object.entries(t.models??{}))e[ha(n)]+=r;let t=n.reduce((t,n)=>t+e[n.fam],0),i=0;return{arcs:n.filter(t=>e[t.fam]>0).map(n=>{let a=e[n.fam],o=t>0?a/t*r:0,s={...n,n:a,len:o,offset:i,pct:t>0?Math.round(a/t*100):0};return i+=o,s}),total:t}});Qa(e,{title:`Model usage`,meta:`by turns`,children:(e,t)=>{var n=oo(),a=P(n),o=P(a);q(I(P(o)),17,()=>V(i).arcs,e=>e.fam,(e,t)=>{var n=ro();L(()=>{Qi(n,`stroke`,V(t).color),Qi(n,`stroke-dasharray`,`${V(t).len} ${r}`),Qi(n,`stroke-dashoffset`,-V(t).offset),Qi(n,`stroke-linecap`,V(i).arcs.length===1?`round`:`butt`)}),W(e,n)}),T(o);var s=I(o,2),c=P(s),l=P(c),u=P(l,!0);T(l),We(2),T(c),T(s),T(a);var d=I(a,2);q(d,21,()=>V(i).arcs,e=>e.fam,(e,t)=>{var n=io(),r=P(n),i=I(r,2),a=P(i,!0);T(i);var o=I(i,2),s=P(o,!0);T(o);var c=I(o,2),l=P(c);T(c),T(n),L(()=>{Ri(r,`background:${V(t).color}`),G(a,V(t).label),G(s,V(t).n),G(l,`${V(t).pct??``}%`)}),W(e,n)},e=>{W(e,ao())}),T(d),T(n),L(()=>G(u,V(i).total)),W(e,n)},$$slots:{default:!0}}),O()}function co(e){return typeof e==`object`&&!!e}var lo=[`string`,`number`,`bigint`,`boolean`];function uo(e){return e==null||lo.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>uo(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var fo=Symbol(`box`),po=Symbol(`is-writable`);function Q(e,t){let n=A(e);return t?{[fo]:!0,[po]:!0,get current(){return V(n)},set current(e){t(e)}}:{[fo]:!0,get current(){return e()}}}function mo(e){return co(e)&&fo in e}function ho(e){let t=M(mn(e));return{[fo]:!0,[po]:!0,get current(){return V(t)},set current(e){N(t,e,!0)}}}function go(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var _o=/\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g,vo=/\\n/g,yo=/^\\s*/,bo=/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/,xo=/^:\\s*/,So=/^((?:\'(?:\\\\\'|.)*?\'|"(?:\\\\"|.)*?"|\\([^)]*?\\)|[^};])+)/,Co=/^[;\\s]*/,wo=/^\\s+|\\s+$/g,To=`\n`,Eo=`/`,Do=`*`,Oo=``,ko=`comment`,Ao=`declaration`;function jo(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(vo);t&&(n+=t.length);var i=e.lastIndexOf(To);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(yo)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(!(Eo!=e.charAt(0)||Do!=e.charAt(1))){for(var n=2;Oo!=e.charAt(n)&&(Do!=e.charAt(n)||Eo!=e.charAt(n+1));)++n;if(n+=2,Oo===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:ko,comment:o})}}function f(){var e=a(),t=c(bo);if(t){if(d(),!c(xo))return s(`property missing \':\'`);var n=c(So),r=e({type:Ao,property:Mo(t[0].replace(_o,Oo)),value:n?Mo(n[0].replace(_o,Oo)):Oo});return c(Co),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function Mo(e){return e?e.replace(wo,Oo):Oo}function No(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=jo(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var Po=/\\d/,Fo=[`-`,`_`,`/`,`.`];function Io(e=``){if(!Po.test(e))return e!==e.toLowerCase()}function Lo(e){let t=[],n=``,r,i;for(let a of e){let e=Fo.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=Io(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function Ro(e){return e?Lo(e).map(e=>Bo(e)).join(``):``}function zo(e){return Vo(Ro(e||``))}function Bo(e){return e?e[0].toUpperCase()+e.slice(1):``}function Vo(e){return e?e[0].toLowerCase()+e.slice(1):``}function Ho(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Ro(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[zo(e)]=n}return No(e,n),t}function Uo(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Wo(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var Go=Wo(/[A-Z]/,e=>`-${e.toLowerCase()}`);function Ko(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${Go(t)}: ${e[t]};`).join(`\n`)}function qo(e={}){return Ko(e).replace(`\n`,` `)}var Jo=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function Yo(e){return Jo.has(e)}function Xo(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];if(r){for(let e of Object.keys(r)){let n=t[e],i=r[e],a=typeof n==`function`,o=typeof i==`function`;if(a&&typeof o&&Yo(e))t[e]=go(n,i);else if(a&&o)t[e]=Uo(n,i);else if(e===`class`){let r=uo(n),a=uo(i);r&&a?t[e]=ki(n,i):r?t[e]=ki(n):a&&(t[e]=ki(i))}else if(e===`style`){let r=typeof n==`object`,a=typeof i==`object`,o=typeof n==`string`,s=typeof i==`string`;if(r&&a)t[e]={...n,...i};else if(r&&s){let r=Ho(i);t[e]={...n,...r}}else if(o&&a)t[e]={...Ho(n),...i};else if(o&&s){let r=Ho(n),a=Ho(i);t[e]={...r,...a}}else r?t[e]=n:a?t[e]=i:o?t[e]=n:s&&(t[e]=i)}else t[e]=i===void 0?n:i}for(let e of Object.getOwnPropertySymbols(r)){let n=t[e],i=r[e];t[e]=i===void 0?n:i}}}return typeof t.style==`object`&&(t.style=qo(t.style).replaceAll(`\n`,` `)),t.hidden===!1&&(t.hidden=void 0,delete t.hidden),t.disabled===!1&&(t.disabled=void 0,delete t.disabled),t}var Zo=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function Qo(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var $o=class extends Map{#e=new Map;#t=M(0);#n=M(0);#r=xr||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return xr===this.#r?M(e):cn(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return V(this.#t),!1;return V(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{V(this.#t);return}return V(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),N(this.#n,super.size),fn(o);else if(i!==t){fn(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&fn(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),N(n,-1)),r&&(N(this.#n,super.size),fn(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;N(this.#n,0);for(var t of e.values())N(t,-1);fn(this.#t),e.clear()}}#a(){V(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)V(n)}keys(){return V(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return V(this.#n),super.size}};new class{#e;#t;constructor(e={}){let{window:t=Zo,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=bt(e=>{let n=Yr(t,`focusin`,e),r=Yr(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?Qo(this.#e):null}};var es=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return nt(this.#t)}get(){let e=et(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=et(this.#t);return t===void 0?e:t}set(e){return tt(this.#t,e)}};function ts(e,t){switch(e){case`post`:zn(t);break;case`pre`:Vn(t);break}}function ns(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;ts(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=Nr(()=>n(t,o));return o=t,r})}function rs(e,t,n){let r=Hn(()=>{let i=!1;ns(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});zn(()=>r)}function is(e,t,n){ns(e,`post`,t,n)}function as(e,t,n){ns(e,`pre`,t,n)}is.pre=as;function os(e,t){rs(e,`post`,t)}function ss(e,t){rs(e,`pre`,t)}os.pre=ss;function cs(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function ls(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function us(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=M(mn(o)),u=M(!1),d=M(void 0),f=M(mn([])),p=()=>{V(f).forEach(e=>e()),N(f,[],!0)},m=e=>{N(f,[...V(f),e],!0)},h=async(e,n,r=!1)=>{try{N(u,!0),N(d,void 0),p();let i=new AbortController;m(()=>i.abort());let a=await t(e,n,{data:V(l),refetching:r,onCleanup:m,signal:i.signal});return N(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||N(d,e,!0);return}finally{N(u,!1)}},g=s?cs(h,s):c?ls(h,c):h,_=Array.isArray(e)?e:[e],v;return r((t,n)=>{a&&v||(v=t,g(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return V(l)},get loading(){return V(u)},get error(){return V(d)},mutate:e=>{N(l,e,!0)},refetch:t=>{let n=_.map(e=>e());return g(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function ds(e,t,n){return us(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];is(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function fs(e,t,n){return us(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];is.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}ds.pre=fs;function ps(e){zn(()=>()=>{e()})}function ms(e,t){return setTimeout(t,e)}function hs(e){Ar().then(e)}var gs=1,_s=9,vs=11;function ys(e){return co(e)&&e.nodeType===gs&&typeof e.nodeName==`string`}function bs(e){return co(e)&&e.nodeType===_s}function xs(e){return co(e)&&e.constructor?.name===`VisualViewport`}function Ss(e){return co(e)&&e.nodeType!==void 0}function Cs(e){return Ss(e)&&e.nodeType===vs&&`host`in e}function ws(e,t){if(!e||!t||!ys(e)||!ys(t))return!1;let n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&Cs(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ts(e){return bs(e)?e:xs(e)?e.document:e?.ownerDocument??document}function Es(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var Ds=class{element;#e=A(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return V(this.#e)}set root(e){N(this.#e,e)}constructor(e){typeof e==`function`?this.element=Q(e):this.element=e}getDocument=()=>Ts(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>Es(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)};function Os(e,t){return{[Pr()]:n=>mo(e)?(e.current=n,Nr(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e.current=null,t?.(null))}):(e(n),Nr(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e(null),t?.(null))})}}function ks(e){return e?``:void 0}function As(e){return e?`open`:`closed`}function js(e){return e===`starting`?{"data-starting-style":``}:e===`ending`?{"data-ending-style":``}:{}}var Ms=class{#e;#t;attrs;constructor(e){this.#e=e.getVariant?e.getVariant():null,this.#t=this.#e?`data-${this.#e}-`:`data-${e.component}-`,this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(e.parts.map(e=>[e,this.getAttr(e)]))}getAttr(e,t){return t?`data-${t}-${e}`:`${this.#t}${e}`}selector(e,t){return`[${this.getAttr(e,t)}]`}};function Ns(e){let t=new Ms(e);return{...t.attrs,selector:t.selector,getAttr:t.getAttr}}var Ps=typeof document<`u`,Fs=Is();function Is(){return Ps&&window?.navigator?.userAgent&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||window?.navigator?.maxTouchPoints>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Ls(e){return e instanceof HTMLElement}function Rs(e){return e instanceof Element||e instanceof SVGElement}var zs=class{#e;#t=null;#n=null;#r=0;constructor(e){this.#e=e,ps(()=>this.#i())}#i(){this.#t!==null&&(window.cancelAnimationFrame(this.#t),this.#t=null),this.#n?.disconnect(),this.#n=null,this.#r++}run(e){this.#i();let t=this.#e.ref.current;if(!t)return;if(typeof t.getAnimations!=`function`){this.#a(e);return}let n=this.#r,r=()=>{n===this.#r&&this.#a(e)},i=()=>{if(n!==this.#r)return;let e=t.getAnimations();if(e.length===0){r();return}Promise.all(e.map(e=>e.finished)).then(()=>{r()}).catch(()=>{if(n===this.#r){if(t.getAnimations().some(e=>e.pending||e.playState!==`finished`)){i();return}r()}})},a=()=>{this.#t=window.requestAnimationFrame(()=>{this.#t=null,i()})};if(!this.#e.afterTick.current){a();return}this.#t=window.requestAnimationFrame(()=>{this.#t=null;let e=`data-starting-style`;if(!t.hasAttribute(e)){a();return}this.#n=new MutationObserver(()=>{n===this.#r&&(t.hasAttribute(e)||(this.#n?.disconnect(),this.#n=null,a()))}),this.#n.observe(t,{attributes:!0,attributeFilter:[e]})})}#a(e){let t=()=>{e()};this.#e.afterTick?hs(t):t()}},Bs=class{#e;#t;#n;#r=M(!1);#i=M(void 0);#a=!1;#o=null;constructor(e){this.#e=e,N(this.#r,e.open.current,!0),this.#t=e.enabled??!0,this.#n=new zs({ref:this.#e.ref,afterTick:this.#e.open}),ps(()=>this.#s()),is(()=>this.#e.open.current,e=>{if(!this.#a){this.#a=!0;return}if(this.#s(),!e&&this.#e.shouldSkipExitAnimation?.()){N(this.#r,!1),N(this.#i,void 0),this.#e.onComplete?.();return}if(e&&N(this.#r,!0),N(this.#i,e?`starting`:`ending`,!0),e&&(this.#o=window.requestAnimationFrame(()=>{this.#o=null,this.#e.open.current&&N(this.#i,void 0)})),!this.#t){e||N(this.#r,!1),N(this.#i,void 0),this.#e.onComplete?.();return}this.#n.run(()=>{e===this.#e.open.current&&(this.#e.open.current||N(this.#r,!1),N(this.#i,void 0),this.#e.onComplete?.())})})}get shouldRender(){return V(this.#r)}get transitionStatus(){return V(this.#i)}#s(){this.#o!==null&&(window.cancelAnimationFrame(this.#o),this.#o=null)}};function $(){}function Vs(e,t){return t===void 0?`bits-${e}`:`bits-${e}-${t}`}var Hs=Ns({component:`dialog`,parts:[`content`,`trigger`,`overlay`,`title`,`description`,`close`,`cancel`,`action`]}),Us=new es(`Dialog.Root | AlertDialog.Root`),Ws=class e{static create(t){let n=Us.getOr(null);return Us.set(new e(t,n))}opts;#e=M(null);get triggerNode(){return V(this.#e)}set triggerNode(e){N(this.#e,e,!0)}#t=M(null);get contentNode(){return V(this.#t)}set contentNode(e){N(this.#t,e,!0)}#n=M(null);get overlayNode(){return V(this.#n)}set overlayNode(e){N(this.#n,e,!0)}#r=M(null);get descriptionNode(){return V(this.#r)}set descriptionNode(e){N(this.#r,e,!0)}#i=M(void 0);get contentId(){return V(this.#i)}set contentId(e){N(this.#i,e,!0)}#a=M(void 0);get titleId(){return V(this.#a)}set titleId(e){N(this.#a,e,!0)}#o=M(void 0);get triggerId(){return V(this.#o)}set triggerId(e){N(this.#o,e,!0)}#s=M(void 0);get descriptionId(){return V(this.#s)}set descriptionId(e){N(this.#s,e,!0)}#c=M(null);get cancelNode(){return V(this.#c)}set cancelNode(e){N(this.#c,e,!0)}#l=M(0);get nestedOpenCount(){return V(this.#l)}set nestedOpenCount(e){N(this.#l,e,!0)}depth;parent;contentPresence;overlayPresence;constructor(e,t){this.opts=e,this.parent=t,this.depth=t?t.depth+1:0,this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.contentPresence=new Bs({ref:Q(()=>this.contentNode),open:this.opts.open,enabled:!0,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new Bs({ref:Q(()=>this.overlayNode),open:this.opts.open,enabled:!0}),is(()=>this.opts.open.current,e=>{this.parent&&(e?this.parent.incrementNested():this.parent.decrementNested())},{lazy:!0}),ps(()=>{this.opts.open.current&&this.parent?.decrementNested()})}handleOpen(){this.opts.open.current||(this.opts.open.current=!0)}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}getBitsAttr=e=>Hs.getAttr(e,this.opts.variant.current);incrementNested(){this.nestedOpenCount++,this.parent?.incrementNested()}decrementNested(){this.nestedOpenCount!==0&&(this.nestedOpenCount--,this.parent?.decrementNested())}#u=A(()=>({"data-state":As(this.opts.open.current)}));get sharedProps(){return V(this.#u)}set sharedProps(e){N(this.#u,e)}},Gs=class e{static create(t){return new e(t,Us.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Os(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}onclick(e){this.opts.disabled.current||e.button>0||this.root.handleClose()}onkeydown(e){this.opts.disabled.current||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),this.root.handleClose())}#e=A(()=>({id:this.opts.id.current,[this.root.getBitsAttr(this.opts.variant.current)]:``,onclick:this.onclick,onkeydown:this.onkeydown,disabled:this.opts.disabled.current?!0:void 0,tabindex:0,...this.root.sharedProps,...this.attachment}));get props(){return V(this.#e)}set props(e){N(this.#e,e)}},Ks=class e{static create(t){return new e(t,Us.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.titleId=this.opts.id.current,this.attachment=Os(this.opts.ref),is.pre(()=>this.opts.id.current,e=>{this.root.titleId=e})}#e=A(()=>({id:this.opts.id.current,role:`heading`,"aria-level":this.opts.level.current,[this.root.getBitsAttr(`title`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return V(this.#e)}set props(e){N(this.#e,e)}},qs=class e{static create(t){return new e(t,Us.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.descriptionId=this.opts.id.current,this.attachment=Os(this.opts.ref,e=>{this.root.descriptionNode=e}),is.pre(()=>this.opts.id.current,e=>{this.root.descriptionId=e})}#e=A(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`description`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return V(this.#e)}set props(e){N(this.#e,e)}},Js=class e{static create(t){return new e(t,Us.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Os(this.opts.ref,e=>{this.root.contentNode=e,this.root.contentId=e?.id})}#e=A(()=>({open:this.root.opts.open.current}));get snippetProps(){return V(this.#e)}set snippetProps(e){N(this.#e,e)}#t=A(()=>({id:this.opts.id.current,role:this.root.opts.variant.current===`alert-dialog`?`alertdialog`:`dialog`,"aria-modal":`true`,"aria-describedby":this.root.descriptionId,"aria-labelledby":this.root.titleId,[this.root.getBitsAttr(`content`)]:``,style:{pointerEvents:`auto`,outline:this.root.opts.variant.current===`alert-dialog`?`none`:void 0,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount,contain:`layout style`},tabindex:this.root.opts.variant.current===`alert-dialog`?-1:void 0,"data-nested-open":ks(this.root.nestedOpenCount>0),"data-nested":ks(this.root.parent!==null),...js(this.root.contentPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return V(this.#t)}set props(e){N(this.#t,e)}get shouldRender(){return this.root.contentPresence.shouldRender}},Ys=class e{static create(t){return new e(t,Us.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Os(this.opts.ref,e=>this.root.overlayNode=e)}#e=A(()=>({open:this.root.opts.open.current}));get snippetProps(){return V(this.#e)}set snippetProps(e){N(this.#e,e)}#t=A(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`overlay`)]:``,style:{pointerEvents:`auto`,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount},"data-nested-open":ks(this.root.nestedOpenCount>0),"data-nested":ks(this.root.parent!==null),...js(this.root.overlayPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return V(this.#t)}set props(e){N(this.#t,e)}get shouldRender(){return this.root.overlayPresence.shouldRender}},Xs=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`level`]),Zs=H(`<div><!></div>`);function Qs(e,t){let n=si();D(t,!0);let r=Y(t,`id`,19,()=>Vs(n)),i=Y(t,`ref`,15,null),a=Y(t,`level`,3,2),o=ca(t,Xs),s=Ks.create({id:Q(()=>r()),level:Q(()=>a()),ref:Q(()=>i(),e=>i(e))}),c=A(()=>Xo(o,s.props));var l=U(),u=F(l),d=e=>{var n=U();J(F(n),()=>t.child,()=>({props:V(c)})),W(e,n)},p=e=>{var n=Zs();ea(n,()=>({...V(c)})),J(P(n),()=>t.children??f),T(n),W(e,n)};K(u,e=>{t.child?e(d):e(p,-1)}),W(e,l),O()}function $s(e,t){var n=U();hi(F(n),()=>t.children,e=>{var n=U();J(F(n),()=>t.children??f),W(e,n)}),W(e,n)}var ec=new es(`BitsConfig`);function tc(){let e=new nc(null,{});return ec.getOr(e).opts}var nc=class{opts;constructor(e,t){let n=rc(e,t);this.opts={defaultPortalTo:n(e=>e.defaultPortalTo),defaultLocale:n(e=>e.defaultLocale)}}};function rc(e,t){return n=>Q(()=>{let r=n(t)?.current;if(r!==void 0)return r;if(e!==null)return n(e.opts)?.current})}function ic(e,t){return n=>{let r=tc();return Q(()=>{let i=n();if(i!==void 0)return i;let a=e(r).current;return a===void 0?t:a})}}var ac=ic(e=>e.defaultPortalTo,`body`);function oc(e,t){D(t,!0);let n=ac(()=>t.to),r=rt(),i=A(a);function a(){if(!Ps||t.disabled)return null;let e=null;return e=typeof n.current==`string`?document.querySelector(n.current):n.current,e}let o;function s(){o&&=(fi(o),null)}is([()=>V(i),()=>t.disabled],([e,n])=>{if(!e||n){s();return}return o=ci($s,{target:e,props:{children:t.children},context:r}),()=>{s()}});var c=U(),l=F(c),u=e=>{var n=U();J(F(n),()=>t.children??f),W(e,n)};K(l,e=>{t.disabled&&e(u)}),W(e,c),O()}var sc=class{eventName;options;constructor(e,t={bubbles:!0,cancelable:!0}){this.eventName=e,this.options=t}createEvent(e){return new CustomEvent(this.eventName,{...this.options,detail:e})}dispatch(e,t){let n=this.createEvent(t);return e.dispatchEvent(n),n}listen(e,t,n){return Yr(e,this.eventName,e=>{t(e)},n)}};function cc(e,t=500){let n=null,r=(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)};return r.destroy=()=>{n!==null&&(clearTimeout(n),n=null)},r}function lc(e,t){return e===t||e.contains(t)}function uc(e){return e?.ownerDocument??document}function dc(e,t){let{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom}var fc=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`],pc=fc.join(`,`),mc=typeof Element>`u`,hc=mc?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,gc=!mc&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},_c=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):_c(e.parentNode))},vc=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},yc=function(e,t,n){if(_c(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(pc));return t&&hc.call(e,pc)&&r.unshift(e),r=r.filter(n),r},bc=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!_c(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=bc(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{hc.call(a,pc)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!_c(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=bc(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},xc=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},Sc=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||vc(e))&&!xc(e)?0:e.tabIndex},Cc=function(e,t){var n=Sc(e);return n<0&&t&&!xc(e)?0:n},wc=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Tc=function(e){return e.tagName===`INPUT`},Ec=function(e){return Tc(e)&&e.type===`hidden`},Dc=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},Oc=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},kc=function(e){if(!e.name)return!0;var t=e.form||gc(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=Oc(r,e.form);return!i||i===e},Ac=function(e){return Tc(e)&&e.type===`radio`},jc=function(e){return Ac(e)&&!kc(e)},Mc=function(e){var t=e&&gc(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=gc(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},Nc=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Pc=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=hc.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(hc.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=gc(e);if(o&&!o.shadowRoot&&r(o)===!0)return Nc(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(Mc(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return Nc(e);return!1},Fc=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return hc.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Ic=function(e,t){return!(t.disabled||Ec(t)||Pc(t,e)||Dc(t)||Fc(t))},Lc=function(e,t){return!(jc(t)||Sc(t)<0||!Ic(e,t))},Rc=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},zc=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=Cc(a,i),s=i?zc(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(wc).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Bc=function(e,t){return t||={},zc(t.getShadowRoot?bc([e],t.includeContainer,{filter:Lc.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Rc}):yc(e,t.includeContainer,Lc.bind(null,t)))},Vc=function(e,t){return t||={},t.getShadowRoot?bc([e],t.includeContainer,{filter:Ic.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):yc(e,t.includeContainer,Ic.bind(null,t))},Hc=fc.concat(`iframe:not([inert]):not([inert] *)`).join(`,`),Uc=function(e,t){if(t||={},!e)throw Error(`No node provided`);return hc.call(e,Hc)===!1?!1:Ic(t,e)},Wc=`data-context-menu-trigger`,Gc=`data-context-menu-content`;new es(`Menu.Root`),new es(`Menu.Root | Menu.Sub`),new es(`Menu.Content`),new es(`Menu.Group | Menu.RadioGroup`),new es(`Menu.RadioGroup`),new es(`Menu.CheckboxGroup`),new sc(`bitsmenuopen`,{bubbles:!1,cancelable:!0}),Ns({component:`menu`,parts:[`trigger`,`content`,`sub-trigger`,`item`,`group`,`group-heading`,`checkbox-group`,`checkbox-item`,`radio-group`,`radio-item`,`separator`,`sub-content`,`arrow`]}),globalThis.bitsDismissableLayers??=new Map;var Kc=class e{static create(t){return new e(t)}opts;#e;#t;#n={pointerdown:!1};#r=!1;#i=!1;#a=void 0;#o;#s=$;constructor(e){this.opts=e,this.#t=e.interactOutsideBehavior,this.#e=e.onInteractOutside,this.#o=e.onFocusOutside,zn(()=>{this.#a=uc(this.opts.ref.current)});let t=$,n=()=>{this.#g(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),t()};is([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(!(!this.opts.enabled.current||!this.opts.ref.current))return ms(1,()=>{this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,this.#t),t(),t=this.#l())}),n}),ps(()=>{this.#g.destroy(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),this.#s(),t()})}#c=e=>{e.defaultPrevented||this.opts.ref.current&&hs(()=>{!this.opts.ref.current||this.#h(e.target)||e.target&&!this.#i&&this.#o.current?.(e)})};#l(){return Uo(Yr(this.#a,`pointerdown`,Uo(this.#f,this.#m),{capture:!0}),Yr(this.#a,`pointerdown`,Uo(this.#p,this.#d)),Yr(this.#a,`focusin`,this.#c))}#u=e=>{let t=e;t.defaultPrevented&&(t=Xc(e)),this.#e.current(e)};#d=cc(e=>{if(!this.opts.ref.current){this.#s();return}let t=this.opts.isValidEvent.current(e,this.opts.ref.current)||Yc(e,this.opts.ref.current);if(!this.#r||this.#_()||!t){this.#s();return}let n=e;if(n.defaultPrevented&&(n=Xc(n)),this.#t.current!==`close`&&this.#t.current!==`defer-otherwise-close`){this.#s();return}e.pointerType===`touch`?(this.#s(),this.#s=Yr(this.#a,`click`,this.#u,{once:!0})):this.#e.current(n)},10);#f=e=>{this.#n[e.type]=!0};#p=e=>{this.#n[e.type]=!1};#m=()=>{this.opts.ref.current&&(this.#r=Jc(this.opts.ref.current))};#h=e=>this.opts.ref.current?lc(this.opts.ref.current,e):!1;#g=cc(()=>{for(let e in this.#n)this.#n[e]=!1;this.#r=!1},20);#_(){return Object.values(this.#n).some(Boolean)}#v=()=>{this.#i=!0};#y=()=>{this.#i=!1};props={onfocuscapture:this.#v,onblurcapture:this.#y}};function qc(e=[...globalThis.bitsDismissableLayers]){return e.findLast(([e,{current:t}])=>t===`close`||t===`ignore`)}function Jc(e){let t=[...globalThis.bitsDismissableLayers],n=qc(t);if(n)return n[0].opts.ref.current===e;let[r]=t[0];return r.opts.ref.current===e}function Yc(e,t){let n=e.target;if(!Rs(n))return!1;let r=!!n.closest(`[${Wc}]`),i=!!t.closest(`[${Gc}]`);return`button`in e&&e.button>0&&!r?!1:`button`in e&&e.button===0&&r&&i?!0:r&&i?!1:uc(n).documentElement.contains(n)&&!lc(t,n)&&dc(e,t)}function Xc(e){let t=e.currentTarget,n=e.target,r;r=e instanceof PointerEvent?new PointerEvent(e.type,e):new PointerEvent(`pointerdown`,e);let i=!1;return new Proxy(r,{get:(r,a)=>a===`currentTarget`?t:a===`target`?n:a===`preventDefault`?()=>{i=!0,typeof r.preventDefault==`function`&&r.preventDefault()}:a===`defaultPrevented`?i:a in r?r[a]:e[a]})}function Zc(e,t){D(t,!0);let n=Y(t,`interactOutsideBehavior`,3,`close`),r=Y(t,`onInteractOutside`,3,$),i=Y(t,`onFocusOutside`,3,$),a=Y(t,`isValidEvent`,3,()=>!1),o=Kc.create({id:Q(()=>t.id),interactOutsideBehavior:Q(()=>n()),onInteractOutside:Q(()=>r()),enabled:Q(()=>t.enabled),onFocusOutside:Q(()=>i()),isValidEvent:Q(()=>a()),ref:t.ref});var s=U();J(F(s),()=>t.children??f,()=>({props:o.props})),W(e,s),O()}globalThis.bitsEscapeLayers??=new Map;var Qc=class e{static create(t){return new e(t)}opts;domContext;constructor(e){this.opts=e,this.domContext=new Ds(this.opts.ref);let t=$;is(()=>e.enabled.current,n=>(n&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),t=this.#e()),()=>{t(),globalThis.bitsEscapeLayers.delete(this)}))}#e=()=>Yr(this.domContext.getDocument(),`keydown`,this.#t,{passive:!1});#t=e=>{if(e.key!==`Escape`||!$c(this))return;let t=new KeyboardEvent(e.type,e);e.preventDefault();let n=this.opts.escapeKeydownBehavior.current;n!==`close`&&n!==`defer-otherwise-close`||this.opts.onEscapeKeydown.current(t)}};function $c(e){let t=[...globalThis.bitsEscapeLayers],n=t.findLast(([e,{current:t}])=>t===`close`||t===`ignore`);if(n)return n[0]===e;let[r]=t[0];return r===e}function el(e,t){D(t,!0);let n=Y(t,`escapeKeydownBehavior`,3,`close`),r=Y(t,`onEscapeKeydown`,3,$);Qc.create({escapeKeydownBehavior:Q(()=>n()),onEscapeKeydown:Q(()=>r()),enabled:Q(()=>t.enabled),ref:t.ref});var i=U();J(F(i),()=>t.children??f),W(e,i),O()}var tl=class e{static instance;#e=ho([]);#t=new WeakMap;#n=new WeakMap;static getInstance(){return this.instance||=new e,this.instance}register(e){let t=this.getActive();t&&t!==e&&t.pause();let n=document.activeElement;n&&n!==document.body&&this.#n.set(e,n),this.#e.current=this.#e.current.filter(t=>t!==e),this.#e.current.unshift(e)}unregister(e){this.#e.current=this.#e.current.filter(t=>t!==e);let t=this.getActive();t&&t.resume()}getActive(){return this.#e.current[0]}setFocusMemory(e,t){this.#t.set(e,t)}getFocusMemory(e){return this.#t.get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,t){this.#n.set(e,t)}getPreFocusMemory(e){return this.#n.get(e)}clearPreFocusMemory(e){this.#n.delete(e)}},nl=class e{#e=!1;#t=null;#n=tl.getInstance();#r=[];#i;constructor(e){this.#i=e}get paused(){return this.#e}pause(){this.#e=!0}resume(){this.#e=!1}#a(){for(let e of this.#r)e();this.#r=[]}mount(e){this.#t&&this.unmount(),this.#t=e,this.#n.register(this),this.#c(),this.#o()}unmount(){this.#t&&=(this.#a(),this.#s(),this.#n.unregister(this),this.#n.clearPreFocusMemory(this),null)}#o(){if(!this.#t)return;let e=new CustomEvent(`focusScope.onOpenAutoFocus`,{bubbles:!1,cancelable:!0});this.#i.onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!this.#t)return;let e=this.#u();e?(e.focus(),this.#n.setFocusMemory(this,e)):this.#t.focus()})}#s(){let e=new CustomEvent(`focusScope.onCloseAutoFocus`,{bubbles:!1,cancelable:!0});if(this.#i.onCloseAutoFocus.current?.(e),!e.defaultPrevented){let e=this.#n.getPreFocusMemory(this);if(e&&document.contains(e))try{e.focus()}catch{document.body.focus()}}}#c(){if(!this.#t||!this.#i.trap.current)return;let e=this.#t,t=e.ownerDocument;this.#r.push(Yr(t,`focusin`,t=>{if(this.#e||!this.#n.isActiveScope(this))return;let n=t.target;if(n)if(e.contains(n))this.#n.setFocusMemory(this,n);else{let n=this.#n.getFocusMemory(this);if(n&&e.contains(n)&&Uc(n))t.preventDefault(),n.focus();else{let t=this.#u(),n=this.#d()[0];(t||n||e).focus()}}},{capture:!0}),Yr(e,`keydown`,e=>{if(!this.#i.loop||this.#e||e.key!==`Tab`||!this.#n.isActiveScope(this))return;let n=this.#l();if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&t.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&t.activeElement===r&&(e.preventDefault(),i.focus())}));let n=new MutationObserver(()=>{let t=this.#n.getFocusMemory(this);if(t&&!e.contains(t)){let t=this.#u(),n=this.#d()[0],r=t||n;r?(r.focus(),this.#n.setFocusMemory(this,r)):e.focus()}});n.observe(e,{childList:!0,subtree:!0}),this.#r.push(()=>n.disconnect())}#l(){return this.#t?Bc(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}#u(){return this.#l()[0]||null}#d(){return this.#t?Vc(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}static use(t){let n=null;return is([()=>t.ref.current,()=>t.enabled.current],([r,i])=>{r&&i?(n||=new e(t),n.mount(r)):n&&=(n.unmount(),null)}),ps(()=>{n?.unmount()}),{get props(){return{tabindex:-1}}}}};function rl(e,t){D(t,!0);let n=Y(t,`enabled`,3,!1),r=Y(t,`trapFocus`,3,!1),i=Y(t,`loop`,3,!1),a=Y(t,`onCloseAutoFocus`,3,$),o=Y(t,`onOpenAutoFocus`,3,$),s=nl.use({enabled:Q(()=>n()),trap:Q(()=>r()),loop:i(),onCloseAutoFocus:Q(()=>a()),onOpenAutoFocus:Q(()=>o()),ref:t.ref});var c=U();J(F(c),()=>t.focusScope??f,()=>({props:s.props})),W(e,c),O()}var il=()=>{};globalThis.bitsTextSelectionLayers??=new Map;var al=class e{static create(t){return new e(t)}opts;domContext;#e=$;#t=!1;#n=il;#r=il;constructor(e){this.opts=e,this.domContext=new Ds(e.ref);let t=$;is(()=>[this.opts.enabled.current,this.opts.onPointerDown.current,this.opts.onPointerUp.current],([e,n,r])=>(this.#t=e,this.#n=n,this.#r=r,e&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),t(),t=this.#i()),()=>{this.#t=!1,t(),this.#s(),globalThis.bitsTextSelectionLayers.delete(this)}))}#i(){return Uo(Yr(this.domContext.getDocument(),`pointerdown`,this.#o),Yr(this.domContext.getDocument(),`pointerup`,go(this.#s,this.#a)))}#a=e=>{this.#r(e)};#o=e=>{let t=this.opts.ref.current,n=e.target;!Ls(t)||!Ls(n)||!this.#t||!ll(this)||!ws(t,n)||(this.#n(e),!e.defaultPrevented&&(this.#e=sl(t,this.domContext.getDocument().body)))};#s=()=>{this.#e(),this.#e=$}},ol=e=>e.style.userSelect||e.style.webkitUserSelect;function sl(e,t){let n=ol(t),r=ol(e);return cl(t,`none`),cl(e,`text`),()=>{cl(t,n),cl(e,r)}}function cl(e,t){e.style.userSelect=t,e.style.webkitUserSelect=t}function ll(e){let t=[...globalThis.bitsTextSelectionLayers];if(!t.length)return!1;let n=t.at(-1);return n?n[0]===e:!1}function ul(e,t){D(t,!0);let n=Y(t,`preventOverflowTextSelection`,3,!0),r=Y(t,`onPointerDown`,3,$),i=Y(t,`onPointerUp`,3,$);al.create({id:Q(()=>t.id),onPointerDown:Q(()=>r()),onPointerUp:Q(()=>i()),enabled:Q(()=>t.enabled&&n()),ref:t.ref});var a=U();J(F(a),()=>t.children??f),W(e,a),O()}globalThis.bitsIdCounter??={current:0};function dl(e=`bits`){return globalThis.bitsIdCounter.current++,`${e}-${globalThis.bitsIdCounter.current}`}var fl=class{#e;#t=0;#n=M();#r;constructor(e){this.#e=e}#i(){--this.#t,this.#r&&this.#t<=0&&(this.#r(),N(this.#n,void 0),this.#r=void 0)}get(...e){return this.#t+=1,V(this.#n)===void 0&&(this.#r=Hn(()=>{N(this.#n,this.#e(...e),!0)})),zn(()=>()=>{this.#i()}),V(this.#n)}},pl=new $o,ml=M(null),hl=null,gl=null,_l=!1,vl=Q(()=>{for(let e of pl.values())if(e)return!0;return!1}),yl=null,bl=new fl(()=>{function e(){document.body.setAttribute(`style`,V(ml)??``),document.body.style.removeProperty(`--scrollbar-width`),Fs&&hl?.(),N(ml,null)}function t(){gl!==null&&(window.clearTimeout(gl),gl=null)}function n(e,n){t(),_l=!0,yl=Date.now();let r=yl,i=()=>{gl=null,yl===r&&(Sl(pl)?_l=!1:(_l=!1,n()))},a=e===null?24:e;gl=window.setTimeout(i,a)}function r(){V(ml)===null&&pl.size===0&&!_l&&N(ml,document.body.getAttribute(`style`),!0)}return is(()=>vl.current,()=>{if(!vl.current)return;r(),_l=!1;let e=getComputedStyle(document.documentElement),t=getComputedStyle(document.body),n=e.scrollbarGutter?.includes(`stable`)||t.scrollbarGutter?.includes(`stable`),i=window.innerWidth-document.documentElement.clientWidth,a={padding:Number.parseInt(t.paddingRight??`0`,10)+i,margin:Number.parseInt(t.marginRight??`0`,10)};i>0&&!n&&(document.body.style.paddingRight=`${a.padding}px`,document.body.style.marginRight=`${a.margin}px`,document.body.style.setProperty(`--scrollbar-width`,`${i}px`)),document.body.style.overflow=`hidden`,Fs&&(hl=Yr(document,`touchmove`,e=>{e.target===document.documentElement&&(e.touches.length>1||e.preventDefault())},{passive:!1})),hs(()=>{document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`})}),ps(()=>()=>{hl?.()}),{get lockMap(){return pl},resetBodyStyle:e,scheduleCleanupIfNoNewLocks:n,cancelPendingCleanup:t,ensureInitialStyleCaptured:r}}),xl=class{#e=dl();#t;#n=()=>null;#r;locked;constructor(e,t=()=>null){this.#t=e,this.#n=t,this.#r=bl.get(),this.#r&&(this.#r.cancelPendingCleanup(),this.#r.ensureInitialStyleCaptured(),this.#r.lockMap.set(this.#e,this.#t??!1),this.locked=Q(()=>this.#r.lockMap.get(this.#e)??!1,e=>this.#r.lockMap.set(this.#e,e)),ps(()=>{if(this.#r.lockMap.delete(this.#e),Sl(this.#r.lockMap))return;let e=this.#n();this.#r.scheduleCleanupIfNoNewLocks(e,()=>{this.#r.resetBodyStyle()})}))}};function Sl(e){for(let[t,n]of e)if(n)return!0;return!1}function Cl(e,t){D(t,!0);let n=Y(t,`preventScroll`,3,!0),r=Y(t,`restoreScrollDelay`,3,null);n()&&new xl(n(),()=>r()),O()}var wl=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`forceMount`,`child`,`children`,`ref`]),Tl=H(`<div><!></div>`);function El(e,t){let n=si();D(t,!0);let r=Y(t,`id`,19,()=>Vs(n)),i=Y(t,`forceMount`,3,!1),a=Y(t,`ref`,15,null),o=ca(t,wl),s=Ys.create({id:Q(()=>r()),ref:Q(()=>a(),e=>a(e))}),c=A(()=>Xo(o,s.props));var l=U(),u=F(l),d=e=>{var n=U(),r=F(n),i=e=>{var n=U(),r=F(n);{let e=A(()=>({props:Xo(V(c)),...s.snippetProps}));J(r,()=>t.child,()=>V(e))}W(e,n)},a=e=>{var n=Tl();ea(n,e=>({...e}),[()=>Xo(V(c))]),J(P(n),()=>t.children??f,()=>s.snippetProps),T(n),W(e,n)};K(r,e=>{t.child?e(i):e(a,-1)}),W(e,n)};K(u,e=>{(s.shouldRender||i())&&e(d)}),W(e,l),O()}var Dl=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`]),Ol=H(`<div><!></div>`);function kl(e,t){let n=si();D(t,!0);let r=Y(t,`id`,19,()=>Vs(n)),i=Y(t,`ref`,15,null),a=ca(t,Dl),o=qs.create({id:Q(()=>r()),ref:Q(()=>i(),e=>i(e))}),s=A(()=>Xo(a,o.props));var c=U(),l=F(c),u=e=>{var n=U();J(F(n),()=>t.child,()=>({props:V(s)})),W(e,n)},d=e=>{var n=Ol();ea(n,()=>({...V(s)})),J(P(n),()=>t.children??f),T(n),W(e,n)};K(l,e=>{t.child?e(u):e(d,-1)}),W(e,c),O()}function Al(e,t){D(t,!0);let n=Y(t,`open`,15,!1),r=Y(t,`onOpenChange`,3,$),i=Y(t,`onOpenChangeComplete`,3,$);Ws.create({variant:Q(()=>`dialog`),open:Q(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:Q(()=>i())});var a=U();J(F(a),()=>t.children??f),W(e,a),O()}var jl=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),Ml=H(`<button><!></button>`);function Nl(e,t){let n=si();D(t,!0);let r=Y(t,`id`,19,()=>Vs(n)),i=Y(t,`ref`,15,null),a=Y(t,`disabled`,3,!1),o=ca(t,jl),s=Gs.create({variant:Q(()=>`close`),id:Q(()=>r()),ref:Q(()=>i(),e=>i(e)),disabled:Q(()=>!!a())}),c=A(()=>Xo(o,s.props));var l=U(),u=F(l),d=e=>{var n=U();J(F(n),()=>t.child,()=>({props:V(c)})),W(e,n)},p=e=>{var n=Ml();ea(n,()=>({...V(c)})),J(P(n),()=>t.children??f),T(n),W(e,n)};K(u,e=>{t.child?e(d):e(p,-1)}),W(e,l),O()}var Pl=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),Fl=H(`<!> <!>`,1),Il=H(`<!> <div><!></div>`,1);function Ll(e,t){let n=si();D(t,!0);let r=Y(t,`id`,19,()=>Vs(n)),i=Y(t,`ref`,15,null),a=Y(t,`forceMount`,3,!1),o=Y(t,`onCloseAutoFocus`,3,$),s=Y(t,`onOpenAutoFocus`,3,$),c=Y(t,`onEscapeKeydown`,3,$),l=Y(t,`onInteractOutside`,3,$),u=Y(t,`trapFocus`,3,!0),d=Y(t,`preventScroll`,3,!0),p=Y(t,`restoreScrollDelay`,3,null),m=ca(t,Pl),h=Js.create({id:Q(()=>r()),ref:Q(()=>i(),e=>i(e))}),g=A(()=>Xo(m,h.props));var _=U(),v=F(_),y=e=>{rl(e,{get ref(){return h.opts.ref},loop:!0,get trapFocus(){return u()},get enabled(){return h.root.opts.open.current},get onOpenAutoFocus(){return s()},get onCloseAutoFocus(){return o()},focusScope:(e,n)=>{let r=()=>n?.().props;el(e,ua(()=>V(g),{get enabled(){return h.root.opts.open.current},get ref(){return h.opts.ref},onEscapeKeydown:e=>{c()(e),!e.defaultPrevented&&h.root.handleClose()},children:(e,n)=>{Zc(e,ua(()=>V(g),{get ref(){return h.opts.ref},get enabled(){return h.root.opts.open.current},onInteractOutside:e=>{l()(e),!e.defaultPrevented&&h.root.handleClose()},children:(e,n)=>{ul(e,ua(()=>V(g),{get ref(){return h.opts.ref},get enabled(){return h.root.opts.open.current},children:(e,n)=>{var i=U(),a=F(i),o=e=>{var n=Fl(),i=F(n),a=e=>{Cl(e,{get preventScroll(){return d()},get restoreScrollDelay(){return p()}})};K(i,e=>{h.root.opts.open.current&&e(a)});var o=I(i,2);{let e=A(()=>({props:Xo(V(g),r()),...h.snippetProps}));J(o,()=>t.child,()=>V(e))}W(e,n)},s=e=>{var n=Il(),i=F(n);Cl(i,{get preventScroll(){return d()}});var a=I(i,2);ea(a,e=>({...e}),[()=>Xo(V(g),r())]),J(P(a),()=>t.children??f),T(a),W(e,n)};K(a,e=>{t.child?e(o):e(s,-1)}),W(e,i)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};K(v,e=>{(h.shouldRender||a())&&e(y)}),W(e,_),O()}var Rl=H(`<button class="flex flex-col gap-1 text-left"><div class="flex items-center gap-2 font-mono text-sm"><span class="size-2 shrink-0 rounded-sm"></span> <span class="flex-1 truncate text-foreground"> </span> <span class="tabular-nums text-muted-foreground"> </span></div> <div class="h-1 overflow-hidden rounded-full bg-border"><div class="h-full"></div></div></button>`),zl=H(`<div class="text-sm text-muted-foreground">No projects tracked yet \u2014 run <code class="text-foreground">syn .</code></div>`),Bl=H(`<div class="flex max-h-[260px] flex-col gap-2 overflow-y-auto pr-1"></div>`),Vl=H(`<div class="flex flex-col gap-0.5 bg-card p-3"><span class="font-mono text-[10px] uppercase tracking-[0.1em] text-muted-foreground"> </span> <span class="font-mono text-sm text-foreground"> </span></div>`),Hl=H(`<!> <!> <div class="mt-4 grid grid-cols-2 gap-px overflow-hidden rounded-lg border bg-border"></div> <!>`,1),Ul=H(`<!> <!>`,1);function Wl(e,t){D(t,!0);let n=M(!1),r=M(null),i=A(()=>X.data?.projects??[]),a=A(()=>Math.max(1,...V(i).map(e=>e.total_turns)));function o(e){let t=(X.data?.recent_turns??[]).find(t=>t.project_path===e.path);return t?ma(t.ts):e.last_seen?ma(e.last_seen):`\u2014`}function s(e){return[[`Cost`,pa(e.estimated_cost_usd)],[`Turns`,Z(e.total_turns)],[`Input`,Z(e.total_input_tokens)],[`Output`,Z(e.total_output_tokens)],[`Cache R`,Z(e.total_cache_read)],[`Cache W`,Z(e.total_cache_create)],[`Blocks`,Z(e.blocked_count)],[`Last active`,o(e)]]}var c=Ul(),l=F(c);Qa(l,{title:`Projects`,meta:`by turns`,children:(e,t)=>{var o=Bl();q(o,21,()=>V(i),e=>e.path,(e,t)=>{var i=Rl(),o=P(i),s=P(o),c=I(s,2),l=P(c,!0);T(c);var u=I(c,2),d=P(u,!0);T(u),T(o);var f=I(o,2),p=P(f);T(f),T(i),L((e,n,r)=>{Ri(s,e),G(l,V(t).name),G(d,n),Ri(p,r)},[()=>`background:${ya(V(t).name)}`,()=>Z(V(t).total_turns),()=>`width:${V(t).total_turns/V(a)*100}%; background:${ya(V(t).name)}`]),Xr(`click`,i,()=>{N(r,V(t),!0),N(n,!0)}),W(e,i)},e=>{W(e,zl())}),T(o),W(e,o)},$$slots:{default:!0}}),Ti(I(l,2),()=>Al,(e,t)=>{t(e,{get open(){return V(n)},set open(e){N(n,e,!0)},children:(e,t)=>{var n=U();Ti(F(n),()=>oc,(e,t)=>{t(e,{children:(e,t)=>{var n=Ul(),i=F(n);Ti(i,()=>El,(e,t)=>{t(e,{class:`fixed inset-0 z-50 bg-black/60`})}),Ti(I(i,2),()=>Ll,(e,t)=>{t(e,{class:`fixed left-1/2 top-1/2 z-50 w-[min(440px,92vw)] -translate-x-1/2 -translate-y-1/2 rounded-xl border bg-card p-5 text-card-foreground shadow-2xl`,children:(e,t)=>{var n=U(),i=F(n),a=e=>{var t=Hl(),n=F(t);{let e=A(()=>`color:${ya(V(r).name)}`);Ti(n,()=>Qs,(t,n)=>{n(t,{class:`font-serif text-xl`,get style(){return V(e)},children:(e,t)=>{We();var n=oi();L(()=>G(n,V(r).name)),W(e,n)},$$slots:{default:!0}})})}var i=I(n,2);Ti(i,()=>kl,(e,t)=>{t(e,{class:`truncate font-mono text-xs text-muted-foreground`,children:(e,t)=>{We();var n=oi();L(()=>G(n,V(r).path)),W(e,n)},$$slots:{default:!0}})});var a=I(i,2);q(a,21,()=>s(V(r)),([e,t])=>e,(e,t)=>{var n=A(()=>h(V(t),2));let r=()=>V(n)[0],i=()=>V(n)[1];var a=Vl(),o=P(a),s=P(o,!0);T(o);var c=I(o,2),l=P(c,!0);T(c),T(a),L(()=>{G(s,r()),G(l,i())}),W(e,a)}),T(a),Ti(I(a,2),()=>Nl,(e,t)=>{t(e,{class:`mt-4 w-full rounded-md border py-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:(e,t)=>{We(),W(e,oi(`Close`))},$$slots:{default:!0}})}),W(e,t)};K(i,e=>{V(r)&&e(a)}),W(e,n)},$$slots:{default:!0}})}),W(e,n)},$$slots:{default:!0}})}),W(e,n)},$$slots:{default:!0}})}),W(e,c),O()}Zr([`click`]);var Gl=H(`<div class="flex items-baseline justify-between font-mono text-sm"><span class="text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span></div>`),Kl=H(`<div class="text-sm text-muted-foreground">No graph-tool calls yet.</div>`),ql=H(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">calls</span></div> <div class="flex flex-col gap-1.5"></div>`,1);function Jl(e,t){D(t,!0);let n=A(()=>{let e=X.data?.global?.tool_calls??{};return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,8)}),r=A(()=>X.data?.global?.total_tool_calls??0);Qa(e,{title:`Graph tools used`,meta:`all projects`,children:(e,t)=>{var i=ql(),a=F(i),o=P(a);We(),T(a);var s=I(a,2);q(s,21,()=>V(n),([e,t])=>e,(e,t)=>{var n=A(()=>h(V(t),2));let r=()=>V(n)[0],i=()=>V(n)[1];var a=Gl(),o=P(a),s=P(o,!0);T(o);var c=I(o,2),l=P(c,!0);T(c),T(a),L(()=>{G(s,r()),G(l,i())}),W(e,a)},e=>{W(e,Kl())}),T(s),L(e=>G(o,`${e??``} `),[()=>Z(V(r))]),W(e,i)},$$slots:{default:!0}}),O()}var Yl=H(`<tr class="border-t border-border/60"><td class="py-1.5 pr-2 text-muted-foreground"> </td><td class="max-w-[120px] truncate py-1.5 pr-2 text-foreground"> </td><td class="py-1.5 pr-2"><span class="inline-flex items-center gap-1.5 rounded px-1.5 py-0.5"><span class="size-1.5 rounded-sm"></span> </span></td><td class="py-1.5 pr-2 text-right tabular-nums text-foreground"> </td><td class="py-1.5 pr-2 text-right tabular-nums text-foreground"> </td><td class="py-1.5 pr-2 text-right tabular-nums text-muted-foreground"> </td><td class="py-1.5 text-right tabular-nums text-[var(--money)]"> </td></tr>`),Xl=H(`<tr><td colspan="7" class="py-6 text-center text-muted-foreground">No turns recorded yet.</td></tr>`),Zl=H(`<div class="flex items-center justify-end gap-3 pt-1 font-mono text-sm text-muted-foreground"><button class="rounded border px-2 py-1 disabled:opacity-40 enabled:hover:text-foreground">\u2039 Prev</button> <span> </span> <button class="rounded border px-2 py-1 disabled:opacity-40 enabled:hover:text-foreground">Next \u203A</button></div>`),Ql=H(`<div class="min-h-0 flex-1 overflow-x-auto"><table class="w-full border-collapse font-mono text-sm"><thead><tr class="text-left text-[10px] uppercase tracking-[0.1em] text-muted-foreground"><th class="py-1.5 pr-2 font-medium">Time</th><th class="py-1.5 pr-2 font-medium">Project</th><th class="py-1.5 pr-2 font-medium">Model</th><th class="py-1.5 pr-2 text-right font-medium">In</th><th class="py-1.5 pr-2 text-right font-medium">Out</th><th class="py-1.5 pr-2 text-right font-medium">Cache R/W</th><th class="py-1.5 text-right font-medium">Cost</th></tr></thead><tbody></tbody></table></div> <!>`,1);function $l(e,t){D(t,!0);let n=M(1),r=A(()=>X.data?.recent_turns??[]),i=A(()=>Math.max(1,Math.ceil(V(r).length/25)));zn(()=>{V(n)>V(i)&&N(n,V(i),!0)});let a=A(()=>V(r).slice((V(n)-1)*25,(V(n)-1)*25+25)),o=A(()=>V(r).length?(V(n)-1)*25+1:0),s=A(()=>Math.min(V(n)*25,V(r).length));{let t=A(()=>`showing ${V(o)}\u2013${V(s)} of ${V(r).length}`);Qa(e,{title:`Recent turns`,get meta(){return V(t)},children:(e,t)=>{var r=Ql(),o=F(r),s=P(o),c=I(P(s));q(c,21,()=>V(a),e=>e.ts+e.project_path+e.model,(e,t)=>{var n=Yl(),r=P(n),i=P(r,!0);T(r);var a=I(r),o=P(a,!0);T(a);var s=I(a),c=P(s),l=P(c),u=I(l);T(c),T(s);var d=I(s),f=P(d,!0);T(d);var p=I(d),m=P(p,!0);T(p);var h=I(p),g=P(h);T(h);var _=I(h),v=P(_,!0);T(_),T(n),L((e,n,r,s,d,p,h,_,y)=>{G(i,e),Qi(a,`title`,V(t).project_name),G(o,V(t).project_name),Ri(c,n),Ri(l,r),G(u,` ${s??``}`),G(f,d),G(m,p),G(g,`${h??``} / ${_??``}`),G(v,y)},[()=>ma(V(t).ts),()=>`color: var(--c-${ha(V(t).model)})`,()=>`background: var(--c-${ha(V(t).model)})`,()=>ga(V(t).model),()=>Z(V(t).input),()=>Z(V(t).output),()=>Z(V(t).cache_read),()=>Z(V(t).cache_create),()=>pa(V(t).cost_usd)]),W(e,n)},e=>{W(e,Xl())}),T(c),T(s),T(o);var l=I(o,2),u=e=>{var t=Zl(),r=P(t),a=I(r,2),o=P(a);T(a);var s=I(a,2);T(t),L(()=>{r.disabled=V(n)<=1,G(o,`page ${V(n)??``} of ${V(i)??``}`),s.disabled=V(n)>=V(i)}),Xr(`click`,r,()=>N(n,Math.max(1,V(n)-1),!0)),Xr(`click`,s,()=>N(n,Math.min(V(i),V(n)+1),!0)),W(e,t)};K(l,e=>{V(i)>1&&e(u)}),W(e,r)},$$slots:{default:!0}})}O()}Zr([`click`]);var eu=H(`<div class="font-mono text-xs text-muted-foreground" title="Codebase exploration via the terminal (rg / cat / find) \u2014 observe-only, not yet blocked"> <span> </span></div>`),tu=H(`<div class="flex items-baseline gap-2 font-mono text-xs"><span class="shrink-0 text-muted-foreground"> </span> <span> </span> <span class="truncate text-foreground/80"> </span></div>`),nu=H(`<div class="text-sm text-muted-foreground">No gate decisions yet.</div>`),ru=H(`<div class="mt-2 border-t border-border pt-2 text-[10px] uppercase tracking-wide text-muted-foreground">Terminal hunts (observe-only)</div> <!>`,1),iu=H(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">blocks</span></div> <!> <div class="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto"><!> <!></div>`,1);function au(e,t){D(t,!0);let n=A(()=>(X.data?.recent_gates??[]).slice(0,50)),r=A(()=>X.data?.global?.blocked_count??0),i=A(()=>X.data?.global?.bash_explorations??0),a=A(()=>X.data?.global?.bash_avoidable??0),o=A(()=>(X.data?.recent_bash??[]).slice(0,12));Qa(e,{title:`The Moat`,meta:`PreToolUse`,children:(e,t)=>{var s=iu(),c=F(s),l=P(c);We(),T(c);var u=I(c,2),d=e=>{var t=eu(),n=P(t),r=I(n),o=P(r);T(r),T(t),L((e,t)=>{G(n,`\u21B3 ${e??``} terminal hunts \xB7 `),Ii(r,1,Ai(V(a)>0?`text-destructive`:``)),G(o,`${t??``} the graph could answer`)},[()=>Z(V(i)),()=>Z(V(a))]),W(e,t)};K(u,e=>{V(i)>0&&e(d)});var f=I(u,2),p=P(f);q(p,17,()=>V(n),e=>e.ts+e.query,(e,t)=>{var n=tu(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a);var s=I(a,2),c=P(s,!0);T(s),T(n),L(e=>{G(i,e),Ii(a,1,`shrink-0 rounded px-1 text-[10px] uppercase `+(V(t).decision===`block`?`bg-destructive/15 text-destructive`:`bg-[var(--c-fable)]/12 text-[var(--c-fable)]`)),G(o,V(t).decision),Qi(s,`title`,V(t).query??``),G(c,V(t).query??`\u2014`)},[()=>ma(V(t).ts)]),W(e,n)},e=>{W(e,nu())});var m=I(p,2),h=e=>{var t=ru();q(I(F(t),2),17,()=>V(o),e=>e.ts+e.query,(e,t)=>{var n=tu(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a);var s=I(a,2),c=P(s,!0);T(s),T(n),L(e=>{G(i,e),Ii(a,1,`shrink-0 rounded px-1 text-[10px] uppercase `+(V(t).avoidable?`bg-destructive/15 text-destructive`:`bg-muted text-muted-foreground`)),G(o,V(t).tool),Qi(s,`title`,V(t).query??``),G(c,V(t).query??`\u2014`)},[()=>ma(V(t).ts)]),W(e,n)}),W(e,t)};K(m,e=>{V(o).length>0&&e(h)}),T(f),L(e=>G(l,`${e??``} `),[()=>Z(V(r))]),W(e,s)},$$slots:{default:!0}}),O()}var ou=H(`<div class="flex items-baseline justify-between gap-3 font-mono text-sm"><span class="truncate text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span></div>`),su=H(`<div class="text-sm text-muted-foreground">No usage learned yet \u2014 Synthra learns as you read/edit files.</div>`),cu=H(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">tracked</span></div> <div class="flex max-h-[190px] flex-col gap-1.5 overflow-y-auto"></div>`,1);function lu(e,t){D(t,!0);let n=A(()=>X.data?.active),r=A(()=>V(n)?.stats?.hot_files??[]);{let t=A(()=>V(n)?.project_name??`active project`);Qa(e,{title:`Hot files`,get meta(){return V(t)},children:(e,t)=>{var i=cu(),a=F(i),o=P(a);We(),T(a);var s=I(a,2);q(s,21,()=>V(r),e=>e.path,(e,t)=>{var n=ou(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a),T(n),L(e=>{Qi(n,`title`,V(t).path),G(i,e),G(o,V(t).score)},[()=>_a(V(t).path)]),W(e,n)},e=>{W(e,su())}),T(s),L(e=>G(o,`${e??``} `),[()=>Z(V(n)?.stats?.hot_files_total??0)]),W(e,i)},$$slots:{default:!0}})}O()}var uu=H(`<div class="grid grid-cols-1 gap-4 p-5 lg:grid-cols-3"><div class="lg:col-span-3 lg:row-start-1"><!></div> <div class="lg:col-start-1 lg:row-start-2"><!></div> <div class="lg:col-start-2 lg:row-start-2"><!></div> <div class="lg:col-start-1 lg:row-start-3"><!></div> <div class="lg:col-start-2 lg:row-start-3"><!></div> <div class="lg:col-start-1 lg:row-start-4"><!></div> <div class="lg:col-start-2 lg:row-start-4"><!></div> <div class="relative lg:col-start-3 lg:row-start-2 lg:row-span-3"><div class="lg:absolute lg:inset-0"><!></div></div> <div class="lg:col-span-3 lg:row-start-5"><!></div></div>`);function du(e){var t=uu(),n=P(t);Ja(P(n),{}),T(n);var r=I(n,2);eo(P(r),{}),T(r);var i=I(r,2);no(P(i),{}),T(i);var a=I(i,2);so(P(a),{}),T(a);var o=I(a,2);lu(P(o),{}),T(o);var s=I(o,2);Wl(P(s),{}),T(s);var c=I(s,2);Jl(P(c),{}),T(c);var l=I(c,2),u=P(l);au(P(u),{}),T(u),T(l);var d=I(l,2);$l(P(d),{}),T(d),T(t),W(e,t)}var fu=new Set([`$$slots`,`$$events`,`$$legacy`]);function pu(e,t){let n=ca(t,fu),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Ea(e,ua({name:`check`},()=>n,{get iconNode(){return r}}))}var mu=new Set([`$$slots`,`$$events`,`$$legacy`]);function hu(e,t){let n=ca(t,mu),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];Ea(e,ua({name:`copy`},()=>n,{get iconNode(){return r}}))}var gu=H(`<p> </p>`),_u=H(`<div class="break-all"><span class="text-foreground/70"> </span> </div>`),vu=H(`<div class="mt-1 flex flex-col gap-0.5 font-mono text-xs text-muted-foreground/80"></div>`),yu=H(`<div role="button" tabindex="0" class="flex cursor-pointer flex-col gap-1.5 rounded-lg border bg-card/55 p-3 text-left transition-colors hover:bg-card/85"><div class="flex items-center gap-1.5"><span class="min-w-0 truncate font-mono text-sm text-foreground"> </span> <button type="button" title="Copy name" class="inline-flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"><!></button> <span> </span></div> <!> <!></div>`);function bu(e,t){D(t,!0);let n=M(!1),r=M(!1),i,a=A(()=>t.item.scope===`plugin`?t.item.source??`plugin`:t.item.scope),o=A(()=>t.item.scope===`project`?`var(--c-fable)`:t.item.scope===`personal`?`var(--c-sonnet)`:`#9bc2ef`),s=A(()=>Object.entries(t.item.meta??{}));function c(){N(n,!V(n))}function l(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}async function u(e){e.stopPropagation();try{await navigator.clipboard.writeText(t.item.name),N(r,!0),clearTimeout(i),i=setTimeout(()=>N(r,!1),1200)}catch{}}var d=yu(),f=P(d),p=P(f),m=P(p,!0);T(p);var g=I(p,2),_=P(g),v=e=>{pu(e,{class:`size-3.5`,style:`color: var(--c-fable)`})},y=e=>{hu(e,{class:`size-3.5`})};K(_,e=>{V(r)?e(v):e(y,-1)}),T(g);var b=I(g,2);let ee;var x=P(b);T(b),T(f);var te=I(f,2),ne=e=>{var r=gu(),i=P(r,!0);T(r),L(()=>{Ii(r,1,`text-sm leading-snug text-muted-foreground `+(V(n)?``:`line-clamp-2`)),G(i,t.item.description)}),W(e,r)};K(te,e=>{t.item.description&&e(ne)});var re=I(te,2),ie=e=>{var t=vu();q(t,21,()=>V(s),([e,t])=>e,(e,t)=>{var n=A(()=>h(V(t),2));let r=()=>V(n)[0],i=()=>V(n)[1];var a=_u(),o=P(a),s=P(o);T(o);var c=I(o);T(a),L(()=>{G(s,`${r()??``}:`),G(c,` ${i()??``}`)}),W(e,a)}),T(t),W(e,t)};K(re,e=>{V(n)&&V(s).length&&e(ie)}),T(d),L(()=>{G(m,t.item.name),Qi(g,`aria-label`,`Copy "${t.item.name}"`),ee=Ii(b,1,`ml-auto shrink-0 rounded border px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wide`,null,ee,{"opacity-50":t.item.enabled===!1}),Ri(b,`color:${V(o)}; border-color:color-mix(in oklab, ${V(o)} 35%, transparent)`),G(x,`${V(a)??``}${t.item.enabled===!1?` \xB7 off`:``}`)}),Xr(`click`,d,c),Xr(`keydown`,d,l),Xr(`click`,g,u),W(e,d),O()}Zr([`click`,`keydown`]);var xu=H(`<span> </span>`),Su=H(`<button> <span class="opacity-60"> </span></button>`),Cu=H(`<div class="text-sm text-muted-foreground">Scanning your arsenal\u2026</div>`),wu=H(`<div class="text-sm text-muted-foreground"> </div>`),Tu=H(`<section class="flex flex-col gap-2"><div class="flex items-center gap-3 border-b border-border pb-1.5"><span class="size-1.5 shrink-0 rounded-sm"></span> <span class="font-mono text-xs uppercase tracking-[0.14em]"> </span> <span class="font-mono text-xs tracking-[0.1em] text-muted-foreground"> </span></div> <div class="grid grid-cols-1 items-start gap-2 md:grid-cols-2 2xl:grid-cols-3"></div></section>`),Eu=H(`<div class="flex flex-col gap-6"></div>`),Du=H(`<div class="flex h-full flex-col gap-4 p-5"><div class="flex flex-wrap items-center justify-between gap-3"><h1 class="font-serif text-2xl text-foreground">\u2694 Arsenal</h1> <div class="flex items-center gap-2 font-mono text-xs text-muted-foreground"><!> <button class="rounded border px-2 py-1 transition-colors hover:text-foreground">\u21BB Rescan</button></div></div> <div class="flex flex-wrap items-center gap-2"><!> <input placeholder="Filter by name or description\u2026" autocomplete="off" class="ml-auto w-full max-w-72 rounded-md border bg-card/60 px-3 py-1.5 text-sm outline-none transition-colors focus:border-ring"/></div> <!></div>`);function Ou(e,t){D(t,!0);let n=M(`skills`),r=M(``),i=A(()=>X.arsenal),a=[{id:`skills`,label:`Skills`},{id:`agents`,label:`Agents`},{id:`mcp`,label:`MCP`}],o=A(()=>{let e=V(i)?V(i)[V(n)]:[],t=V(r).toLowerCase().trim();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||(e.source??``).toLowerCase().includes(t)):e}),s=A(()=>{let e=new Map;for(let t of V(o)){let n=t.scope===`plugin`?`plugin:${t.source??`plugin`}`:t.scope,r=e.get(n);r||(r={label:t.scope===`plugin`?t.source??`plugin`:t.scope===`project`?`In this project`:`Personal \xB7 this machine`,scope:t.scope,items:[]},e.set(n,r)),r.items.push(t)}return[...e.values()]});function c(e){return e===`project`?`var(--c-fable)`:e===`personal`?`var(--c-sonnet)`:`#9bc2ef`}let l=A(()=>V(i)?new Date(V(i).scanned_at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``);var u=Du(),d=P(u),f=I(P(d),2),p=P(f),m=e=>{var t=xu(),n=P(t);T(t),L(()=>G(n,`${V(i).counts.plugins??``} plugins \xB7 scanned ${V(l)??``}`)),W(e,t)};K(p,e=>{V(i)&&e(m)});var h=I(p,2);T(f),T(d);var g=I(d,2),_=P(g);q(_,17,()=>a,e=>e.id,(e,t)=>{var r=Su(),a=P(r),o=I(a),s=P(o,!0);T(o),T(r),L(()=>{Ii(r,1,`rounded-lg px-3 py-1.5 font-mono text-xs transition-colors `+(V(n)===V(t).id?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`)),G(a,`${V(t).label??``} `),G(s,V(i)?.counts?.[V(t).id]??0)}),Xr(`click`,r,()=>N(n,V(t).id,!0)),W(e,r)});var v=I(_,2);Xi(v),T(g);var y=I(g,2),b=e=>{W(e,Cu())},ee=e=>{var t=wu(),n=P(t,!0);T(t),L(()=>G(n,V(r)?`No matches.`:`Nothing installed in this category.`)),W(e,t)},x=e=>{var t=Eu();q(t,21,()=>V(s),e=>e.label+e.scope,(e,t)=>{var n=Tu(),r=P(n),i=P(r),a=I(i,2),o=P(a,!0);T(a);var s=I(a,2),l=P(s,!0);T(s),T(r);var u=I(r,2);q(u,21,()=>V(t).items,e=>e.scope+(e.source??``)+e.name,(e,t)=>{bu(e,{get item(){return V(t)}})}),T(u),T(n),L((e,n)=>{Ri(i,e),Ri(a,n),G(o,V(t).label),G(l,V(t).items.length)},[()=>`background:${c(V(t).scope)}`,()=>`color:${c(V(t).scope)}`]),W(e,n)}),T(t),W(e,t)};K(y,e=>{X.arsenalLoading&&!V(i)?e(b):V(s).length?e(x,-1):e(ee,1)}),T(u),Xr(`click`,h,()=>X.loadArsenal(!0)),ia(v,()=>V(r),e=>N(r,e)),W(e,u),O()}Zr([`click`]);var ku=H(`<div class="flex items-baseline gap-3 text-sm"><code class="shrink-0 font-mono text-xs text-[var(--c-sonnet)]"> </code> <span class="text-muted-foreground"> </span></div>`),Au=H(`<div class="mt-1 flex flex-col gap-1"></div>`),ju=H(`<div class="flex flex-col gap-1.5 rounded-lg border bg-card/55 p-4"><code class="font-mono text-sm text-foreground"> </code> <p class="text-sm leading-snug text-muted-foreground"> </p> <!></div>`),Mu=H(`<div class="flex h-full flex-col gap-4 p-5"><div class="flex flex-wrap items-center justify-between gap-3"><h1 class="font-serif text-2xl text-foreground">\u276F Commands</h1> <span class="font-mono text-xs text-muted-foreground">all paths default to the current directory</span></div> <div class="flex max-w-3xl flex-col gap-2.5"></div> <p class="max-w-3xl font-mono text-xs leading-relaxed text-muted-foreground">Install: <code class="text-foreground">npm install -g @jefuriiij/synthra</code> \xB7 macOS/Linux hooks\n additionally need <code class="text-foreground">jq</code> (<code>brew install jq</code>) \u2014 without it\n the hooks silently no-op while the MCP tools keep working.</p></div>`);function Nu(e){let t=[{cmd:`syn . [path]`,desc:`The default flow: scan the project, start the MCP server + dashboard, install the hooks, and register the MCP entry for the IDE. Runs as a background service \u2014 Ctrl+C stops it.`,opts:[{flag:`--full`,desc:`Re-parse every file, ignoring the incremental parse cache`},{flag:`--launch-cli`,desc:"Also spawn the `claude` CLI in this terminal"},{flag:`--resume <id>`,desc:`Resume a Claude session (requires --launch-cli)`}]},{cmd:`syn scan [path]`,desc:`Scan only \u2014 walk the project, parse it into the symbol graph, and write it to .synthra-graph/. No servers, no hooks.`,opts:[{flag:`--full`,desc:`Re-parse every file, ignoring the incremental parse cache`}]},{cmd:`syn serve [path]`,desc:`Start the HTTP MCP server only, against an already-scanned project.`},{cmd:`syn dashboard [path]`,desc:`Run this dashboard as a standalone process (no graph required) \u2014 token spend, savings, the Moat, and your Arsenal across every registered project.`},{cmd:`syn doctor [path]`,desc:`Diagnose the setup: Node version, jq (required by the macOS/Linux hooks), the claude CLI, graph freshness, .mcp.json registration, policy version, and installed hooks. Run this first when something feels off.`},{cmd:`syn remove [path]`,desc:`Uninstall Synthra from a project: deletes .synthra-graph/ and .synthra/, strips the CLAUDE.md policy block, Synthra\'s .gitignore entries, and its hooks \u2014 your own content in those files always survives. Also deregisters MCP and removes the project from this dashboard. Shows a summary and asks [y/N] first.`,opts:[{flag:`--yes`,desc:`Skip the confirmation prompt (required when not in a terminal)`}]},{cmd:`syn --version`,desc:`Print the installed Synthra version.`}];var n=Mu(),r=I(P(n),2);q(r,5,()=>t,e=>e.cmd,(e,t)=>{var n=ju(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a);var s=I(a,2),c=e=>{var n=Au();q(n,5,()=>V(t).opts,e=>e.flag,(e,t)=>{var n=ku(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a),T(n),L(()=>{G(i,V(t).flag),G(o,V(t).desc)}),W(e,n)}),T(n),W(e,n)};K(s,e=>{V(t).opts?.length&&e(c)}),T(n),L(()=>{G(i,V(t).cmd),G(o,V(t).desc)}),W(e,n)}),T(r),We(2),T(n),W(e,n)}var Pu=H(`<details class="rounded-lg border bg-card/50 p-3"><summary class="cursor-pointer text-sm font-medium text-foreground"> </summary> <p class="mt-2 text-[13px] leading-relaxed text-muted-foreground"> </p></details>`),Fu=H(`<!> <!> <div class="mt-4 flex flex-col gap-2"></div> <!>`,1),Iu=H(`<!> <!>`,1);function Lu(e,t){D(t,!0);let n=Y(t,`open`,15,!1),r=[{q:`Where do these numbers come from?`,a:`Synthra\'s Stop hook reads Claude Code\'s transcript JSONL after each turn and logs token usage to .synthra-graph/token_log.jsonl. The gate logs to gate_log.jsonl, tool calls to tool_log.jsonl. The dashboard reads those \u2014 it never feeds back into retrieval.`},{q:`How is cost calculated?`,a:`Token counts \xD7 Anthropic\'s published per-model rates (in src/shared/pricing.ts), summed across input, output, cache-read and cache-write. These are API-equivalent estimates, not your plan billing \u2014 useful for comparing sessions.`},{q:`What is the savings floor?`,a:`Each time the Moat blocks an exploratory Grep/Glob, we credit a deliberately conservative 500 tokens \xD7 $3/M input rate. Real savings are usually higher (it ignores cache thrash and follow-up reads the block also prevents). It\'s a floor, not a guess.`},{q:`What is the Moat?`,a:`A PreToolUse hook that intercepts Grep/Glob and, when the graph has confident context, blocks them and hands back the exact graph_read targets + signatures \u2014 so the agent reads ~50-token slices instead of whole files.`},{q:`What is the Arsenal view?`,a:`A scan of every skill, subagent, and MCP server available to you \u2014 project, personal (~/.claude), and plugin \u2014 with descriptions, so you never have to drop to the CLI to recall what\'s installed. MCP entries show name/type/url only; auth tokens are never read.`},{q:`What\'s the codebase graph?`,a:`tree-sitter parses your project into a symbol graph (files, symbols, imports, call edges). graph_read returns a symbol\'s source plus its dependency surface; graph_continue packs a context bundle.`},{q:`Where is everything stored?`,a:`.synthra-graph/ (machine-local, gitignored) holds the graph + logs; .synthra/ (git-tracked) holds branch-aware memory. Nothing leaves your machine.`},{q:`Why is my bill not lower already?`,a:`Savings land only when the agent actually uses the cheap path. v0.4\u20130.6 push the answer to the point of use (block payloads, edit recipes, dependency footers); a real dogfood session on the latest version is the true test.`}];var i=U();Ti(F(i),()=>Al,(e,t)=>{t(e,{get open(){return n()},set open(e){n(e)},children:(e,t)=>{var n=U();Ti(F(n),()=>oc,(e,t)=>{t(e,{children:(e,t)=>{var n=Iu(),i=F(n);Ti(i,()=>El,(e,t)=>{t(e,{class:`fixed inset-0 z-50 bg-black/60`})}),Ti(I(i,2),()=>Ll,(e,t)=>{t(e,{class:`fixed left-1/2 top-1/2 z-50 max-h-[85vh] w-[min(640px,92vw)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl`,children:(e,t)=>{var n=Fu(),i=F(n);Ti(i,()=>Qs,(e,t)=>{t(e,{class:`font-serif text-2xl`,children:(e,t)=>{We(),W(e,oi(`FAQ`))},$$slots:{default:!0}})});var a=I(i,2);Ti(a,()=>kl,(e,t)=>{t(e,{class:`text-xs text-muted-foreground`,children:(e,t)=>{We(),W(e,oi(`Where every number on this dashboard comes from.`))},$$slots:{default:!0}})});var o=I(a,2);q(o,21,()=>r,e=>e.q,(e,t)=>{var n=Pu(),r=P(n),i=P(r,!0);T(r);var a=I(r,2),o=P(a,!0);T(a),T(n),L(()=>{G(i,V(t).q),G(o,V(t).a)}),W(e,n)}),T(o),Ti(I(o,2),()=>Nl,(e,t)=>{t(e,{class:`mt-4 w-full rounded-md border py-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:(e,t)=>{We(),W(e,oi(`Close`))},$$slots:{default:!0}})}),W(e,n)},$$slots:{default:!0}})}),W(e,n)},$$slots:{default:!0}})}),W(e,n)},$$slots:{default:!0}})}),W(e,i),O()}var Ru=H(`<div class="flex h-screen w-screen overflow-hidden"><!> <main class="min-w-0 flex-1 overflow-y-auto"><!></main></div> <!>`,1);function zu(e,t){D(t,!0);let n=M(!1);da(()=>(X.start(),()=>X.stop()));var r=Ru(),i=F(r),a=P(i);Ga(a,{onFaq:()=>N(n,!0)});var o=I(a,2),s=P(o),c=e=>{du(e,{})},l=e=>{Nu(e,{})},u=e=>{Ou(e,{})};K(s,e=>{X.view===`overview`?e(c):X.view===`commands`?e(l,1):e(u,-1)}),T(o),T(i),Lu(I(i,2),{get open(){return V(n)},set open(e){N(n,e,!0)}}),W(e,r),O()}var Bu=document.getElementById(`app`);if(!Bu)throw Error(`missing #app mount node`);ci(zu,{target:Bu});</script>\n <style rel="stylesheet" crossorigin>/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border)}html,body{height:100%}body{background:radial-gradient(1200px 800px at 14% 16%, #2c5db81f, transparent 60%), var(--background);color:var(--foreground);font-family:var(--font-sans);-webkit-font-smoothing:antialiased}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:999px}::-webkit-scrollbar-track{background:0 0}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-1\\/2{top:50%}.left-1\\/2{left:50%}.z-50{z-index:50}.my-1{margin-block:var(--spacing)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-\\[116px\\]{width:116px;height:116px}.size-full{width:100%;height:100%}.h-1{height:var(--spacing)}.h-2{height:calc(var(--spacing) * 2)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\\[85vh\\]{max-height:85vh}.max-h-\\[190px\\]{max-height:190px}.max-h-\\[260px\\]{max-height:260px}.min-h-0{min-height:0}.w-9{width:calc(var(--spacing) * 9)}.w-\\[64px\\]{width:64px}.w-\\[248px\\]{width:248px}.w-\\[min\\(440px\\,92vw\\)\\]{width:min(440px,92vw)}.w-\\[min\\(640px\\,92vw\\)\\]{width:min(640px,92vw)}.w-full{width:100%}.w-screen{width:100vw}.max-w-3xl{max-width:var(--container-3xl)}.max-w-72{max-width:calc(var(--spacing) * 72)}.max-w-\\[120px\\]{max-width:120px}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-px{gap:1px}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border,.border-border\\/60{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\/60{border-color:color-mix(in oklab, var(--border) 60%, transparent)}}.border-sidebar-border{border-color:var(--sidebar-border)}.bg-\\[var\\(--c-fable\\)\\],.bg-\\[var\\(--c-fable\\)\\]\\/12{background-color:var(--c-fable)}@supports (color:color-mix(in lab, red, red)){.bg-\\[var\\(--c-fable\\)\\]\\/12{background-color:color-mix(in oklab, var(--c-fable) 12%, transparent)}}.bg-\\[var\\(--money\\)\\]{background-color:var(--money)}.bg-accent{background-color:var(--accent)}.bg-black\\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-border{background-color:var(--border)}.bg-card,.bg-card\\/50{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/50{background-color:color-mix(in oklab, var(--card) 50%, transparent)}}.bg-card\\/55{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/55{background-color:color-mix(in oklab, var(--card) 55%, transparent)}}.bg-card\\/60{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/60{background-color:color-mix(in oklab, var(--card) 60%, transparent)}}.bg-card\\/70{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/70{background-color:color-mix(in oklab, var(--card) 70%, transparent)}}.bg-destructive,.bg-destructive\\/15{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\/15{background-color:color-mix(in oklab, var(--destructive) 15%, transparent)}}.bg-muted{background-color:var(--muted)}.bg-muted-foreground,.bg-muted-foreground\\/40{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\\/40{background-color:color-mix(in oklab, var(--muted-foreground) 40%, transparent)}}.bg-primary\\/90{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\\/90{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-accent,.bg-sidebar-accent\\/40{background-color:var(--sidebar-accent)}@supports (color:color-mix(in lab, red, red)){.bg-sidebar-accent\\/40{background-color:color-mix(in oklab, var(--sidebar-accent) 40%, transparent)}}.bg-sidebar-border{background-color:var(--sidebar-border)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-serif{font-family:var(--font-serif)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[13px\\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.12em\\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\\[0\\.14em\\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\\[0\\.18em\\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.text-\\[var\\(--c-fable\\)\\]{color:var(--c-fable)}.text-\\[var\\(--c-sonnet\\)\\]{color:var(--c-sonnet)}.text-\\[var\\(--money\\)\\]{color:var(--money)}.text-accent-foreground{color:var(--accent-foreground)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-foreground,.text-foreground\\/70{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\/70{color:color-mix(in oklab, var(--foreground) 70%, transparent)}}.text-foreground\\/80{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\/80{color:color-mix(in oklab, var(--foreground) 80%, transparent)}}.text-muted-foreground,.text-muted-foreground\\/60{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\/60{color:color-mix(in oklab, var(--muted-foreground) 60%, transparent)}}.text-muted-foreground\\/80{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\/80{color:color-mix(in oklab, var(--muted-foreground) 80%, transparent)}}.text-primary-foreground{color:var(--primary-foreground)}.text-sidebar-accent-foreground{color:var(--sidebar-accent-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\\/60{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\\/60{color:color-mix(in oklab, var(--sidebar-foreground) 60%, transparent)}}.text-sidebar-foreground\\/75{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\\/75{color:color-mix(in oklab, var(--sidebar-foreground) 75%, transparent)}}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-card\\/80:hover{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-card\\/80:hover{background-color:color-mix(in oklab, var(--card) 80%, transparent)}}.hover\\:bg-card\\/85:hover{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-card\\/85:hover{background-color:color-mix(in oklab, var(--card) 85%, transparent)}}.hover\\:bg-sidebar-accent\\/50:hover{background-color:var(--sidebar-accent)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-sidebar-accent\\/50:hover{background-color:color-mix(in oklab, var(--sidebar-accent) 50%, transparent)}}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:text-sidebar-foreground:hover{color:var(--sidebar-foreground)}}.focus\\:border-ring:focus{border-color:var(--ring)}@media (hover:hover){.enabled\\:hover\\:text-foreground:enabled:hover{color:var(--foreground)}}.disabled\\:opacity-40:disabled{opacity:.4}@media (width>=40rem){.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width>=64rem){.lg\\:absolute{position:absolute}.lg\\:inset-0{inset:0}.lg\\:col-span-3{grid-column:span 3/span 3}.lg\\:col-start-1{grid-column-start:1}.lg\\:col-start-2{grid-column-start:2}.lg\\:col-start-3{grid-column-start:3}.lg\\:row-span-3{grid-row:span 3/span 3}.lg\\:row-start-1{grid-row-start:1}.lg\\:row-start-2{grid-row-start:2}.lg\\:row-start-3{grid-row-start:3}.lg\\:row-start-4{grid-row-start:4}.lg\\:row-start-5{grid-row-start:5}.lg\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (width>=96rem){.\\32 xl\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}:root{--radius:.75rem;--background:#04081a;--foreground:#ecf2fb;--card:#0a1733;--card-foreground:#ecf2fb;--popover:#0a1733;--popover-foreground:#ecf2fb;--primary:#2c5db8;--primary-foreground:#f4f7fc;--secondary:#122549;--secondary-foreground:#d7e6f7;--muted:#102146;--muted-foreground:#8ba0c2;--accent:#1b3a78;--accent-foreground:#ecf2fb;--destructive:#ff5d5d;--destructive-foreground:#fff5f5;--border:#9bc2ef24;--input:#9bc2ef2e;--ring:#5c8fe6;--sidebar:#081226;--sidebar-foreground:#d7e6f7;--sidebar-primary:#2c5db8;--sidebar-primary-foreground:#f4f7fc;--sidebar-accent:#122549;--sidebar-accent-foreground:#ecf2fb;--sidebar-border:#9bc2ef1f;--sidebar-ring:#5c8fe6;--c-fable:#2ee08f;--c-opus:#ff6338;--c-sonnet:#ffb938;--c-haiku:#7438ff;--c-unknown:#12cbf5;--money:#4ade9b;--font-sans:"Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-serif:"Instrument Serif", "Times New Roman", serif;--font-mono:"Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}\n/*$vite$:1*/</style>\n </head>\n <body>\n <div id="app"></div>\n </body>\n</html>\n';
|
|
1329
|
+
var built_default = '<!doctype html>\n<html lang="en" class="dark">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Synthra \xB7 Dashboard</title>\n <link rel="icon" href="/favicon.svg" type="image/svg+xml" />\n <link rel="preconnect" href="https://fonts.googleapis.com" />\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />\n <link\n href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap"\n rel="stylesheet"\n />\n <script type="module" crossorigin>(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible;function d(e){return typeof e==`function`}var f=()=>{};function p(e){for(var t=0;t<e.length;t++)e[t]()}function m(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function h(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var g=1<<24,_=1024,v=2048,y=4096,b=8192,x=16384,S=32768,ee=1<<25,te=65536,ne=1<<19,re=1<<20,ie=1<<25,ae=65536,oe=1<<21,se=1<<22,ce=1<<23,le=Symbol(`$state`),ue=Symbol(`legacy props`),de=Symbol(``),fe=Symbol(`attributes`),pe=Symbol(`class`),me=Symbol(`style`),he=Symbol(`text`),ge=Symbol(`form reset`),_e=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ve=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function ye(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function be(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function xe(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Se(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ce(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function we(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Te(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ee(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function De(){throw Error(`https://svelte.dev/e/set_context_after_init`)}function Oe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ke(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ae(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function je(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Me={},C=Symbol(`uninitialized`),Ne=`http://www.w3.org/1999/xhtml`,Pe=`http://www.w3.org/2000/svg`,Fe=`@attach`;function Ie(){console.warn(`https://svelte.dev/e/derived_inert`)}function Le(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Re(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function ze(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var w=!1;function Be(e){w=e}var T;function Ve(e){if(e===null)throw Le(),Me;return T=e}function He(){return Ve(Sn(T))}function E(e){if(w){if(Sn(T)!==null)throw Le(),Me;T=e}}function D(e=1){if(w){for(var t=e,n=T;t--;)n=Sn(n);T=n}}function Ue(e=!0){for(var t=0,n=T;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Sn(n);e&&n.remove(),n=i}}function We(e){if(!e||e.nodeType!==8)throw Le(),Me;return e.data}function Ge(e){return e===this.v}function Ke(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function qe(e){return!Ke(e,this.v)}var Je=!1,Ye=!1;function Xe(){Ye=!0}var O=null;function Ze(e){O=e}function Qe(e){return rt(`getContext`).get(e)}function $e(e,t){let n=rt(`setContext`);if(Je){var r=V.f;!B&&r&32&&!O.i||De()}return n.set(e,t),t}function et(e){return rt(`hasContext`).has(e)}function tt(){return rt(`getAllContexts`)}function k(e,t=!1,n){O={p:O,i:!1,c:null,e:null,s:e,x:null,r:V,l:Ye&&!t?{s:null,u:null,$:[]}:null}}function A(e){var t=O,n=t.e;if(n!==null){t.e=null;for(var r of n)Rn(r)}return e!==void 0&&(t.x=e),t.i=!0,O=t.p,e??{}}function nt(){return!Ye||O!==null&&O.l===null}function rt(e){return O===null&&ye(e),O.c??=new Map(it(O)||void 0)}function it(e){let t=e.p;for(;t!==null;){let e=t.c;if(e!==null)return e;t=t.p}return null}var at=[];function ot(){var e=at;at=[],p(e)}function st(e){if(at.length===0&&!Bt){var t=at;queueMicrotask(()=>{t===at&&ot()})}at.push(e)}function ct(){for(;at.length>0;)ot()}function lt(e){var t=V;if(t===null)return B.f|=ce,e;if(!(t.f&32768)&&!(t.f&4))throw e;ut(e,t)}function ut(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}var dt=~(v|y|_);function j(e,t){e.f=e.f&dt|t}function ft(e){e.f&512||e.deps===null?j(e,_):j(e,y)}function pt(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=ae,pt(t.deps))}function mt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),pt(e.deps),j(e,_)}var ht=!1,gt=!1;function _t(e){var t=gt;try{return gt=!1,[e(),gt]}finally{gt=t}}function vt(e){let t=0,n=on(0),r;return()=>{Fn()&&(H(n),Wn(()=>(t===0&&(r=Mr(()=>e(()=>un(n)))),t+=1,()=>{st(()=>{--t,t===0&&(r?.(),r=void 0,un(n))})})))}}var yt=te|ne;function bt(e,t,n,r){new xt(e,t,n,r)}var xt=class{parent;is_pending=!1;transform_error;#e;#t=w?T:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=vt(()=>(this.#m=on(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=V;t.b=this,t.f|=128,n(e)},this.parent=V.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Gn(()=>{if(w){let e=this.#t;He();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},yt),w&&(this.#e=T)}#g(){try{this.#a=qn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=qn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=qn(()=>e(this.#e)),st(()=>{var e=this.#c=document.createDocumentFragment(),t=bn();e.append(t),this.#a=this.#x(()=>qn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,er(this.#o,()=>{this.#o=null}),this.#b(N))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=qn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ir(this.#a,e);let t=this.#n.pending;this.#o=qn(()=>t(this.#e))}else this.#b(N)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){mt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=V,n=B,r=O;dr(this.#i),ur(this.#i),Ze(this.#i.ctx);try{return Kt.ensure(),e()}catch(e){return lt(e),null}finally{dr(t),ur(n),Ze(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&er(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,st(()=>{this.#d=!1,this.#m&&cn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),H(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;N?.is_fork?(this.#a&&N.skip_effect(this.#a),this.#o&&N.skip_effect(this.#o),this.#s&&N.skip_effect(this.#s),N.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Zn(this.#a),null),this.#o&&=(Zn(this.#o),null),this.#s&&=(Zn(this.#s),null),w&&(Ve(this.#t),D(),Ve(Ue()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){ze();return}r=!0,i&&je(),this.#s!==null&&er(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){ut(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return qn(()=>{var t=V;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return ut(e,this.#i.parent),null}}))};st(()=>{var t;try{t=this.transform_error(e)}catch(e){ut(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ut(e,this.#i&&this.#i.parent)):o(t)})}};function St(e,t,n,r){let i=nt()?Et:kt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=V,c=Ct(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){ut(e,s)}wt()}}var d=Tt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Ot(e))).then(u).catch(e=>ut(e,s)).finally(d)}l?l.then(()=>{c(),f(),wt()}):f()}function Ct(){var e=V,t=B,n=O,r=N;return function(i=!0){dr(e),ur(t),Ze(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function wt(e=!0){dr(null),ur(null),Ze(null),e&&N?.deactivate()}function Tt(){var e=V,t=e.b,n=N,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Et(e){var t=2|v;return V!==null&&(V.f|=ne),{ctx:O,deps:null,effects:null,equals:Ge,f:t,fn:e,reactions:null,rv:0,v:C,wv:0,parent:V,ac:null}}var Dt=Symbol(`obsolete`);function Ot(e,t,n){let r=V;r===null&&be();var i=void 0,a=on(C),o=!B,s=new Set;return Un(()=>{var t=V,n=m();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==_e&&n.reject(e)}).finally(wt)}catch(e){n.reject(e),wt()}var c=N;if(o){if(t.f&32768)var l=Tt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Dt);else for(let e of s.values())e.reject(Dt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Dt&&(c.activate(),t?(a.f|=ce,cn(a,t)):(a.f&8388608&&(a.f^=ce),cn(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),In(()=>{for(let e of s)e.reject(Dt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function M(e){let t=Et(e);return Je||pr(t),t}function kt(e){let t=Et(e);return t.equals=qe,t}function At(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Zn(t[n])}}function jt(e){var t,n=V,r=e.parent;if(!sr&&r!==null&&e.v!==C&&r.f&24576)return Ie(),e.v;dr(r);try{e.f&=~ae,At(e),t=Tr(e)}finally{dr(n)}return t}function Mt(e){var t=jt(e);if(!e.equals(t)&&(e.wv=Sr(),(!N?.is_fork||e.deps===null)&&(N===null?e.v=t:(N.capture(e,t,!0),Lt?.capture(e,t,!0)),e.deps===null))){j(e,_);return}sr||(Rt===null?ft(e):(Fn()||N?.is_fork)&&Rt.set(e,t))}function Nt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(_e),t.fn!==null&&(t.teardown=f),t.ac=null,Dr(t,0),Yn(t))}function Pt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Or(t)}var Ft=null,It=null,N=null,Lt=null,Rt=null,zt=null,Bt=!1,Vt=!1,Ht=null,Ut=null,Wt=0,Gt=1,Kt=class e{id=Gt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){It===null?Ft=It=this:(It.#n=this,this.#t=It),It=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)j(r,v),t(r);for(r of n.m)j(r,y),t(r)}this.#p.add(e)}#g(){this.#e=!0,Wt++>1e3&&(this.#S(),Jt());for(let e of this.#u)this.#d.delete(e),j(e,v),this.schedule(e);for(let e of this.#d)j(e,y),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Ht=[],r=[],i=Ut=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw tn(e),this.#h()||this.discard(),t}if(N=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Ht=null,Ut=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)en(e,t);i.length>0&&N.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Lt=this,Xt(r),Xt(n),Lt=null,this.#s?.resolve();var s=N;if(this.#a===0&&(this.#c.length===0||s!==null)&&(this.#S(),Je&&(this.#x(),N=s)),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=_;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=_:i&4?t.push(r):Je&&i&16777224?n.push(r):Cr(r)&&(i&16&&this.#d.add(r),Or(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),j(i,v),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),N=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)mt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==C&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),Rt?.set(e,t)),this.is_fork||(e.v=t)}activate(){N=this}deactivate(){N=null,Rt=null}flush(){try{Vt=!0,N=this,this.#g()}finally{Wt=0,zt=null,Ht=null,Ut=null,Vt=!1,N=null,Rt=null,rn.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(Dt);this.#S(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}#x(){for(let u=Ft;u!==null;u=u.#n){var e=u.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(u.current.has(r)){var n=u.current.get(r)[0];if(e&&i!==n)u.current.set(r,[i,a]);else continue}t.push(r)}if(e)for(let[e,t]of this.async_deriveds){let n=u.async_deriveds.get(e);n&&t.promise.then(n.resolve).catch(n.reject)}var r=[...u.current.keys()].filter(e=>!u.current.get(e)[1]);if(!(!u.#e||r.length===0)){var i=r.filter(e=>!this.current.has(e));if(i.length===0)e&&u.discard();else if(t.length>0){if(e)for(let e of this.#p)u.unskip_effect(e,e=>{e.f&4194320?u.schedule(e):u.#b([e])});u.activate();var a=new Set,o=new Map;for(var s of t)Zt(s,i,a,o);o=new Map;var c=[...u.current].filter(([e,t])=>{let n=this.current.get(e);return n?n[0]!==t[0]||n[1]!==t[1]:!0}).map(([e])=>e);if(c.length>0)for(let e of this.#l)!(e.f&155648)&&Qt(e,c,o)&&(e.f&4194320?(j(e,v),u.schedule(e)):u.#u.add(e));if(u.#c.length>0&&!u.#m){u.apply();for(var l of u.#c)u.#_(l,[],[]);u.#c=[]}u.deactivate()}}}}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,st(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=m()).promise}static ensure(){if(N===null){let t=N=new e;!Vt&&!Bt&&st(()=>{t.#e||t.flush()})}return N}apply(){if(!Je||!this.is_fork&&this.#t===null&&this.#n===null){Rt=null;return}Rt=new Map;for(let[e,[t]]of this.current)Rt.set(e,t);for(let t=Ft;t!==null;t=t.#n)if(!(t===this||t.is_fork)){var e=!1;if(t.id<this.id){for(let[n,[,r]]of t.current)if(!r&&this.current.has(n)){e=!0;break}}if(!e)for(let[e,n]of t.previous)Rt.has(e)||Rt.set(e,n)}}schedule(e){if(zt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Ht!==null&&t===V&&(Je||(B===null||!(B.f&2))&&!ht))return;if(n&96){if(!(n&1024))return;t.f^=_}}this.#c.push(t)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null?Ft=t:e.#n=t,t===null?It=e:t.#t=e,this.linked=!1}}};function qt(e){var t=Bt;Bt=!0;try{var n;for(e&&(N!==null&&!N.is_fork&&N.flush(),n=e());;){if(ct(),N===null)return n;N.flush()}}finally{Bt=t}}function Jt(){try{Te()}catch(e){ut(e,zt)}}var Yt=null;function Xt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Cr(r)&&(Yt=new Set,Or(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&$n(r),Yt?.size>0)){rn.clear();for(let e of Yt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Yt.has(n)&&(Yt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Or(n)}}Yt.clear()}}Yt=null}}function Zt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Zt(i,t,n,r):e&4194320&&!(e&2048)&&Qt(i,t,r)&&(j(i,v),$t(i))}}function Qt(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&Qt(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function $t(e){N.schedule(e)}function en(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),j(e,_);for(var n=e.first;n!==null;)en(n,t),n=n.next}}function tn(e){j(e,_);for(var t=e.first;t!==null;)tn(t),t=t.next}var nn=new Set,rn=new Map,an=!1;function on(e,t){return{f:0,v:e,reactions:null,equals:Ge,rv:0,wv:0}}function P(e,t){let n=on(e,t);return pr(n),n}function sn(e,t=!1,n=!0){let r=on(e);return t||(r.equals=qe),Ye&&n&&O!==null&&O.l!==null&&(O.l.s??=[]).push(r),r}function F(e,t,n=!1){return B!==null&&(!lr||B.f&131072)&&nt()&&B.f&4325394&&(fr===null||!fr.has(e))&&Ae(),cn(e,n?fn(t):t,Ut)}function cn(e,t,n=null){if(!e.equals(t)){rn.set(e,sr?t:e.v);var r=Kt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&jt(t),Rt===null&&ft(t)}e.wv=Sr(),dn(e,v,n),nt()&&V!==null&&V.f&1024&&!(V.f&96)&&(gr===null?_r([e]):gr.push(e)),!r.is_fork&&nn.size>0&&!an&&ln()}return t}function ln(){an=!1;for(let e of nn){e.f&1024&&j(e,y);let t;try{t=Cr(e)}catch{t=!0}t&&Or(e)}nn.clear()}function un(e){F(e,e.v+1)}function dn(e,t,n){var r=e.reactions;if(r!==null)for(var i=nt(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===V)){var l=(c&v)===0;if(l&&j(s,t),c&131072)nn.add(s);else if(c&2){var u=s;Rt?.delete(u),c&65536||(c&512&&(V===null||!(V.f&2097152))&&(s.f|=ae),dn(u,y,n))}else if(l){var d=s;c&16&&Yt!==null&&Yt.add(d),n===null?$t(d):n.push(d)}}}}function fn(t){if(typeof t!=`object`||!t||le in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=P(0),u=null,d=br,f=e=>{if(br===d)return e();var t=B,n=br;ur(null),xr(d);var r=e();return ur(t),xr(n),r};return i&&r.set(`length`,P(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Oe();var i=r.get(t);return i===void 0?f(()=>{var e=P(n.value,u);return r.set(t,e),e}):F(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>P(C,u));r.set(t,e),un(o)}}else F(n,C),un(o);return!0},get(e,n,i){if(n===le)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>P(fn(s?e[n]:C),u)),r.set(n,o)),o!==void 0){var c=H(o);return c===C?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=H(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==C)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===le)return!0;var n=r.get(t),i=n!==void 0&&n.v!==C||Reflect.has(e,t);return(n!==void 0||V!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>P(i?fn(e[t]):C,u)),r.set(t,n)),H(n)===C)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>P(C,u)),r.set(d+``,p)):F(p,C)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>P(void 0,u)),F(c,fn(n)),r.set(t,c));else{l=c.v!==C;var m=f(()=>fn(n));F(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&F(g,_+1)}un(o)}return!0},ownKeys(e){H(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==C});for(var[n,i]of r)i.v!==C&&!(n in e)&&t.push(n);return t},setPrototypeOf(){ke()}})}function pn(e){try{if(typeof e==`object`&&e&&le in e)return e[le]}catch{}return e}function mn(e,t){return Object.is(pn(e),pn(t))}new Set([`copyWithin`,`fill`,`pop`,`push`,`reverse`,`shift`,`sort`,`splice`,`unshift`]);var hn,gn,_n,vn;function yn(){if(hn===void 0){hn=window,gn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;_n=a(t,`firstChild`).get,vn=a(t,`nextSibling`).get,u(e)&&(e[pe]=void 0,e[fe]=null,e[me]=void 0,e.__e=void 0),u(n)&&(n[he]=void 0)}}function bn(e=``){return document.createTextNode(e)}function xn(e){return _n.call(e)}function Sn(e){return vn.call(e)}function I(e,t){if(!w)return xn(e);var n=xn(T);if(n===null)n=T.appendChild(bn());else if(t&&n.nodeType!==3){var r=bn();return n?.before(r),Ve(r),r}return t&&En(n),Ve(n),n}function L(e,t=!1){if(!w){var n=xn(e);return n instanceof Comment&&n.data===``?Sn(n):n}if(t){if(T?.nodeType!==3){var r=bn();return T?.before(r),Ve(r),r}En(T)}return T}function R(e,t=1,n=!1){let r=w?T:e;for(var i;t--;)i=r,r=Sn(r);if(!w)return r;if(n){if(r?.nodeType!==3){var a=bn();return r===null?i?.after(a):r.before(a),Ve(a),a}En(r)}return Ve(r),r}function Cn(e){e.textContent=``}function wn(){return!Je||Yt!==null?!1:(V.f&S)!==0}function Tn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function En(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Dn(e,t){if(t){let t=document.body;e.autofocus=!0,st(()=>{document.activeElement===t&&e.focus()})}}var On=!1;function kn(){On||(On=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ge]?.()})},{capture:!0}))}function An(e){var t=B,n=V;ur(null),dr(null);try{return e()}finally{ur(t),dr(n)}}function jn(e,t,n,r=n){e.addEventListener(t,()=>An(n));let i=e[ge];i?e[ge]=()=>{i(),r(!0)}:e[ge]=()=>r(!0),kn()}function Mn(e){V===null&&(B===null&&we(e),Ce()),sr&&Se(e)}function Nn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Pn(e,t){var n=V;n!==null&&n.f&8192&&(e|=b);var r={ctx:O,deps:null,nodes:null,f:e|v|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};N?.register_created_effect(r);var i=r;if(e&4)Ht===null?Kt.ensure().schedule(r):Ht.push(r);else if(t!==null){try{Or(r)}catch(e){throw Zn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=te))}if(i!==null&&(i.parent=n,n!==null&&Nn(i,n),B!==null&&B.f&2&&!(e&64))){var a=B;(a.effects??=[]).push(i)}return r}function Fn(){return B!==null&&!lr}function In(e){let t=Pn(8,null);return j(t,_),t.teardown=e,t}function Ln(e){Mn(`$effect`);var t=V.f;if(!B&&t&32&&O!==null&&!O.i){var n=O;(n.e??=[]).push(e)}else return Rn(e)}function Rn(e){return Pn(4|re,e)}function zn(e){return Mn(`$effect.pre`),Pn(8|re,e)}function Bn(e){Kt.ensure();let t=Pn(64|ne,e);return()=>{Zn(t)}}function Vn(e){Kt.ensure();let t=Pn(64|ne,e);return(e={})=>new Promise(n=>{e.outro?er(t,()=>{Zn(t),n(void 0)}):(Zn(t),n(void 0))})}function Hn(e){return Pn(4,e)}function Un(e){return Pn(se|ne,e)}function Wn(e,t=0){return Pn(8|t,e)}function z(e,t=[],n=[],r=[]){St(r,t,n,t=>{Pn(8,()=>{e(...t.map(H))})})}function Gn(e,t=0){return Pn(16|t,e)}function Kn(e,t=0){return Pn(g|t,e)}function qn(e){return Pn(32|ne,e)}function Jn(e){var t=e.teardown;if(t!==null){let e=sr,n=B;cr(!0),ur(null);try{t.call(null)}finally{cr(e),ur(n)}}}function Yn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&An(()=>{e.abort(_e)});var r=n.next;n.f&64?n.parent=null:Zn(n,t),n=r}}function Xn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Zn(t),t=n}}function Zn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Qn(e.nodes.start,e.nodes.end),n=!0),e.f|=ee,Yn(e,t&&!n),Dr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Jn(e),e.f^=ee,e.f|=x;var i=e.parent;i!==null&&i.first!==null&&$n(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Qn(e,t){for(;e!==null;){var n=e===t?null:Sn(e);e.remove(),e=n}}function $n(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function er(e,t,n=!0){var r=[];tr(e,r,!0);var i=()=>{n&&Zn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function tr(e,t,n){if(!(e.f&8192)){e.f^=b;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;tr(i,t,o?n:!1)}i=a}}}function nr(e){rr(e,!0)}function rr(e,t){if(e.f&8192){e.f^=b,e.f&1024||(j(e,v),Kt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;rr(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function ir(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Sn(n);t.append(n),n=i}}var ar=null,or=!1,sr=!1;function cr(e){sr=e}var B=null,lr=!1;function ur(e){B=e}var V=null;function dr(e){V=e}var fr=null;function pr(e){B!==null&&(!Je||B.f&2)&&(fr??=new Set).add(e)}var mr=null,hr=0,gr=null;function _r(e){gr=e}var vr=1,yr=0,br=yr;function xr(e){br=e}function Sr(){return++vr}function Cr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~ae),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Cr(a)&&Mt(a),a.wv>e.wv)return!0}t&512&&Rt===null&&j(e,_)}return!1}function wr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Je&&fr!==null&&fr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?wr(a,t,!1):t===a&&(n?j(a,v):a.f&1024&&j(a,y),$t(a))}}function Tr(e){var t=mr,n=hr,r=gr,i=B,a=fr,o=O,s=lr,c=br,l=e.f;mr=null,hr=0,gr=null,B=l&96?null:e,fr=null,Ze(e.ctx),lr=!1,br=++yr,e.ac!==null&&(An(()=>{e.ac.abort(_e)}),e.ac=null);try{e.f|=oe;var u=e.fn,d=u();e.f|=S;var f=e.deps,p=N?.is_fork;if(mr!==null){var m;if(p||Dr(e,hr),f!==null&&hr>0)for(f.length=hr+mr.length,m=0;m<mr.length;m++)f[hr+m]=mr[m];else e.deps=f=mr;if(Fn()&&e.f&512)for(m=hr;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&hr<f.length&&(Dr(e,hr),f.length=hr);if(nt()&&gr!==null&&!lr&&f!==null&&!(e.f&6146))for(m=0;m<gr.length;m++)wr(gr[m],e);if(i!==null&&i!==e){if(yr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=yr;if(t!==null)for(let e of t)e.rv=yr;gr!==null&&(r===null?r=gr:r.push(...gr))}return e.f&8388608&&(e.f^=ce),d}catch(e){return lt(e)}finally{e.f^=oe,mr=t,hr=n,gr=r,B=i,fr=a,Ze(o),lr=s,br=c}}function Er(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(mr===null||!n.call(mr,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~ae),s.v!==C&&ft(s),Nt(s),Dr(s,0)}}function Dr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Er(e,n[r])}function Or(e){var t=e.f;if(!(t&16384)){j(e,_);var n=V,r=or;V=e,or=!0;try{t&16777232?Xn(e):Yn(e),Jn(e);var i=Tr(e);e.teardown=typeof i==`function`?i:null,e.wv=vr}finally{or=r,V=n}}}async function kr(){if(Je)return new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),qt()}function H(e){var t=(e.f&2)!=0;if(ar?.add(e),B!==null&&!lr&&!(V!==null&&V.f&16384)&&(fr===null||!fr.has(e))){var r=B.deps;if(B.f&2097152)e.rv<yr&&(e.rv=yr,mr===null&&r!==null&&r[hr]===e?hr++:mr===null?mr=[e]:mr.push(e));else{B.deps??=[],n.call(B.deps,e)||B.deps.push(e);var i=e.reactions;i===null?e.reactions=[B]:n.call(i,B)||i.push(B)}}if(sr&&rn.has(e))return rn.get(e);if(t){var a=e;if(sr){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||jr(a))&&(o=jt(a)),rn.set(a,o),o}var s=(a.f&512)==0&&!lr&&B!==null&&(or||(B.f&512)!=0),c=(a.f&S)===0;Cr(a)&&(s&&(a.f|=512),Mt(a)),s&&!c&&(Pt(a),Ar(a))}if(Rt?.has(e))return Rt.get(e);if(e.f&8388608)throw e.v;return e.v}function Ar(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(Pt(t),Ar(t))}function jr(e){if(e.v===C)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(rn.has(t)||t.f&2&&jr(t))return!0;return!1}function Mr(e){var t=lr;try{return lr=!0,e()}finally{lr=t}}function Nr(){return Symbol(Fe)}function Pr(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var Fr=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function Ir(e){return Fr.includes(e)}var Lr=`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`),Rr={formnovalidate:`formNoValidate`,ismap:`isMap`,nomodule:`noModule`,playsinline:`playsInline`,readonly:`readOnly`,defaultvalue:`defaultValue`,defaultchecked:`defaultChecked`,srcobject:`srcObject`,novalidate:`noValidate`,allowfullscreen:`allowFullscreen`,disablepictureinpicture:`disablePictureInPicture`,disableremoteplayback:`disableRemotePlayback`};function zr(e){return e=e.toLowerCase(),Rr[e]??e}[...Lr];var Br=[`touchstart`,`touchmove`];function Vr(e){return Br.includes(e)}var Hr=[`textarea`,`script`,`style`,`title`];function Ur(e){return Hr.includes(e)}var Wr=Symbol(`events`),Gr=new Set,Kr=new Set;function qr(e,t,n,r={}){function i(e){if(r.capture||Qr.call(t,e),!e.cancelBubble)return An(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?st(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Jr(e,t,n,r={}){var i=qr(t,e,n,r);return()=>{e.removeEventListener(t,i,r)}}function Yr(e,t,n){(t[Wr]??={})[e]=n}function Xr(e){for(var t=0;t<e.length;t++)Gr.add(e[t]);for(var n of Kr)n(e)}var Zr=null;function Qr(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;Zr=e;var s=0,c=Zr===e&&e[Wr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[Wr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=B,f=V;ur(null),dr(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[Wr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Wr]=t,delete e.currentTarget,ur(d),dr(f)}}}var $r=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ei(e){return $r?.createHTML(e)??e}function ti(e){var t=Tn(`template`);return t.innerHTML=ei(e.replaceAll(`<!>`,`\\x3C!---->`)),t.content}function ni(e,t){var n=V;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function U(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(w)return ni(T,null),T;i===void 0&&(i=ti(a?e:`<!>`+e),n||(i=xn(i)));var t=r||gn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=xn(t),s=t.lastChild;ni(o,s)}else ni(t,t);return t}}function ri(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=(t&1)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(w)return ni(T,null),T;if(!o){var e=xn(ti(a));if(i)for(o=document.createDocumentFragment();xn(e);)o.appendChild(xn(e));else o=xn(e)}var t=o.cloneNode(!0);if(i){var n=xn(t),r=t.lastChild;ni(n,r)}else ni(t,t);return t}}function ii(e,t){return ri(e,t,`svg`)}function ai(e=``){if(!w){var t=bn(e+``);return ni(t,t),t}var n=T;return n.nodeType===3?En(n):(n.before(n=bn()),Ve(n)),ni(n,n),n}function W(){if(w)return ni(T,null),T;var e=document.createDocumentFragment(),t=document.createComment(``),n=bn();return e.append(t,n),ni(t,n),e}function G(e,t){if(w){var n=V;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=T),He();return}e!==null&&e.before(t)}function oi(){if(w&&T&&T.nodeType===8&&T.textContent?.startsWith(`$`)){let e=T.textContent.substring(1);return He(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function K(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[he]??=e.nodeValue)&&(e[he]=n,e.nodeValue=`${n}`)}function si(e,t){return li(e,t)}var ci=new Map;function li(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){yn();var l=void 0,u=Vn(()=>{var s=n??t.appendChild(bn());bt(s,{pending:()=>{}},t=>{k({});var n=O;if(o&&(n.c=o),a&&(i.$$events=a),w&&ni(t,null),l=e(t,i)||{},w&&(V.nodes.end=T,T===null||T.nodeType!==8||T.data!==`]`))throw Le(),Me;A()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=Vr(r);for(let e of[t,document]){var a=ci.get(e);a===void 0&&(a=new Map,ci.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,Qr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(Gr)),Kr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=ci.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Qr),r.delete(e),r.size===0&&ci.delete(n)):r.set(e,i)}Kr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return ui.set(l,u),l}var ui=new WeakMap;function di(e,t){let n=ui.get(e);return n?(ui.delete(e),n(t)):Promise.resolve()}var fi=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)nr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(nr(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Zn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ir(r,t),t.append(bn()),this.#n.set(e,{effect:r,fragment:t})}else Zn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),er(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Zn(n.effect),this.#n.delete(e))};ensure(e,t){var n=N,r=wn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=bn();i.append(a),this.#n.set(e,{effect:qn(()=>t(a)),fragment:i})}else this.#t.set(e,qn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else w&&(this.anchor=T),this.#a(n)}};function q(e,t,n=!1){var r;w&&(r=T,He());var i=new fi(e),a=n?te:0;function o(e,t){if(w){var n=We(r);if(e!==parseInt(n.substring(1))){var a=Ue();Ve(a),i.anchor=a,Be(!1),i.ensure(e,t),Be(!0);return}}i.ensure(e,t)}Gn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var pi=Symbol(`NaN`);function mi(e,t,n){w&&He();var r=new fi(e),i=!nt();Gn(()=>{var e=t();e!==e&&(e=pi),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function hi(e,t){return t}function gi(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];er(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;_i(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=i.length===0&&n!==null;if(l){var u=n,d=u.parentNode;Cn(d),d.append(u),e.items.clear()}_i(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function _i(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ie,ir(a,document.createDocumentFragment())):Zn(t[i],n)}}var vi;function J(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=w?Ve(xn(u)):u.appendChild(bn())}w&&He();var d=null,f=kt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,bi(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ie,Si(d,null,c)):nr(d):er(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Gn(()=>{p=H(f);var e=p.length;let t=!1;w&&We(c)===`[!`!=(e===0)&&(c=Ue(),Ve(c),Be(!1),t=!0);for(var r=new Set,u=N,v=wn(),y=0;y<e;y+=1){w&&T.nodeType===8&&T.data===`]`&&(c=T,t=!0,Be(!1));var b=p[y],x=a(b,y),S=h?null:l.get(x);S?(S.v&&cn(S.v,b),S.i&&cn(S.i,y),v&&u.unskip_effect(S.e)):(S=xi(l,h?c:vi??=bn(),b,x,y,o,n,i),h||(S.e.f|=ie),l.set(x,S)),r.add(x)}if(e===0&&s&&!d&&(h?d=qn(()=>s(c)):(d=qn(()=>s(vi??=bn())),d.f|=ie)),e>r.size&&xe(``,``,``),w&&e>0&&Ve(Ue()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&Be(!0),H(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,w&&(c=T)}function yi(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function bi(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=yi(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(nr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432)if(_.f^=ie,_===l)Si(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Ci(e,d,_),Ci(e,_,y),Si(_,y,n),d=_,p=[],m=[],l=yi(d.next);continue}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],ee=p[p.length-1];for(x=0;x<p.length;x+=1)Si(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Ci(e,S.prev,ee.next),Ci(e,d,S),Ci(e,ee,b),l=b,d=ee,--v,p=[],m=[]}else u.delete(_),Si(_,l,n),Ci(e,_.prev,_.next),Ci(e,_,d===null?e.effect.first:d.next),Ci(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=yi(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=yi(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(_i(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var te=[];if(u!==void 0)for(_ of u)_.f&8192||te.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&te.push(l),l=yi(l.next);var ne=te.length;if(ne>0){var re=i&4&&s===0?n:null;if(o){for(v=0;v<ne;v+=1)te[v].nodes?.a?.measure();for(v=0;v<ne;v+=1)te[v].nodes?.a?.fix()}gi(e,te,re)}}o&&st(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function xi(e,t,n,r,i,a,o,s){var c=o&1?o&16?on(n):sn(n,!1,!1):null,l=o&2?on(i):null;return{v:c,i:l,e:qn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Si(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Sn(r);if(a.before(r),r===i)return;r=o}}function Ci(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Y(e,t,...n){var r=new fi(e);Gn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},te)}function X(e,t,n){var r;w&&(r=T,He());var i=new fi(e);Gn(()=>{var e=t()??null;if(w&&We(r)===`[`!=(e!==null)){var a=Ue();Ve(a),i.anchor=a,Be(!1),i.ensure(e,e&&(t=>n(t,e))),Be(!0);return}i.ensure(e,e&&(t=>n(t,e)))},te)}function wi(e,t,n,r,i,a){let o=w;w&&He();var s=null;w&&T.nodeType===1&&(s=T,He());var c=w?T:e,l=new fi(c,!1);Gn(()=>{let e=t()||null;var a=i?i():n||e===`svg`?Pe:void 0;if(e===null){l.ensure(null,null);return}return l.ensure(e,t=>{if(e){if(s=w?s:Tn(e,a),ni(s,s),r){var n=null;w&&Ur(e)&&s.append(n=document.createComment(``));var i=w?xn(s):s.appendChild(bn());w&&(i===null?Be(!1):Ve(i)),r(s,i),n?.remove()}V.nodes.end=s,t.before(s)}w&&Ve(t)}),()=>{}},te),In(()=>{}),o&&(Be(!0),Ve(c))}function Ti(e,t){var n=void 0,r;Kn(()=>{n!==(n=t())&&(r&&=(Zn(r),null),n&&(r=qn(()=>{Hn(()=>n(e))})))})}function Ei(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ei(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Di(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ei(e))&&(r&&(r+=` `),r+=t);return r}function Oi(e){return typeof e==`object`?Di(e):e??``}var ki=[...` \n\\r\\f\\xA0\\v\uFEFF`];function Ai(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ki.includes(r[o-1]))&&(s===r.length||ki.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ji(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Mi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Ni(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Mi)),i&&c.push(...Object.keys(i).map(Mi));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`\'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Mi(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=ji(r)),i&&(n+=ji(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Pi(e,t,n,r,i,a){var o=e[pe];if(w||o!==n||o===void 0){var s=Ai(n,r,a);(!w||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[pe]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Fi(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Ii(e,t,n,r){var i=e[me];if(w||i!==t){var a=Ni(t,r);(!w||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[me]=t}else r&&(Array.isArray(r)?(Fi(e,n?.[0],r[0]),Fi(e,n?.[1],r[1],`important`)):Fi(e,n,r));return r}function Li(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return Re();for(var i of t.options)i.selected=n.includes(zi(i));return}for(i of t.options)if(mn(zi(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function Ri(e){var t=new MutationObserver(()=>{Li(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),In(()=>{t.disconnect()})}function zi(e){return`__value`in e?e.__value:e.value}var Bi=Symbol(`class`),Vi=Symbol(`style`),Hi=Symbol(`is custom element`),Ui=Symbol(`is html`),Wi=ve?`link`:`LINK`,Gi=ve?`input`:`INPUT`,Ki=ve?`option`:`OPTION`,qi=ve?`select`:`SELECT`;function Ji(e){if(w){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Xi(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Xi(e,`checked`,null),e.checked=r}}};e[ge]=n,st(n),kn()}}function Yi(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function Xi(e,t,n,r){var i=$i(e);w&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Wi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[de]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ta(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Zi(e,t,n,r,i=!1,a=!1){if(w&&i&&e.nodeName===Gi){var o=e;(o.type===`checkbox`?`defaultChecked`:`defaultValue`)in n||Ji(o)}var s=$i(e),c=s[Hi],l=!s[Ui];let u=w&&c;u&&Be(!1);var d=t||{},f=e.nodeName===Ki;for(var p in t)p in n||(n[p]=null);n.class?n.class=Oi(n.class):(r||n[Bi])&&(n.class=null),n[Vi]&&(n.style??=null);var m=ta(e);if(e.nodeName===Gi&&`type`in n&&(`value`in n||`__value`in n)){var h=n.type;(h!==d.type||h===void 0&&e.hasAttribute(`type`))&&(d.type=h,Xi(e,`type`,h,a))}for(let i in n){let o=n[i];if(f&&i===`value`&&o==null){e.value=e.__value=``,d[i]=o;continue}if(i===`class`){Pi(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,o,r,t?.[Bi],n[Bi]),d[i]=o,d[Bi]=n[Bi];continue}if(i===`style`){Ii(e,o,t?.[Vi],n[Vi]),d[i]=o,d[Vi]=n[Vi];continue}var g=d[i];if(!(o===g&&!(o===void 0&&e.hasAttribute(i)))){d[i]=o;var _=i[0]+i[1];if(_!==`$$`)if(_===`on`){let t={},n=`$$`+i,r=i.slice(2);var v=Ir(r);if(Pr(r)&&(r=r.slice(0,-7),t.capture=!0),!v&&g){if(o!=null)continue;e.removeEventListener(r,d[n],t),d[n]=null}if(v)Yr(r,e,o),Xr([r]);else if(o!=null){function a(e){d[i].call(this,e)}d[n]=qr(r,e,a,t)}}else if(i===`style`)Xi(e,i,o);else if(i===`autofocus`)Dn(e,!!o);else if(!c&&(i===`__value`||i===`value`&&o!=null))e.value=e.__value=o;else if(i===`selected`&&f)Yi(e,o);else{var y=i;l||(y=zr(y));var b=y===`defaultValue`||y===`defaultChecked`;if(o==null&&!c&&!b)if(s[i]=null,y===`value`||y===`checked`){let n=e,r=t===void 0;if(y===`value`){let e=n.defaultValue;n.removeAttribute(y),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i);else b||m.includes(y)&&(c||typeof o!=`string`)?(e[y]=o,y in s&&(s[y]=C)):typeof o!=`function`&&Xi(e,y,o,a)}}}return u&&Be(!0),d}function Qi(e,t,n=[],r=[],i=[],a,o=!1,s=!1){St(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===qi,l=!1;if(Kn(()=>{var u=t(...n.map(H)),d=Zi(e,r,u,a,o,s);l&&c&&`value`in u&&Li(e,u.value);for(let e of Object.getOwnPropertySymbols(i))u[e]||Zn(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var f=u[t];t.description===`@attach`&&(!r||f!==r[t])&&(i[t]&&Zn(i[t]),i[t]=qn(()=>Ti(e,()=>f))),d[t]=f}r=d}),c){var u=e;Hn(()=>{Li(u,r.value,!0),Ri(u)})}l=!0})}function $i(e){return e[fe]??={[Hi]:e.nodeName.includes(`-`),[Ui]:e.namespaceURI===Ne}}var ea=new Map;function ta(e){var t=e.getAttribute(`is`)||e.nodeName,n=ea.get(t);if(n)return n;ea.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.push(s);i=l(i)}return n}function na(e,t,n=t){var r=new WeakSet;jn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ra(e)?ia(a):a,n(a),N!==null&&r.add(N),await kr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(w&&e.defaultValue!==e.value||Mr(t)==null&&e.value)&&(n(ra(e)?ia(e.value):e.value),N!==null&&r.add(N)),Wn(()=>{var n=t();if(e===document.activeElement){var i=Je?Lt:N;if(r.has(i))return}ra(e)&&n===ia(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function ra(e){var t=e.type;return t===`number`||t===`range`}function ia(e){return e===``?null:+e}var aa={get(e,t){if(!e.exclude.has(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.has(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.has(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.has(t))}};function oa(e,t,n){return new Proxy({props:e,exclude:t},aa)}var sa={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===le||t===ue)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function ca(...e){return new Proxy({props:e},sa)}function Z(e,t,n,r){var i=!Ye||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=void 0,d=()=>s&&i?(u??=Et(r),H(u)):(l&&(l=!1,c=s?Mr(r):r),c);let f;if(o){var p=le in e||ue in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=_t(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Ee(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?Et:kt)(()=>(v=!1,g()));o&&H(y);var b=V;return(function(e,t){if(arguments.length>0){let n=t?H(y):i&&o?fn(e):e;return F(y,n),v=!0,c!==void 0&&(c=n),e}return sr&&v||b.f&16384?y.v:H(y)})}function la(e){O===null&&ye(`onMount`),Ye&&O.l!==null?ua(O).m.push(e):Ln(()=>{let t=Mr(e);if(typeof t==`function`)return t})}function ua(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var Q=new class{#e=P(null);get data(){return H(this.#e)}set data(e){F(this.#e,e,!0)}#t=P(null);get arsenal(){return H(this.#t)}set arsenal(e){F(this.#t,e,!0)}#n=P(`connecting`);get status(){return H(this.#n)}set status(e){F(this.#n,e,!0)}#r=P(``);get clock(){return H(this.#r)}set clock(e){F(this.#r,e,!0)}#i=P(`overview`);get view(){return H(this.#i)}set view(e){F(this.#i,e,!0)}#a=P(!1);get arsenalLoading(){return H(this.#a)}set arsenalLoading(e){F(this.#a,e,!0)}#o=!1;#s=null;async tick(){try{let e=await fetch(`/data`);if(!e.ok)throw Error(`HTTP ${e.status}`);this.data=await e.json(),this.status=`live`,this.clock=new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{this.status=`offline`}}start(){this.tick(),this.#s=setInterval(()=>void this.tick(),1e4)}stop(){this.#s&&clearInterval(this.#s)}#c=P(null);get report(){return H(this.#c)}set report(e){F(this.#c,e,!0)}#l=P(!1);get reportLoading(){return H(this.#l)}set reportLoading(e){F(this.#l,e,!0)}async loadReport(){this.reportLoading=!0;try{let e=await fetch(`/report`);e.ok&&(this.report=await e.json())}catch{}finally{this.reportLoading=!1}}async loadArsenal(e=!1){if(!(this.#o&&!e)){this.arsenalLoading=!0;try{let e=await fetch(`/arsenal`);e.ok&&(this.arsenal=await e.json(),this.#o=!0)}catch{}finally{this.arsenalLoading=!1}}}go(e){this.view=e,e===`arsenal`&&this.loadArsenal()}};function da(e){return typeof e!=`number`||!Number.isFinite(e)?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function fa(e){return typeof e!=`number`||!Number.isFinite(e)?`$0.00`:`$${e.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function pa(e){if(!e)return`\u2014`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`\u2014`;let n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function ma(e){if(!e)return`unknown`;let t=e.toLowerCase();return t===`<synthetic>`?`unknown`:t.includes(`fable`)?`fable`:t.includes(`opus`)?`opus`:t.includes(`sonnet`)?`sonnet`:t.includes(`haiku`)?`haiku`:`unknown`}function ha(e){return!e||e===`<synthetic>`?`synthetic`:e.replace(/^claude-/,``)}function ga(e){if(!e)return``;let t=e.split(/[/\\\\]/).filter(Boolean);return t.length<=2?t.join(`/`):`\u2026/${t.slice(-2).join(`/`)}`}var _a=[220,75,20,155,285,330,250,45];function va(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return`oklch(72% 0.15 ${_a[t%_a.length]})`}var ya={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},ba=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},xa=Symbol(`lucide-context`),Sa=()=>Qe(xa),Ca=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),wa=ii(`<svg><!><!></svg>`);function Ta(e,t){k(t,!0);let n=Sa()??{},r=Z(t,`color`,19,()=>n.color??`currentColor`),i=Z(t,`size`,19,()=>n.size??24),a=Z(t,`strokeWidth`,19,()=>n.strokeWidth??2),o=Z(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),s=Z(t,`iconNode`,19,()=>[]),c=oa(t,Ca),l=M(()=>o()?Number(a())*24/Number(i()):a());var u=wa();Qi(u,e=>({...ya,...e,...c,width:i(),height:i(),stroke:r(),"stroke-width":H(l),class:[`lucide-icon lucide`,n.class,t.name&&`lucide-${t.name}`,t.class]}),[()=>!t.children&&!ba(c)&&{"aria-hidden":`true`}]);var d=I(u);J(d,17,s,hi,(e,t)=>{var n=M(()=>h(H(t),2));let r=()=>H(n)[0],i=()=>H(n)[1];var a=W();wi(L(a),r,!0,(e,t)=>{Qi(e,()=>({...i()}))}),G(e,a)}),Y(R(d),()=>t.children??f),E(u),G(e,u),A()}var Ea=new Set([`$$slots`,`$$events`,`$$legacy`]);function Da(e,t){let n=oa(t,Ea),r=[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`}]];Ta(e,ca({name:`layout-dashboard`},()=>n,{get iconNode(){return r}}))}var Oa=new Set([`$$slots`,`$$events`,`$$legacy`]);function ka(e,t){let n=oa(t,Oa),r=[[`polyline`,{points:`14.5 17.5 3 6 3 3 6 3 17.5 14.5`}],[`line`,{x1:`13`,x2:`19`,y1:`19`,y2:`13`}],[`line`,{x1:`16`,x2:`20`,y1:`16`,y2:`20`}],[`line`,{x1:`19`,x2:`21`,y1:`21`,y2:`19`}],[`polyline`,{points:`14.5 6.5 18 3 21 3 21 6 17.5 9.5`}],[`line`,{x1:`5`,x2:`9`,y1:`14`,y2:`18`}],[`line`,{x1:`7`,x2:`4`,y1:`17`,y2:`20`}],[`line`,{x1:`3`,x2:`5`,y1:`19`,y2:`21`}]];Ta(e,ca({name:`swords`},()=>n,{get iconNode(){return r}}))}var Aa=new Set([`$$slots`,`$$events`,`$$legacy`]);function ja(e,t){let n=oa(t,Aa),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];Ta(e,ca({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var Ma=new Set([`$$slots`,`$$events`,`$$legacy`]);function Na(e,t){let n=oa(t,Ma),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m4.93 4.93 4.24 4.24`}],[`path`,{d:`m14.83 9.17 4.24-4.24`}],[`path`,{d:`m14.83 14.83 4.24 4.24`}],[`path`,{d:`m9.17 14.83-4.24 4.24`}],[`circle`,{cx:`12`,cy:`12`,r:`4`}]];Ta(e,ca({name:`life-buoy`},()=>n,{get iconNode(){return r}}))}var Pa=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fa(e,t){let n=oa(t,Pa),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];Ta(e,ca({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Ia=new Set([`$$slots`,`$$events`,`$$legacy`]);function La(e,t){let n=oa(t,Ia),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]];Ta(e,ca({name:`panel-left`},()=>n,{get iconNode(){return r}}))}var Ra=U(`<div class="min-w-0"><div class="font-serif text-lg leading-none text-foreground">Synth<em>ra</em></div> <div class="font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground">Dashboard</div></div>`),za=U(`<span class="font-mono text-sm text-muted-foreground"> </span>`),Ba=U(`<span> </span>`),Va=U(`<button><!> <!></button>`),Ha=U(`<span>Report</span>`),Ua=U(`<span>FAQ</span>`),Wa=U(`<div class="flex flex-col gap-1 rounded-lg bg-sidebar-accent/40 p-2.5"><div class="font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground">Active</div> <div class="truncate font-mono text-sm text-sidebar-foreground"> </div> <div class="mt-1 flex items-center justify-between font-mono text-[10px] text-muted-foreground"><span> </span> <span>v__SYN_VERSION__</span></div></div>`),Ga=U(`<span class="text-xs">Collapse</span>`),Ka=U(`<aside><div class="flex items-center gap-2.5 px-1 py-2"><div class="grid size-8 shrink-0 place-items-center rounded-lg bg-primary/90 font-serif text-lg italic text-primary-foreground">S</div> <!></div> <div><span></span> <!></div> <div class="my-1 h-px bg-sidebar-border"></div> <nav class="flex flex-col gap-1"><!> <button title="Report an issue or suggest a feature"><!> <!></button> <button title="FAQ"><!> <!></button></nav> <div class="flex-1"></div> <!> <button title="Toggle sidebar"><!> <!></button></aside>`);function qa(e,t){k(t,!0);let n=P(!1),r=typeof window<`u`&&window.location.port||`8901`,i=[{id:`overview`,label:`Overview`,icon:Da},{id:`arsenal`,label:`Arsenal`,icon:ka},{id:`commands`,label:`Commands`,icon:ja}];var a=Ka(),o=I(a),s=R(I(o),2),c=e=>{G(e,Ra())};q(s,e=>{H(n)||e(c)}),E(o);var l=R(o,2),u=I(l);let d;var f=R(u,2),p=e=>{var t=za(),n=I(t,!0);E(t),z(()=>K(n,Q.status===`live`?`live \xB7 ${Q.clock}`:Q.status)),G(e,t)};q(f,e=>{H(n)||e(p)}),E(l);var m=R(l,4),h=I(m);J(h,17,()=>i,e=>e.id,(e,t)=>{var r=Va(),i=I(r);X(i,()=>H(t).icon,(e,t)=>{t(e,{class:`size-4 shrink-0`})});var a=R(i,2),o=e=>{var n=Ba(),r=I(n,!0);E(n),z(()=>K(r,H(t).label)),G(e,n)};q(a,e=>{H(n)||e(o)}),E(r),z(()=>{Xi(r,`title`,H(t).label),Pi(r,1,`flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm transition-colors `+(Q.view===H(t).id?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-sidebar-foreground/75 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground`)+(H(n)?` justify-center`:``))}),Yr(`click`,r,()=>Q.go(H(t).id)),G(e,r)});var g=R(h,2),_=I(g);Na(_,{class:`size-4 shrink-0`});var v=R(_,2),y=e=>{G(e,Ha())};q(v,e=>{H(n)||e(y)}),E(g);var b=R(g,2),x=I(b);Fa(x,{class:`size-4 shrink-0`});var S=R(x,2),ee=e=>{G(e,Ua())};q(S,e=>{H(n)||e(ee)}),E(b),E(m);var te=R(m,4),ne=e=>{var t=Wa(),n=R(I(t),2),i=I(n,!0);E(n);var a=R(n,2),o=I(a),s=I(o);E(o),D(2),E(a),E(t),z(()=>{Xi(n,`title`,Q.data?.active?.project_root??`\u2014`),K(i,Q.data?.active?.project_name??`\u2014`),K(s,`port ${r??``}`)}),G(e,t)};q(te,e=>{H(n)||e(ne)});var re=R(te,2),ie=I(re);La(ie,{class:`size-4 shrink-0`});var ae=R(ie,2),oe=e=>{G(e,Ga())};q(ae,e=>{H(n)||e(oe)}),E(re),E(a),z(()=>{Pi(a,1,`flex h-screen shrink-0 flex-col gap-1 border-r border-sidebar-border bg-sidebar p-3 transition-[width] duration-200 `+(H(n)?`w-[64px] items-center`:`w-[248px]`)),Pi(l,1,`flex items-center gap-2 rounded-md px-2 py-1.5 `+(H(n)?`justify-center`:``)),d=Pi(u,1,`size-2 shrink-0 rounded-full `+(Q.status===`live`?`bg-[var(--c-fable)]`:Q.status===`offline`?`bg-destructive`:`bg-muted-foreground`),null,d,{"animate-pulse":Q.status===`live`}),Pi(g,1,`flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm text-sidebar-foreground/75 transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground `+(H(n)?`justify-center`:``)),Pi(b,1,`flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm text-sidebar-foreground/75 transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground `+(H(n)?`justify-center`:``)),Pi(re,1,`mt-1 flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground `+(H(n)?`justify-center`:``))}),Yr(`click`,g,function(...e){t.onReport?.apply(this,e)}),Yr(`click`,b,function(...e){t.onFaq?.apply(this,e)}),Yr(`click`,re,()=>F(n,!H(n))),G(e,a),A()}Xr([`click`]),Xe();var Ja=U(`<div class="flex flex-col gap-1 bg-card/70 p-4"><span class="font-mono text-xs uppercase tracking-[0.12em] text-muted-foreground"> </span> <span class="font-mono text-2xl tabular-nums text-foreground"> </span></div>`),Ya=U(`<div class="grid grid-cols-2 gap-px overflow-hidden rounded-xl border bg-border sm:grid-cols-3 lg:grid-cols-5"></div>`);function Xa(e,t){k(t,!0);let n=M(()=>{let e=Q.data?.global;return[{label:`Turns`,v:e?.total_turns??0},{label:`\u2193 Input`,v:e?.total_input_tokens??0},{label:`\u2191 Output`,v:e?.total_output_tokens??0},{label:`\u27F2 Cache R`,v:e?.total_cache_read??0},{label:`\uFF0B Cache W`,v:e?.total_cache_create??0}]});var r=Ya();J(r,21,()=>H(n),e=>e.label,(e,t)=>{var n=Ja(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a),E(n),z(e=>{K(i,H(t).label),K(o,e)},[()=>da(H(t).v)]),G(e,n)}),E(r),G(e,r),A()}var Za=U(`<span class="font-mono text-[10px] uppercase tracking-[0.12em] text-muted-foreground"> </span>`),Qa=U(`<header class="flex items-baseline justify-between gap-3"><span class="font-mono text-xs uppercase tracking-[0.14em] text-muted-foreground"> </span> <!></header>`),$a=U(`<section><!> <!></section>`);function eo(e,t){let n=Z(t,`class`,3,``);var r=$a(),i=I(r),a=e=>{var n=Qa(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=e=>{var n=Za(),r=I(n,!0);E(n),z(()=>K(r,t.meta)),G(e,n)};q(a,e=>{t.meta&&e(o)}),E(n),z(()=>K(i,t.title)),G(e,n)};q(i,e=>{t.title&&e(a)}),Y(R(i,2),()=>t.children??f),E(r),z(()=>Pi(r,1,`flex h-full min-h-0 flex-col gap-3 rounded-xl border bg-card/55 p-4 transition-colors hover:bg-card/80 `+n())),G(e,r)}var to=U(`<div class="flex flex-col gap-3"><div><div class="font-mono text-3xl text-[var(--money)]"> </div> <div class="font-mono text-sm text-muted-foreground"> </div></div> <div class="flex h-2 overflow-hidden rounded-full bg-border"><div class="h-full bg-muted-foreground/40"></div> <div class="h-full bg-[var(--money)]"></div></div> <div class="flex justify-between font-mono text-xs text-muted-foreground"><span>you paid <b class="text-foreground"> </b></span> <span>baseline <b class="text-foreground"> </b></span></div> <div class="rounded-md border border-dashed border-border px-3 py-2 text-center font-mono text-xs text-muted-foreground"><b class="text-foreground"> </b> blocks \xD7 <b class="text-foreground">500</b> tokens \xD7 <b class="text-foreground">$3</b>/M = <b class="text-[var(--money)]"> </b></div></div>`);function no(e,t){k(t,!0);let n=M(()=>{let e=Q.data?.global,t=e?.blocked_count??0,n=t*500*3/1e6,r=e?.estimated_cost_usd??0,i=r+n;return{blocks:t,money:n,paid:r,baseline:i,pct:i>0?n/i*100:0,tokens:e?.estimated_tokens_saved??0,paidWidth:i>0?r/i*100:100}});{let t=M(()=>`${H(n).pct.toFixed(1)}% off \xB7 floor`);eo(e,{title:`Synthra savings`,get meta(){return H(t)},children:(e,t)=>{var r=to(),i=I(r),a=I(i),o=I(a,!0);E(a);var s=R(a,2),c=I(s);E(s),E(i);var l=R(i,2),u=I(l),d=R(u,2);E(l);var f=R(l,2),p=I(f),m=R(I(p)),h=I(m,!0);E(m),E(p);var g=R(p,2),_=R(I(g)),v=I(_,!0);E(_),E(g),E(f);var y=R(f,2),b=I(y),x=I(b,!0);E(b);var S=R(b,6),ee=I(S,!0);E(S),E(y),E(r),z((e,t,r,i,a)=>{K(o,e),K(c,`${t??``} tokens avoided`),Ii(u,`width:${H(n).paidWidth}%`),Ii(d,`width:${100-H(n).paidWidth}%`),K(h,r),K(v,i),K(x,H(n).blocks),K(ee,a)},[()=>fa(H(n).money),()=>da(H(n).tokens),()=>fa(H(n).paid),()=>fa(H(n).baseline),()=>fa(H(n).money)]),G(e,r)},$$slots:{default:!0}})}A()}var ro=U(`<div class="font-mono text-3xl text-[var(--money)]"> </div> <div class="mt-1 flex flex-col gap-1 font-mono text-sm text-muted-foreground"><div class="flex justify-between"><span>Tokens (in+out)</span><span class="text-foreground"> </span></div> <div class="flex justify-between"><span>Avg / turn</span><span class="text-foreground"> </span></div></div>`,1);function io(e,t){k(t,!0);let n=M(()=>{let e=Q.data?.global,t=e?.total_turns??0,n=e?.estimated_cost_usd??0;return{cost:n,tokens:(e?.total_input_tokens??0)+(e?.total_output_tokens??0),avg:t>0?n/t:0}});eo(e,{title:`Total spend`,meta:`all time`,children:(e,t)=>{var r=ro(),i=L(r),a=I(i,!0);E(i);var o=R(i,2),s=I(o),c=R(I(s)),l=I(c,!0);E(c),E(s);var u=R(s,2),d=R(I(u)),f=I(d,!0);E(d),E(u),E(o),z((e,t,n)=>{K(a,e),K(l,t),K(f,n)},[()=>fa(H(n).cost),()=>da(H(n).tokens),()=>fa(H(n).avg)]),G(e,r)},$$slots:{default:!0}}),A()}var ao=ii(`<circle cx="70" cy="70" r="52" fill="none" stroke-width="14"></circle>`),oo=U(`<div class="flex items-center gap-2 font-mono text-sm"><span class="size-2 rounded-sm"></span> <span class="flex-1 text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span> <span class="w-9 text-right tabular-nums text-muted-foreground"> </span></div>`),so=U(`<div class="text-sm text-muted-foreground">No turns yet.</div>`),co=U(`<div class="flex items-center gap-4"><div class="relative size-[116px] shrink-0"><svg viewBox="0 0 140 140" class="size-full -rotate-90"><circle cx="70" cy="70" r="52" fill="none" stroke="var(--border)" stroke-width="14"></circle><!></svg> <div class="absolute inset-0 grid place-items-center"><div class="text-center"><div class="font-mono text-2xl text-foreground"> </div> <div class="font-mono text-[10px] uppercase text-muted-foreground">turns</div></div></div></div> <div class="flex min-w-0 flex-1 flex-col gap-1.5"></div></div>`);function lo(e,t){k(t,!0);let n=[{fam:`fable`,label:`Fable`,color:`var(--c-fable)`},{fam:`opus`,label:`Opus`,color:`var(--c-opus)`},{fam:`sonnet`,label:`Sonnet`,color:`var(--c-sonnet)`},{fam:`haiku`,label:`Haiku`,color:`var(--c-haiku)`},{fam:`unknown`,label:`Other`,color:`var(--c-unknown)`}],r=2*Math.PI*52,i=M(()=>{let e={fable:0,opus:0,sonnet:0,haiku:0,unknown:0};for(let t of Q.data?.projects??[])for(let[n,r]of Object.entries(t.models??{}))e[ma(n)]+=r;let t=n.reduce((t,n)=>t+e[n.fam],0),i=0;return{arcs:n.filter(t=>e[t.fam]>0).map(n=>{let a=e[n.fam],o=t>0?a/t*r:0,s={...n,n:a,len:o,offset:i,pct:t>0?Math.round(a/t*100):0};return i+=o,s}),total:t}});eo(e,{title:`Model usage`,meta:`by turns`,children:(e,t)=>{var n=co(),a=I(n),o=I(a);J(R(I(o)),17,()=>H(i).arcs,e=>e.fam,(e,t)=>{var n=ao();z(()=>{Xi(n,`stroke`,H(t).color),Xi(n,`stroke-dasharray`,`${H(t).len} ${r}`),Xi(n,`stroke-dashoffset`,-H(t).offset),Xi(n,`stroke-linecap`,H(i).arcs.length===1?`round`:`butt`)}),G(e,n)}),E(o);var s=R(o,2),c=I(s),l=I(c),u=I(l,!0);E(l),D(2),E(c),E(s),E(a);var d=R(a,2);J(d,21,()=>H(i).arcs,e=>e.fam,(e,t)=>{var n=oo(),r=I(n),i=R(r,2),a=I(i,!0);E(i);var o=R(i,2),s=I(o,!0);E(o);var c=R(o,2),l=I(c);E(c),E(n),z(()=>{Ii(r,`background:${H(t).color}`),K(a,H(t).label),K(s,H(t).n),K(l,`${H(t).pct??``}%`)}),G(e,n)},e=>{G(e,so())}),E(d),E(n),z(()=>K(u,H(i).total)),G(e,n)},$$slots:{default:!0}}),A()}function uo(e){return typeof e==`object`&&!!e}var fo=[`string`,`number`,`bigint`,`boolean`];function po(e){return e==null||fo.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>po(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var mo=Symbol(`box`),ho=Symbol(`is-writable`);function $(e,t){let n=M(e);return t?{[mo]:!0,[ho]:!0,get current(){return H(n)},set current(e){t(e)}}:{[mo]:!0,get current(){return e()}}}function go(e){return uo(e)&&mo in e}function _o(e){let t=P(fn(e));return{[mo]:!0,[ho]:!0,get current(){return H(t)},set current(e){F(t,e,!0)}}}function vo(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var yo=/\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g,bo=/\\n/g,xo=/^\\s*/,So=/^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/,Co=/^:\\s*/,wo=/^((?:\'(?:\\\\\'|.)*?\'|"(?:\\\\"|.)*?"|\\([^)]*?\\)|[^};])+)/,To=/^[;\\s]*/,Eo=/^\\s+|\\s+$/g,Do=`\n`,Oo=`/`,ko=`*`,Ao=``,jo=`comment`,Mo=`declaration`;function No(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(bo);t&&(n+=t.length);var i=e.lastIndexOf(Do);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(xo)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(!(Oo!=e.charAt(0)||ko!=e.charAt(1))){for(var n=2;Ao!=e.charAt(n)&&(ko!=e.charAt(n)||Oo!=e.charAt(n+1));)++n;if(n+=2,Ao===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:jo,comment:o})}}function f(){var e=a(),t=c(So);if(t){if(d(),!c(Co))return s(`property missing \':\'`);var n=c(wo),r=e({type:Mo,property:Po(t[0].replace(yo,Ao)),value:n?Po(n[0].replace(yo,Ao)):Ao});return c(To),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function Po(e){return e?e.replace(Eo,Ao):Ao}function Fo(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=No(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var Io=/\\d/,Lo=[`-`,`_`,`/`,`.`];function Ro(e=``){if(!Io.test(e))return e!==e.toLowerCase()}function zo(e){let t=[],n=``,r,i;for(let a of e){let e=Lo.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=Ro(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function Bo(e){return e?zo(e).map(e=>Ho(e)).join(``):``}function Vo(e){return Uo(Bo(e||``))}function Ho(e){return e?e[0].toUpperCase()+e.slice(1):``}function Uo(e){return e?e[0].toLowerCase()+e.slice(1):``}function Wo(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Bo(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[Vo(e)]=n}return Fo(e,n),t}function Go(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Ko(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var qo=Ko(/[A-Z]/,e=>`-${e.toLowerCase()}`);function Jo(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${qo(t)}: ${e[t]};`).join(`\n`)}function Yo(e={}){return Jo(e).replace(`\n`,` `)}var Xo=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function Zo(e){return Xo.has(e)}function Qo(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];if(r){for(let e of Object.keys(r)){let n=t[e],i=r[e],a=typeof n==`function`,o=typeof i==`function`;if(a&&typeof o&&Zo(e))t[e]=vo(n,i);else if(a&&o)t[e]=Go(n,i);else if(e===`class`){let r=po(n),a=po(i);r&&a?t[e]=Di(n,i):r?t[e]=Di(n):a&&(t[e]=Di(i))}else if(e===`style`){let r=typeof n==`object`,a=typeof i==`object`,o=typeof n==`string`,s=typeof i==`string`;if(r&&a)t[e]={...n,...i};else if(r&&s){let r=Wo(i);t[e]={...n,...r}}else if(o&&a)t[e]={...Wo(n),...i};else if(o&&s){let r=Wo(n),a=Wo(i);t[e]={...r,...a}}else r?t[e]=n:a?t[e]=i:o?t[e]=n:s&&(t[e]=i)}else t[e]=i===void 0?n:i}for(let e of Object.getOwnPropertySymbols(r)){let n=t[e],i=r[e];t[e]=i===void 0?n:i}}}return typeof t.style==`object`&&(t.style=Yo(t.style).replaceAll(`\n`,` `)),t.hidden===!1&&(t.hidden=void 0,delete t.hidden),t.disabled===!1&&(t.disabled=void 0,delete t.disabled),t}var $o=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function es(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var ts=class extends Map{#e=new Map;#t=P(0);#n=P(0);#r=br||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return br===this.#r?P(e):on(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return H(this.#t),!1;return H(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{H(this.#t);return}return H(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),F(this.#n,super.size),un(o);else if(i!==t){un(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&un(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),F(n,-1)),r&&(F(this.#n,super.size),un(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;F(this.#n,0);for(var t of e.values())F(t,-1);un(this.#t),e.clear()}}#a(){H(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)H(n)}keys(){return H(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return H(this.#n),super.size}};new class{#e;#t;constructor(e={}){let{window:t=$o,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=vt(e=>{let n=Jr(t,`focusin`,e),r=Jr(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?es(this.#e):null}};var ns=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return et(this.#t)}get(){let e=Qe(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=Qe(this.#t);return t===void 0?e:t}set(e){return $e(this.#t,e)}};function rs(e,t){switch(e){case`post`:Ln(t);break;case`pre`:zn(t);break}}function is(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;rs(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=Mr(()=>n(t,o));return o=t,r})}function as(e,t,n){let r=Bn(()=>{let i=!1;is(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});Ln(()=>r)}function os(e,t,n){is(e,`post`,t,n)}function ss(e,t,n){is(e,`pre`,t,n)}os.pre=ss;function cs(e,t){as(e,`post`,t)}function ls(e,t){as(e,`pre`,t)}cs.pre=ls;function us(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function ds(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function fs(e,t,n={},r){let{lazy:i=!1,once:a=!1,initialValue:o,debounce:s,throttle:c}=n,l=P(fn(o)),u=P(!1),d=P(void 0),f=P(fn([])),p=()=>{H(f).forEach(e=>e()),F(f,[],!0)},m=e=>{F(f,[...H(f),e],!0)},h=async(e,n,r=!1)=>{try{F(u,!0),F(d,void 0),p();let i=new AbortController;m(()=>i.abort());let a=await t(e,n,{data:H(l),refetching:r,onCleanup:m,signal:i.signal});return F(l,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||F(d,e,!0);return}finally{F(u,!1)}},g=s?us(h,s):c?ds(h,c):h,_=Array.isArray(e)?e:[e],v;return r((t,n)=>{a&&v||(v=t,g(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return H(l)},get loading(){return H(u)},get error(){return H(d)},mutate:e=>{F(l,e,!0)},refetch:t=>{let n=_.map(e=>e());return g(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function ps(e,t,n){return fs(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];os(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function ms(e,t,n){return fs(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];os.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}ps.pre=ms;function hs(e){Ln(()=>()=>{e()})}function gs(e,t){return setTimeout(t,e)}function _s(e){kr().then(e)}var vs=1,ys=9,bs=11;function xs(e){return uo(e)&&e.nodeType===vs&&typeof e.nodeName==`string`}function Ss(e){return uo(e)&&e.nodeType===ys}function Cs(e){return uo(e)&&e.constructor?.name===`VisualViewport`}function ws(e){return uo(e)&&e.nodeType!==void 0}function Ts(e){return ws(e)&&e.nodeType===bs&&`host`in e}function Es(e,t){if(!e||!t||!xs(e)||!xs(t))return!1;let n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&Ts(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ds(e){return Ss(e)?e:Cs(e)?e.document:e?.ownerDocument??document}function Os(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}var ks=class{element;#e=M(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return H(this.#e)}set root(e){F(this.#e,e)}constructor(e){typeof e==`function`?this.element=$(e):this.element=e}getDocument=()=>Ds(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>Os(this.root);isActiveElement=e=>e===this.getActiveElement();getElementById(e){return this.root.getElementById(e)}querySelector=e=>this.root?this.root.querySelector(e):null;querySelectorAll=e=>this.root?this.root.querySelectorAll(e):[];setTimeout=(e,t)=>this.getWindow().setTimeout(e,t);clearTimeout=e=>this.getWindow().clearTimeout(e)};function As(e,t){return{[Nr()]:n=>go(e)?(e.current=n,Mr(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e.current=null,t?.(null))}):(e(n),Mr(()=>t?.(n)),()=>{`isConnected`in n&&n.isConnected||(e(null),t?.(null))})}}function js(e){return e?``:void 0}function Ms(e){return e?`open`:`closed`}function Ns(e){return e===`starting`?{"data-starting-style":``}:e===`ending`?{"data-ending-style":``}:{}}var Ps=class{#e;#t;attrs;constructor(e){this.#e=e.getVariant?e.getVariant():null,this.#t=this.#e?`data-${this.#e}-`:`data-${e.component}-`,this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(e.parts.map(e=>[e,this.getAttr(e)]))}getAttr(e,t){return t?`data-${t}-${e}`:`${this.#t}${e}`}selector(e,t){return`[${this.getAttr(e,t)}]`}};function Fs(e){let t=new Ps(e);return{...t.attrs,selector:t.selector,getAttr:t.getAttr}}var Is=typeof document<`u`,Ls=Rs();function Rs(){return Is&&window?.navigator?.userAgent&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||window?.navigator?.maxTouchPoints>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function zs(e){return e instanceof HTMLElement}function Bs(e){return e instanceof Element||e instanceof SVGElement}var Vs=class{#e;#t=null;#n=null;#r=0;constructor(e){this.#e=e,hs(()=>this.#i())}#i(){this.#t!==null&&(window.cancelAnimationFrame(this.#t),this.#t=null),this.#n?.disconnect(),this.#n=null,this.#r++}run(e){this.#i();let t=this.#e.ref.current;if(!t)return;if(typeof t.getAnimations!=`function`){this.#a(e);return}let n=this.#r,r=()=>{n===this.#r&&this.#a(e)},i=()=>{if(n!==this.#r)return;let e=t.getAnimations();if(e.length===0){r();return}Promise.all(e.map(e=>e.finished)).then(()=>{r()}).catch(()=>{if(n===this.#r){if(t.getAnimations().some(e=>e.pending||e.playState!==`finished`)){i();return}r()}})},a=()=>{this.#t=window.requestAnimationFrame(()=>{this.#t=null,i()})};if(!this.#e.afterTick.current){a();return}this.#t=window.requestAnimationFrame(()=>{this.#t=null;let e=`data-starting-style`;if(!t.hasAttribute(e)){a();return}this.#n=new MutationObserver(()=>{n===this.#r&&(t.hasAttribute(e)||(this.#n?.disconnect(),this.#n=null,a()))}),this.#n.observe(t,{attributes:!0,attributeFilter:[e]})})}#a(e){let t=()=>{e()};this.#e.afterTick?_s(t):t()}},Hs=class{#e;#t;#n;#r=P(!1);#i=P(void 0);#a=!1;#o=null;constructor(e){this.#e=e,F(this.#r,e.open.current,!0),this.#t=e.enabled??!0,this.#n=new Vs({ref:this.#e.ref,afterTick:this.#e.open}),hs(()=>this.#s()),os(()=>this.#e.open.current,e=>{if(!this.#a){this.#a=!0;return}if(this.#s(),!e&&this.#e.shouldSkipExitAnimation?.()){F(this.#r,!1),F(this.#i,void 0),this.#e.onComplete?.();return}if(e&&F(this.#r,!0),F(this.#i,e?`starting`:`ending`,!0),e&&(this.#o=window.requestAnimationFrame(()=>{this.#o=null,this.#e.open.current&&F(this.#i,void 0)})),!this.#t){e||F(this.#r,!1),F(this.#i,void 0),this.#e.onComplete?.();return}this.#n.run(()=>{e===this.#e.open.current&&(this.#e.open.current||F(this.#r,!1),F(this.#i,void 0),this.#e.onComplete?.())})})}get shouldRender(){return H(this.#r)}get transitionStatus(){return H(this.#i)}#s(){this.#o!==null&&(window.cancelAnimationFrame(this.#o),this.#o=null)}};function Us(){}function Ws(e,t){return t===void 0?`bits-${e}`:`bits-${e}-${t}`}var Gs=Fs({component:`dialog`,parts:[`content`,`trigger`,`overlay`,`title`,`description`,`close`,`cancel`,`action`]}),Ks=new ns(`Dialog.Root | AlertDialog.Root`),qs=class e{static create(t){let n=Ks.getOr(null);return Ks.set(new e(t,n))}opts;#e=P(null);get triggerNode(){return H(this.#e)}set triggerNode(e){F(this.#e,e,!0)}#t=P(null);get contentNode(){return H(this.#t)}set contentNode(e){F(this.#t,e,!0)}#n=P(null);get overlayNode(){return H(this.#n)}set overlayNode(e){F(this.#n,e,!0)}#r=P(null);get descriptionNode(){return H(this.#r)}set descriptionNode(e){F(this.#r,e,!0)}#i=P(void 0);get contentId(){return H(this.#i)}set contentId(e){F(this.#i,e,!0)}#a=P(void 0);get titleId(){return H(this.#a)}set titleId(e){F(this.#a,e,!0)}#o=P(void 0);get triggerId(){return H(this.#o)}set triggerId(e){F(this.#o,e,!0)}#s=P(void 0);get descriptionId(){return H(this.#s)}set descriptionId(e){F(this.#s,e,!0)}#c=P(null);get cancelNode(){return H(this.#c)}set cancelNode(e){F(this.#c,e,!0)}#l=P(0);get nestedOpenCount(){return H(this.#l)}set nestedOpenCount(e){F(this.#l,e,!0)}depth;parent;contentPresence;overlayPresence;constructor(e,t){this.opts=e,this.parent=t,this.depth=t?t.depth+1:0,this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.contentPresence=new Hs({ref:$(()=>this.contentNode),open:this.opts.open,enabled:!0,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new Hs({ref:$(()=>this.overlayNode),open:this.opts.open,enabled:!0}),os(()=>this.opts.open.current,e=>{this.parent&&(e?this.parent.incrementNested():this.parent.decrementNested())},{lazy:!0}),hs(()=>{this.opts.open.current&&this.parent?.decrementNested()})}handleOpen(){this.opts.open.current||(this.opts.open.current=!0)}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}getBitsAttr=e=>Gs.getAttr(e,this.opts.variant.current);incrementNested(){this.nestedOpenCount++,this.parent?.incrementNested()}decrementNested(){this.nestedOpenCount!==0&&(this.nestedOpenCount--,this.parent?.decrementNested())}#u=M(()=>({"data-state":Ms(this.opts.open.current)}));get sharedProps(){return H(this.#u)}set sharedProps(e){F(this.#u,e)}},Js=class e{static create(t){return new e(t,Ks.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=As(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}onclick(e){this.opts.disabled.current||e.button>0||this.root.handleClose()}onkeydown(e){this.opts.disabled.current||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),this.root.handleClose())}#e=M(()=>({id:this.opts.id.current,[this.root.getBitsAttr(this.opts.variant.current)]:``,onclick:this.onclick,onkeydown:this.onkeydown,disabled:this.opts.disabled.current?!0:void 0,tabindex:0,...this.root.sharedProps,...this.attachment}));get props(){return H(this.#e)}set props(e){F(this.#e,e)}},Ys=class e{static create(t){return new e(t,Ks.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.titleId=this.opts.id.current,this.attachment=As(this.opts.ref),os.pre(()=>this.opts.id.current,e=>{this.root.titleId=e})}#e=M(()=>({id:this.opts.id.current,role:`heading`,"aria-level":this.opts.level.current,[this.root.getBitsAttr(`title`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return H(this.#e)}set props(e){F(this.#e,e)}},Xs=class e{static create(t){return new e(t,Ks.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.root.descriptionId=this.opts.id.current,this.attachment=As(this.opts.ref,e=>{this.root.descriptionNode=e}),os.pre(()=>this.opts.id.current,e=>{this.root.descriptionId=e})}#e=M(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`description`)]:``,...this.root.sharedProps,...this.attachment}));get props(){return H(this.#e)}set props(e){F(this.#e,e)}},Zs=class e{static create(t){return new e(t,Ks.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=As(this.opts.ref,e=>{this.root.contentNode=e,this.root.contentId=e?.id})}#e=M(()=>({open:this.root.opts.open.current}));get snippetProps(){return H(this.#e)}set snippetProps(e){F(this.#e,e)}#t=M(()=>({id:this.opts.id.current,role:this.root.opts.variant.current===`alert-dialog`?`alertdialog`:`dialog`,"aria-modal":`true`,"aria-describedby":this.root.descriptionId,"aria-labelledby":this.root.titleId,[this.root.getBitsAttr(`content`)]:``,style:{pointerEvents:`auto`,outline:this.root.opts.variant.current===`alert-dialog`?`none`:void 0,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount,contain:`layout style`},tabindex:this.root.opts.variant.current===`alert-dialog`?-1:void 0,"data-nested-open":js(this.root.nestedOpenCount>0),"data-nested":js(this.root.parent!==null),...Ns(this.root.contentPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return H(this.#t)}set props(e){F(this.#t,e)}get shouldRender(){return this.root.contentPresence.shouldRender}},Qs=class e{static create(t){return new e(t,Ks.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=As(this.opts.ref,e=>this.root.overlayNode=e)}#e=M(()=>({open:this.root.opts.open.current}));get snippetProps(){return H(this.#e)}set snippetProps(e){F(this.#e,e)}#t=M(()=>({id:this.opts.id.current,[this.root.getBitsAttr(`overlay`)]:``,style:{pointerEvents:`auto`,"--bits-dialog-depth":this.root.depth,"--bits-dialog-nested-count":this.root.nestedOpenCount},"data-nested-open":js(this.root.nestedOpenCount>0),"data-nested":js(this.root.parent!==null),...Ns(this.root.overlayPresence.transitionStatus),...this.root.sharedProps,...this.attachment}));get props(){return H(this.#t)}set props(e){F(this.#t,e)}get shouldRender(){return this.root.overlayPresence.shouldRender}},$s=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`ref`,`child`,`children`,`level`]),ec=U(`<div><!></div>`);function tc(e,t){let n=oi();k(t,!0);let r=Z(t,`id`,19,()=>Ws(n)),i=Z(t,`ref`,15,null),a=Z(t,`level`,3,2),o=oa(t,$s),s=Ys.create({id:$(()=>r()),level:$(()=>a()),ref:$(()=>i(),e=>i(e))}),c=M(()=>Qo(o,s.props));var l=W(),u=L(l),d=e=>{var n=W();Y(L(n),()=>t.child,()=>({props:H(c)})),G(e,n)},p=e=>{var n=ec();Qi(n,()=>({...H(c)})),Y(I(n),()=>t.children??f),E(n),G(e,n)};q(u,e=>{t.child?e(d):e(p,-1)}),G(e,l),A()}function nc(e,t){var n=W();mi(L(n),()=>t.children,e=>{var n=W();Y(L(n),()=>t.children??f),G(e,n)}),G(e,n)}var rc=new ns(`BitsConfig`);function ic(){let e=new ac(null,{});return rc.getOr(e).opts}var ac=class{opts;constructor(e,t){let n=oc(e,t);this.opts={defaultPortalTo:n(e=>e.defaultPortalTo),defaultLocale:n(e=>e.defaultLocale)}}};function oc(e,t){return n=>$(()=>{let r=n(t)?.current;if(r!==void 0)return r;if(e!==null)return n(e.opts)?.current})}function sc(e,t){return n=>{let r=ic();return $(()=>{let i=n();if(i!==void 0)return i;let a=e(r).current;return a===void 0?t:a})}}var cc=sc(e=>e.defaultPortalTo,`body`);function lc(e,t){k(t,!0);let n=cc(()=>t.to),r=tt(),i=M(a);function a(){if(!Is||t.disabled)return null;let e=null;return e=typeof n.current==`string`?document.querySelector(n.current):n.current,e}let o;function s(){o&&=(di(o),null)}os([()=>H(i),()=>t.disabled],([e,n])=>{if(!e||n){s();return}return o=si(nc,{target:e,props:{children:t.children},context:r}),()=>{s()}});var c=W(),l=L(c),u=e=>{var n=W();Y(L(n),()=>t.children??f),G(e,n)};q(l,e=>{t.disabled&&e(u)}),G(e,c),A()}var uc=class{eventName;options;constructor(e,t={bubbles:!0,cancelable:!0}){this.eventName=e,this.options=t}createEvent(e){return new CustomEvent(this.eventName,{...this.options,detail:e})}dispatch(e,t){let n=this.createEvent(t);return e.dispatchEvent(n),n}listen(e,t,n){return Jr(e,this.eventName,e=>{t(e)},n)}};function dc(e,t=500){let n=null,r=(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)};return r.destroy=()=>{n!==null&&(clearTimeout(n),n=null)},r}function fc(e,t){return e===t||e.contains(t)}function pc(e){return e?.ownerDocument??document}function mc(e,t){let{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom}var hc=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`],gc=hc.join(`,`),_c=typeof Element>`u`,vc=_c?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,yc=!_c&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},bc=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):bc(e.parentNode))},xc=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},Sc=function(e,t,n){if(bc(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(gc));return t&&vc.call(e,gc)&&r.unshift(e),r=r.filter(n),r},Cc=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!bc(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=Cc(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{vc.call(a,gc)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!bc(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=Cc(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},wc=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},Tc=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||xc(e))&&!wc(e)?0:e.tabIndex},Ec=function(e,t){var n=Tc(e);return n<0&&t&&!wc(e)?0:n},Dc=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Oc=function(e){return e.tagName===`INPUT`},kc=function(e){return Oc(e)&&e.type===`hidden`},Ac=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},jc=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Mc=function(e){if(!e.name)return!0;var t=e.form||yc(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=jc(r,e.form);return!i||i===e},Nc=function(e){return Oc(e)&&e.type===`radio`},Pc=function(e){return Nc(e)&&!Mc(e)},Fc=function(e){var t=e&&yc(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=yc(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},Ic=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Lc=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if(getComputedStyle(e).visibility===`hidden`)return!0;var i=vc.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(vc.call(i,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var a=e;e;){var o=e.parentElement,s=yc(e);if(o&&!o.shadowRoot&&r(o)===!0)return Ic(e);e=e.assignedSlot?e.assignedSlot:!o&&s!==e.ownerDocument?s.host:o}e=a}if(Fc(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return Ic(e);return!1},Rc=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return vc.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},zc=function(e,t){return!(t.disabled||kc(t)||Lc(t,e)||Ac(t)||Rc(t))},Bc=function(e,t){return!(Pc(t)||Tc(t)<0||!zc(e,t))},Vc=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},Hc=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=Ec(a,i),s=i?Hc(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(Dc).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Uc=function(e,t){return t||={},Hc(t.getShadowRoot?Cc([e],t.includeContainer,{filter:Bc.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Vc}):Sc(e,t.includeContainer,Bc.bind(null,t)))},Wc=function(e,t){return t||={},t.getShadowRoot?Cc([e],t.includeContainer,{filter:zc.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Sc(e,t.includeContainer,zc.bind(null,t))},Gc=hc.concat(`iframe:not([inert]):not([inert] *)`).join(`,`),Kc=function(e,t){if(t||={},!e)throw Error(`No node provided`);return vc.call(e,Gc)===!1?!1:zc(t,e)},qc=`data-context-menu-trigger`,Jc=`data-context-menu-content`;new ns(`Menu.Root`),new ns(`Menu.Root | Menu.Sub`),new ns(`Menu.Content`),new ns(`Menu.Group | Menu.RadioGroup`),new ns(`Menu.RadioGroup`),new ns(`Menu.CheckboxGroup`),new uc(`bitsmenuopen`,{bubbles:!1,cancelable:!0}),Fs({component:`menu`,parts:[`trigger`,`content`,`sub-trigger`,`item`,`group`,`group-heading`,`checkbox-group`,`checkbox-item`,`radio-group`,`radio-item`,`separator`,`sub-content`,`arrow`]}),globalThis.bitsDismissableLayers??=new Map;var Yc=class e{static create(t){return new e(t)}opts;#e;#t;#n={pointerdown:!1};#r=!1;#i=!1;#a=void 0;#o;#s=Us;constructor(e){this.opts=e,this.#t=e.interactOutsideBehavior,this.#e=e.onInteractOutside,this.#o=e.onFocusOutside,Ln(()=>{this.#a=pc(this.opts.ref.current)});let t=Us,n=()=>{this.#g(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),t()};os([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(!(!this.opts.enabled.current||!this.opts.ref.current))return gs(1,()=>{this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,this.#t),t(),t=this.#l())}),n}),hs(()=>{this.#g.destroy(),globalThis.bitsDismissableLayers.delete(this),this.#d.destroy(),this.#s(),t()})}#c=e=>{e.defaultPrevented||this.opts.ref.current&&_s(()=>{!this.opts.ref.current||this.#h(e.target)||e.target&&!this.#i&&this.#o.current?.(e)})};#l(){return Go(Jr(this.#a,`pointerdown`,Go(this.#f,this.#m),{capture:!0}),Jr(this.#a,`pointerdown`,Go(this.#p,this.#d)),Jr(this.#a,`focusin`,this.#c))}#u=e=>{let t=e;t.defaultPrevented&&(t=$c(e)),this.#e.current(e)};#d=dc(e=>{if(!this.opts.ref.current){this.#s();return}let t=this.opts.isValidEvent.current(e,this.opts.ref.current)||Qc(e,this.opts.ref.current);if(!this.#r||this.#_()||!t){this.#s();return}let n=e;if(n.defaultPrevented&&(n=$c(n)),this.#t.current!==`close`&&this.#t.current!==`defer-otherwise-close`){this.#s();return}e.pointerType===`touch`?(this.#s(),this.#s=Jr(this.#a,`click`,this.#u,{once:!0})):this.#e.current(n)},10);#f=e=>{this.#n[e.type]=!0};#p=e=>{this.#n[e.type]=!1};#m=()=>{this.opts.ref.current&&(this.#r=Zc(this.opts.ref.current))};#h=e=>this.opts.ref.current?fc(this.opts.ref.current,e):!1;#g=dc(()=>{for(let e in this.#n)this.#n[e]=!1;this.#r=!1},20);#_(){return Object.values(this.#n).some(Boolean)}#v=()=>{this.#i=!0};#y=()=>{this.#i=!1};props={onfocuscapture:this.#v,onblurcapture:this.#y}};function Xc(e=[...globalThis.bitsDismissableLayers]){return e.findLast(([e,{current:t}])=>t===`close`||t===`ignore`)}function Zc(e){let t=[...globalThis.bitsDismissableLayers],n=Xc(t);if(n)return n[0].opts.ref.current===e;let[r]=t[0];return r.opts.ref.current===e}function Qc(e,t){let n=e.target;if(!Bs(n))return!1;let r=!!n.closest(`[${qc}]`),i=!!t.closest(`[${Jc}]`);return`button`in e&&e.button>0&&!r?!1:`button`in e&&e.button===0&&r&&i?!0:r&&i?!1:pc(n).documentElement.contains(n)&&!fc(t,n)&&mc(e,t)}function $c(e){let t=e.currentTarget,n=e.target,r;r=e instanceof PointerEvent?new PointerEvent(e.type,e):new PointerEvent(`pointerdown`,e);let i=!1;return new Proxy(r,{get:(r,a)=>a===`currentTarget`?t:a===`target`?n:a===`preventDefault`?()=>{i=!0,typeof r.preventDefault==`function`&&r.preventDefault()}:a===`defaultPrevented`?i:a in r?r[a]:e[a]})}function el(e,t){k(t,!0);let n=Z(t,`interactOutsideBehavior`,3,`close`),r=Z(t,`onInteractOutside`,3,Us),i=Z(t,`onFocusOutside`,3,Us),a=Z(t,`isValidEvent`,3,()=>!1),o=Yc.create({id:$(()=>t.id),interactOutsideBehavior:$(()=>n()),onInteractOutside:$(()=>r()),enabled:$(()=>t.enabled),onFocusOutside:$(()=>i()),isValidEvent:$(()=>a()),ref:t.ref});var s=W();Y(L(s),()=>t.children??f,()=>({props:o.props})),G(e,s),A()}globalThis.bitsEscapeLayers??=new Map;var tl=class e{static create(t){return new e(t)}opts;domContext;constructor(e){this.opts=e,this.domContext=new ks(this.opts.ref);let t=Us;os(()=>e.enabled.current,n=>(n&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),t=this.#e()),()=>{t(),globalThis.bitsEscapeLayers.delete(this)}))}#e=()=>Jr(this.domContext.getDocument(),`keydown`,this.#t,{passive:!1});#t=e=>{if(e.key!==`Escape`||!nl(this))return;let t=new KeyboardEvent(e.type,e);e.preventDefault();let n=this.opts.escapeKeydownBehavior.current;n!==`close`&&n!==`defer-otherwise-close`||this.opts.onEscapeKeydown.current(t)}};function nl(e){let t=[...globalThis.bitsEscapeLayers],n=t.findLast(([e,{current:t}])=>t===`close`||t===`ignore`);if(n)return n[0]===e;let[r]=t[0];return r===e}function rl(e,t){k(t,!0);let n=Z(t,`escapeKeydownBehavior`,3,`close`),r=Z(t,`onEscapeKeydown`,3,Us);tl.create({escapeKeydownBehavior:$(()=>n()),onEscapeKeydown:$(()=>r()),enabled:$(()=>t.enabled),ref:t.ref});var i=W();Y(L(i),()=>t.children??f),G(e,i),A()}var il=class e{static instance;#e=_o([]);#t=new WeakMap;#n=new WeakMap;static getInstance(){return this.instance||=new e,this.instance}register(e){let t=this.getActive();t&&t!==e&&t.pause();let n=document.activeElement;n&&n!==document.body&&this.#n.set(e,n),this.#e.current=this.#e.current.filter(t=>t!==e),this.#e.current.unshift(e)}unregister(e){this.#e.current=this.#e.current.filter(t=>t!==e);let t=this.getActive();t&&t.resume()}getActive(){return this.#e.current[0]}setFocusMemory(e,t){this.#t.set(e,t)}getFocusMemory(e){return this.#t.get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,t){this.#n.set(e,t)}getPreFocusMemory(e){return this.#n.get(e)}clearPreFocusMemory(e){this.#n.delete(e)}},al=class e{#e=!1;#t=null;#n=il.getInstance();#r=[];#i;constructor(e){this.#i=e}get paused(){return this.#e}pause(){this.#e=!0}resume(){this.#e=!1}#a(){for(let e of this.#r)e();this.#r=[]}mount(e){this.#t&&this.unmount(),this.#t=e,this.#n.register(this),this.#c(),this.#o()}unmount(){this.#t&&=(this.#a(),this.#s(),this.#n.unregister(this),this.#n.clearPreFocusMemory(this),null)}#o(){if(!this.#t)return;let e=new CustomEvent(`focusScope.onOpenAutoFocus`,{bubbles:!1,cancelable:!0});this.#i.onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!this.#t)return;let e=this.#u();e?(e.focus(),this.#n.setFocusMemory(this,e)):this.#t.focus()})}#s(){let e=new CustomEvent(`focusScope.onCloseAutoFocus`,{bubbles:!1,cancelable:!0});if(this.#i.onCloseAutoFocus.current?.(e),!e.defaultPrevented){let e=this.#n.getPreFocusMemory(this);if(e&&document.contains(e))try{e.focus()}catch{document.body.focus()}}}#c(){if(!this.#t||!this.#i.trap.current)return;let e=this.#t,t=e.ownerDocument;this.#r.push(Jr(t,`focusin`,t=>{if(this.#e||!this.#n.isActiveScope(this))return;let n=t.target;if(n)if(e.contains(n))this.#n.setFocusMemory(this,n);else{let n=this.#n.getFocusMemory(this);if(n&&e.contains(n)&&Kc(n))t.preventDefault(),n.focus();else{let t=this.#u(),n=this.#d()[0];(t||n||e).focus()}}},{capture:!0}),Jr(e,`keydown`,e=>{if(!this.#i.loop||this.#e||e.key!==`Tab`||!this.#n.isActiveScope(this))return;let n=this.#l();if(n.length===0)return;let r=n[0],i=n[n.length-1];!e.shiftKey&&t.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&t.activeElement===r&&(e.preventDefault(),i.focus())}));let n=new MutationObserver(()=>{let t=this.#n.getFocusMemory(this);if(t&&!e.contains(t)){let t=this.#u(),n=this.#d()[0],r=t||n;r?(r.focus(),this.#n.setFocusMemory(this,r)):e.focus()}});n.observe(e,{childList:!0,subtree:!0}),this.#r.push(()=>n.disconnect())}#l(){return this.#t?Uc(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}#u(){return this.#l()[0]||null}#d(){return this.#t?Wc(this.#t,{includeContainer:!1,getShadowRoot:!0}):[]}static use(t){let n=null;return os([()=>t.ref.current,()=>t.enabled.current],([r,i])=>{r&&i?(n||=new e(t),n.mount(r)):n&&=(n.unmount(),null)}),hs(()=>{n?.unmount()}),{get props(){return{tabindex:-1}}}}};function ol(e,t){k(t,!0);let n=Z(t,`enabled`,3,!1),r=Z(t,`trapFocus`,3,!1),i=Z(t,`loop`,3,!1),a=Z(t,`onCloseAutoFocus`,3,Us),o=Z(t,`onOpenAutoFocus`,3,Us),s=al.use({enabled:$(()=>n()),trap:$(()=>r()),loop:i(),onCloseAutoFocus:$(()=>a()),onOpenAutoFocus:$(()=>o()),ref:t.ref});var c=W();Y(L(c),()=>t.focusScope??f,()=>({props:s.props})),G(e,c),A()}var sl=()=>{};globalThis.bitsTextSelectionLayers??=new Map;var cl=class e{static create(t){return new e(t)}opts;domContext;#e=Us;#t=!1;#n=sl;#r=sl;constructor(e){this.opts=e,this.domContext=new ks(e.ref);let t=Us;os(()=>[this.opts.enabled.current,this.opts.onPointerDown.current,this.opts.onPointerUp.current],([e,n,r])=>(this.#t=e,this.#n=n,this.#r=r,e&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),t(),t=this.#i()),()=>{this.#t=!1,t(),this.#s(),globalThis.bitsTextSelectionLayers.delete(this)}))}#i(){return Go(Jr(this.domContext.getDocument(),`pointerdown`,this.#o),Jr(this.domContext.getDocument(),`pointerup`,vo(this.#s,this.#a)))}#a=e=>{this.#r(e)};#o=e=>{let t=this.opts.ref.current,n=e.target;!zs(t)||!zs(n)||!this.#t||!fl(this)||!Es(t,n)||(this.#n(e),!e.defaultPrevented&&(this.#e=ul(t,this.domContext.getDocument().body)))};#s=()=>{this.#e(),this.#e=Us}},ll=e=>e.style.userSelect||e.style.webkitUserSelect;function ul(e,t){let n=ll(t),r=ll(e);return dl(t,`none`),dl(e,`text`),()=>{dl(t,n),dl(e,r)}}function dl(e,t){e.style.userSelect=t,e.style.webkitUserSelect=t}function fl(e){let t=[...globalThis.bitsTextSelectionLayers];if(!t.length)return!1;let n=t.at(-1);return n?n[0]===e:!1}function pl(e,t){k(t,!0);let n=Z(t,`preventOverflowTextSelection`,3,!0),r=Z(t,`onPointerDown`,3,Us),i=Z(t,`onPointerUp`,3,Us);cl.create({id:$(()=>t.id),onPointerDown:$(()=>r()),onPointerUp:$(()=>i()),enabled:$(()=>t.enabled&&n()),ref:t.ref});var a=W();Y(L(a),()=>t.children??f),G(e,a),A()}globalThis.bitsIdCounter??={current:0};function ml(e=`bits`){return globalThis.bitsIdCounter.current++,`${e}-${globalThis.bitsIdCounter.current}`}var hl=class{#e;#t=0;#n=P();#r;constructor(e){this.#e=e}#i(){--this.#t,this.#r&&this.#t<=0&&(this.#r(),F(this.#n,void 0),this.#r=void 0)}get(...e){return this.#t+=1,H(this.#n)===void 0&&(this.#r=Bn(()=>{F(this.#n,this.#e(...e),!0)})),Ln(()=>()=>{this.#i()}),H(this.#n)}},gl=new ts,_l=P(null),vl=null,yl=null,bl=!1,xl=$(()=>{for(let e of gl.values())if(e)return!0;return!1}),Sl=null,Cl=new hl(()=>{function e(){document.body.setAttribute(`style`,H(_l)??``),document.body.style.removeProperty(`--scrollbar-width`),Ls&&vl?.(),F(_l,null)}function t(){yl!==null&&(window.clearTimeout(yl),yl=null)}function n(e,n){t(),bl=!0,Sl=Date.now();let r=Sl,i=()=>{yl=null,Sl===r&&(Tl(gl)?bl=!1:(bl=!1,n()))},a=e===null?24:e;yl=window.setTimeout(i,a)}function r(){H(_l)===null&&gl.size===0&&!bl&&F(_l,document.body.getAttribute(`style`),!0)}return os(()=>xl.current,()=>{if(!xl.current)return;r(),bl=!1;let e=getComputedStyle(document.documentElement),t=getComputedStyle(document.body),n=e.scrollbarGutter?.includes(`stable`)||t.scrollbarGutter?.includes(`stable`),i=window.innerWidth-document.documentElement.clientWidth,a={padding:Number.parseInt(t.paddingRight??`0`,10)+i,margin:Number.parseInt(t.marginRight??`0`,10)};i>0&&!n&&(document.body.style.paddingRight=`${a.padding}px`,document.body.style.marginRight=`${a.margin}px`,document.body.style.setProperty(`--scrollbar-width`,`${i}px`)),document.body.style.overflow=`hidden`,Ls&&(vl=Jr(document,`touchmove`,e=>{e.target===document.documentElement&&(e.touches.length>1||e.preventDefault())},{passive:!1})),_s(()=>{document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`})}),hs(()=>()=>{vl?.()}),{get lockMap(){return gl},resetBodyStyle:e,scheduleCleanupIfNoNewLocks:n,cancelPendingCleanup:t,ensureInitialStyleCaptured:r}}),wl=class{#e=ml();#t;#n=()=>null;#r;locked;constructor(e,t=()=>null){this.#t=e,this.#n=t,this.#r=Cl.get(),this.#r&&(this.#r.cancelPendingCleanup(),this.#r.ensureInitialStyleCaptured(),this.#r.lockMap.set(this.#e,this.#t??!1),this.locked=$(()=>this.#r.lockMap.get(this.#e)??!1,e=>this.#r.lockMap.set(this.#e,e)),hs(()=>{if(this.#r.lockMap.delete(this.#e),Tl(this.#r.lockMap))return;let e=this.#n();this.#r.scheduleCleanupIfNoNewLocks(e,()=>{this.#r.resetBodyStyle()})}))}};function Tl(e){for(let[t,n]of e)if(n)return!0;return!1}function El(e,t){k(t,!0);let n=Z(t,`preventScroll`,3,!0),r=Z(t,`restoreScrollDelay`,3,null);n()&&new wl(n(),()=>r()),A()}var Dl=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`forceMount`,`child`,`children`,`ref`]),Ol=U(`<div><!></div>`);function kl(e,t){let n=oi();k(t,!0);let r=Z(t,`id`,19,()=>Ws(n)),i=Z(t,`forceMount`,3,!1),a=Z(t,`ref`,15,null),o=oa(t,Dl),s=Qs.create({id:$(()=>r()),ref:$(()=>a(),e=>a(e))}),c=M(()=>Qo(o,s.props));var l=W(),u=L(l),d=e=>{var n=W(),r=L(n),i=e=>{var n=W(),r=L(n);{let e=M(()=>({props:Qo(H(c)),...s.snippetProps}));Y(r,()=>t.child,()=>H(e))}G(e,n)},a=e=>{var n=Ol();Qi(n,e=>({...e}),[()=>Qo(H(c))]),Y(I(n),()=>t.children??f,()=>s.snippetProps),E(n),G(e,n)};q(r,e=>{t.child?e(i):e(a,-1)}),G(e,n)};q(u,e=>{(s.shouldRender||i())&&e(d)}),G(e,l),A()}var Al=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`]),jl=U(`<div><!></div>`);function Ml(e,t){let n=oi();k(t,!0);let r=Z(t,`id`,19,()=>Ws(n)),i=Z(t,`ref`,15,null),a=oa(t,Al),o=Xs.create({id:$(()=>r()),ref:$(()=>i(),e=>i(e))}),s=M(()=>Qo(a,o.props));var c=W(),l=L(c),u=e=>{var n=W();Y(L(n),()=>t.child,()=>({props:H(s)})),G(e,n)},d=e=>{var n=jl();Qi(n,()=>({...H(s)})),Y(I(n),()=>t.children??f),E(n),G(e,n)};q(l,e=>{t.child?e(u):e(d,-1)}),G(e,c),A()}function Nl(e,t){k(t,!0);let n=Z(t,`open`,15,!1),r=Z(t,`onOpenChange`,3,Us),i=Z(t,`onOpenChangeComplete`,3,Us);qs.create({variant:$(()=>`dialog`),open:$(()=>n(),e=>{n(e),r()(e)}),onOpenChangeComplete:$(()=>i())});var a=W();Y(L(a),()=>t.children??f),G(e,a),A()}var Pl=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),Fl=U(`<button><!></button>`);function Il(e,t){let n=oi();k(t,!0);let r=Z(t,`id`,19,()=>Ws(n)),i=Z(t,`ref`,15,null),a=Z(t,`disabled`,3,!1),o=oa(t,Pl),s=Js.create({variant:$(()=>`close`),id:$(()=>r()),ref:$(()=>i(),e=>i(e)),disabled:$(()=>!!a())}),c=M(()=>Qo(o,s.props));var l=W(),u=L(l),d=e=>{var n=W();Y(L(n),()=>t.child,()=>({props:H(c)})),G(e,n)},p=e=>{var n=Fl();Qi(n,()=>({...H(c)})),Y(I(n),()=>t.children??f),E(n),G(e,n)};q(u,e=>{t.child?e(d):e(p,-1)}),G(e,l),A()}var Ll=new Set([`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),Rl=U(`<!> <!>`,1),zl=U(`<!> <div><!></div>`,1);function Bl(e,t){let n=oi();k(t,!0);let r=Z(t,`id`,19,()=>Ws(n)),i=Z(t,`ref`,15,null),a=Z(t,`forceMount`,3,!1),o=Z(t,`onCloseAutoFocus`,3,Us),s=Z(t,`onOpenAutoFocus`,3,Us),c=Z(t,`onEscapeKeydown`,3,Us),l=Z(t,`onInteractOutside`,3,Us),u=Z(t,`trapFocus`,3,!0),d=Z(t,`preventScroll`,3,!0),p=Z(t,`restoreScrollDelay`,3,null),m=oa(t,Ll),h=Zs.create({id:$(()=>r()),ref:$(()=>i(),e=>i(e))}),g=M(()=>Qo(m,h.props));var _=W(),v=L(_),y=e=>{ol(e,{get ref(){return h.opts.ref},loop:!0,get trapFocus(){return u()},get enabled(){return h.root.opts.open.current},get onOpenAutoFocus(){return s()},get onCloseAutoFocus(){return o()},focusScope:(e,n)=>{let r=()=>n?.().props;rl(e,ca(()=>H(g),{get enabled(){return h.root.opts.open.current},get ref(){return h.opts.ref},onEscapeKeydown:e=>{c()(e),!e.defaultPrevented&&h.root.handleClose()},children:(e,n)=>{el(e,ca(()=>H(g),{get ref(){return h.opts.ref},get enabled(){return h.root.opts.open.current},onInteractOutside:e=>{l()(e),!e.defaultPrevented&&h.root.handleClose()},children:(e,n)=>{pl(e,ca(()=>H(g),{get ref(){return h.opts.ref},get enabled(){return h.root.opts.open.current},children:(e,n)=>{var i=W(),a=L(i),o=e=>{var n=Rl(),i=L(n),a=e=>{El(e,{get preventScroll(){return d()},get restoreScrollDelay(){return p()}})};q(i,e=>{h.root.opts.open.current&&e(a)});var o=R(i,2);{let e=M(()=>({props:Qo(H(g),r()),...h.snippetProps}));Y(o,()=>t.child,()=>H(e))}G(e,n)},s=e=>{var n=zl(),i=L(n);El(i,{get preventScroll(){return d()}});var a=R(i,2);Qi(a,e=>({...e}),[()=>Qo(H(g),r())]),Y(I(a),()=>t.children??f),E(a),G(e,n)};q(a,e=>{t.child?e(o):e(s,-1)}),G(e,i)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};q(v,e=>{(h.shouldRender||a())&&e(y)}),G(e,_),A()}var Vl=U(`<button class="flex flex-col gap-1 text-left"><div class="flex items-center gap-2 font-mono text-sm"><span class="size-2 shrink-0 rounded-sm"></span> <span class="flex-1 truncate text-foreground"> </span> <span class="tabular-nums text-muted-foreground"> </span></div> <div class="h-1 overflow-hidden rounded-full bg-border"><div class="h-full"></div></div></button>`),Hl=U(`<div class="text-sm text-muted-foreground">No projects tracked yet \u2014 run <code class="text-foreground">syn .</code></div>`),Ul=U(`<div class="flex max-h-[260px] flex-col gap-2 overflow-y-auto pr-1"></div>`),Wl=U(`<div class="flex flex-col gap-0.5 bg-card p-3"><span class="font-mono text-[10px] uppercase tracking-[0.1em] text-muted-foreground"> </span> <span class="font-mono text-sm text-foreground"> </span></div>`),Gl=U(`<!> <!> <div class="mt-4 grid grid-cols-2 gap-px overflow-hidden rounded-lg border bg-border"></div> <!>`,1),Kl=U(`<!> <!>`,1);function ql(e,t){k(t,!0);let n=P(!1),r=P(null),i=M(()=>Q.data?.projects??[]),a=M(()=>Math.max(1,...H(i).map(e=>e.total_turns)));function o(e){let t=(Q.data?.recent_turns??[]).find(t=>t.project_path===e.path);return t?pa(t.ts):e.last_seen?pa(e.last_seen):`\u2014`}function s(e){return[[`Cost`,fa(e.estimated_cost_usd)],[`Turns`,da(e.total_turns)],[`Input`,da(e.total_input_tokens)],[`Output`,da(e.total_output_tokens)],[`Cache R`,da(e.total_cache_read)],[`Cache W`,da(e.total_cache_create)],[`Blocks`,da(e.blocked_count)],[`Last active`,o(e)]]}var c=Kl(),l=L(c);eo(l,{title:`Projects`,meta:`by turns`,children:(e,t)=>{var o=Ul();J(o,21,()=>H(i),e=>e.path,(e,t)=>{var i=Vl(),o=I(i),s=I(o),c=R(s,2),l=I(c,!0);E(c);var u=R(c,2),d=I(u,!0);E(u),E(o);var f=R(o,2),p=I(f);E(f),E(i),z((e,n,r)=>{Ii(s,e),K(l,H(t).name),K(d,n),Ii(p,r)},[()=>`background:${va(H(t).name)}`,()=>da(H(t).total_turns),()=>`width:${H(t).total_turns/H(a)*100}%; background:${va(H(t).name)}`]),Yr(`click`,i,()=>{F(r,H(t),!0),F(n,!0)}),G(e,i)},e=>{G(e,Hl())}),E(o),G(e,o)},$$slots:{default:!0}}),X(R(l,2),()=>Nl,(e,t)=>{t(e,{get open(){return H(n)},set open(e){F(n,e,!0)},children:(e,t)=>{var n=W();X(L(n),()=>lc,(e,t)=>{t(e,{children:(e,t)=>{var n=Kl(),i=L(n);X(i,()=>kl,(e,t)=>{t(e,{class:`fixed inset-0 z-50 bg-black/60`})}),X(R(i,2),()=>Bl,(e,t)=>{t(e,{class:`fixed left-1/2 top-1/2 z-50 w-[min(440px,92vw)] -translate-x-1/2 -translate-y-1/2 rounded-xl border bg-card p-5 text-card-foreground shadow-2xl`,children:(e,t)=>{var n=W(),i=L(n),a=e=>{var t=Gl(),n=L(t);{let e=M(()=>`color:${va(H(r).name)}`);X(n,()=>tc,(t,n)=>{n(t,{class:`font-serif text-xl`,get style(){return H(e)},children:(e,t)=>{D();var n=ai();z(()=>K(n,H(r).name)),G(e,n)},$$slots:{default:!0}})})}var i=R(n,2);X(i,()=>Ml,(e,t)=>{t(e,{class:`truncate font-mono text-xs text-muted-foreground`,children:(e,t)=>{D();var n=ai();z(()=>K(n,H(r).path)),G(e,n)},$$slots:{default:!0}})});var a=R(i,2);J(a,21,()=>s(H(r)),([e,t])=>e,(e,t)=>{var n=M(()=>h(H(t),2));let r=()=>H(n)[0],i=()=>H(n)[1];var a=Wl(),o=I(a),s=I(o,!0);E(o);var c=R(o,2),l=I(c,!0);E(c),E(a),z(()=>{K(s,r()),K(l,i())}),G(e,a)}),E(a),X(R(a,2),()=>Il,(e,t)=>{t(e,{class:`mt-4 w-full rounded-md border py-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:(e,t)=>{D(),G(e,ai(`Close`))},$$slots:{default:!0}})}),G(e,t)};q(i,e=>{H(r)&&e(a)}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,c),A()}Xr([`click`]);var Jl=U(`<div class="flex items-baseline justify-between font-mono text-sm"><span class="text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span></div>`),Yl=U(`<div class="text-sm text-muted-foreground">No graph-tool calls yet.</div>`),Xl=U(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">calls</span></div> <div class="flex flex-col gap-1.5"></div>`,1);function Zl(e,t){k(t,!0);let n=M(()=>{let e=Q.data?.global?.tool_calls??{};return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,8)}),r=M(()=>Q.data?.global?.total_tool_calls??0);eo(e,{title:`Graph tools used`,meta:`all projects`,children:(e,t)=>{var i=Xl(),a=L(i),o=I(a);D(),E(a);var s=R(a,2);J(s,21,()=>H(n),([e,t])=>e,(e,t)=>{var n=M(()=>h(H(t),2));let r=()=>H(n)[0],i=()=>H(n)[1];var a=Jl(),o=I(a),s=I(o,!0);E(o);var c=R(o,2),l=I(c,!0);E(c),E(a),z(()=>{K(s,r()),K(l,i())}),G(e,a)},e=>{G(e,Yl())}),E(s),z(e=>K(o,`${e??``} `),[()=>da(H(r))]),G(e,i)},$$slots:{default:!0}}),A()}var Ql=U(`<tr class="border-t border-border/60"><td class="py-1.5 pr-2 text-muted-foreground"> </td><td class="max-w-[120px] truncate py-1.5 pr-2 text-foreground"> </td><td class="py-1.5 pr-2"><span class="inline-flex items-center gap-1.5 rounded px-1.5 py-0.5"><span class="size-1.5 rounded-sm"></span> </span></td><td class="py-1.5 pr-2 text-right tabular-nums text-foreground"> </td><td class="py-1.5 pr-2 text-right tabular-nums text-foreground"> </td><td class="py-1.5 pr-2 text-right tabular-nums text-muted-foreground"> </td><td class="py-1.5 text-right tabular-nums text-[var(--money)]"> </td></tr>`),$l=U(`<tr><td colspan="7" class="py-6 text-center text-muted-foreground">No turns recorded yet.</td></tr>`),eu=U(`<div class="flex items-center justify-end gap-3 pt-1 font-mono text-sm text-muted-foreground"><button class="rounded border px-2 py-1 disabled:opacity-40 enabled:hover:text-foreground">\u2039 Prev</button> <span> </span> <button class="rounded border px-2 py-1 disabled:opacity-40 enabled:hover:text-foreground">Next \u203A</button></div>`),tu=U(`<div class="min-h-0 flex-1 overflow-x-auto"><table class="w-full border-collapse font-mono text-sm"><thead><tr class="text-left text-[10px] uppercase tracking-[0.1em] text-muted-foreground"><th class="py-1.5 pr-2 font-medium">Time</th><th class="py-1.5 pr-2 font-medium">Project</th><th class="py-1.5 pr-2 font-medium">Model</th><th class="py-1.5 pr-2 text-right font-medium">In</th><th class="py-1.5 pr-2 text-right font-medium">Out</th><th class="py-1.5 pr-2 text-right font-medium">Cache R/W</th><th class="py-1.5 text-right font-medium">Cost</th></tr></thead><tbody></tbody></table></div> <!>`,1);function nu(e,t){k(t,!0);let n=P(1),r=M(()=>Q.data?.recent_turns??[]),i=M(()=>Math.max(1,Math.ceil(H(r).length/25)));Ln(()=>{H(n)>H(i)&&F(n,H(i),!0)});let a=M(()=>H(r).slice((H(n)-1)*25,(H(n)-1)*25+25)),o=M(()=>H(r).length?(H(n)-1)*25+1:0),s=M(()=>Math.min(H(n)*25,H(r).length));{let t=M(()=>`showing ${H(o)}\u2013${H(s)} of ${H(r).length}`);eo(e,{title:`Recent turns`,get meta(){return H(t)},children:(e,t)=>{var r=tu(),o=L(r),s=I(o),c=R(I(s));J(c,21,()=>H(a),e=>e.ts+e.project_path+e.model,(e,t)=>{var n=Ql(),r=I(n),i=I(r,!0);E(r);var a=R(r),o=I(a,!0);E(a);var s=R(a),c=I(s),l=I(c),u=R(l);E(c),E(s);var d=R(s),f=I(d,!0);E(d);var p=R(d),m=I(p,!0);E(p);var h=R(p),g=I(h);E(h);var _=R(h),v=I(_,!0);E(_),E(n),z((e,n,r,s,d,p,h,_,y)=>{K(i,e),Xi(a,`title`,H(t).project_name),K(o,H(t).project_name),Ii(c,n),Ii(l,r),K(u,` ${s??``}`),K(f,d),K(m,p),K(g,`${h??``} / ${_??``}`),K(v,y)},[()=>pa(H(t).ts),()=>`color: var(--c-${ma(H(t).model)})`,()=>`background: var(--c-${ma(H(t).model)})`,()=>ha(H(t).model),()=>da(H(t).input),()=>da(H(t).output),()=>da(H(t).cache_read),()=>da(H(t).cache_create),()=>fa(H(t).cost_usd)]),G(e,n)},e=>{G(e,$l())}),E(c),E(s),E(o);var l=R(o,2),u=e=>{var t=eu(),r=I(t),a=R(r,2),o=I(a);E(a);var s=R(a,2);E(t),z(()=>{r.disabled=H(n)<=1,K(o,`page ${H(n)??``} of ${H(i)??``}`),s.disabled=H(n)>=H(i)}),Yr(`click`,r,()=>F(n,Math.max(1,H(n)-1),!0)),Yr(`click`,s,()=>F(n,Math.min(H(i),H(n)+1),!0)),G(e,t)};q(l,e=>{H(i)>1&&e(u)}),G(e,r)},$$slots:{default:!0}})}A()}Xr([`click`]);var ru=U(`<div class="font-mono text-xs text-muted-foreground" title="Codebase exploration via the terminal (rg / cat / find) \u2014 observe-only, not yet blocked"> <span> </span></div>`),iu=U(`<div class="flex items-baseline gap-2 font-mono text-xs"><span class="shrink-0 text-muted-foreground"> </span> <span> </span> <span class="truncate text-foreground/80"> </span></div>`),au=U(`<div class="text-sm text-muted-foreground">No gate decisions yet.</div>`),ou=U(`<div class="mt-2 border-t border-border pt-2 text-[10px] uppercase tracking-wide text-muted-foreground">Terminal hunts (observe-only)</div> <!>`,1),su=U(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">blocks</span></div> <!> <div class="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto"><!> <!></div>`,1);function cu(e,t){k(t,!0);let n=M(()=>(Q.data?.recent_gates??[]).slice(0,50)),r=M(()=>Q.data?.global?.blocked_count??0),i=M(()=>Q.data?.global?.bash_explorations??0),a=M(()=>Q.data?.global?.bash_avoidable??0),o=M(()=>(Q.data?.recent_bash??[]).slice(0,12));eo(e,{title:`The Moat`,meta:`PreToolUse`,children:(e,t)=>{var s=su(),c=L(s),l=I(c);D(),E(c);var u=R(c,2),d=e=>{var t=ru(),n=I(t),r=R(n),o=I(r);E(r),E(t),z((e,t)=>{K(n,`\u21B3 ${e??``} terminal hunts \xB7 `),Pi(r,1,Oi(H(a)>0?`text-destructive`:``)),K(o,`${t??``} the graph could answer`)},[()=>da(H(i)),()=>da(H(a))]),G(e,t)};q(u,e=>{H(i)>0&&e(d)});var f=R(u,2),p=I(f);J(p,17,()=>H(n),e=>e.ts+e.query,(e,t)=>{var n=iu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a);var s=R(a,2),c=I(s,!0);E(s),E(n),z(e=>{K(i,e),Pi(a,1,`shrink-0 rounded px-1 text-[10px] uppercase `+(H(t).decision===`block`?`bg-destructive/15 text-destructive`:`bg-[var(--c-fable)]/12 text-[var(--c-fable)]`)),K(o,H(t).decision),Xi(s,`title`,H(t).query??``),K(c,H(t).query??`\u2014`)},[()=>pa(H(t).ts)]),G(e,n)},e=>{G(e,au())});var m=R(p,2),h=e=>{var t=ou();J(R(L(t),2),17,()=>H(o),e=>e.ts+e.query,(e,t)=>{var n=iu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a);var s=R(a,2),c=I(s,!0);E(s),E(n),z(e=>{K(i,e),Pi(a,1,`shrink-0 rounded px-1 text-[10px] uppercase `+(H(t).avoidable?`bg-destructive/15 text-destructive`:`bg-muted text-muted-foreground`)),K(o,H(t).tool),Xi(s,`title`,H(t).query??``),K(c,H(t).query??`\u2014`)},[()=>pa(H(t).ts)]),G(e,n)}),G(e,t)};q(m,e=>{H(o).length>0&&e(h)}),E(f),z(e=>K(l,`${e??``} `),[()=>da(H(r))]),G(e,s)},$$slots:{default:!0}}),A()}var lu=U(`<div class="flex items-baseline justify-between gap-3 font-mono text-sm"><span class="truncate text-muted-foreground"> </span> <span class="tabular-nums text-foreground"> </span></div>`),uu=U(`<div class="text-sm text-muted-foreground">No usage learned yet \u2014 Synthra learns as you read/edit files.</div>`),du=U(`<div class="font-mono text-2xl text-foreground"> <span class="text-sm text-muted-foreground">tracked</span></div> <div class="flex max-h-[190px] flex-col gap-1.5 overflow-y-auto"></div>`,1);function fu(e,t){k(t,!0);let n=M(()=>Q.data?.active),r=M(()=>H(n)?.stats?.hot_files??[]);{let t=M(()=>H(n)?.project_name??`active project`);eo(e,{title:`Hot files`,get meta(){return H(t)},children:(e,t)=>{var i=du(),a=L(i),o=I(a);D(),E(a);var s=R(a,2);J(s,21,()=>H(r),e=>e.path,(e,t)=>{var n=lu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a),E(n),z(e=>{Xi(n,`title`,H(t).path),K(i,e),K(o,H(t).score)},[()=>ga(H(t).path)]),G(e,n)},e=>{G(e,uu())}),E(s),z(e=>K(o,`${e??``} `),[()=>da(H(n)?.stats?.hot_files_total??0)]),G(e,i)},$$slots:{default:!0}})}A()}var pu=U(`<div class="grid grid-cols-1 gap-4 p-5 lg:grid-cols-3"><div class="lg:col-span-3 lg:row-start-1"><!></div> <div class="lg:col-start-1 lg:row-start-2"><!></div> <div class="lg:col-start-2 lg:row-start-2"><!></div> <div class="lg:col-start-1 lg:row-start-3"><!></div> <div class="lg:col-start-2 lg:row-start-3"><!></div> <div class="lg:col-start-1 lg:row-start-4"><!></div> <div class="lg:col-start-2 lg:row-start-4"><!></div> <div class="relative lg:col-start-3 lg:row-start-2 lg:row-span-3"><div class="lg:absolute lg:inset-0"><!></div></div> <div class="lg:col-span-3 lg:row-start-5"><!></div></div>`);function mu(e){var t=pu(),n=I(t);Xa(I(n),{}),E(n);var r=R(n,2);no(I(r),{}),E(r);var i=R(r,2);io(I(i),{}),E(i);var a=R(i,2);lo(I(a),{}),E(a);var o=R(a,2);fu(I(o),{}),E(o);var s=R(o,2);ql(I(s),{}),E(s);var c=R(s,2);Zl(I(c),{}),E(c);var l=R(c,2),u=I(l);cu(I(u),{}),E(u),E(l);var d=R(l,2);nu(I(d),{}),E(d),E(t),G(e,t)}var hu=new Set([`$$slots`,`$$events`,`$$legacy`]);function gu(e,t){let n=oa(t,hu),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Ta(e,ca({name:`check`},()=>n,{get iconNode(){return r}}))}var _u=new Set([`$$slots`,`$$events`,`$$legacy`]);function vu(e,t){let n=oa(t,_u),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];Ta(e,ca({name:`copy`},()=>n,{get iconNode(){return r}}))}var yu=U(`<p> </p>`),bu=U(`<div class="break-all"><span class="text-foreground/70"> </span> </div>`),xu=U(`<div class="mt-1 flex flex-col gap-0.5 font-mono text-xs text-muted-foreground/80"></div>`),Su=U(`<div role="button" tabindex="0" class="flex cursor-pointer flex-col gap-1.5 rounded-lg border bg-card/55 p-3 text-left transition-colors hover:bg-card/85"><div class="flex items-center gap-1.5"><span class="min-w-0 truncate font-mono text-sm text-foreground"> </span> <button type="button" title="Copy name" class="inline-flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"><!></button> <span> </span></div> <!> <!></div>`);function Cu(e,t){k(t,!0);let n=P(!1),r=P(!1),i,a=M(()=>t.item.scope===`plugin`?t.item.source??`plugin`:t.item.scope),o=M(()=>t.item.scope===`project`?`var(--c-fable)`:t.item.scope===`personal`?`var(--c-sonnet)`:`#9bc2ef`),s=M(()=>Object.entries(t.item.meta??{}));function c(){F(n,!H(n))}function l(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())}async function u(e){e.stopPropagation();try{await navigator.clipboard.writeText(t.item.name),F(r,!0),clearTimeout(i),i=setTimeout(()=>F(r,!1),1200)}catch{}}var d=Su(),f=I(d),p=I(f),m=I(p,!0);E(p);var g=R(p,2),_=I(g),v=e=>{gu(e,{class:`size-3.5`,style:`color: var(--c-fable)`})},y=e=>{vu(e,{class:`size-3.5`})};q(_,e=>{H(r)?e(v):e(y,-1)}),E(g);var b=R(g,2);let x;var S=I(b);E(b),E(f);var ee=R(f,2),te=e=>{var r=yu(),i=I(r,!0);E(r),z(()=>{Pi(r,1,`text-sm leading-snug text-muted-foreground `+(H(n)?``:`line-clamp-2`)),K(i,t.item.description)}),G(e,r)};q(ee,e=>{t.item.description&&e(te)});var ne=R(ee,2),re=e=>{var t=xu();J(t,21,()=>H(s),([e,t])=>e,(e,t)=>{var n=M(()=>h(H(t),2));let r=()=>H(n)[0],i=()=>H(n)[1];var a=bu(),o=I(a),s=I(o);E(o);var c=R(o);E(a),z(()=>{K(s,`${r()??``}:`),K(c,` ${i()??``}`)}),G(e,a)}),E(t),G(e,t)};q(ne,e=>{H(n)&&H(s).length&&e(re)}),E(d),z(()=>{K(m,t.item.name),Xi(g,`aria-label`,`Copy "${t.item.name}"`),x=Pi(b,1,`ml-auto shrink-0 rounded border px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wide`,null,x,{"opacity-50":t.item.enabled===!1}),Ii(b,`color:${H(o)}; border-color:color-mix(in oklab, ${H(o)} 35%, transparent)`),K(S,`${H(a)??``}${t.item.enabled===!1?` \xB7 off`:``}`)}),Yr(`click`,d,c),Yr(`keydown`,d,l),Yr(`click`,g,u),G(e,d),A()}Xr([`click`,`keydown`]);var wu=U(`<span> </span>`),Tu=U(`<button> <span class="opacity-60"> </span></button>`),Eu=U(`<div class="text-sm text-muted-foreground">Scanning your arsenal\u2026</div>`),Du=U(`<div class="text-sm text-muted-foreground"> </div>`),Ou=U(`<section class="flex flex-col gap-2"><div class="flex items-center gap-3 border-b border-border pb-1.5"><span class="size-1.5 shrink-0 rounded-sm"></span> <span class="font-mono text-xs uppercase tracking-[0.14em]"> </span> <span class="font-mono text-xs tracking-[0.1em] text-muted-foreground"> </span></div> <div class="grid grid-cols-1 items-start gap-2 md:grid-cols-2 2xl:grid-cols-3"></div></section>`),ku=U(`<div class="flex flex-col gap-6"></div>`),Au=U(`<div class="flex h-full flex-col gap-4 p-5"><div class="flex flex-wrap items-center justify-between gap-3"><h1 class="font-serif text-2xl text-foreground">\u2694 Arsenal</h1> <div class="flex items-center gap-2 font-mono text-xs text-muted-foreground"><!> <button class="rounded border px-2 py-1 transition-colors hover:text-foreground">\u21BB Rescan</button></div></div> <div class="flex flex-wrap items-center gap-2"><!> <input placeholder="Filter by name or description\u2026" autocomplete="off" class="ml-auto w-full max-w-72 rounded-md border bg-card/60 px-3 py-1.5 text-sm outline-none transition-colors focus:border-ring"/></div> <!></div>`);function ju(e,t){k(t,!0);let n=P(`skills`),r=P(``),i=M(()=>Q.arsenal),a=[{id:`skills`,label:`Skills`},{id:`agents`,label:`Agents`},{id:`mcp`,label:`MCP`}],o=M(()=>{let e=H(i)?H(i)[H(n)]:[],t=H(r).toLowerCase().trim();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||(e.source??``).toLowerCase().includes(t)):e}),s=M(()=>{let e=new Map;for(let t of H(o)){let n=t.scope===`plugin`?`plugin:${t.source??`plugin`}`:t.scope,r=e.get(n);r||(r={label:t.scope===`plugin`?t.source??`plugin`:t.scope===`project`?`In this project`:`Personal \xB7 this machine`,scope:t.scope,items:[]},e.set(n,r)),r.items.push(t)}return[...e.values()]});function c(e){return e===`project`?`var(--c-fable)`:e===`personal`?`var(--c-sonnet)`:`#9bc2ef`}let l=M(()=>H(i)?new Date(H(i).scanned_at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):``);var u=Au(),d=I(u),f=R(I(d),2),p=I(f),m=e=>{var t=wu(),n=I(t);E(t),z(()=>K(n,`${H(i).counts.plugins??``} plugins \xB7 scanned ${H(l)??``}`)),G(e,t)};q(p,e=>{H(i)&&e(m)});var h=R(p,2);E(f),E(d);var g=R(d,2),_=I(g);J(_,17,()=>a,e=>e.id,(e,t)=>{var r=Tu(),a=I(r),o=R(a),s=I(o,!0);E(o),E(r),z(()=>{Pi(r,1,`rounded-lg px-3 py-1.5 font-mono text-xs transition-colors `+(H(n)===H(t).id?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`)),K(a,`${H(t).label??``} `),K(s,H(i)?.counts?.[H(t).id]??0)}),Yr(`click`,r,()=>F(n,H(t).id,!0)),G(e,r)});var v=R(_,2);Ji(v),E(g);var y=R(g,2),b=e=>{G(e,Eu())},x=e=>{var t=Du(),n=I(t,!0);E(t),z(()=>K(n,H(r)?`No matches.`:`Nothing installed in this category.`)),G(e,t)},S=e=>{var t=ku();J(t,21,()=>H(s),e=>e.label+e.scope,(e,t)=>{var n=Ou(),r=I(n),i=I(r),a=R(i,2),o=I(a,!0);E(a);var s=R(a,2),l=I(s,!0);E(s),E(r);var u=R(r,2);J(u,21,()=>H(t).items,e=>e.scope+(e.source??``)+e.name,(e,t)=>{Cu(e,{get item(){return H(t)}})}),E(u),E(n),z((e,n)=>{Ii(i,e),Ii(a,n),K(o,H(t).label),K(l,H(t).items.length)},[()=>`background:${c(H(t).scope)}`,()=>`color:${c(H(t).scope)}`]),G(e,n)}),E(t),G(e,t)};q(y,e=>{Q.arsenalLoading&&!H(i)?e(b):H(s).length?e(S,-1):e(x,1)}),E(u),Yr(`click`,h,()=>Q.loadArsenal(!0)),na(v,()=>H(r),e=>F(r,e)),G(e,u),A()}Xr([`click`]);var Mu=U(`<div class="flex items-baseline gap-3 text-sm"><code class="shrink-0 font-mono text-xs text-[var(--c-sonnet)]"> </code> <span class="text-muted-foreground"> </span></div>`),Nu=U(`<div class="mt-1 flex flex-col gap-1"></div>`),Pu=U(`<div class="flex flex-col gap-1.5 rounded-lg border bg-card/55 p-4"><code class="font-mono text-sm text-foreground"> </code> <p class="text-sm leading-snug text-muted-foreground"> </p> <!></div>`),Fu=U(`<div class="flex h-full flex-col gap-4 p-5"><div class="flex flex-wrap items-center justify-between gap-3"><h1 class="font-serif text-2xl text-foreground">\u276F Commands</h1> <span class="font-mono text-xs text-muted-foreground">all paths default to the current directory</span></div> <div class="flex max-w-3xl flex-col gap-2.5"></div> <p class="max-w-3xl font-mono text-xs leading-relaxed text-muted-foreground">Install: <code class="text-foreground">npm install -g @jefuriiij/synthra</code> \xB7 macOS/Linux hooks\n additionally need <code class="text-foreground">jq</code> (<code>brew install jq</code>) \u2014 without it\n the hooks silently no-op while the MCP tools keep working.</p></div>`);function Iu(e){let t=[{cmd:`syn . [path]`,desc:`The default flow: scan the project, start the MCP server + dashboard, install the hooks, and register the MCP entry for the IDE. Runs as a background service \u2014 Ctrl+C stops it.`,opts:[{flag:`--full`,desc:`Re-parse every file, ignoring the incremental parse cache`},{flag:`--launch-cli`,desc:"Also spawn the `claude` CLI in this terminal"},{flag:`--resume <id>`,desc:`Resume a Claude session (requires --launch-cli)`}]},{cmd:`syn scan [path]`,desc:`Scan only \u2014 walk the project, parse it into the symbol graph, and write it to .synthra-graph/. No servers, no hooks.`,opts:[{flag:`--full`,desc:`Re-parse every file, ignoring the incremental parse cache`}]},{cmd:`syn serve [path]`,desc:`Start the HTTP MCP server only, against an already-scanned project.`},{cmd:`syn dashboard [path]`,desc:`Run this dashboard as a standalone process (no graph required) \u2014 token spend, savings, the Moat, and your Arsenal across every registered project.`},{cmd:`syn doctor [path]`,desc:`Diagnose the setup: Node version, jq (required by the macOS/Linux hooks), the claude CLI, graph freshness, .mcp.json registration, policy version, and installed hooks. Run this first when something feels off.`,opts:[{flag:`--report`,desc:`Emit a copy-pasteable markdown diagnostic for GitHub issues (paths redacted)`}]},{cmd:`syn remove [path]`,desc:`Uninstall Synthra from a project: deletes .synthra-graph/ and .synthra/, strips the CLAUDE.md policy block, Synthra\'s .gitignore entries, and its hooks \u2014 your own content in those files always survives. Also deregisters MCP and removes the project from this dashboard. Shows a summary and asks [y/N] first.`,opts:[{flag:`--yes`,desc:`Skip the confirmation prompt (required when not in a terminal)`}]},{cmd:`syn --version`,desc:`Print the installed Synthra version.`}];var n=Fu(),r=R(I(n),2);J(r,5,()=>t,e=>e.cmd,(e,t)=>{var n=Pu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a);var s=R(a,2),c=e=>{var n=Nu();J(n,5,()=>H(t).opts,e=>e.flag,(e,t)=>{var n=Mu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a),E(n),z(()=>{K(i,H(t).flag),K(o,H(t).desc)}),G(e,n)}),E(n),G(e,n)};q(s,e=>{H(t).opts?.length&&e(c)}),E(n),z(()=>{K(i,H(t).cmd),K(o,H(t).desc)}),G(e,n)}),E(r),D(2),E(n),G(e,n)}var Lu=U(`<details class="rounded-lg border bg-card/50 p-3"><summary class="cursor-pointer text-sm font-medium text-foreground"> </summary> <p class="mt-2 text-[13px] leading-relaxed text-muted-foreground"> </p></details>`),Ru=U(`<!> <!> <div class="mt-4 flex flex-col gap-2"></div> <!>`,1),zu=U(`<!> <!>`,1);function Bu(e,t){k(t,!0);let n=Z(t,`open`,15,!1),r=[{q:`Where do these numbers come from?`,a:`Synthra\'s Stop hook reads Claude Code\'s transcript JSONL after each turn and logs token usage to .synthra-graph/token_log.jsonl. The gate logs to gate_log.jsonl, tool calls to tool_log.jsonl. The dashboard reads those \u2014 it never feeds back into retrieval.`},{q:`How is cost calculated?`,a:`Token counts \xD7 Anthropic\'s published per-model rates (in src/shared/pricing.ts), summed across input, output, cache-read and cache-write. These are API-equivalent estimates, not your plan billing \u2014 useful for comparing sessions.`},{q:`What is the savings floor?`,a:`Each time the Moat blocks an exploratory Grep/Glob, we credit a deliberately conservative 500 tokens \xD7 $3/M input rate. Real savings are usually higher (it ignores cache thrash and follow-up reads the block also prevents). It\'s a floor, not a guess.`},{q:`What is the Moat?`,a:`A PreToolUse hook that intercepts Grep/Glob and, when the graph has confident context, blocks them and hands back the exact graph_read targets + signatures \u2014 so the agent reads ~50-token slices instead of whole files.`},{q:`What is the Arsenal view?`,a:`A scan of every skill, subagent, and MCP server available to you \u2014 project, personal (~/.claude), and plugin \u2014 with descriptions, so you never have to drop to the CLI to recall what\'s installed. MCP entries show name/type/url only; auth tokens are never read.`},{q:`What\'s the codebase graph?`,a:`tree-sitter parses your project into a symbol graph (files, symbols, imports, call edges). graph_read returns a symbol\'s source plus its dependency surface; graph_continue packs a context bundle.`},{q:`Where is everything stored?`,a:`.synthra-graph/ (machine-local, gitignored) holds the graph + logs; .synthra/ (git-tracked) holds branch-aware memory. Nothing leaves your machine.`},{q:`Why is my bill not lower already?`,a:`Savings land only when the agent actually uses the cheap path. v0.4\u20130.6 push the answer to the point of use (block payloads, edit recipes, dependency footers); a real dogfood session on the latest version is the true test.`}];var i=W();X(L(i),()=>Nl,(e,t)=>{t(e,{get open(){return n()},set open(e){n(e)},children:(e,t)=>{var n=W();X(L(n),()=>lc,(e,t)=>{t(e,{children:(e,t)=>{var n=zu(),i=L(n);X(i,()=>kl,(e,t)=>{t(e,{class:`fixed inset-0 z-50 bg-black/60`})}),X(R(i,2),()=>Bl,(e,t)=>{t(e,{class:`fixed left-1/2 top-1/2 z-50 max-h-[85vh] w-[min(640px,92vw)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl`,children:(e,t)=>{var n=Ru(),i=L(n);X(i,()=>tc,(e,t)=>{t(e,{class:`font-serif text-2xl`,children:(e,t)=>{D(),G(e,ai(`FAQ`))},$$slots:{default:!0}})});var a=R(i,2);X(a,()=>Ml,(e,t)=>{t(e,{class:`text-xs text-muted-foreground`,children:(e,t)=>{D(),G(e,ai(`Where every number on this dashboard comes from.`))},$$slots:{default:!0}})});var o=R(a,2);J(o,21,()=>r,e=>e.q,(e,t)=>{var n=Lu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),o=I(a,!0);E(a),E(n),z(()=>{K(i,H(t).q),K(o,H(t).a)}),G(e,n)}),E(o),X(R(o,2),()=>Il,(e,t)=>{t(e,{class:`mt-4 w-full rounded-md border py-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:(e,t)=>{D(),G(e,ai(`Close`))},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,i),A()}var Vu=U(`<div class="mt-4 text-sm text-muted-foreground">Running checks\u2026</div>`),Hu=U(`<div class="flex items-baseline gap-2 rounded-lg border bg-card/50 px-3 py-2"><span class="shrink-0"> </span> <span class="shrink-0 font-mono text-sm text-foreground"> </span> <span class="min-w-0 text-[13px] leading-snug text-muted-foreground"> </span></div>`),Uu=U(`<!> Copied`,1),Wu=U(`<!> Copy report`,1),Gu=U(`<div class="mt-3 font-mono text-xs text-muted-foreground"> </div> <div class="mt-3 flex flex-col gap-1.5"></div> <div class="mt-4 flex flex-wrap items-center gap-2"><button class="inline-flex items-center gap-1.5 rounded-md border px-3 py-2 text-sm text-foreground transition-colors hover:bg-accent"><!></button> <a target="_blank" rel="noreferrer" class="rounded-md border px-3 py-2 text-sm text-foreground transition-colors hover:bg-accent">Report a bug \u2197</a> <a target="_blank" rel="noreferrer" class="rounded-md border px-3 py-2 text-sm text-foreground transition-colors hover:bg-accent">Suggest a feature \u2197</a></div> <p class="mt-3 text-xs leading-relaxed text-muted-foreground">Nothing is sent automatically \u2014 copy the report and paste it into the issue. Paths are\n redacted (your home directory shows as <code>~</code>).</p>`,1),Ku=U(`<div class="mt-4 text-sm text-muted-foreground">Couldn\'t reach the dashboard server for the checks \u2014 you can still run <code class="text-foreground">syn doctor --report</code> in a terminal.</div>`),qu=U(`<!> <!> <!> <!>`,1),Ju=U(`<!> <!>`,1);function Yu(e,t){k(t,!0);let n=Z(t,`open`,15,!1),r=P(!1),i,a=`https://github.com/jefuriiij/synthra/issues/new`,o={ok:`\u2705`,warn:`\u26A0\uFE0F`,fail:`\u274C`};Ln(()=>{n()&&Q.loadReport()});async function s(){if(Q.report)try{await navigator.clipboard.writeText(Q.report.markdown),F(r,!0),clearTimeout(i),i=setTimeout(()=>F(r,!1),1200)}catch{}}var c=W();X(L(c),()=>Nl,(e,t)=>{t(e,{get open(){return n()},set open(e){n(e)},children:(e,t)=>{var n=W();X(L(n),()=>lc,(e,t)=>{t(e,{children:(e,t)=>{var n=Ju(),i=L(n);X(i,()=>kl,(e,t)=>{t(e,{class:`fixed inset-0 z-50 bg-black/60`})}),X(R(i,2),()=>Bl,(e,t)=>{t(e,{class:`fixed left-1/2 top-1/2 z-50 max-h-[85vh] w-[min(640px,92vw)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl`,children:(e,t)=>{var n=qu(),i=L(n);X(i,()=>tc,(e,t)=>{t(e,{class:`font-serif text-2xl`,children:(e,t)=>{D(),G(e,ai(`Report`))},$$slots:{default:!0}})});var c=R(i,2);X(c,()=>Ml,(e,t)=>{t(e,{class:`text-xs text-muted-foreground`,children:(e,t)=>{D(),G(e,ai(`Your setup, checked live \u2014 copy the diagnostic into a bug report, or suggest an idea.`))},$$slots:{default:!0}})});var l=R(c,2),u=e=>{G(e,Vu())},d=e=>{var t=Gu(),n=L(t),i=I(n);E(n);var c=R(n,2);J(c,21,()=>Q.report.checks,e=>e.label,(e,t)=>{var n=Hu(),r=I(n),i=I(r,!0);E(r);var a=R(r,2),s=I(a,!0);E(a);var c=R(a,2),l=I(c,!0);E(c),E(n),z(()=>{K(i,o[H(t).status]??`\u2022`),K(s,H(t).label),K(l,H(t).detail)}),G(e,n)}),E(c);var l=R(c,2),u=I(l),d=I(u),f=e=>{var t=Uu();gu(L(t),{class:`size-3.5`,style:`color: var(--c-fable)`}),D(),G(e,t)},p=e=>{var t=Wu();vu(L(t),{class:`size-3.5`}),D(),G(e,t)};q(d,e=>{H(r)?e(f):e(p,-1)}),E(u);var m=R(u,2);Xi(m,`href`,`${a}?template=bug_report.yml`),Xi(R(m,2),`href`,`${a}?template=feature_request.yml`),E(l),D(2),z(()=>K(i,`Synthra v${Q.report.version??``} \xB7 ${Q.report.platform??``}\n ${Q.report.arch??``} \xB7 Node v${Q.report.node??``}`)),Yr(`click`,u,s),G(e,t)},f=e=>{G(e,Ku())};q(l,e=>{Q.reportLoading&&!Q.report?e(u):Q.report?e(d,1):e(f,-1)}),X(R(l,2),()=>Il,(e,t)=>{t(e,{class:`mt-4 w-full rounded-md border py-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:(e,t)=>{D(),G(e,ai(`Close`))},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,n)},$$slots:{default:!0}})}),G(e,c),A()}Xr([`click`]);var Xu=U(`<div class="flex h-screen w-screen overflow-hidden"><!> <main class="min-w-0 flex-1 overflow-y-auto"><!></main></div> <!> <!>`,1);function Zu(e,t){k(t,!0);let n=P(!1),r=P(!1);la(()=>(Q.start(),()=>Q.stop()));var i=Xu(),a=L(i),o=I(a);qa(o,{onFaq:()=>F(n,!0),onReport:()=>F(r,!0)});var s=R(o,2),c=I(s),l=e=>{mu(e,{})},u=e=>{Iu(e,{})},d=e=>{ju(e,{})};q(c,e=>{Q.view===`overview`?e(l):Q.view===`commands`?e(u,1):e(d,-1)}),E(s),E(a);var f=R(a,2);Bu(f,{get open(){return H(n)},set open(e){F(n,e,!0)}}),Yu(R(f,2),{get open(){return H(r)},set open(e){F(r,e,!0)}}),G(e,i),A()}var Qu=document.getElementById(`app`);if(!Qu)throw Error(`missing #app mount node`);si(Zu,{target:Qu});</script>\n <style rel="stylesheet" crossorigin>/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--color-black:#000;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border)}html,body{height:100%}body{background:radial-gradient(1200px 800px at 14% 16%, #2c5db81f, transparent 60%), var(--background);color:var(--foreground);font-family:var(--font-sans);-webkit-font-smoothing:antialiased}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:999px}::-webkit-scrollbar-track{background:0 0}}@layer components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-1\\/2{top:50%}.left-1\\/2{left:50%}.z-50{z-index:50}.my-1{margin-block:var(--spacing)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-\\[116px\\]{width:116px;height:116px}.size-full{width:100%;height:100%}.h-1{height:var(--spacing)}.h-2{height:calc(var(--spacing) * 2)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\\[85vh\\]{max-height:85vh}.max-h-\\[190px\\]{max-height:190px}.max-h-\\[260px\\]{max-height:260px}.min-h-0{min-height:0}.w-9{width:calc(var(--spacing) * 9)}.w-\\[64px\\]{width:64px}.w-\\[248px\\]{width:248px}.w-\\[min\\(440px\\,92vw\\)\\]{width:min(440px,92vw)}.w-\\[min\\(640px\\,92vw\\)\\]{width:min(640px,92vw)}.w-full{width:100%}.w-screen{width:100vw}.max-w-3xl{max-width:var(--container-3xl)}.max-w-72{max-width:calc(var(--spacing) * 72)}.max-w-\\[120px\\]{max-width:120px}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.animate-pulse{animation:var(--animate-pulse)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-px{gap:1px}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border,.border-border\\/60{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\/60{border-color:color-mix(in oklab, var(--border) 60%, transparent)}}.border-sidebar-border{border-color:var(--sidebar-border)}.bg-\\[var\\(--c-fable\\)\\],.bg-\\[var\\(--c-fable\\)\\]\\/12{background-color:var(--c-fable)}@supports (color:color-mix(in lab, red, red)){.bg-\\[var\\(--c-fable\\)\\]\\/12{background-color:color-mix(in oklab, var(--c-fable) 12%, transparent)}}.bg-\\[var\\(--money\\)\\]{background-color:var(--money)}.bg-accent{background-color:var(--accent)}.bg-black\\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-border{background-color:var(--border)}.bg-card,.bg-card\\/50{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/50{background-color:color-mix(in oklab, var(--card) 50%, transparent)}}.bg-card\\/55{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/55{background-color:color-mix(in oklab, var(--card) 55%, transparent)}}.bg-card\\/60{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/60{background-color:color-mix(in oklab, var(--card) 60%, transparent)}}.bg-card\\/70{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/70{background-color:color-mix(in oklab, var(--card) 70%, transparent)}}.bg-destructive,.bg-destructive\\/15{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\/15{background-color:color-mix(in oklab, var(--destructive) 15%, transparent)}}.bg-muted{background-color:var(--muted)}.bg-muted-foreground,.bg-muted-foreground\\/40{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\\/40{background-color:color-mix(in oklab, var(--muted-foreground) 40%, transparent)}}.bg-primary\\/90{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\\/90{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-accent,.bg-sidebar-accent\\/40{background-color:var(--sidebar-accent)}@supports (color:color-mix(in lab, red, red)){.bg-sidebar-accent\\/40{background-color:color-mix(in oklab, var(--sidebar-accent) 40%, transparent)}}.bg-sidebar-border{background-color:var(--sidebar-border)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-serif{font-family:var(--font-serif)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[13px\\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.12em\\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\\[0\\.14em\\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\\[0\\.18em\\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.text-\\[var\\(--c-fable\\)\\]{color:var(--c-fable)}.text-\\[var\\(--c-sonnet\\)\\]{color:var(--c-sonnet)}.text-\\[var\\(--money\\)\\]{color:var(--money)}.text-accent-foreground{color:var(--accent-foreground)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-foreground,.text-foreground\\/70{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\/70{color:color-mix(in oklab, var(--foreground) 70%, transparent)}}.text-foreground\\/80{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\/80{color:color-mix(in oklab, var(--foreground) 80%, transparent)}}.text-muted-foreground,.text-muted-foreground\\/60{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\/60{color:color-mix(in oklab, var(--muted-foreground) 60%, transparent)}}.text-muted-foreground\\/80{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\/80{color:color-mix(in oklab, var(--muted-foreground) 80%, transparent)}}.text-primary-foreground{color:var(--primary-foreground)}.text-sidebar-accent-foreground{color:var(--sidebar-accent-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\\/60{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\\/60{color:color-mix(in oklab, var(--sidebar-foreground) 60%, transparent)}}.text-sidebar-foreground\\/75{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\\/75{color:color-mix(in oklab, var(--sidebar-foreground) 75%, transparent)}}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-card\\/80:hover{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-card\\/80:hover{background-color:color-mix(in oklab, var(--card) 80%, transparent)}}.hover\\:bg-card\\/85:hover{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-card\\/85:hover{background-color:color-mix(in oklab, var(--card) 85%, transparent)}}.hover\\:bg-sidebar-accent\\/50:hover{background-color:var(--sidebar-accent)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-sidebar-accent\\/50:hover{background-color:color-mix(in oklab, var(--sidebar-accent) 50%, transparent)}}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:text-sidebar-foreground:hover{color:var(--sidebar-foreground)}}.focus\\:border-ring:focus{border-color:var(--ring)}@media (hover:hover){.enabled\\:hover\\:text-foreground:enabled:hover{color:var(--foreground)}}.disabled\\:opacity-40:disabled{opacity:.4}@media (width>=40rem){.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width>=64rem){.lg\\:absolute{position:absolute}.lg\\:inset-0{inset:0}.lg\\:col-span-3{grid-column:span 3/span 3}.lg\\:col-start-1{grid-column-start:1}.lg\\:col-start-2{grid-column-start:2}.lg\\:col-start-3{grid-column-start:3}.lg\\:row-span-3{grid-row:span 3/span 3}.lg\\:row-start-1{grid-row-start:1}.lg\\:row-start-2{grid-row-start:2}.lg\\:row-start-3{grid-row-start:3}.lg\\:row-start-4{grid-row-start:4}.lg\\:row-start-5{grid-row-start:5}.lg\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (width>=96rem){.\\32 xl\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}:root{--radius:.75rem;--background:#04081a;--foreground:#ecf2fb;--card:#0a1733;--card-foreground:#ecf2fb;--popover:#0a1733;--popover-foreground:#ecf2fb;--primary:#2c5db8;--primary-foreground:#f4f7fc;--secondary:#122549;--secondary-foreground:#d7e6f7;--muted:#102146;--muted-foreground:#8ba0c2;--accent:#1b3a78;--accent-foreground:#ecf2fb;--destructive:#ff5d5d;--destructive-foreground:#fff5f5;--border:#9bc2ef24;--input:#9bc2ef2e;--ring:#5c8fe6;--sidebar:#081226;--sidebar-foreground:#d7e6f7;--sidebar-primary:#2c5db8;--sidebar-primary-foreground:#f4f7fc;--sidebar-accent:#122549;--sidebar-accent-foreground:#ecf2fb;--sidebar-border:#9bc2ef1f;--sidebar-ring:#5c8fe6;--c-fable:#2ee08f;--c-opus:#ff6338;--c-sonnet:#ffb938;--c-haiku:#7438ff;--c-unknown:#12cbf5;--money:#4ade9b;--font-sans:"Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-serif:"Instrument Serif", "Times New Roman", serif;--font-mono:"Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}\n/*$vite$:1*/</style>\n </head>\n <body>\n <div id="app"></div>\n </body>\n</html>\n';
|
|
882
1330
|
|
|
883
1331
|
// src/dashboard/public/favicon.svg
|
|
884
1332
|
var favicon_default = '<svg width="107" height="107" viewBox="0 0 107 107" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect x="0.5" y="0.5" width="106" height="106" rx="7.5" fill="url(#paint0_radial_21_11)"/>\n<rect x="0.5" y="0.5" width="106" height="106" rx="7.5" stroke="url(#paint1_linear_21_11)"/>\n<path d="M26.408 72.558C25.5813 72.558 24.6513 72.4753 23.618 72.31C22.626 72.1447 21.6753 71.938 20.766 71.69C19.898 71.442 19.216 71.1733 18.72 70.884C18.4307 70.7187 18.2033 70.5533 18.038 70.388C17.914 70.1813 17.852 69.8507 17.852 69.396L17.542 59.662C17.542 58.8353 17.8107 58.422 18.348 58.422C18.8027 58.422 19.1127 58.794 19.278 59.538L19.836 61.894C21.2413 67.8047 23.866 70.76 27.71 70.76C29.7767 70.76 31.4093 70.078 32.608 68.714C33.848 67.3087 34.468 65.3453 34.468 62.824C34.468 60.3853 33.8273 58.112 32.546 56.004C31.306 53.896 29.3013 51.8087 26.532 49.742C23.4733 47.5513 21.2413 45.4433 19.836 43.418C18.4307 41.3513 17.728 39.1607 17.728 36.846C17.728 33.7873 18.782 31.3487 20.89 29.53C23.0393 27.67 25.7673 26.74 29.074 26.74C30.314 26.74 31.5127 26.8847 32.67 27.174C33.8273 27.4633 34.778 27.8767 35.522 28.414C35.77 28.5793 35.956 28.7653 36.08 28.972C36.2453 29.1787 36.328 29.4473 36.328 29.778L36.514 39.14C36.514 39.8427 36.2453 40.194 35.708 40.194C35.336 40.194 35.0673 39.9047 34.902 39.326L34.468 37.776C33.5587 34.5933 32.608 32.2787 31.616 30.832C30.6653 29.344 29.2807 28.6 27.462 28.6C25.6847 28.6 24.2587 29.1787 23.184 30.336C22.1507 31.4933 21.634 33.126 21.634 35.234C21.634 37.0113 22.2127 38.706 23.37 40.318C24.5273 41.93 26.5527 43.8933 29.446 46.208C32.546 48.7293 34.7987 51.168 36.204 53.524C37.6507 55.8387 38.374 58.3187 38.374 60.964C38.374 63.2787 37.8573 65.304 36.824 67.04C35.7907 68.776 34.3647 70.14 32.546 71.132C30.7687 72.0827 28.7227 72.558 26.408 72.558ZM44.1831 84.71C43.0671 84.71 42.1784 84.3173 41.5171 83.532C40.8558 82.788 40.5251 81.92 40.5251 80.928C40.5251 80.1427 40.7524 79.4813 41.2071 78.944C41.6618 78.4067 42.2818 78.138 43.0671 78.138C43.7284 78.138 44.2038 78.2827 44.4931 78.572C44.7824 78.8613 44.9891 79.192 45.1131 79.564C45.2371 79.936 45.3611 80.2667 45.4851 80.556C45.6091 80.8453 45.8571 80.99 46.2291 80.99C46.6838 80.99 47.0971 80.6593 47.4691 79.998C47.8411 79.378 48.3578 78.0347 49.0191 75.968C49.4324 74.728 49.6804 73.6533 49.7631 72.744C49.8871 71.8347 49.8664 70.8633 49.7011 69.83C49.5771 68.7967 49.2671 67.536 48.7711 66.048L42.0131 44.534C41.7238 43.542 41.4344 42.9013 41.1451 42.612C40.8971 42.3227 40.4838 42.116 39.9051 41.992L38.9751 41.806C38.4378 41.682 38.1691 41.4133 38.1691 41C38.1691 40.5867 38.4584 40.38 39.0371 40.38H49.2671C49.8458 40.38 50.1351 40.5867 50.1351 41C50.1351 41.4547 49.8664 41.7233 49.3291 41.806L48.3371 41.93C47.3451 42.054 46.7044 42.302 46.4151 42.674C46.1671 43.0047 46.1878 43.6247 46.4771 44.534L51.9331 62.7C52.0571 63.1133 52.2431 63.32 52.4911 63.32C52.7804 63.32 52.9871 63.1133 53.1111 62.7L58.3811 45.65C58.7118 44.534 58.7944 43.7073 58.6291 43.17C58.5051 42.5913 57.9264 42.2193 56.8931 42.054L55.5911 41.806C55.0538 41.682 54.7851 41.4133 54.7851 41C54.7851 40.5867 55.0744 40.38 55.6531 40.38H63.5271C64.1058 40.38 64.3951 40.6073 64.3951 41.062C64.3951 41.4753 64.1471 41.7647 63.6511 41.93L63.0931 42.116C62.4731 42.3227 61.9564 42.6947 61.5431 43.232C61.1298 43.7693 60.6958 44.6993 60.2411 46.022L51.0031 74.852C50.0938 77.7453 49.2671 79.8947 48.5231 81.3C47.8204 82.7053 47.1384 83.6147 46.4771 84.028C45.8158 84.4827 45.0511 84.71 44.1831 84.71ZM64.9342 72C64.3142 72 64.0042 71.7727 64.0042 71.318C64.0042 70.946 64.2729 70.698 64.8102 70.574L65.5542 70.45C66.4222 70.2847 66.9802 70.0367 67.2282 69.706C67.5176 69.334 67.6622 68.714 67.6622 67.846V47.014C67.6622 46.27 67.5382 45.774 67.2902 45.526C67.0836 45.2367 66.6909 45.0507 66.1122 44.968L64.8102 44.782C64.2729 44.7407 64.0042 44.5133 64.0042 44.1C64.0042 43.7693 64.3349 43.542 64.9962 43.418C66.2776 43.2113 67.2489 42.8807 67.9102 42.426C68.6129 41.9713 69.3362 41.4133 70.0802 40.752C70.4522 40.38 70.7622 40.194 71.0102 40.194C71.3822 40.194 71.5682 40.442 71.5682 40.938V43.728C71.5682 44.1 71.6922 44.348 71.9402 44.472C72.2296 44.5547 72.5396 44.4307 72.8702 44.1C74.5236 42.5293 75.9702 41.4547 77.2102 40.876C78.4916 40.2973 79.8349 40.008 81.2402 40.008C83.1002 40.008 84.5882 40.6693 85.7042 41.992C86.8202 43.2733 87.3782 45.1747 87.3782 47.696V67.846C87.3782 68.714 87.5022 69.334 87.7502 69.706C88.0396 70.0367 88.6182 70.264 89.4862 70.388L90.8502 70.574C91.3049 70.6567 91.5322 70.9047 91.5322 71.318C91.5322 71.7727 91.2842 72 90.7882 72H80.3722C79.7936 72 79.5042 71.7727 79.5042 71.318C79.5042 70.9047 79.7316 70.6567 80.1862 70.574L81.0542 70.45C81.9222 70.326 82.4802 70.078 82.7282 69.706C83.0176 69.334 83.1622 68.714 83.1622 67.846V48.378C83.1622 46.3527 82.7902 44.9267 82.0462 44.1C81.3022 43.2733 80.2482 42.86 78.8842 42.86C77.5616 42.86 76.3629 43.2527 75.2882 44.038C74.2549 44.782 73.4282 45.7947 72.8082 47.076C72.1882 48.316 71.8782 49.7007 71.8782 51.23V67.846C71.8782 68.714 72.0022 69.334 72.2502 69.706C72.5396 70.078 73.1182 70.3053 73.9862 70.388L75.6602 70.574C76.1149 70.6567 76.3422 70.884 76.3422 71.256C76.3422 71.752 76.0322 72 75.4122 72H64.9342Z" fill="white"/>\n<defs>\n<radialGradient id="paint0_radial_21_11" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(14 16) rotate(43.5498) scale(167.638 156.2)">\n<stop stop-color="#2C5DB8"/>\n<stop offset="1" stop-color="#04081A"/>\n</radialGradient>\n<linearGradient id="paint1_linear_21_11" x1="1.77511" y1="1.50277e-06" x2="105.225" y2="107" gradientUnits="userSpaceOnUse">\n<stop stop-color="#5C8FE6"/>\n<stop offset="1" stop-color="#335080"/>\n</linearGradient>\n</defs>\n</svg>\n';
|
|
@@ -903,6 +1351,17 @@ async function startDashboard(paths, preferredPort = 8901) {
|
|
|
903
1351
|
});
|
|
904
1352
|
app.get("/health", (c) => c.json({ ok: true }));
|
|
905
1353
|
app.get("/arsenal", async (c) => c.json(await computeArsenal(paths.projectRoot)));
|
|
1354
|
+
app.get("/report", async (c) => {
|
|
1355
|
+
const checks = await runDoctorChecks(paths.projectRoot);
|
|
1356
|
+
const info = {
|
|
1357
|
+
version: VERSION,
|
|
1358
|
+
platform: process.platform,
|
|
1359
|
+
arch: process.arch,
|
|
1360
|
+
node: process.versions.node,
|
|
1361
|
+
claudeBin: loadConfig().claudeBin
|
|
1362
|
+
};
|
|
1363
|
+
return c.json({ ...info, checks, markdown: buildDiagnosticReport(checks, info) });
|
|
1364
|
+
});
|
|
906
1365
|
app.get("/data", async (c) => {
|
|
907
1366
|
const data = await computeDashboardData(paths, RECENT_N);
|
|
908
1367
|
return c.json(data);
|
|
@@ -920,8 +1379,8 @@ async function startDashboard(paths, preferredPort = 8901) {
|
|
|
920
1379
|
}
|
|
921
1380
|
|
|
922
1381
|
// src/hooks/installer.ts
|
|
923
|
-
import { mkdir as mkdir3, readFile as
|
|
924
|
-
import { dirname as
|
|
1382
|
+
import { mkdir as mkdir3, readFile as readFile7, writeFile as writeFile4 } from "fs/promises";
|
|
1383
|
+
import { dirname as dirname5, join as join5 } from "path";
|
|
925
1384
|
|
|
926
1385
|
// src/hooks/hooks-config.ts
|
|
927
1386
|
var SYNTHRA_HOOK_MARKER = "synthra-hook=true";
|
|
@@ -1283,7 +1742,7 @@ function chosenScriptExt() {
|
|
|
1283
1742
|
}
|
|
1284
1743
|
async function readSettings(path) {
|
|
1285
1744
|
try {
|
|
1286
|
-
const raw = await
|
|
1745
|
+
const raw = await readFile7(path, "utf8");
|
|
1287
1746
|
return JSON.parse(raw);
|
|
1288
1747
|
} catch {
|
|
1289
1748
|
return {};
|
|
@@ -1292,7 +1751,7 @@ async function readSettings(path) {
|
|
|
1292
1751
|
function mergeOurHooks(config, paths) {
|
|
1293
1752
|
const hooks = config.hooks = config.hooks ?? {};
|
|
1294
1753
|
for (const s of SCRIPTS) {
|
|
1295
|
-
const scriptPath =
|
|
1754
|
+
const scriptPath = join5(paths.claudeHooksDir, `${s.baseName}${chosenScriptExt()}`);
|
|
1296
1755
|
const entry = {
|
|
1297
1756
|
...s.matcher ? { matcher: s.matcher } : {},
|
|
1298
1757
|
hooks: [
|
|
@@ -1312,15 +1771,15 @@ async function installHooks(paths) {
|
|
|
1312
1771
|
await mkdir3(paths.claudeHooksDir, { recursive: true });
|
|
1313
1772
|
const scriptsWritten = [];
|
|
1314
1773
|
for (const s of SCRIPTS) {
|
|
1315
|
-
const target =
|
|
1316
|
-
await
|
|
1774
|
+
const target = join5(paths.claudeHooksDir, `${s.baseName}${chosenScriptExt()}`);
|
|
1775
|
+
await writeFile4(target, chosenScriptBody(s), "utf8");
|
|
1317
1776
|
scriptsWritten.push(target);
|
|
1318
1777
|
}
|
|
1319
|
-
await mkdir3(
|
|
1778
|
+
await mkdir3(dirname5(paths.claudeSettings), { recursive: true });
|
|
1320
1779
|
const existing = await readSettings(paths.claudeSettings);
|
|
1321
1780
|
const stripped = stripOurHooks(existing);
|
|
1322
1781
|
const merged = mergeOurHooks(stripped, paths);
|
|
1323
|
-
await
|
|
1782
|
+
await writeFile4(paths.claudeSettings, JSON.stringify(merged, null, 2) + "\n", "utf8");
|
|
1324
1783
|
log.debug(`installed ${scriptsWritten.length} hook script(s) into ${paths.claudeHooksDir}`);
|
|
1325
1784
|
return { scriptsWritten, settingsUpdated: true };
|
|
1326
1785
|
}
|
|
@@ -1332,7 +1791,7 @@ import { writeFile as writeFile11 } from "fs/promises";
|
|
|
1332
1791
|
|
|
1333
1792
|
// src/activity/activity-log.ts
|
|
1334
1793
|
import { appendFile as appendFile2, mkdir as mkdir4 } from "fs/promises";
|
|
1335
|
-
import { dirname as
|
|
1794
|
+
import { dirname as dirname6 } from "path";
|
|
1336
1795
|
var DEFAULT_RING_SIZE = 100;
|
|
1337
1796
|
var ActivityStore = class {
|
|
1338
1797
|
ring = [];
|
|
@@ -1369,7 +1828,7 @@ var ActivityStore = class {
|
|
|
1369
1828
|
}
|
|
1370
1829
|
async persist(event) {
|
|
1371
1830
|
try {
|
|
1372
|
-
await mkdir4(
|
|
1831
|
+
await mkdir4(dirname6(this.persistPath), { recursive: true });
|
|
1373
1832
|
await appendFile2(this.persistPath, JSON.stringify(event) + "\n", "utf8");
|
|
1374
1833
|
} catch {
|
|
1375
1834
|
}
|
|
@@ -1378,8 +1837,8 @@ var ActivityStore = class {
|
|
|
1378
1837
|
|
|
1379
1838
|
// src/activity/file-watcher.ts
|
|
1380
1839
|
import chokidar from "chokidar";
|
|
1381
|
-
import { readFile as
|
|
1382
|
-
import { join as
|
|
1840
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
1841
|
+
import { join as join6, relative, sep } from "path";
|
|
1383
1842
|
import ignore from "ignore";
|
|
1384
1843
|
var ALWAYS_IGNORE = [
|
|
1385
1844
|
".git",
|
|
@@ -1401,7 +1860,7 @@ var ALWAYS_IGNORE = [
|
|
|
1401
1860
|
];
|
|
1402
1861
|
async function readIgnoreFile(path) {
|
|
1403
1862
|
try {
|
|
1404
|
-
const text = await
|
|
1863
|
+
const text = await readFile8(path, "utf8");
|
|
1405
1864
|
return text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
|
|
1406
1865
|
} catch {
|
|
1407
1866
|
return [];
|
|
@@ -1410,8 +1869,8 @@ async function readIgnoreFile(path) {
|
|
|
1410
1869
|
async function buildMatcher(root) {
|
|
1411
1870
|
const ig = ignore();
|
|
1412
1871
|
ig.add(ALWAYS_IGNORE.map((d) => `${d}/`));
|
|
1413
|
-
ig.add(await readIgnoreFile(
|
|
1414
|
-
ig.add(await readIgnoreFile(
|
|
1872
|
+
ig.add(await readIgnoreFile(join6(root, ".gitignore")));
|
|
1873
|
+
ig.add(await readIgnoreFile(join6(root, ".synthraignore")));
|
|
1415
1874
|
return ig;
|
|
1416
1875
|
}
|
|
1417
1876
|
function toPosixRel(root, abs) {
|
|
@@ -1466,14 +1925,14 @@ function createFileWatcher(root, onEvent) {
|
|
|
1466
1925
|
// src/activity/git-watcher.ts
|
|
1467
1926
|
import { execFile } from "child_process";
|
|
1468
1927
|
import { watch } from "fs";
|
|
1469
|
-
import { readFile as
|
|
1470
|
-
import { join as
|
|
1928
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
1929
|
+
import { join as join7 } from "path";
|
|
1471
1930
|
import { promisify } from "util";
|
|
1472
1931
|
var execFileAsync = promisify(execFile);
|
|
1473
1932
|
var POLL_MS = 2e3;
|
|
1474
1933
|
async function readHeadBranch(projectRoot) {
|
|
1475
1934
|
try {
|
|
1476
|
-
const head = await
|
|
1935
|
+
const head = await readFile9(join7(projectRoot, ".git", "HEAD"), "utf8");
|
|
1477
1936
|
const m = head.trim().match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
1478
1937
|
return m?.[1] ?? null;
|
|
1479
1938
|
} catch {
|
|
@@ -1540,7 +1999,7 @@ function createGitWatcher(root, onEvent) {
|
|
|
1540
1999
|
lastBranch = await readHeadBranch(root);
|
|
1541
2000
|
lastStatus = await readStatusPorcelain(root);
|
|
1542
2001
|
try {
|
|
1543
|
-
headWatcher = watch(
|
|
2002
|
+
headWatcher = watch(join7(root, ".git", "HEAD"), () => {
|
|
1544
2003
|
void checkHead();
|
|
1545
2004
|
});
|
|
1546
2005
|
headWatcher.on("error", () => {
|
|
@@ -1569,13 +2028,10 @@ function parseStatusFiles(porcelain) {
|
|
|
1569
2028
|
}
|
|
1570
2029
|
|
|
1571
2030
|
// src/cli/scan-command.ts
|
|
1572
|
-
import { resolve } from "path";
|
|
2031
|
+
import { resolve as resolve2 } from "path";
|
|
1573
2032
|
|
|
1574
2033
|
// src/scanner/extract.ts
|
|
1575
|
-
import { dirname as
|
|
1576
|
-
|
|
1577
|
-
// src/graph/types.ts
|
|
1578
|
-
var SCHEMA_VERSION2 = 2;
|
|
2034
|
+
import { dirname as dirname7, join as join8, posix } from "path";
|
|
1579
2035
|
|
|
1580
2036
|
// src/scanner/hash.ts
|
|
1581
2037
|
import { createHash } from "crypto";
|
|
@@ -1933,7 +2389,7 @@ async function buildGraph(root, parsed) {
|
|
|
1933
2389
|
nodes,
|
|
1934
2390
|
edges,
|
|
1935
2391
|
generated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1936
|
-
schema_version:
|
|
2392
|
+
schema_version: SCHEMA_VERSION
|
|
1937
2393
|
};
|
|
1938
2394
|
}
|
|
1939
2395
|
function buildSymbolIndex(graph) {
|
|
@@ -1986,11 +2442,11 @@ function buildCallEdges(symbolsByFile, callsByFile) {
|
|
|
1986
2442
|
}
|
|
1987
2443
|
|
|
1988
2444
|
// src/scanner/parse-cache.ts
|
|
1989
|
-
import { mkdir as mkdir5, readFile as
|
|
1990
|
-
import { dirname as
|
|
2445
|
+
import { mkdir as mkdir5, readFile as readFile11, writeFile as writeFile5 } from "fs/promises";
|
|
2446
|
+
import { dirname as dirname8 } from "path";
|
|
1991
2447
|
|
|
1992
2448
|
// src/scanner/parser.ts
|
|
1993
|
-
import { readFile as
|
|
2449
|
+
import { readFile as readFile10 } from "fs/promises";
|
|
1994
2450
|
import { createRequire } from "module";
|
|
1995
2451
|
import { Language, Parser } from "web-tree-sitter";
|
|
1996
2452
|
|
|
@@ -2851,7 +3307,7 @@ function emptyParseCache() {
|
|
|
2851
3307
|
}
|
|
2852
3308
|
async function readParseCache(path) {
|
|
2853
3309
|
try {
|
|
2854
|
-
const raw = await
|
|
3310
|
+
const raw = await readFile11(path, "utf8");
|
|
2855
3311
|
const parsed = JSON.parse(raw);
|
|
2856
3312
|
if (parsed.schema_version !== PARSE_CACHE_VERSION || typeof parsed.files !== "object" || parsed.files === null) {
|
|
2857
3313
|
return emptyParseCache();
|
|
@@ -2863,8 +3319,8 @@ async function readParseCache(path) {
|
|
|
2863
3319
|
}
|
|
2864
3320
|
async function writeParseCache(path, cache2) {
|
|
2865
3321
|
try {
|
|
2866
|
-
await mkdir5(
|
|
2867
|
-
await
|
|
3322
|
+
await mkdir5(dirname8(path), { recursive: true });
|
|
3323
|
+
await writeFile5(path, `${JSON.stringify(cache2)}
|
|
2868
3324
|
`, "utf8");
|
|
2869
3325
|
} catch {
|
|
2870
3326
|
}
|
|
@@ -2878,7 +3334,7 @@ async function incrementalParse(parsable, prev, opts = {}) {
|
|
|
2878
3334
|
for (const f of parsable) {
|
|
2879
3335
|
let source;
|
|
2880
3336
|
try {
|
|
2881
|
-
source = await
|
|
3337
|
+
source = await readFile11(f.absPath, "utf8");
|
|
2882
3338
|
} catch {
|
|
2883
3339
|
continue;
|
|
2884
3340
|
}
|
|
@@ -2909,8 +3365,8 @@ async function incrementalParse(parsable, prev, opts = {}) {
|
|
|
2909
3365
|
}
|
|
2910
3366
|
|
|
2911
3367
|
// src/scanner/walker.ts
|
|
2912
|
-
import { readFile as
|
|
2913
|
-
import { extname, join as
|
|
3368
|
+
import { readFile as readFile12, readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
3369
|
+
import { extname, join as join9, relative as relative2, sep as sep2 } from "path";
|
|
2914
3370
|
import ignore2 from "ignore";
|
|
2915
3371
|
var DEFAULT_IGNORE = [
|
|
2916
3372
|
".git/",
|
|
@@ -3000,7 +3456,7 @@ var BINARY_EXTS = /* @__PURE__ */ new Set([
|
|
|
3000
3456
|
]);
|
|
3001
3457
|
async function readIgnoreFile2(path) {
|
|
3002
3458
|
try {
|
|
3003
|
-
const text = await
|
|
3459
|
+
const text = await readFile12(path, "utf8");
|
|
3004
3460
|
return text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
|
|
3005
3461
|
} catch {
|
|
3006
3462
|
return [];
|
|
@@ -3009,8 +3465,8 @@ async function readIgnoreFile2(path) {
|
|
|
3009
3465
|
async function buildMatcher2(root, extra) {
|
|
3010
3466
|
const ig = ignore2();
|
|
3011
3467
|
ig.add(DEFAULT_IGNORE);
|
|
3012
|
-
ig.add(await readIgnoreFile2(
|
|
3013
|
-
ig.add(await readIgnoreFile2(
|
|
3468
|
+
ig.add(await readIgnoreFile2(join9(root, ".gitignore")));
|
|
3469
|
+
ig.add(await readIgnoreFile2(join9(root, ".synthraignore")));
|
|
3014
3470
|
if (extra.length) ig.add(extra);
|
|
3015
3471
|
return ig;
|
|
3016
3472
|
}
|
|
@@ -3023,273 +3479,66 @@ async function* walk(root, options = {}) {
|
|
|
3023
3479
|
async function* recurse(dir) {
|
|
3024
3480
|
let entries;
|
|
3025
3481
|
try {
|
|
3026
|
-
entries = await readdir2(dir, { withFileTypes: true });
|
|
3027
|
-
} catch {
|
|
3028
|
-
return;
|
|
3029
|
-
}
|
|
3030
|
-
for (const entry of entries) {
|
|
3031
|
-
const abs =
|
|
3032
|
-
const rel = relative2(root, abs);
|
|
3033
|
-
if (!rel) continue;
|
|
3034
|
-
const relPosix = toPosix2(rel);
|
|
3035
|
-
const matchPath = entry.isDirectory() ? `${relPosix}/` : relPosix;
|
|
3036
|
-
if (ig.ignores(matchPath)) continue;
|
|
3037
|
-
if (entry.isDirectory()) {
|
|
3038
|
-
yield* recurse(abs);
|
|
3039
|
-
} else if (entry.isFile()) {
|
|
3040
|
-
const ext = extname(entry.name).toLowerCase();
|
|
3041
|
-
if (BINARY_EXTS.has(ext)) continue;
|
|
3042
|
-
let size;
|
|
3043
|
-
try {
|
|
3044
|
-
const s = await
|
|
3045
|
-
size = s.size;
|
|
3046
|
-
} catch {
|
|
3047
|
-
continue;
|
|
3048
|
-
}
|
|
3049
|
-
if (size > maxFileSize) continue;
|
|
3050
|
-
yield { absPath: abs, relPath: relPosix, ext, size };
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
yield* recurse(root);
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
// src/graph/store.ts
|
|
3058
|
-
import { mkdir as mkdir6, readFile as readFile11, writeFile as writeFile5 } from "fs/promises";
|
|
3059
|
-
import { dirname as dirname8 } from "path";
|
|
3060
|
-
async function writeJson(path, data, pretty) {
|
|
3061
|
-
await mkdir6(dirname8(path), { recursive: true });
|
|
3062
|
-
const text = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
3063
|
-
await writeFile5(path, text + "\n", "utf8");
|
|
3064
|
-
}
|
|
3065
|
-
async function readJson2(path) {
|
|
3066
|
-
const text = await readFile11(path, "utf8");
|
|
3067
|
-
return JSON.parse(text);
|
|
3068
|
-
}
|
|
3069
|
-
async function writeGraph(path, graph) {
|
|
3070
|
-
await writeJson(path, graph, false);
|
|
3071
|
-
}
|
|
3072
|
-
async function readGraph(path) {
|
|
3073
|
-
return readJson2(path);
|
|
3074
|
-
}
|
|
3075
|
-
async function writeSymbolIndex(path, index) {
|
|
3076
|
-
await writeJson(path, index, true);
|
|
3077
|
-
}
|
|
3078
|
-
async function readSymbolIndex(path) {
|
|
3079
|
-
const parsed = await readJson2(path);
|
|
3080
|
-
return Object.assign(/* @__PURE__ */ Object.create(null), parsed);
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
|
-
// src/cli/bootstrap.ts
|
|
3084
|
-
import { mkdir as mkdir7, readFile as readFile13, stat as stat2, writeFile as writeFile7 } from "fs/promises";
|
|
3085
|
-
import { basename as basename5 } from "path";
|
|
3086
|
-
|
|
3087
|
-
// src/hooks/claude-md.ts
|
|
3088
|
-
import { readFile as readFile12, writeFile as writeFile6 } from "fs/promises";
|
|
3089
|
-
import { basename as basename4, dirname as dirname9 } from "path";
|
|
3090
|
-
var POLICY_VERSION = 9;
|
|
3091
|
-
var POLICY_BEGIN = `<!-- synthra-policy v${POLICY_VERSION} BEGIN -->`;
|
|
3092
|
-
var POLICY_END = `<!-- synthra-policy v${POLICY_VERSION} END -->`;
|
|
3093
|
-
var ANY_BLOCK_RE = /<!--\s*synthra-policy\s+v\d+\s+BEGIN\s*-->[\s\S]*?<!--\s*synthra-policy\s+v\d+\s+END\s*-->\s*/g;
|
|
3094
|
-
function stripPolicyBlock(content) {
|
|
3095
|
-
return content.replace(ANY_BLOCK_RE, "");
|
|
3096
|
-
}
|
|
3097
|
-
function policyBlock() {
|
|
3098
|
-
return [
|
|
3099
|
-
POLICY_BEGIN,
|
|
3100
|
-
"## Synthra context policy",
|
|
3101
|
-
"",
|
|
3102
|
-
"Synthra has pre-loaded structured context into this session and exposes",
|
|
3103
|
-
"the project's code graph through MCP tools. **Prefer these tools over",
|
|
3104
|
-
"Grep / Glob / Read** \u2014 they are faster, cheaper, and already filtered",
|
|
3105
|
-
"to relevant files.",
|
|
3106
|
-
"",
|
|
3107
|
-
"> **Tool namespace.** Synthra's MCP tools are exposed as",
|
|
3108
|
-
"> `mcp__synthra__graph_continue`, `mcp__synthra__graph_read`, and",
|
|
3109
|
-
"> `mcp__synthra__graph_register_edit`. **Short names will NOT resolve**",
|
|
3110
|
-
"> in ToolSearch or invocation \u2014 always use the full namespaced form.",
|
|
3111
|
-
"> If the tools are deferred, load their schemas with ToolSearch:",
|
|
3112
|
-
"> `select:mcp__synthra__graph_continue,mcp__synthra__graph_read,mcp__synthra__graph_register_edit,mcp__synthra__find_symbol,mcp__synthra__route_task`.",
|
|
3113
|
-
"> Below, short names (`graph_continue` etc.) appear in prose for",
|
|
3114
|
-
"> readability only.",
|
|
3115
|
-
"",
|
|
3116
|
-
"### Tools",
|
|
3117
|
-
"",
|
|
3118
|
-
"- **`graph_continue(query)`** \u2014 returns a `Confidence` label, the list",
|
|
3119
|
-
" of relevant `Files`, and signatures + top function bodies for those",
|
|
3120
|
-
" files. Your default first move when you need project context.",
|
|
3121
|
-
"- **`graph_read(target)`** \u2014 fetch source. Prefer the",
|
|
3122
|
-
' `"file/path.ts::SymbolName"` form over a bare file path \u2014 reading one',
|
|
3123
|
-
" symbol is ~50 tokens, reading a whole file is thousands.",
|
|
3124
|
-
"- **`graph_register_edit(files)`** \u2014 after you edit files, call this so",
|
|
3125
|
-
" subsequent turns weight your changes and avoid stale snapshots.",
|
|
3126
|
-
"- **`find_symbol(name)`** \u2014 **reuse-first**: before writing a new helper,",
|
|
3127
|
-
" util, or function, call this to check whether one already exists. If it",
|
|
3128
|
-
" returns matches, reuse or extend them instead of re-implementing; only",
|
|
3129
|
-
' "no match \u2014 safe to create" means it is genuinely new.',
|
|
3130
|
-
"- **`route_task(task)`** \u2014 **delegate-first**: before starting a multi-step",
|
|
3131
|
-
" implementation task, ask which installed subagent/skill fits it. Plan on",
|
|
3132
|
-
" the primary model, then hand execution to the recommended subagent on a",
|
|
3133
|
-
" cheaper model (sonnet \u2248 5\xD7 cheaper than opus). Synthra may also inject a",
|
|
3134
|
-
" `[Synthra route]` hint on your prompt \u2014 treat it the same way.",
|
|
3135
|
-
"",
|
|
3136
|
-
"### When to call `graph_continue` \u2014 and when to skip",
|
|
3137
|
-
"",
|
|
3138
|
-
"**Call `graph_continue` only when you do NOT already know the relevant",
|
|
3139
|
-
"files.**",
|
|
3140
|
-
"",
|
|
3141
|
-
"Call it when:",
|
|
3142
|
-
"- This is the first message of a new task or conversation",
|
|
3143
|
-
"- The task shifts to a different area of the codebase",
|
|
3144
|
-
"- You need files you haven't seen yet in this session",
|
|
3145
|
-
"",
|
|
3146
|
-
"**Skip `graph_continue` when:**",
|
|
3147
|
-
"- You already identified the relevant files earlier in this conversation",
|
|
3148
|
-
"- You are doing follow-up work on files already read (verify, refactor,",
|
|
3149
|
-
" test, docs, cleanup, commit)",
|
|
3150
|
-
"- The task is pure text (commit message, explanation, summary)",
|
|
3151
|
-
"",
|
|
3152
|
-
"If skipping, go directly to",
|
|
3153
|
-
'`mcp__synthra__graph_read("file.ts::symbol")` on what you already know.',
|
|
3154
|
-
"",
|
|
3155
|
-
"### Confidence caps",
|
|
3156
|
-
"",
|
|
3157
|
-
"When `graph_continue` returns:",
|
|
3158
|
-
"",
|
|
3159
|
-
"- **`Confidence: high`** \u2192 Stop. Do NOT Grep, Glob, or further explore",
|
|
3160
|
-
" for this query. The graph already has it.",
|
|
3161
|
-
"- **`Confidence: medium`** \u2192 Read the listed `Files` directly via",
|
|
3162
|
-
' `mcp__synthra__graph_read("file::symbol")` *before* trying Grep. The',
|
|
3163
|
-
" graph has narrowed the search space \u2014 use it, don't bypass it.",
|
|
3164
|
-
"- **`Confidence: low`** \u2192 You may use Grep / Glob, but the PreToolUse",
|
|
3165
|
-
" hook may still block redundant calls.",
|
|
3166
|
-
"",
|
|
3167
|
-
"### Reading code",
|
|
3168
|
-
"",
|
|
3169
|
-
"- **Always use `file::symbol` notation** with `graph_read`. Whole-file",
|
|
3170
|
-
" reads should be rare \u2014 only when you genuinely need the full file.",
|
|
3171
|
-
"- If `graph_continue`'s `Files` list contains a `::` entry, pass it",
|
|
3172
|
-
" verbatim to `graph_read`.",
|
|
3173
|
-
"- **Large file?** Don't read it in successive line-range chunks \u2014 call",
|
|
3174
|
-
" `mcp__synthra__graph_continue` or",
|
|
3175
|
-
' `mcp__synthra__graph_read("file::symbol")` to pull the one symbol you',
|
|
3176
|
-
" need. Chunked whole-file Reads are exactly the cost `graph_read`",
|
|
3177
|
-
" exists to avoid.",
|
|
3178
|
-
"",
|
|
3179
|
-
"### Editing a file",
|
|
3180
|
-
"",
|
|
3181
|
-
"Claude Code's `Edit` tool (and `Write` when overwriting) only accepts a",
|
|
3182
|
-
"file that was opened with the **`Read` tool** \u2014 a `graph_read` slice does",
|
|
3183
|
-
'not count, and editing such a file fails with *"File has not been read',
|
|
3184
|
-
'yet."* So before editing a file you only know through `graph_read`: take',
|
|
3185
|
-
"the line range from its header (e.g. `\u2026::handler (L120-168)`), `Read` that",
|
|
3186
|
-
"file with a matching `offset`/`limit`, then `Edit`. That satisfies the",
|
|
3187
|
-
"gate while keeping the read small \u2014 don't whole-file `Read` unless the",
|
|
3188
|
-
"edit spans most of the file.",
|
|
3189
|
-
"",
|
|
3190
|
-
"### Don'ts",
|
|
3191
|
-
"",
|
|
3192
|
-
"- Don't Grep / Glob before calling `graph_continue` when required \u2014 the",
|
|
3193
|
-
" PreToolUse hook may block it.",
|
|
3194
|
-
"- Don't call `graph_continue` more than once per turn.",
|
|
3195
|
-
"- Don't read whole files when a symbol-level read would suffice.",
|
|
3196
|
-
"",
|
|
3197
|
-
"### Resuming a session",
|
|
3198
|
-
"",
|
|
3199
|
-
'At session start the primer may begin with a **"Since you were last here"**',
|
|
3200
|
-
"digest \u2014 recent commits, files touched, open next-steps, and recent",
|
|
3201
|
-
"decisions carried over from the previous session. **Trust it.** It is the",
|
|
3202
|
-
"cheapest possible orientation: do NOT re-run `graph_continue` or Grep just",
|
|
3203
|
-
'to rediscover "what were we doing / what changed" \u2014 that work is already',
|
|
3204
|
-
"done. For the concrete next steps,",
|
|
3205
|
-
'`mcp__synthra__context_recall({kind:"next"})` returns them verbatim. Only',
|
|
3206
|
-
"reach for fresh retrieval when the task moves beyond what the digest",
|
|
3207
|
-
"covers.",
|
|
3208
|
-
"",
|
|
3209
|
-
"### Session-end resume note",
|
|
3210
|
-
"",
|
|
3211
|
-
`When the user signals they're done (e.g. "bye", "wrap up", "done"),`,
|
|
3212
|
-
"persist the resume state by calling `context_remember` once per bullet.",
|
|
3213
|
-
"Synthra re-renders `.synthra/CONTEXT.md` from those entries at session",
|
|
3214
|
-
"end \u2014 do **NOT** write to `CONTEXT.md` directly, it is a derived view",
|
|
3215
|
-
"and direct edits are overwritten by the Stop hook.",
|
|
3216
|
-
"",
|
|
3217
|
-
"Use these `kind` values:",
|
|
3218
|
-
"",
|
|
3219
|
-
'- **`kind: "task"`** \u2014 what is being worked on right now (1 entry)',
|
|
3220
|
-
'- **`kind: "decision"`** \u2014 non-obvious choices made this session (max 3)',
|
|
3221
|
-
'- **`kind: "next"`** \u2014 concrete next steps (max 3)',
|
|
3222
|
-
"",
|
|
3223
|
-
'Tag entries with the relevant area (`tags: ["auth"]`) and the files',
|
|
3224
|
-
'they touch (`files: ["src/auth.ts"]`) so later `context_recall` queries',
|
|
3225
|
-
"can filter. Keep each `text` to 1\u20132 sentences.",
|
|
3226
|
-
"",
|
|
3227
|
-
"_This block is managed by Synthra. Edits inside the BEGIN/END markers",
|
|
3228
|
-
"are overwritten on every `syn .` run._",
|
|
3229
|
-
"",
|
|
3230
|
-
POLICY_END
|
|
3231
|
-
].join("\n");
|
|
3232
|
-
}
|
|
3233
|
-
function onboardingSkeleton(projectName) {
|
|
3234
|
-
return [
|
|
3235
|
-
`# ${projectName}`,
|
|
3236
|
-
"",
|
|
3237
|
-
"> Onboarding notes for AI coding agents. Synthra's graph already knows the",
|
|
3238
|
-
"> code's *structure* (files, symbols, imports) \u2014 this file is for what the",
|
|
3239
|
-
"> graph can't infer: how to run the project, its conventions, and the",
|
|
3240
|
-
"> decisions behind them. Keep it lean and current; delete prompts you don't need.",
|
|
3241
|
-
"",
|
|
3242
|
-
"## Build & test",
|
|
3243
|
-
"",
|
|
3244
|
-
"- TODO: install deps / build",
|
|
3245
|
-
"- TODO: run tests / lint / typecheck",
|
|
3246
|
-
"- TODO: run the app locally",
|
|
3247
|
-
"",
|
|
3248
|
-
"## Conventions",
|
|
3249
|
-
"",
|
|
3250
|
-
"- TODO: code style, naming, file layout the agent should follow",
|
|
3251
|
-
"",
|
|
3252
|
-
"## Key decisions",
|
|
3253
|
-
"",
|
|
3254
|
-
'- TODO: non-obvious choices and *why* ("we use X not Y because \u2026")',
|
|
3255
|
-
"",
|
|
3256
|
-
"## Gotchas",
|
|
3257
|
-
"",
|
|
3258
|
-
`- TODO: traps, footguns, "don't touch X without Y"`,
|
|
3259
|
-
"",
|
|
3260
|
-
"_Tip: run `/init` in Claude Code to auto-draft the sections above, then trim",
|
|
3261
|
-
"to the durable bits. Synthra manages its own block below \u2014 leave it._",
|
|
3262
|
-
""
|
|
3263
|
-
].join("\n");
|
|
3264
|
-
}
|
|
3265
|
-
async function patchClaudeMd(path, projectName) {
|
|
3266
|
-
let existing;
|
|
3267
|
-
try {
|
|
3268
|
-
existing = await readFile12(path, "utf8");
|
|
3269
|
-
} catch {
|
|
3270
|
-
existing = null;
|
|
3271
|
-
}
|
|
3272
|
-
const block = policyBlock();
|
|
3273
|
-
if (existing === null) {
|
|
3274
|
-
const name = projectName || basename4(dirname9(path)) || "this project";
|
|
3275
|
-
await writeFile6(path, onboardingSkeleton(name) + "\n" + block + "\n", "utf8");
|
|
3276
|
-
return { created: true, updated: false, skipped: false };
|
|
3482
|
+
entries = await readdir2(dir, { withFileTypes: true });
|
|
3483
|
+
} catch {
|
|
3484
|
+
return;
|
|
3485
|
+
}
|
|
3486
|
+
for (const entry of entries) {
|
|
3487
|
+
const abs = join9(dir, entry.name);
|
|
3488
|
+
const rel = relative2(root, abs);
|
|
3489
|
+
if (!rel) continue;
|
|
3490
|
+
const relPosix = toPosix2(rel);
|
|
3491
|
+
const matchPath = entry.isDirectory() ? `${relPosix}/` : relPosix;
|
|
3492
|
+
if (ig.ignores(matchPath)) continue;
|
|
3493
|
+
if (entry.isDirectory()) {
|
|
3494
|
+
yield* recurse(abs);
|
|
3495
|
+
} else if (entry.isFile()) {
|
|
3496
|
+
const ext = extname(entry.name).toLowerCase();
|
|
3497
|
+
if (BINARY_EXTS.has(ext)) continue;
|
|
3498
|
+
let size;
|
|
3499
|
+
try {
|
|
3500
|
+
const s = await stat2(abs);
|
|
3501
|
+
size = s.size;
|
|
3502
|
+
} catch {
|
|
3503
|
+
continue;
|
|
3504
|
+
}
|
|
3505
|
+
if (size > maxFileSize) continue;
|
|
3506
|
+
yield { absPath: abs, relPath: relPosix, ext, size };
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3277
3509
|
}
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
const desired = base.length ? `${base}
|
|
3510
|
+
yield* recurse(root);
|
|
3511
|
+
}
|
|
3281
3512
|
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
await writeFile6(path,
|
|
3289
|
-
|
|
3513
|
+
// src/graph/store.ts
|
|
3514
|
+
import { mkdir as mkdir6, readFile as readFile13, writeFile as writeFile6 } from "fs/promises";
|
|
3515
|
+
import { dirname as dirname9 } from "path";
|
|
3516
|
+
async function writeJson(path, data, pretty) {
|
|
3517
|
+
await mkdir6(dirname9(path), { recursive: true });
|
|
3518
|
+
const text = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
3519
|
+
await writeFile6(path, text + "\n", "utf8");
|
|
3520
|
+
}
|
|
3521
|
+
async function readJson2(path) {
|
|
3522
|
+
const text = await readFile13(path, "utf8");
|
|
3523
|
+
return JSON.parse(text);
|
|
3524
|
+
}
|
|
3525
|
+
async function writeGraph(path, graph) {
|
|
3526
|
+
await writeJson(path, graph, false);
|
|
3527
|
+
}
|
|
3528
|
+
async function readGraph(path) {
|
|
3529
|
+
return readJson2(path);
|
|
3530
|
+
}
|
|
3531
|
+
async function writeSymbolIndex(path, index) {
|
|
3532
|
+
await writeJson(path, index, true);
|
|
3533
|
+
}
|
|
3534
|
+
async function readSymbolIndex(path) {
|
|
3535
|
+
const parsed = await readJson2(path);
|
|
3536
|
+
return Object.assign(/* @__PURE__ */ Object.create(null), parsed);
|
|
3290
3537
|
}
|
|
3291
3538
|
|
|
3292
3539
|
// src/cli/bootstrap.ts
|
|
3540
|
+
import { mkdir as mkdir7, readFile as readFile14, stat as stat3, writeFile as writeFile7 } from "fs/promises";
|
|
3541
|
+
import { basename as basename5 } from "path";
|
|
3293
3542
|
var GITIGNORE_ENTRIES = [
|
|
3294
3543
|
{
|
|
3295
3544
|
comment: "added by synthra (heavy generated state \u2014 gitignored by design)",
|
|
@@ -3300,23 +3549,23 @@ var GITIGNORE_ENTRIES = [
|
|
|
3300
3549
|
entry: ".mcp.json"
|
|
3301
3550
|
}
|
|
3302
3551
|
];
|
|
3303
|
-
async function
|
|
3552
|
+
async function exists2(path) {
|
|
3304
3553
|
try {
|
|
3305
|
-
await
|
|
3554
|
+
await stat3(path);
|
|
3306
3555
|
return true;
|
|
3307
3556
|
} catch {
|
|
3308
3557
|
return false;
|
|
3309
3558
|
}
|
|
3310
3559
|
}
|
|
3311
3560
|
async function ensureDir(path) {
|
|
3312
|
-
const had = await
|
|
3561
|
+
const had = await exists2(path);
|
|
3313
3562
|
await mkdir7(path, { recursive: true });
|
|
3314
3563
|
return !had;
|
|
3315
3564
|
}
|
|
3316
3565
|
async function patchGitignore(path) {
|
|
3317
3566
|
let existing = "";
|
|
3318
3567
|
try {
|
|
3319
|
-
existing = await
|
|
3568
|
+
existing = await readFile14(path, "utf8");
|
|
3320
3569
|
} catch {
|
|
3321
3570
|
}
|
|
3322
3571
|
const trimmed = new Set(existing.split(/\r?\n/).map((l) => l.trim()));
|
|
@@ -3332,7 +3581,7 @@ async function bootstrap(paths) {
|
|
|
3332
3581
|
const graphCreated = await ensureDir(paths.graphDir);
|
|
3333
3582
|
const contextCreated = await ensureDir(paths.contextDir);
|
|
3334
3583
|
const gitignoreUpdated = await patchGitignore(paths.gitignore);
|
|
3335
|
-
const claudeMdExistedBefore = await
|
|
3584
|
+
const claudeMdExistedBefore = await exists2(paths.claudeMd);
|
|
3336
3585
|
const patch = await patchClaudeMd(paths.claudeMd, basename5(paths.projectRoot));
|
|
3337
3586
|
return {
|
|
3338
3587
|
graphCreated,
|
|
@@ -3376,7 +3625,7 @@ var PARSABLE_EXTS = /* @__PURE__ */ new Set([
|
|
|
3376
3625
|
".cs"
|
|
3377
3626
|
]);
|
|
3378
3627
|
async function scanProject(projectRootRaw, opts = {}) {
|
|
3379
|
-
const projectRoot =
|
|
3628
|
+
const projectRoot = resolve2(projectRootRaw);
|
|
3380
3629
|
const paths = resolvePaths(projectRoot);
|
|
3381
3630
|
const start = Date.now();
|
|
3382
3631
|
const verbose = !opts.silent;
|
|
@@ -3492,44 +3741,6 @@ var LearnRuntime = class _LearnRuntime {
|
|
|
3492
3741
|
}
|
|
3493
3742
|
};
|
|
3494
3743
|
|
|
3495
|
-
// src/shared/config.ts
|
|
3496
|
-
function num(name, fallback) {
|
|
3497
|
-
const v = process.env[name];
|
|
3498
|
-
if (!v) return fallback;
|
|
3499
|
-
const n = Number(v);
|
|
3500
|
-
return Number.isFinite(n) ? n : fallback;
|
|
3501
|
-
}
|
|
3502
|
-
function str(name, fallback) {
|
|
3503
|
-
return process.env[name] ?? fallback;
|
|
3504
|
-
}
|
|
3505
|
-
function loadConfig() {
|
|
3506
|
-
return {
|
|
3507
|
-
hardMaxReadChars: num("SYN_HARD_MAX_READ_CHARS", 4e3),
|
|
3508
|
-
gateHintMaxChars: num("SYN_GATE_HINT_CHARS", 1200),
|
|
3509
|
-
readDepsMaxChars: num("SYN_READ_DEPS_CHARS", 900),
|
|
3510
|
-
turnReadBudgetChars: num("SYN_TURN_READ_BUDGET_CHARS", 18e3),
|
|
3511
|
-
fallbackMaxCallsPerTurn: num("SYN_FALLBACK_MAX_CALLS_PER_TURN", 1),
|
|
3512
|
-
retrieveCacheTtlSec: num("SYN_RETRIEVE_CACHE_TTL_SEC", 900),
|
|
3513
|
-
// Auto-reindex: re-run the incremental scan + swap the in-memory graph this
|
|
3514
|
-
// many ms after the last source-file change, so graph reads never go stale
|
|
3515
|
-
// mid-session. Set SYN_NO_AUTOREINDEX to disable entirely.
|
|
3516
|
-
reindexDebounceMs: num("SYN_REINDEX_DEBOUNCE_MS", 1e3),
|
|
3517
|
-
autoReindex: !process.env.SYN_NO_AUTOREINDEX,
|
|
3518
|
-
// Observe-only: log codebase-exploration Bash commands (grep/cat/find …) so
|
|
3519
|
-
// the terminal bypass of the Moat can be measured. Never blocks. Opt out
|
|
3520
|
-
// with SYN_NO_BASH_OBSERVE.
|
|
3521
|
-
bashObserve: !process.env.SYN_NO_BASH_OBSERVE,
|
|
3522
|
-
// The Dispatcher: per-prompt routing hints (best-fit agent/skill/model).
|
|
3523
|
-
// Silent unless the top agent clears routeMinScore. SYN_NO_ROUTE disables.
|
|
3524
|
-
route: !process.env.SYN_NO_ROUTE,
|
|
3525
|
-
routeMinScore: num("SYN_ROUTE_MIN_SCORE", 3),
|
|
3526
|
-
mcpPort: process.env.SYN_MCP_PORT ? num("SYN_MCP_PORT", 0) : null,
|
|
3527
|
-
dashboardPort: num("SYN_DASHBOARD_PORT", 8901),
|
|
3528
|
-
logLevel: str("SYN_LOG_LEVEL", "info"),
|
|
3529
|
-
claudeBin: str("SYN_CLAUDE_BIN", "claude")
|
|
3530
|
-
};
|
|
3531
|
-
}
|
|
3532
|
-
|
|
3533
3744
|
// src/server/mcp.ts
|
|
3534
3745
|
import { appendFile as appendFile4, mkdir as mkdir11 } from "fs/promises";
|
|
3535
3746
|
import { dirname as dirname13 } from "path";
|
|
@@ -3785,14 +3996,14 @@ async function retrieve(graph, query, options = {}) {
|
|
|
3785
3996
|
|
|
3786
3997
|
// src/memory/branches.ts
|
|
3787
3998
|
import { execFile as execFile2 } from "child_process";
|
|
3788
|
-
import { readFile as
|
|
3789
|
-
import { join as
|
|
3999
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
4000
|
+
import { join as join10 } from "path";
|
|
3790
4001
|
import { promisify as promisify2 } from "util";
|
|
3791
4002
|
var execFileAsync2 = promisify2(execFile2);
|
|
3792
4003
|
async function currentBranch(projectRoot) {
|
|
3793
4004
|
try {
|
|
3794
|
-
const headPath =
|
|
3795
|
-
const head = await
|
|
4005
|
+
const headPath = join10(projectRoot, ".git", "HEAD");
|
|
4006
|
+
const head = await readFile15(headPath, "utf8");
|
|
3796
4007
|
const trimmed = head.trim();
|
|
3797
4008
|
const match = trimmed.match(/^ref:\s+refs\/heads\/(.+)$/);
|
|
3798
4009
|
if (match?.[1]) return match[1];
|
|
@@ -3828,21 +4039,21 @@ function sanitizeBranchName(name) {
|
|
|
3828
4039
|
function resolveBranchPaths(contextDir, branch, isDefault) {
|
|
3829
4040
|
if (isDefault) {
|
|
3830
4041
|
return {
|
|
3831
|
-
contextStore:
|
|
3832
|
-
contextMd:
|
|
4042
|
+
contextStore: join10(contextDir, "context-store.json"),
|
|
4043
|
+
contextMd: join10(contextDir, "CONTEXT.md"),
|
|
3833
4044
|
branchDir: null
|
|
3834
4045
|
};
|
|
3835
4046
|
}
|
|
3836
|
-
const branchDir =
|
|
4047
|
+
const branchDir = join10(contextDir, "branches", sanitizeBranchName(branch));
|
|
3837
4048
|
return {
|
|
3838
|
-
contextStore:
|
|
3839
|
-
contextMd:
|
|
4049
|
+
contextStore: join10(branchDir, "context-store.json"),
|
|
4050
|
+
contextMd: join10(branchDir, "CONTEXT.md"),
|
|
3840
4051
|
branchDir
|
|
3841
4052
|
};
|
|
3842
4053
|
}
|
|
3843
4054
|
|
|
3844
4055
|
// src/memory/context-md.ts
|
|
3845
|
-
import { mkdir as mkdir8, readFile as
|
|
4056
|
+
import { mkdir as mkdir8, readFile as readFile16, writeFile as writeFile8 } from "fs/promises";
|
|
3846
4057
|
import { dirname as dirname10 } from "path";
|
|
3847
4058
|
var MAX_BULLETS = 3;
|
|
3848
4059
|
function deriveContextMd(entries, branch) {
|
|
@@ -3891,12 +4102,12 @@ async function writeContextMd(path, ctx) {
|
|
|
3891
4102
|
}
|
|
3892
4103
|
|
|
3893
4104
|
// src/memory/context-store.ts
|
|
3894
|
-
import { mkdir as mkdir9, readFile as
|
|
4105
|
+
import { mkdir as mkdir9, readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
|
|
3895
4106
|
import { dirname as dirname11 } from "path";
|
|
3896
4107
|
var SCHEMA_VERSION3 = 1;
|
|
3897
4108
|
async function readEntries(path) {
|
|
3898
4109
|
try {
|
|
3899
|
-
const raw = await
|
|
4110
|
+
const raw = await readFile17(path, "utf8");
|
|
3900
4111
|
const parsed = JSON.parse(raw);
|
|
3901
4112
|
return Array.isArray(parsed.entries) ? parsed.entries : [];
|
|
3902
4113
|
} catch {
|
|
@@ -5452,12 +5663,12 @@ async function getChangedLineRanges(projectRoot, sinceRef) {
|
|
|
5452
5663
|
}
|
|
5453
5664
|
|
|
5454
5665
|
// src/memory/session.ts
|
|
5455
|
-
import { mkdir as mkdir12, readFile as
|
|
5666
|
+
import { mkdir as mkdir12, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
5456
5667
|
import { dirname as dirname14 } from "path";
|
|
5457
5668
|
var SESSION_SCHEMA_VERSION = 2;
|
|
5458
5669
|
async function readSession(path) {
|
|
5459
5670
|
try {
|
|
5460
|
-
const raw = await
|
|
5671
|
+
const raw = await readFile18(path, "utf8");
|
|
5461
5672
|
const parsed = JSON.parse(raw);
|
|
5462
5673
|
if (parsed.schema_version !== SESSION_SCHEMA_VERSION) return null;
|
|
5463
5674
|
return parsed;
|
|
@@ -6049,8 +6260,8 @@ async function loadContext(paths) {
|
|
|
6049
6260
|
readGraph(paths.infoGraph),
|
|
6050
6261
|
readSymbolIndex(paths.symbolIndex)
|
|
6051
6262
|
]);
|
|
6052
|
-
if (graph.schema_version !==
|
|
6053
|
-
log.info(`graph schema v${graph.schema_version} \u2260 current v${
|
|
6263
|
+
if (graph.schema_version !== SCHEMA_VERSION) {
|
|
6264
|
+
log.info(`graph schema v${graph.schema_version} \u2260 current v${SCHEMA_VERSION} \u2014 rescanning\u2026`);
|
|
6054
6265
|
await scanProject(paths.projectRoot, { silent: true });
|
|
6055
6266
|
[graph, symbolIndex] = await Promise.all([
|
|
6056
6267
|
readGraph(paths.infoGraph),
|
|
@@ -6162,15 +6373,15 @@ async function startServer(paths, options = {}) {
|
|
|
6162
6373
|
}
|
|
6163
6374
|
|
|
6164
6375
|
// src/cli/session-discovery.ts
|
|
6165
|
-
import { readdir as readdir3, stat as
|
|
6166
|
-
import { homedir as
|
|
6167
|
-
import { join as
|
|
6376
|
+
import { readdir as readdir3, stat as stat4 } from "fs/promises";
|
|
6377
|
+
import { homedir as homedir4 } from "os";
|
|
6378
|
+
import { join as join11 } from "path";
|
|
6168
6379
|
function encodeProjectPath(projectRoot) {
|
|
6169
6380
|
return projectRoot.replace(/[\\/:]/g, "-");
|
|
6170
6381
|
}
|
|
6171
6382
|
async function findLatestSession(projectRoot) {
|
|
6172
6383
|
const encoded = encodeProjectPath(projectRoot);
|
|
6173
|
-
const dir =
|
|
6384
|
+
const dir = join11(homedir4(), ".claude", "projects", encoded);
|
|
6174
6385
|
let entries;
|
|
6175
6386
|
try {
|
|
6176
6387
|
entries = await readdir3(dir);
|
|
@@ -6181,9 +6392,9 @@ async function findLatestSession(projectRoot) {
|
|
|
6181
6392
|
if (jsonlFiles.length === 0) return null;
|
|
6182
6393
|
let latest = null;
|
|
6183
6394
|
for (const file of jsonlFiles) {
|
|
6184
|
-
const path =
|
|
6395
|
+
const path = join11(dir, file);
|
|
6185
6396
|
try {
|
|
6186
|
-
const s = await
|
|
6397
|
+
const s = await stat4(path);
|
|
6187
6398
|
if (!latest || s.mtime > latest.modifiedAt) {
|
|
6188
6399
|
latest = {
|
|
6189
6400
|
sessionId: file.replace(/\.jsonl$/, ""),
|
|
@@ -6209,9 +6420,9 @@ async function cleanup(paths) {
|
|
|
6209
6420
|
}
|
|
6210
6421
|
|
|
6211
6422
|
// src/cli/dashboard-command.ts
|
|
6212
|
-
import { resolve as
|
|
6423
|
+
import { resolve as resolve3 } from "path";
|
|
6213
6424
|
async function dashboardCommand(rawPath) {
|
|
6214
|
-
const projectRoot =
|
|
6425
|
+
const projectRoot = resolve3(rawPath);
|
|
6215
6426
|
const paths = resolvePaths(projectRoot);
|
|
6216
6427
|
const cfg = loadConfig();
|
|
6217
6428
|
const handle = await startDashboard(paths, cfg.dashboardPort);
|
|
@@ -6235,181 +6446,18 @@ async function dashboardCommand(rawPath) {
|
|
|
6235
6446
|
});
|
|
6236
6447
|
}
|
|
6237
6448
|
|
|
6238
|
-
// src/cli/doctor-command.ts
|
|
6239
|
-
import { readFile as readFile18, stat as stat4 } from "fs/promises";
|
|
6240
|
-
import { join as join11, resolve as resolve3 } from "path";
|
|
6241
|
-
import spawn from "cross-spawn";
|
|
6242
|
-
var ICON = { ok: "\u2705", warn: "\u26A0\uFE0F", fail: "\u274C" };
|
|
6243
|
-
function binWorks(bin, args) {
|
|
6244
|
-
return new Promise((res) => {
|
|
6245
|
-
let proc;
|
|
6246
|
-
try {
|
|
6247
|
-
proc = spawn(bin, args, { stdio: "ignore" });
|
|
6248
|
-
} catch {
|
|
6249
|
-
res(false);
|
|
6250
|
-
return;
|
|
6251
|
-
}
|
|
6252
|
-
proc.on("error", () => res(false));
|
|
6253
|
-
proc.on("exit", (code) => res(code === 0));
|
|
6254
|
-
});
|
|
6255
|
-
}
|
|
6256
|
-
async function exists2(path) {
|
|
6257
|
-
try {
|
|
6258
|
-
await stat4(path);
|
|
6259
|
-
return true;
|
|
6260
|
-
} catch {
|
|
6261
|
-
return false;
|
|
6262
|
-
}
|
|
6263
|
-
}
|
|
6264
|
-
async function runDoctorChecks(projectRoot) {
|
|
6265
|
-
const paths = resolvePaths(projectRoot);
|
|
6266
|
-
const cfg = loadConfig();
|
|
6267
|
-
const checks = [];
|
|
6268
|
-
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
6269
|
-
checks.push(
|
|
6270
|
-
nodeMajor >= 18 ? { status: "ok", label: "Node", detail: `v${process.versions.node}` } : {
|
|
6271
|
-
status: "fail",
|
|
6272
|
-
label: "Node",
|
|
6273
|
-
detail: `v${process.versions.node} \u2014 Synthra needs Node >= 18`
|
|
6274
|
-
}
|
|
6275
|
-
);
|
|
6276
|
-
const hasJq = await binWorks("jq", ["--version"]);
|
|
6277
|
-
if (process.platform === "win32") {
|
|
6278
|
-
checks.push({
|
|
6279
|
-
status: "ok",
|
|
6280
|
-
label: "jq",
|
|
6281
|
-
detail: hasJq ? "present (not required \u2014 Windows uses .ps1 hooks)" : "not required on Windows (.ps1 hooks)"
|
|
6282
|
-
});
|
|
6283
|
-
} else {
|
|
6284
|
-
checks.push(
|
|
6285
|
-
hasJq ? { status: "ok", label: "jq", detail: "present" } : {
|
|
6286
|
-
status: "warn",
|
|
6287
|
-
label: "jq",
|
|
6288
|
-
detail: "missing \u2014 Stop/PreToolUse bash hooks silently no-op (no token logging or gating). Install jq (brew/apt)."
|
|
6289
|
-
}
|
|
6290
|
-
);
|
|
6291
|
-
}
|
|
6292
|
-
const hasClaude = await binWorks(cfg.claudeBin, ["--version"]);
|
|
6293
|
-
checks.push(
|
|
6294
|
-
hasClaude ? { status: "ok", label: "claude CLI", detail: `'${cfg.claudeBin}' on PATH` } : {
|
|
6295
|
-
status: "warn",
|
|
6296
|
-
label: "claude CLI",
|
|
6297
|
-
detail: `'${cfg.claudeBin}' not found \u2014 MCP registration + IDE need it (set SYN_CLAUDE_BIN to override).`
|
|
6298
|
-
}
|
|
6299
|
-
);
|
|
6300
|
-
if (!await exists2(paths.infoGraph)) {
|
|
6301
|
-
checks.push({
|
|
6302
|
-
status: "warn",
|
|
6303
|
-
label: "Graph",
|
|
6304
|
-
detail: "no info_graph.json \u2014 run `syn .` (or `syn scan`) here."
|
|
6305
|
-
});
|
|
6306
|
-
} else {
|
|
6307
|
-
try {
|
|
6308
|
-
const graph = JSON.parse(await readFile18(paths.infoGraph, "utf8"));
|
|
6309
|
-
const parts = [`${graph.symbol_count} symbols`, `${graph.file_count} files`];
|
|
6310
|
-
let status = "ok";
|
|
6311
|
-
const ageMs = Date.now() - Date.parse(graph.generated_at);
|
|
6312
|
-
if (Number.isFinite(ageMs))
|
|
6313
|
-
parts.push(`scanned ${Math.max(0, Math.round(ageMs / 6e4))}m ago`);
|
|
6314
|
-
if (graph.schema_version !== SCHEMA_VERSION2) {
|
|
6315
|
-
status = "warn";
|
|
6316
|
-
parts.push(`schema v${graph.schema_version} \u2260 v${SCHEMA_VERSION2} (auto-rescans on serve)`);
|
|
6317
|
-
}
|
|
6318
|
-
if (graph.symbol_count === 0) {
|
|
6319
|
-
status = "warn";
|
|
6320
|
-
parts.push("0 symbols \u2014 unsupported language or nothing indexed");
|
|
6321
|
-
}
|
|
6322
|
-
checks.push({ status, label: "Graph", detail: parts.join(" \xB7 ") });
|
|
6323
|
-
} catch {
|
|
6324
|
-
checks.push({
|
|
6325
|
-
status: "warn",
|
|
6326
|
-
label: "Graph",
|
|
6327
|
-
detail: "info_graph.json unreadable \u2014 re-run `syn scan`."
|
|
6328
|
-
});
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6331
|
-
checks.push(
|
|
6332
|
-
await exists2(join11(projectRoot, ".mcp.json")) ? {
|
|
6333
|
-
status: "ok",
|
|
6334
|
-
label: "MCP registration",
|
|
6335
|
-
detail: ".mcp.json present (IDE can see graph_* tools)"
|
|
6336
|
-
} : {
|
|
6337
|
-
status: "warn",
|
|
6338
|
-
label: "MCP registration",
|
|
6339
|
-
detail: "no .mcp.json \u2014 the IDE extension won't see Synthra's tools; run `syn .`."
|
|
6340
|
-
}
|
|
6341
|
-
);
|
|
6342
|
-
if (!await exists2(paths.claudeMd)) {
|
|
6343
|
-
checks.push({
|
|
6344
|
-
status: "warn",
|
|
6345
|
-
label: "CLAUDE.md policy",
|
|
6346
|
-
detail: "no CLAUDE.md \u2014 run `syn .` to scaffold + inject the policy block."
|
|
6347
|
-
});
|
|
6348
|
-
} else {
|
|
6349
|
-
const md = await readFile18(paths.claudeMd, "utf8");
|
|
6350
|
-
if (md.includes(`synthra-policy v${POLICY_VERSION} BEGIN`)) {
|
|
6351
|
-
checks.push({
|
|
6352
|
-
status: "ok",
|
|
6353
|
-
label: "CLAUDE.md policy",
|
|
6354
|
-
detail: `policy block v${POLICY_VERSION}`
|
|
6355
|
-
});
|
|
6356
|
-
} else {
|
|
6357
|
-
const m = md.match(/synthra-policy v(\d+) BEGIN/);
|
|
6358
|
-
checks.push({
|
|
6359
|
-
status: "warn",
|
|
6360
|
-
label: "CLAUDE.md policy",
|
|
6361
|
-
detail: m ? `policy block is v${m[1]}, current is v${POLICY_VERSION} \u2014 re-run \`syn .\` to refresh.` : "no synthra-policy block \u2014 run `syn .`."
|
|
6362
|
-
});
|
|
6363
|
-
}
|
|
6364
|
-
}
|
|
6365
|
-
if (!await exists2(paths.claudeSettings)) {
|
|
6366
|
-
checks.push({
|
|
6367
|
-
status: "warn",
|
|
6368
|
-
label: "Hooks",
|
|
6369
|
-
detail: "no .claude/settings.local.json \u2014 run `syn .` to install hooks."
|
|
6370
|
-
});
|
|
6371
|
-
} else {
|
|
6372
|
-
const s = await readFile18(paths.claudeSettings, "utf8");
|
|
6373
|
-
checks.push(
|
|
6374
|
-
s.includes("synthra-hook=true") ? { status: "ok", label: "Hooks", detail: "registered in .claude/settings.local.json" } : {
|
|
6375
|
-
status: "warn",
|
|
6376
|
-
label: "Hooks",
|
|
6377
|
-
detail: "settings.local.json present but no Synthra hooks \u2014 run `syn .`."
|
|
6378
|
-
}
|
|
6379
|
-
);
|
|
6380
|
-
}
|
|
6381
|
-
return checks;
|
|
6382
|
-
}
|
|
6383
|
-
async function doctorCommand(rawPath) {
|
|
6384
|
-
const projectRoot = resolve3(rawPath);
|
|
6385
|
-
const checks = await runDoctorChecks(projectRoot);
|
|
6386
|
-
log.info("");
|
|
6387
|
-
log.info(` Synthra doctor \u2014 ${projectRoot}`);
|
|
6388
|
-
log.info("");
|
|
6389
|
-
for (const c of checks) {
|
|
6390
|
-
log.info(` ${ICON[c.status]} ${c.label.padEnd(18)}${c.detail}`);
|
|
6391
|
-
}
|
|
6392
|
-
const warn = checks.filter((c) => c.status === "warn").length;
|
|
6393
|
-
const fail = checks.filter((c) => c.status === "fail").length;
|
|
6394
|
-
log.info("");
|
|
6395
|
-
log.info(
|
|
6396
|
-
fail === 0 && warn === 0 ? " All checks passed." : ` ${fail} failed \xB7 ${warn} warning(s).`
|
|
6397
|
-
);
|
|
6398
|
-
log.info("");
|
|
6399
|
-
}
|
|
6400
|
-
|
|
6401
6449
|
// src/cli/remove-command.ts
|
|
6402
6450
|
import { readFile as readFile20, readdir as readdir4, rm, rmdir, stat as stat5, unlink, writeFile as writeFile13 } from "fs/promises";
|
|
6403
6451
|
import { basename as basename6, join as join13, resolve as resolve4 } from "path";
|
|
6404
6452
|
|
|
6405
6453
|
// src/cli/self-update.ts
|
|
6406
6454
|
import { mkdir as mkdir16, readFile as readFile19, writeFile as writeFile12 } from "fs/promises";
|
|
6407
|
-
import { homedir as
|
|
6455
|
+
import { homedir as homedir5 } from "os";
|
|
6408
6456
|
import { join as join12 } from "path";
|
|
6409
6457
|
import { createInterface } from "readline/promises";
|
|
6410
6458
|
import spawn2 from "cross-spawn";
|
|
6411
6459
|
var PKG_NAME = "@jefuriiij/synthra";
|
|
6412
|
-
var SYNTHRA_DIR = join12(
|
|
6460
|
+
var SYNTHRA_DIR = join12(homedir5(), ".synthra");
|
|
6413
6461
|
var LAST_SEEN_PATH = join12(SYNTHRA_DIR, "last-seen-version.json");
|
|
6414
6462
|
var REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PKG_NAME)}/latest`;
|
|
6415
6463
|
var FETCH_TIMEOUT_MS = 2e3;
|
|
@@ -6968,8 +7016,8 @@ function buildProgram() {
|
|
|
6968
7016
|
prog.command("dashboard [path]", "Run the token dashboard server (localhost:8901).").action(async (path) => {
|
|
6969
7017
|
await dashboardCommand(path ?? ".");
|
|
6970
7018
|
});
|
|
6971
|
-
prog.command("doctor [path]", "Diagnose this project's Synthra setup + environment.").action(async (path) => {
|
|
6972
|
-
await doctorCommand(path ?? ".");
|
|
7019
|
+
prog.command("doctor [path]", "Diagnose this project's Synthra setup + environment.").option("--report", "Emit a copy-pasteable markdown diagnostic (for GitHub issues)", false).action(async (path, opts) => {
|
|
7020
|
+
await doctorCommand(path ?? ".", { report: opts.report, version: VERSION2 });
|
|
6973
7021
|
});
|
|
6974
7022
|
prog.command(
|
|
6975
7023
|
"remove [path]",
|